akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int main()
{
	int H, W;
	in >> H >> W;
	std::vector<std::string>a(H);
	rep(i, H) in >> a[i];

	rep(j, W + 2) out << "#";
	out << std::endl;
	rep(i, H) out << "#" << a[i] << "#" << std::endl;
	rep(j, W + 2) out << "#";
	out << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}

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



Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from itertools import product

MOD = 1000000007  # type: int

def solve(N: int, K: int):
    if K % 2 == 1:
        print(0)
        return
    dp = [[[0 for k in range(K+1)]
            for j in range(N+2)]
            for i in range(N+1)]
    dp[0][0][0] = 1
    for i, j, k in product(range(1, N+1), range(N+1), range(K+1)):
        prev_k = k - 2 * j
        if prev_k < 0:
            continue
        dp[i][j][k] += dp[i-1][j][prev_k]
        dp[i][j][k] += 2 * j * dp[i-1][j][prev_k]
        dp[i][j][k] += (j+1) * (j+1) * dp[i-1][j+1][prev_k]
        if j > 0: dp[i][j][k] += dp[i-1][j-1][prev_k]
        dp[i][j][k] %= MOD
    print(dp[N][0][K])

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    solve(n, k)

if __name__ == '__main__':
    main()


Measured memory_bytes: 96732
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000000

template <typename T,typename F>
struct SWAG{
	F func;
	T init_value;
	vector<pair<T,T>> X,Y;
	SWAG(F f,T iv):func(f){
		init_value = iv;
	}
	
	void push_front(T x){
		if(X.empty())X.push_back({x,x});
		else X.push_back({x,func(x,X.back().second)});
	}
	
	void push_back(T x){
		if(Y.empty())Y.push_back({x,x});
		else Y.push_back({x,func(Y.back().second,x)});
	}
	
	void pop_front(){
		if(X.empty()){
			int n = Y.size();
			vector<T> t;
			for(int i=0;i<n/2;i++){
				t.push_back(Y.back().first);
				Y.pop_back();
			}
			while(!Y.empty()){
				push_front(Y.back().first);
				Y.pop_back();
			}
			while(!t.empty()){
				push_back(t.back());
				t.pop_back();
			}
			if(!X.empty())X.pop_back();
		}
		else{
			X.pop_back();
		}
	}
	
	void pop_back(){
		if(Y.empty()){
			int n = X.size();
			stack<T> t;
			for(int i=0;i<n/2;i++){
				t.push_back(X.back().first);
				X.pop_back();
			}
			while(!X.empty()){
				push_back(X.back().first);
				X.pop_back();
			}
			while(!t.empty()){
				push_front(t.back());
				t.pop_back();
			}
			if(!Y.empty())Y.pop_back();
		}
		else{
			Y.pop_back();
		}
	}
	
	T get(){
		T ret = init_value;
		if(!X.empty())ret = func(ret,X.back().second);
		if(!Y.empty())ret = func(ret,Y.back().second);
		return ret;
	}
	
	T front(){
		if(!X.empty())return X.back().first;
		if(!Y.empty())return Y[0].first;
		return init_value;
	}
	
	T back(){
		if(!Y.empty())return Y.back().first;
		if(!X.empty())return X[0].first;
		return init_value;
	}
	
};

int main(){
	
	int N;
	cin>>N;
	
	long long E,T;
	cin>>E>>T;
	
	vector<long long> x(N);
	for(int i=0;i<N;i++)cin>>x[i];
	x.push_back(E);
	
	vector<long long> dp(x.size(),Inf);
	dp[0] = x[0];
	
	auto f = [](long long a,long long b){
		return min(a,b);
	};
		
	SWAG<long long,decltype(f)> minT(f,Inf),minX(f,Inf);
	minT.push_back(dp[0]-x[0]);
	int now = 0;
	
	for(int i=1;i<dp.size();i++){
		while(now!=i&&(x[i-1]-x[now])*2>T){
			minT.pop_front();
			minX.push_back(dp[now]-3*x[now]);
			now++;
		}
		dp[i] = min(minT.get()+T+x[i],minX.get()+x[i]+x[i-1]*2);
		minT.push_back(dp[i]-x[i]);
	}
	
	cout<<dp.back()<<endl;
	
	return 0;
}


Measured memory_bytes: 8736
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

int dy[] = {0,1,0,-1};
int dx[] = {1,0,-1,0};
int dy8[] = {0,1,1,1,0,-1,-1,-1};
int dx8[] = {1,1,0,-1,-1,-1,0,1};

/*==================================================*/
/*variable*/
string s;
int x, y;

vector<int> vx;
vector<int> vy;

bool dpx[4010][32010];  //iブロック目のx方向への移動で座標jに到達かのうか?
bool dpy[4010][32010];

/*==================================================*/
/*function*/

/*==================================================*/

int main() {
    cin>>s>>x>>y;
    int dir = 1;    //x方向
//    int ind = 0;
//    while(ind < s.size()){
//        if(s[ind] == 'T') dir *= (-1), ind++;
//        else{
//            int cnt = 0;
//            while(s[ind] == 'F'){
//                cnt++;
//                ind++;
//                if(ind == s.size()) break;
//            }
//            if(dir == 1) vx.push_back(cnt);
//            else vy.push_back(cnt);
//        }
//    }
    int cnt = 0;
    REP(i,0,s.size()){
        if(s[i] == 'T'){
            if(dir == 1) vx.push_back(cnt);
            else vy.push_back(cnt);
            dir *= (-1);
            cnt = 0;
        }else{
            cnt++;
        }
    }
    if(cnt != 0){
        if(dir == 1) vx.push_back(cnt);
        else vy.push_back(cnt);
    }

    dpx[0][8000] = true;
    REP(i,0,vx.size()){
        REP(posx, -8000, 8001){
            if(dpx[i][(posx+8000)]){
                if(i != 0) dpx[i+1][(posx+8000)-vx[i]] = true;
                dpx[i+1][(posx+8000)+vx[i]] = true;
            }
        }
    }

    dpy[0][8000] = true;
    REP(i,0,vy.size()){
        REP(posy, -8000, 8001){
            if(dpy[i][(posy+8000)]){
                dpy[i+1][(posy+8000)-vy[i]] = true;
                dpy[i+1][(posy+8000)+vy[i]] = true;
            }
        }
    }


    if(dpx[(int)vx.size()][x+8000] && dpy[(int)vy.size()][y+8000]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 248320
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin>>N;
    vector<int> a(N,0);
    rep(i,0,N) cin>>a[i];
    sor(a);
    if(N==2){
        if(a[0]==1&&a[1]==1) cout <<"Possible"<<"\n";
        else cout <<"Impossible"<<"\n";
    }
    else if(a[N-1]%2){
        if(!(a[0]==(a[N-1]+1)/2&&a[1]==a[0]&&a[2]!=a[1])) cout <<"Impossible"<<"\n";
        else{
            rep(i,(a[N-1]+1)/2, a[N-1]+1){
                if(ub(a,i)-lb(a,i)<2){
                    cout <<"Impossible"<<"\n";
                    return 0;
                }
            }
            cout <<"Possible"<<"\n";
        }
    }
    else{
        if(!(a[0]==a[N-1]/2&&a[1]!=a[0])) cout <<"Impossible"<<"\n";
        else{
            rep(i,a[N-1]/2+1, a[N-1]+1){
                if(ub(a,i)-lb(a,i)<2){
                    cout <<"Impossible"<<"\n";
                    return 0;
                }
            }
            cout <<"Possible"<<"\n";
        }
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;

using namespace std;


void solve()
{
    int a;
    scanf("%d", &a);
    int tmp0=a / 500;
    a = a % 500;
    int tmp1 = a / 5;
    printf("%lld", (ll)tmp0 * 1000 + (ll)tmp1 * 5);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.util.Scanner;

public class Main{

     public static void main(String[] args){
        
        try{
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        String[] inputs = str.split(" ");

            //格納(N A B)
            int n = Integer.parseInt(inputs[0]);
            int a = Integer.parseInt(inputs[1]);
            int b = Integer.parseInt(inputs[2]);
            
            int max = 0;
            int min = 0;
            
            //max算出
            if(a <= b){
                max = a;
            }else{
                max = b;
            }
            
            //min算出
            int tmp = a + b - n;
            
            if(tmp >= 0){
                min = tmp;
            }else{
                min = 0;
            }
            
            System.out.println( max + " " + min );
            
        
         }catch(Exception e){
        
           System.out.println(e); 
           
         }
     }
}

Measured memory_bytes: 23252
#include <iostream>

using namespace std;
long long dp[110][100010] = {},a[110],b[110],ans;
int main(){
	int i,j,n,w;
	cin >> n >> w;
	for(i=1;i<=n;i++){
		cin >> a[i] >> b[i];
	}
	for(i=0;i<=n;i++){
		for(j=0;j<=100000;j++){
			dp[i][j] = 1000000000000000;
		}
	}
	dp[0][0] = 0;
	for(i=1;i<=n;i++){
		for(j=0;j<=100000;j++){
			dp[i][j] = min(dp[i][j],dp[i-1][j]);
			dp[i][b[i] + j] = min(dp[i][b[i] + j],dp[i-1][j] + a[i]);
		}
	}
	for(i=100000;i>=0;i--){
		if(dp[n][i]<=w){
			cout << i << endl;
			return 0;
		}
	}
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())
#define all(a) (a).begin(), (a).end()

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//print
#define pv(val) cerr << #val << '=' << (val) << endl

const int INF = 1e9;

int main(void){

	ll N; cin >> N;

	ll sum = 0;
	int idx = 1;
	while(sum <= N){
		sum += idx++;
	}
	int ng = sum - N;
	
	FOR(i,1,idx){
		if(ng == i) continue;
		cout << i << endl;

	}

	return 0;

}


Measured memory_bytes: 3604
#
# abc048 b
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4 8 2"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """0 5 1"""
        output = """6"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """9 9 2"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """1 1000000000000000000 3"""
        output = """333333333333333333"""
        self.assertIO(input, output)


def resolve():
    a, b, x = map(int, input().split())

    print(b//x - (a-1)//x)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16352
using namespace std;
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 1000010
int n,m,k;
char str[N];
int s[N],t[N];
struct Node{
	Node *pre,*suc;
	int s,n;
} *fir,*lst;
Node *ins(Node *p,int s,int n=1){
	Node *nw=new Node;
	*nw={p,p->suc,s,n};
	if (p->suc)
		p->suc->pre=nw;
	else
		lst=nw;
	p->suc=nw;
	return nw;
}
Node *check(Node *p){
	if (p->n==0 || p->pre && p->s==p->pre->s){
		p->pre->n+=p->n;
		p->pre->suc=p->suc;
		if (p->suc)
			p->suc->pre=p->pre;
		else
			lst=p->pre;
		return p->pre;
	}
	return p;
}
int ans[N*2],cnt;
int main(){
	scanf("%d%d%d",&n,&m,&k);
	scanf("%s",str);
	for (int i=0;i<n;++i)
		s[i]=str[n-1-i]-'0';
	scanf("%s",str);
	for (int i=0;i<m;++i)
		t[i]=str[m-1-i]-'0';
	n=max(n,m);	
	fir=lst=new Node;
	*lst=(Node){NULL,NULL,0,1000000000};
	for (int i=n-1;i>=0;--i)
		if (s[i]==1 && t[i]==1){
			int z=k;
			Node *p=lst;
			while (z){
				while (1){
					Node *q=check(p);
					if (q==p) break;
					p=q;
				}
				if (p->s==0){
					if (p->n<=z){
						z-=p->n;
						p=p->pre;
						if (z==0)
							ins(p,3,1);
					}
					else{
						p->n-=z;
						Node *q=ins(p,0,z);
						ins(p,3,1);
						break;
					}
				}
				else{
					while (1){
						Node *q=check(p->pre);
						if (q==p->pre) break;
						p->pre=q;
					}
					int m=p->s;
					if (p->pre->s==0){
						p->s=0,p->n--;
						Node *q=ins(p,m^3,1),*r=ins(q,0,1);
						p->pre->n--;
						check(p->pre);
						ins(p->pre,m,1);
						check(p);
						break;
					}
					else{
						p->s=0,p->n--;
						Node *q=ins(p,m^3,1),*r=ins(q,0,1);
						p->pre->n--;
						p=p->pre;
						z--;
						check(p->suc);
						if (z==0)
							ins(p,3,1);
						p=check(p);
					}
				}
			}
		}
		else{
			int f=s[i]|t[i]<<1;
			if (f==lst->s)
				lst->n++;
			else
				lst=ins(lst,f,1);
		}
	for (Node *p=lst;p!=fir;p=p->pre)
		for (int i=0;i<p->n;++i)
			ans[cnt++]=p->s;
	bool bz=0;
	for (int i=cnt-1;i>=0;--i){
		bz|=ans[i]&1;
		if (bz)
			putchar('0'+(ans[i]&1));
	}
	if (bz==0)
		putchar('0');
	putchar('\n');
	bz=0;
	for (int i=cnt-1;i>=0;--i){
		bz|=ans[i]>>1;
		if (bz)
			putchar('0'+(ans[i]>>1));
	}
	if (bz==0)
		putchar('0');
	return 0;
}





















Measured memory_bytes: 145260
#include<stdio.h>
int main(){
  int i,s,sum,x,y;
  bool flag=false;
  //入力
  scanf("%d %d",&x,&y);
  
  for(i=x;0<=i;i--){
    for(s=0;s<=x;s++){
      sum=2*i+4*s;
      if(sum==y && (i+s)==x){
        flag=true;
        break;
      }
      if(flag){
        break;
      }
    }
  }
  if(flag){
     printf("Yes");
  }
  else{
    printf("No");
  }
}

Measured memory_bytes: 1732
#include<stdio.h>
int main()
{
	int a, b, c, i;
	int count;
	count = 0;
		scanf("%d %d %d", &a, &b, &c);
		for (i = a; i <= b; i++)
		{
			if (c%i == 0) count++;
		}
		printf("%d\n", count);

		return 0;
}


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

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

  int start = 0;
  while (start < s.size()) {
    if (s.at(start) == 'A' ||
	s.at(start) == 'C' ||
	s.at(start) == 'G' ||
	s.at(start) == 'T') break;
    start++;
  }

  int max = 0;
  for (int i = start; i < s.size(); i++) {
    int length = 0;
    for (int j = i; j < s.size(); j++) {
      if (s.at(j) == 'A' ||
	  s.at(j) == 'C' ||
	  s.at(j) == 'G' ||
	  s.at(j) == 'T') length++;
      else break;
    }
    if (length > max) max = length;
  }

  cout << max << endl;
}


Measured memory_bytes: 256
k,n = map(int,input().split())
alist = list(map(int,input().split()))
sa = 0
for i in range(n-1):
  if alist[i+1] - alist[i] > sa:
    sa = alist[i+1] - alist[i]
if k - alist[n-1] + alist[0] > sa:
  sa = k - alist[n-1] + alist[0]
print(k-sa)

Measured memory_bytes: 77516
/**
* Problem Link: 
*/              
#include <bits/stdc++.h>

using namespace std;

void test_case(int case_no) {
    long long n;
    int m;
    cin >> n >> m;
    vector<long long> arr(m);
    long long sum = 0;
    for(int i = 0; i < m; ++i) {
        cin >> arr[i];
        sum += 1LL * arr[i];
    }
    if(n - sum < 0) {
        cout << "-1\n";
    } else {
        cout << n - sum << "\n";
    }
}

int main() {
    // freopen("in", "r", stdin), freopen("out", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t = 1;
    for(int i = 1; i <= t; ++i) {
        test_case(i);
    }
    return 0;
}

Measured memory_bytes: 3720
n = int(input())
a = input()
b = input()
c = input()
ans = 0
for i in range(n):
  if a[i] == b[i] or b[i] == c[i] or c[i] ==a[i]:
    if a[i] == b[i] == c[i]:
      continue
    else:
      ans += 1
  else:
    ans+= 2
print(ans)

Measured memory_bytes: 3064
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <complex>
#include <iomanip>
#include <queue>
//定数
#define MOD 1000000007
//マクロ
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

#define vsort(v) sort((v).begin(), (v).end());

typedef unsigned long long int ull;
typedef long long lint;

using namespace std;




int main(){
    int X, X0, calc;

    //入力
    cin >> X; X0=X;
    calc = X/100;
    
    if(X%100 <= calc*5) cout << "1" << endl;
    else                cout << "0" << endl;
    
    

    return 0;
}

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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

const i64 MAXN = 300005;

i64 h, w, n;
i64 a[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >>  h >> w >> n;

    i64 R = 0;
    R = n / max(h, w) + (n % max(h, w) ? 1 : 0);
    cout << R << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
abc = []
for i in range(N):
    abc.append(list(map(int,input().split())))
dp = [[0,0,0] for _ in range(N)]
dp[0] = abc[0][:]
for i in range(1,N):
    dp[i][0] = abc[i][0] + max(dp[i-1][1],dp[i-1][2])
    dp[i][1] = abc[i][1] + max(dp[i-1][0],dp[i-1][2])
    dp[i][2] = abc[i][2] + max(dp[i-1][1],dp[i-1][0])
print(max(dp[-1]))

Measured memory_bytes: 104660
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <vector>

using namespace std;

int main()
{
    int h, w, bor[510][510], cnt=0, v[260000][4];
    cin>>h>>w;
    for (int i=1; i<=h; i++)
    {
        for (int j=1; j<=w; j++) cin>>bor[i][j];
    }
    for (int i=1; i<=h; i++)
    {
        for (int j=1; j<=w; j++)
        {
            if (bor[i][j]%2==1)
            {
                if (j!=w)
                {
                    cnt++;
                    v[cnt][0]=i;
                    v[cnt][1]=j;
                    v[cnt][2]=i;
                    v[cnt][3]=j+1;
                    //cout<<i<<' '<<j<<' '<<i<<' '<<j+1<<'\n';
                    bor[i][j]--;
                    bor[i][j+1]++;
                }
                else if (i!=h)
                {
                    cnt++;
                    v[cnt][0]=i;
                    v[cnt][1]=j;
                    v[cnt][2]=i+1;
                    v[cnt][3]=j;
                    //cout<<i<<' '<<j<<' '<<i+1<<' '<<j<<'\n';
                    bor[i][j]--;
                    bor[i+1][j]++;
                }
            }
        }
    }
    cout<<cnt<<'\n';
    for (int i=1; i<=cnt; i++)
    {
        cout<<v[i][0]<<' '<<v[i][1]<<' '<<v[i][2]<<' '<<v[i][3]<<'\n';
    }
    return 0;
}


Measured memory_bytes: 7040
n=int(input())
a=[int(input())for _ in[0]*n]
for i in range(4):
 for j in range(n-1,i,-1):
  if a[i]>a[j]:a[i],a[j]=a[j],a[i]
p=[]
for i in range(3):
 for d in a[i+1:4]:
  c=a[i]
  p+=[int(f'{c}{d}'),int(f'{d}{c}')]
for i in range(3):
 for j in range(11,i,-1):
  if p[i]>p[j]:p[i],p[j]=p[j],p[i]
print(sorted(p)[2])


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

int main() {
  long n,ans=0;
  cin >> n;
  vector<long> a(n);
  vector<long> b(n+1);
  b.at(0)=0;
  for(int i=0;i<n;i++) {
    cin >> a.at(i);
    b.at(i+1)=b.at(i)+a.at(i);
  };
  sort(b.begin(),b.end());
  long j=0;
  for(int i=0;i<n;i++) {
    if(b.at(i)==b.at(i+1)) {
      j++;
      ans+=j;
    } else {
      j=0;
    };
  };
  cout << ans << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int min_3(int x,int y,int z){
  int min=x;
  if (x > y){
    min = y;
  }
  if (min > z){
    min = z;
  }
  return min;
}

int gcd(int x,int y,int z){
  int gcd = 1;
  int min_xyz = min_3(x,y,z);
  for (int i=1; i <= min_xyz ; i++){
    if (x % i == 0 && y % i == 0 && z % i == 0){
      gcd = i;
    }
  }
  return gcd;
}

int main(){
  int K;
  cin >> K;
  int ans=0;
  for (int i=1; i<=K; i++){
    for(int j=1; j<=K; j++){
      for(int k=1; k<=K; k++){
        ans += gcd(i,j,k);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3604
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
from fractions  import gcd
#input=sys.stdin.readline
import bisect
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=[0]*(n+1)
s[0]=0
for i in range(1,n+1):
    s[i]=s[i-1]+a[i-1]
    s[i]%=m
c=Counter(s)
ans=0
for i in c:
    ans+=(c[i]*(c[i]-1))//2
print(ans)

Measured memory_bytes: 97732
import java.util.Arrays;
import java.util.stream.IntStream;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt(), w = scanner.nextInt();
        int[] wa = new int[n], va = new int[n];
        for (int i = 0; i < n; i++) {
            wa[i] = scanner.nextInt();
            va[i] = scanner.nextInt();
        }
        int sum = Arrays.stream(va).sum();
        long[] dp = new long[sum + 1];
        Arrays.fill(dp, 1, sum + 1, Long.MAX_VALUE);
        for (int i = 0; i < n; i++)
            for (int j = sum; j >= va[i]; j--)
                if (dp[j - va[i]] != Long.MAX_VALUE)
                    dp[j] = Math.min(dp[j], dp[j - va[i]] + wa[i]);
        IntStream.rangeClosed(0, sum)
                .filter(j -> dp[sum - j] <= w)
                .findFirst()
                .ifPresent(j -> System.out.println(sum - j));
    }
}

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

using namespace std;
using ll = long long;

int main() {
	int N, M, C;
	cin >> N >> M >> C;
	vector<int> B(M);
	for (int i = 0; i < M; ++i) { cin >> B[i]; }
	vector<vector<int>> A(N, vector<int>(M));
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < M; ++j) { cin >> A[i][j]; }
	}

	int res = 0;
	for (int i = 0; i < N; ++i) {
		int sc = 0;
		for (int j = 0; j < M; ++j) {
			sc += (A[i][j] * B[j]);
		}
		if (sc + C > 0) { ++res; }
	}

	cout << res << endl;

	return 0;
}


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

int main() {
	char * s = new char[1000010];
	scanf("%s", s);
	char * s_compr = new char[1000010];
	int N = 0, N_compr = 0;
	while(s[N]) {
		if(N == 0 || s_compr[N_compr-1] != s[N]) s_compr[N_compr++] = s[N];
		N++;
	}
	delete[] s;
	int cnt[3] = {};
	for(int i = 0; i < N_compr; i++) cnt[s_compr[i]-'A']++;
	int c_max = (cnt[1] > cnt[0]) ? 1 : 0;
	if(cnt[2] >= cnt[c_max]) c_max = 2;
	int c_min = (cnt[1] > cnt[0]) ? 0 : 1;
	if(cnt[2] <= cnt[c_min]) c_min = 2;
	if(cnt[0] > cnt[1]) {cnt[0] ^= cnt[1]; cnt[1] ^= cnt[0]; cnt[0] ^= cnt[1];}
	if(cnt[0] > cnt[2]) {cnt[0] ^= cnt[2]; cnt[2] ^= cnt[0]; cnt[0] ^= cnt[2];}
	if(cnt[1] > cnt[2]) {cnt[1] ^= cnt[2]; cnt[2] ^= cnt[1]; cnt[1] ^= cnt[2];}
	if(cnt[0] == cnt[2]) {
		printf("%s\n", s_compr);
		delete[] s_compr;
		return 0;
	}
	int d = cnt[2]-cnt[1];
	for(int i = 0; i < N_compr; i++) if(s_compr[i]-'A' == c_max && d > 0)
		if(i == 0 || i == N_compr-1 || s_compr[i-1] != s_compr[i+1]) d--, cnt[2]--, s_compr[i] = 'Z';
	for(int i = 1; i < N_compr-1; i++) if(s_compr[i]-'A' == c_max && d > 0)
		if(s_compr[i-1]-'A' == c_min) d--, cnt[0]--, cnt[2]--, s_compr[i] = s_compr[i-1] = 'Z';
	if(d) return 1;
	N = N_compr = 0;
	while(s_compr[N]) {
		if(s_compr[N] <= 'C') s_compr[N_compr++] = s_compr[N];
		N++;
	}
	s_compr[N_compr] = 0;
	d = cnt[1]-cnt[0];
	int last = -1;
	for(int i = 0; i < N_compr-1; i++) {
		if(d == 0) break;
		if(s_compr[i]-'A' == c_max || s_compr[i+1]-'A' == c_max)
			if(s_compr[i]-'A' != c_min && s_compr[i+1]-'A' != c_min)
				if(last == -1 || i == N_compr-2 || s_compr[last] != s_compr[i+2])
					s_compr[i] += 4, s_compr[i+1] += 4, d--;
		if(s_compr[i] <= 'C') last = i;
		else i++;
	}
	N = N_compr = 0;
	while(s_compr[N]) {
		if(s_compr[N] <= 'C') s_compr[N_compr++] = s_compr[N];
		N++;
	}
	s_compr[N_compr] = 0;
	printf("%s\n", s_compr);
	delete[] s_compr;
}


Measured memory_bytes: 2220
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
#define ll long long
using namespace std;
int maxn;
int D[1000010],A[200010],app[1000010];

void makeD(int x)
{
    for(int sum=2*x;sum<=maxn;sum+=x)
        D[sum]=1;
    return ;
}

int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",A+i);
        app[A[i]]++;
        maxn=max(A[i],maxn);
    }
    for(int i=1;i<=n;i++)
        makeD(A[i]);
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        if(app[A[i]]>1)
            continue;
        if(!D[A[i]])
            ans++;
    }
    printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 12352
// AOJ 1626: Skyscraper MinatoHarukas
// 2019.2.23 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
	int b, p, q;

	while (scanf("%d", &b) && b > 0) {
		b <<= 1;
		for (p = (int)sqrt(b); ; p--) {
			if (b % p == 0) {
				q = b / p;
				if ((p + q) & 1) break;
			}
		}
		printf("%d %d\n", q-(p+q-1)/2, p);
	}
	return 0;
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // long longの1次元の型に vll という別名をつける
using vvll = vector<vll>; // long longの2次元の型に vvll という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pll という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------



int main() {
   ll a,b,c,d;
   cin>>a>>b>>c>>d;
   vll ans(4);
   
   ans.at(0)=a*c;
   ans.at(1)=b*d;
   ans.at(2)=b*c;
   ans.at(3)=a*d;
   
   sort(ALL(ans));
   cout<<ans.at(3)<<endl;
   
   
}



Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int K = scanner.nextInt();
    int[] p = new int[N];
    for (int i = 0; i < N; i++) p[i] = scanner.nextInt() + 1;
    int sum = 0;
    for (int i = 0; i < K; i++) sum += p[i];
    int max = sum;
    for (int i = K; i < N; i++) {
      sum += p[i];
      sum -= p[i - K];
      max = Math.max(max, sum);
    }
    System.out.printf("%f\n", max * 0.5d);
  }
}


Measured memory_bytes: 80720
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Long> lucas = new ArrayList<>();
        lucas.add(2L);
        lucas.add(1L);
        for (int i = 2; i <= n; i++) {
            lucas.add(lucas.get(i - 1) + lucas.get(i - 2));
        }
        System.out.println(lucas.get(n));
    }

}


Measured memory_bytes: 23764
#include <stdio.h>

int main(void){
    int a,b,k;
    scanf("%d %d %d",&a,&b,&k);
    if(b-a+1 > 2*k){
        for(int i=a;i<a+k;i++){
            printf("%d\n",i);
        }
        for(int j=b-k+1;j<=b;j++){
            printf("%d\n",j);
        }
    }else{
        for(int l=a;l<=b;l++){
            printf("%d\n",l);
        }
    }
    return 0;
}

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

using namespace std;

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

const int maxn=1e6+5;

const ll mod=1e9+7;

char s[maxn];

ll num[maxn];

int main(){
	int n,p;
	scanf("%d%d",&n,&p);
	scanf("%s",s+1);
	ll ans=0;
	if(p==2||p==5){
		for(int i=1;i<=n;i++){
			if((s[i]-'0')%p==0){
				ans+=i;
			}
		}
	}
	else{
		ll tmp=1;ll res=0;
		for(int i=n;i>=1;i--){
			res=(res+(s[i]-'0')*tmp)%p;
			tmp=(tmp*10)%p;
			num[res]++;
		}
		ans=num[0]+num[0]*(num[0]-1)/2;
		for(int i=1;i<p;i++){
			ans+=num[i]*(num[i]-1)/2;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(int i = (int)k; i < (int)n; i++)
#define rrep(i, n) RREP(i, 0, n)
#define RREP(i, k, n) for(int i = (int)n-1; i > (int)k-1; i--)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;

int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int dx8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

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

    int N;
    cin >> N;
    int a[101];
    rep(i,N) cin >> a[i];
    sort(a,a+N);

    int ans = INT_MAX;
    REP(i,a[0],a[N-1]+1) {
        int cans = 0;
        rep(j,N) {
            cans += pow(a[j]-i,2);
        }
        ans = min(ans, cans);
    }

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


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

int main(){
	ios::sync_with_stdio(false);
	int N; cin>>N;
	vector<string> S;

	rep(i,N){
		string s; cin>>s;
		S.push_back(s);
	}
	sort(S.begin(),S.end());

	int num=0;
	string ms=S[0];
	int x=0;
	for(int i=0; i<N; i++){
		if(S[i]==ms){
			x++;
			num = max(x,num);
		}else{
			ms=S[i];
			x=1;
		}
	}

	cerr << num << endl;
	int ct=0; ms=S[0];
	for(int i=0; i<N; i++){
		if(ms==S[i]){
			ct++;
			if(ct==num){
				cout << S[i] << endl;
			}
		}else{
			ms = S[i];
			ct=1;
			if(num==1) cout << S[i] << endl;
		}
	}
	
}

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

template <uint MD> struct ModInt {
    using M = ModInt;
    uint v;
    ModInt() : v{0} {}
    ModInt(ll _v) { set(_v % MD + MD); }
    M& set(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator - () const { return M(0) - *this; }
    M operator + (const M& r) const { return M().set(v + r.v); }
    M operator - (const M& r) const { return M().set(v + MD - r.v); }
    M operator * (const M& r) const { return M().set(ull(v) * r.v % MD); }
    M operator / (const M& r) const { return *this * r.inv(); }
    M& operator += (const M& r) { return *this = *this + r; }
    M& operator -= (const M& r) { return *this = *this - r; }
    M& operator *= (const M& r) { return *this = *this * r; }
    M& operator /= (const M& r) { return *this = *this / r; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return (*this).pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<924844033>;

const int B = 4010;
int n, k;
Mint fac[B], ifac[B];
Mint dp[B], ndp[B];

void first() {
    fac[0] = 1;
    for (int i = 1; i < B; i++) fac[i] = fac[i - 1] * Mint(i);
    for (int i = 0; i < B; i++) ifac[i] = fac[i].inv();
}

Mint C(int n, int k) {
    if (n < k || k < 0) return 0;
    return fac[n] * ifac[k] * ifac[n - k];
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;

    first();
    cin >> n >> k;

    int sm = 0;
    dp[0] = 1;
    for (int st = 0; st < min(n, 2 * k); st++) {
        int cnt = (n - st - 1) / k + (st >= k);
        fill_n(ndp, sm + cnt + 1, 0);
        for (int i = 0; i <= sm; i++) {
            for (int j = 0; j <= cnt; j++) {
                ndp[i + j] += dp[i] * C(cnt - j + 1, j);
            }
        }
        sm += cnt;
        copy_n(ndp, sm + 1, dp);
    }

    Mint ans = 0;
    for (int i = 0; i <= n; i++) {
        Mint x = dp[i] * fac[n - i];
        if (i % 2 == 0) ans += x;
        else ans -= x;
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 384
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 5+5  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
    
def solve():
  n,k = (int(i) for i in input().split())
  a = sorted(list(int(i) for i in input().split()))
  mod = 10**9+7
  ans = 0
  for i in range(n-k+1):
    ans -= a[i]*cmb(n-i-1,k-1,mod)
  a = a[::-1]
  for i in range(n-k+1):
    ans += a[i]*cmb(n-i-1,k-1,mod)
  ans %= mod
  print(ans)



solve()

Measured memory_bytes: 26688
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
  ll n,p[114514],k;
  cin>>n>>k;
  for(int i=0;i<n;i++)cin>>p[i];
  sort(p,p+n);
  ll ans=1e15;
  for(int i=0;i<n-k+1;i++){
    ans=min(p[i+k-1]-p[i],ans);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define irp(i,s,e) for(int i=(s);i>(e);--i)
string N;
int K;
int dp[100][4][2];// digit DP, [|N|: 0 origin][k:0~3][notLessThen?], init = 0
int lt = 0, eq = 1;//lt: <, eq: =

int solve(){
	int dn = N.size();
	int di = N[0] - '0';
	dp[0][0][lt] = 1;
	dp[0][1][lt] = di>0? di-1:di;
	dp[0][1][eq] = 1;

	rp(i,1,dn){
		di = N[i] - '0';
		int lt0 = 1, ltn = 9;//<ni
		int eq0 = di? 1:0, eqn = max(0, di-1);//=ni

		// lt <
		rp(k,0,4){
			int x = dp[i-1][k][lt] * lt0 + dp[i-1][k][eq] * eq0;
			if(k) x += dp[i-1][k-1][lt] * ltn + dp[i-1][k-1][eq] * eqn;
			dp[i][k][lt] = x;
		}

		// eq =
		irp(k,2,-1){
			if(dp[i-1][k][eq]){
				if(di) dp[i][k+1][eq] = di>0;
				else dp[i][k][eq] = 1;
			}
		}

	}

	return dp[dn-1][K][lt] + dp[dn-1][K][eq];
}

int main(){
	cin>>N>>K;
	cout<< solve() <<endl;

	// cout<<N<<" "<<K<<"\n";;///
	// cout<<"       k0   k1   k2   k3\n";///
	// rp(i,0,N.size()){
	// 	rp(j,0,2){
	// 		printf((j%2? "=n%d:":"<n%d:"),i);
	// 		rp(k,0,4){ printf("%5d",dp[i][k][j]); }
	// 		puts("");
	// 	}
	// }

}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		String okikae = s.replace("ABC" , "0");
		int count = 0;
        for(int i : okikae.toCharArray()) {
			if(i == '0') {
				count++;
			}
		}
		System.out.print(count);
	}
}

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


int main(){
   ll n,m;
   string s;
   cin >> n >> m;
   rep(i,m){
      ll x;
      cin >> x;
      n-=x;
   }
   if (n < 0) cout << -1 << endl;
   else cout << n << endl;

   return 0;
}


Measured memory_bytes: 3632
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 c = sc.nextInt();
			int d = sc.nextInt();
			String result;

			if (Math.abs(a - c) <= d) {
				result = "Yes";
			} else if (Math.abs(a - b) <= d & Math.abs(b -c) <= d) {
				result = "Yes";
			} else {
				result = "No";
			}
			System.out.println(result);
	}
}

Measured memory_bytes: 23380
#include<stdio.h>

main(void)

{


 int a,b,d,r;

 double f;


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


 d=a/b;


 r= a%b;


 f = (double)a/(double)b;


 printf("%d %d %f\n",d,r,f);


 return 0;





}

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

using namespace std;

void fastio() {
	cin.tie(nullptr);
	cin.sync_with_stdio(false);
}

using LL = long long;
using LD = long double;

const LL MOD = 1e9+7;
const LL INF = LLONG_MAX;
const LL N = 1e6+1;

#define F first
#define S second

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

	vector<pair<LL, LL>> vp(n);

	for (auto &e : vp) {
		cin >> e.F >> e.S;
	}
	LL c = 0;
	for (LL i = 0; i < n-2; ++i) {
		if (vp[i].F == vp[i].S && vp[i+1].S == vp[i+1].F && vp[i+2].F == vp[i+2].S) {
			c++;
		}
	}

	if (c) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}

}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
	public static void main(String argv[]) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int R = sc.nextInt();
		int time = 0;
		if(H + R < 0)    time = -1;
		else if(H + R >= 2*R) time =  1;
		else if(H + R == 0)   time = 0;
		else if(H + R >= 1) time = 1;
		System.out.println(time);
	}
}


Measured memory_bytes: 26228
#include <bits/stdc++.h>
using namespace std;
#define INF (1e9)
#define N 100
typedef complex<double> Point;
typedef pair<Point,Point> Vector;
typedef pair<double,int> P;

double dot(Point a,Point b) {
  return real(conj(a)*b);
}

double cross(Point a,Point b) {
  return imag(conj(a)*b);
}

int ccw(Point a,Point b,Point c){
  b-=a;
  c-=a;
  if(cross(b,c)<0)return -1;//counterclockwise
  if(cross(b,c)>0)return 1;//clockwise
  if(dot(b,c)<0)return -2;
  if(norm(b)<norm(c))return 2;
  return 0;
}

bool isIntersect(Vector a,Vector b){
  return (ccw(a.first,a.second,b.first)*ccw(a.first,a.second,b.second)<=0)&&(ccw(b.first,b.second,a.first)*ccw(b.first,b.second,a.second)<=0);  
}

Point crosspoint(Vector l,Vector m){
  double A=cross(l.second-l.first,m.second-m.first);
  double B=cross(l.second-l.first,l.second-m.first);
  if(fabs(A)<0&&fabs(B)<0) return m.first;
  else if(fabs(A)>=0) return m.first+B/A*(m.second-m.first);
}

int main(){
  int d,n,o[N],l[N],ans,cnt;
  Vector b,s[N];
  vector<P> v;
  cin>>d;
  while(d--){
    cin>>b.first.real()>>b.first.imag()>>b.second.real()>>b.second.imag();
    cin>>n;
    for(int i=0;i<n;i++){
      cin>>s[i].first.real()>>s[i].first.imag()>>s[i].second.real()>>s[i].second.imag()>>o[i]>>l[i];
      if(isIntersect(b,s[i])){
	Point x=crosspoint(b,s[i]);
	double A=x.real()-b.first.real(),B=x.imag()-b.first.imag();
	v.push_back(P(A*A+B*B,i));
      }
    }
    sort(v.begin(),v.end());
    ans=INF;
    for(int i=0;i<2;i++){
      int x=i;
      cnt=0;
      for(int j=0;j<v.size();j++){
	int idx=v[j].second;
	if(o[idx]==1){
	  if(x==0&&l[idx]==1) x=1,cnt++;
	  if(x==1&&l[idx]==0) x=0,cnt++;
	}else{
	  if(x==0&&l[idx]==0) x=1,cnt++;
	  if(x==1&&l[idx]==1) x=0,cnt++;
	}
      }
      ans=min(ans,cnt);
    }
    cout<<ans<<endl;
    v.clear();
  }
  return 0;
}

Measured memory_bytes: 1260
n = int(input())
x = ""
a = []
def abc(p):
    if p == 1:
        return "a"
    elif p == 2:
        return "b"
    elif p == 3:
        return "c"
    elif p == 4:
        return "d"
    elif p == 5:
        return "e"
    elif p == 6:
        return "f"
    elif p == 7:
        return "g"
    elif p == 8:
        return "h"
    elif p == 9:
        return "i"
    elif p == 10:
        return "j"
    elif p == 11:
        return "k"
    elif p == 12:
        return "l"
    elif p == 13:
        return "m"
    elif p == 14:
        return "n"
    elif p == 15:
        return "o"
    elif p == 16:
        return "p"
    elif p == 17:
        return "q"
    elif p == 18:
        return "r"
    elif p == 19:
        return "s"
    elif p == 20:
        return "t"
    elif p == 21:
        return "u"
    elif p == 22:
        return "v"
    elif p == 23:
        return "w"
    elif p == 24:
        return "x"
    elif p == 25:
        return "y"
    elif p == 0:
        return "z"
while n > 0:
    a.append(abc(n%26))
    n = (n-1)//26
for i in range(len(a)):
    x += a[-i-1]
print(x)

Measured memory_bytes: 9292
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
const int inf = 1000000000; //10^9
const ll MOD = 1e9 + 7;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで
int main()
{
    string s[60] = {}; //string型のs。要素数60。初期値は空。
    int n; 
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> s[i]; //文字列の入力を文字列Sに代入
    }
    string ans;
    for (char c = 'a'; c <= 'z'; c++) //a~zまでループ
    {
        int small = inf;
        for (int i = 0; i < n; i++) //文字列分ループ
        {
            int cnt = 0;
            for (int j = 0; j < s[i].length(); j++) //各文字列の長さ分ループ
            {
                if (s[i][j] == c) //各文字列の個々の文字とa~zを比較
                    cnt++; //一緒ならカウンタを加算
            }
            small = min(small, cnt); //各アルファベットの出現数の最小値を取得
        }
        for (int i = 0; i < small; i++)
        {
            ans += c; //各アルファベットの最小値の出現数をansに代入。a~zのループだから並び替えは不要。
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
a=list(map(int,input().split()))
a_sum=sum(a)
#print(a_sum)
a.sort(reverse=True)
#print(a)
if a[m-1]/a_sum>=1/(4*m):
            print('Yes')
else:
            print('No')
            


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

int main(){
  string s;
  cin >> s;
  int a_ans = 0, z_ans = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'A'){
      a_ans = i;
      break;
    }
  }
  for(int i = s.size(); i >= 0; i--){
    if(s[i] == 'Z'){
      z_ans = i;
      break;
    }
  }
  cout << z_ans - a_ans + 1 << endl;
  return 0;
}

Measured memory_bytes: 3732
package main

import "fmt"

func main() {
	var o, e string
	fmt.Scan(&o, &e)

	ans := ""
	for i := range e {
		ans += string(o[i])
		ans += string(e[i])
	}
	if len(o) > len(e) {
		ans += string(o[len(o)-1])
	}

	fmt.Println(ans)
}


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

int main() {
  string S;
  cin>>S;
  int N=S.size();
  int Z=0;
  for(int i=0;i<N;i++){
    if(S[i]=='p'){
      Z++;
    }
  }
  cout<<N/2-Z<<endl;
}

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

int main (void)
{
  int a, b, c;
  
  cin >> a >> b >> c;
  
  int sub;
  
  sub = a - b;
  
  if (sub >= c) cout << 0;
  else cout << (c- sub) << endl;

  
 return 0; 
}

Measured memory_bytes: 256
from collections import deque
N,X,Y=map(int,input().split())

count=[0]*N

def bfs(start):
    dist=[-1]*(N+1)#indexと頂点の番号を合わせる
    q=deque()
    q.append([start,0])
    dist[start]=0
    while q:
        j,kyori=q.popleft()

        if j-1>=1:
            if dist[j-1]==-1:
                q.append([j-1,kyori+1])
                dist[j-1]=kyori+1

        if j+1<=N:
            if dist[j+1]==-1:
                q.append([j+1,kyori+1])
                dist[j+1]=kyori+1
        
        if j == X and dist[Y]==-1:
            q.append([Y,kyori+1])
            dist[Y]=kyori+1

        if j == Y and dist[X]==-1:
            q.append([X,kyori+1])
            dist[X]=kyori+1

    return dist[1:]

def main():
    for start in range(1,N+1):
        dist=bfs(start)
        for d in dist:
            count[d]+=1

    for i in count[1:]:
        print(i//2)

main()

Measured memory_bytes: 51292
//////////////////////////// ⛎🎱💲♏☢🤘(NOOB 383)
//////////////////////////// 🇨🇸🇪 48
//////////////////////////// 🇯🇦🇭🇦🇳🇬🇮🇷🇳🇦🇬🇦🇷 🇺🇳🇮🇻🇪🇷🇸🇮🇹🇾((JU))

#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator
#define VL vector<LL>::iterator
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
void Y()
{
    cout<<"Yes"<<endl;
}
void N()
{
    cout<<"No"<<endl;
}
map<LL,LL>v;
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,t,z;
    cin>>n>>m;

    cout<<min((n%m),(m-(n%m)))<<endl;
return 0;
}


Measured memory_bytes: 256