akhauriyash/Code-Regression huggingface dataset:
char m[110];int a[101],b[101];
char *T="abcdefghijklmnopqrstuvwxyz";
#define X(n) m[n]=T[(strchr(T,m[n])-T+b[i]-a[i])%26],
main(){
  int N,i,c;
  for(;scanf("%d",&N),N;){
    scanf("%s",m+1);
    for(i=1;i<=N;i++)scanf("%d%d",a+i,b+i);
    for(i=N;i;i--)
      X(a[i])X(b[i])c=m[a[i]],m[a[i]]=m[b[i]],m[b[i]]=c;
    printf("%s\n",m+1);
  }
}

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

int main()
{
    long a, b, v, w;
    long t;
    cin >> a >> v >> b >> w >> t;

    long distance = (a > b) ? a - b : b - a;
    long diff_v = (v - w) * t;

    if (distance <= diff_v)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
using namespace std;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int i1 = i % 10;
		int i10 = ((i - i1) / 10) % 10;
		int i100 = ((i - i1 - i10 * 10) / 100) % 10;
		int i1000 = ((i - i1 - i10 * 10 - i100 * 100) / 1000) % 10;
		int i10000 = ((i - i1 - i10 * 10 - i100 * 100 - i1000 * 1000) / 10000) % 10;
		int sum = i1 + i10 + i100 + i1000 + i10000;
		if (sum >= a&&sum <= b) {
			ans += i;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)

signed main(){

	lli n,k;
	cin>>n>>k;

	vector<lli> a(n);
	REP(i,0,n)cin>>a[i];

	lli dp[100100];
	/*dp[i]: 0負け 1勝ち*/
	/*      遷移先が全て勝ちならその人負けにする*/
	/*      遷移先に一つでも負けがあるならその人の勝ちにする */

	for(lli i=0;i<=k;i++){
		lli flag=0;
		for(lli j=0;j<n;j++){
			lli next = i-a[j];
			if(next<0)continue;
			if(dp[next] == 0){
				flag=1;
				dp[i]=1;
				break;
			}
		}
		if(flag==0){
			dp[i]=0;
		}
	}
	if(dp[k]==0)cout<<"Second"<<endl;
	else cout<<"First"<<endl;

	return 0;
}

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

inline int read()
{
	int ret=0; char c=getchar();
	while(c<48||c>57)c=getchar();
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	return ret;
}

long long l,r,mi;

int main()
{
	l=read(); r=read();
	if(l/2019!=r/2019){
		puts("0");
		return 0;
	} 
	mi=2020*2020;
	for(int i=l;i<r;++i)
	for(int j=l+1;j<=r;++j){  //min  int ll
		mi=min(mi,(long long)i*j%2019);
	}
	cout<<mi;
}

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

int main() {
  int n;
  cin >> n;
  string cmd, str;
  set<string> dic;
  int i;
  for (i = 0; i < n; i++) {
    cin >> cmd >> str;
    if (cmd == "insert") {
      dic.insert(str);
    } else {
      cout << (dic.find(str) != dic.end() ? "yes" : "no") << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 32548
#include <iostream>

using namespace std;
using ll = long long;

int main()
{
    int n;
    ll c;
    cin >> n >> c;
    ll *x = new ll[n];
    int *v = new int[n];
    for (int i = 0; i < n; i++) {
        cin >> x[i];
        cin >> v[i];
    }

    ll prev;
    ll next;

    ll *r = new ll[n];
    prev = v[0] - x[0];
    r[0] = prev;
    ll tmp = r[0];
    ll *r2 = new ll[n];
    r2[0] = prev - x[0];
    ll tmp2 = r2[0];
    for (int i = 1; i < n; i++) {
        next = prev + v[i] - x[i] + x[i-1];
        if (tmp < next) {
            r[i] = next;
            tmp = next;
            if (tmp2 < next - x[i]) {
                r2[i] = next - x[i];
                tmp2 = next - x[i];
            }
        }
        else {
            r[i] = tmp;
            r2[i] = tmp2;
        }
        prev = next;
    }
    
    ll *l = new ll[n];
    prev = v[n-1] - c + x[n-1];
    l[n-1] = prev;
    tmp = l[n-1];
    ll *l2 = new ll[n];
    l2[n-1] = prev - c + x[n-1];
    tmp2 = l2[n-1];
    for (int i = n-2; i >= 0; i--) {
        next = prev + v[i] + x[i] - x[i+1];
        if (tmp < next) {
            l[i] = next;
            tmp = next;
            if (tmp2 < next - c + x[i]) {
                l2[i] = next - c + x[i];
                tmp2 = next - c + x[i];
            }
        }
        else {
            l[i] = tmp;
            l2[i] = tmp2;
        }
        prev = next;
    }


    ll max = 0;
    if (max < r[n-1]) max = r[n-1];
    if (max < l[0]) max = l[0];

    for (int i = 1; i < n; i++) {
        ll t = r2[i - 1] + l[i];
        if (t > max) max = t;
    }
    for (int i = n-2; i >= 0; i--) {
        ll t = l2[i+1] + r[i];
        if (t > max) max = t;
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 4608
#include <iostream>
#include <string>
#include <vector>

#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)

using lint = long int;
using llint = long long int;
using namespace std;

int main() {
    fastIO;
    string s;
    cin >> s;
    string ans(s.size(), 'x');
    cout << ans << endl;
}



Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			String line = sc.nextLine();
			Scanner scan = new Scanner(line);
			int n = scan.nextInt();
			int s = scan.nextInt();
			if (n == 0)
				break;
			int[] a = new int[n];
			System.out.println(comb(a, 0, 0, s));
		}
	}

	static int comb(int[] a, int b, int ix, int s) {
		if (ix == a.length) {
			// 合計がsになるか？
			int sum = 0;
			for (int i = 0; i < a.length; i++)
				sum += a[i];
			if (sum == s) {
				return 1;
			}
			// なれば 1、そうでなければ 0 と数える
			return 0;
		}
		int sum = 0;
		for (int i = b; i <= 9; i++) {
			a[ix] = i;
			sum += comb(a, a[ix] + 1, ix + 1, s);
		}
		return sum;
	}
}

Measured memory_bytes: 24736
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
int d[3][123456];
//main
signed main(){
  int N,M;cin>>N>>M;
  std::vector<int> edge[N];
  for(int i=0;i<M;i++){
    int a,b;cin>>a>>b;a--;b--;
    edge[a].push_back(b);
  }
  for(int i=0;i<3;i++)for(int j=0;j<123456;j++)d[i][j]=LINF;
  typedef pair<int,int> P;
  queue<P> que;
  int s,t;cin>>s>>t;s--;t--;
  que.push(P(s,0));
  d[0][s]=0;
  while(que.size()){
    P p=que.front();que.pop();
    int u=p.first;
    for(int q:edge[u]){
      if(d[(p.second+1)%3][q]<=d[p.second][p.first]+1)continue;
      d[(p.second+1)%3][q]=d[p.second][p.first]+1;
      que.push(P(q,(p.second+1)%3));
    }
  }
  if(d[0][t]<LINF)cout<<d[0][t]/3<<endl;
  else cout<<"-1"<<endl;
}


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

void solver(){
	//type your code here
	int H , W;
	int h , w;
	cin >> H >> W >> h >> w;
	cout << (H-h)*(W-w) << endl;
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int queries = 1;
	//(cin >> queries);
	for(int i = 0 ; i < queries ; ++i){
		solver();
	}
	return 0;
}


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

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int N = 2e5;
const int P = 1e9+7;
char a[N+3];
llong f[N+3],sf[N+3];
int n,m; llong ans;

int main()
{
	scanf("%d%d",&n,&m); scanf("%s",a+1);
	for(int i=1; i<=m; i++) a[i] = a[i]=='R'?0:1;
	if(a[1]) {for(int i=1; i<=m; i++) a[i] ^= 1;}
	int lim = m,cur = 0;
	for(int i=1; i<=m; i++)
	{
		if(a[i]==a[1]) {cur++;}
		else
		{
			if(cur==i-1) {lim = cur&1?cur:cur+1;}
			else {if(cur&1) lim = min(lim,cur);}
			cur = 0;
		}
	}
	if(cur==m)
	{
		f[1] = 1ll; for(int i=2; i<=n; i++) f[i] = (f[i-1]+f[i-2])%P;
		ans = (f[n]+f[n-1]+f[n-1])%P;
		printf("%lld\n",ans);
	}
	else
	{
		if(n&1) {puts("0"); return 0;}
//		printf("lim=%d\n",lim);
		lim>>=1,n>>=1; f[1] = sf[1] = 1ll;
		for(int i=2; i<=n; i++)
		{
			f[i] = (sf[i-1]-sf[max(0,i-lim-2)]+P)%P; sf[i] = (sf[i-1]+f[i])%P;
		}
		for(int i=1; i<=n; i++) if(n-i<=lim)
		{
			ans = (ans+f[i]*(n-i+1ll))%P;
		}
		printf("%lld\n",(ans+ans)%P);
	}
	return 0;
}

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

vector <int> adia[100010];

int calc(int nod, int tata)
{
    int ans = 0;
    vector <int> fii;
    for (auto i : adia[nod]) {
        if (i == tata)
            continue;
        int x = calc(i, nod);
        ans ^= (x + 1);
    }

    return ans;
/*
    if (fii.size() == 0)
        return 0;
    sort(fii.begin(), fii.end());

    int mex = 0;
    for (auto i : fii) {
        if (i == mex)
            mex++;
        else if (i > mex)
            return mex;
    }
    return mex;*/
}

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

    while (--n) {
        cin >> a >> b;
        adia[a].push_back(b);
        adia[b].push_back(a);
    }

    cout << (calc(1, 0) ? "Alice" : "Bob");
    return 0;
}


Measured memory_bytes: 10368
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  int K, S;
  cin >> K >> S;

  long long ret = 0;
  for (int i = 0; i <= K; ++i) {
    for (int j = 0; j <= K; ++j) {
      if (i + j <= S && S - i - j <= K)
        ++ret;
    }
  }

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
#define INF 1e9
typedef long long ll;

int main(void){
  int N;cin >> N;
  ll ans_sum=0,abs_min=INF;
  int n_negative=0;
  int i;REP(i,N){
    ll x;
    cin >> x;
    if(x<0)n_negative++; 
    if(abs(x)<abs_min) abs_min=abs(x);
    ans_sum+=abs(x);
  }
  if(n_negative%2==0) cout << ans_sum << endl;
  else cout << ans_sum - 2*abs_min << endl;;
  return 0;
}


Measured memory_bytes: 256
from collections import deque
n = int(input())
a = list(input().split())

ball = []
for i in range(n, 0, -1):
    c = 2
    while i * c <= n:
        if a[i*c-1] == "1":
            a[i-1] = "1" if a[i-1] == "0" else "0"
        c += 1
    if a[i-1] == "1":
        ball.append(str(i))

print(len(ball))
if ball != []: print(" ".join(ball))


Measured memory_bytes: 16180
// Beginner162.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

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

bool has7(int n)
{
	while (n > 0)
	{
		int c = n % 10;
		if (c == 7) return true;
		n /= 10;
	}
	return false;
}

int gcd(int a, int b)
{
	while (b != 0)
	{
		int t = b;
		b = a % b;
		a = t;
	}
	return a;
}

int main()
{
	//A
	/*int n;
	cin >> n;
	bool has = has7(n);
	cout << (has ? "Yes" : "No");*/

	//B
	/*int n;
	cin >> n;

	ll result = 0;
	for (int i = 1; i <=n; ++i)
	{
		if (i % 3 != 0 && i % 5 != 0)
		{
			result += i;
		}
	}
	cout << result;*/
	
	//C
	/*int k;
	cin >> k;

	ll result = 0;
	vector<vector<int>> v(k + 1, vector<int>(k + 1, 0));
	for (int i = 1; i <= k; ++i)
	{
		for (int j = i; j <= k; ++j)
		{
			int g = gcd(i, j);
			v[i][j] = g;
			v[j][i] = g;
		}
	}
	
	for (int i = 1; i <=k; ++i)
	{
		for (int j = 1; j <= k; ++j)
		{
			int ij = v[i][j];
			
			for (int l = 1; l <= k; ++l)
			{
				int ijl = v[ij][l];
				result += ijl;
			}
		}
	}
	
	cout << result;*/

	//D
	/*int n;
	string s;
	cin >> n >> s;

	ll result = 0;

	vector<vector<int>> count(n, vector<int>(3, 0));
	for (int i = n-1; i >=0; --i)
	{
		if (s[i] == 'R') count[i][0]++;
		else if (s[i] == 'G') count[i][1]++;
		else count[i][2]++;

		if (i < n-1)
		{
			for (int j = 0; j < 3; ++j)
			{
				count[i][j] += count[i + 1][j];
			}
		}
	}

	for (int i = 0; i < n-2; ++i)
	{
		for (int j = i+1; j < n-1; ++j)
		{
			if (s[i] == s[j]) continue;

			int charIndex;
			if (s[i] != 'R' && s[j] != 'R') charIndex = 0;
			else if (s[i] != 'G' && s[j] != 'G') charIndex = 1;
			else charIndex = 2;

			result += count[j + 1][charIndex];
			int checkIndex = j + j - i;
			if (checkIndex < n && s[checkIndex] != s[i] && s[checkIndex] != s[j])
			{
				result--;
			}
		}
	}
	
	cout << result;*/
	
	//E

	//F
	
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	vector<ll> dp(n,0);
	dp[0] = 0;
	vector<ll> prefix(n);
	prefix[0] = a[0];
	for (int i = 2; i < n; i += 2) {
		prefix[i] = prefix[i - 2] + a[i];
	}
	for (int i = 1; i < n; i++) {
		if (i % 2 == 0) {
			dp[i] = max(dp[i - 1], dp[i - 2] + a[i]);
		}
		else {
			dp[i] = i == 1 ? a[i] : a[i] + dp[i - 2];
			dp[i] = max(dp[i], prefix[i - 1]);
		}
	}
	cout << dp[n-1];
	
	
}



Measured memory_bytes: 7216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

int main(){
    int n;cin>>n;
    int qctr,bctr;
    qctr=bctr=0;
    rep(i,n){
        int a;cin>>a;
        if(a%4==0)qctr++;
        else if(a%2==0)bctr++;
    }
    if(qctr>=n/2)cout<<"Yes"<<endl;
    else if(qctr+bctr/2>=n/2)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

typedef long long ll;

const char nl = '\n' ;
const ll MOD = 1e9 + 7;


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

   int n; cin >> n;
   map<int, int> s;
   for(int i =0; i < n; i++)
   {
      int x; cin >> x;
      s[x]++;
   }
   cout << s.size() <<nl;
   return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define max(a, b) (((a) > (b)) ? (a) : (b))

int main(void) {
	int i;
	int q;

	scanf("%d", &q);

	while (q--) {
		int n;
		int cnt;

		scanf("%d", &n);

		cnt = 0;
		while (n > 9) {
			char str[8];
			int len;
			int max;

			sprintf(str, "%d", n);
			len = strlen(str);

			max = 0;
			for (i = 1; i < len; i++) {
				char substr1[7], substr2[7];

				strncpy(substr1, str, i);
				substr1[i] = '\0';
				strcpy(substr2, str + i);

				max = max(max, atoi(substr1) * atoi(substr2));
			}
			n = max;

			cnt++;
		}

		printf("%d\n", cnt);
	}

	return 0;
}

Measured memory_bytes: 624
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

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

    if(X == 7 || X == 5 || X == 3)cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
def f(n,a):
    if n==1:
        print(1)
        exit()
    pre=a[1]-a[0]
    ans=1
    for i in range(2,n):
        if pre*(a[i]-a[i-1])<0:
            pre=0
            ans+=1
        else:
            if a[i]-a[i-1]:###
                pre=a[i]-a[i-1]
    return ans

n=int(input())
*a,=map(int,input().split())
print(f(n,a))

Measured memory_bytes: 86848
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

char s[2001][2000];
short a[2000][2000], r;
int h, w;

void f() {
    for (int i = 0; i < h; i++) {
        int t = 0;
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '#') {
                t = 0;
            } else {
                t++;
                r = max(r, a[i][j] += t);
            }
        }
    }
}

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

    cin >> h >> w;

    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }

    int n = min(h, w);
    int m = max(h, w);

    for (int k = 0; k < 2; k++) {
        for (int l = 0; l < 2; l++) {
            f();
            if (l == 1) break;

            for (int i = 0; i < h; i++) {
                reverse(s[i], s[i] + w);
                reverse(a[i], a[i] + w);
            }
        }
        if (k == 1) break;

        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < m; j++) {
                swap(s[i][j], s[j][i]);
                swap(a[i][j], a[j][i]);
            }
        }
        swap(h, w);
    }

    cout << r - 3 << endl;

    return 0;
}

Measured memory_bytes: 12032
#include <iostream>
using namespace std;
main() {
	int h, w;
	while (cin >> h >> w, h!=0||h!=w) {
		for (int j=0; j<w; j++) cout << "#";
		cout << endl;
		for (int i=1; i<h-1; i++) {
			cout << "#";
			for (int j=1; j<w-1; j++) cout << ".";
			cout << "#" << endl;
		}
		for (int j=0; j<w; j++) cout << "#";
		cout << endl << endl;
	}
}

Measured memory_bytes: 3012
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>

#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define REP(i, n) for(int i=1; i<=(int)(n); i++)

const int INF = 100100100;
using namespace std;

typedef pair<int, int> P;
const int di[4] = {-1, 0, 1, 0};
const int dj[4] = {0, -1, 0, 1};

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> field(H);
    
    rep(i, H) {
        cin >> field[i];
    }

    int ans = 0;
    rep(i, H) {
        rep(j, W) {
            if (field[i][j] == '#') continue;
            vector<vector<int> > dist(H, vector<int>(W, INF));
            queue<P> q;
            dist[i][j] = 0;
            q.push(P(i,j));
            while (!q.empty()) {
                P v = q.front(); q.pop();
                rep(dir, 4) {
                    int ni = v.first + di[dir]; int nj = v.second + dj[dir];
                    if (ni<0||ni>=H||nj<0||nj>=W) continue;
                    if (field[ni][nj] == '#') continue;
                    if (dist[ni][nj] != INF) continue;
                    dist[ni][nj] = dist[v.first][v.second] + 1;
                    q.push(P(ni, nj));
                }
           }

            rep(si,H)rep(sj,W){
                if (dist[si][sj] == INF) continue;
                ans = max(ans, dist[si][sj]);
            }

        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	int p = 0;
	for(int i = 0; i < n; i++){
		int x; cin >> x;
		if(p + 1 == x) p++;
	}
	if(p == 0) return cout << -1 << endl, 0;
	cout << n - p << endl;
	return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

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

    for(int x=1;x<=n;x++){
        int s=x*108/100;
        if(s==n){
            cout<<x<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
    return 0;
}

Measured memory_bytes: 256
n=input()
a = list(map(int, input().split()))
a.sort()
h, w =0, 0
while True:
    try:
        if a[-1] == a[-2]:
            h = a[-1]
            a.pop()
            a.pop()
            break
        else:
            a.pop()
    except:
        break

while True:
    try:
        if a[-1] == a[-2]:
            w = a[-1]
            a.pop()
            a.pop()
            break
        else:
            a.pop()
    except:
        break
print(h*w)

Measured memory_bytes: 14248
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

signed main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i != j)
                ans += v[i] * v[j];
        }
    }
    cout << ans / 2 << "\n";
}

Measured memory_bytes: 256
import math
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(N):
    if i < N - 1 and x >= a[i] or i == N - 1 and x == a[i]:
        ans += 1
        x -= a[i]
print(ans)


Measured memory_bytes: 62124
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin >> n;
	vector<int> heights(n); fore(e, heights) cin >> e;
	ford(i, n-2, 0) {
		if(heights[i] > heights[i+1]) heights[i]--;
		if(heights[i] > heights[i+1]) { println("No"); return 0; }
	}
	println("Yes");
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = (a), i_len = (b); i < i_len; ++i)

const int INF = 1e9 + 7;

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

    int a[1000], b[1000], c[1000], dist[100][100];

    REP(i, 0, m) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--, b[i]--;
    }

    REP(i, 0, n) REP(j, 0, n) {
        if(i == j) dist[i][j] = 0;
        else       dist[i][j] = INF;
    }

    REP(i, 0, m) {
        dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
        dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
    }

    REP(k, 0, n) REP(i, 0, n) REP(j, 0, n) 
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);

    
    int ans = m;
    /*
    REP(i, 0, m) {
        bool shortest = false;
        REP(j, 0, n) if(dist[j][a[i]] + c[i] == dist[j][b[i]]) shortest = true;
        if(shortest) ans -= 1;
    }
    */

    bool used[m];
    REP(i, 0, m) used[i] = false;
    REP(s, 0, n) REP(t, 0, n) {
        REP(i, 0, m) if(dist[s][a[i]] + c[i] + dist[b[i]][t] == dist[s][t]) used[i] = true;
    }

    REP(i, 0, m) if(used[i]) ans -= 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>
#include<map>

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1e9 + 7)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl


typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

void solve() {

	int n = in(), tmp;
	vector<char> s(1, '\0');

	while (n != 1 && n != 0) {
		tmp = n % (-2);
		if (tmp == -1) {
			s.insert(s.begin(), '1');
			n = n / (-2) + 1;
			continue;
		}
		s.insert(s.begin(), n % (-2) + '0');
		n /= (-2);
	}

	s.insert(s.begin(), n + '0');

	for (int i = 0; s[i] != '\0'; i++) {
		cout << s[i];
	}
	cout << endl;

	return;

}

int main() {

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

	solve();

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  ll N = S.length();
  REP(i,N/2){
    if (S[i] != S[N-i-1]){
      cout << "No" << "\n";
      return 0;
    }
  }
  ll NN = (N-1)/2;
  REP(i,NN/2){
    if (S[i] != S[NN-i-1]){
      cout << "No" << "\n";
      return 0;
    }
  }
  ll NNN = (N+3)/2;
  REP3(i,NNN-1,N){
    if (S[i] != S[N-i+NNN-2]){
      cout << "No" << "\n";
      return 0;
    }
  }
  cout << "Yes" << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <array>
#include <iomanip>
using namespace std;
long Nchoose2(long n){
    return n*(n-1)/2;
}
int main(){
    int x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;
    long long ans = 0;
    vector<int> p(a);
    vector<int> q(b);
    vector<int> r(c);
    for(int i = 0; i < a; i++){
        cin >> p[i];
    }
    for(int i = 0; i < b; i++){
        cin >> q[i];
    }
    for(int i = 0; i < c; i++){
        cin >> r[i];
    }
    
    sort(p.begin(), p.end());
    sort(q.begin(), q.end());
    vector<int> sn(x+y+c);
    int ind = 0;
    for(int i = a-1; i > a-1-x; i--){
        sn[ind] = p[i];
        ind ++;
    }
    for(int i = b-1; i > b-1-y; i--){
        sn[ind] = q[i];
        ind ++;
    }
    for(int i = 0; i < c; i++){
        sn[ind] = r[i];
        ind ++;
    }
    sort(sn.begin(), sn.end());
    
    for(int i = x+y+c-1; i > x+y+c-1-(x+y); i--){
        ans += sn[i];
    }
    cout << ans << endl;
    // cout << tmp1 << endl;
    // cout << tmp2 << endl;
}

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

using namespace std;

int main(void)
{
	string s;
	cin >> s;
	vector<int> v(s.length() + 1, 0), w(s.length() + 1, 0);
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '<') {
			v[i + 1] = v[i] + 1;
		}
	}
	for (int i = s.length() - 1; i >= 0; i--) {
		if (s[i] == '>') {
			w[i] = w[i + 1] + 1;
		}
	}
	long long sum = 0;
	for (int i = 0; i <= s.length(); i++) {
		sum += max(v[i], w[i]);
	}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 4740
s=input()
li=list(set([s[i] for i in range(len(s))]))
k=int(input())
c=0
for i in range(len(s)):
  if s[i] != "1":
    t = s[i]
    j=i
    c=1
    break
if c==0:
  print(1)
else:
  if j<=k-1:
    print(t)
  else:
    print(1)

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

using namespace std;
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvs = vector<vector<string>>;
template<typename T> using vv = vector<vector<T>>;
template<typename T> using vvv = vector<vector<vector<T>>>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using pqg = priority_queue<T, vector<T>, greater<T>>;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

#define _sel(_1, _2, x, ...) x
#define repn(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) _sel(__VA_ARGS__, reps, repn)(i, __VA_ARGS__)
#define reppn(i, n) for (ll i = 1; i <= (n); i++)
#define repps(i, a, b) for (ll i = (a); i <= (b); i++)
#define repp(i, ...) _sel(__VA_ARGS__, repps, reppn)(i, __VA_ARGS__)
#define rrepn(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define rrep(i, ...) _sel(__VA_ARGS__, rreps, rrepn)(i, __VA_ARGS__)
#define rreppn(i, n) for (ll i = (n); i >= 1; i--)
#define rrepps(i, a, b) for (ll i = (b); i >= (a); i--)
#define rrepp(i, ...) _sel(__VA_ARGS__, rrepps, rreppn)(i, __VA_ARGS__)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define rng(v) (v).begin(), (v).end()
#define rrng(v) (v).rbegin(), (v).rend()
#define siz(x) int((x).size())
#define pow2(x) (1ll << (x))
#define bit(x, n) ((x) >> (n) & 1)
#define prt(x) cout << (x) << endl
#define dbg(x) dbgn(#x, x)

template<typename T, typename U> inline bool umax(T& m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U> inline bool umin(T& m, U x) { if (m > x) { m = x; return true; } return false; }
template<typename T> inline void errv(T& v) { for (auto x: v) cerr << x << " "; cerr << endl; }
inline void errv(vb& v) { for (auto x: v) cerr << (x ? 1 : 0) << " "; cerr << endl; }
template<typename T> inline void dbgn(string n, T x) { cerr << n << ": " << x << endl; }
template<typename T> inline void dbgn(string n, vector<T>& v) { cerr << n << ": "; errv(v); }
template<typename T> inline void dbgn(string n, vv<T>& m) { cerr << n << ":" << endl; for (auto& v: m) errv(v); }


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

    ll ans = 1;
    vl a(n);
    rep(i, n) {
        cin >> a[i];
        if (a[i] == 0) {
            prt(0);
            return 0;
        }
    }

    rep(i, n) {
        if (LINF / a[i] < ans) {
            prt(-1);
            return 0;
        }
        ans *= a[i];
    }

    prt(ans);

    return 0;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<long long> X(N), Y(N), Z(N);
    for (int i = 0; i < N; i++)
        cin >> X[i] >> Y[i] >> Z[i];
    vector<vector<long long>> cakes = {X, Y, Z};

    long long res = -(1LL << 60);
    for (int i = 0; i < (1 << 3); i++) {
        vector<long long> sum;
        for (int j = 0; j < N; j++) {
            long long s = 0;
            for (int k = 0; k < 3; k++) {
                if ((i >> k) & 1) {
                    s += cakes[k][j];
                } else {
                    s -= cakes[k][j];
                }
            }
            sum.push_back(s);
        }
        sort(sum.begin(), sum.end(), greater<long long>());
        long long s = 0;
        for (int j = 0; j < M; j++)
            s += sum[j];
        res = max(res, s);
    }

    cout << res << endl;
    return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int v[3],ans;
    while(cin >> v[0] >> v[1] >> v[2])
    {
        sort(v, v+3);
        ans = v[2] - v[1];
        v[0] += ans;
        v[0] = v[2] - v[0];
        if(v[0] % 2 == 0)
            ans += v[0]/2;
        else
            ans += v[0]/2 + 2;
        cout << ans << '\n';
    }
    return 0;
}

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

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

  if(a < 0 and 0 < b) cout << "Zero" << endl;
  else if(0 < a and 0 < b) cout << "Positive" << endl;
  else if(a < 0 and b < 0) cout << ((b-a)%2 ? "Positive" : "Negative")  << endl;

  return 0;
}


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

using namespace std;

void bubbleSort(vector<int> vec,size_t N){
  size_t flag = 1;
  size_t i=0;
  size_t count =0;
  for(size_t i=0; flag; i++){
    flag =0;
    for(size_t j=N-1 ; j>=i+1; j--){
      if(vec[j]<vec[j-1]){
      swap(vec[j],vec[j-1]);
        flag = 1;
        count++;
      }

    }
  }

  for(size_t i=0 ; i< N ; i++){
     if(i == N-1){
       cout<< vec[i];
     }
 else    cout<< vec[i] << " " ;
  }
  cout <<endl;

  cout<< count << endl;
}



int main(){
  size_t N;
  cin>> N;
  vector<int> vec(N);
  for(size_t i=0;i< N;i++){
    cin>> vec[i];
  }

  bubbleSort(vec,N);

 return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int k, a, b;
	cin >> k >> a >> b;
	for (int i = a; i <= b; i ++)
	{
		if (i % k == 0)
			return cout << "OK", 0;
	}
	cout << "NG";
}

Measured memory_bytes: 3620
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    int N;
    cin >> N;

    vector<int > A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    bitset<24> B(0);
    long long sum = 0;
    long long ans = 0;

    int right = 0;
    for (int left = 0; left < N; left++) {
        if (right <= left) right = left;
        while (right < N && ((B ^ bitset<24>(A[right])).to_ullong() == (sum + A[right]))) {
            sum += A[right];
            B ^= bitset<24>(A[right]);
            right++;
        }
        ans += (right - left);
        sum -= A[left];
        B ^= A[left];
    }

    cout << ans << endl;

    return 0;
}














































Measured memory_bytes: 1024
N, Q = (int(i) for i in input().split())
S = str(input())

ac_count = [0] *(N+1)

for i in range(N):
  if S[i:i+2] == "AC":
    ac_count[i+1] = ac_count[i] + 1
  else:
    ac_count[i+1] = ac_count[i]

LR = []
for i in range(Q):
  LR.append([int(i) for i in input().split()])

for l,r in LR:
  ans = ac_count[r-1] - ac_count[l-1]
  print(ans)


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

signed main(){
  unsigned long long int N;
  cin >> N;
  vector<char>B(100);
  vector<char>A(26);
  int count=0;
  A[1]='a';
  A[2]='b';
  A[3]='c';
  A[4]='d';
  A[5]='e';
  A[6]='f';
  A[7]='g';
  A[8]='h';
  A[9]='i';
  A[10]='j';
  A[11]='k';
  A[12]='l';
  A[13]='m';
  A[14]='n';
  A[15]='o';
  A[16]='p';
  A[17]='q';
  A[18]='r';
  A[19]='s';
  A[20]='t';
  A[21]='u';
  A[22]='v';
  A[23]='w';
  A[24]='x';
  A[25]='y';
  A[0]='z';
  for(int i=0;i<100;i++){
    if(N%26!=0){
      B[i]=A[N%26];
      N/=26;
    }
    else{
    B[i]='z';
    N/=26;
    N--;
    }
    if(N==0){
      count=i;
      break;
    }
  }
  for(int i=count;i>=0;i--){
    cout << B[i];
  }
  cout << endl;
}


Measured memory_bytes: 3616
#include <stdio.h>

int main(){
  int flag,i,minj,j,N,A[100],tmp,count=0;
  flag = 1;
  i = 0;
  
  scanf("%d",&N);
  if(N > 100 || N < 0) return 0;
  
  while(i < N){
    scanf("%d",&A[i]);   
   if(A[i] > 100 || A[i] < 0) return 0;
   
   i++;
  }
 
    for(i = 0 ; i <= N - 1;i++){
      minj = i;
      
      for(j = i; j <= N -1;j++){
	if (A[j] < A[minj]){
	  minj = j;
	}
      }
      if(i != minj){
      tmp = A[minj];
      A[minj] = A[i];
      A[i] = tmp;
      count++;
      }
    }
  	
for(j = 0; j <= N-2;j++){
  	printf("%d ",A[j]);
 }
 printf("%d",A[j]);

 printf("\n%d\n",count);

  return 0;
}



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

using namespace std;

int n,k,x[100010],y[100010];
char c[100010];

int cnt[1010][1010][2]={0};
int b[1010][1010]={0},w[1010][1010]={0};

int main(){
    cin>>n>>k;
    for(int i=0;i<n;++i){
        cin>>x[i]>>y[i]>>c[i];
        if((x[i]/k)%2==(y[i]/k)%2){
            if(c[i]=='W')cnt[x[i]%k][y[i]%k][0]++;
            else cnt[x[i]%k][y[i]%k][1]++;
        }
        else{
            if(c[i]=='W')cnt[x[i]%k][y[i]%k][1]++;
            else cnt[x[i]%k][y[i]%k][0]++;
        }
    }

    for(int i=0;i<k;++i){
        w[i][0]=0;
        b[i][0]=0;
        for(int j=0;j<k;++j){
            w[i][j+1]=w[i][j]+cnt[i][j][0];
            b[i][j+1]=b[i][j]+cnt[i][j][1];
        }
    }

    int res=-1,s,t;
    for(int i=0;i<k;++i){
        for(int j=0;j<k;++j){
            if(j==0){
                s=t=0;
                for(int l=0;l<k;++l){
                    s+=w[l][k]-w[l][i]+b[l][i];
                    t+=b[l][k]-b[l][i]+w[l][i];
                }
            }
            else{
                s-=(w[j-1][k]-w[j-1][i]+b[j-1][i]);
                s+=b[j-1][k]-b[j-1][i]+w[j-1][i];
                t-=(b[j-1][k]-b[j-1][i]+w[j-1][i]);
                t+=w[j-1][k]-w[j-1][i]+b[j-1][i];
            }
            res=max(res,s);
            res=max(res,t);
        }
    }

    cout<<res<<endl;

}

Measured memory_bytes: 17024
from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    g[a-1].append(b)
    g[b-1].append(a)
q=deque()
q.append(1)
check=[0]*n
check[0]=1
ans=[0]*n
while len(q)!=0:
    v=q.popleft()
    for u in g[v-1]:
        if check[u-1]==0:
            check[u-1]=1
            ans[u-1]=v
            q.append(u)
print("Yes")
for i in range(1,n):
    print(ans[i])

Measured memory_bytes: 35072
import java.io.*;

/**
 * ??´??°?????\??? "x" ????????????x???3????????????????????????
 * (1 ??? x ??? 100)
 * 
 * (ex)
 * 1 -> 1
 * 3 -> 27
 * 100 -> 1000000
 * 
 * @author shirakawa_d
 */
class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            String line = br.readLine();
            System.out.println(getCubicOf(line));
        } catch (Exception e) {
            System.out.println(e);
        }
    }

    /**
     * @param line
     *            ??´??°x?????\???
     * @return x???3???
     */
    private static long getCubicOf(String line) {
        long x = Long.parseLong(line);
        return (long)Math.pow(x, 3);
    }
}

Measured memory_bytes: 24184
#include<stdio.h>
#include<string.h>
int main(){
	int n,x,i,j;
	char s[]=	"0000000";
	char a[][9]={   "0111111",
			"0000110",
			"1011011",
			"1001111",
			"1100110",
			"1101101",
			"1111101",
			"0100111",
			"1111111",
			"1101111",};
	while(scanf("%d",&n)!=EOF){
		if(n==-1)break;
		strcpy(s,"0000000");
		for(i=0;i<n;i++){
			scanf("%d",&x);
			for(j=0;j<7;j++){
				if(s[j]!=a[x][j])s[j]='1';
				else s[j]='0';
			}
			printf("%s\n",s);
			strcpy(s,a[x]);
		}
	}
	return 0;
}

Measured memory_bytes: 0
x=input().split()
n=int(x[0])
m=int(x[1])
adj=[[] for i in range(n)]
inp=[[0]*2 for i in range(m)]
count=0
visited=[False for i in range(n)]
def dfs(u):
    visited[u]=True
    for v in adj[u]:
        if not visited[v-1]:
            dfs(v-1)
for i in range(m):
    x=input().split()
    a=int(x[0])
    b=int(x[1])
    inp[i][0]=a
    inp[i][1]=b
ind=0
for i in inp:
    visited=[False for ii in range(n)]
    adj=[[] for iii in range(n)]
    inp[ind]=[]
    for j in inp:
        if j!=[]:
            adj[j[0]-1].append(j[1])
            adj[j[1]-1].append(j[0])
    
    dfs(0)
    for k in visited:
        if k==False:
            count+=1
            break
    inp[ind]=i
    ind+=1
print(count)

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		String s1, s2;

		s1 = in.next();
		s2 = in.next();

		String s = "";
		for (int i = 0; i < s2.length(); i++) {
			s += "" + s1.charAt(i) + s2.charAt(i);
		}
		if(s2.length() < s1.length()) {
			s += "" + s1.charAt(s1.length() - 1);
		}

		System.out.println(s);
	}
}


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

// マクロ
// forループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair

int N, M, A[200000], B[200000];

vector<int> G[100000];
int dist[100000];
queue<int> Q;
int sign[100000];

int main() {
    cin >> N >> M;
    REP(i, M) {
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
        G[A[i]].PB(B[i]);
        G[B[i]].PB(A[i]);
    }

    REP(i, N) dist[i] = MOD;

    dist[0] = 0;
    Q.push(0);

    while (Q.size()) {
        int pos = Q.front(); Q.pop();
        for (int i = 0; i < G[pos].size(); i++) {
            int to = G[pos][i];
            if (dist[to] != MOD) continue;
            dist[to] = dist[pos] + 1;
            Q.push(to);
            sign[to] = pos + 1;
        }
    }

    PRINT("Yes");
    FOR(i, 1, N-1) PRINT(sign[i]);

    return 0;
}

Measured memory_bytes: 12392
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))

using namespace std;
char a;

int main(){
  int ans = 0;
  REP(i,3){
    cin >> a;
    if(a=='1') ans ++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
N = int(input())
cells = []
for idx, a in enumerate(map(int, input().split())):
    cells.extend([idx + 1 for _ in range(a)])

for i in range(H):
    if i % 2 == 0:
        print(*cells[i*W:(i+1)*W])
    else:
        print(*cells[i*W:(i+1)*W][::-1])


Measured memory_bytes: 3828
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

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

    bool ans = false ;
    if(abs(a-c)<=d){
      ans = true ;
    }else if(abs(a-b)<=d && abs(b-c)<=d){
      ans = true ;
    }
     
  if(ans)
    cout << "Yes" << endl ;  
  else
    cout << "No" << endl ;  
    
	return 0;
}



Measured memory_bytes: 256
/* while(!cin.eof()) */
 
#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define mod 998244353
#define endl '\n'
#define MAXI (int)(3e17+10)
#define N 1000005

// int k, n, q, ans = 0;
// int a[55][5];

// void printArray(int arr[], int size) 
// { 
//     int temp = 0;
//     // for(int i=0;i<size;i++)
//     //     cout << arr[i] << " ";
//     // cout << endl;
//    // cout << q << endl;
//     for(int i=0;i<q;i++)
//     {
//         if(arr[a[i][1]-1] - arr[a[i][0]-1] == a[i][2])
//             temp += a[i][3];
//     }

//     ans = max(ans, temp);
// } 
  
// /* The core function that recursively generates and prints all sequences of  
//   length k */
// void printSequencesRecur(int arr[], int n, int k, int index) 
// { 
//    int i; 
//    if (k == 0) 
//    { 
//      printArray(arr, index); 
//    } 
//    if (k > 0) 
//    { 
//       for(i = 1; i<=n; ++i) 
//       { 
//         arr[index] = i; 
//         printSequencesRecur(arr, n, k-1, index+1); 
//       } 
//    } 
// } 
  
  
// /* A function that uses printSequencesRecur() to prints all sequences  
//    from 1, 1, ..1 to n, n, ..n */
// void printSequences(int n, int k) 
// { 
//     int *arr = new int[k]; 
//     printSequencesRecur(arr, n, k, 0); 
  
//     delete(arr); // free dynamically allocated array 
//     return; 
// } 


// Driver code to test above functions
int32_t main()
{
  
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    // int x;
    // cin >> x;

    // double y = 1.01, z = x/(100*1.0);
    // int ans = 1;
    // while(1)
    // {
    //     if(y>=z){
    //         cout << ans;
    //         return 0;
    //     }

    //     y *= 1.01;
    //     ans++;
    // }

    // int k, n, q;
    // cin >> k >> n >> q;

    // for(int i=0;i<q;i++)
    //     cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];

    // printSequences(n, k);

    //int arr[] = {1, 3, 4};

    //printArray(arr, 3);

    //cout << ans;

    int x;
    cin >> x;

    int y = 100, ans = 0;

    while(y<x){
        y*=1.01;
        ans++;
    }

    cout << ans;


    return 0;

} 


Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#define int long long
using namespace std;
signed main(){
  int n,k,h[100000],ans=1145141919;
  cin>>n>>k;
  for(int i=0;i<n;i++)cin>>h[i];
  sort(h,h+n);
  for(int i=0;i<n-k+1;i++){
    ans=min(ans,h[i+k-1]-h[i]);
    
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

from bisect import bisect_left, bisect_right

N = I()
L = III()

L.sort(reverse=True)
L2 = L[::-1]

ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        p = bisect_right(L2,L[i]-L[j])
        if N-1-p-j>=0:
            ans += N-1-p-j

print(ans)

Measured memory_bytes: 45316
#include <iostream>
#include <string>
#include <memory.h>
#include <vector>

#define TABLESIZE 1000000

int pow(int base, int index){
  int output = 1;
  for(int i = 0; i < index; i++){
    output *= base;
  }
  return output;
}
using namespace std;

template <class T>
class HashTable{
private:
  T table[TABLESIZE];
  int hash_val;

private:
  void key2int(string key){
    int len = key.size();
    hash_val = 0;
    for(int i = 0; i < len; i++){
      hash_val += (key[i]-'A'+1)*(pow(4,i));
    }
  }

  int hash1(){
    return hash_val % TABLESIZE;
  }

  int hash2(){
    return 1 + hash_val % (TABLESIZE-1);
  }

  int hash(int i){
    return (hash1()+i*hash2()) % TABLESIZE;
  }

public:
  HashTable();
  void insert(string key);
  bool find(string key);
};

template<class T>
HashTable<T>::HashTable(){
  for(int i = 0; i < TABLESIZE; i++){
    table[i] = "";
  }//ここはsizeofとかtableへの代入型がわからなかったら困るなぁとおもう
}

template<class T>
void HashTable<T>::insert(string key){
  key2int(key);
  int i = 0;
  int index;
  while(1){
    index = hash(i);
    //printf("%s %d\n",key.c_str(),index);
    if(table[index] == key){
      return;
    }else if(table[index] == ""){
      table[index] = key;
      return;
    }
    i++;
  }
  return ;
}

template <class T>
bool HashTable<T>::find(string key){
  key2int(key);
  int i = 0;
  int index;
  while(1){
    index = hash(i);
    //printf("%s %d\n",key.c_str(),index);
    if(table[index] == key){
      return true;
    }
    else if(table[index] == "" || i >= TABLESIZE){
      return false;
    }
    i++;
  }
}

enum commands{
  INSERT = 0,
  FIND = 1,
  NOP = 2,
};

commands command2enum(string command){
  if(command == "insert") return INSERT;
  if(command == "find") return FIND;
  return NOP;
}

int main(){
  HashTable<string>* H = new HashTable<string>();
  int n;
  cin >> n;
  string command;
  string key;
  vector<bool> V;
  int V_len=0;
  for(int i = 0; i < n; i++){
    cin >> command >> key;
    switch(command2enum(command)){
      case INSERT:
        H->insert(key);
        break;
      case FIND:
        if(H->find(key)) V.push_back(true);
        else V.push_back(false);
        V_len++;
        break;
      case NOP:
        break;
    }
  }
  for(int i = 0; i < V_len; i++){
    if(V[i]) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}



Measured memory_bytes: 27496
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <iterator>
using namespace std;
int main(void){
    string a,b,c;
    cin>>a>>b>>c;
    a=a[0];
    a+=b[0];
    a+=c[0];
    
    for_each(a.begin(),a.end(),[](char &c){return c=toupper(c);});
    cout<<a;
}


Measured memory_bytes: 256