akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const ll MAX_N = 100000;

// vector<int> dp(100000, 1e9);

int main()
{
    ll n, t;
    ll dp[100005];
    int h[100005];
    scanf("%lld", &n);
    // std::vector<int> h;
    // rep(i, n)
    // {
    //     scanf("%lld", &t);
    //     h.push_back(t);
    // }
    for (int i = 1; i <= n; i++)
        cin >> h[i];
    dp[1] = 0;
    rep2(i, 2, n + 1)
    {
            dp[i] = dp[i - 1] + abs(h[i - 1] - h[i]);
        if (i - 2 >= 1){
            dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
        }
    }
    printf("%lld\n", dp[n]);
    // printf("OK");

    return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

long long inf = 1000000007;

double eps = 0.0000000001;

double w, h;
double x, y;
long double ans;
bool flag;

int main(){
  cin >> w >> h >> x >> y;
  ans = (w * h) / 2;
  double tmp1 = w/2; double tmp2 = h/2;
  if(x == tmp1 && y == tmp2){
    flag = 1;
  }else{
    flag = 0;
  }
  //cout << tmp2 << endl;
  cout << ans << " " << flag << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner  yomi = new Scanner(System.in);
        long a = yomi.nextLong();
        long b=100;
        for(int i=1;b<a;i++){
            b+=b/100;
            if (b>=a) System.out.println(i);
        }

    }
}

Measured memory_bytes: 35608
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6,inf=1e9;
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n;cin>>n;

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

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    TA = [[int(x) for x in input().split()] for _ in range(N)]

    now = TA[0]
    for t, a in TA[1:]:
        i = max(now[0] //t , now[1] // a)
        while now[0] > t * i or now[1] > a * i:
            i += 1
        now[0] = t * i
        now[1] = a * i

    print(now[0] + now[1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<string, int> P;


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

    ll mod = 2019;
    int N = s.length();
    map<ll, ll> mp;
    ll now = 0;
    mp[now]++;
    ll digit = 1;
    ll ans = 0;
    for(int i = N - 1; i >= 0; i--) {
        now += digit * (s[i] - '0');
        now %= mod;
        ans += mp[now];
        mp[now]++;
        digit = digit * 10 % mod;
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3760
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int w;
        if(!(cin >> w))
            return 0;

        int tmp = 1;
        bool first = true;
        while(w > 0){
            if(w % 2 == 1){
                if(first)
                    first = false;
                else
                    cout << ' ';
                cout << tmp;
            }
            w /= 2;
            tmp *= 2;
        }
        cout << endl;
    }
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }


signed main()
{
	int a, b;
	cin >> a >> b;
	cout << max(a + b, max(a - b, a * b)) << endl;
}



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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, start_index, num)  (a).begin()+(start_index),(a).begin()+(num)

int main() {
	double a, v, b, w;
	int t;
	cin >> a >> v >> b >> w >> t;
	if (v <= w) {
		ps(NO);
		return 0;
	}
	else {
		double tmp = abs(a - b) / (v - w);
		if (tmp <= t) {
			ps(YES);
			return 0;
		}
		else {
			ps(NO);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3720
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <stack>
#include <deque>

using namespace std;

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

	int N;
	cin >> N;

	string S;
	cin >> S;

	deque<char> prefix;

	stack<char> s;

	for (int i = 0; i < N; i++)
	{
		if (S[i] == ')')
		{
			if (!s.empty())
			{
				s.pop();
			}
			else
			{
				prefix.push_front('(');
			}
		}
		else
		{
			s.push(S[i]);
		}
	}

	for (int i = 0; i < prefix.size(); i++)
	{
		cout << prefix[i];
	}

	cout << S;

	for (int i = 0; i < s.size(); i++)
	{
		cout << ")";
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;
ll const MOD = 1000000007;


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

int H,W;
cin >> H >> W;
vector<string> a(H);
rep(h,H) cin >> a[h];

//外壁を作る処理

vector<vector<char>> fi(H+2,vector<char>(W+2,'#'));
rep(h,H) rep(w,W) fi[h+1][w+1] = a[h][w];

rep(h,H+2) {
    rep(w,W+2){
    cout << fi[h][w];
    }
    cout << "\n";
}

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	string S;
	cin >> S;
	int i = 0, j = S.size() - 1;
	int ans = 0;
	while (i <= j) {
		if (S[i] != S[j])ans++;
		i++;
		j--;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <cmath>
#include <random>
using namespace std;
typedef pair<int, int>p;

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int a[100004];
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	sort(a+1, a + n+1);
	long long ruiseki[100005];
	ruiseki[0] = 0;
	for (int i = 1; i <= n; i++) {
		ruiseki[i] = ruiseki[i - 1] + a[i];
	}
	int ans = 1;
	for (int i = n - 1; i >= 1; i--) {
		if (ruiseki[i] * 2 < a[i + 1])break;
		ans += 1;
	}
	cout << ans;
}

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

int main(){
    int n,k; cin >> n >> k;
    int t;
    if(n%2 == 0) {
        t = n/2;
    }
    else{
        t = n/2+1;
    }
    if(t >= k){
        cout << "YES" << endl;
        
    }else{
        cout << "NO" << endl;
    }
    return 0;
    

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string S[50];
    cin >> n;
    for(int i=0; i<n; i++) cin >> S[i];
    int cnt[26];
    fill_n(cnt, 26, 100);

    for(int i=0; i<n; i++){
        int tmp[26];
        fill_n(tmp, 26, 0);
        for(int j=0; j<S[i].size(); j++)
            tmp[S[i][j]-'a']++;
        for(int j=0; j<26; j++)
            cnt[j] = min(cnt[j], tmp[j]);
    }
    for(int i=0; i<26; i++){
        for(int j=0; j<cnt[i]; j++){
            char ch = i + 'a';
            cout << ch;
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
 
  int main(){
      lint h,w;
      cin>>h>>w;
      lint c1,c2,d1,d2;
      cin>>c1>>c2>>d1>>d2;
      --c1;--c2;--d1;--d2;
      char bf[h][w];
      lint dist[h][w];
      rep(i,h){
          rep(j,w){
              cin>>bf[i][j];
              dist[i][j]=INF;
          }
      }
    deque<tuple<lint,lint,lint>> que;
        que.push_front({c1,c2,0});
        vector<lint> ii={0,0,-1,1};
        vector<lint> jj={1,-1,0,0};
        while(!que.empty()){
            lint i,j,ans;
            tie(i,j,ans)=que.front();
            que.pop_front();
            if(dist[i][j]!=INF)continue;
            dist[i][j]=ans;
            if(i==d1&&j==d2){
                cout<<ans<<endl;
                return 0;
            }
            rep(k,4){
                if((i+ii[k])<0||(i+ii[k])>=h||(j+jj[k])<0||(j+jj[k])>=w)continue;
              if(bf[i+ii[k]][j+jj[k]]=='.')  que.push_front({i+ii[k],j+jj[k],ans});

            }
            for(lint x=-2;x<=2;x++){
                for(lint y=-2;y<=2;y++){
            if((i+x)<0||(i+x)>=h||(j+y)<0||(j+y)>=w)continue;
                if(bf[i+x][j+y]=='.') que.push_back({i+x,j+y,ans+1});
                }
            }
            bf[i][j]='#';
        }
        cout<<-1<<endl;
  }
      

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

class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		String[] str = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		BitSet bs = new BitSet(n);
		str = br.readLine().split(" ");
		int k = Integer.parseInt(str[0]);
		for(int i = 0; i < k; i++){
			int b = Integer.parseInt(str[i + 1]);
			bs.set(b);
		}
		for(int i = 0; i < (1 << n); i++){
			boolean flag = true;
			for(int j = 0; j < n; j++){
				if(!bs.get(j)) continue;
				if((i & (1 << j)) == 0) flag = false;
			}
			if(!flag) continue;
			int sum = 0;
			int pow2 = 1;
			ArrayList<Integer> a = new ArrayList<Integer>();
			for(int j = 0; j < n; j++){
				if((i & (1 << j)) != 0){
					sum += pow2;
					a.add(j);
				}
				pow2 *= 2;
			}
			pw.print(sum + ":");
			if(i > 0) pw.print(" ");
			for(int j = 0; j < a.size(); j++){
				pw.print(a.get(j));
				if(j != a.size() - 1) pw.print(" ");
			}
			pw.print("\n");
		}
		pw.close();
	}
}



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

int main(){
  int a, b[100001], c[100000];
  int i, j, N, num;
  scanf("%d", &N); j=0; num=0;

  for(i=0;i<=N;i++){
    b[i]=0;
  }
  
  for(i=0;i<N;i++){
    c[i]=0;
  }
  
  for(i=0;i<N;i++){
    scanf(" %d", &a);
    if(a>N){
      num++;continue;
    }
    if(b[a]==0){
      c[j]=a;j++;
    }
    b[a]++;
  }
  
  for(i=0;i<j;i++){
    if(b[c[i]]>c[i])
      num+=(b[c[i]]-c[i]);
    else if(b[c[i]]<c[i])
      num+=b[c[i]];
    else
      continue;
  }
  printf("%d\n", num);

}


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

int main() {
	int N;
	cin >> N;
	vector<int> C(N - 1), S(N - 1), F(N - 1);
	for (int i = 0; i < N - 1; i++) {
		cin >> C[i] >> S[i] >> F[i];
	}
	for (int i = 0; i < N; i++) {
		int t = 0;
		for (int j = i; j < N - 1; j++) {
			if (t < S[j]) t += S[j] - t;
			else t += t % F[j] == 0 ? 0 : F[j] - t % F[j];
			t += C[j];
		}
		cout << t << endl;
	}
}


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

int main()
{
	int n,point=0,temp=0,out=0,i=0;
	vector <int>result;
	string a;
	cin >> n;
	while (i<n)
	{
		cin >> a;
		if (a == "HIT")
		{
			if (temp==3)
			{
				point++;
			}
			else
			{
				temp++;
			}
		}
		else if (a == "HOMERUN")
		{
			point = point+temp+1;
			temp = 0;
		}
		else if (a == "OUT")
		{
			out++;
			if (out == 3)
			{
				i++;
				out = 0;
				temp = 0;
				result.push_back(point);
				point = 0;
			}
		}
	}
	for (int j=0; j < n; j++)
	{
		cout << result.at(j) << endl;
	}
	return 0;
}

Measured memory_bytes: 1228
S = input()
N = len(S)

if S[0] != '1' or S[-1] != '0':
    print(-1)
    exit()

for s, t in zip(S[: N - 1], S[:: -1][1:]):
    if s != t:
        print('-1')
        exit()

now = 1
branch = N
ans = []
for s in S[: N - 1]:
    if s == '1':
        ans.append('{} {}'.format(now, now + 1))
        now += 1
    else:
        ans.append('{} {}'.format(now, branch))
        branch -= 1

print(*ans, sep='\n')

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

#ifndef ONLINE_JUDGE
	#define W(x, y) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << y;
#else
	#define W(x, y)
#endif

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vii vector<pii>
#define vl vector<ll>
#define vll vector<pll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi acosl(-1)
#define ld long double
#define prime (1000000000 + 7)
#define INF 1000000000

using namespace std;

vl kmp(string &&s, string &r){
	vl vet(s.size() + 1, -1);
	ll t = -1;
	for(int i = 0; i < s.size(); ++i){
		while (t > -1 && s[i] != s[t]){
			t = vet[t];
		}
		vet[i+1] = ++t;
	}
	vl res;
	res.insert(res.begin(), vet.begin() + r.size() + 1, vet.end());
	res[0] = -1;
	return res;
}

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

	ll n, a;
	cin >> n >> a;
	if(n%500 <= a){
		cout << "Yes\n"; 
	} else{
		cout << "No\n";
	}

	return 0;
}

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

using ll = long long int;

int main(void){
    
    int answer = 0;
    string s;
    
    cin >> s;
    
    int left = 0,right = s.size()-1;
    
    while(left < right){
        if(s[left] == s[right]){
            left++;
            right--;
        }else if(s[left] == 'x'){
            answer++;
            left++;
        }else if(s[right] == 'x'){
            answer++;
            right--;
        }else{
            cout << -1 << endl;
            return 0;
        }
    }
    
    cout << answer << endl;
    
}


Measured memory_bytes: 512
k, n = map(int, input().split())
a = list(map(int, input().split()))
a2 = a + [aa + k for aa in a]
max_inter = 0
for i in range(n*2 - 1):
    max_inter = max(max_inter, a2[i+1] - a2[i])
print(k - max_inter)

Measured memory_bytes: 26444
inputs = input()
N = int(inputs)

inputs = input().split()

prob = {}
for i in inputs:
    if not int(i) in prob.keys():
        prob[int(i)] = 1
    else:
        prob[int(i)] += 1

inputs = input()
M = int(inputs)

inputs = input().split()
flag = True

for i in inputs:
    if not int(i) in prob.keys():
        flag = False
    else:
        prob[int(i)] -= 1
        if prob[int(i)] < 0:
            flag = False

if flag:
    print('YES')
else:
    print('NO')

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

int main(){
    int n;
    cin>>n;
    map<string,int>mp;
    mp["AC"]=0;
    mp["WA"]=0;
    mp["TLE"]=0;
    mp["RE"]=0;
    rep(i,n){
        string s;
        cin>>s;
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<math.h>
int main(){
int a[10001],b=2,c=3,d=0,e,i,f=0;
for(i=0;i<10000;){
if(b==2){
a[i]=2;
i++;
}
else if(b%2==0 || b==1){
}
else{
while(c<=sqrt(b)){
if(b%c==0){
d++;
break;
}
c++;
}
if(d==0){
a[i]=b;
i++;
}
d=0;
}
b++,c=3;
}
while(1){
scanf("%d\n",&e);
if(e==0){
break;
}
else{
for(i=0;i<e;i++){
f=f+a[i];
}
printf("%d\n",f);
f=0;
}
}
return 0;
}



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

using namespace std;

#define IoFast ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long int
#define float long double
#define foor(i, a, b) for ( int (i) = (a); (i)<(b); (i)++ )
#define foor2(i, a, b) for( int (i) = (a); (i)>(b); (i)-- )
#define foorl(i, a, b) for ( ll (i) = (a); (i)<(b); (i)++ )
#define foorl2(i, a, b) for( ll (i) = (a); (i)>(b); (i)-- )
#define mp make_pair
#define f1 first
#define f2 second
#define pb push_back
#define pii pair<int,int>
#define vpii vector <pii>
#define vi vector<int>
#define sz(a) (int) a.size( )
#define fillArr(n, a) foor(i, 0, n) cin >> a[i];
#define print(a) cout << #a << endl;
#define umax(a,b) a = max ( a, b )
#define umin(a,b) a = min ( a, b )
#define all(k) k.begin ( ), k.end( )
#define rall(k) k.rbegin ( ), k.rend( )
#define clean(k) memset( k, 0, sizeof(k) )
#define endl '\n'


int main(){
	IoFast;
	int n, x, sum = 0;
    cin >> n >> x;
    vector<int> a(n);
    foor (i,0,n)
        cin >> a[i];
    
 
    sort(a.begin(),a.end());
    foor (i, 0, n){
        sum += a[i];
        
        if(x < sum){
            cout << i << endl;
            break;
        }
		else if(x == sum){
            cout << i + 1 << endl;
            break;
        }
        if(i == n - 1){
            cout << i << endl;
        }
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef pair< double,double> dd;
#define sz(a) int((a).size())
#define all(c) c.begin(),c.end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define mp make_pair

const int INF = 1000000007;
const long long INFLL = (ll)INF * (ll)INF;

void test_case()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	ll ans1,ans2,ans3,ans4;
	ans1 = (ll)a*(ll)c;
	ans2 = (ll)a*(ll)d;
	ans3 = (ll)b*(ll)c;
	ans4 = (ll)b*(ll)d;
	cout<<max(ans1,max(ans2,max(ans3,ans4)));
}

int32_t main()
{
	//int t;
	//cin>>t;
	//while(t--)
	{
		test_case();
		cout<<endl;
	}
	return 0;
}



Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) (a<<b)
#define Rshift(a,b) (a>>b)
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define swap(a,b) ( (a^=b) , (b^=a) , (a^=b) )
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;


int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int a, b, c;
    cin >> a >> b >> c;
    cout << c << ' ' << a << ' ' << b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000000
#define maxn 110
#define inf 0x7fffffff
/*------------------------------------------------------------*/
 
int main(){
	ll a,b;
	inl2(a,b);
	ll ans=0;
	for(ll i=a;i<=b;i*=2)ans++;
	outl(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c && c == a)
    cout << "No" << endl;
  else if (a != b && b != c && c != a)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 3612
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int[] n = new int[5];
        
        for(int i=0; i<5; i++){
            n[i] = sc.nextInt();
            if(n[i]==0){
                System.out.println(i+1);
                return;
            }
        }
        
        
   }
}


Measured memory_bytes: 35668
#include "iostream"
#include "vector"

using namespace std;

int main(void){
    int N;
    int result = 0, max = 0;
    scanf("%d", &N);

    vector<int> H(N);

    for (int i = 0; i < N; i++){
        scanf("%d", &H[i]);
    }

    for (int i = 0; i < N - 1; i++){
        if(H[i] >= H[i + 1]){
            result++;
            if(result > max){
                max = result;
            }
        }
        else{
            result = 0;
        }
    }

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

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define pb push_back
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 3e5+5;
void solve(){
	ll n,m; 
	cin>>n>>m; 
	if(abs(n-m)>1){
		cout<<0<<endl;
		return ;
	}
	ll ans = 1;
	for(ll i=1;i<=n;i++){
		ans*=i;
		ans%=mod;
	}
	for(ll i=1;i<=m;i++){
		ans*=i;
		ans%=mod;
	} 
	if(n==m)ans*=2ll;
	ans%=mod;
	cout<<ans<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3624
#include <cstring>
#include <cstdint>
#include <iostream>
#include <string>
#include <memory>
#include <queue>
#include <limits>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <sstream>
#include <random>
#include <functional>
#include<algorithm>
#include <array>
using namespace std;

using q_pair = pair<long long, long>;
struct Vertex {
	vector<q_pair > to;
	long long d = -1;
	long long p = 0;
};
int main() {
	long long X, Y;
	cin >> X >> Y;
	if (X % Y == 0)cout << -1;
	else cout << X;
	return 0;
}


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

int make(int n){
  int ans = 0;
  while(n > 0){
    ans += n % 10;
    n = n / 10;
  }
  return ans;
}

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

  int a,b;
  int ans = 999999999;
  for(int i = 1;i <= n/2;i++){
    a = make(i);
    b = make(n-i);
    if(ans > a + b){
      ans = a + b;
    }
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>

using namespace std;

string S, T;
bool flag = false;

int main(){
    cin >> S >> T;

    int N = S.size();

    for(int i = 0; i < N; i++){
        if(S == T){
            flag = true;
            break;
        }
        char buff = S.front();
        S.erase(S.begin());
        S.push_back(buff);
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 384
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

int main() {
	string s;
	cin >> s;
	if (s.length() & 1) {
		cout << "No" << endl;
	} else {
		for (int i = 0; i < s.length(); i++) {
			if ((i & 1) && s[i] != 'i') {
				cout << "No" << endl;
				return 0;
			}
			if ((!(i & 1)) && s[i] != 'h') {
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
	}
	return 0;
}


Measured memory_bytes: 3600
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
    int N;
    char zm[500]={0};
    int symbol[500]={0};
    scanf("%d",&N);
    char spa;
    scanf("%c",&spa);
    int needz,needy;
	needz=needy=0;
    for(int i=150;i<150+N;i++)
    	scanf("%c",&zm[i]);
    for(int i=150;i<150+N;i++)
    {
    	if(zm[i]=='(')
    	{
    		int k;
    		for(k=i+1;k<150+N;k++)
    		{
    			if(symbol[k]==0 && zm[k]==')')
    			{
					symbol[k]=1;
					break; 
				}
			}
			if(k>=150+N)
			{
				zm[150+N++]=')';
				symbol[150+N-1]=1;
			}
		}
	}
	for(int i=150;i<150+N;i++)
	{
		if(zm[i]==')' && symbol[i]==0)
			printf("(");
	}
	for(int i=150;i<150+N;i++)
	{
		printf("%c",zm[i]);
	}
    return 0;
 }

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

class Program
{
    #region library
    static int n = 0;
    static int m = 0;
    static int r = 0;
    static int c = 0;
    static int x = 0;
    static int y = 0;
    static int[] arr;
    static string s = "";
    static string[] ss;
    static string alpha = "abcdefghijklmnopqrstuvwxyz";
    static long sum = 0;
    static long cnt = 0;
    static long max = -1;
    static long min = 2147483647;
    static bool flg = false;
    static bool flg2 = false;
    static char[,] map;
    static int[,] imap;
    static string rl()
    {
        return Console.ReadLine();
    }
    static string[] rls()
    {
        return Console.ReadLine().Split();
    }
    static void wl(object obj = null)
    {
        Console.WriteLine(obj);
    }
    static void w(object obj)
    {
        Console.Write(obj);
    }
    static int Int(string s)
    {
        return int.Parse(s);
    }
    static long Max(long a, long b)
    {
        return Math.Max(a, b);
    }
    static long Min(long a, long b)
    {
        return Math.Min(a, b);
    }
    static long Abs(long a)
    {
        return Math.Abs(a);
    }
    static void yes()
    {
        wl("YES");
    }
    static void no()
    {
        wl("NO");
    }
    static void Sum()
    {
        wl(sum);
    }
    static void Cnt()
    {
        wl(cnt);
    }
    static void setmap(char def = '@')
    {
        if (r == 0 && c == 0)
        {
            ss = rls();
            r = Int(ss[0]);
            c = Int(ss[1]);
        }
        map = new char[r, c];
        for (int i = 0; i < r; i++)
        {
            if (def == '@') s = rl();
            for (int j = 0; j < c; j++)
            {
                map[i, j] = (def == '@') ? s[j] : def;
            }
        }
    }
    static void setimap(int def = -1)
    {
        if (r == 0 && c == 0)
        {
            ss = rls();
            r = Int(ss[0]);
            c = Int(ss[1]);
        }
        imap = new int[r, c];
        for (int i = 0; i < r; i++)
        {
            if (def == -1) s = rl();
            for (int j = 0; j < c; j++)
            {
                imap[i, j] = (def == -1) ? Int(s[j].ToString()) : def;
            }
        }
    }
    #endregion

    static void Main(string[] args)
    {
        int a = Int(rl());
        int b = Int(rl());

        if (a != 1 && b != 1) wl(1);
        if (a != 2 && b != 2) wl(2);
        if (a != 3 && b != 3) wl(3);
    }


}



Measured memory_bytes: 11092
// https://atcoder.jp/contests/agc032/tasks/agc032_b
//
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::fmt::*;
use std::io::*;
use std::str::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: usize
    };

    let mut edges = vec![];
    if n % 2 == 1 {
        for i in 1..n {
            edges.push([i, n]);
            let counterpart = n - i;
            for j in i + 1..n {
                if j != counterpart {
                    edges.push([i, j]);
                }
            }
        }
    } else {
        for i in 1..n + 1 {
            let counterpart = n + 1 - i;
            for j in i + 1..n + 1 {
                if j != counterpart {
                    edges.push([i, j]);
                }
            }
        }
    }

    println!("{}", edges.len());
    for e in edges {
        println!("{} {}", e[0], e[1]);
    }
}


Measured memory_bytes: 4352
import sys
input=sys.stdin.readline

N,M = map(int, input().split())

pref = [[0] for i in range(N+1)]
import collections
q = collections.deque()
 
for i in range(M):
    p,y = map(int, input().split())
    pref[p].append(y)
    q.append((p,y))
for p in pref:
    p.sort()

import bisect
for p,y in q:
    print("%06d%06d" %(p, bisect.bisect_left(pref[p], y)))


Measured memory_bytes: 31084
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>


#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int a, b; cin >> a >> b;

	int p = 0;
	while (true) {
		int cap = (p * 1.08) - p;
		int cbp = (p * 1.10) - p;
		if (cap == a && cbp == b) {
			cout << p << endl;
			return 0;
		}
		if (a < cap) {
			cout << -1 << endl;
			return 0;
		}

		p++;
	}

	return 0;
}

Measured memory_bytes: 256
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
using ll = long long;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//動的計画法で役に立つ関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//最大公約数と最小公倍数
ll gcd(ll a, ll 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;
}

vector<vector<long long> > comb(int n) {
  vector<vector<long long> > v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int N,K;
    cin >> N >> K;
    VI A(N);
    REP(i,N)
    {
        cin>>A[i];
    }
    cout << 1+(N-2)/(K-1) << endl;

    return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define Rep(i,n) for(int i=1;i<=(n);++i)
using LL = long long;
using ULL = unsigned long long;

int main()
{
	int x;
	cin >> x;
	cout << x/500*1000 + x%500/5*5 << endl;
	return 0;
}


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

int main() {
  int xi,yi,size,xy[50][50] = {0};
  int white,top;
  string str;
  while(cin >> str) {
    xi = atoi(str.substr(0,1).c_str());
    yi = atoi(str.substr(2,1).c_str());
    size = atoi(str.substr(4,1).c_str());
    if((size == 1) ||(size == 2)||(size == 3)) {
      xy[xi+10][yi+10]++;
      xy[xi+1+10][yi+10]++;
      xy[xi-1+10][yi+10]++;
      xy[xi+10][yi+1+10]++;
      xy[xi+10][yi-1+10]++;
    }
    if((size == 2) || (size == 3)) {
      xy[xi+1+10][yi+1+10]++;
      xy[xi+1+10][yi-1+10]++;
      xy[xi-1+10][yi+1+10]++;
      xy[xi-1+10][yi-1+10]++;
    }
    if(size == 3) {
      xy[xi+10][yi+2+10]++;
      xy[xi+10][yi-2+10]++;
      xy[xi+2+10][yi+10]++;
      xy[xi-2+10][yi+10]++;
    }
  }
  white = 0;
  top = xy[10][10];
  for(int i=0;i<10;i++) {
    for(int j=0;j<10;j++) {
      if(xy[i+10][j+10] == 0)
        white++;
      if(xy[i+10][j+10] > top)
        top = xy[i+10][j+10];
    }
  }
  cout << white << endl << top << endl;
}

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

using namespace std;

long long numPatty(long long level) {
    if (level == 0) {
        return 1;
    }
    else {
        return 2 * numPatty(level - 1) + 1;
    }
}

long long numLayer(long long level) {
    if (level == 0) {
        return 1;
    }
    else {
        return 2 * numLayer(level - 1) + 3;
    }
}

long long solve(long long n, long long x) {
    if (n == 0) {
        return 1;
    }

    long long nlayer = numLayer(n);
    if (x == 0) {
        return 0;
    }
    else if (x == (nlayer - 1) / 2) {
        return numPatty(n - 1) + 1;
    }
    else if (x == nlayer - 1) {
        return 2 * numPatty(n - 1) + 1;
    }
    else if (0 < x && x < (nlayer - 1) / 2) {
        return solve(n - 1, x - 1);
    }
    else { // (nlayer - 1) / 2 < x && x < nlayer - 1
        return numPatty(n - 1) + 1 + solve(n - 1, x - (nlayer - 1) / 2 - 1);
    }
}

void Main() {
    long long  N, X;
    cin >> N >> X;

    long long ans = solve(N, X - 1);
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
ll c[101][101];
int main(){
    int n; scanf("%d", &n);
    rep(i, n) rep(j, n) scanf("%lld", &c[i][j]);
    ll ans = 0;
    rep(i, n - 1) REP(j, i + 1, n)
      ans += min(c[i][j], c[j][i]);
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1272
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define INF 1e9
typedef long long ll;
using namespace std;

int main() {
    int n,y; cin >> n >> y;
    if(n*10000<y){
        cout << -1 << " " << -1 << " " << -1 << endl;
    }
    else{
        int ans=0;
        int count=0;
        int a1,b1,c1;
        rep(i,n+1){
            rep(j,n-i+1){
                int k = n-i-j;
                ans = 10000*i + 5000*j + 1000*k;
                if(ans==y){
                    a1 = i;
                    b1 = j;
                    c1 = k;
                    count += 1;
                }
            }
        }
        if(count!=0){
            cout << a1 << " " << b1 << " " << c1 << endl;
        }else{
            cout << -1 << " " << -1 << " " << -1 << endl;
        }
    }
    


    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/nikkei2019-qual/tasks/nikkei2019_qual_c
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

struct dish {
    int diff, a, b;
};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<dish> v(n);
    REP(i, n) {
        int a, b;
        cin >> a >> b;
        v[i] = {a + b, a, b};
    }
    sort(ALL(v), [](const dish &a, const dish &b) {
        // 降順ソート
        return a.diff > b.diff;
    }); //比較関数をラムダ式で作る
    ll ans = 0;
    REP(i, n) {
        if (i % 2 == 0) {
            ans += v[i].a;
        } else {
            ans -= v[i].b;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int M = Integer.parseInt(sc.next());
        String S = sc.next();
        int offset;
        StringBuilder sb = new StringBuilder();
        for(int i=N;i>0;i=offset){
            offset = Math.max(0,i-M);
            for(;offset<i;offset++){
                if(S.charAt(offset)=='0'){
                    break;

                }
            }
            if(offset==i){
                System.out.print(-1);
                System.out.flush();
                return ;
            }else{
                sb.insert(0," "+(i-offset));
            }
        }

        System.out.print(sb.subSequence(1,sb.length()));
    }
}

Measured memory_bytes: 38928
import sys
input = sys.stdin.readline

# from collections import deque

def linput(_t=int, cnv=list):
    return cnv(map(_t, input().split()))

def gcd(n,m):
    while m: n,m = m, n%m
    return n

def lcm(n,m): return n*m//gcd(n,m)

def main():
    N = int(input())
    vA = [int(input()) for _ in [0,]*N]

    res = 0
    odd = 0

    for a in vA:
        x = (a+odd)//2
        k = (a+odd) - 2*x
        res += x
        odd = min(k,a)
        # print(res,a,x,odd)####

    print(res)
    # print("No Yes".split()[res])

main()


Measured memory_bytes: 13844
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

using ll = long long;
using P = pair<int, int>;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    cin >> x;
    int l, q;
    cin >> l >> q;
    
    const int LOG_N = 17;
    vector<vector<int>> nxt(LOG_N + 1, vector<int>(n));
    int right = 0;
    rep(left, n) {
        while (right < n && x[right] - x[left] <= l) right++;
        nxt[0][left] = right - 1;
    }
    rep(k, LOG_N) rep(i, n) nxt[k + 1][i] = nxt[k][nxt[k][i]];
    
    //d日でaからbに行けるか
    auto is_ok = [&](int d, int a, int b){
        int now = a;
        rep(i, LOG_N + 1) if (d >> i & 1) now = nxt[i][now];
        return b <= now;
    };
    
    auto query = [&](int a, int b){
        int ng = -1;
        int ok = n + 1;

        while (abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;

            if (is_ok(mid, a, b)) ok = mid;
            else ng = mid;
        }
        return ok;
    };
    
    rep(_q, q) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        if (a > b) swap(a, b);
        cout << query(a, b) << endl;
    }
}

Measured memory_bytes: 8312
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int urs = 0;
    while(x >= 500){
      x -= 500;
      urs += 1000;
    }
    while(x >= 5){
      x -= 5;
      urs += 5;
    }
    System.out.println(urs);
  }
}


Measured memory_bytes: 21972