akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}
//long long int ruizyo(long long int aa, long long int bb){
  //  if(aa==0){
    //    return 1;
    //}
    //else if(aa%2==0){
      //  long long int tt=ruizyo(aa/2,bb);
        //return (tt*tt)%MOD;
    //}
    //else{
      //  return (ruizyo(aa-1,bb)*bb)%MOD;
    //}
//}フェルマ－のア


//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

//bool f[100001];//1000000以下の素数を調べよう！
//rrep(i,2,100001){
  //      f[i]=false;
    //}
//rrep(i,2,100001){
  //      if(!f[i]){
    //        for(int j=i+i;j<=100000;j+=i){
      //          f[j]=true;
        //    }
        //}
    //}
    //for(int i=3;i<=100000;i+=2){
      //  if(!f[i]){
        //    c[i]++;
      //  }
   // }

//visited=vector<vector<bool>>(10,vector<bool>(10,false));アを全部falseに


long long int n,cnt=0,ans=0,a,b,c,d,cmp=0,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;

//-------------------------↓↓↓↓↓↓----------------------------

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

       cin >> n;
       rrep(i,1,n+1){
           pos=i;
           while(1){
               if(pos%2!=0 || pos==0){
                   break;
               }
               else{
                   pos/=2;
                   cnt++;
               }
           }
           if(cmp<cnt){
               cmp=cnt;
               ans=i;
           }
           cnt=0;
       }
       if(n==1){
           Cout(1);
           return 0;
       }
      Cout(ans);
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s;
int main()
{
    cin>>s;
    int num=0,res=0;
    for (int i=0;i<(int)s.length();++i)
        if (num+num>=i) res-=s[i]=='p';
        else {
            ++num;
            res+=s[i]=='g';
        }
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 3852
fn main() {
    let n: i32 = read();

    'a: for i in 0..27 {
        for j in 0..16 {
            if 4 * i + 7 * j == n {
                println!("Yes");
                break 'a;
            }
        }
        if i == 26 {
            println!("No");
        }
    }
}



use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed toparse token")
}

Measured memory_bytes: 4352
/**
 * editorial をそのまま実装
 */

#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <tuple>
#include <utility>
#include <limits>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

template<typename T, size_t N>
constexpr size_t NELEMS(T (&)[N]) { return N; }

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

#define DEBUG
#undef DEBUG

using ll = long long;

int N, W;
int wmin;
vector<int> V[4];


void solve()
{
    ll vmax = 0;

    ll v0, v1, v2, v3;
    ll w0, w1, w2, w3;
    for(size_t i0 = 0; i0 <= V[0].size(); ++i0) {
        v0 = accumulate(begin(V[0]), begin(V[0])+i0, 0);
        w0 = i0 * wmin;
        for(size_t i1 = 0; i1 <= V[1].size(); ++i1) {
            v1 = accumulate(begin(V[1]), begin(V[1])+i1, 0);
            w1 = i1 * (wmin+1);
            for(size_t i2 = 0; i2 <= V[2].size(); ++i2) {
                v2 = accumulate(begin(V[2]), begin(V[2])+i2, 0);
                w2 = i2 * (wmin+2);
                for(size_t i3 = 0; i3 <= V[3].size(); ++i3) {
#ifdef DEBUG
                    cout << i0 << " " << i1 << " " << i2 << " " << i3 << "\n";
#endif

                    v3 = accumulate(begin(V[3]), begin(V[3])+i3, 0);
                    w3 = i3 * (wmin+3);

                    if(w0 + w1 + w2 + w3 <= W) {
                        vmax = max(vmax, v0 + v1 + v2 + v3);
                    }
                }
            }
        }
    }

    cout << vmax << "\n";
}

int main()
{
    cin >> N >> W;
    REP(i, N) {
        int w, v;
        cin >> w >> v;
        if(i == 0) {
            wmin = w;
            V[0].push_back(v);
        }
        else {
            V[w-wmin].push_back(v);
        }
    }
    FOR(i, 0, 4) {
        sort(begin(V[i]), end(V[i]), greater<int>());
    }

    solve();

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <cmath>

using namespace std;

void b_crane_and_turtle(void) {
	int x, y;
	cin >> x >> y;
	int total = 0;
	string judge = "No";
	for (int j = 0; j <= x; j++) {
		total = 2 * j + 4 * (x - j);
		if (total == y) {
			judge = "Yes";
			break;
		}
	}
	cout << judge << endl;
}

int main()
{
    b_crane_and_turtle();
    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

int main(void){
	int a,b,h;
	cin >> a >> b >> h;
	cout << (a+b)*h/2 << endl;
	return 0;
}

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

int main(){
    int k; cin >> k;
    int a,b; cin >> a >> b;
    int flag=0;
    for(int i=a;i<=b;++i){
        if(i%k==0){
            flag=1;
            break;
        }
    }
    if(flag==1) cout << "OK" << endl;
    else cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int Q = sc.nextInt();
    int[] A = new int[N];
    int sum = 0;
    for (int i = 0; i < Q; i++) {
      A[sc.nextInt()-1]++;
      sum++;
    }
    for (int i = 0; i < N; i++) {
      if (sum - A[i] >= K) {
        System.out.println("No");
      } else {
        System.out.println("Yes");
      }
    }
  }
}


Measured memory_bytes: 65576
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
const long long N=(100010),M=(250025),LEN=(50);
const long long Mod=(323232323);
const long double EPS=(1e-7);
const long long MAX=(1e18);
///////////////////////////////////////////////
int n,m,A,B,Max,es[N],Flag;
struct EDGE{
	int to,next;
}edge[N*2];
int head[N],tote;
void addedge(int u,int v){
	edge[++tote].to=v;
	edge[tote].next=head[u];
	head[u]=tote;
	return;
}
void dfs(int x,int last,int lim,int tar,int flag){
	if(x==tar&&flag==1){
		Flag=1;
		return ;
	}
	for(int i=head[x];i;i=edge[i].next){
		int v=edge[i].to;
		if(v==last) continue;
		if(v==lim) continue;
		dfs(v,x,lim,tar,1);
		if(Flag==1) return ;
	}
	return ;
}
bool check(int A,int B){
	dfs(A,0,B,A,0);
	if(Flag==1) return true;
	return false;
}
int main(){
	//freopen("problem.in","r",stdin);
	//freopen("problem.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		addedge(u,v);
		addedge(v,u);
		es[u]++;
		es[v]++;
	}
	int flag=1,k1=0;
	for(int i=1;i<=n;i++){
		if(es[i]%2==1) flag=0;
		Max=max(Max,es[i]);
		if(es[i]==4){
			if(A==0) A=i;
			else if(B==0) B=i;
			else k1=1;
		}
	}
	if(flag==0) return puts("No"),0;
	if(Max<4) return puts("No"),0;
	if(Max>4) return puts("Yes"),0;
	if(B==0) return puts("No"),0;
	if(k1==1) return puts("Yes"),0;
	if(check(A,B)) return puts("Yes"),0;
	else return puts("No"),0;
	return 0;
}
/*
*/

Measured memory_bytes: 6532
a = list(map(int,input().split()))
A = a[0]
B = a[1]
K = a[2]
taka = A
aoki = B
if K < A:
    aoki = B
    taka = A - K
elif K>=(A+B):
    taka = 0
    aoki = 0
else:
    #A<=K<(A+B)
    taka = 0
    b = K - A
    aoki = B - b
print(str(taka)+" "+str(aoki))

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

const int mod = 1000000007;

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

    ll sum = 0;
    rep(i, N) sum += A[i];
    ll ans = 0;
    rep(i, N) { ans += (((sum - A[i]) % (mod * 2)) * A[i]) % (mod * 2); }
    cout << ans / 2 % mod << endl;
}

Measured memory_bytes: 4776
n,q = map(int,input().split())
rl = [0] * n
al = [0] * n
for i in range(n-1):
    a,b = map(int,input().split())
    rl[b-1] = a -1
for j in range(q):
    p,x = map(int,input().split())
    al[p-1] += x
for k in range(n):
    if k == 0:
        pass
    else:
        al[k] += al[rl[k]]
print(*al)

Measured memory_bytes: 25828
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>


using namespace std;
const int MOD = 1000000009; // check!!!
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)(c).size())
#define ten(x) ((int)1e##x)
#define tenll(x) ((ll)1e##x)

ll dp[4001];

int main(){

	dp[0] = 1;
	FOR(i,4){
		for(int j = 3000; j >= 0; j--){
			FOR(k,1000) dp[j+k+1] += dp[j];
		}
	}

	int n;
	while(~scanf("%d",&n)){
		cout << dp[n] << endl;
	}

	return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
using P=pair<int, int>;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main(){
    fast_io

    char a;
    cin>>a;
    if(a>=65 && a<=90) {
        cout<<"A"<<endl;
        return 0;
    }
    cout<<"a"<<endl;
    
    return 0;
  }

Measured memory_bytes: 3648
w, h, n = map(int, input().split())
list_XY = [ list(map(int,input().split(" "))) for i in range(n)]
a = 0
b = w
c = 0
d = h

for l in list_XY:
    if l[2] == 1:
        a = max(a, l[0])
    elif l[2] == 2:
        b = min(b, l[0])
    elif l[2] == 3:
        c = max(c, l[1])
    elif l[2] == 4:
        d = min(d, l[1])
ans = -1
if b > a and d > c:
    ans = (b-a)*(d-c)
else:
    ans = 0

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
typedef long long ll;
const ll INF = 1e18L + 1;

int bcd[3];
int main()
{
  int a;
  cin >> a;
  rep(i, 3)
  {
    bcd[2 - i] = a % 10;
    a /= 10;
  }

  for (int i = 0; i < 8; i++)
  {
    int target = a;
    string ans = "";
    ans += to_string(a);

    for (int j = 0; j < 3; j++)
    {
      if (i & (1 << j))
      {
        target += bcd[j];
        ans += "+";
      }
      else
      {
        target -= bcd[j];
        ans += "-";
      }
      ans += to_string(bcd[j]);
    }
    ans += "=7";
    if (target == 7)
    {
      cout << ans << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;


int main()
{
	int n;
	cin >> n;
	for (int i = 0; 4*i <= n; i++) {
		if ((n - 4 * i) % 7 == 0)return cout << "Yes" << endl,0;
	}
	cout << "No" << endl;
}


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

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

    int count = 1;

    for (int i=0; i<N; i++){
        if(count*2 >= count+K){
            count += K;
        }
        else{
            count *= 2;
        }

    }

    cout << count;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (fabs(a - c) <= d || (fabs(a - b) <= d && fabs(b - c) < d))
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path;
//***********//

int main() {
	vl A(3);
	cin >> A[0] >> A[1] >> A[2];
	if (A[0] == A[1]) {
		ans++;
	}
	if (A[1] == A[2]) {
		ans++;
	}
	if (A[0] == A[2]) {
		ans++;
	}
	if (ans == 1) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int A[200010];
int main() 
{
	int N; cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A, A + N);
	for (int i = 0; i < N - 1; i++) {
		if (A[i] == A[i + 1]) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}


Measured memory_bytes: 1024
N = int(input())
A = list(map(int, input().split()))

is_alice_turn = True

alice_point = 0
bob_point = 0

while len(A) != 0:
    picked_num = max(A)
    if is_alice_turn:
        alice_point += picked_num
    else:
        bob_point += picked_num

    A.remove(picked_num)
    is_alice_turn = not is_alice_turn

print(alice_point - bob_point)


Measured memory_bytes: 3060
n=int(input())
w=input()
ww=[w]
ans="Yes"
for i in range(n-1):
  w1=input()
  if not w[len(w)-1]==w1[0]:
    ans="No"
    break
  if w1 in ww:
    ans="No"
    break
  w=w1
  ww+=[w]
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;
void solve(){
    int N,a,ans;
    cin >> N;
    map<int,int>A;
    fol(i,N){
        cin >>a;
        auto itr = A.find(a);
        if (itr==A.end()) A[a]=1;
        else A.erase(itr);
    }
    ans = A.size();
    cout << ans <<endl;
}

int main(){
/*/Debug by file input
    ifstream fin("input");
    cin.rdbuf(fin.rdbuf());// */
    solve();
    return 0;
}


Measured memory_bytes: 4864
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int count = sc.nextInt();
    String str = sc.next();
    long out = 0;

    for (int i = 0; i < count -2; i++) {
      if ('A' == str.charAt(i) && 'B' == str.charAt(i + 1) && 'C' == str.charAt(i + 2)) {
        out++;
      }
    }
    System.out.println(out);
  }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <string.h>
#define N 500000

typedef struct{
  int key, left, right;
}Node;

Node tree[N+1];
int size;

void insert(int x){
  int p = 0;
  while(1){
    if(x < tree[p].key){
      if(tree[p].left == -1){
        tree[p].left = size;
        tree[size++].key = x;
        break;
      }else p = tree[p].left;
    }else{
      if(tree[p].right == -1){
        tree[p].right = size;
        tree[size++].key = x;
        break;
      }else p = tree[p].right;
    }
  }
}

void inorder(int p){
  if(tree[p].left != -1) inorder(tree[p].left);
  printf(" %d", tree[p].key);
  if(tree[p].right != -1) inorder(tree[p].right);
}

void preorder(int p){
  printf(" %d", tree[p].key);
  if(tree[p].left != -1) preorder(tree[p].left);
  if(tree[p].right != -1) preorder(tree[p].right);
}

main(){
  int n, i, first;
  first = 1;
  scanf("%d", &n);
  for(i=0;i<=n;i++) tree[i].key = tree[i].left = tree[i].right = -1;
  size = 0;
  while(n--){
    char str[100];
    scanf("%s", str);
    if(!strcmp(str, "insert")){
      int in;
      scanf("%d", &in);
      if(first){
        tree[size++].key = in;
        first = 0;
      }
      else insert(in);
    }else{
      inorder(0);
      printf("\n");
      preorder(0);
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 7604
//B - Count ABC

#include <iostream>

using namespace std;

const string ABC = "ABC";

int main()
{
    int n;
    string s;

    cin >> n;
    cin >> s;

    int ans = 0;

    for (int i=0; i<n-2; i++){
        if (s.substr(i, 3) == ABC) {
            ans++;
        }
    }
    
    cout << ans << endl;

    return 0;
}


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

long lucas(int i){
  if(i == 0)  return 2;
  if(i == 1)  return 1;

  return lucas(i-1) + lucas(i-2);
}
int main()
{

	int N;
	cin >> N;
  vector<long long> L(90);

  for(int i=0; i<=N; i++){
    if(i == 0) L.at(i) = 2;
    else if(i == 1) L.at(i) = 1;
    else L.at(i) = L.at(i-1) + L.at(i-2);
  }

	cout << L.at(N) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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

  cout << (ll)(n-1)*n/2 << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
namespace fuck
{
	const int N=200010,M=N*2;
	int begin[N],next[M],to[M];
	int dis[N];
	int n,m,e;
	void add(int x,int y,bool k=1)
	{
		to[++e]=y;
		next[e]=begin[x];
		begin[x]=e;
		if(k)add(y,x,0);
	}
	void bfs()
	{
		static int dl[M];
		int u,d;
		u=d=0;
		for(int i=1;i<=n;i++)dis[i]=-1;
		dis[dl[++u]=1]=0;
		for(int p,q;u>d;)
		{
			p=dl[++d];
			for(int i=begin[p];i;i=next[i])
			{
				if(dis[q=to[i]]>=0)continue;
				dis[q]=dis[p]+1;
				dl[++u]=q;
			}
		}
	}
	void solve()
	{
		scanf("%d%d",&n,&m);
		for(int u,v;m--;)
		{
			scanf("%d%d",&u,&v);
			add(u,v);
		}
		bfs();
		if(dis[n]>2 || dis[n]<0)printf("IMPOSSIBLE\n");
		else printf("POSSIBLE\n");
	}
}
int main()
{
	fuck::solve();
	return 0;
}


Measured memory_bytes: 6400
#include <iostream>

#define SIZE 100

using namespace std;

void selectionSort(int, int[]);

int main(void) {
	int n, list[SIZE];
	
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> list[i];
	}

	selectionSort(n, list);

	return 0;
}

void selectionSort(int n, int list[]) {
	int count = 0;
	int min, tmp;
	for (int i = 0; i < n; i++) {
		min = i;
		for (int j = i; j < n; j++) {
			if (list[j] < list[min]) {
				min = j;
			}
		}
		tmp = list[i];
		list[i] = list[min];
		list[min] = tmp;
		if (i != min) {
			count++;
		}
	}
	for (int i = 0; i < n; i++) {
		if (i > 0) {
			cout << " ";
		}
		cout << list[i];
	}
	cout << "\n" << count << "\n";
}

Measured memory_bytes: 3084
#coding: utf-8

s = input()
N = len(s)

for i in range(N-1):
    if s[i] == s[i+1]:
        print(i+1,i+2)
        exit()

for i in range(N-2):
    if s[i] == s[i+2]:
        print(i+1,i+3)
        exit()

print(-1, -1)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;cin >> x;
    if(x<=599){
        cout << 8 << endl;
    }
    else if(x<=799){
        cout << 7 << endl;
    }
    else if(x<=999){
        cout << 6 << endl;
    }
    else if(x<=1199){
        cout << 5 << endl;
    }
    else if(x<=1399){
        cout << 4 << endl;
    }
    else if(x<=1599){
        cout << 3 << endl;
    }
    else if(x<=1799){
        cout << 2 << endl;
    }
    else{
        cout << 1 << endl;
    }
}


Measured memory_bytes: 3652
a = int(input())
lengt = list(map(int, input().split()))
lengt.sort(reverse = False)

count = 0

for m, x in enumerate(lengt[:-2]):
  for n, y in enumerate(lengt[m+1:-1]):
    if x == y:
      count += 0
    else:
      for p, z in enumerate(lengt[m+n+1:]):
        if x+y>z and x!=z and y!=z:
          count += 1
        else:
          count += 0

print(count)

Measured memory_bytes: 9152
S=input()
T=input()
N=len(S)
n=len(T)
core=[]
for i in range(N-n,-1,-1):
    S1=S
    time=0
    for j in range(i,i+n):
        if S[j]=="?":
            time+=1
            continue
        elif S[j]==T[j-i]:
            time+=1
            continue
        else:
            break
    if time==n:
        S1=S1[:i]+T+S1[i+n:]
        S1=S1.replace("?","a")
        core.append(S1)

if len(core)==0:
    print("UNRESTORABLE")
else:
    core.sort()
    print(core[0])

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


template<int mod>
struct ModInt{
	int x;

	ModInt() : x(0){}
	ModInt(long long y) : x(y>=0 ? y%mod : (mod-(-y)%mod)){}

	ModInt &operator+=(const ModInt &p){
		if((x+=p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator-=(const ModInt &p){
		if((x+=mod-p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator*=(const ModInt &p){
		x=(int)(1LL*x*p.x%mod);
		return *this;
	}
	ModInt &operator/=(const ModInt &p){
		*this*=p.inverse();
		return *this;
	}

	ModInt operator-() const{return ModInt(-x);}
	ModInt operator+(const ModInt &p) const{return ModInt (*this)+=p;}
	ModInt operator-(const ModInt &p) const{return ModInt (*this)-=p;}
	ModInt operator*(const ModInt &p) const{return ModInt (*this)*=p;}
	ModInt operator/(const ModInt &p) const{return ModInt (*this)/=p;}
	bool operator==(const ModInt &p) const{return x==p.x;}
	bool operator!=(const ModInt &p) const{return x!=p.x;}
	friend ostream &operator<<(ostream &os, const ModInt &p){return os<<p.x;}
	friend istream &operator>>(istream &is,ModInt &a){
		int t;
		is>>t;
		a=ModInt<mod>(t);
		return (is);
	}

	ModInt inverse() const{
		int a=x, b=mod, u=1, v=0, t;
		while(b>0){
			t=a/b;
			a-=t*b;
			swap(a,b);
			u-=t*v;
			swap(u,v);
		}
		return ModInt(u);
	}
	
	ModInt pow(int e) const{
		long long a=1,p=x;
		while(e>0){
			if(e%2==0){p=(p*p)%mod; e/=2;}
			else {a=(a*p)%mod; e--;}
		}
		return ModInt(a);
	}
};

using modint =ModInt<1000000007>;
vector<modint> fact;

signed main(){
	int r1,c1,r2,c2; cin>>r1>>c1>>r2>>c2;
	fact.assign(r2+c2+100,0);
	fact[0]=1;
	for(int i=1;i<=r2+c2+10;i++){
		fact[i]=i;
		fact[i]*=fact[i-1];
	}
	modint ans=0;
	for(int i=r1+1;i<=r2+1;i++){
		ans+=fact[c2+i]/fact[c2]/fact[i];
		ans-=fact[c1+i-1]/fact[c1-1]/fact[i];
	}
	cout<<ans<<endl;
	
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    string s;cin >> s;
    int n=s.size();
    int dp[n+2][2];
    dp[0][0]=0;
    for(int i=0;i<n;i++){
        if(!i){
            dp[i+1][0]=0;
            dp[i+1][1]=1;
        }
        else{
            int p=s[i-1]-'0';
            dp[i+1][0]=min({dp[i][0]+p,dp[i][1]+p+1,dp[i][1]+10-p});
            dp[i+1][1]=min(dp[i][0]+p+1,dp[i][1]+9-p);
        }
    }
    int p=s[n-1]-'0';
    cout << min({dp[n][0]+p,dp[n][1]+p+1,dp[n][1]+10-p}) << endl;
}

Measured memory_bytes: 9220
#include<bits/stdc++.h>
using namespace std;
// size_t f = string::npos
// make pair, tuple
//
// bool isPrime(int n){
//       if(n <= 1)return false;
//       if(n <= 3)return true;
//       if(n % 2 == 0 || n % 3 == 0)return false;
//       for(int i = 5;i * i <= n;i += 6){
//             if(n % i == 0 || n % (i + 2) == 0)return false;
//       }
//       return true;
// }

int main(){
      long long int a,b;cin >> a >> b;
      long long int x = min(a, b);
      long long int y = max(a, b);
      long long int c = x;
      long long int p = 2;
      while(c % x != 0 || c % y != 0){
            c = x * p++;
      }
      cout << c;
}


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

namespace Programminng
{
    class AOJ_Volume0016
    {
        public static void Main(string[] args)
        {
            double x = 0.0, y = 0.0, angle = 90;
            while (true)
            {
                string[] input = Console.ReadLine().Split(',');

                if (input[0] == "0" && input[1] == "0") break;

                int value = int.Parse(input[0]);
                int value_2 = int.Parse(input[1]);
               

                x += Math.Cos(angle * Math.PI / 180) * value;
                y += Math.Sin(angle * Math.PI / 180) * value;
                angle -= value_2;
            }

            Console.WriteLine((int)x);
            Console.WriteLine((int)y);
        }
    }
}

Measured memory_bytes: 5604
# C - Cat Snuke and a Voyage
N,M = map(int, input().split())
A = [list(map(int, input().split())) for i in range(M)]
goal2 = []
goal1 = []
for i in range(M):
    if A[i][1] == N:
        goal2.append(A[i][0])
    elif A[i][0] == 1:
        goal1.append(A[i][1])
    else:
        pass

if len(set(goal1)&set(goal2)) != 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 103640
#include <iostream>
#include <queue>
using namespace std;
int main() {
	int n, m;
	cin >> n >> m;
	priority_queue<int> q;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		q.push(x);
	}
	for (int i = 0; i < m; i++) {
		int x = q.top();
		q.pop();
		q.push(x/2);
	}
	long long s = 0;
	while (!q.empty()) {
		s += q.top();
		q.pop();
	}
	cout << s << endl;
}



Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

vector<int> get_prime(int n) {
    if(n <= 1) return vector<int>{};
    vector<bool> is_composite(n);
    vector<int> prime;
    for (int i = 2; i <= n; ++i) {
        if(!is_composite[i]) prime.push_back(i);
        for (auto &&j : prime) {
            if(i*j > n) break;
            is_composite[i*j] = true;
            if(i % j == 0) break;
        }
    }
    return prime;
}

auto p = get_prime(50000);

int main() {
    int m, a, b;
    while(cin >> m >> a >> b, m){
        int ans1 = 0, ans2 = 1, ans3 = 0;
        for (int i = 0; i < p.size(); ++i) {
            for (int j = i; j < p.size(); ++j) {
                if(p[i]*p[j] > m) break;
                if(a*p[j] > p[i]*b) break;
                if(ans3 <= p[i]*p[j]){
                    ans1 = p[i], ans2 = p[j], ans3 = p[i]*p[j];
                }
            }
        }
        cout << ans1 << " " << ans2 << "\n";
    }
    return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

bool dp[4040][8080];

bool ret(vector<int> cnt,int a) {
    if(cnt.empty() && a != 0) {
        return false;
    }
    int all = 0;
    for(int i = 0;i < cnt.size();i++) {
        all += cnt.at(i);
    }
    if((all + a) % 2 == 1) {
        return false;
    }
    all = (all + a) / 2;
    memset(dp,0,sizeof(dp));
    dp[0][0] = true;
    for(int i = 0;i < cnt.size();i++) {
        for(int j = 0;j <= all;j++) {
            dp[i + 1][j] |= dp[i][j];
            if(j >= cnt.at(i)) {
                dp[i + 1][j] |= dp[i][j - cnt.at(i)];
            }
        }
    }
    return dp[cnt.size()][all];
}

int main() {
    string S;
    cin >> S;
    S += 'T';
    int x,y;
    cin >> x >> y;
    vector<int> dx;
    vector<int> dy;
    int cnt = 0;
    bool cnt2 = false;
    for(int i = 0;i < S.size();i++) {
        if(S.at(i) == 'F') {
            cnt++;
        }
        else {
            if(cnt2 == false) {
                dx.push_back(cnt);
                cnt = 0;
                cnt2 = true;
            }
            else {
                dy.push_back(cnt);
                cnt = 0;
                cnt2 = false;
            }            
        }
    }
    x -= dx.at(0);
    dx.erase(dx.begin());
    if(ret(dx,x) && ret(dy,y)) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 32256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    ll ans = 700;
    rep(i, s.size()) {
        if(s[i] == 'o') {
            ans += 100;
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 256
def examC():
    ABCD = S()
    loop = 2**3
    for i in range(loop):
        cur = int(ABCD[0])
        for j in range(3):
            if (i>>j)&1==1:
                cur += int(ABCD[j+1])
            else:
                cur -= int(ABCD[j+1])
        if cur==7:
            cur = i
            break
    ans = str(ABCD[0])
    for i in range(3):
        if (cur>>i)&1 == 1:
            ans += "+"
        else:
            ans += "-"
        ans += str(ABCD[i+1])
    ans += "=7"
    print(ans)

import sys,copy,bisect,itertools
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


Measured memory_bytes: 3520
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    long long a[7]; rep(i,7) cin>>a[i];
    long long ans1=0,ans2=0;
    ans1+=a[0]/2*2;
    ans1+=a[1];
    ans1+=a[3]/2*2;
    ans1+=a[4]/2*2;
    if(a[0]>0&&a[3]>0&&a[4]>0){
        ans2+=3;
        a[0]--;
        a[3]--;
        a[4]--;
    }
    ans2+=a[0]/2*2;
    ans2+=a[1];
    ans2+=a[3]/2*2;
    ans2+=a[4]/2*2;
    cout<<max(ans1,ans2)<<endl;
    return 0;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;

	int ans = INF;
	rep(i, 0, max(X, Y) * 2+1)
	{
		if (i % 2 == 1)continue;
		int res = C * i + max(0LL,A * (X - i / 2)) + max(0LL,B * (Y - i / 2));
		chmin(ans, res);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict as dd
N=int(input())
S = [input() for _ in range(N)]
dic = dd(int)
for s in S:
    dic[s] += 1
print('AC x '+str(dic['AC']))
print('WA x '+str(dic['WA']))
print('TLE x '+str(dic['TLE']))
print('RE x '+str(dic['RE']))

Measured memory_bytes: 78792
#include<stdio.h>
#include<vector>
#include<iostream>
#include<functional>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    ll n,q,a;
    vector<ll> list;
    cin >> n >> q;
    REP(i,n){
        cin >> a;
        list.push_back(a);
    }

    ll x;
    REP(i,q){
        cin >> x;

        ll ans = 0;
        ll l=0, r=0;
        ll stat=0;     //define status
        for(l=0; l<n; l++){
            while(r<n && stat+list[r]<=x){
                stat += list[r];
                r++;
            }
            //operate
            ans += r-l;
            //increment
            if(r==l)r++;
            else stat -= list[l];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3868
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Sagor
 */

#include <fstream>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

#define gap                        ' '
#define EPS                        1e-9
#define P_INF                      2e9+17
#define N_INF                     -2e9-17
#define MOD                        1000000007
#define PI                         2*acos(0.0)
#define All(x)                     x.begin(),x.end()
#define Mem(Name, type)            memset(Name, type, sizeof(Name))

template<typename T>
T GCD(T a, T b) { return a ? GCD(b % a, a) : b; }

template<typename T>
T LCM(T a, T b) { return (a * b) / GCD(a, b); }

template<typename T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &v) {
    for (auto ob : v) os << ob << " ";
    return os;
}

template<typename T, typename S>
std::ostream &operator<<(std::ostream &os, const std::map<T, S> &v) {
    for (auto ob : v) os << ob.first << " : " << ob.second << std::endl;
    return os;
}

using ld = double;
using ll = long long int;
using ul = unsigned long long int;
using namespace std;

class ARepeatACL {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n;
        in >> n;
        for (int i = 0; i < n; ++i) {
            out << "ACL";
        }
        out << endl;
    }
};


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ARepeatACL solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int main(void){
  char S[6];
  int cnt = 0;
  cin >> S;
  if(S[2] == S[3]) cnt++;
  if(S[4] == S[5]) cnt++;
  if(cnt == 2) cout << "Yes" << "\n";
  else cout << "No" << "\n";
  return 0;
}

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

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            int input = Integer.parseInt(br.readLine());

            String result = "red";
            if (input >= 3200) {
                result = br.readLine();
            }

            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

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

int main(){
    int n, k;
    cin >> n >> k;
    int a[n];
    int sum = 0;
    rep(i,n){ 
        cin >> a[i];
        sum += a[i];
    }
    vector<int> div;
    int ans = 1;
    for(int i = 1; i*i <= sum; i++) {
        if(sum % i == 0){
             div.push_back(i);
             div.push_back(sum/i);
        }
    }
    rep(i, div.size()){
        int m[n];
        rep(j,n) m[j] = a[j] % div[i];
        sort(m, m+n); 
        int l[n+2] = {}, r[n+2] = {};
        rep(j,n){
            l[j+1] = l[j] + m[j];
            r[n-j] = r[n+1-j] + (div[i]-m[n-j-1]);
        }
        int s;
        for(int b = 0; b <= n; b++) if(l[b] == r[b+1]) s = l[b];
        if(s <= k) ans = max(ans,div[i]);
    }
    cout << ans << endl;
    return 0;
}

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

public class AC
{


    public static int[] ReadArray()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt32(m));
    }

    public static int ReadInt()
    {
        return Convert.ToInt32(Console.ReadLine());
    }

    public static string ReadStr()
    {
        return Console.ReadLine();
    }

    public static long ReadLong()
    {
        return Convert.ToInt64(Console.ReadLine());
    }

    public static long[] ReadLongArray()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt64(m));

    }


    public static void Main()
    {
        int n = ReadInt();
        int[] A = ReadArray();

        long ans = 0;
        int max = 0;

        for(int i = 0; i < A.Length; i++)
        {
            if (A[i] < max)
                ans += max - A[i];

            max = Math.Max(max, A[i]);
        }

        Console.WriteLine(ans);



    }

}


Measured memory_bytes: 43564
//Created by Kira

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

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
	
int gcd(int a, int b){
	return b == 0 ? a : gcd(b, a % b);
}

const int N = 1e6 + 10;
int main(){
   IOS

	int  n; cin>>n;
	
	vi a(n);
	int mx = 0;
	for(int &x : a){
		cin>>x;
		mx = max(mx, x);
	}

	int g = 0;
	for(int i = 0; i < n; i++){
		g = gcd(a[i], g);
	}

	bool pw = true;
	unordered_map<int,int> mp;
	for(int i = 0; i < n; i++){
		if(mp.count(a[i]) && a[i] != 1){
			pw = false;
			break;
		}
		mp[a[i]]++;
	}

	if(!pw){
		if(g == 1){
			cout<<"setwise coprime\n";
		}else{
			cout<<"not coprime\n";
		}
	}else{

		for(int i = 2; i <= mx; i++){
			int cnt = 0;
			for(int j = i; j <= mx; j+= i){
				if(mp.count(j)){
					cnt++;
				}
			}
			if(cnt > 1){
				pw = false;
				break;
			}
		}

		if(!pw){
			if(g == 1){
				cout<<"setwise coprime\n";
			}else{
				cout<<"not coprime\n";
			}
		}else{
			cout<<"pairwise coprime\n";
		}

	}

	





	



	



}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
	if(b&1) res = res * a % mod;
		a = a * a % mod;
	b >>= 1;
	}

	return res;
}



Measured memory_bytes: 46416
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
#define MOD 1000000007
//scanf("%d", &a) '\n'

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	string s1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
	rep(i, s.size()) {
		rep(j, 26) {
			if (s[i] == s1[j]) {
				s[i]=s1[j + n]; break;
			}
		}
	}
	cout << s << endl;
}
	

Measured memory_bytes: 256
X, N = [int(_c) for _c in input().split(" ")]

p_list_raw = input()
if p_list_raw == "":
    print(X)
else:
    p_list = [int(_c) for _c in p_list_raw.split(" ")]

    ans = -1
    for i in range(101):
        target = X - i
        if target not in p_list:
            ans = target
            break
        target = X + i
        if target not in p_list:
            ans = target
            break

    print(ans)

Measured memory_bytes: 9200
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		StringTokenizer tok = new StringTokenizer(in.readLine());
		int N = Integer.parseInt(tok.nextToken());
		int M = Integer.parseInt(tok.nextToken());
		boolean arr[] = new boolean[N + 1];
		int arr2[] = new int[N + 1];
		arr[1] = true;
		Arrays.fill(arr2, 1);
		int cont = 0;
int xxxx = 0;
		for (int i = 0; i < M; i++) {
			tok = new StringTokenizer(in.readLine());
			int x = Integer.parseInt(tok.nextToken());
			int y = Integer.parseInt(tok.nextToken());
			if (arr[x]) {
				if (arr2[x] != 0) {
					// cont++;
					arr2[y]++;
					arr2[x]--;
					if (arr2[x] == 0) {
						arr[x] = false;
					}
					arr[y] = true;
				} else {
					arr2[y]++;
					arr2[x]--;
				}
			} else {
				arr2[y]++;
				arr2[x]--;
			}
		}

		for (int i = 0; i < arr.length; i++) {
			if (arr[i])
				cont++;
		}
		out.println(cont);
		out.close();
	}
}

Measured memory_bytes: 40952
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    H, W = NMI()
    if H % 3 == 0 or W % 3 == 0:
        print(0)
        exit()
    if H == 2 or W == 2:
        print(1)
        exit()

    lh, gh = H // 3, H // 3 + 1
    lw, gw = W // 3, W // 3 + 1

    ans = min(H, W)

    a = lh * W
    b, c = (H - lh) * (W // 2), (H - lh) * (W - W // 2)
    gap = max(a,b,c) - min(a,b,c)
    ans = min(ans, gap)

    a = gh * W
    b, c = (H - gh) * (W // 2), (H - gh) * (W - W // 2)
    gap = max(a,b,c) - min(a,b,c)
    ans = min(ans, gap)

    a = H * lw
    b, c = (W - lw) * (H // 2), (W - lw) * (H - H // 2)
    gap = max(a,b,c) - min(a,b,c)
    ans = min(ans, gap)

    a = H * gw
    b, c = (W - gw) * (H // 2), (W - gw) * (H - H // 2)
    gap = max(a,b,c) - min(a,b,c)
    ans = min(ans, gap)

    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316