Welcome to HackerRank DSL (Domain Specific Language) Documentation! You can use our the DSL to generate code stubs that read test case data from standard input in hackerrank challenges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Programming Contest Template | |
| //Shafaet Ashraf | |
| #include <bits/stdc++.h> | |
| #define stream istringstream | |
| #define rep(i,n) for(int i=0; i<(int)n; i++) | |
| #define repv(i,n) for(int i=n-1; i>=0; i--) | |
| #define repl(i,n) for(int i=1; i<=(int)n; i++) | |
| #define replv(i,n) for(int i=n; i>=1; i--) | |
| #define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| list=["user1",user2"] | |
| list.each do |name| | |
| h=Hacker.find_by_username(name) | |
| m=Message.where(receiver_id: h.id) | |
| puts h.id,m | |
| end | |
| #it will output only hackerid's if nobody sent any messages, otherwise it will print list of messages too |
OlderNewer
