akhauriyash/Code-Regression huggingface dataset:
//  RAKSHIT KADAM

 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 3
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning check the size of arrays!!!
// NUMERIC DEFINITIONS :
    #define INF 1000000000000000005
    #define inf 1000000004
    #define MOD  1000000007
    #define mod 998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
 #define ll long long
 #define int long long
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll ter; cin>> ter; while(ter--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
 
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}

int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 500003;
//ll fact[1000005];
//ll modIN[1000005];
//void facto()
//{
//    ll lim =1000005;fact[0]=1;
//    for(ll i=1;i<lim;i++)
//    {
//        fact[i]=(fact[i-1]*i)%MOD;
//    }
//    modIN[n]=modInverse(fact[n],MOD);
//    for(ll i=n-1;i>=1;i--)
//    {
//        modIN[i] = (modIN[i+1]*(i+1))%MOD;
//    }
//}
//ll ncr(ll a,ll b)
//{
//    ll ret = 0;
//    ret = fact[a]*(modIN[b]);
//    ret%=MOD;
//    ret*=modIN[a-b];
//    ret%=MOD;
//    return ret;
//}

void solve()
{
    ll n;cin>>n;
    ll ans = power(10,n,MOD);
    ans-=2*(power(9,n,MOD))%MOD;
    ans%=MOD;
    ans+=MOD;
    ans%=MOD;
    ans+=power(8,n,MOD);
    ans+=MOD;
    ans%=MOD;
    ans+=MOD;
    ans%=MOD;
    cout<<ans<<endl;
    
}
signed main(){
   Need_for_speed(activated);
//
//    satisfy
//    {
// solve();
//    }
    
  
    solve();

    
    
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <unordered_map>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int N;
int a[3000];

int main(){
    cin>>N;
    rep(i,N) cin>>a[i];

    int ans=0;
    rep(i,N) ans+=a[i]-1;

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){

	//3つの狼の合計が偶数->〇
	//S->0 W->1
	//S->0x53
	//W->0x57
	//o->0x6f
	//x->0x78
	//012345
	//oxooxo
	//SSWWSS
	long long int N, i, h, x = 0, ok = 0;
	char c;
	static char say[100015];
	static long long int dou[100015];
	long long int  sta[2];
	volatile int stop;
	scanf("%lld", &N);
	fflush(stdin);
	for (i = 0; i < N; i++) {
		scanf(" %c", &say[i]);
	}say[N] = say[0]; say[N + 1] = say[1]; say[N + 2] = say[2];
	for (h = 0; h < 4; h++) {
		if (h == 0) { sta[0] = 0; sta[1] = 0; }
		if (h == 1) { sta[0] = 0; sta[1] = 1; }
		if (h == 2) { sta[0] = 1; sta[1] = 0; }
		if (h == 3) { sta[0] = 1; sta[1] = 1; }
		dou[0] = sta[0];
		dou[1] = sta[1];
		for (i = 2; i < N + 2; i++) {
			if (say[i - 1] == 0x6f) { x = 0; }
			else { x = 1; }
			if ((x + dou[i - 1] + dou[i - 2]) % 2 == 1) { dou[i] = 1; }
			else { dou[i] = 0; }
		}
		if (dou[N] == sta[0] && dou[N + 1] == sta[1]) {
			dou[1] = dou[N + 1];
			for (i = 0; i <N; i++) {
				if (dou[i] == 0) { c = 0x53; }
				else { c = 0x57; }
				printf("%c", c);
				ok = 1;
			}
			break;
		}
	}
	if (ok == 0) { printf("-1"); }


	return 0;
}

Measured memory_bytes: 1152
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int A = in.nextInt();
			int B = in.nextInt();
			int C = in.nextInt();
			if(A <= C && C <= B) {
				out.println("Yes");
			} else {
				out.println("No");
			}
		}
	}
		
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
using namespace std;
typedef pair<int,int>pii;
int n;
bool flg=1;
string s[110];
set<string>ss;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s[i];
		if(flg){
			if(ss.count(s[i]))flg=0;
			else ss.insert(s[i]);
		}
	}
	if(!flg){
		puts("No");
		return 0;
	}
	for(int i=2;i<=n;i++){
		if(s[i-1].back()!=s[i].front()){
			puts("No");
			// cout<<i<<endl;
			return 0;
		}
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<ll,pair<ll,ll>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int h, w, k, ans = mod;
vector<string> s(10);

int solve(vector<int> a, int cnt){
    int ret = 0;
    vector<int> sum(cnt);
    rep(i, w){
        rep(j, h)sum[a[j]] += (s[j][i]=='1');
        bool ok = false;
        rep(j, cnt)if(sum[j] > k)ok = true;
        if(ok){
            ret++;
            fill(all(sum), 0);
            rep(j, h)sum[a[j]] += (s[j][i]=='1');
            if(*max_element(all(sum)) > k)return mod;
        }
    }
    return ret;
}

int main(){
    cin >> h >> w >> k;
    rep(i, h)cin >> s[i];
    for(int bit = 0; bit < (1<<h-1); bit++){
        vector<int> a(h);
        int now = 0;
        rep(i, h){
            a[i] = now;
            if(bit & (1<<i))now++;
        }
        chmin(ans, solve(a, now+1)+now);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3648
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)] # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def main():
    h,w = inpm()
    a = inplT(h)
    dic = defaultdict(int)
    for i in range(h):
        for j in range(w):
            x = ord(a[i][j])
            dic[x] += 1
    aaa = 0
    q = 0
    for e in dic:
        if dic[e] != 1 and dic[e]%2 == 1:
            aaa += 1
            q = dic[e]
            if aaa == 2:
                print('No')
                return
    if h%2 == 0 and w%2 == 0:
        for e in dic:
            if dic[e]%4 != 0:
                print('No')
                return
    if (h%2 == 0 and w%2 == 1) or (h%2 == 1 and w%2 == 0):
        cnt = 0
        if aaa:
            print('No')
            return
        else:
            for e in dic:
                if dic[e]%2 != 0:
                    print('No')
                    return
                if dic[e]%4 == 2:
                    cnt += 1
            if h%2 == 0:
                key = h//2
            else:
                key = w//2
            if (key-cnt) < 0 or (key-cnt)%2 != 0:
                print('No')
                return
    if h%2 == 1 and w%2 == 1:
        cnt1 = 0
        cnt2 = 0
        if aaa:
            for e in dic:
                if dic[e]%2 == 1:
                    cnt1 += 1
                elif dic[e]%4 == 2:
                    cnt2 += 1
            if cnt1 != 1:
                print('No')
                return
            key = (h//2) + (w//2)
            if (key-cnt2) < 0 or (key-cnt2)%2 != 0:
                print('No')
                return
        else:
            for e in dic:
                if dic[e] == 1:
                    cnt1 += 1
                elif dic[e]%4 == 2:
                    cnt2 += 1
            if cnt1 != 1:
                print('No')
                return
            q -= 1
            if q%4 == 2:
                cnt2 += 1
            key = (h//2) + (w//2)
            if (key-cnt2) < 0 or (key-cnt2)%2 != 0:
                print('No')
                return
    print('Yes')

if __name__ == "__main__":
    main()

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

int main() {
    int n, k, cnt = 0;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n) {
        cin >> h[i];
        if(h[i] >= k) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

typedef long long int ll;

int N,M;
int X;
int C[20];
int A[20][20];

int B[20];

const int INF=1e8;

int pow(int x,int n){
    int res=1;
    for(int i=0;i<n;++i)res*=x;
    return res;
}

int calc(int b){
    int mon=0;
    for(int i=0;i<M;++i)B[i]=0;
    for(int i=0;i<N;++i){
        if((b&pow(2,i))!=pow(2,i))continue;
        for(int j=0;j<M;++j)B[j]+=A[i][j];
        mon+=C[i];
    }
    for(int i=0;i<M;++i){
        if(B[i]<X)return INF;
    }
    return mon;
}

int main(){
    cin>>N>>M>>X;
    for(int i=0;i<N;++i){
        cin>>C[i];
        for(int j=0;j<M;++j){
            cin>>A[i][j];
        }
    }
    int ans=INF;
    int maxbit=pow(2,N);
    for(int i=0;i<maxbit;++i)ans=min(ans,calc(i));
    if(ans!=INF)cout<<ans<<endl;
    else cout<<-1<<endl;
}

Measured memory_bytes: 3592
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"

using namespace std;

int N;
int beat[100001];
int sum[100001] = {};
int s[100001];
list <int> battle[100001];
multiset<int> num[100001];

int Search(int a) {
	if (sum[a])return sum[a];
	for (auto i = battle[a].begin(); i != battle[a].end(); ++i) {
		num[a].insert(Search(*i));
	}
	int x = 1;
	for (auto i = num[a].rbegin(); i != num[a].rend(); ++i) {
		sum[a] = max(sum[a], *i + x);
		x++;
	}
	return sum[a];
}

int main() {
	cin >> N;
	for (int i = 2; i <= N; i++) {
		cin >> beat[i];
		battle[beat[i]].push_back(i);
	}
	for (int i = 1; i <= N; i++) {
		s[i] = (int)battle[i].size();
	}
	cout << Search(1) << endl;
	return 0;
}

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

int main(){
	int n,m,ans=0;
	cin >> n >> m;
	for(int i = 1 ; i <= n ; i += 1){
		for(int j = 20 ; j <= m ; j += 1){
			if(j % 10 >= 2){
				int t = j;
				t /= 10;
				if((t%10) * (j%10) == i){
					ans += 1;
				}
			}
		}
	}
	cout << ans << endl;
}

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

using namespace std;

unsigned int d[101];

int main()
{
	unsigned int n;
	unsigned int num;
	cin >> n;
	for (unsigned int i = 0; i < n; ++i)
		cin >> d[i];

	for (unsigned int i = 0; i < n; ++i) {
		unsigned int minj = i;
		for (unsigned int j = i+1; j < n; ++j) {
			if (d[j] < d[minj]) {
				minj = j;
			}
		}
		if (i != minj) {
			unsigned int t = d[i];
			d[i] = d[minj];
			d[minj] = t;
			++num;
		}
	}
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << d[i] << " ";
	cout << d[n-1] << "\n" << num << endl;
	return 0;
}
     


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

#define ft first
#define sd second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )
const int  p=31,po=1,N=1e5+10, M=(ll)1e9+1 ;
const int mod = 1e9+7 ;
ll s;
vl compute(string s){
        vl has(s.length());
        ll i;

        for(i=0;i<s.length();i++){
            if(i==0){
                has[i]=((s[i]-'a'+1))%mod;
            }
            else
                has[i]=(has[i-1]*p + (s[i]-'a'+1))%mod;
        }
        return has;
}
// vl ed[N],g[N],in(N),vis(N,0),cost(N,0);
vl g[N],vis(N,0);

// vl vis(N,0);
// bool check(ll x){
//   ll i,j,k;
//   for(i=0;i<N;i++)  g[i].clear();
//   memset(in,0,sizeof(in));
//   ll tar=ed[x][0];
//   for(i=1;i<=m;i++){
//     if(ed[i][0]>tar){
//       g[ed[i][1]].pb(g[ed[i][2]]);
//       ++in[ed[i][1]];
//     }
//   }

// }
// ll dp[101][(ll)1e9+1];
vl ans(N,-1);
ll result=0;
ll dp(ll x){
  // vis[x]=1;
  if(ans[x]!=-1)
    return ans[x];
  ll m=0;
  for(auto &it:g[x]){
    m=max(m,ans[it]+1);
  }
  ans[x]=m;
  result=max(result,ans[x]);
  return ans[x];
}
// vl cr(N);
// ll vis[5][5],actual[5][5];
// ll vis[1010][1010];

int main(){
 ios_base::sync_with_stdio(0);
  ll i,n;
  cin >> n;
  vl a(n);
  map<ll,ll>m1,m2;
  for(i=0;i<n;i+=2){
    cin >> a[i] >> a[i+1];
    m1[a[i]]++;
    m2[a[i+1]]++;
  }
  ll x,y;
  x=y=0;
  ll xm,ym,f1,f2;
  xm=ym=f1=f2=0;
  vll v1,v2;
  v1.pb(mp(0,-1));
  v2.pb(mp(0,-1));
  for(auto &it:m1){
      v1.pb(mp(it.second,it.first));
  }
  for(auto &it:m2){
      v2.pb(mp(it.second,it.first));
  }
  sort(v1.rbegin(),v1.rend());
  sort(v2.rbegin(),v2.rend());
  if(v1[0].second!=v2[0].second){
    cout << n-v1[0].first-v2[0].first;
    
  }
  else{
    cout << min(n-v1[0].first-v2[1].first,n-v1[1].first-v2[0].first);
  }
  
}

Measured memory_bytes: 13560
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
#include <queue>
using namespace std;

typedef long long ll;
vector<vector<int>> path(10005);

int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N-1; i++){
        int a,b;
        cin >> a >> b;
        path[a].push_back(b);
        path[b].push_back(a);
    }
    vector<int> c(N);
    ll sum = 0;
    for(int i = 0; i < N; i++){
        cin >> c[i];
        sum += c[i];
    }
    sort(c.begin(), c.end(), greater<>());
    sum -= c[0];
    queue<pair<int, int>> q;

    vector<int> ans(N+1);
    ans[1] = c[0];
    q.push(make_pair(1, -1));
    int idx = 1;

    while(!(q.empty())){
        int now = q.front().first;
        int p = q.front().second;
        for(int i = 0; i < path[now].size(); i++){
            if(path[now][i] == p) continue;
            q.push(make_pair(path[now][i], now));
            ans[path[now][i]] = c[idx];
            idx++;
        }
        q.pop();
    }
    cout << sum << endl;
    for(int i = 1; i <= N; i++)
        cout << ans[i] << endl;
}



Measured memory_bytes: 1024
# 2019/08/11

from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
lcd=(n*m)//gcd(n,m)
x={}
aa=(lcd//n)
bb=(lcd//m)
for i in range(n):
    a=i*aa
    x[a]=s[i]

for i in range(m):
    b=i*bb
    if b in x and x[b]!=t[i]:
        print(-1)
        exit()
    
print(lcd)


Measured memory_bytes: 17492
#include<stdio.h>
int main(void){
int x, y;
int i;
int gcd, A;
while(1){
  scanf("%d%d",&x, &y);
  if(x>=1 && y<=1000000000)break;
}
if(x>y){
  while(1){
  A=x%y;
  if(A==0){gcd=y; break;}
  else{x=y; y=A;}
  }
}else if(x<y){
  while(1){
  A=y%x;
  if(A==0){gcd=x; break;}
  else{y=x; x=A;}
  }
}else gcd=x;
printf("%d\n",gcd);
return 0;
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int>vi;
#define pb push_back
#define sc(n) scanf("%d",&n)
#define lsc(n) scanf("%lld",&n)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define rev1(i,n) for(i=n;i>0;i--)
#define in insert
#define IT ::iterator
#define pr(n) printf("%d\n",n)
#define lpr(n) printf("%lld\n",n);


int main()
{
    int n,i;
   cin >> n;
   for(i=1;i<=9;i++)
   {
   	if(n%i==0)
	{
		int c=n/i;
		if(c>=1 && c<=9)
		{
			cout << "Yes";
			return 0;
		}
	}
   }
   cout << "No";
    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>

#define N 100001

int main(void)
{
	int i, n, judge = 1;
	long long int h[N];

	scanf("%d", &n);

	for (i = 0; i < n; i++)
		scanf("%lld", &h[i]);

	for (i = 1; i < n; i++)
	{
		if (h[i] > h[i - 1])
			h[i]--;
		else if (h[i] < h[i - 1])
		{
			judge = 0;
			break;
		}
	}
	printf(judge ? "Yes\n": "No\n");
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

ll gcd(ll a, ll b){//最大公約数
  if (b == 0){
    return a;
  }
  return gcd(b, a%b);
}

ll lcm(ll a, ll b){//最小公倍数
  ll c = gcd(a, b);
  return a / c * b;
}

int main(){
  int n;
  cin >> n;
  ll ans = 1LL;
  rep(i,n){
    ll t;
    cin >> t;
    ans = lcm(ans, t);
  }
  cout << ans << endl;
}


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

using namespace std;

int n, p;
string s;

bool compareDirectly (const pair<pair<string, int>, int> &a, const pair<pair<string, int>, int> &b) {
    if (a.first.first < b.first.first) {
        return true;
    } else if (a.first.first > b.first.first) {
        return false;
    } else {
        if (a.first.second < b.first.second){
            return false;
        } else if (a.first.second > b.first.second && a.first.first >= b.first.first){
            return true;
        } else{
            return false;
        }
    } 
}

int main(){
    vector< pair< pair<string, int>, int > > r;
    cin >> n;

    for(int i = 0; i < n; i++){
        cin >> s >> p;
        r.push_back(make_pair(make_pair(s, p), i+1));
    }

    sort(r.begin(), r.end(), compareDirectly);
    
    for(int i = 0; i < n; i++){
        cout << r[i].second << endl;
    }

}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
{
    public static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[,] a = new int[n, n];
        for (int i = 0; i < n; i++)
        {
            int[] s = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int u = s[0] - 1;
            for (int j = 0; j < s[1]; j++)
            {
                int v = s[2 + j] - 1;
                a[u, v] = 1;
            }
        }
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                if (j != n - 1)
                    Console.Write("{0} ", a[i, j]);
                else
                    Console.WriteLine("{0}", a[i, j]);
            }
        }
    }
}


Measured memory_bytes: 17948
package main

import "fmt"

func main() {
	var amount,count int
	var a [3]int
	for i := 0 ; i < 3; i++ {
		fmt.Scan(&a[i])
	}
	fmt.Scan(&amount)
	for i := 0 ; i <= a[0] ; i++ {
		for j := 0 ; j <= a[1] ; j++ {
			rem := (amount - i * 500 - j * 100) / 50
			if rem < 0 {
				continue
			}else if rem <= a[2] {
				count++
				//fmt.Println("500 : ",i, " 100 : ",j, " 50 : ",rem)
			}
		}
		if (i+1) * 500 > amount {
			break
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
N=32768
p=[ i for i in range(N)]
for i in range(2, int(N**0.5)+1):
    if p[i]:
        for j in range(i*i,N,i):
            p[j]=0

p=sorted(set(p))[2:]
while True:
    n = int(input())
    if n==0:
        break
    c=0
    if n&1:c=int(n-2 in p)
    else:
        for x in p:
            if x>n//2:
                break
            if n-x in p:
                c += 1
    print(c)


Measured memory_bytes: 6968
fn main() {
    let (k, s) = read();
    let s = solve(&k, &s);
    write(s);
}
 
fn read() -> (String, String) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s = s.trim().to_string();

    let mut t = String::new();
    std::io::stdin().read_line(&mut t).ok();
    t = t.trim().to_string();

    (s, t)
}
 
fn write(b: bool) {
    println!("{}", if b {"Yes"} else {"No"});
}
 
fn solve(s: &str, t: &str) -> bool {
    s == &t[..t.len() - 1]
}

Measured memory_bytes: 2108
import java.util.*;
public class Main {
  public static void main(String args[]) {
  	Scanner scan = new Scanner(System.in);
    String string = scan.next();
    String text = scan.next();
    int row = string.length()+1;
    int col = text.length()+1;
    int[][] lcs = new int[row][col];
    char[][] backtrack = new char[row][col]; 
    for(int i=1; i<row; i++) {
      for(int j=1; j<col; j++) {
        if(string.charAt(i-1)==text.charAt(j-1)) {
          lcs[i][j]=lcs[i-1][j-1]+1;
          backtrack[i][j]='D';
        }else{
          lcs[i][j]=Math.max(lcs[i-1][j],lcs[i][j-1]);
          backtrack[i][j] = lcs[i-1][j]>lcs[i][j-1] ? 'U' : 'R';
        }
      }
    }
    String match = printSequence(backtrack,row-1,col-1,text);
    System.out.println(match);
  }
  
  public static String printSequence(char[][] path, int i, int j, String text) {
  	if(i==0||j==0){
      return "";
    }else if(path[i][j]=='D') {
      return printSequence(path,i-1,j-1,text)+text.charAt(j-1);
    }else if(path[i][j]=='U') {
      return printSequence(path,i-1,j,text);
    }else{
      return printSequence(path,i,j-1,text);
    }
  }  
}

Measured memory_bytes: 120180
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a, b;
  cin >> a >> b;
  cout << max({a + b, a - b, a * b}) << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define mod 998244353
#define xx first
#define yy second
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define N 200005

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());



int n;
string niz[N];
int ima[N];

bool has[1000005][27];

struct node{
    int deca[30];
    ll ima[30];
};

node traj[1000005];

bool cmp(string x, string y){return x.length() > y.length();}

int main()
{

    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    ff(i,1,n)cin >> niz[i];
    sort(niz + 1, niz + n + 1, cmp);


    ll res = 0;
    int z = 0;
    ff(i,1,n){
        int m = niz[i].length();
        if(m == 1){
            res += ima[niz[i][0] - 'a'];
            ima[niz[i][0] - 'a']++;
            continue;
        }
        ff(j,0,25)has[0][j] = 0;
        ff(j,0,m - 1){
            if(j){
                ff(k,0,25)has[j][k] = has[j-1][k];
            }
            has[j][niz[i][j] - 'a'] = 1;

        }
        int target = niz[i][0] - 'a';
        bool kurac = 0;
        int r = 0;
        fb(j,m-1,1){
            int tr = niz[i][j] - 'a';
            if(!traj[r].deca[tr]){
                kurac = 1;
                break;
            }
            r = traj[r].deca[tr];
        }
        if(!kurac)res += traj[r].ima[target];

        r = 0;
        fb(j,m-1,1){
            int tr = niz[i][j] - 'a';
            if(!traj[r].deca[tr]){
                traj[r].deca[tr] = ++z;
            }
            r = traj[r].deca[tr];
            ff(k,0,25){
                if(has[j - 1][k]){
                    traj[r].ima[k]++;
                }
            }
        }
        ff(k,0,25){
            if(has[m - 1][k])ima[k]++;
        }
    }
    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 382172
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>

bool app[26];

using namespace std;
int main() {
  string s; cin >> s;
  for ( int i = 0; i < s.length(); i++ ) {
    app[s[i]-'a'] = true;
  }

  for ( int i = 0; i < 26 ; i++ ) {
    if ( !app[i] ) {
      cout << char(i+'a') << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 512
use proconio::input;

fn main() {
    input! {
        a: i64,
        b: i64,
        h: i64,
        m: i64,
    }

    let short = (6 * m) as f64;
    let long = (30 * h) as f64 + 0.5 * m as f64;
    let diff = if (short - long).abs() <= 180.0 {
        (short - long).abs()
    } else {
        360.0 - (short - long).abs()
    };
    let a_sq = (a * a + b * b) as f64 - (2 * a * b) as f64 * (diff / 180.0 * std::f64::consts::PI).cos();
    let ans = a_sq.sqrt();
    println!("{}", ans);
}


Measured memory_bytes: 3020
#include <iostream>
#include <vector>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

// DPテーブル
const int MAX_N = 1110;
const int MAX_W = 12110;
int dp[MAX_N][MAX_W]; // 12 種類だが余裕をもつ

int main() {
    int W;
    cin >> W;
    int n; cin>>n;
    // 品物を列挙 (価値はすべて 1)
    vector<int> weight(n);
    vector <int> v(n);
    for(int i=0;i<n;i++){
        int a,b; cin>>a>>b;
        weight[i] = a, v[i] = b;
    }

    // DP初期条件: dp[i][0] = 0
    for (int i = 0; i < MAX_N; ++i) for (int w = 0; w < MAX_W; ++w) dp[i][w] = 1145141919; // INF
    for (int i = 0; i <= n; ++i) dp[i][0] = 0;

    // DPループ
    for (int i = 0; i < n; ++i) {
        for (int w = 0; w <= 11000; ++w) {
            dp[i + 1][w] = min(dp[i + 1][w], dp[i][w]);
            if (w >= weight[i]) dp[i + 1][w] = min(dp[i + 1][w], dp[i + 1][w - weight[i]] + v[i]);
        }
    }

    int ans = 1145141919;
    for(int i=W;i<11910;i++){
        chmin(ans, dp[n][i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 52736
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		// 入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[] list = new int[N];
		for (int i = 0; i < N; i++) {
			list[i] = sc.nextInt();
		}
		sc.close();

		int ans = 0;
		int MaxHeight = 1;
		// 今見ている山
		for (int i = 0; i < N; i++) {
			if(MaxHeight <=  list[i]) {
				ans++;
				MaxHeight = list[i];
			}
		}
		System.out.println(ans);

	}
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
//#define mp make_pair

vector<string> v;
int n, l;


int main(){
ios::sync_with_stdio(0);
cin.tie(0);

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

cin >> n >> l;
rep(i, 0, n-1){
string s;
cin >> s;
v.pb(s);
}

sort(v.begin(), v.end());

rep(i, 0, n-1)cout << v[i];

return 0;}


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    cout << (b - a == c - b ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const long long MOD = 1000000007;

signed main(){
    string S;
    cin >> S;
    if(S.back() == 's') S += "es";
    else S += "s";
    PRINT(S);
    return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

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

    vector<long> A(N), B(N);
    for (long n = 0; n < N; n++) cin >> A[n];
    for (long n = 0; n < N; n++) cin >> B[n];

    long cnt = 0, sum = 0;
    vector<long> excess(N);
    for (long n = 0; n < N; n++) {
        excess[n] = A[n] - B[n];
        if (excess[n] < 0) {
            cnt++;
            sum += -excess[n];
        }
    }

    if (cnt == 0) {
        cout << 0 << endl;
        return 0;
    }

    sort(excess.rbegin(), excess.rend());

    for (long n = 0; n < N; n++) {
        if (excess[n] <= 0) {
            cout << -1 << endl;
            return 0;
        }

        sum -= excess[n];

        if (sum <= 0) {
            cout << cnt + n + 1 << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    const ll INF = 1000000000000;
    ll H, W, hA, hB, hC, hBC, wA, wB, wC, wBC, SA, SB, SC, t;
    ll ans1 = INF, ans2 = INF, ans3 = INF, ans4 = INF, anser;
    cin >> H >> W;
    
    for(hA = 1; hA <= H-2; hA++) {
        hB = (H - hA)/2;
        hC = H - (hA + hB);
        SA = hA*W;  SB = hB*W;  SC = hC*W;
        ll S[] = {SA, SB, SC};
        sort(S, S+3);
        t = S[2] - S[0];
        ans1 = min(ans1, t);
    }

    for(hA = 1; hA <= H-1; hA++) {
        hBC = H - hA;
        wB = W/2;
        wC = W - wB;
        SA = hA*W;  SB = hBC*wB;  SC = hBC*wC;
        ll S[] = {SA, SB, SC};
        sort(S, S+3);
        t = S[2] - S[0];
        ans2 = min(ans2, t);
    }

    for(wA = 1; wA <= W-2; wA++) {
        wB = (W - wA)/2;
        wC = W - (wA + wB);
        SA = H*wA;  SB = H*wB;  SC = H*wC;
        ll S[] = {SA, SB, SC};
        sort(S, S+3);
        t = S[2] - S[0];
        ans3 = min(ans3, t);
    }

    for(wA = 1; wA <= W-1; wA++) {
        wBC = W - wA;
        hB = H/2;
        hC = H - hB;
        SA = H*wA;  SB = hB*wBC;  SC = hC*wBC;
        ll S[] = {SA, SB, SC};
        sort(S, S+3);
        t = S[2] - S[0];
        ans4 = min(ans4, t);
    }

    anser = min({ans1, ans2, ans3, ans4});

    cout << anser;
    
    cout << endl;
    return 0;
}

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

int main(void)
{
    int n,x,t,count,time;
    scanf("%d %d %d",&n,&x,&t);
    
    if(n%x==0)
    {
        count = n/x;
        time = count*t;
    }
    
    else
    {
        count = n/x + 1;
        time = count*t;
    }
    
    printf("%d",time);
    return 0;
    
    
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
#define BOOST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ll long long
#define test(t) int t ; cin>>t ; while(t--)
ll mulmod(ll a, ll b, ll mod){ll res = 0;a = a % mod;while (b > 0){if (b % 2 == 1)res = (res + a) % mod;a = (a * 2) % mod;b /= 2;}return res % mod;}
ll n;
int main(){
    BOOST;
    cin >> n;
    if(n%2 == 0){
        cout << n ;
    }else{
        cout << n*2;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
d = {}
e = 0
for ai in a:
  s = ai // 400
  if s > 7:
    e += 1
  else:
    if s in d:
      d[s] += 1
    else:
      d[s] = 1
print(max(1, len(d)), len(d) + e)


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

signed main() {
  int n, m;
  cin >> n >> m;
  vector<int> h(n);
  for (auto& x : h) cin >> x;

  vector<vector<int>> g(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    int ma = 0;
    for (int x : g[i]) ma = max(ma, h[x]);
    ans += (ma < h[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 9860
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    vector<int> v(n+1, 0);
    for(int x=1; x<=n; ++x){
        int y = x;
        for(int a=2; a<=y; ++a){
            while(y % a == 0){
                ++ v[a];
                y /= a;
            }
        }
    }

    vector<int> dp(75+1, 0);
    dp[1] = 1;
    for(int i=2; i<=n; ++i){
        for(int x=75; x>=1; --x){
            for(int j=1; j<=v[i]; ++j){
                int y = x * (j + 1);
                if(y <= 75)
                    dp[y] += dp[x];
            }
        }
    }
    cout << dp[75] << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  mint ans = 0;
  rep(i, 60){
    ll zero = 0;
    ll one = 0;
    for(int j = 0; j < n; ++j){
      if((a[j] >> i) & 1) one++;
      else zero++;
    }
    mint tmp = one * zero;
    for(int j = 0; j < i; ++j){
      tmp *= 2;
    }
    ans += tmp;
  }

  cout << ans.x << endl;
}


Measured memory_bytes: 2560
import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n=int(input())
count=0
flag=0
tag=0
bsdk=0
for i in range(n):
    s=input()
    if s=="AC":
        count=count+1
    elif s=="WA":
        flag=flag+1
    elif s=="TLE":
        tag=tag+1
    else:
        bsdk=bsdk+1
print("AC x",count)
print("WA x",flag)
print("TLE x",tag)
print("RE x",bsdk)


Measured memory_bytes: 68060
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

int main() {
  int H, W;
  char a[20][20];
  cin >> H >> W;
  rep(i, H) {
    rep(j, W) {
      cin >> a[i][j];
    }
  }
  int ans = 0;
  rep(i, H) {
    rep(j, W) {
      int temp = 0;
      if(a[i][j] == '.') {
        int sx = i;
        int sy = j;
        int visited[20][20];
        rep(i, H) {
          rep(j, W) {
            visited[i][j] = -1;
          }
        }
        queue<P> que;
        que.push({sx, sy});
        visited[i][j] = 0;
        temp = 0;
        while(que.size()) {
          P p = que.front();
          que.pop();
          int x = p.first;
          int y = p.second;
          int dx[4] = {-1, 1, 0, 0};
          int dy[4] = {0, 0, -1, 1};
          rep(k, 4) {
            int nx = x + dx[k];
            int ny = y + dy[k];
            if(0 <= nx && nx < H && 0 <= ny && ny < W && a[nx][ny] == '.' && visited[nx][ny] == -1) {
              que.push({nx, ny});
              visited[nx][ny] = visited[x][y] + 1;
              temp = max(temp, visited[nx][ny]);
            }
          }
        }
        // rep(i, H) {
        //   rep(j, W) {
        //     cout << visited[i][j];
        //   }
        //   cout << endl;
        // }
        // cout << endl;
        ans = max(ans, temp);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3560
#include <stdio.h>
#include <ctype.h>

int main(void){
    char ch;
    int alfa[27] = {};
    int i;
    i=0;
    while(scanf("%c", &ch) != EOF){
        if(isupper(ch)){
            ch = tolower(ch);
        }
        i = ch - 'a';
        alfa[i] += 1;
    }
    for(i=0;i<26;i++){
        printf("%c : %d\n",i+'a',alfa[i]);
    }
    return(0);
}

Measured memory_bytes: 548
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(x) (x).begin(), (x).end()
int main() {
  string s ;
  cin >> s;
  sort(ALL(s));
  int cnt=0;
  for(int i=0; i<s.size(); i++) {
    if(s[i] == s[i-1] || i == 0){
      cnt++;
    } else if (s[i] != s[i-1] && i != 0){
      if (cnt%2!=0) {
        cout << "No" << endl;
        return 0;
      }
      cnt=1;
    }
  }

  if(s.size() == 1) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  int x;
  cin >> x;
  int ans = 0;
  ans += (x / 500) * 1000;
  x -= (x / 500) * 500;
  ans += (x / 5) * 5;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

int N;
char c[36];
int a[36];
pair<int, char> p[100], q[100];

void bubbleSort() {
  rep(i, N-1) {
    for(int j = N-1; j >= i+1; j--) {
      if(p[j].first < p[j-1].first) {
        swap(p[j-1], p[j]);
      }
    }
  }
}

bool selectoinSort() {
  bool ff = false;
  rep(i, N-1) {
    int ind = i;
    bool f = false;
    for(int j = i+1; j < N; j++) {
      if(q[j].first == q[ind].first) {
        f = true;
      }
      if(q[j].first < q[ind].first) {
        ind = j;
        if(f) ff = true;
      }
    }
    swap(q[i], q[ind]);
  }
  return ff;
}

int main() {

  cin >> N;
  rep(i, N) {
    cin >> c[i] >> a[i];
    p[i].first = a[i];
    p[i].second = c[i];
    q[i].first = a[i];
    q[i].second = c[i];
  }

  bubbleSort();
  rep(i, N) {
    cout << p[i].second << p[i].first;
    if(i != N-1) cout << " ";
    else cout << endl;
  }
  cout << "Stable" << endl;

  bool res = selectoinSort();
  rep(i, N) {
    cout << q[i].second << q[i].first;
    if(i != N-1) cout << " ";
    else cout << endl;
  }

  if(res) cout << "Not stable" << endl;
  else cout << "Stable" << endl;

  return 0;
}


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

int main() {
    int N;  cin >> N;
    int cnt = 0;
    for (int i = 0; i < N; ++i) {
        int a, b;  cin >> a >> b;
        if (a == b) ++cnt;
        else cnt = 0;
        if (cnt >= 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3632
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
        System.out.println(a+b+c-Math.max(a,Math.max(b,c)));
    }
}

Measured memory_bytes: 23124
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
using namespace std;

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

    cout << ((N <= 999) ? "ABC" : "ABD") << endl;
    
    return 0;

}

Measured memory_bytes: 256
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define mpi         map<pair<ll int,ll int>,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;
 
#define N  100005
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int n;
		cin>>n;
		string s;
		cin>>s;
		ll int cnt=0;
		for(ll int i=1;i<n;i++) if(s[i]!=s[i-1]) cnt++;
		cout<<cnt+1;
	}
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

string s;
string table[] = { "1111", "2222", "3333", "4444",
"5555", "6666", "7777", "8888", "9999" };
int changei(string s){
	stringstream ss;
	int res;
	ss << s;
	ss >> res;
	return res;
}

int main(){
	while (cin >> s){
		if (s == "0000")break;
		bool f = 0;
		REP(i, 9){
			if (s == table[i])f = 1;
		}
		if (f){
			cout << "NA" << endl;
			continue;
		}
		int ans = 0;
		while (s != "6174"){
			ans++;
			string t, u;
			sort(ALL(s));
			t = s;
			sort(ALL(s), greater<int>());
			u = s;
			int k = changei(u) - changei(t);
			stringstream ss;
			ss << k;
			ss >> s;
			reverse(ALL(s));
			while (s.size() < 4){
				s += '0';
			}
			reverse(ALL(s));
		}
		cout << ans << endl;
	}
}

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

using namespace std;

int main()
{
  int N, m;
  cin >> N >> m;
  bool th[1001] = {false};
  for(int i = 0; i < m; i++) {
    int c, d; cin >> c >> d;
    for(int j = c; j < d; j++) th[j] = true;
  }
  int ans = N + 1;
  for(int i = 0; i < N; i++) {
    if(th[i]) ans += 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define LOOP(val, times)   for(val = 0; val < (times); val++)
bool hh(vector<int> a,int n){//要素がすべて０ならfalse
  int i;
  LOOP(i,n){
    if(a[i]!=0) return true;
  }
  return false;
}
int nn(vector<int> &a,int &n){
  n++;
  a.push_back(0);
  int mini=800;
  int fast=0;
  int end=0;
  int ans=0;
  int kk=0;
  int i=0;
  while(hh(a,n)){
    
    if(a[i]==0 && kk!=0){
      end=i-1;
      for(int j=fast;j<=end;j++){
        if(a[j]!=0){
          a[j]-=mini;
        }
      }
      ans+=mini;
      mini=800;
      fast=i;
      kk=0;
    }
    if(a[i]!=0){
      kk=1;
      mini=min(mini,a[i]);
    }  
    i++;
    if(i==n+1) {
      i=0;
      fast=0;
    }
  }
  return ans;
}
int main(){
  int n;
  cin>>n;
  vector<int> aa(n);
  int i;
  LOOP(i,n){
    cin>>aa[i];
  }
  cout<<nn(aa,n)<<endl;
}
  


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
int n, m, k, ans;

int main() {
    cin >> n;
    cout << n / 3 << endl;
    return 0;
}


Measured memory_bytes: 3648