akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>

#define	mp			make_pair
#define	rep(i,n)	for(int i=0;i<n;i++)

using namespace std;

typedef	pair<int,int>	pii;

int main(){
	for(int m,n;scanf("%d%d",&n,&m),n;){
		pair<int,pii> packet[20000];
		rep(i,m)	scanf("%d%d%d",&packet[i].first,&packet[i].second.first,&packet[i].second.second);
		sort(packet,packet+m);

		bool flg[20000]={};	flg[0]=true;
		rep(i,m){
			int src=packet[i].second.first-1,dst=packet[i].second.second-1;
			flg[dst]|=flg[src];
		}
		printf("%d\n",count(flg,flg+n,true));
	}

	return 0;
}

Measured memory_bytes: 1020
#include <stdio.h>

int main (){

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

	if(a==b && a!=c && b!=c){
		printf("Yes\n");
	}else if(b==c && b!=a && c!=a){
		printf("Yes\n");
	}else if(a==c && a!=b && c!=b){
		printf("Yes\n");
	}else
		printf("No\n");

return 0;
}


Measured memory_bytes: 3128
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math import gcd
from operator import add, itemgetter, mul, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


A, V = list(map(int, sys.stdin.buffer.readline().split()))
B, W = list(map(int, sys.stdin.buffer.readline().split()))
T = int(sys.stdin.buffer.readline())

a = abs(A - B)
b = V - W
ok = b * T >= a
if ok:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 27236
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;



vector<vint> adj;

int main(void){
	ll ans = 0;
	int n, m; cin >> n >> m;
	vint h(n); vinput(h);
	adj.resize(n);
	rep(i, m){
		int a, b; cin >> a >> b;
		a--; b--;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	rep(i, n){
		ans++;
		rep(j, adj[i].size()){
			if(h[i] <= h[adj[i][j]]){
				ans--;
				break;
			}
		}
	}

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

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n; cin >> n;
  vector<int> v(n); cin >> v;
  int ans = 1001001001;
  for(int i = -100; i <= 100; ++i){
    int x = 0;
    for(auto e:v){
      x += pow(e-i,2);
    }
    ChangeMin(ans,x);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3600
import java.io.*;
import java.util.*;

public class Main {
  private static boolean debug = false;
  private static boolean elapsed = false;

  private static PrintWriter _err = new PrintWriter(System.err);

  private void solve(Scanner sc, PrintWriter out) {
    int a = sc.nextInt();
    String op = sc.next();
    int b = sc.nextInt();
    if (op.equals("+")) {
      out.println((a + b));
    } else {
      out.println((a - b));
    }
  }
  private long C(long n, long r) {
    long res = 1;
    for (long i = n; i > n - r; --i) {
      res *= i;
    }
    for (long i = r; i > 1; --i) {
      res /= i;
    }
    return res;
  }
  private long P(long n, long r) {
    long res = 1;
    for (long i = n; i > n - r; --i) {
      res *= i;
    }
    return res;
  }
  private long ceil2pow(long n) {
    if (n == 0) {
      return 1;
    }
    n--;
    n |= (n >>> 1);
    n |= (n >>> 2);
    n |= (n >>> 4);
    n |= (n >>> 8);
    n |= (n >>> 16);
    n++;
    return n;
  }
  /*
   * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
   * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
   */
  public static void main(String[] args) {
    long S = System.currentTimeMillis();

    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new Main().solve(sc, out);
    out.flush();

    long G = System.currentTimeMillis();
    if (elapsed) {
      _err.println((G - S) + "ms");
    }
    _err.flush();
  }
}

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

int main(){
  string s;

  while(cin >> s){
    bool flgA = false;
    bool flgB = false;
    bool flgC = false;

    for(int i = 0; i < s.size(); i++){
      if(isdigit(s[i])){
        flgA = true;
      }
      if(islower(s[i])){
        flgB = true;
      }
      if(isupper(s[i])){
        flgC = true;
      }
    }
    if(flgA && flgB && flgC && s.size() >= 6){
      cout << "VALID\n";
    }
    else{
      cout << "INVALID\n";
    }
  }
}

Measured memory_bytes: 1160
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    a.sort()
    ans = 1
    for i in range(n):
        if a[i] == 0:
            print(0)
            sys.exit()
        ans *= a[i]
        if ans>10**18:
            print(-1)
            sys.exit()
    print(ans)
        

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

int main(){
 int N,k;
 cin>>N>>k;
 vector<int>v(N+1);
 for(int i=1;i<=N;i++){
    cin>>v[i];
 }

 int *dp = new int [N+1]();
 dp[1]=0;
 dp[2]=abs(v[2]-v[1]);

 for(int i=3;i<=N;i++){
        dp[i]=INT_MAX;
        for(int j=i-1;j>=max(i-k,1);j--){
          dp[i]=min(dp[i],dp[j]+abs(v[i]-v[j]));
        }
  //dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
 }
cout<<dp[N]<<endl;
    return 0;
}


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

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

for(int i=0;i<2;i++){
 if(a>=b){
     num+=a;
   a--;
   
 }
 else{
     num+=b;
     b--;
 }

}
cout<<num;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using piii = pair<int, pair<int, int>>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

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

    string S;
    cin >> S;

    int N = S.length();
    int ans = N;
    for (int i = 0; i < N - 1; ++i) {
        if (S[i] != S[i + 1])
            ans = min(ans, max(i + 1, N - i - 1));
    }

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


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

int main() {
  long long X;
  cin >> X;
long long A;
A = 100;
  
 for(int i = 0;; i++) {
A = A + A/100;
  if (A >= X){
 int N;
 N= i + 1;
 cout << N << endl;
    break; 
  } 
 }
 
 }


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

int main() {
  char s[3];
  cin >> s;
  int x=0;
  for(int i=0; i<3; i++){
    if(s[i] == '1'){
      x++;
    }
  }
  cout << x << endl;
  return 0;
}


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

int main() {

    int n,a ;
    cin >> n >> a ;
   
    if(n%500<=a)
      cout << "Yes" << endl ;        
    else 
      cout << "No" << endl ;        

	return 0;
}



Measured memory_bytes: 256
require 'pp'
N = gets.chomp.to_i
a = []
N.times do |i|
  x = gets.chomp.to_i
  a << x
end

failed = a[0] > 0
(0..N-2).each do |i|
  if a[i] + 1 < a[i+1]
    failed = true
    break
  end
end

if failed
  puts -1
  exit 0
end

cost = 0

i = 1
while i < N
  if a[i-1] + 1 == a[i]
    cost += 1
  else
    cost += a[i]
  end
  i += 1
end

puts cost


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

#define int long long
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
const int mod = 1e9+7;
const int inf = 2e18;
const int maxn = 1e5+5;
int n;
int32_t main()
{	
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	int ans =0;
	for(int i=1;i<n;i++)
	{
		int x = i;
		ans = ans + (n/x-(n%x==0));
	}
	cout<<ans<<'\n';
	return 0;
}	

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b,c;
    int K;
    cin >>a>>b>>c>>K;
    int cnt=0;
    while (a>=b){
        b*=2;
        cnt++;
    }
    while (b>=c){
        c*=2;
        cnt++;
    }
    if (cnt<=K){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;

    }
    return 0;
}


Measured memory_bytes: 3416
#include <iostream>
#include <string>

using namespace std;

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

  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  char c1 = s1.front() - 32;
  char c2 = s2.front() - 32;
  char c3 = s3.front() - 32;
  cout << c1 << c2 << c3 << endl;
  return 0;
}


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

using namespace std;
int main()
{
    vector<int> v;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        int in;
        cin >> in;
        v.push_back(in);
    }
    sort(v.begin(), v.end());
    int counter = 1;
    for(int i = 0; i < n - 1; i++){
        if(v[i] != v[i + 1]){
            counter++;
        }
    }
    if((n % 2) != (counter % 2)){
        counter--;
    }
    cout << counter << endl;
    return 0;
}
    

Measured memory_bytes: 892
// finish date: 2018/05/12
#include <bits/stdc++.h>


using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000
#define pii pair<int,int>

string changeBase(int N, int b, int digit = -1) {
    string s = "";
    while (N != 0) {
        s = to_string(N % b) + s;
        N /= b;
    }
    if (digit != -1) {
        while (s.length() < digit) {
            s = "0" + s;
        }
    }
    return s;
}

int main() {
    int N;
    cin >> N;
    vi a(N), b(N);
    rep(i, N) cin >> a[i];
    rep(i, N) cin >> b[i];
    vi count(30, 0);
    vl v(N);
    rep(i, 30) {
        rep(j, N) {
            v[j] = (int) (b[j] % ((ll) 1 << (i + 1)));
        }
        sort(v.begin(), v.end());
        rep(j, N) {
            int Tmin = (1 << i) - (int) (a[j] % ((ll) 1 << (i + 1)));
            int Tmax = (1 << (i + 1)) - (int) (a[j] % ((ll) 1 << (i + 1)));
//            cout << distance(lower_bound(v.begin(), v.end(), Tmin),
//                             lower_bound(v.begin(), v.end(), Tmax)) << " " <<
//                 distance(lower_bound(v.begin(), v.end(), Tmin + (1 << (i + 1))),
//                          lower_bound(v.begin(), v.end(), Tmax + (1 << (i + 1)))) << endl;
            count[i] = (count[i] +
                        distance(lower_bound(v.begin(), v.end(), Tmin),
                                 lower_bound(v.begin(), v.end(), Tmax)) +
                        distance(lower_bound(v.begin(), v.end(), (ll)Tmin + (1 << (i + 1))),
                                 lower_bound(v.begin(), v.end(), (ll)Tmax + (1 << (i + 1)))))
                       % 2;
        }
    }
    int ans = 0;
    rep(i, 30) {
        ans += count[i] << i;
    }
    cout << ans << endl;
    return 0;
}

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

signed main() {
	int a;
	while (cin >> a, a) {
		int b[200][2]{};
		int c, d;
		cin >> c >> d;
		int l0= c, l1 = d;
		for (int e = 1; e < a; e++) {
			int f, g;
			cin >> f >> g;
			b[e][0] = f - c;
			b[e][1] = g - d;
			c = f; d = g;
		}
		int n;
		cin >> n;
		map<vector<int>, bool>h;
		for (int i = 0; i < n; i++) {
			vector<int>u(2);
			cin >> u[0] >> u[1];
			h[u] = true;
		}
		for (auto q = h.begin(); q != h.end(); q++) {
			int x = (*q).first[0]; int y = (*q).first[1];
			int r0 = x, r1 = y;
			for (int p = 0; p < a; p++) {
				x += b[p][0]; y += b[p][1];
				vector<int>t(2); t[0] = x; t[1] = y;
				if (h[t] == false)break;
				if (a - 1 == p) {
					cout <<r0-l0<<" "<<r1-l1 << endl;
					goto w;
				}
			}
		}
	w:;
	}
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    int k;cin>>k;

    vi v={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    cout<<v[k-1]<<"\n";

    return 0;

}

Measured memory_bytes: 256
A,B,K=map(int,input().split())
a=[]
b=[]
for i in range(1,int(A**0.5)+1):
  if A%i==0:
    a.append(i)
    a.append(A//i)
for i in range(1,int(B**0.5)+1):
  if B%i==0:
    b.append(i)
    b.append(B//i)   
print(sorted(list(set(a) & set(b)))[-K])


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

#define nn 14
#define ll long long 
ll road[nn][nn];
ll n;
ll rati[]={1,2,4,7,12,20,29,38,52,73};
ll M;
void outprint(){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			printf("%lld ",road[i][j]); 
		}
		puts("");
	}
	exit(0);
}

ll id[nn];
void solve(ll m){
	for(int i=0;i<m;i++) id[i]=i;
	do{
		ll ans=0;
		for(int i=0;i<m;i++) ans+=road[id[i]][id[(i+1)%m]];
		M=max(M,ans);
	}while(next_permutation(id,id+m));
}
int main(){
	srand(time(0));
	cin>>n;
	if(n==2){
		road[1][0]=road[0][1]=1;
		outprint();
	}
	while(1){
	road[0][1]=road[1][0]=1,road[1][2]=road[2][1]=2,road[0][2]=road[2][0]=3;
	for(int i=3;i<n;i++){
		solve(i);
		random_shuffle(rati,rati+i);
		for(int j=0;j<i;j++){
			road[j][i]=road[i][j]=(M)*rati[j];
		}
	}
	solve(n);
	if(M<1e11) 
	outprint();
}
	
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int X,A,B;
  cin>>X>>A>>B;
  if(B<=A) cout<<"delicious"<<endl;
  else if(A<B&&B<A+X+1) cout<<"safe"<<endl;
  else if(B>=A+X+1)cout<<"dangerous"<<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<complex>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 5 * 100000 + 47;
const int MOD = 1000 * 1000 * 1000 + 7;

int A[MAX];
string s;
int n;
int summ = 0;

void addOne()
{
	FOR(i, 0, n)
	{
		if (A[i] != 9)
		{
			summ++;
			A[i]++;
			break;
		}

		summ -= 9;
		A[i] = 0;
	}
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> s;
	n = SZ(s);
	FOR(i, 0, n)
	{
		A[i] = s[n - i - 1] - '0';
	}

	int nex = 0;
	FOR(i, 0, n + 1)
	{
		int val = A[i] * 9 + nex;
		A[i] = val % 10;
		nex = val / 10;
	}

	if (A[n]) n++;
	FOR(i, 0, n)
	{
		summ += A[i];
	}

	FOR(k, 1, MAX)
	{
		FOR(i, 0, 9)
		{
			addOne();
		}

		if (summ <= 9 * k)
		{
			cout << k << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 2808
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string.h>
#include <math.h>
typedef long long ll;
#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REP(i,x,y)	for (int (i)=(x);(i)<(y);(i)++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;
typedef pair<int, int> Point;
typedef vector<vector<Point>> Graph;

ll N,M;

int main() {
	cin >> N >> M;
	
	cout << ABS((N-2)*(M-2));

	return 0;
}


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

//素数判定
bool isPrime(int num){
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2){
    if (num % i == 0) return false;
  }
  return true;
}

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

  n = n%k;  
  ll ans = n;
  bool flag = false; //処理終了フラグ
  for(;;){
    ll tmp = abs(ans-k);
    if(ans<tmp) break;
    ans = tmp;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  map<char, ll> mp;
  for (int i = 0; i < n; ++i) {
    mp[s[i]] += 1;
  }
  ll ans = 1;
  for (auto itr : mp) {
	itr.second += 1;
    ans *= itr.second;
    ans %= MOD;
  }
  ans -= 1;
  cout << ans << endl;
}

Measured memory_bytes: 512
def main():
    s=input()
    for i in ["+","-"]:
        for j in ["+","-"]:
            for k in ["+","-"]:
                b=s[0]+i+s[1]+j+s[2]+k+s[3]
                if eval(b)==7:
                    print(b+"=7")
                    return

main()


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

int main(){
  int N; cin>>N;
  vector<int> V(N),C(N);
  for(int i=0;i<N;i++){
    cin>>V[i];
  }
  for(int i=0;i<N;i++){
    cin>>C[i];
  }
  int ans=0;
  for(int i=0;i<N;i++){
    if(V[i]-C[i]>0){
      ans+=V[i]-C[i];
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int train[100],n,i=0;
	while(scanf("%d",&n)!=EOF){
		if(n==0){
			printf("%d\n",train[i-1]);
			i--;
			}
		else{
			train[i]=n;
			i++;
			}
	}
	return 0;
}

Measured memory_bytes: 600
# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <complex>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) begin(x),end(x)
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<":"<<x<<endl;
# define EPS 1e-12
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
typedef long long lint;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }


typedef vector<vc> P;
int h, w, n;
bool check(P &a)
{
	int ans = 0;
	FORI(i, 1, h + 1)
	{
		FORI(j, 1, w + 1)
		{
			if (a[i][j] != '.')ans++;
		}
	}
	return !ans;
}

bool remove(P &a)
{
	bool r[40][40] = {};
	FORI(i, 1, h + 1)
	{
		FORI(j, 1, w + 1)
		{
			if (a[i][j] != '.')
			{
				int c = 0;
				char ch = a[i][j];
				for (int x = j;; x++)
				{
					if (a[i][x] == ch)c++;
					else break;
				}
				if (c >= n)
				{
					for (int x = j;; x++)
					{
						if (a[i][x] == ch)r[i][x] = true;
						else break;
					}
				}
				c = 0;
				for (int y = i;; y++)
				{
					if (a[y][j] == ch)c++;
					else break;
				}
				if (c >= n)
				{
					for (int y = i;; y++)
					{
						if (a[y][j] == ch)r[y][j] = true;
						else break;
					}
				}
				
			}
		}
	}
	bool ok = false;
	FOR(i, 40)
	{
		FOR(j, 40)
		{
			if (r[i][j])
			{
				a[i][j] = '.';
				ok = true;
			}
		}
	}
	return ok;
}

void fall(P &a)
{
	bool ok = true;
	while (ok)
	{
		ok = false;
		FORI(i,2,h+1)
		{
			FORI(j, 1, w + 1)
			{
				if (a[i][j] == '.'&&a[i - 1][j] != '.')
				{
					swap(a[i][j], a[i - 1][j]);
					ok = true;
				}
			}
		}
	}
}

int main()
{

	cin >> h >> w >> n;
	
	vc wall(40, '!');
	P a(40,wall);

	FORI(i, 1, h+1)
	{
		FORI(j, 1, w + 1)
		{
			cin >> a[i][j];
		}
	}

	FORI(i, 1, h + 1)
	{
		FORI(j, 1, w)
		{
			if (a[i][j] != a[i][j + 1])
			{
				P x = a;
				swap(x[i][j], x[i][j + 1]);
				fall(x);
				while (remove(x))
				{
					fall(x);
				}

				if (check(x))
				{
					cout << "YES" << endl;
					return 0;
				}
			}
		}
	}

	cout << "NO" << endl;

}

Measured memory_bytes: 3156
/*
	*#*#*#* Author GaryMr *#*#*#*
########################################################################
	是否可以简化问题：
	抓住数据范围哪里小
	dfs or bfs
	是否可以化具体为抽象
	字符串问题是否可以用数学模拟递归过程（取c[i]或不取来算结果）
	二分？左闭右开？
	long long？
	逆向思维？
	dp？
	贪心？
	匹配括号 左减右>=0
	多组数据清空？
	dp优化用g？
	线段树：大小为n的8倍
	线段树：左闭右开！
	线段树：find： if(l>=b||r<=a) return 0x3f3f3f3f; if(r<=b&&l>=a) return tree[k];
	线段树：满二叉树 
	循环跳出条件 
	代数设出每个值寻找关系？
	优先队列：priority_queue<类型> q;   
	priority_queue<类,vector<类>, less<类> > pq1; 　　　 // 使用递减	
	priority_queue<类，vector<类>, greater<类> > pq2; 　　// 使用递增
	判断括号，判断是否长度为偶数
	1<<ceil(log2(double(n)))
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;a++)
#define rl(a,b,c) for(int a=b;a>=c;a--)
#define niv vector<int>
#define LL long long
#define IT iterator
#define FIR first
#define SEC second
using namespace std;
const int MAX=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
struct mytype{
	vector<int> in_node;
}each_node[100001];
int dp[100001];
int dfs_find_longest(int now_node){
	if(dp[now_node]) return dp[now_node];
	if(each_node[now_node].in_node.size()==0) return dp[now_node]=0;
	rb(i,0,int(each_node[now_node].in_node.size())-1){
		dp[now_node]=max(dp[now_node],dfs_find_longest(each_node[now_node].in_node[i])+1);
	}
	return dp[now_node];
}
int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	rb(i,1,m){
		int xi,yi;//xi to yi
		scanf("%d %d",&xi,&yi);
		each_node[yi].in_node.push_back(xi);
	}
	int final=-1;
	rb(i,1,n){
		final=max(final,dfs_find_longest(i));
	}
	printf("%d\n",final);
	return 0;
}

Measured memory_bytes: 10624
a[50],n,c,p;main(x){for(;a[c]==p?n?printf("%d\n",c):1,c=a[c]=0,scanf("%d%d",&n,&p),x=p:~c++;x?x--,a[c]++:(x+=a[c],a[c]=0))c%=n;return 0;}

Measured memory_bytes: 404
#include<bits/stdc++.h>
using namespace std;
bool vis[101];
int main() {
  int x, n; cin >> x >> n;
  while(n--) {
    int y; cin >> y; vis[y] = true;
  }
  int ax = x; while(vis[ax]) ax--;
  int ay = x; while(vis[ay]) ay++;
  if(x - ax > ay - x) cout << ay;
  else cout << ax;
}
  

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin >> a;
  
  bitset <3> b(a);

  int count = 0;
  
  for (int i; i < 3; i++) {
    if (b.test(i)) {
      count++;
    }
  }
  
  cout << count << endl;
  
}


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

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

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

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

  // result = sum of (gdc - 1) mod Ai
  long long sum = 0;
  rep(i, N)
  {
    int a;
    cin >> a;
    sum += a - 1;
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,(v).size())
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define bit(n)(1ll<<(n))
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(const T&...t){_print(cout,t...);}template<class...T>void dprint(const T&...t){_print(cerr,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#endif
template<class T>bool chmax(T&a,const T&b){bool x=a<b;x?a=b:b;return x;}template<class T>bool chmin(T&a,const T&b){bool x=a>b;x?a=b:b;return x;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>class iterable{static false_type c(string v);template<class U>static auto c(U v)->decltype(all(v),true_type());static false_type c(...);public:const static bool value=decltype(c(declval<T>()))::value;};
template<class T,typename=enable_if_t<iterable<T>::value>>ostream&operator<<(ostream&o,const T&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    string s;
    int k;
    cin>>s>>k;
    int n=s.size();
    ll c=0;
    ll f=0;
    ll e=0;
    for(int i=0;i<n;){
        int ii=i;
        while(i<n && s[ii]==s[i])++i;
        if(ii==0){
            if(i==n){
                cout<<(ll)n*k/2<<endl;
                return 0;
            }
            f=i-ii;
        }else if(i==n)e=i-ii;
        else c+=(i-ii)/2;
    }
    c*=k;
    c+=f/2;
    c+=e/2;
    if(s[0]==s[n-1])c+=(f+e)/2*(k-1);
    else c+=(f/2+e/2)*(k-1);
    cout<<c<<endl;
}


Measured memory_bytes: 256
Option Strict On
Module Module1

    Sub Main()
        Dim menu(4) As Integer
        For i As Integer = 0 To 4
            menu(i) = Convert.ToInt32(Console.ReadLine())
        Next
        Dim time As Integer = 0
        Dim counter As Integer = 0
        Dim furagu As Integer = 1
        For i As Integer = 0 To 4
            time += (menu(i) \ 10) * 10
            menu(i) = (menu(i) - (menu(i) \ 10) * 10)
            If menu(i) <> 0 Then
                counter += 1
                furagu = 1
            End If
        Next
        time += (counter - 1) * 10
        'Console.WriteLine(time)
        'Console.WriteLine(counter)
        ' For Each t In menu
        'Console.WriteLine(t)
        'Next
        If furagu = 0 Then
            Console.WriteLine(time)
            Console.ReadLine()
            Return
        End If
        Dim mini As Integer = 10
        For i As Integer = 0 To 4
            If menu(i) <> 0 And mini > menu(i) Then
                mini = menu(i)
            End If
        Next
        ' Console.WriteLine(mini)
        time += mini
        Console.WriteLine(time)
        Console.ReadLine()
    End Sub

End Module

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<(max({a,b,c}) - min({a,b,c}))<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <map>
using namespace std;

double BMI(double w,double t){
	return w/(t*t);
}

int main(){
	int No;
	double w,t;
	vector<int> vc;
	map<int,double> f;

	while( ~scanf("%d,%lf,%lf", &No , &w , &t ) ){
		if( BMI( w , t ) >= 25.0 )
			printf("%d\n", No );
		//printf("%d %f %f\n" , No , w , t );
		//if( No == -1 ) break;
		//vc.push_back( No );
		//f[ No ] = IMB( w, t );
	}
	/*for(int i=0 ; i<vc.size() ; ++i )
		if( f[ vc[i] ] >= 25.0 )
			printf("%d\n", i );*/
}

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

using i64=int64_t;
using namespace std;

#define int long long

struct wuf{
  vector<int> d;
  vector<int> p;
  wuf(int n):d(n, 0), p(n, -1){};
  int root(int x){
    if(p[x] < 0)return x;
    else{
      int r = root(p[x]);
      d[x] += d[p[x]];
      return p[x] = r;
    }
  }
  bool same(int x, int y){
    return root(x) == root(y); 
  }
  bool join(int x, int y, int w){
    w += weight(x);
    w -= weight(y);
    x = root(x);
    y = root(y);
    if(x == y)return false;
    if(p[x] > p[y]){
      swap(x, y);
      w = -w;
    }
    p[x] += p[y];
    p[y] = x;
    d[y] = w;
    return true;
  }
  int weight(int x){
    root(x);
    return d[x];
  }
  int diff(int x, int y){
    return weight(y) - weight(x);
  }
};

int32_t main() {
  int n, q;
  cin >> n >> q;
  wuf w(n);
  for(int i=0;i<q;i++){
    int c;
    cin >> c;
    int x, y, z;
    if(c == 0){
      cin >> x >> y >> z;
      w.join(x, y, z);
    }else{
      cin >> x >> y;
      if(w.same(x, y)){
        cout << w.diff(x, y) << endl;
      }else{
        cout << '?' << endl;
      }
    }
  }
}


Measured memory_bytes: 4420
n = int(input())
A = list(map(int, input().split()))
d2 = 0
d4 = 0
for i in range(n):
    if A[i]%2==0 and A[i]%4!=0:
        d2 += 1
    elif A[i]%4==0:
        d4 += 1
n -= int(d2/2)*2
if n-1-d4<=d4:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14252
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<string> s(N);
    vector<int> t(N), ts(N + 1, 0);
    for (int i = 0; i < N; i++) {
        cin >> s[i] >> t[i];
        ts[i + 1] = ts[i] + t[i];
    }
    string X;
    cin >> X;
    auto i = distance(s.cbegin(), find(s.cbegin(), s.cend(), X));
    cout << ts[N] - ts[i + 1] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define dist(j, i) (abs(dist[0][i] - dist[0][j]) + abs(dist[1][i] - dist[1][j]))
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	int maxplusy = -1, maxsuby = -1123456789;
	int minxplusy = 2000000001, minxsuby = 1123456789;
	while (n--) {
		int x, y;
		cin >> x >> y;
		maxplusy = maxplusy < x + y ? x + y : maxplusy;
		maxsuby = maxsuby < x - y ? x - y : maxsuby;
		minxplusy = minxplusy > x + y ? x + y : minxplusy;
		minxsuby = minxsuby > x - y ? x - y : minxsuby;
	}
	cout << max(maxplusy - minxplusy, maxsuby - minxsuby) << '\n';

	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 10000007

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

	int h, w;
	map<int, int> storageX;
	map<int, int> storageY;
	
	cin >> h >> w;
	
	char arr[h][w];
	vector<char> col;
	vector<vector<char> > ans;
	
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cin >> arr[i][j];		
		}
	}

	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(arr[i][j] == '.') storageX[i]++;
		}
	}

	for(int i = 0; i < w; i++){
		for(int j = 0; j < h; j++){
			if(arr[j][i] == '.') storageY[i]++;
		}
	}
	
	for(int i = 0; i < h; i++){
		if(storageX[i] == w) continue;
		for(int j = 0; j < w; j++){	
			if(storageY[j] == h) continue;
			col.push_back(arr[i][j]);
		}
		ans.push_back(col);
		col.clear();
	}
	
	for(int i = 0; i < ans.size(); i++){
		for(int j = 0; j < ans[i].size(); j++){
			cout << ans[i][j];
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 256
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n=n0()
a=n2(n)
b=sorted(a)
m1=b[-1]
m2=b[-2]
c=[]

for i in a:
    if i==m1:
        c.append(m2)
    else:
        c.append(m1)
print(*c,sep="\n")

Measured memory_bytes: 19380
#include <iostream>
#include <algorithm>
#include <cstdlib>

using namespace std;

int main(){
	int w, h, n;
	int road = 0;
	int x[1001], y[1001];
	cin >> w >> h >> n;
	
	for (int i = 0; i < n; i++){
		cin >> x[i] >> y[i];
	}

	for (int i = 1; i < n; i++){
		int x1 = x[i] - x[i - 1];
		int y1 = y[i] - y[i - 1];
		if (x1 * y1 >= 0)  road += max(abs(x1), abs(y1));
		else road += abs(x1) + abs(y1);
	}
	cout << road << endl;

	return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <math.h>
#include <time.h>
#include <chrono>
#include <random>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define repr(i, a, b) for (int i = (int)a; i > (int)b; i--)
#define all(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 1147483600;
const ll infl = 4e18 + 5;
const char ENDL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;

bool debug = false;

random_device rnd;
mt19937_64 mt(rnd());

ll c[26], s[370][26], D, last[26];

void input(){
    cin >> D;
    rep(i, 26) cin >> c[i];
    rep(i, D) rep(j, 26) cin >> s[i][j];
}

void make_input(){
    rep(i, 365) c[i] = mt() % 101;
    rep(i, 365) rep(j, 26) s[i][j] = mt() % 20001;
}

ll calc_v(vll t){
    vll v(D, 0);
    rep(i, 26) last[i] = -1;
    rep(i,D){
        if (i>0)
            v[i] = v[i - 1];
        v[i] += s[i][t[i]];
        last[t[i]] = i;
        rep(j, 26) v[i] -= c[j] * (i - last[j]);
    }
    return v[D-1];
}



//note:ランダム

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    clock_t start = clock();
    D = 365;
    if(debug)
        make_input();
    else
        input();
    rep(i, 26) last[i] = -1;

    ll mx = -infl;
    vll ans(D, 0);

    //ans:答えをＤ日分入力
    //last[i]:i番目のコンテストを最後に行ったのはlast[i]日

    vll t(D);
    rep(i, D) cin >> t[i];
    rep(i, D) t[i]--;
    ll v;
    v = calc_v(t);
    ll M;
    cin >> M;
    rep(i,M){
        ll d, q;
        cin >> d >> q;
        d--;
        q--;
        t[d] = q;
        v = calc_v(t);
        cout << v << ENDL;
    }

    clock_t end = clock();
    if (debug){
        cout << "value :" << v << ENDL;
        cout << "check :" << ((*min_element(all(ans)) >= 0) && (*max_element(all(ans)) <= 25)) << ENDL;
        ld time = static_cast<ld>(end - start) / CLOCKS_PER_SEC * 1000.0;

        cout << "time :" << fixed << setprecision(3) << time << "ms" << ENDL;
        }
    //else 
        //rep(i, D) cout << ans[i] + 1 << ENDL;
}


Measured memory_bytes: 3724
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> ivv;
 

int main()
{
	int n;
	
	cin >> n;
	
	int num = 0;
	
		
	if(n % 2 != 0)
	{
		cout << "NO" << endl;
		return 0;
	}
	
	
	REP(i,n)
	{
		string tmp;
		cin >> tmp;	
		
		if(tmp == "A")num++;
		else num--;
		
		
		if(num < 0)
		{
			cout << "NO" << endl;
			return 0;
		}
	}
	
	if(num == 0)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	
	return 0;
}

Measured memory_bytes: 3144
//Author: AnandRaj doubleux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test(t) int t;cin>>t;while(t--)
#define forn(i,f,n) for(int i=f;i<f+n;i++)
#define rforn(i,l,n) for(int i=l;i>l-n;i--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int i=f;i<f+n;i++) cin>>V[i]
#define what(x) cerr<<#x<<" = "<<x<<endl

const int MOD = 1e9+7,MAX = 1e5+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
//////////////////Sieve////////////////////

int main()
{	
	char c;
	cin>>c;
	cout<<(char)(c+1)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs

const int MAXN = 105000;

int n, m;
vector < pair<int, int> > edges;
int st[MAXN];
int sz[MAXN];
long long ans;
vector<long long> ansv;

int getSet(int x) {
  if (st[x] == x)
    return x;
  st[x] = getSet(st[x]);
  return st[x];
}

void unite(int a, int b) {
  a = getSet(a); b = getSet(b);
  if (rand() & 1)
    swap(a, b);
  st[a] = b;
  if (a != b) {
    ans -= 1ll * sz[a] * sz[b];
    sz[b] += sz[a];
  }
}

int main() { 

  scanf("%d %d", &n, &m);

  for (int i = 0; i < m; i++) {
    int from, to;
    scanf("%d %d", &from, &to);
    from--; to--;
    edges.push_back(make_pair(from,to));
  }

  ans = 1ll * n * (n - 1) / 2;
  ansv.push_back(ans);

  for (int i = 0; i < n; i++) {
    st[i] = i;
    sz[i] = 1;
  }

  for (int i = m - 1; i > 0; i--) {
    int from = edges[i].first, to = edges[i].second;
    unite(from, to);
    ansv.push_back(ans);
  }

  reverse(all(ansv));
  for (int i = 0; i < sz(ansv); i++) {
    printf("%lld\n", ansv[i]);
  }

  return 0;
}


Measured memory_bytes: 3828
S = input()
from collections import Counter as c

od,ev = [],[]#od=奇数 ev=偶数
for s,i in zip(S,range(1,len(S)+1)):
    if i%2 == 0:
        ev.append(s)
    else:
        od.append(s)
odd = c(od).most_common(2)
eve = c(ev).most_common(2)
N = len(S)
N,odd,eve
if len(odd) != 2:
    odd.append(('9',0))
if len(eve) != 2:
    eve.append(('9',0))
if N == 1:
    ans = 0
elif odd[0][0] != eve[0][0]:
    ans = N-odd[0][1]-eve[0][1]
else:
    if len(odd) == len(eve) == 1:
        ans = N//2
    else:
        ans = N-max(odd[0][1]+eve[1][1],odd[1][1]+eve[0][1])
print(ans)

Measured memory_bytes: 4476
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i,a,b) for(int i=(a);i<=(b);++i)
#define FD(i,b,a) for(int i=(b);i>=(a);--i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;
constexpr LL inv(LL x, LL m) { return x > m ? inv(x % m, m) : x > 1 ? inv(m % x, m) * (m - m / x) % m : x; }
constexpr LL mpow(LL a, LL k, LL m) { LL r(1); for (a %= m; k; k >>= 1, a = a * a % m) if (k & 1)r = r * a % m; return r; }

int main() {
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n; i++) for (int j = i; j < n; j++) {
            if (s.substr(0, i) + s.substr(j) == "keyence") return puts("YES"), 0;
        }
    puts("NO");
}


Measured memory_bytes: 256
awk -M '\
NR==1{N=$1}
NR==2{split($0, A)}
END{
    sum = 0
    for(i=1;i<=N;i++){
        sum += A[i]
        S[i] = sum
    }
    ans = 0
    MOD = 10^9 + 7
    for(i=1;i<=N;i++){
        ans += (A[i]* (S[N]-S[i])) % MOD
    }
    print ans%MOD
}'

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

int main()
{
    int n;
    vector<pair<int, int>> student;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        int temp;
        cin >> temp;
        student.push_back({temp, i});
    }

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

    for (auto& i : student) {
        cout << i.second << ' ';
    }
}

Measured memory_bytes: 1780
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var dSlice []int
	var d int
	for i := 0; i < n; i++ {
		fmt.Scan(&d)
		dSlice = append(dSlice, d)
	}
	dSet := make(map[int]struct{})
	for _, v := range dSlice {
		dSet[v] = struct{}{}
	}
	fmt.Println(len(dSet))
}


Measured memory_bytes: 512
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n = int(input())
    A = list(map(int,input().split()))
    cunt=0
    for i, a in enumerate(A):
        if i%2==0 and a%2:
            cunt+=1
    print(cunt)


if __name__=='__main__':
    main()

Measured memory_bytes: 9180
#include <iostream>
#include <vector>
#include <algorithm>

#define INF 100000

using namespace std;

int solve2(int n, int r, vector<int> root, vector< vector<int> > &l, vector< vector<int> > &s){
  
  //DP????????????dp[i][j]
  //0????????????i???????????????????????????i?????????????????????????????£?????¨????????????j???????????????0??????i???????????§??????????????¢
  vector< vector<int> > dp;
  dp.resize(r);
  for(int i = 0; i < r; i++) dp[i].resize(n);

  for(int i = 0; i < r; i++){
	for(int j = 0; j < n; j++){
	  if( i == 0  && j == root[0]) dp[i][j] = 0;
	  else dp[i][j] = INF;
	}
  }

  for(int i = 1; i < r; i++){
	for(int j = 0; j < n; j++){//i???????????§???????????????????????¨??????????????????
	  for(int k = 0; k < n; k++){//k : i-1???????????§???????????????????????¨??????????????????
		if(j != k) dp[i][j] = min( dp[i][j], dp[i-1][k] + l[root[i-1]][k] + s[k][j] + l[j][root[i]] );
		else dp[i][j] = min( dp[i][j], dp[i-1][j] + l[root[i-1]][root[i]] );
	  }
	}
  }

  int ans = INF;
  for(int i = 0; i < n; i++){
	ans = min( ans, dp[r-1][i] );
  }
  return ans;
}

void solve1(int n, vector< vector<int> > &l, vector< vector<int> > &s){

 //??????????????¨??????????????????????????¢????????????????±???????
  for(int k = 0; k < n; k++){
	for(int i = 0; i < n; i++){
	  for(int j = 0; j < n; j++){
		l[i][j] = min(l[i][j], l[i][k] + l[k][j]);
		s[i][j] = min(s[i][j], s[i][k] + s[k][j]);
	  }
	}
  }

}

int main(){

  while(1){

	int n, m;
	cin >> n >> m;

	if(n == 0 && m == 0) return 0;

	vector< vector<int> > l, s;
	l.resize(n);
	for(int i = 0; i < n; i++) l[i].resize(n);
	s.resize(n);
	for(int i = 0; i < n; i++) s[i].resize(n);

	for(int i = 0; i < n; i++){
	  for(int j = 0; j < n; j++){
	    if(i == j){
		  l[i][j] = 0;
		  s[i][j] = 0;
		}
		else{
		  l[i][j] = INF;
		  s[i][j] = INF;
		}
	  }
	}

	int x, y, t;
	char sl;

	for(int i = 0; i < m; i++){
	  cin >> x >> y >> t >> sl;
	  if(sl == 'L'){
		l[x-1][y-1] = t;
		l[y-1][x-1] = t;
	  }
	  else{
		s[x-1][y-1] = t;
		s[y-1][x-1] = t;
	  }
	}

	solve1(n, l, s); //??????????????¨??????????????????????????¢????????????????±???????

	int r;
	cin >> r;

	vector<int> root;
	for(int i = 0; i < r; i++){
	  int area;
	  cin >> area;
	  root.push_back(area-1);
	} 

	cout << solve2(n, r, root, l, s) << endl; //????????¨??????????????????????????¢????±???????

  }

  return 0;
}

Measured memory_bytes: 2324
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin>>n;
  string a[n+1];
  map <string,int> b;
  map <string,int> c;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    b[a[i]]++;
  }
  int mx=1;
  for(int i=1;i<=n;i++){
    mx=max(mx,b[a[i]]);
  }
  vector<string> v;
  for(int i=1;i<=n;i++){
    if(b[a[i]]==mx && c.count(a[i])==0){
      v.push_back(a[i]);
      c[a[i]]++;
    }
  }
  sort(v.begin(),v.end());
  for(int i=0;i<=v.size()-1;i++)
    cout<<v[i]<<endl;
}

Measured memory_bytes: 42352