akhauriyash/Code-Regression huggingface dataset:
from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy

# 入力 =stdin.readline().rstrip()
# 分割 = stdin.readline().rstrip().split()

'''
条件に合うものを絞り込む
data = [1, 2, 3]
s = [x for x in data if x % 3 == 0]
'''

'''
文字配列を数値に
l_si = ['-10', '0', '100']

l_si_i = [int(s) for s in l_si]
'''

'''
a = [2, 4, 6, 8]
b = [3, 6, 9]

print(list(set(a) | set(b)))  # 和集合
print(list(set(a) & set(b)))  # 積集合
'''

'''
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
count = 0
while len([x for x in A if x % 2 == 0]) == N:
    A = list(map(lambda y: y / 2, A))
    count += 1
print(count)
'''

'''
.append(要素)
.extend(要素)
.insert(場所,要素)
del 配列名[場所]
-1で末尾で末尾から一つ前
'''
'''
間に空白追加
' '.join(lis)
'''
'''
copy.copy(配列名)
'''
'''
sort()
sorted(reverse=true)
'''
'''
2分探索
bisect.bisect_left(リスト, 要素)
'''
num = stdin.readline().rstrip().split()
num1 = int(num[0])
num2 = int(num[1])
if (num1 >= 10 or num2 >= 10):
    print(-1)
else:
    print(num1*num2)


Measured memory_bytes: 3696
#include <stdio.h>

int main(void)
{
    unsigned long long int N, answer = 0;
    scanf("%llu", &N);

    for (int i = 1; i <= N; i++)
    {
        if (i%3 == 0 || i%5 == 0)
        {
            continue;
        }
        
        answer += i;
    }

    printf("%llu", answer);
    
    return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
int main() {
  
  int a,b;
  cin>>a>>b;
  
  if(a>=13) cout << b;
  if(a<=12 && a>=6) cout << int(b/2);
  if(a<=5) cout << 0;
  cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;

int main(){
    int n;
    cin>>n;
    int h[n];
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    int dp[n];
    dp[0] = 0;
    dp[1] = abs(h[0]-h[1]) + dp[0];
    for(int i=2;i<n;i++){
        dp[i] = min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2]);
    }
    cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
	int S,h,m,s;
	
	scanf("%d",&S);
	h=S/3600;
	m=S%3600/60;
	s=S%3600%60;
	printf("%d:%d:%d\n",h,m,s);
	
	return 0;
}

Measured memory_bytes: 592
#include<iostream>
using namespace std;

int main() {
  long long x;
  cin >> x;
  long long q = x/11;
  long long r = x%11;

  if (r == 0) cout << 2 * q << endl;
  else if (r > 0 && r < 7) cout << 2 * q + 1 << endl;
  else if (r >= 7) cout << 2 * q + 2 << endl;
}


Measured memory_bytes: 256
/*#pragma GCC optimize("Ofast",3,"inline")
#include <bits/stdc++.h>
using namespace std;
double a[60];
double x[60];
int n;
void dfs(int step,double cnt){
	if(step==n-1){
		
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++){
//		cin>>a[i];
		a[i]=i+1;
	}
	sort(a,a+n);
	dfs(0,0);
	return 0;
}
*/
#pragma GCC optimize("Ofast",3,"inline")
#include <bits/stdc++.h>
using namespace std;
double a[60];
double ans;
int n;
int main(){
	ios_base::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int i=0;i<n-1;i++){
		double x=a[0];
		double y=a[1];
		double z=(x+y)/2;
		a[0]=999999;
		a[1]=999999;
		a[0]=z;
		sort(a,a+n);
	}
	cout<<a[0];
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

typedef long double ld;

int main() {
  int N,sum;
  cin>>N;
  vector<int> L(N);
  sum = 0;
  for(int i = 0; i < N; i++) {
    cin>>L[i];
    sum+= L[i];
  }
  sort(L.begin(),L.end());
  if (L[N-1] < sum - L[N-1]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
typedef struct {
    ll lv;
    ll rv;
} Q;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll P[100010];
    rep(i,0,N) cin >> P[i];
    vector<Q> arr(100010);
    arr[0] = (Q){-1, 1};
    arr[1] = (Q){0, 2};
    rep(i,0,N){
        arr[i+2] = (Q){i+1, i+3};
    }
    arr[N+2] = (Q){N+1, N+3};
    arr[N+3] = (Q){N+2, N+4};
    ll pos[100010] = {};
    rep(i,0,N) pos[P[i]] = i+2;

    ll ans = 0;
    rep(n,1,N){
        ll p = pos[n];
        ll lv = arr[p].lv;
        ll lv2 = arr[lv].lv;
        ll rv = arr[p].rv;
        ll rv2 = arr[rv].rv;
        if(lv != 1){
            ans += n * (lv - lv2) * (rv - p);
        }
        if(rv != N+2){
            ans += n * (rv2 - rv) * (p - lv);
        }

        arr[lv].rv = arr[p].rv;
        arr[rv].lv = arr[p].lv;
    }
    print(ans);



    
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    long long ans = 1;
    for (int i=1; i<=n; i++) {
        ans = (ans * i) % 1000000007;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

#define all(x)        (x).begin(),(x).end()
#define eb            emplace_back
#define mp            make_pair
#define pb            push_back
#define fi            first
#define se            second
#define sz(x)         ((int)(x).size())
#define rep(x,y,z)    for(int x=y;x<z;x++)
#define per(x,z,y)    for(int x=z-1;x>=y;x--)
#define trav(y,x)     for(auto& y:x)
#define pii           pair<int, int>
#define pll           pair<ll, ll>
#define vi            vector<int>
#define vll           vector<ll> 
#define vpi           vector<pii>

int dbg = 0;
#define cri           if(0)
#define shame         cri cerr<<(++dbg)<<"\n\n";

// aaaaaaaaaaaaaaaa
void solve() {
  // C+T=X 2*C+4*T=Y
  //       2*T=Y-2*X
  // T=(Y-2*X)/2
  int x,y; cin>>x>>y;
  if (y&1||2*x>y) cout<<"No\n";
  else {
    int t=(y-2*x)/2;
    int c=x-t;
    if (c<0) cout<<"No\n";
    else cout<<"Yes\n";
  }
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  // int _; cin >> _; while(_--)
  solve();
	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < b; ++i)

const int N = 5e5;
int n, k, c, pre[N], suf[N];
string s;

main() {
    cin >> n >> k >> c >> s;
    s = ' ' + s;
    rep(i, 1, n + 1) {
        if (s[i] == 'x') {
            pre[i] = pre[i - 1];
        } else {
            pre[i] = 1 + pre[max(0, i - c - 1)];
        }
    }
    for (int i = n; i >= 1; --i) {
        if (s[i] == 'x') {
            suf[i] = suf[i + 1];
        } else {
            suf[i] = 1 + suf[min(n + 1, i + c + 1)];
        }
    }
    rep(i, 1, n + 1) {
        if (pre[i - 1] + suf[i + 1] < k) {
            printf("%d\n", i);
        }
    }
}

Measured memory_bytes: 3392
#include <bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

void solve(){
    string s;
    cin>>s;
    string revs=s;
    reverse(all(revs));
    string t=s.substr(0,sz(s)/2);
    string revt=t;
    reverse(all(revt));
    if(s==revs and t==revt) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#include <cstring>
#include <cstdio>
#include <stack>
#define INF 1000000000
#define rep(i,n) for(int i =0;i<n;i++)
using namespace std;
typedef long long int ll;

int main(){
    for(;;){
        int t,p,r;
        cin >> t >> p >> r;
        if(!t and !p and !r) break;
        int g[t][p+3];
        memset(g, 0, sizeof(g));
        for (int i=0; i<r; i++) {
            int tid,pid,time;
            string message;
            cin >> tid >> pid >> time >> message;
            if (message=="CORRECT") {
                g[tid-1][p+1]++;
                g[tid-1][p+2]+=(time+g[tid-1][pid]*1200);
            }else{
                g[tid-1][pid]++;
            }
        }
        vector<pair<int, pair<int, int> > > h;
        for (int i=0; i<t; i++) {
            h.push_back({p-g[i][p+1],{g[i][p+2],i+1}});
        }
        sort(h.begin(), h.end());
        for (int i=0; i<h.size(); i++) {
            cout << h[i].second.second <<" "<<p-h[i].first<<" "<<h[i].second.first<<endl;
        }
    }
}

Measured memory_bytes: 1228
/*
*  Problem Link: https://atcoder.jp/contests/abc168/tasks/abc168_b
*  Author: Raunak Sett
*/
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long 
#define vi vector<int>
int main() {
    IOS
    // Code Here
    int k;
    cin>>k;
    string s;
    cin>>s;
    int size = s.length();
    int l = min(size, k);
    for (int i=0; i < l; i++) {
        cout<<s[i];
    }
    if (k < s.length()) {
        cout<<"...";
    }
    cout<<"\n";
    return 0;
}

Measured memory_bytes: 3648
n = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ctr = [0] * 60
for a in A:
    for i in range(60):
        if (a>>i) & 1:
            ctr[i] += 1

ans = 0
for d, num1 in enumerate(ctr):
    num0 = n - num1
    ans += num0 * num1 * 2**d
    ans %= MOD

print(ans)

Measured memory_bytes: 122808
#include <bits/stdc++.h>
#define ll                  long long
#define pb                  push_back
#define pf                  push_front
#define mp                  make_pair
#define in                  insert
#define sz(a)               (int)(a).size()
#define all(x)              (x).begin(), (x).end()
#define fore(i,a,b)         for(ll i=a; i<b; i+=1)
#define forr(i,a)           for(ll i=a; i>=0; i-=1)
#define forg(i,b,e,c)       for (ll i=(ll)b; i<(ll)e; i+=c)
#define ford(i,a)           for(auto i=a.begin(); i!=a.end(); i++) 
#define F first
#define S second
#define clr(a,val)          memset(a,val,sizeof (a))
#define min3(a, b, c)       min(min(a, b), c)
#define min4(a, b, c, d)    min(min(a, b), min(c, d))
#define max3(a, b, c)       max(max(a, b), c)
#define max4(a, b, c, d)    max(max(a, b), max(c, d))
#define endl "\n"
#define printV(arr)         fore(x,0,sz(arr)) cout << arr[x] <<" "; cout<<endl;
#define printR(arr,a,b)     fore(x,a,b) cout << arr[x] <<" "; cout<<endl;
#define setp(x)             fixed<<setprecision(x)
 
 
using namespace std;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll,ll> lll;
typedef vector<ii> vii;
typedef vector<lll> vlll;
typedef pair<string, int> si;
typedef pair<int, string> is;
typedef vector<string> vs;
const int MAX=1e5+10;
const int MOD=1000000009;
const double pi=acos(-1);
const int dx[]={0,1,-1,0};
const int dy[]={-1,0,0,1};
const int dxc[]={0,2,-2,0,2,2,-2,-2};
const int dyc[]={-2,0,0,2,-2,2,-2,2};
 
ll min(ll a, ll b){
    if(a>b) return b;
    return a;
}
ll max(ll a, ll b){
    if(a>b) return a;
    return b;
}
 
ll gcd(ll a, ll b){
    while(b!=0){
        a%=b;
        swap(a,b);
    }
    return a;
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}
bool isPrime(ll n){
    if(n<=1) return false;
    if(n==2) return true;
    if(n%2==0) return false;
    for(ll i=3; i*i<=n; i+=2){
        if(n%i==0) return false;
    }
    return true;
}
 
set<ll> gen(ll n){
    set<ll> divs;
    for(ll i=1; i*i<=n; i++){
        if(n%i==0){
            divs.insert(i);
            divs.insert(n/i);
        }
    }
    return divs;
}
 
map<ll, int> fact(ll n){
    map<ll, int> F;
    for(ll p = 2; p*p <= n; p++){
        while(n%p == 0){
            F[p]++;
            n /= p;
        }
    }   
    if(n > 1) F[n]++;
    return F;
}
 
ll sum(ll n){
    return (n*(n+1))/2;
}
 
ll binaryExp(ll a, ll b, ll c){
    if(b==0) return 1;
    if(b%2==0){
        ll temp=binaryExp(a,b/2,c);
        return (temp*temp)%c;
    }
    else{
        ll temp=binaryExp(a,b-1,c);
        return (temp*a)%c;
    }
}
 
bool isPal(string& cad){
    int p1=sz(cad)-1;
    fore(i,0,sz(cad)/2){
        if(cad[i]!=cad[p1]) return false;
        p1--;
    }
    return true;
}

double dis(double x1,double y1, double x2, double y2){
    double ff=pow(x2-x1,2)+pow(y2-y1,2);
    return sqrt(ff);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    double d,t,v; cin>>d>>t>>v;
    if(d/v<=t) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 3700
import java.util.*;
import java.io.*;
class Main{
	public static void main(String[]args) throws IOException{
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		//Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out, true);
		int n=Integer.parseInt(in.readLine());
		Deque<String> list=new ArrayDeque<>();
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<n;i++){
			String str[]=in.readLine().split(" ");
			if(str[0].equals("insert"))
				list.addFirst(str[1]);
			else if(str[0].equals("delete"))
				try{
					list.remove(str[1]);
				}catch(Exception e){
					continue;
				}
			else if(str[0].equals("deleteFirst"))
				list.removeFirst();
			else if(str[0].equals("deleteLast"))
				list.removeLast();
		}
		if(!list.isEmpty()){
			sb.append(list.getFirst());
			list.removeFirst();
		}
		while(!list.isEmpty()){
			sb.append(" ").append(list.getFirst());
			list.removeFirst();
		}
		out.println(sb.toString());

	}

}



Measured memory_bytes: 229176
#include <iostream>
using namespace std;

int main()
{
    long long N, K, Q;
    cin >> N >> K >> Q;

    long n = K - Q;

    long long score[N+1];
    for(int i = 1; i <= N; i++) score[i] = n;
    for(int i = 1; i <= Q; i++)
    {
        long long a;
        cin >> a;
        score[a]++;
    }

    for(int i = 1; i <= N; i++)
    {
        if(score[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main() {
    int H,W;
    cin >> H >> W;
    vector<string> f(H);

    rep(i,H)
        cin >> f.at(i);
    
    rep(i,H)
        rep(j,W) {
            bool ok=0;
            if(f.at(i).at(j) == '.')
                continue;

            if(i>0 && f.at(i-1).at(j)=='#')
                ok = 1;
            if(i<H-1 && f.at(i+1).at(j)=='#')
                ok = 1;
            if(j>0 && f.at(i).at(j-1)=='#')
                ok = 1;
            if(j<W-1 && f.at(i).at(j+1)=='#')
                ok = 1;

            if(!ok) {
                cout << "No" << endl;
                return 0;
            }
        }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#エラトステネスの篩
MAX_NUM = 999999
primes = []
max = Math.sqrt(MAX_NUM).ceil
arr = [*2..MAX_NUM]
0.upto(max) {|i|
  next if arr[i] == nil
  primes << arr[i]
  i.step(MAX_NUM, primes.last){|j| arr[j] = nil}
}
primes.concat(arr.compact!)
#Prime Number
while gets
  n = $_.to_i
  puts primes.take_while{|i| i <= n}.length
end

Measured memory_bytes: 21848
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
        String s=sc.next();
        
        System.out.println(s.substring(0,k-1)+s.substring(k-1,k).toLowerCase()+s.substring(k));
    }
}


Measured memory_bytes: 23636
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// dump macro{{{
// http://www.creativ.xyz/dump-cpp-652
#define DUMPOUT cerr // 変数ダンプ先。coutかcerr

#ifdef PCM
// 引数はいくつでもどんな型でも可（ストリーム出力演算子があればOK）
#define dump(...) DUMPOUT<<"  "; \
  DUMPOUT<<#__VA_ARGS__; \
  DUMPOUT<<":=> "; \
  dump_func(__VA_ARGS__); DUMPOUT<<"in ["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl;
#define dump_1d(x,n) DUMPOUT <<"  " \
  <<#x<<"["<<#n<<"]"<<":=> {"; \
  rep(i,n){ DUMPOUT << x[i] << (((i)==(n-1))?"}":", "); } DUMPOUT <<" in [" << __LINE__ << "]" << endl;

#define dump_2d(x,n,m) DUMPOUT <<"  " \
    <<#x<<"["<<#n<<"]"<<"["<<#m<<"]"<<":=> \n"; \
    rep(i,n)rep(j,m){ DUMPOUT << ((j==0)?"     |":" ") << x[i][j] << (((j)==(m-1))?"|\n":" "); } \
    DUMPOUT <<"  in [" << __LINE__ << "]" << endl;
#else
#define dump(...) 42
#define dump_1d(...) 42
#define dump_2d(...) 42
#endif

// デバッグ用変数ダンプ関数
void dump_func() {
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail)
{
    DUMPOUT << head;
    if (sizeof...(Tail) == 0) {
        DUMPOUT << " ";
    }
    else {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i<vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}/*}}}*/

#define rep(i, x) for(int i = 0; i < (int)(x); i++)/*{{{*/
#define reps(i,x) for(int i = 1; i <= (int)(x); i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define foreach(x,a) for(auto& (x) : (a) )
#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define INF 2147483647
#define INFLL 1000000000000000000LL
#define MOD 1000000007/*}}}*/

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;/*{{{*/
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<pii,vii,greater<pii> > spq;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*}}}*/

// global variables

int main() {
  int n,k;cin>>n>>k;

  int cnt[200001]={};

  rep(i,n){
    int tmp;cin>>tmp;
    cnt[tmp]++;
  }

  vi x;
  rep(i, 200001){
    x.pb(cnt[i]);
  }

  sort(all(x));

  int res = 0;
  rep(i, x.size()-k){
    res += x[i];
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 2168
S = input()
a = 'dream'
b = 'dreamer'
c = 'erase'
d = 'eraser'
T = S
while len(T) > 4:
    if S[len(T)-5:len(T)] == a:
        T = T[0:len(T)-5]
    elif S[len(T)-7:len(T)] == b:
        T = T[0:len(T)-7]
    elif S[len(T)-5:len(T)] == c:
        T = T[0:len(T)-5]
    elif S[len(T)-6:len(T)] == d:
        T = T[0:len(T)-6]
    else:
        break
if T == '':
    print('YES')
else:
    print('NO')

Measured memory_bytes: 135156
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    vector<string> a;
    int N,L;
    cin>>N>>L;
    for(int i=0;i<N;i++){
        string s;
        cin>>s;
        a.push_back(s);
    }
    sort(a.begin(),a.end());
    for(int i=0;i<N;i++) cout<<a[i];
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAX_N = 1 << 19;
const ll INF = 1LL << 50;

struct MinSegTree2{
	static const ll def = INF;
	int n;
	ll segMin[2 * MAX_N - 1], segAdd[2 * MAX_N - 1];
	void init(int n_){
		n = 1;
		while(n < n_) n *= 2;
		for(int i = 0; i < 2 * n - 1; i++) segMin[i] = def, segAdd[i] = 0;
	}

	void add(int a, int b, ll x){ add(a, b, x, 0, 0, n); }

	void add(int a, int b, ll x, int k, int l, int r){
		if(r <= a || b <= l) return;
		if(a <= l && r <= b){
			segAdd[k] += x;
			return;
		}
		add(a, b, x, k * 2 + 1, l, (l + r) / 2);
		add(a, b, x, k * 2 + 2, (l + r) / 2, r);
		segMin[k] = min(segMin[k * 2 + 1] + segAdd[k * 2 + 1], segMin[k * 2 + 2] + segAdd[k * 2 + 2]);
	}

	void set(int i, ll x){
		ll y = query(i, i + 1);
		add(i, i + 1, -y + x);
	}

	ll query(int a, int b){ return query(a, b, 0, 0, n); }

	ll query(int a, int b, int k, int l, int r){
		if(r <= a || b <= l) return def;
		if(a <= l && r <= b) return segMin[k] + segAdd[k];
		ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr) + segAdd[k];
	}
};

MinSegTree2 minst;

int N;
string s;

set<int> O, C;

void flip(int i){
	if(s[i] == '('){
		s[i] = ')';
		O.erase(i);
		C.insert(i);
		minst.add(i, N, -2);
	}
	else{
		s[i] = '(';
		C.erase(i);
		O.insert(i);
		minst.add(i, N, +2);
	}
}

void debug(){
	cout << s << endl;
	for(int i = 0; i < N; i++){
		cout << minst.query(i, i + 1) << " ";
	}
	cout << endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int Q;
	cin >> N >> Q >> s;

	minst.init(N);
	int cnt = 0;
	for(int i = 0; i < N; i++){
		if(s[i] == '('){
			O.insert(i);
			cnt++;
			minst.set(i, cnt);
		}
		else{
			C.insert(i);
			cnt--;
			minst.set(i, cnt);
		}
	}

	//debug();

	while(Q--){
		int k;
		cin >> k;
		k--;
		char c = s[k];
		flip(k);
		//debug();
		int ans = k;

		if(c == '('){
			// CLOSE -> OPEN
			// ????????????CLOSE
			ans = *C.begin();
		}
		else{
			// OPEN -> CLOSE
			// [i, n) >= 2 ????????????????°????i
			int ng = 0, ok = k;
			while(abs(ng - ok) > 1){
				int mid = (ng + ok) / 2;
				auto it = O.lower_bound(mid);
				if(it == O.end()){
					ng = mid;
					continue;
				}
				int a = *it;
				if(minst.query(a, N) >= 2) ok = mid;
				else ng = mid;
			}
			ans = *O.lower_bound(ok);
		}

		cout << ans + 1 << endl;
		flip(ans);
		//debug();
	}
}

Measured memory_bytes: 33792
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

#define size_t int

struct SuffixArray {
    string s;
    size_t n;
    vector<size_t> sarray, rank;
    SuffixArray(string s): s(s), n(s.length()) {
        sarray.assign(n+1, 0);
        rank.assign(n+1, 0);

        for (size_t i=0; i<=n; ++i) {
            sarray[i] = i;
            rank[i] = i<n? s[i]:-1;
        }

        vector<size_t> tmp(n+1);
        for (size_t k=1; k<=n; k<<=1) {
            auto comp=[&, k](size_t i, size_t j)->bool {
                if (rank[i] != rank[j])
                    return rank[i] < rank[j];

                int ri=i+k<=n? rank[i+k]:-1;
                int rj=j+k<=n? rank[j+k]:-1;
                return ri < rj;
            };
            sort(sarray.begin(), sarray.end(), comp);
                
            for (size_t i=1; i<=n; ++i)
                tmp[sarray[i]] = tmp[sarray[i-1]]+comp(sarray[i-1], sarray[i]);

            for (size_t i=0; i<=n; ++i)
                rank[i] = tmp[i];
        }
    }
    bool is_substr(string t) {
        size_t lb=0, ub=s.length();
        while (ub-lb > 1) {
            size_t mid=(lb+ub)>>1;
            (s.compare(sarray[mid], t.length(), t)<0? lb:ub) = mid;
        }
        return !s.compare(sarray[ub], t.length(), t);
    }
};

int main() {
    char buf[1<<20];
    scanf("%s", buf);
    string T(buf);

    SuffixArray sa(T);

    size_t Q;
    scanf("%d", &Q);

    for (size_t i=0; i<Q; ++i) {
        scanf("%s", buf);
        string P(buf);

        printf("%d\n", sa.is_substr(P));
    }

    return 0;
}

Measured memory_bytes: 17008
#include <bits/stdc++.h>
#define nmax 200005
using namespace std;
char s[nmax];
char q[nmax][2];
int n, m, ans1, ans2;


int last_position(int p) {

	if(!(p >= 1 && p <= n))
		return p;

	for(int i = 0; i < m; i++) {
		if(q[i][0] == s[p]) {
			if(q[i][1] == 'L') {
				if (--p == 0)
					return 0;
			}
			else {
				if (++p == n + 1)
					return n + 1;
			}
		}
	}
	return p;
}

int main()
{

	cin >> n >> m;
	cin >> s + 1;
	//cout << s + 1 << '\n';
	for(int i = 0; i < m; i++)
		cin >> q[i][0] >> q[i][1];

	int st = 1, dr = n; ans1 = 0;
	while (st <= dr) {
		int mid = (st + dr) / 2;
		if(last_position(mid) == 0) {
			ans1 = mid;
			st = mid + 1;
		}
		else
			dr = mid - 1;
	}

	st = 1, dr = n; ans2 = n + 1;
	while (st <= dr) {
		int mid = (st + dr) / 2;
		//cout << mid << '\n';
		if(last_position(mid) == n + 1) {
			ans2 = mid;
			dr = mid - 1;
		}
		else
			st = mid + 1;

	} while(st <= dr);

	//for (int i = 1; i <= n; i++)
	//	cout << last_position(i) << '\n';

	//cout << ans1 << '\n';
	//cout << ans2 << '\n';
	cout << ans2 - ans1 - 1 << '\n';
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <type_traits>
using namespace std;

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int n, m;
  std::cin >> n >> m;
  vi fromTo;
  vector<bool> canGo(n + 1);
  REP(i, m) {
    int a = read(), b = read();
    if (a == 1)
      fromTo.PB(b);
    if (b == n)
      canGo[a] = true;
  }
  bool ok = false;
  for (auto &v : fromTo)
    if (canGo[v])
      ok = true;
  if (ok)
    std::cout << "POSSIBLE" << std::endl;
  else
    std::cout << "IMPOSSIBLE" << std::endl;
}


Measured memory_bytes: 1532
var y,n,i,_x,_y:longint;
begin
  readln(n,y);
  for i:=0 to n do
    if (y+4000*i)mod 5000=0 then
    begin
      _y:=(y+4000*i-5000*n)div 5000;
      _x:=n-i-_y;
      if (_x>=0) and (_x<=n-i) then
      begin
        writeln(_y,' ',_x,' ',i);
        halt;
      end;
    end;
  writeln('-1 -1 -1');
end.

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)

void solve(){
    ll x;
    cin>>x;
    ll r = x%1000;
    ll ans = r != 0 ? 1000-r : 0ll;
    print(ans);
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
        start_routine();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
 
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
        
    #ifndef ONLINE_JUDGE
        end_routine();
    #endif
}


Measured memory_bytes: 3632
K = int(input())
rc = [list(map(int, input().split())) for i in range(K)]

from itertools import permutations as per

ans = None
for pers in per(range(8)):
    flag = False
    # 指定された配置にできない場合はスキップ
    for r, c in rc:
        if pers[r] != c:
            break
    else:
        flag = True
    # 斜めで競合する場合はスキップ
    for i in range(8):
        for j in range(1, 8):
            if i >= j:
                if pers[i] == pers[i-j]-j or pers[i] == pers[i-j]+j:
                    flag = False
                    break
    if flag:
        ans = pers
        break

for i in range(8):
    for j in range(8):
        if ans[i] == j:
            print('Q', sep='', end='')
        else:
            print('.', sep='', end='')
    print('')



Measured memory_bytes: 5656
from collections import deque

H,W = list(map(int, input().split()))

A = []
for i in range(H):
  A.append(input())
  
Q = deque()
visited = [[False for i in range(W)] for j in range(H)]

for i in range(H):
  for j in range(W):
    if A[i][j] == '#':
      Q.append([i,j,0])
      visited[i][j] = True

ans = 0
while len(Q) > 0:
  i,j,dist = Q.popleft()
  for dy, dx in [[1,0], [-1,0], [0,-1], [0,1]]:
    y = i + dy
    x = j + dx
    if y < 0 or H <= y or x < 0 or W <= x:
      continue
    if visited[y][x]:
      continue
    visited[y][x] = True
    Q.append([y,x,dist+1])
    ans = max(ans, dist+1)
    
print(ans)


Measured memory_bytes: 150236
#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5+5 , M = 1e9+7, OO = 0x3f3f3f3f;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
const double Pii = 3.14159265359;
ll n;
ll a[N], d[N], fr[N];

int main()
{
    FIO
    cin >> n;
    for(int i=0; i<n; ++i)
    {
        cin >> a[i];
        d[i] = i-a[i];
    }
    for(int i=0; i<n; ++i)
        if(d[i] < N && d[i] >= 0) fr[d[i]]++;
    ll ans =0;
    for(int i=0; i<n; ++i)
    {
        int didx = a[i]+i;
        if(didx >= 0 && didx < N) ans += fr[didx];
        //cout << didx << " " << fr[didx] << endl;
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 8276
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#include <math.h>
#define pb push_back
using namespace std;
using ll = long long;
const char E = '\n';
const int N = 105;
const ll mod = 1e9+7;
const int lim = 1e5;

mt19937_64 mt_rnd_64(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll l, ll r) {
    return (mt_rnd_64() % (r-l+1)) + l;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int a;
	cin >> a;
	cout << (a*a)*3;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lint long long

int main(){
    int N;
    cin >> N;
    
    set<int> st;
    
    for(int i = 0; i < N; ++i){
        int n;
        cin >> n;
        st.insert(n);
    }
    
    
    cout << st.size() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

int main(){
  string S;
  cin >> S;
  bool flag = 1;
  int cnt = 0;
  if(S[0] != 'A') flag = 0;
  for(int i =2; i < S.size()-1; i++){
    if(S[i] == 'C')cnt++;
  }
  if(cnt != 1) flag  = 0;
  for(int i = 1; i< S.size(); i++){
    if(!(S[i] == 'C' ||( 'a' <= S[i] && S[i] <= 'z'))) flag = 0;
  }
  if(flag) cout << "AC\n";
  else cout << "WA\n";
}
  

Measured memory_bytes: 256
def solve(a, b, c, k):
    for i_a in range(k+1):
        for i_b in range(k+1):
            for i_c in range(k+1):
                if i_a + i_b + i_c > k:
                    break
                x = a * (2**i_a)
                y = b * (2**i_b)
                z = c * (2**i_c)
                if x < y < z:
                    return "Yes"
    return "No"

a, b, c = map(int, input().split())
k = int(input())
print(solve(a, b, c, k))

Measured memory_bytes: 9200
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <bitset>
using namespace std;

#define N 900010
typedef long long ll;

const ll Mod=1e9+7;

int n,m,K;
ll Pre[N],Inv[N],Pre_inv[N],Pow[N];

inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

void Prepare()
{
    Inv[1]=1;Inv[0]=1;
    for(int i=2;i<=900000;i++)
        Inv[i]=(Mod-Mod/i)*Inv[Mod%i]%Mod;
    Pre[0]=1;Pre_inv[0]=1;
    for(int i=1;i<=900000;i++)
        Pre[i]=Pre[i-1]*i%Mod,Pre_inv[i]=Pre_inv[i-1]*Inv[i]%Mod;
    Pow[0]=1;
    for(int i=1;i<=900000;i++)
        Pow[i]=Pow[i-1]*3%Mod;
}

ll Cal(int a,int b)
{
    return Pre[a]*Pre_inv[b]%Mod*Pre_inv[a-b]%Mod;
}

int main()
{
    Prepare();
    n=read();m=read();K=read();
    ll qwer=1,Ans=0;
    for(int i=0;i<=m+K;i++)
    {
        ll now=Cal(n+i-1,i)*qwer%Mod*Pow[m+K-i]%Mod;
        Ans=(Ans+now)%Mod;
        qwer=qwer*2%Mod;
        if(i+1>K)
            qwer-=Cal(i,K);
        if(i+1>m)
            qwer-=Cal(i,m);
        qwer=(qwer%Mod+Mod)%Mod;
    }
    cout<<Ans<<endl;
    return 0;
}


Measured memory_bytes: 28416
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll INF = 1LL << 62;
const int inf = 1 << 30;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vector<string> in(n); for(auto& e : in) cin >> e;
    const int M = 'z' - 'a' + 1;
    vi histres(M, inf);

    for(auto& S : in){
        vi hist(M);
        for(auto& e : S){
            hist[e - 'a']++;
        }
        rep(i, M){
            chmin(histres[i], hist[i]);
        }
    }

    rep(i, M){
        rep(j, histres[i]){
            cout << (char)('a' + i);
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
from collections import deque

N, K = map(int, input().split())
A = list(map(int, input().split()))
Q = deque()
Q.append(0)

Seen = [-1] * N
Seen[0] = 0
loop = 0
point = 0
while True:
    now = Q.popleft()
    nex = A[now]
    nex -= 1
    if Seen[nex] == -1:
        Seen[nex] = Seen[now] + 1
        Q.append(nex)
    elif Seen[nex] != -1:
        first = Seen[nex]
        loop = Seen[now] - Seen[nex] + 1
        point = nex
        break

if first > K:
    ind = Seen.index(K)
    print(ind+1)
    exit()

p = (K - first) % loop
Q.clear()
Q.append(point)
ans = point
while p > 0:
    no = Q.popleft()
    ans = A[no]
    ans -= 1
    Q.append(ans)
    p -= 1
print(ans + 1)



Measured memory_bytes: 91536
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

#define int long long

const int MAX_N = 200000;
const int inf = LLONG_MAX / 3;

int N;
int h[MAX_N + 5], a[MAX_N + 5];
int idx[MAX_N + 5];
int dp[MAX_N + 5];

struct SegTree { // 区間max
	int n;
	vector<int> Max;
	void init(int n_) {
		n = 1;
		while (n < n_) n *= 2;
		Max.resize(2 * n);
		for (int i = 0; i < 2 * n - 1; ++i) {
			Max[i] = 0;
		}
	}
	void update(int idx, int val) {
		idx += n - 1;
		Max[idx] = val;
		while (idx > 0) {
			idx = (idx - 1) / 2;
			Max[idx] = max(Max[idx * 2 + 1], Max[idx * 2 + 2]);
		}
	}
	int get_max(int a, int b, int k = 0, int l = 0, int r = -1) { // [a, b)のmax
		if (r == -1) r = n;
		if (r <= a || b <= l) return 0;
		if (a <= l && r <= b) return Max[k];
		int vl = get_max(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = get_max(a, b, k * 2 + 2, (l + r) / 2, r);
		return max(vl, vr);
	}
};

SegTree t;

signed main()
{
	cin >> N;
	for (int i = 1; i <= N; ++i) {
		cin >> h[i];
		idx[h[i]] = i;
	}

	for (int i = 1; i <= N; ++i) cin >> a[i];

	t.init(N + 5);

	for (int height = 1; height <= N; ++height) {
		t.update(idx[height], a[idx[height]] + t.get_max(0, idx[height]));
	}

	cout << t.get_max(0, N + 1) << endl;
}


Measured memory_bytes: 9088
import functools

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def inpm(line):
    return [inp() for _ in range(line)]


def inpfm(line):
    return [inpf() for _ in range(line)]


def inpsm(line):
    return [inps() for _ in range(line)]


def inlm(line):
    return [inl() for _ in range(line)]


def inlfm(line):
    return [inlf() for _ in range(line)]


def inlsm(line):
    return [inls() for _ in range(line)]


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper


x, y = inls()
if x > y:
    print('>')
if x < y:
    print('<')
if x == y:
    print('=')


Measured memory_bytes: 3564
#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    T,P,R = map(int,input().split(" "))
    if T == 0 and P == 0 and R == 0:
        break
    teams = [[i,0,[0 for j in range(P)],0] for i in range(T)]
    for i in range(R):
        tID,pID,time,message = map(lambda x: int(x) -1 if x.isnumeric() else x,input().split())
        time += 1
        if message == "WRONG":
            teams[tID][2][pID] += 1
        elif message == "CORRECT" and teams[tID][2][pID] != -1:
            teams[tID][1] += 1
            teams[tID][3] += teams[tID][2][pID] * 1200 + time
            teams[tID][2][pID] = -1
    for t in sorted(teams,key = lambda x:(x[1],-x[3]),reverse=True):
        print(t[0] + 1,t[1],t[3])



    

Measured memory_bytes: 6744
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#define ll long long
using namespace std;
int main(){
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    ll n=s.length();
    ll now=0;
    ll d=1;
    map<ll,ll> rmap;
    rmap[0]++;
    for(ll i=0;i<n;i++){
        now=(now+(s[i]-'0')*d)%2019;
        rmap[now]++;
        d*=10;
        d%=2019;
    }
    
    ll ans=0;
    for(const auto& imap:rmap){
        ans+=imap.second*(imap.second-1)/2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3760
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
const ld pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct S {//辺の情報を入れる変数
	int from, to, cost;
};
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld radian(ld a, ld b, ld c, ld d) {
	return sqrt(pow(a - c, 2) + pow(b - d, 2));
}
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int n;
	cin >> n;
	cout << "ABC" << n << endl;
	getchar(); getchar();
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
	int n;
	cin >> n;
	string march="MARCH";
	vector<long long> c(5,0);
	for(int i=0;i<n;i++)
	{
		string s;
		cin >> s;
		for(int j=0;j<5;j++)
			if(s[0]==march[j])
				c[j]++;
	}
	long long ans=0;

	for(int i=0;i<5-2;i++)
		for(int j=i+1;j<5-1;j++)
			for(int k=j+1;k<5;k++)
				ans+=(c[i]*c[j]*c[k]);
	
	cout << ans << endl;


	
}


Measured memory_bytes: 256
import Data.Array

main = do
    n <- readLn
    getLine >>= putStrLn.show.answer n.listArray (1,n).map read.words

answer :: Int -> Array Int Int -> Int
answer n = (!1).dp n

dp n costs =
    let ans = array (1,n) $ (n,0) : (n-1, n#(n-1)) : [(k,min(ans!(k+1)+k#(k+1)) (ans!(k+2)+k#(k+2))) | k <- [1..n-2]]
    in ans where
        a#b = abs $ (costs!a) - (costs!b)

Measured memory_bytes: 45436
#include<iostream>
#include<vector>
using namespace std;

int main(){
    int A,B,C;
    cin >> A >> B>> C;
    if(A<B && B>C && A<C){
        cout << "Yes" << endl;
    }
    else if(A > B && B<C && C<A){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>

int main(void)
{
	int X,A,B;
	scanf("%d %d %d\n",&X,&A,&B);
	int after = B - A;
	if (after<=0){
		printf("delicious\n");
	}
	else if (after<=X){
		printf("safe\n");
	}
	else {
		printf("dangerous\n");
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <deque>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::deque;

int main() {
  int n, q;
  cin >> n;
  cin >> q;

  deque<string> ps;
  deque<int> ts;

  for (int i = 0; i < n; i++) {
    string p;
    int t;
    cin >> p;
    cin >> t;
    ps.push_back(p);
    ts.push_back(t);
  }

  int elapsed = 0;

  while (!ts.empty()) {
    string p = ps.front();
    ps.pop_front();
    int t = ts.front();
    ts.pop_front();
    if (t > q) {
      t -= q;
      elapsed += q;
      ps.push_back(p);
      ts.push_back(t);
    } else {
      elapsed += t;
      cout << p << " " << elapsed << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 5688
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
const int INF = 1001001001;

int main()
{
    int a,b;
    in a>>b;
    cout<<(b-a)*(b-a+1)/2-b<<endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	var tmp string
	fmt.Scan(&n)
	m := make(map[string]int, 4)
	for i := 0; i < n; i++ {
		fmt.Scan(&tmp)
		m[tmp]++
	}
	var result string
	switch len(m) {
	case 3:
		result = "Three"
	case 4:
		result = "Four"
	}
	fmt.Println(result)
}


Measured memory_bytes: 512
import java.util.Scanner;

/**
 * @author author
 *
 */
public class Main {

  /**
   * @param args
   */
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    long n = Integer.parseInt(sc.next());

    
    System.out.println(((n - 1) * n) / 2);

  }

}


Measured memory_bytes: 23380
#include<iostream> 
using namespace std; 
int main() 
{
 int n;
 cin>>n;
 int arr[n],ans(0);
 for(int i=0; i<n; ++i)
{
cin>>arr[i];
if(arr[i]%2&&(i%2==0))
++ans;
}
cout<<ans;
return 0; 
} 

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

class Point {
public:
	double x, y;
	Point(int x, int y) :x(x), y(y) {}
	Point operator + (Point p) {
		return Point(x + p.x, y + p.y);
	}
	Point operator - (Point p) {
		return Point(x - p.x, y - p.y);
	}
};

typedef vector<Point> Polygon;

int main() {
	int cnt = 0;
	while (1) {
		int i, j, n;
		double x, y, s = 0;
		Polygon p;

		
		cin >> n;
		cnt++;
		if (n == 0)break;
		for (i = 0; i < n; i++) {
			cin >> x >> y;
			p.push_back(Point(x, y));
		}

		for (i = 1; i < n - 1; i++) {
			s -= ((p[i] - p[0]).x * (p[i + 1] - p[0]).y - (p[i] - p[0]).y * (p[i + 1] - p[0]).x) / 2.0;
		}

		//cout << cnt << " " << s << endl;
		printf("%d %.1f\n", cnt, s);
	}
	





	return 0;
}

Measured memory_bytes: 3196
e1, e2, e3, e4 = map(int,input().split())

if e1 == e2 and e3 == e4:
    print('yes')
elif e2 == e3 and e4 == e1:
    print('yes')
elif e3 == e1 and e2 == e4:
    print('yes')
else:
    print('no')


Measured memory_bytes: 5596
#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int main(){

	int n,array[25],NUM,index;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		for(int i=0; i < n; i++)scanf("%d",&array[i]);

		NUM = 32;
		index = 0;

		while(NUM > 0){
			NUM -= (NUM-1)%5;
			printf("%d\n",NUM);

			NUM -= array[index%n];
			if(NUM <  0){
				printf("0\n");
			}else{
				printf("%d\n",NUM);
			}
			index++;
		}

	}

    return 0;
}

Measured memory_bytes: 2576