akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;


int main() {
	complex<long double>cmpmp;
	const long long int mod = 1000000007;
	map<long long int, long long int>mp;
	//cout << fixed << setprecision(10);
	long long int N, A, B, C, x;
	long long int  ketawa = 1, Y[2000] = {}, num[10005] = {};

	while (1) {
		for (int i = 0; i < 10002; i++) {
			num[i] = 0;
		}
		cin >> N >> A >> B >> C >> x;
		if (N == 0) { return 0; }
		long long int res = -1, cou = 0;
		for (int i = 0; i < N; i++) {
			cin >> Y[i];
		}
		cou = N ;
		for (int i = 0; i <= 10000; i++) {
			if (x == Y[N - cou]) { cou--; }
			if (cou == 0) { cout << i << endl; x = -1;break; }
			
			x = (A * x + B) % C;
		}
		if (x != -1) { cout << -1 << endl; }
	}
}



Measured memory_bytes: 3084
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(S: str, T: str):
    lenS, lenT = len(S), len(T)
    DP = [[0]*(lenT+1) for _ in range(lenS+1)]
    for i in range(lenS):
        for j in range(lenT):
            if S[i] == T[j]:
                DP[i+1][j+1] = max(DP[i][j]+1, DP[i+1][j+1])
            DP[i+1][j+1] = max(DP[i+1][j], DP[i][j+1], DP[i+1][j+1])

    ans = ""
    i, j = lenS, lenT
    while i > 0 and j > 0:
        if DP[i][j] == DP[i-1][j]:
            i -= 1
        elif DP[i][j] == DP[i][j-1]:
            j -= 1
        else:
            ans = S[i-1] + ans
            i -= 1
            j -= 1
    print(ans)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    t = next(tokens)  # type: str
    solve(s, t)


if __name__ == '__main__':
    main()


Measured memory_bytes: 112476
import sys
sys.setrecursionlimit(10000)
n, m = map(int, input().split())
G = [[] for i in range(n)]
for j in range(m):
    x, y = map(int, input().split())
    G[x-1].append(y-1)
DP = [None for i in range(n)]
def dp(i):
    if DP[i] != None:
        return DP[i]
    ret = 0
    for j in G[i]:
        ret = max(ret, dp(j)+1)
    DP[i] = ret
    return ret
print(max([dp(i) for i in range(n)]))


Measured memory_bytes: 139724
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int n;
    cin >> n;
    int ans = 1;
    bool f = true;
    if(n % 7 == 0)
        n = n/7;
    map<int , int> m;
    ll b = 1;
    while(b % n != 0){
        ++ans;
        int r = b % n;
        if(m[r]){
            f = false;
            break;
        }
        m[r]++;
        b = r * 10 + 1;
    }
    if(f)
        cout<<ans;
    else
        cout<<"-1";
}



Measured memory_bytes: 50376
#!/usr/bin/env python3
import sys
import math
def comb(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n)/math.factorial(n-r)/math.factorial(r)
def solve(N: int, M: int):
    print(int(comb(N, 2) + comb(M, 2)))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;



int main(){
	double l;
	cin >> l;
	cout << setprecision(10) <<(l/3)*(l/3)*(l/3) << endl;
 	return 0;
 }

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner scan = new FastScanner();
		int[] ary = new int[3];
		for (int i =0; i <ary.length; i++){
			ary[i] = scan.nextInt();
		}
		if(ary[0] <= ary[2] && ary[2] <= ary[1]) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

}
class FastScanner {
	public static String debug = null;

	private final InputStream in = System.in;
	private int ptr = 0;
	private int buflen = 0;
	private byte[] buffer = new byte[1024];
	private boolean eos = false;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				if (debug != null) {
					buflen = debug.length();
					buffer = debug.getBytes();
					debug = "";
					eos = true;
				} else {
					buflen = in.read(buffer);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen < 0) {
				eos = true;
				return false;
			} else if (buflen == 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean isEOS() {
		return this.eos;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		return (int) nextLong();
	}

	public long[] nextLongList(int n) {
		return nextLongTable(1, n)[0];
	}

	public int[] nextIntList(int n) {
		return nextIntTable(1, n)[0];
	}

	public long[][] nextLongTable(int n, int m) {
		long[][] ret = new long[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextLong();
			}
		}
		return ret;
	}

	public int[][] nextIntTable(int n, int m) {
		int[][] ret = new int[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextInt();
			}
		}
		return ret;
	}
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    long double T,X;
    cin >>T>>X;
    

    cout << fixed << setprecision(15) << T/X << endl;


    return 0;
    

}

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

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/
  
  int a,b;

  for(int i=0;i<7;i++){
    cin>>a>>b;

    cout<<a-b<<endl;
  }
  return 0;

}



Measured memory_bytes: 3196
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

int main()
{
    long N;
    std::cin >> N;
    std::string S,T;
    std::cin >> S >> T;
    for(long i=0; i<N; i++){
        std::cout << S[i];
        std::cout << T[i];
    }
    std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
s = 0
for i in range(n-1):
    s += b[i]
    if a[i+1] - a[i] == 1:
        s += c[a[i]-1]
print(s+b[-1])

Measured memory_bytes: 3064
s = list(map(int,list(input())))
a = s[0]*10+s[1]
b = s[2]*10+s[3]
if a == 0 and b == 0:
    print('NA')
    exit()
if 0 < a<= 12 and (b>12 or b==0):
    print('MMYY')
elif (a > 12 or a==0) and 0 < b <= 12:
    print('YYMM')
elif a <= 12 and b <= 12:
    print('AMBIGUOUS')
else:print('NA')

Measured memory_bytes: 9088
#include<stdio.h>

int main(void){

int a,b,c,h;
scanf("%d",&a); scanf("%d",&b); scanf("%d",&c);

if(a>b){
h=a; a=b; b=h;}

if(b>c){
h=b; b=c; c=h;}

if(a>b){
h=a; a=b; b=h;}

printf("%d %d %d\n",a,b,c);

return 0;
}


Measured memory_bytes: 2060
A,B,M=map(int,input().split(" "))

a=[]
b=[]

a=[int(_) for _ in input().split(" ")]
b=[int(_) for _ in input().split(" ")]

mina=min(a)
minb=min(b)

mi = mina + minb

for i in range(M):
  x,y,c = map(int, input().split(" "))
  tmp=a[x-1]+b[y-1]-c
  if mi > tmp:
    mi = tmp

print(mi)


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

int main(int argc, char const *argv[]) {
  int n;
  cin >> n;

  int ans = 1;
  for (int i = 0; i < n; i++) {
    int pow_2 = pow(2, i);
    if (pow_2 > n) {
      break;
    }
    ans = pow_2;
  }

  cout << ans << endl;
  return 0;
}

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

int search(int s);
int num[50],a[50],u[50],d[51],n,g;

int fnd(int v,int t,int s,int k) {
	int i,j,w=-1;
	if (k==0) {
		 j=a[v]; a[v]=0;
		   if (g==n || search(t+1)==1) return 1;
		   a[v]=j; return 0;}
	if (k>d[s] || t==n-1) return 0;
	for (i=s;i<n;i++) {
		if (u[i]==0 && a[i]!=w && k-a[i]>=0) {
			u[i]=1; g++;
			if (fnd(v,t,i+1,k-a[i])==1) return 1;
		    u[i]=0; g--; w=a[i];
	 }
 }
	 return 0;
 }
  
int search(int s) {
	int i,k;
	if (g==n) return 1;
	while(u[s]==1 && s<n) s++;
	if (s==n) return 0; 
	for (i=0;i<s;i++) if (a[i]>=a[s]) {
		a[i]-=a[s]; g++;
		if (a[i]==0) { u[s]=1; k=search(s+1);} else k=fnd(i,s,s+1,a[i]);
		if (k==1) return 1; else { a[i]+=a[s]; u[s]=0; g--;}
		}
	return 0;
}

int main() {
	int i,j,k;
	
	while(cin >> n) {
		if (n==0) break;
		for (i=0;i<n;i++) { cin >> num[i];}
		for (i=n-1;i>0;i--) for (j=0;j<i;j++) if (num[j]<num[j+1]) { k=num[j]; num[j]=num[j+1]; num[j+1]=k;}
		d[n]=0;
		for (i=n-1;i>=0;i--) {a[i]=num[i]; d[i]=d[i+1]+num[i]; u[i]=0;}
		u[0]=1; g=1;
		if (search(1)==1) cout << "YES" << endl; else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
long long x[100010],y[100010],z[100010];
int main(){

  cin.tie(0);
  ios::sync_with_stdio(false);

  long long a,b,cnt=0,ans=0,c;
  string s,v;

  cin>>s;
  if(s[0]=='a' && s[1]=='b' && s[2]=='c'){
    cout<<"Yes"<<'\n';
  }else if(s[0]=='b' && s[1]=='a' && s[2]=='c'){
    cout<<"Yes"<<'\n';
  }else if(s[0]=='c' && s[1]=='a' && s[2]=='b'){
    cout<<"Yes"<<'\n';
  }else if(s[0]=='a' && s[1]=='c' && s[2]=='b'){
    cout<<"Yes"<<'\n';
  }else if(s[0]=='b' && s[1]=='c' && s[2]=='a'){
    cout<<"Yes"<<'\n';
  }else if(s[0]=='c' && s[1]=='b' && s[2]=='a'){
    cout<<"Yes"<<'\n';
  }else{
    cout<<"No"<<'\n';
  }

}
  


Measured memory_bytes: 256
n, m, l = map(int, input().split())
a = []
b = []

for i in range(n):
    a.append(list(map(int, input().split())))
for j in range(m):
    b.append(list(map(int, input().split())))

for i in range(n):
    li = []
    for j in range(l):
        su = 0
        for k in range(m):
            su += a[i][k] * b[k][j]
        li.append(su)
    print(" ".join(list(map(str, li))))


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

using ll = long long;

int main()
{
    int N; cin >> N;
    vector<vector<int>> G(N+1);
    for (int i = 0; i < N-1; i++) {
        int a, b; cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> C(N);
    for (auto& c : C) cin >> c;
    sort(C.begin(), C.end(), greater<int>());

    if (N == 1) {
        cout << C[0] << endl << C[0] << endl;
        return 0;
    }

    int sum = accumulate(C.begin()+1, C.end(), 0);
    vector<int> ans(N+1);

    vector<bool> done(N+1, false);
    queue<int> q;
    q.push(1);
    done[1] = true;
    auto it = C.begin();
    while (!q.empty()) {
        int v = q.front(); q.pop();
        ans[v] = *it++;
        for (int u : G[v]) {
            if (!done[u]) {
                q.push(u);
                done[u] = true;
            }
        }
    }

    cout << sum << endl;
    cout << ans[1];
    for (int i = 2; i < ans.size(); i++) cout << " " << ans[i];
    cout << endl;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
// const int mod=998244353;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,m;
    cin>>n>>m;
    vvi g(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        g[a].eb(b);
        g[b].eb(a);
    }
    vi ans(n);
    queue<pi> q;
    q.push({0,-1});
    while(!q.empty()){
        pi p=q.front();
        q.pop();
        int v=p.fi;
        for(int u:g[v]){
            if(!u||ans[u])continue;
            ans[u]=v+1;
            q.push({u,v});
        }
    }
    cout<<"Yes"<<endl;
    Rep(i,1,n)cout<<ans[i]<<endl;
}

Measured memory_bytes: 13660
#include<set>  
#include<map>  
#include<stack>  
#include<cstdio>  
#include<queue>  
#include<cmath>  
#include<vector>  
#include<climits>  
#include<cstring> 
#include<iostream> 
#include<algorithm> 
using namespace std;
#define INF 0x3f3f3f3f
#define LL long long
LL read(){ 
    LL f=1,x=0; 
    char c=getchar(); 
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();} 
    while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();} 
    return f*x; 
}
#define MAXN 3000000
struct edge{
	int v,w;
	edge(){}
	edge(int V,int W){v=V,w=W;}
};
int n,m;
struct node{
	int u,k;
	node(){}	
	node(int U,int K){u=U,k=K;}
	friend bool operator < (node a,node b){return a.u==b.u?a.k<b.k:a.u<b.u;}
};
struct node1{
	int u,v,k;
	node1(){}	
	node1(int U,int V,int K){u=U,v=V,k=K;}
};
vector<node> Make_zx;
vector<node1> Make_xx;
vector<edge> G[MAXN+5];
int dis[MAXN+5];
bool vis[MAXN+5];
queue<int>Q;
int SPFA(int S,int T){
	memset(vis,0,sizeof(vis));
	memset(dis,0x3f,sizeof(dis));
	dis[S]=0,vis[S]=1,Q.push(S);
	while(!Q.empty()){
		int u=Q.front(),v,w,siz=G[u].size();
		Q.pop();
		vis[u]=0;
		for(int i=0;i<siz;i++){
			v=G[u][i].v,w=G[u][i].w;
			if(dis[v]>dis[u]+w){
				dis[v]=dis[u]+w;
				if(!vis[v]){
					vis[v]=1;
					Q.push(v);
				}
			}
		}
	}
	return dis[T]==INF?-1:dis[T]/2;
}
int main(){
	n=read(),m=read();
	for(int i=1;i<=m;i++){
		int p=read()-1,q=read()-1,c=read()-1;
		Make_zx.push_back(node(p,c));
		Make_zx.push_back(node(q,c));
		Make_xx.push_back(node1(p,q,c));
		Make_xx.push_back(node1(q,p,c));
	}
	sort(Make_zx.begin(),Make_zx.end());
	for(int i=0;i<int(Make_zx.size());i++){
		G[n+i].push_back(edge(Make_zx[i].u,1));
		G[Make_zx[i].u].push_back(edge(n+i,1));
	}
	for(int i=0;i<int(Make_xx.size());i++){
		int l1=lower_bound(Make_zx.begin(),Make_zx.end(),node(Make_xx[i].u,Make_xx[i].k))-Make_zx.begin(),
		l2=lower_bound(Make_zx.begin(),Make_zx.end(),node(Make_xx[i].v,Make_xx[i].k))-Make_zx.begin();
		G[l1+n].push_back(edge(l2+n,0));
	}
	printf("%d\n",SPFA(0,n-1));
    return 0;
}

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

#define be begin
#define en end
#define pb push_back
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++) 

template<typename T> using V = vector< T >;
using Vi = V<int>;

int main(){
    int n;
    string s;
    cin>>n;
    cin>>s;
    s.erase(unique(ALL(s)),s.en());
    cout<<s.size()<<endl;
    return 0;
}

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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

struct Team {
    int id, score, time, wrong[10];
};

int main()
{
    int M, T, P, R;
    while(cin>>M>>T>>P>>R, M) {
        Team team[50]{};
        rep(i,T) team[i].id = i + 1;
        rep(i, R) {
            int m, t, p, j;
            cin >> m >> t >> p >> j;
            t--;
            p--;
            if(j) team[t].wrong[p]++;
            else {
                team[t].score++;
                team[t].time += m + 20 * team[t].wrong[p];
            }
        }
        sort(team, team+T, [](Team a, Team b) {
            if (a.score != b.score) return a.score > b.score;
            if(a.time != b.time) return a.time < b.time;
            return a.id > b.id;
        });
        cout << team[0].id;
        for(int i=1; i<T; ++i) {
            if(team[i-1].score==team[i].score&&team[i-1].time==team[i].time)
                cout << "=";
            else cout << ",";
            cout << team[i].id;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3068
(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  lines.shift();
  const arr = lines.shift().split(' ').map(Number);
  buildMaxHeap(arr);
  console.log(arr.reduce((s, e) => s += ` ${e}`, ''));
})();

function buildMaxHeap(arr) {
  const n = arr.length;
  const maxHeapify = (i) => {
    let left, right, largest;
    left = 2 * i + 1;
    right = 2 * i + 2;
    largest = left < n && arr[left] > arr[i] ? left : i;
    if (right < n && arr[right] > arr[largest]) largest = right;
    if (largest != i) {
      arr[largest] = [arr[i], arr[i] = arr[largest]][0];
      maxHeapify(largest);
    }
  };

  for (let i = Math.floor(n / 2); i >= 0; i--) maxHeapify(i);
}



Measured memory_bytes: 140164
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	tmp := n
	sum := 0
	for {
		sum += tmp % 10
		if tmp/10 == 0 {
			break
		} else {
			tmp = tmp / 10
		}
	}
	if n%sum == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<stdio.h>
#define MAX_ARRAY 100010
int main(void){
  long long int n,k,i,a,b,ans;
  long long int count=0;
  long long int d[100010];
  scanf("%lld %lld",&n,&k);
  for(i=0;i<MAX_ARRAY;i++) d[i]=0;
  for(i=0;i<n;i++){
    scanf("%lld %lld",&a,&b);
    d[a]+=b;
  }
  for(i=0;i<MAX_ARRAY;i++){
    count+=d[i];
    if(count>=k){
      ans=i;
      break;
    }
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 896
n = int(input())
s = input()
ans = 0
for i in range(10):
    a = s.find(str(i))
    if a == -1: continue
    for j in range(10):
        b = s.find(str(j), a+1)
        if b == -1: continue
        for k in range(10):
            if s.find(str(k), b+1) != -1:
                ans += 1
print(ans)

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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

string s,ans;

main() {
    cin >> s;
    rep(i,s.size()) if(!(i%2)) ans.pb(s[i])
    ct(ans)
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String s = "";
		String p = "";
		try {
			s = in.readLine();
			p = in.readLine();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		boolean flag = false;
		for (int i = 0; i < s.length(); i++) {
			flag = true;
			for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			}
			if (flag) break;
		}
		if (flag) System.out.println("Yes");
		else System.out.println("No");
	}
}

Measured memory_bytes: 24268
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp(a, b) make_pair(a, b)
#define pb(t) push_back(t)
#define ft first
#define sc second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;


int main(void) {
    ll H, W;
    cin >> H >> W;
    
    if(H%3==0 || W%3==0) pt(0);
    else {
        if(H>W) swap(H, W);
        
        ll ans=H;
        
        for(ll k=0; k<2; k++) {
            ll s, t;
            if(k) {s=H; t=W;}
            else  {s=W; t=H;}
            
            for(ll i=1; i<s; i++) {
                ll a=i*t;
                ll b=(s-i)*((t+1)/2);
                ll c=(s-i)*(t/2);
                
                ll max=max(a, max(b, c));
                ll min=min(a, min(b, c));
                chmin(ans, max-min);
            }
            
        }
        
        pt(ans);
    }
    
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	long double x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	cout << setprecision(10) << fixed << sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1)) << endl;
}

Measured memory_bytes: 1288
R, G, B, N= map(int, input().split())
c = 0
S = [R, G, B]
S.sort()
R = S[2]
G = S[1]
B = S[0]

if S[0] == 1:
  for i in range(N//R + 1):
    for j in range(N//G + 1):
      if R * i + G * j <= N:
        c += 1
else:
  for i in range(N//R + 1):
    for j in range(N//G + 1):
      for k in range(N//B + 1):
        if R * i + G * j + B * k == N:
          c += 1
print(c)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define co(i) cout<<(i)<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
#define all(i) i.begin(),i.end()
#define pint pair<int, int>
#define vint vector<int>
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;
//const int MOD=998244353;

int main(){
    int h,w; cin>>h>>w;
    int b[501][501]={};
    FOR(i,0,h){
        FOR(j,0,w){
            cin>>b[i][j];
        }
    }
    vector<int> v[4];
    FOR(i,0,h){
        FOR(j,0,w){
            if(j!=w-1){
                if(b[i][j]%2==1){
                    v[0].PB(i+1);
                    v[1].PB(j+1);
                    v[2].PB(i+1);
                    v[3].PB(j+2);
                    b[i][j+1]++;
                }
            }else{
                if(b[i][j]%2==1 && i!=h-1){
                    v[0].PB(i+1);
                    v[1].PB(j+1);
                    v[2].PB(i+2);
                    v[3].PB(j+1);
                    b[i+1][j]++;
                }
            }
        }
    }
    cout<<v[0].size()<<endl;
    FOR(i,0,v[0].size()){
        printf("%d %d %d %d\n",v[0][i],v[1][i],v[2][i],v[3][i]);
    }
}


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

int main() {
  int x, y;
  cin >> x >> y;

  array<int, 3> a = {300000, 200000, 100000};

  int ans = 0;
  if (x < 4)
    ans += a[x - 1];
  if (y < 4)
    ans += a[y - 1];
  if (x == 1 && y == 1)
    ans += 400000;

  cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func COM(n, k int64) int64 {
	r := int64(1)
	for i := int64(0); i < k; i++ {
		r = ModMul(r, n-i)
		r = ModDiv(r, i+1)
	}

	return r
}

const (
	MOD = 1000000000 + 7
)

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	value int
	index int
	A, B  int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

func FactoredPrimeNumber(num int) map[int]int {
	m := map[int]int{}
	return factor(m, num, 2)
}

func factor(result map[int]int, num, pnum int) map[int]int {
	if pnum*pnum > num {
		if num != 1 {
			result[num] += 1
		}
		return result
	}

	if num%pnum == 0 {
		num /= pnum
		result[pnum]++
	} else {
		pnum++
	}
	return factor(result, num, pnum)
}

func GCD(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}

func LCM(a, b int64) int64 {
	return a * b / GCD(a, b)
}

type P struct {
	X, T, Cond int
}

type PS []*P

func (p PS) Len() int           { return len(p) }
func (p PS) Less(i, j int) bool { return p[i].T < p[j].T }
func (pq PS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
}

func main() {
	var N, M int
	fmt.Scanf("%d %d\n", &N, &M)

	l := 0
	r := int(1e9)
	for i := 0; i < M; i++ {
		var L, R int
		fmt.Scanf("%d %d\n", &L, &R)
		if l < L {
			l = L
		}
		if r > R {
			r = R
		}
	}
	cnt := 0
	for i := 1; i <= N; i++ {
		if i >= l && i <= r {
			cnt++
		}
	}
	fmt.Println(cnt)
}

type IntHeap []int

func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] < h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


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

int main() {
    int n,k;
    cin>>n>>k;
    vector<int> v(n, 0);
    for(int i = 0; i < n; i++){
        cin>>v[i];
    }
    for(int i = k; i < n; i++){
        if(v[i] > v[i-k])
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 4048
#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e6 + 7;
int n;
int ans[maxx];

int main() {
	cin >> n;
	if(!n) {
		puts("0");
		return 0;
	}
	int num = 0;
	while(n) {
		if(n & 1) {
			ans[++num] = 1;
			n = (n - 1) / -2;
		}
		else {
			ans[++num] = 0;
			n /= -2;
		}
	}
	for(int i = num; i >= 1; i--) printf("%d", ans[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
import sys
 
nN = int(input())
nK = int(input())
nX = int(input())
nY = int(input())
 
nE = 0
nAns = 0
 
if nN <= nK:
  nAns = nX * nN
  print(nAns)
  sys.exit()
  
nE = nN - nK
 
nAns = (nX * nK) + (nY * nE)
print(nAns)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
  static int N;
  static int[] dat;

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    init(n);
    for(int i = 0; i < n; i++) {
      int a = sc.nextInt();
      update(i, a);
    }

    int ans = 1;

    for(int i = 0; i < n; i++) {
      if(i < n - 1) {
        ans = Math.max(ans, gcd(query(0, i, 0, 0, N), query(i + 1, n, 0, 0, N)));
      } else {
        ans = Math.max(ans, query(0, i, 0, 0, N));
      }
    }

    System.out.println(ans);
  }

  public static void init(int n_) {
    int n = 1;
    while(n < n_) {
      n *= 2;
    }
    N = n;
    dat = new int[2 * N - 1];
  }

  public static void update(int k, int x) {
    int a = k + N - 1;
    dat[a] = x;
    while(a > 0) {
      a = (a - 1) / 2;
      dat[a] = gcd(dat[2 * a + 1], dat[2 * a + 2]); 
    }
  }

  public static int query(int a, int b, int k, int l, int r) {
    if((r <= a) || (l >= b)) return 0;
    if((a <= l) && (r <= b)) {
      return dat[k];
    } else {
      int vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
      int vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
      return gcd(vl, vr);
    }
  }

  public static int gcd(int a, int b) {
    if(b == 0) return a;
    return gcd(b, a % b);
  }
}

Measured memory_bytes: 56976
// Aizu Vol-1 0169: Blackjack
// 2017.8.3

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

char *gets(char *);
char buf[500], *p;

int getInt(void)
{
	int n = 0;
	while (isspace(*p)) p++;
	if (!*p) return -1;
	while (isdigit(*p)) n = 10 * n + (*p++ - '0');
	return n;
}

int main()
{
	int k, sum, ace;

	while (1) {
NEXT:	gets(p = buf);
		if (!(k = getInt())) break;
		sum = ace = 0;
		do {
			if (k == 1) k = 0, ace++;
			else if (k >= 10) k = 10;
			sum += k;
			if (sum + ace > 21) { puts("0"); goto NEXT; }
		} while ((k = getInt()) > 0);
		if (ace > 0 && sum + ace - 1 + 11 <= 21) printf("%d\n", sum + ace + 10);
		else printf("%d\n", sum + ace);
	}
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
constexpr int time_limit = 1950;
chrono::system_clock::time_point start, current;
int c[26];
int64_t s[366][26];


int64_t eval(const vector<int> &state, int d){
    int last[26] = {0};
    int64_t csum = 0;
    for(int i=0;i<26;++i) csum += c[i];
    int64_t decl = -csum;
    int64_t score = 0;

    for(int i=1;i<=d;++i){
        score += s[i][state[i]];
        decl += (i - last[state[i]])*c[state[i]];
        last[state[i]] = i;
        score += decl;
        decl -= csum;
    }
    return score;
}

struct simulated_annealing{
    random_device dev;
    mt19937_64 rng;
    uniform_real_distribution<double> dist;
    uniform_int_distribution<int> typ;
    int D;

    simulated_annealing(int d): dist{0.0, 1.0}, typ{0, 25}, D(d){
        rng.seed(1234);
        //rng.seed(dev());
    }

    vector<int> loop(){
        vector<int> state, best_state;
        state.resize(D+1); best_state.resize(D+1);
        for(int i=1;i<=D;++i) state[i] = best_state[i] = typ(rng);
        int64_t curr_score = eval(state, D), best_score = curr_score;

        for(int iter=1;;++iter){
            current = chrono::system_clock::now();
            if(chrono::duration_cast<chrono::milliseconds>(current-start).count() >= time_limit) break;
            auto next_state = neighbor(state);
            int64_t next_score = eval(next_state, D);

            if(next_score >= curr_score || dist(rng) <= probability(curr_score, next_score, temperature(iter))){
                curr_score = next_score;
                state = next_state;
                if(best_score < curr_score){
                    best_score = curr_score;
                    best_state = state;
                }
            }
        }
        return best_state;
    }
    vector<int> neighbor(const vector<int> &curr){
        vector<int> ret{curr};
        int x = rand() % D + 1;
        ret[x] = typ(rng);
        return ret;
    }
    double probability(double score1, double score2, double t){
        if(score1 <= score2) return 1.0;
        else return exp((score2 - score1) / t);
    }
    double temperature(int step){
        return pow(0.9, step);
    }
};

int main(){
    start = chrono::system_clock::now();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);

    int d;
    cin >> d;
    for(int i=0;i<26;++i) cin >>c[i];
    for(int i=1;i<=d;++i){
        for(int j=0;j<26;++j) cin >> s[i][j];
    }
    simulated_annealing sa(d);
    auto ans = sa.loop();

    for(int i=1;i<=d;++i) cout << ans[i] + 1 << endl;

    return 0;
}

Measured memory_bytes: 4248
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main()
{
    string S;
    cin >> S;

    int Q;
    cin >> Q;

    int num_reverses = 0;
    string head, tail;

    for (int i = 0; i < Q; ++i) {
        int T;
        cin >> T;

        if (T == 1) {
            ++num_reverses;
        } else {
            int F;
            char C;
            cin >> F >> C;

            if (F == 1) {
                if (num_reverses % 2 == 0) {
                    head += C;
                } else {
                    tail += C;
                }
            } else {
                if (num_reverses % 2 == 0) {
                    tail += C;
                } else {
                    head += C;
                }
            }
        }
    }

    if (num_reverses % 2 == 0) {
        reverse(begin(head), end(head));
        cout << head + S + tail << endl;
    } else {
        reverse(begin(tail), end(tail));
        reverse(begin(S), end(S));
        cout << tail + S + head << endl;
    }

    return 0;
}


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

//前処理は O(n)、毎回の二項係数計算は O(1)

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

map<int, int>prime_factor(int n) {
	map<int, int>res;
	for (int i = 2; i*i <= n; i++) {
		while (n%i == 0) {
			res[i]++;
			n /= i;
		}
	}
	if (n != 1)res[n]++;//nは素数
	return res;
}

int main() {
	// 前処理
	COMinit();
	int n, m;
	cin >> n >> m;
	map<int, int>mp = prime_factor(m);
	long long ans = 1;
	int k=m;
	if (mp[m] == 1){cout << n << endl;return 0;}
	for (int i = 2; i <= k; i++) {
		while (k%i == 0) {
			//iの素因数
			ans *= COM(n + mp[i] - 1, mp[i]);
			ans %= MOD;
			while (k%i == 0)k /= i;
		}
	}
	if (mp[m] == 1)ans = n;
	cout << ans << endl;
}

Measured memory_bytes: 12160
#include <iostream>
using namespace std;
typedef long long ll;
ll n,m,q,a,b,c,s[12][12],t[12],cnt,ok,ans,u[12];
int main(void){
    cin>>n>>m>>q;
    ans=1e9;
    for(int i=0;i<n;i++){
        cin>>t[i];
        for(int j=0;j<m;j++){
            cin>>s[i][j];
        }
    }
    for(int i=0;i<(1<<n);i++){
        for(int j=0;j<12;j++)u[j]=0;
        cnt=0;
        for(int j=0;j<n;j++){
            if(((i>>j)&1)==1){
                cnt+=t[j];
                for(int k=0;k<m;k++){
                    u[k]+=s[j][k];
                }
            }
        }
        ok=1;
        for(int j=0;j<m;j++){
            //cout<<u[j]<<" "<<q<<endl;
            if(u[j]<q)ok=0;
        }
        if(ok==1)ans=min(ans,cnt);
    }
    if(ans==1e9)cout<<-1<<endl;
    else cout<<ans<<endl;
}


Measured memory_bytes: 3684
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);++i)
#include <algorithm>
using namespace std;
int main(){
    int n;
    int c[4];
    cin >> n;
    rep(i,4) c[i] = 0;
    rep(i,n)
    {
        string t;
        cin >> t;
        if(t == "AC") c[0]++;
        else if(t == "WA") c[1]++;
        else if(t == "TLE") c[2]++;
        else c[3]++;
    }
    cout << "AC x " << c[0] << endl;
    cout << "WA x " << c[1] << endl;
    cout << "TLE x " << c[2] << endl;
    cout << "RE x " << c[3] << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll  long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define e endl
#define bc __builtin_popcount
#define MAXN 200005
#define debug cout<<"we are debuuging"<<endl;
#define MOD 998244353
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
   ll a;
   cin>>a;
   cout<<a+a*a+a*a*a;


}


Measured memory_bytes: 3632
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int a,b,x=1,y=1;
  string s="",t="";
  cin >> a >> b;
  for(int i=0; i<b; i++) {
    s+=to_string(a);
  }
  for(int i=0; i<a; i++) {
    t+=to_string(b);
  }
  if(s<=t) {
    cout << s << endl;
  }
  else {
    cout << t << endl;
  }
}


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

int main() {
  int A, B;
  cin >> A >> B;
  
  int count = 0;
  for(int i=A; i <= B; i++){
    int a,b,d,e;
    a = i/10000%10;
    b = i/1000%10;

    d = i/10%10;
    e = i%10;
    if(a==e && b==d) count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<vector>
#include<algorithm>
using namespace std;
#define ll long long 
#define ull unsigned long long
#define pb push_back
char c[100010];
int main()
{
    cin >> c;
    int f = 0, l, r;
    int n = strlen(c);
    for (int i = 0; i < n - 2; i++)
    {
        if (c[i] == c[i + 1])
        {
            f= 1;
            l = i;
            r = i + 1;
            break;
        }
        else if (c[i] == c[i + 2])
        {
            f= 1;
            l = i;
            r= i + 2;
            break;
        }
    }
    if (c[n - 2] == c[n - 1])
    {
        f = 1;
        l = n - 2;
        r = n - 1;
    }
    if (f)
    {
        cout << l+ 1 << ' ' << r+ 1;
    }
    else
    {
        cout << "-1 -1";
    }
}

Measured memory_bytes: 3704
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int N;
	cin >> N;

	long long ans = 0;
	int minimum = (1e9),cnt= 0;
	bool zero = false;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		if (tmp < 0) cnt++;
		minimum = min(abs(tmp), minimum);
		if (tmp == 0) zero = true;
		ans += abs(tmp);
	}
	
	if (zero || cnt %2 == 0) {
		cout << ans << endl;
	}
	else {
		cout << ans - 2 * minimum << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;


ll n;
vector<ll>a;

int main(){
    cin>>n;
    a.resize(n+1);
    rep(i,n)cin>>a[i+1];
    vector<ll>ans(n+1,0);
    ll M = 0;
    for(int i=n;i>=1;i--){
        int j=2;
        int cnt = 0;
        //倍数の和を求める
        while (i*j<=n){
            if(ans[i*j]==1)cnt++;
            j++;
        }
        if((a[i]%2)!=(cnt%2)){
            ans[i]++;
            M++;
        }
    }
    cout << M << endl;
    for(int i=1;i<=n;i++){
        if(ans[i]==1)cout<<i<<endl;
    }
    return 0;
}


Measured memory_bytes: 6424
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>
#include <map>
#include <string>
#include <climits>
#include <set>
#include <sstream>
#include <utility>
#include <ctime>
#include <cassert>
#include <fstream>
using namespace std;
typedef long long LL;
#define MSV(A,a) memset(A, a, sizeof(A))
#define MP make_pair
#define PB push_back
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define MOD 1000000007
#define MAX 1000000
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';


int main() {

	int x;
	cin>>x;

	if(x>= 400 && x <= 599) cout<<8<<endl;
	else if(x>= 600 && x <= 799) cout<<7<<endl;
	else if(x>= 800 && x <= 999) cout<<6<<endl;
	else if(x>= 1000 && x <= 1199) cout<<5<<endl;
	else if(x>= 1200 && x <= 1399) cout<<4<<endl;
	else if(x>= 1400 && x <= 1599) cout<<3<<endl;
	else if(x>= 1600 && x <= 1799) cout<<2<<endl;
	else if(x>= 1800 && x <= 1999) cout<<1<<endl;


	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=205,p=998244353;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int T,n;
ll a[N];
char s[N];
struct asd{
	ll f[61];
	void clear(){memset(f,0,sizeof(f));}
	void add(ll x){
		for (int i=60;i>=0;i--)
		if (x&(1ll<<i)){
			if (!f[i]) {f[i]=x;return;}
			else x^=f[i];
		}
	}
	bool find(ll x){
		for (int i=60;i>=0;i--)
		if ((x^f[i])<x) x^=f[i];
		return (x==0);
	}
}f;
int main(){
//	freopen("a.in","r",stdin);
//	freopen("a.out","w",stdout);
	T=read();
	while (T--){
		n=read();int fl=0;
		f.clear();
		for (int i=1;i<=n;i++) scanf("%lld ",a+i);
		scanf(" %s",s+1);
		for (int i=n;i;i--)
		if (s[i]=='0'){
			f.add(a[i]);
		}
		else{
			if (!f.find(a[i])){fl=1;break;}
		}
		printf("%d\n",fl);
	}
	return 0;
}


Measured memory_bytes: 3760
#include<stdio.h>
#include<cstring>
using namespace std;
bool flag=false;
char s[10005];
int main ()
{
	scanf("%s",s);
	for(int i=0;i<strlen(s);i++)
	{
		if(s[i]=='C')
		flag=true;
		if(s[i]=='F')
		{
			if(flag)
			{
				printf("Yes\n");
				return 0;
			}
		}
	}
	printf("No\n");
	return 0;
}

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

typedef long long int lli;
typedef long long ll;
typedef long double ld;

int main(){
    int t=1;
    //cin>>t;
    while(t--){
        int k,s;
        cin>>k>>s;
        int c=0;
        for(int i=0;i<=k;i++){
            for(int j=0;j<=k;j++){
                int z=s-i-j;
                if(z<=k && z>=0)
                    c++;
            }
        }
        cout<<c;
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int k = sc.nextInt();
		System.out.println(Math.min(a, k) - Math.max(k - a - b, 0));
	}
}

Measured memory_bytes: 35704