akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
LL t[1010], a[1010];

int main(){
    
    // 1. 入力情報.
    int N;
    scanf("%d", &N);
    rep(i, N) scanf("%lld %lld", &t[i], &a[i]);
    
    // 2. 投票数を計算.
    LL ans = 0, tBef = 0, aBef = 0;
    rep(i, N){
        // 今回分取得.
        LL tCur = t[i];
        LL aCur = a[i];
        
        // 投票数を計算.
        if(!tBef && !aBef){
            ans = t[i] + a[i];
            tBef = t[i];
            aBef = a[i];
            continue;
        }
        
        // 得票数の変化を確認.
        if(tCur < tBef || aCur < aBef){
            LL dt = tBef / tCur;
            LL da = aBef / aCur;
            LL dd = max(dt, da);
            // printf("tBef=%lld tCur=%lld aBef=%lld aCur=%lld\n", tBef, tCur, aBef, aCur);
            if(tCur * dd < tBef || aCur * dd < aBef) dd++;
            tCur *= dd;
            aCur *= dd;
            // printf("tBef=%lld tCur=%lld aBef=%lld aCur=%lld\n", tBef, tCur, aBef, aCur);
        }
        
        // 更新.
        ans = tCur + aCur;
        
        // 前回分更新.
        tBef = tCur;
        aBef = aCur;
    }
    
    // 3. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 3804
#include <iostream>
using namespace std; 
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a>b)swap(a,b);
    if(b>c)swap(b,c);
    if(a>b)swap(a,b);
    cout<<a<<" "<<b<<" " <<c<<endl;
}


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

using namespace std;

#define rep(i, a, b) for (int i = (a); i <= (b); i++)

const int N = 1e5 + 100;

int n, k, q, a[N], tot[N];

int main() {
  cin >> n >> k >> q;
  rep(i, 1, q) {
    scanf("%d", &a[i]);
    tot[a[i]]++;
  }
  rep(i, 1, n) {
    if (q - tot[i] < k) puts("Yes");
    else puts("No");
  }
  return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>


int main(){
	
	int a,i,count=0,max=0;
	char n[101];
	
	scanf("%d\n",&a);
	
	for(i=0;i<a;i++){
		scanf("%c",&n[i]);
		if(n[i]=='I')count=count+1;
		if(n[i]=='D')count=count-1;
		if(count>=max)max=count;
	}
	
	printf("%d\n",max);
	
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n, d;
  cin >> n >> d;
  cout << (n + 2 * d) / (2 * d + 1) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;


// a,bの最小公倍数
ll lcm(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll gcd(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}
// MOD
ll modadd(ll a, ll b){return (a%MOD+b%MOD+MOD)%MOD;}
ll modmul(ll a, ll b){return a%MOD*b%MOD%MOD;}
ll modexp(ll a, ll n){if(n==0)return 1; if(n%2==0){ll e=modexp(a,n/2); return modmul(e,e);} return modexp(a,n-1)*a%MOD;}
ll modinv(ll n){return modexp(n%MOD,MOD-2);}
ll modfact(ll n){ll res=1; for (int i=1; i <= n; ++i){res *= i; res %= MOD;} return res;}
ll modncr(ll n, ll r){ll numer=1;ll denom=1;for(int i=1;i<=r;++i){numer=modmul(numer,n-r+i);denom=modmul(denom,i);}return modmul(numer, modinv(denom));}


int main(){

    int n;
    cin >> n;
    int a[2][n];
    rep(i,n) cin >> a[0][i];
    rep(i,n) cin >> a[1][i];

    int mx = 0;
    rep(i, n) {
        int tmp = 0;
        rep(j,n) {
            if (j < i) tmp += a[0][j];
            else if (j == i) tmp += a[0][j] + a[1][j];
            else tmp += a[1][j];
        }

        mx = max(mx, tmp);
    }

    cout << mx << endl;

}



//              g++ -std=c++1z


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

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

    int cnt = 0;
    rep(i, s.size()) if(s[i] == 'p') cnt++;
    cout << (int(s.size()/2) - cnt) << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.PriorityQueue;
import java.util.Scanner;

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

		final int n = sc.nextInt();
		
		long[][] map = new long[n][n];
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				map[i][j] = sc.nextLong();
			}
		}
		
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(i != 0){
					map[i][j] += map[i-1][j];
				}
				if(j != 0){
					map[i][j] += map[i][j-1];
				}
				if(i != 0 && j != 0){
					map[i][j] -= map[i-1][j-1];
				}
			}
		}
		
		long max = Long.MIN_VALUE;
		for(int s_y = 0; s_y < n; s_y++){
			for(int s_x = 0; s_x < n; s_x++){
				
				for(int e_y = s_y; e_y < n; e_y++){
					for(int e_x = s_x; e_x < n; e_x++){
						
						final long ll = s_y == 0 || s_x == 0 ? 0 : map[s_y-1][s_x-1];
						final long lr = s_y == 0 ? 0 : map[s_y-1][e_x];
						final long rl = s_x == 0 ? 0 : map[e_y][s_x-1];
						final long rr = map[e_y][e_x];
						
						max = Math.max(max, rr - lr - rl + ll);
					}
				}
			}
		}
		
		System.out.println(max);
		
	}

}

Measured memory_bytes: 37224
/*
Author : Harsh AKA Codula
*/
#include<iostream>
#include<vector>

using namespace std;

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define deb(x) cout<<"["<<#x<<"="<<x<<"]"<<"\n";
#define FOR(a,b) for(ll i=a;i<b;++i)
#define read(x) for(auto& i:x)cin>>i
#define pb push_back

class MAIN
{
	public:
		void run()
		{
			ll t=1;//cin>>t;
			while(t--)
			{
				ll n;
				cin>>n;
 				vector<pair<ll,ll>> a(n,pair<ll,ll>(0,0));
 				for(ll i=0;i<n;++i)
 				{
 					cin>>a[i].first>>a[i].second;
 				}
 				bool flag=false;
 				for(ll i=0;i<n-2;i+=1)
 				{
 					if(a[i].first==a[i].second&&a[i+1].first==a[i+1].second&&a[i+2].first==a[i+2].second)
 					{
 						flag=true;
 						break;
 					}
 				}
 				if(flag)
 				{
 					cout<<"Yes";
 				}
 				else
 				{
 					cout<<"No";
 				}
				cout<<"\n";
			}
		}	
};

int main()
{
	fast;
	MAIN solution;
	solution.run();
	return 0;
}

Measured memory_bytes: 3612
N=int(input())
A=list(map(int,input().split()))
f=True
ans=0
while f:
  for i in range(N):
    if A[i]%2==0:
      A[i]=A[i]//2
    else:
      f=False
    
  if f:
    ans+=1
    
print(ans)

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

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

	for(int i = 1; i <= 9; i++){
		for(int j = i; j <= 9; j++){
			if(i*j == n){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.nio.CharBuffer;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

    private static final int MOD = 1000000007;
    private static final int DIV = 13;

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        char[] s = scanner.next().toCharArray();
        int n = s.length;
        long[][] f = new long[2][DIV];
        f[0][0] = 1;
        int cur = 0;
        for (int i = 0; i < n; ++i) {
            cur ^= 1;
            Arrays.fill(f[cur], 0);
            if (s[i] == '?') {
                for (int digit = 0; digit <= 9; ++digit) {
                    for (int j = 0; j < DIV; ++j) {
                        f[cur][(j * 10 + digit) % DIV] = (f[cur][(j * 10 + digit) % DIV] + f[cur ^ 1][j]) % MOD;
                    }
                }
            } else {
                int digit = s[i] - '0';
                for (int j = 0; j < DIV; ++j) {
                    f[cur][(j * 10 + digit) % DIV] = f[cur ^ 1][j];
                }
            }
        }
        writer.println(f[cur][5]);
        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        int nextInt() {
            return Integer.valueOf(next());
        }

        long nextLong() {
            return Long.valueOf(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 24788
n = int(input())
a = list(map(int, input().split()))
total = 1
total2 = 0
a.append(0)
for i in range(0, n):
    if a[i]==a[i+1]:
        total += 1
    else:
        total2 += total//2
        total = 1
print(total2)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
#define LL long long
#define int long long
using namespace std;
template<typename T>void read(T &x){
	x=0;int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if (c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-48;
	x*=f;
}
int P=1000000007;
inline void mo(int &x){if(x>=P) x-=P;if(x<0) x+=P;}
int a[100010],n,s[100010],pin[100010],ivp[100010];
int sm(int l,int r){
	int rt=s[r]-s[l-1]; mo(rt);
	return rt;
}
int inv[100010];
signed main(){
	read(n);
	for(int i=1;i<=n;++i)
		read(a[i]),s[i]=s[i-1]+a[i],mo(s[i]);
	pin[0]=1;
	for(int i=1;i<=n;++i) pin[i]=1ll*i*pin[i-1]%P;
	inv[1]=1;
	for(int i=2;i<=n;++i)
		inv[i]=1ll*(P-P/i)*inv[P%i]%P;
	ivp[0]=1;
	for(int i=1;i<=n;++i) ivp[i]=1ll*inv[i]*ivp[i-1]%P;
	int ans=1ll*pin[n]*s[n]%P,nw=0;
	for(int len=1;len<=n-2;++len){
		nw+=sm(1+len,n-len);mo(nw);
		ans=(ans+1ll*2*pin[n]*pin[len]%P*ivp[len+2]%P*nw)%P;
	}
	for(int i=1;i<n;++i)
		ans=(ans+1ll*pin[n]*pin[i]%P*ivp[i+1]%P*s[i])%P;
	for(int j=2;j<=n;++j){
		int len=n-j+1;
		ans=(ans+1ll*pin[n]*pin[len]%P*ivp[len+1]%P*(s[n]-s[j-1]))%P;mo(ans);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,m,c;
  cin>>N>>m>>c;
  vector<int>B(m);
  vector<vector<int>>A(N,vector<int>(m));
  
  for(int i=0;i<m;i++){
    cin>>B.at(i);
  }
  
  for(int i=0;i<N;i++){
    for(int j=0;j<m;j++){
      
      cin>>A.at(i).at(j);
    }
  }
  int sum=c;
  int count =0;
  for(int i=0;i<N;i++){
    for(int j=0;j<m;j++){
      
      sum += A.at(i).at(j)*B.at(j);
      
    }
    
    if(sum>0){
      count++;
    }
    sum=c;
  }
  
  
  
  
  
  cout<<count<<endl;
  
  
  
  
}

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

int a[102][102],color;

void dfs(int x,int y){
   
    a[y][x] = 9;
    
    if(a[y+1][x] == color){
      dfs(x,y+1);
    }
    if(a[y][x+1] == color){
      dfs(x+1,y);
    }
    if(a[y-1][x] == color){
      dfs(x,y-1);
    } 
    if(a[y][x-1] == color){
      dfs(x-1,y);
    }
 
} 

int main(){

  int xs,ys,xg,yg,n,c,d,x,y,w,h;

  while(1){
  
    cin >>w>>h;
    
    if(w == 0 && h == 0)break;

    for(int i = 0 ; i < 102 ; i++){
      for(int j = 0 ; j < 102 ; j++){
	a[i][j]=0;
      }
    }

    cin >>xs>>ys;
    cin >>xg>>yg;

    cin >>n;

    for(int i = 0 ; i < n ; i++){
      
      cin >> c >> d >> x >> y;
      
      if( d == 0 ){
	for(int i = 0 ; i < 2 ; i++){
	  for(int j = 0 ; j < 4 ; j++){
	    a[i+y][j+x] = c;
	  }
	}
      }else{
	for(int i = 0 ; i < 4 ; i++){
	  for(int j = 0 ; j < 2 ; j++){
	    a[i+y][j+x] = c;
	  }
	}
      }
    
    }
    
    /*
      for(int i = 0 ; i < h+2 ; i ++){
      for(int j = 0 ; j < w+2 ; j++){
      cout << a[i][j];
      }
      cout <<endl;
      }
      cout <<endl;
    */
  
    if(a[ys][xs] != 0){
      color = a[ys][xs];
      dfs(xs,ys);
    }
    
    /*
      for(int i = 0 ; i < h+2 ; i ++){
      for(int j = 0 ; j < w+2 ; j++){
      cout << a[i][j];
      }
      cout <<endl;
      }
    */
    
    if(a[yg][xg] == 9){
      cout <<"OK"<<endl;
    }else{
      cout <<"NG"<<endl;
    }
    
  }      
  
  return 0;
  
}

Measured memory_bytes: 1196
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>

#define ll long long
#define pll pair<ll, ll>

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

const int INF = 1111111111;
const double EPS = 1e-9;

using namespace std;

void init()
{
}

void solve()
{
	char c;
	cin >> c;

	if('a' <= c && c<='z')
	{
		cout << "a" << endl;
		return;
	}

	cout << "A" << endl;
}

int main()
{
	init();
	solve();
}


Measured memory_bytes: 3068
import java.util.Scanner;

public class Main {

    public static void main(String[] args){

        long res = 0;

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();

        if(k == 0) {
            res = (long) n * n;
            System.out.println(res);
            return;
        }

        for(int b=k+1; b<=n; b++) {
            int div = (n+1) / b;
            int rem = (n+1) % b;
            long t = div * (b - k);
            t += Math.max(0, rem - k);
            res += t;
        }

        System.out.println(res);
    }

}


Measured memory_bytes: 23764
from collections import deque
K = int(input())

Current = [1, 2, 3, 4, 5, 6, 7, 8, 9]
cnt = 9
times = 0
while 1:
    Next = deque([])
    cnt = len(Current) 
    if K <= cnt:
        #現在の桁の中で考える
        ans = Current[K - 1]
        break
    else:   #K > cnt
        #次の桁を考える
        for i in Current:
            key = i % 10
            for j in [key - 1, key, key + 1]:
                if 0 <= j and j <= 9:
                    Next.append(i * 10 + j)
                else: #j < 0 or 9 < j
                    pass
        K -= cnt
        Current = Next


print(ans)


Measured memory_bytes: 11380
using System;
using System.Collections;
using System.Collections.Generic;

namespace ITP1_3_B
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> list = new List<int>();

            while(true)
            {
                int input = Convert.ToInt32(Console.ReadLine(), 10);
                if (input == 0) break;

                list.Add( input );
            }

            for(int i = 0; i < list.Count; i++)
            {
                Console.WriteLine("Case " + (i+1) + ": " + list[i]);
            }
        }
    }
}

Measured memory_bytes: 5932
#include<bits/stdc++.h>
using namespace std;
int n,m,i,j,k,l,x[101],y[101];
float r,d[205],P=acos(-1);
main(){
	cin>>n;++m=i=n;
	while(m--)cin>>x[m]>>y[m];
	while(i--){
		j=l=k=r=0;
		for(;j<n;j++)if(i-j)d[k++]=atan2(y[j]-y[i],x[j]-x[i]);
		sort(d,d+k);
		for(;l<k;l++)d[l+k]=d[l]+2*P;
		while(l--)r=max(r,P-d[l+k]+d[l+1]);
		cout<<r/2./P<<'\n';
	}
}

Measured memory_bytes: 256
N = int(input())
ok_flag = 0
jufuku = 0
words = []
word_mae = input()
words.append(word_mae)
for i in range(N-1):
    word_ima = input()
    if(list(word_mae)[-1] == list(word_ima)[0]):
        ok_flag += 1
    if(word_ima in words):
        jufuku = 1
        break
    words.append(word_ima)
    word_mae = word_ima
if(jufuku == 1):
    print("No")
elif(ok_flag == N-1):
    print("Yes")
else:
    print("No")

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var N = input[0];
            var K = input[1];
            var cnt = new int[K + 1];
            for (int i = K - 1; i > 0; i--)
            {
                if (i * 2 >= K) cnt[i] = 1;
                else
                {
                    cnt[i] = cnt[i * 2] + 1;
                }
            }
            var ans = 0D;
            if (N < K)
            {
                for (int i = 1; i <= N; i++)
                {
                    ans += Math.Pow(0.5, cnt[i]);
                }
                ans /= N;
            }
            else
            {
                for (int i = 1; i < K; i++)
                {
                    ans += Math.Pow(0.5, cnt[i]);
                }
                ans += N - K + 1;
                ans /= N;
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

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

#define INF INT_MAX

using namespace std;

int main(void){
	int x,y;
	cin >> x >> y;
	int typeX = 0;
	if(4 == x || 6 == x || 9 == x || 11 == x){
		typeX = 0;
	}else if(x == 2){
		typeX = 1;
	}else{
		typeX = 2;
	}

	int typeY = 0;
	if(4 == y || 6 == y || 9 == y || 11 == y){
		typeY = 0;
	}else if(y == 2){
		typeY = 1;
	}else{
		typeY = 2;
	}

	if(typeY == typeX){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    final static int MOD = 1000000007;
    
    public static void main(String[] args) {
        MyScanner in = new MyScanner();
        int n = in.nextInt();
        int k = in.nextInt();
        int[] h = in.nextIntArray(n);
        
        int count = 0;
    
        for (int i : h) {
            if (i>=k) {
                count++;
            }
        }
    
        System.out.println(count);
        
        
    }
    
    static class MyScanner {
        static Scanner sc = new Scanner(System.in);
        
        String next() {
            return sc.next();
        }
        
        String nextLine() {
            return sc.nextLine();
        }
        
        int nextInt() {
            return Integer.parseInt(sc.next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextInt();
            }
            return array;
        }
        
        double[] nextDoubleArray(int n) {
            double[] array = new double[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextDouble();
            }
            return array;
        }
        
        long[] nextLongArray(int n) {
            long[] array = new long[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextLong();
            }
            return array;
        }
        
        String[] nextLineArray(int n) {
            String[] array = new String[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextLine();
            }
            return array;
        }
        
        int[][] nextIntMatrix(int n, int m) {
            int[][] matrix = new int[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    matrix[i][j] = nextInt();
                }
            }
            return matrix;
        }
        
        double[][] nextDoubleMatrix(int n, int m) {
            double[][] matrix = new double[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    matrix[i][j] = nextDouble();
                }
            }
            return matrix;
        }
        
        long[][] nextLongMatrix(int n, int m) {
            long[][] matrix = new long[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    matrix[i][j] = nextLong();
                }
            }
            return matrix;
        }
    }
}

Measured memory_bytes: 51148
using System;

public class ITP1_2_B
{
    public static void Main(string[] args)
    {
        //var exStdIn = new System.IO.StreamReader( "input.txt" );
        //System.Console.SetIn( exStdIn );

        string[] str = Console.ReadLine().Split(' ');

        var a = int.Parse(str[0]);
        var b = int.Parse(str[1]);
        var c = int.Parse(str[2]);

        Solve(a, b, c);
    }

    private static void Solve(int a, int b, int c)
    {
        if (a < b && b < c)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}



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

int main(){
      string s1,s2;cin >> s1 >> s2;
      for(int i = 0;i < 3;i++){
            if(s1[i] != s2[3 - i - 1])return cout << "NO", 0;
      }
      cout << "YES";
}

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

int main()
{
    int n; cin >> n;
    int a[n],b[n];
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
    }
    int maxi=a[0];
    b[0]=a[0];
    long long int sum=0;
    for(int i=1;i<n;i++)
    {
        maxi=max(maxi,a[i]);
        b[i]=maxi;
    }
    for(int i=0;i<n;i++)
    {
        sum=sum+abs(b[i]-a[i]);
    }
    cout << sum;
}

Measured memory_bytes: 5180
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long;
using P = pair<int, int>;
using lP = pair<ll, ll>;
using fP = pair<double, double>;
ll const mod = 998244353;
const ll MAX = 300000;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<int>num(n);
    rep(i, n)num[i] = s[i] - '0';
    ll sum = 0;
    rep(i, 1 << (n-1)) {
        
        ll div = num[0];
        rep(j, n-1) {
            if (i >> j & 1) {
                sum += div;
                div = num[j + 1];
            }
            else div = div * 10 + num[j + 1];
        }
        sum += div;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define MX 3003
#define pb push_back
int m = 1e9 + 7;
double dp[MX][MX];
int main() {
	dp[0][0] = 1;
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
    	double p;
    	cin >> p;
    	for (int j = 0; j <= i; ++j) {
    		if(j == 0) 
    			dp[i][j] = (1 - p) * dp[i - 1][j];
    		else 
    			dp[i][j] = p * dp[i - 1][j - 1] + (1 - p) * dp[i - 1][j];
    		
    	}
    }
    double sum = 0;
    for (int i = (n / 2) + 1; i <= n; ++i)
    	sum += dp[n][i];
    cout << setprecision(10) << fixed << sum << endl;
}


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


ll n,h;
vector<pair<ll , ll> >arr;
int main()
{
	cin>>n>>h;
	for(int i=0;i<n;i++)
	{
		ll x;
		cin>>x;
		pair<ll, ll>p;
		p.first=x;
		p.second=0;
		arr.push_back(p);
		cin>>x;
		p.first=x;
		p.second=1;
		arr.push_back(p);
	}
	
	sort(arr.begin(),arr.end());
	reverse(arr.begin(), arr.end());
/*	for(int i=0;i<arr.size();i++)
	{
		cout<<arr[i].first<<" "<<arr[i].second<<endl;
	}
*/	
	ll ans=0;
	for(ll i=0;i<arr.size();i++)
	{
		if(arr[i].second==1 and h>0)
		{
			ans++;
		//	cout<<h<<" ";
			h-=arr[i].first;
		//	cout<<h<<endl;	
		}	
		else if(h>0)
		{
		//	cout<<h<<endl;
		//	cout<<ans<<endl;
		//	cout<<(ll)ceil((float)h/arr[i].first)<<endl;
			ans+=h/arr[i].first;
			h-=(h/arr[i].first)*arr[i].first;
			if(h>0)
			ans++;
			break;
		}
	}	
	cout<<ans;
}

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

int main() {
	int n;
	int h[100000];
	cin >> n;
	int a = 0;
	int ans = 0;
	for(int i=0; i!=n; i++){
		cin >> h[i];
		if(i == 0){
			continue;
		}
		if(h[i-1] >= h[i]){
			a += 1;
			if(ans < a){
				ans = a;
			}
		}else{
			a = 0;
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int M = sc.nextInt();
        int[] a = new int[A];
        int[] b = new int[B];
        int[] x = new int[M];
        int[] y = new int[M];
        int[] c = new int[M];
        int amin = Integer.MAX_VALUE;
        int bmin = Integer.MAX_VALUE;
        for (int i = 0; i < A; i++) {
            a[i] = sc.nextInt();
            amin = Math.min(a[i], amin);
        }
        for (int i = 0; i < B; i++) {
            b[i] = sc.nextInt();
            bmin = Math.min(b[i], bmin);
        }
        for (int i = 0; i < M; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
            c[i] = sc.nextInt();
        }

        int ans = amin + bmin;
        for (int i = 0; i < M; i++) {
            ans = Math.min(a[x[i] - 1] + b[y[i] - 1] - c[i], ans);
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 154652
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <stack>
#include <iostream>
#include <string>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

int a[5];

int main() 
{
	while(~scanf("%d%d%d", &a[1], &a[2], &a[3])) {
		sort(a + 1, a + 4);
		if(a[3] - a[2] == a[2] - a[1]) printf("YES\n");
		else printf("NO\n");
	}
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<_>>();
    print!("{}", s[0]);
    let s = read::<String>().chars().collect::<Vec<_>>();
    print!("{}", s[1]);
    let s = read::<String>().chars().collect::<Vec<_>>();
    println!("{}", s[2]);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		int N = in.nextInt();
		
		if(N/100 == 1) {
			System.out.print(9);
		}else {
			System.out.print(1);
		}
		N = N%100;
		if(N/10 == 1) {
			System.out.print(9);
		}else {
			System.out.print(1);
		}
		if(N%10 == 1) {
			System.out.print(9);
		}else {
			System.out.print(1);
		}
		
		
		in.close();
	}
}


Measured memory_bytes: 23252
import math
a, b, h, m = map(int,input().split())
ms = m//60
ma = m%60
h = h + ms
ha =h%12 + ma/60
rh = ha*math.pi/6
rm = ma*math.pi/30
x = math.cos(rh - rm)
ans = math.sqrt(a**2 + b**2 - 2*a*b*x)
print(ans)

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

int main() {
 long long n, k, q;
 cin >> n >> k>>q;
    
 vector<long long> v(q);
 rep(i,q) {
  cin >> v.at(i);
 }
    
    vector<long long> point(n);
    for(int i =0; i<n; i++) {
    point.at(i) = k - q;
    }
    
    rep(i,q) {
     point.at(v.at(i) - 1) += 1;
    }
    
    rep(i,n) {
     if(point.at(i) > 0) {
      cout << "Yes" << endl;
     } else {
      cout << "No" << endl;;
     }
    }
}

Measured memory_bytes: 4824
import math

X = int(input())

i = 0
j = 0
while i < 1:
  q = (X - (100 * j)) // 100
  r = (X - (100 * j)) % 100 + (100 * j)
  
  if math.ceil(r / 5) <= q:
    print(1)
    break
    
  if (X - (100 * (j + 1))) <= 0:
    print(0)
    break
  
  j += 1
  
  



Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    ll x;
    cin>>x;
    ll ans = 0;
    ans += (x / 500) * 1000;
    x %= 500;
    ans += (x / 5) * 5;
    cout<<ans<<endl;
}

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

using namespace std;

int main(){
	long long int N;
	cin >> N;
	vector<pair<long long int, long long int>>D(N);
	for( size_t i = 0; i < N; i++ ){
		cin >> D[i].first >> D[i].second;
	}
	sort(D.begin(), D.end(), [&](const pair<long long int, long long int>&A, const pair<long long int, long long int>&B){
		return A.first - A.second < B.first - B.second;
	});
	long long int i = 0, j = 0;
	long long int div = 0;
	long long int ans = 0;
	vector<long long int>cost;
	for( int i = 0; i < N; i++ ){
		if( D[i].first < D[i].second ){
			div += D[i].second - D[i].first;
			ans += D[i].second;
			D[i].first = 0;
			D[i].second = 0;
		} else if( D[i].first == D[i].second ){
			if( ans ){
				ans += D[i].second;
			}
		} else{
			cost.push_back(D[i].second);
		}
	}
	sort(cost.begin(), cost.end());
	for( size_t i = 1; i < cost.size(); i++ ){
		ans += cost[i];
	}

	cout << ans << endl;
}

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

int main(){
	double n;
	while (cin >> n) {
		if (n > 91.00) {
			cout << "heavy" << endl;
		}else if (n > 81.00) {
			cout << "light heavy" << endl;
		}else if (n > 75.00) {
			cout << "middle" << endl;
		}else if (n > 69.00) {
			cout << "light middle" << endl;
		}else if (n > 64.00) {
			cout << "welter" << endl;
		}else if (n > 60.00) {
			cout << "light welter" << endl;
		}else if (n > 57.00) {
			cout << "light" << endl;
		}else if (n > 54.00) {
			cout << "feather" << endl;
		}else if (n > 51.00) {
			cout << "bantam" << endl;
		}else if (n > 48.00) {
			cout << "fly" << endl;
		}else{
			cout << "light fly" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
N = int(input())
ans = 0
minv = 101
for _ in range(N):
  a = int(input())
  ans += a
  if a%10 != 0:
    minv = min(minv,a)
if ans%10 != 0:
  print(ans)
elif minv <= 100:
  print(ans-minv)
else:
  print(0)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int H,W,cnt;
	cin>>H>>W;
	vector<int> ans[100];
	string clouds[100],temp;
	for(int i=0;i<H;i++){
		cin>>temp;
		clouds[i]=temp;
	}
	for(int i=0;i<H;i++){
		bool flag=false;
		cnt=0;
		for(int j=0;j<W;j++){
			if(clouds[i][j]=='c'){
				cout<<0;
				cnt=1;
				flag=true;
			}else if(flag){
				cout<<cnt;
				cnt++;
			}else{
				cout<<-1;
				
			}
			
			
			if(j!=W-1)cout<<" ";
			else cout<<endl;
		}
	}
	
}

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

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

typedef long long ll;
typedef pair<int, int> P;

#define INF 1e9

char DIR[4] = { 'U', 'R', 'D', 'L' };
struct POINT {
  int x, y, u;
  POINT(int x, int y, int u) : x(x), y(y), u(u) {}
  void rotate(void) {
    int tmp = x;
    x = y;
    y = -tmp;
    u = (u+1)%4;
  }
};

int main(int, char**)
{
  int n;
  cin >> n;
  vector<POINT> p;
  int x, y, uu;
  char u;
  rep(i,n) {
    cin >> x >> y >> u;
    rep(j,4) if (DIR[j] == u) uu = j;
    p.emplace_back(x,y,uu);
  }

  int ans = INF;
  int st;

  rep(_,2) {
    sort(p.begin(), p.end(), [&](POINT a, POINT b)->bool{ if (a.x == b.x) return a.y < b.y; else return a.x < b.x; });
    rep(i,n) {
      if (!i || p[i-1].x < p[i].x) st = -1;
      if (DIR[p[i].u]=='U') st = p[i].y;
      else if (DIR[p[i].u]=='D') {
        if (st != -1) {
          ans = min(ans, (p[i].y - st) * 5);
        }
        st = -1;
      }
    }
    rep(i,n) p[i].rotate();
  }

  rep(_,4) {
    sort(p.begin(), p.end(), [&](POINT a, POINT b)->bool{ if (a.y-a.x == b.y-b.x) return a.x < b.x; else return a.y-a.x < b.y-b.x; });
    rep(i,n) {
      if (!i || p[i-1].y-p[i-1].x < p[i].y-p[i].x) st = -1;
      if (DIR[p[i].u]=='R') st = p[i].x;
      else if (DIR[p[i].u]=='D') {
        if (st != -1) {
          ans = min(ans, (p[i].x - st) * 10);
        }
        st = -1;
      }
    }
    rep(i,n) p[i].rotate();
  }
  if (ans==INF) cout << "SAFE" << endl;
  else cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6368
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int k,s;
    cin >> k >> s;

    vector<int> vec(2*k+1,0);
    for(int i=0; i<=k; i++){
        vec[2*i]++;
        for(int j=i+1; j<=k; j++){
            vec[i+j] += 2;
        }
    }
    int cnt=0;
    for(int i=0; i<=k; i++){
        int sub=s-i;
        if(sub < 0 || sub > 2*k) continue;
        cnt += vec[sub];
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

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

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



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

  ll N;
  string S;
  cin >> N >> S;

  ll ans = 0;
  REP(i,N-2){
    if (S.substr(i,3)=="ABC"){
      ans++;
    }
  }

  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include<climits>
#include <string>
#include <map>
#include <set>
#include <list>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

/////////////////////////////////////////////////////
#define pll pair<ll,ll>

char S[20];
int i,j,ans;
int main(){
    scanf("%s",S);
    ans = 999999;
    for (i = 0; S[i+2] != '\0';i++){
        int num=0;
        for (j = 0; j < 3;j++){
            num += (S[i + j] - '0');
            num *= 10;
        }
        num /= 10;
        int sub = num - 753 < 0 ? 753 - num : num - 753;
        ans = sub < ans ? sub : ans;
    }
    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int 
#define pb push_back
#define mp make_pair
#define ff first
#define se second
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,i,l,r,sum=0,sum1=0,mx,sum2=0;
	cin>>n;
	ll a[n];
	vector<ll> vi,vi1,vi2;
	for(i=0;i<n;i++){
	    cin>>a[i];
	}
	sort(a,a+n);
	if(n%2==1){
	    vi.pb(a[n/2]);
	    l=0;;
	    r=n-1;
	    while(l<r){
	        vi.pb(a[r]);
	        r--;
	        vi.pb(a[l]);
	        l++;
	    }
	    if(n>=3){
	        l=0;;
    	    r=n-1;
    	    vi1.pb(a[n/2 -1]);
    	    while(l<r){
    	        vi1.pb(a[r]);
    	        r--;
    	        vi1.pb(a[l]);
    	        l++;
    	    }
    	    vi1.pop_back();
    	    vi1.pb(a[n/2]);
    /*	    for(auto x:vi1){
    	        cout<<x<<" ";
    	    }
    	    cout<<endl;*/
    	    l=0;;
    	    r=n-1;
    	    vi2.pb(a[1+n/2]);
    	    while(l<r){
    	        vi2.pb(a[l]);
    	        l++;
    	        vi2.pb(a[r]);
    	        r--;
    	    }
    	    vi2.pop_back();
    	    vi2.pb(a[n/2]);
    /*	    for(auto x:vi2){
    	        cout<<x<<" ";
    	    }
    	    cout<<endl;*/
	    }
	    for(i=0;i<n-1;i++){
	        sum+=(abs(vi[i]-vi[i+1]));
	    }
	    for(i=0;i<n-1;i++){
	        sum1+=(abs(vi1[i]-vi1[i+1]));
	    }
	    for(i=0;i<n-1;i++){
	        sum2+=(abs(vi2[i]-vi2[i+1]));
	    }
	    mx=max({sum,sum1,sum2});
	   /* for(auto x:vi){
	        cout<<x<<" ";
	    }
	    cout<<endl;*/
	    cout<<mx<<endl;
	}
	else{
	    vi.pb(a[n/2]);
	    l=0;;
	    r=n-1;
	    while(l<r && (l!= n/2 -1) &&(r!= n/2 -1)){
	        vi.pb(a[r]);
	        r--;
	        vi.pb(a[l]);
	        l++;
	    }
	    vi.pb(a[n/2 -1]);
	    vi1.pb(a[n/2 -1]);
	    l=0;;
	    r=n-1;
	    while(l<r){
	        vi1.pb(a[r]);
	        r--;
	        vi1.pb(a[l]);
	        l++;
	    }
	    vi1.pop_back();
	    for(i=0;i<n-1;i++){
	        sum+=(abs(vi[i]-vi[i+1]));
	    }
	    for(i=0;i<n-1;i++){
	        sum1+=(abs(vi1[i]-vi1[i+1]));
	    }
	    mx=max(sum1,sum);
	    cout<<mx;
	}
}

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

int main(){
	int a, b, juara;
	cin >> a >> b;
	if(a == 1) a = 14;
	if(b == 1) b = 14;
	if(a>b) cout << "Alice" << endl;
	else if(a<b) cout << "Bob" << endl;
	else cout << "Draw" << endl;
	return 0;
}

Measured memory_bytes: 256
s = input()

ans = [0] * len(s)
R_point = []

for i in range(len(s) - 1):
    if s[i] == 'R' and s[i+1] == 'L':
        R_point.append(i)

point = 0
for i in R_point:
    r_count = 0
    l_count = 0
    while point <= i:
        dist = i - point
        if dist % 2 == 0:
            r_count += 1
        else:
            l_count += 1
        point += 1
    while point < len(s) and s[point] == 'L':
        dist = point - i
        if dist % 2 == 0:
            r_count += 1
        else:
            l_count += 1
        point += 1
    ans[i] = r_count
    ans[i+1] = l_count

print(*ans)



Measured memory_bytes: 50108
n = int(input())
cnt = 0
def sympy(num):
  l = []
  for i in range(1, num+1):
    for j in range(1, num+1):
      if (i % 2 != 0) and (i*j == num):
        l.append(i)
  return l
for i in range(1, n+1):
  l = sympy(i)
  if (i % 2 != 0) and (len(l) == 8):
    cnt += 1
print(cnt)

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

int main(){
  int n, ans=0;
  string s;
  cin >> n >> s;
  rep(i, n-2){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
	int a, b, c, d;
	while(~scanf("%1d%1d%1d%1d", &a, &b, &c, &d))
	{
		if(a + b + c + d == 7)
			{printf("%d+%d+%d+%d=7\n", a, b, c, d);break;}
		if(a + b + c - d == 7)
			{printf("%d+%d+%d-%d=7\n", a, b, c, d);break;}
		if(a + b - c + d == 7)
			{printf("%d+%d-%d+%d=7\n", a, b, c, d);break;}
		if(a - b + c + d == 7)
			{printf("%d-%d+%d+%d=7\n", a, b, c, d);break;}
		if(a + b - c - d == 7)
			{printf("%d+%d-%d-%d=7\n", a, b, c, d);break;}
		if(a - b - c + d == 7)
			{printf("%d-%d-%d+%d=7\n", a, b, c, d);break;}
		if(a - b + c - d == 7)
			{printf("%d-%d+%d-%d=7\n", a, b, c, d);break;}
		if(a - b - c - d == 7)
			{printf("%d-%d-%d-%d=7\n", a, b, c, d);break;}
	    
	}
}



Measured memory_bytes: 128
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)


//// B
int main(){
    int n, d; cin >> n >> d;
    int w = d*2+1;
    int ans = (n+w-1)/w;
    cout << ans;
}

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

int main() {
  long long n;

  cin >> n;

  long long flag= 0;

  vector<long long> p(n);
  vector<long long> p_min(n);


  rep(i,n){
    cin >> p.at(i);
  }

  long long ans = p.at(0);

  rep(i,n){
    p_min.at(i) = min(p.at(i),ans);
    ans = p_min.at(i);
  }

  rep(i,n){
    if(p_min.at(i) == p.at(i))
    flag++;
  }
  
  cout << flag;


}

Measured memory_bytes: 6312
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int gcd(int a,int b) { return b ? gcd(b,a%b) : a;}
int lcm(int a,int b) { return a/gcd(a,b)*b;}
void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}
void putb(unsigned int v) {putchar('0'), putchar('b'), printb(v), putchar('\n');}
#define ALL(W) (W).begin(),(W).end()

signed main(){
  int N,M;
  cin >> N >> M;
  int t=1;
  rep(i,M) t*=2;
  cout << (1900*M+100*(N-M))*t << endl;
  return 0;
}


Measured memory_bytes: 256
// Vicfred
// https://atcoder.jp/contests/abc153/tasks/abc153_b
// greedy
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;

void main() {
    int n, h;
    readf("%s %s", &h, &n);
    readln;

    int[] a = readln.split.map!(to!int).array;

    int power = sum(a);

    if(power >= h)
        "Yes".writeln;
    else
        "No".writeln;

}



Measured memory_bytes: 3992
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int INF=1e18;
const int MOD=1e9+7;
const int MAX=2e5+1;

signed main(){
    int N;cin>>N;
    int C[N];
    vector<int> Cp[MAX];
  	REP(i,MAX)Cp[i].clear();
    REP(i,N){
        cin>>C[i];
        Cp[C[i]].pb(i);
    }
    int dp[N+1];
  	REPS(i,N)dp[i]=0;
    dp[0]=1;
    REPS(i,N){
        dp[i]+=dp[i-1];
        int c=C[i-1];
        int itr=lower_bound(all(Cp[c]),i-1)-Cp[c].begin();
        if(itr>0){
            int d=Cp[c][itr-1];
            if(i-d>2)dp[i]+=dp[d+1];
        }
        dp[i]%=MOD;
    }
    cout<<dp[N]<<endl;
}


Measured memory_bytes: 14336
# ABC149C
import math
def is_prime(N):
    if N == 1:
        return False
    for k in range(2, int(math.sqrt(N)) + 1):
        if N % k == 0:
            return False
    return True

X = int(input())

# for文じゃなくてwhileを使う方が良い
"""
for i in range(X, 2 * 10 ** 7):
    if is_prime(i):
        print(i)
        exit()
"""

while 1:
    if is_prime(X):
        print(X)
        exit()
    X += 1    

Measured memory_bytes: 3064
#include <stdio.h>

int max(int a,int b){
	if(a>b) return a;
	else return b;
}

int main(void) {
	int N; scanf("%d",&N);
	int a[N+1]; for(int i=1;i<=N;i++) scanf("%d",&a[i]);
	int m[N+1]; for(int i=0;i<=N;i++) m[i] = 0;
	
	for(int i=1;i<=N;i++) m[i] = max(a[i],m[i-1]);
	
	int count = 0;
	
	for(int i=1;i<=N;i++) if(m[i]>=a[i]+2) count++;
	
	if(count>0) printf("No\n");
	else printf("Yes\n");
	
	return 0;
}

Measured memory_bytes: 896
#include<stdio.h>
#include<string.h>
#define N 100000

typedef struct{
  int time;
  char name[10];
}data;

int head,tail,x;
void enqueue(data);
data dequeue(void);
int mix(int,int);
data Q[N];

main(){
  int i,j,c=0,e;
  data b;

  scanf("%d%d",&x,&e);
  for(i=1;i<=x;i++){
    scanf("%s%d",Q[i].name,&Q[i].time);
  }

  head = 1;
  tail = x+1;
  while(head != tail){
    b = dequeue();
    j = mix(e,b.time);
    b.time -= j;
    c += j;
    if(b.time > 0){
      enqueue(b);
    }
    else printf("%s %d\n",b.name,c);
  }
  return 0;
}


void enqueue(data a){
  Q[tail] = a;
  tail = (tail + 1)%N;
}

data dequeue(){
  data d;
  d = Q[head];
  head = (head + 1)%N;
  return d;
}

int mix(int x,int y){
  return x < y ? x:y;
}

Measured memory_bytes: 2160
// Ho-kago Tea Time

#include <bits/stdc++.h>

using namespace std;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getchar());
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

typedef long long LL;
typedef pair<int, int> pii;

const int MAXN = (int) 1e5;

int n;

vector<int> adj[MAXN + 5];

inline void input()
{
	n = read<int>();
	for(int i = 1; i < n; ++i)
	{
		int u = read<int>(), v = read<int>();
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
}

int SG[MAXN + 5];

inline void dfs(int u, int fa)
{
	SG[u] = 0;
	for(auto v : adj[u]) if(v != fa)
	{
		dfs(v, u);
		SG[u] ^= SG[v] + 1;
	}
}

inline void solve()
{
	dfs(1, 0);
	puts(SG[1] ? "Alice" : "Bob");
}

int main()
{
#ifdef K_ON // K-ON!
	freopen("D.in", "r", stdin);
	freopen("D.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}



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

typedef long long ll;

int main () {

    int H,W;
    cin >> H >> W;

    for (int i=0; i<H; ++i) {
	for (int j=0; j<W; ++j) {
	    string s;
	    cin >> s;
	    if( s == "snuke")
		printf("%c%d\n",'A'+j,i+1);
	}
    }
    
    return 0;
}


Measured memory_bytes: 256