akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<pair<int,int> > a;
    for(int i=0;i<n;i++){
        int b;
        cin >> b;
        a.push_back(make_pair(b,i));
    } 

    /*for(int i=0;i<n;i++){
        cout << a[0].second << ':' << a[i].first << endl;
    }*/

    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());

    for(int i=0;i<n;i++){
        if(a[0].second!=i){
            cout << a[0].first << endl;
        }else{
            cout << a[1].first << endl;
        }
    }
}

Measured memory_bytes: 5340
/* -------------------------------- Template -------------------------------- */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }

template<typename T> constexpr T inf = [](){ assert(false); };
// template<> constexpr int inf<int> = 1e9;
// template<> constexpr ll inf<ll> = 1e18;
// template<> constexpr ld inf<ld> = 1e30;

struct yes_no : std::numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve();

int main() {
  std::locale loc(std::locale(), new yes_no);
  std::cout << std::boolalpha << std::setprecision(12) << std::fixed;
  std::cout.imbue(loc);
  solve();
  return 0;
}

using namespace std;

/* -------------------------------- Library -------------------------------- */

/* ---------------------------------- Main ---------------------------------- */

void solve() {
  int H, W;
  cin >> H >> W;
  REP(i,H) REP(j,W) {
    string s;
    cin >> s;
    if (s == "snuke") cout << char(j + 'A') << i + 1 << endl;
  }
  return;
}


Measured memory_bytes: 764
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {

	int n;
	while (cin >> n, n) {
		vector<int>v(n);
		for (int i = 0; i < n; i++)cin >> v[i];
		int x = 0;
		int value = 32;
		while (1) {
			value -= (value - 1) % 5;
			cout << value << endl;
			if (value == 1) {
				cout << 0 << endl;
				break;
			}
			value -= v[(x++) % n];
			cout << value << endl;
		}

		
	}

	return 0;
}

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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

const int MAX_N = 300001;
vector<int> prime;
void setMyPrime(int n) {
    vector<bool> alive(n, true);
    rep2(i, 2, n) {
        if (!(i % 7 == 1 || i % 7 == 6)) continue;
        if (alive[i]) {
            prime.emplace_back(i);
            for (int j = 2 * i; j < n; j += i) {
                alive[j] = false;
            }
        }
    }
}

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

    setMyPrime(MAX_N);

    int x;
    while (cin >> x, x > 1) {
        cout << x << ":";
        for (auto p : prime) {
            if (x % p == 0) cout << " " << p;
        }
        cout << endl;
    }
}

Measured memory_bytes: 3408
#include <cstdio>
#include <random>
#include <cassert>
#include <algorithm>    
#include <iostream>
#include <chrono>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
// #define int long long


using namespace std;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const long long INF = 1e18;
const int M = 1e9 + 7;



int qpow(int a, int p, int n){
	int res = 1;
	for(; p; a = a * a % n, p >>= 1) {
		if(p & 1) {
			res = res * a % n;
		}
	}
	return res;
}

signed main()
{
#ifndef ONLINE_JUDGE
	//freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false); cin.tie(0);
	int p;
	cin >> p;
	const int maxn = 3000;
	static int r[maxn], a[maxn];
	for(int i = 0; i < p; ++i) {
		cin >> a[i];
	}
	for(int i = 0; i < p; ++i) {
		for(int j = 1; j < p; ++j) {
			if(a[i]) {
				r[j] = (r[j] - qpow(i, p - 1 - j, p) + p) % p;
			}
		}
	}
	r[0] = a[0];
	for(int i = 0; i < p; ++i) {
		cout << r[i] << ' ';
		/*int res = 0;
		for(int j = 0; j < p; ++j) {
			res += r[j] * qpow(i, j, p);
		}
		cout << i << ' ' << res % p << endl;*/
	}



    
	return 0;
}

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

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

  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }

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

  if(A.at(0)>x) {
      cout << 0 << endl;
      return 0;
  }

  int ans =0;
  for (int i = 0; i < N; i++) {
 //満足する個数が少ないものから与える
    x -= A.at(i);
    if(x>=0) {
        ans++;
    }
    else break;
  }

  if(x>0) ans--;//全員に配ってもまだ残っている

  cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int dist[32][32][5];
int H, W, C[5];

int field[32][32];

struct query{
    int h;
    int w;
    int direction;
    int nowdist;
    query(int a, int b, int c, int d) {
        h = a;
        w = b;
        direction = c;
        nowdist = d;
    }
};

const bool operator> (const query &a, const query &b) {
    return a.nowdist > b.nowdist;
}
int dh[4] = {-1, 0, 1, 0};
int dw[4] = {0, 1, 0, -1};

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        cin >> W >> H;
        if(W == 0) break;
        for(int h = 1; h <= H; h++) {
            for(int w = 1; w <= W; w++) {
                cin >> field[h][w];
                for(int d = 0; d <= 3; d++) {
                    dist[h][w][d] = INF;
                }
            }
        }
        priority_queue<query, vector<query>, greater<query>> que;
        dist[1][1][1] = 0;
        que.emplace(1, 1, 1, 0);
        for(int i = 0; i <= 3; i++) cin >> C[i];
        while(!que.empty()) {
            query now = que.top();
            que.pop();
            //cerr << now.h << " " << now.w << " " << now.direction << " " << dist[now.h][now.w][now.direction] << endl;
            if(now.h == H && now.w == W) {
                cout << dist[H][W][now.direction] << endl;
                break;
            }
            for(int ope = 0; ope <= 3; ope++) {
                int newdist = dist[now.h][now.w][now.direction];
                if(ope != field[now.h][now.w]) newdist += C[ope];
                int newdirection = (now.direction + ope) % 4;
                int newh = now.h + dh[newdirection];
                int neww = now.w + dw[newdirection];
                if(newh < 1 || newh > H || neww < 1 || neww > W) continue;
                if(dist[newh][neww][newdirection] > newdist) {
                    dist[newh][neww][newdirection] = newdist;
                    que.emplace(newh, neww, newdirection, newdist);
                }
            }
        }
    }
    return 0;
}


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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int N;
    cin >> N;
    if (N == 1) {
        cout << "Hello World" << endl;
    } else {
        int A, B;
        cin >> A >> B;
        cout << A + B << endl;
    }
}

signed main() {
    solve();
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
x, y = map(int, input().split())
if (x in A and y in A) or (x in B and y in B):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};

vector<int> edge[MAX_N];
bool reach[MAX_N];
lint ans[MAX_N];

void dfs(int now){
    if(reach[now]) return;
    reach[now]=true;
    rep(i,edge[now].size()){
        if(!reach[edge[now][i]]) ans[edge[now][i]]+=ans[now];
        dfs(edge[now][i]);
    }
}

int main(void){
    int N,Q;
    cin >> N >> Q;
    rep(i,N-1){
        int u,v;
        cin >> u >> v;
        u--,v--;
        edge[u].push_back(v);
        edge[v].push_back(u);
    }
    rep(i,Q){
        int p,x;
        cin >> p >> x;
        p--;
        ans[p]+=x;
    }
    dfs(0);
    rep(i,N) cout << ans[i] << " ";
    cout << endl;
}

Measured memory_bytes: 25728
a,b,c,d=input()
for i in range(2**3):
    ls =['+','+','+']
    for j in range(len(ls)):
        if (i >> j) & 1:
            ls[j] = '-'
    if eval(a+ls[0]+b+ls[1]+c+ls[2]+d)==7:
        print(a+ls[0]+b+ls[1]+c+ls[2]+d+'=7')
        break

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int d,t,s; cin >> d >> t >> s;
    cout << (d>t*s?"No":"Yes") << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n, m, s;
const int MOD = 100000;
int dp[2010][3010];

int main() {
  while (scanf("%d %d %d", &n, &m, &s), n|m|s) {
    MEMSET(dp, 0);
    FOREQ(i, 0, m) {
      dp[i][0] = 1;
    }
    REP(iter, n * n) {
      dp[m][s] = 0;
      for (int i = m; i >= 1; i--) {
        int upper = s - i * (n * n - iter);
        FOREQ(j, 0, upper) {
          dp[i][j + i] = dp[i - 1][j];
        }
        memset(dp[i], 0, sizeof(int) * i);
      }
      FOREQ(i, 1, m) {
        int upper = s + i - i * (n * n - iter);
        FOREQ(j, 0, upper) {
          dp[i][j] += dp[i - 1][j];
          dp[i][j] %= MOD;
        }
      }
      if (iter == 0) {
        FOREQ(i, 0, m) {
          dp[i][0] = 0;
        }
      }
    }
    printf("%d\n", dp[m][s]);
  }
}

Measured memory_bytes: 23000
#include <bits/stdc++.h>
using namespace std;
typedef long long lol;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

lol a[3001][3001] = {};
lol dp[3001][3001][4] = {};

int main()
{
    lol result{0};
    lol r, c, k; cin >> r >> c >> k;
    lol ri, ci, vi;
    FOR(i, 1, k)
    {
        cin >> ri >> ci >> vi;
        a[ri][ci] = vi;
    }
    FOR(i, 1, r)
    {
        FOR(j, 1, c)
        {
            dp[i][j][0] = max(dp[i-1][j][3], dp[i][j-1][0]);
            result = max(result, dp[i][j][0]);
            FOR(x, 1, 3)
            {
                dp[i][j][x] = max(dp[i-1][j][3]+a[i][j], max(dp[i][j-1][x], dp[i][j-1][x-1]+a[i][j]));
                result = max(result, dp[i][j][x]);
            }
        }
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 355220
def add(x,y):
    return x+y
def sub(x,y):
    return x-y
def mul(x,y):
    return x*y
def div(x,y):
    return x/float(y)

a=input().split()
i=0
for j in range(len(a)):
    if a[i]=="+":
        a[i-2]=int(a[i-2])
        a[i-1]=int(a[i-1])
        a[i]=int(add(a[i-2],a[i-1]))
        del a[i-2]
        del a[i-2]
        i=i-2
    elif a[i]=="-":
        a[i-2]=int(a[i-2])
        a[i-1]=int(a[i-1])
        a[i]=int(sub(a[i-2],a[i-1]))
        del a[i-2]
        del a[i-2]
        i=i-2
    elif a[i]=="*":
        a[i-2]=int(a[i-2])
        a[i-1]=int(a[i-1])
        a[i]=int(mul(a[i-2],a[i-1]))
        del a[i-2]
        del a[i-2]
        i=i-2
    elif a[i]=="/":
        a[i-2]=int(a[i-2])
        a[i-1]=int(a[i-1])
        a[i]=int(div(a[i-2],a[i-1]))
        del a[i-2]
        del a[i-2]
        i=i-2
    i=i+1
print(a[0])



Measured memory_bytes: 5620
#include <stdio.h>
long long solve(long long, long long);
long long pow2(long long);
long long a[5] = {0, 1, 2, 3, 3};
int main()
{
  long long n, x;
  scanf("%lld%lld", &n, &x);
  long long ans;
  ans = solve(n, x);
  printf("%lld\n",ans);
  return 0;
}
long long solve(long long n, long long x)
{
  if(x==0) return 0;
  if(n==0) return 1;
  if(x<=n) return 0;
  long long st = pow2(n+1) - 1, ans;//每行面包 肉饼个数和 的一半 包括中间的
  if (n>=1)
  {
    if (x >= st){
      ans = pow2(n) + solve(n-1, x-st);
    }
    else{
      ans = solve(n-1, x-1);
    }
  }
  return ans;
}
long long pow2(long long n)
{
  long long x = 1;
  for (int i = 0; i < n; ++i)
    x *= 2;
  return x;
}


Measured memory_bytes: 128
// AOJ 2013: Osaki
// 2017.11.1 bal4u@uu

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

int tbl[86400];  // 24*60*60 

int main()
{
	int n, i, h, m, s, ans;
	char a[10], b[10];

	while (scanf("%d", &n) && n > 0) {
		memset(tbl, 0, sizeof(tbl));
		for (i = 0; i < n; i++) {
			scanf("%s%s", a, b);
			h = atoi(a), m = atoi(a+3), s = atoi(a+6);
			tbl[h*3600 + m*60 + s]++;
			h = atoi(b), m = atoi(b+3), s = atoi(b+6);
			tbl[h*3600 + m*60 + s]--;
		}
		for (ans = 0, i = 1; i < 86400; i++) {
			tbl[i] += tbl[i-1];
			if (tbl[i] > ans) ans = tbl[i];
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,a,b;
  cin >> n >> a >> b;
  if((b-a)%2==0){
    cout << (b-a)/2;
  }
  else{
    if(n+n-a-b+1>a+b-1){
        cout << (a+b-1)/2;
    }
    else{
        cout << (n+n-a-b+1)/2;
    }
  }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {
        FastReader in = new FastReader();
        String s = in.nextLine();
        String t = in.nextLine();
        int count = 0;
        for (int i=0;i<s.length();i++){
            if(s.charAt(i)!=t.charAt(i))
                count++;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 37548
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int q, n;
  cin >> q >> n;
  vector<vector<int>> wt(n, vector<int>(n, 0));
  for (int _ = 0; _ < q; _++) {
    int i, j;
    cin >> i >> j;
    i %= 2 * n;
    j %= 2 * n;
    int par = 0;
    if (i >= n) {
      i -= n;
      par ^= 1;
    }
    if (j >= n) {
      j -= n;
      par ^= 1;
    }
    char clr;
    cin >> clr;
    par ^= (clr == 'W');
    if (!par) {
      wt[i][j]++;
    } else {
      wt[i][j]--;
    }
  }
  vector<vector<int>> ac(n + 1, vector<int>(n + 1, 0));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      ac[i][j] = ac[i - 1][j] + ac[i][j - 1] - ac[i - 1][j - 1] + wt[i - 1][j - 1];
    }
  }
  int ans = 0;
  for (int di = 0; di < n; di++) {
    for (int dj = 0; dj < n; dj++) {
      int tmp = ac[n][n] - 2 * ac[n][dj] - 2 * ac[di][n] + 4 * ac[di][dj];
      ans = max(ans, abs(tmp));
    }
  }
  ans = (ans + q) / 2;
  cout << ans << '\n';
  return 0;
}


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

public class Program
{
    static int N, K;

    public static void Main(string[] args)
    {
        N = Input.NextInt();
        K = Input.NextInt();

        var a = N - K + 1;

        Console.WriteLine(a);
    }
}

public static class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define lo long long 
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 100005
using namespace std;
int n,m,x,y,deg[li];
int main(){
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d %d",&x,&y);
		deg[x]++;
		deg[y]++;
	}
	for(int i=1;i<=n;i++){
		if(deg[i]%2==1){
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}


Measured memory_bytes: 640
function main(input)
{
  bingo = input.slice(0, 3);
  num = input.slice(3, input.length);
  B = []
  for(var i=0; i<3; i++){
    bingo_num = bingo[i].split(" ");
    B.push(bingo_num)
  }
  numset = new Set();
  for(var j =0; j<num.length; j++){
    numset.add(num[j]);
  }
  
  var result = 'No'
  bingo_flags =[]
  for (var n=0; n<3; n++){
    flag=[]
    line_sum = 0
  	for (var m=0; m<3; m++){
    	if(numset.has(B[n][m])){
            flag.push(1)
          	line_sum += 1
        }else{
         	flag.push(0)
        }   
    }
    //横ビンゴ
    if(line_sum === 3){
    	result = 'Yes'
    }
    bingo_flags.push(flag)
  }
  
  //縦ビンゴ
  for(var index = 0; index<3; index++){
   if(bingo_flags[0][index] + bingo_flags[1][index] + bingo_flags[2][index] ===3){
   	 result= 'Yes'
   }
  }
  
  //斜めビンゴ
  center = bingo_flags[1][1]
  b1 = bingo_flags[0][0] + center + bingo_flags[2][2]
  b2 = bingo_flags[0][2] + center + bingo_flags[2][0]
  if(b1 ===3 || b2 ===3){
    result = 'Yes'
  }
  
  console.log(result);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))

Measured memory_bytes: 7372
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
using pii =pair<int,int>;

int n;
vector<int> a,b;
void input(){
    cin>>n;
    a.resize(n,0);
    b.resize(n);
    rep(i,n-1) cin>>b[i];
}
void src(){
    a[0] = b[0];
    a[n-1] = b[n-2];
    repi(i,1,n-1){ a[i] = min(b[i],b[i-1]); }
    int sum=0;
    rep(i,n) sum+=a[i];
    cout<<sum;
    return;
}

int main(int argc,char* argv[]){
    //ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
//suhan lee,saitama university

#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
#include <complex>
using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define repn(i,n) for(int i=0;i<n;i++)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
#define pb push_back 
#define pf push_front

int main(){
  bool prime[1300000];
  int tmp,tmp2;
  int k;
  for(int i=0;i<1300000;i++)
    prime[i]=0;
  for(int i=2;i<1300000;i++){
    if(!prime[i]){
      tmp=i;
      //  cout <<i<<endl;
	tmp+=i;
      while(tmp<1300000){

	prime[tmp]=1;
	tmp+=i;	
      }
    }
  }
      while(1){
	cin>>k;
	if(k==0) return 0;
	if(!prime[k])
	  cout<<"0\n";
	else{
	  tmp2=k;
	  tmp=k;
	  while(prime[tmp2])
	    tmp2--; 
	  while(prime[tmp])
	    tmp++; 
	  //	  cout<<tmp<<" "<<tmp2<<" "<<tmp-tmp2<<endl;
	  cout<<tmp-tmp2<<endl;
	}

      }

}

Measured memory_bytes: 2424
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define ill long long
#define fcout cout << fixed << setprecision(10)
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, 0, n) cin >> p[i];
  sort(p.begin(), p.end());
  int sum = 0;
  rep(i, 0, k) sum += p[i];
  cout << sum;
}


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

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  if (B < A) {
    cout << 0 << endl;
    return 0;
  }
  if (B == A) {
    cout << 1 << endl;
    return 0;
  }
  if (N == 1) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = (B-A)*(N-2)+1;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main()
{
    int n,ans=0;
    cin>>n;
    rep(i,n){
        int a;
        cin>>a;
        if(a!=i+1) ans++;
    }
    if(ans<=2) cout<<"YES";
    else cout<<"NO";
}

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

const long long INF = 1LL << 60;

// 入力
int N;
long long h[110000];

// DP テーブル
long long dp[110000];

int main() {
    int N, K; cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 110000; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 1; j <= K; ++j) {
	  //dp[i+j] = min(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
	  dp[i] = min(dp[i],dp[i-j]+abs(h[i-j]-h[i]));
	  //chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    // 答え
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    ll n;
    cin >> n;
    string s;
    while(n >= 1) {
        n--;
        ll tmp = n % 26;
        s.push_back('a' + tmp);
        n /= 26;
    }
    reverse(all(s));
    cout << s << endl;
}

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

#include <iostream>
#include <fstream>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define mp make_pair

using namespace std;

typedef long long int64;
typedef vector<int> vi;
typedef pair<int, int> ii;

int BITS = 30;
int64 v[200000];

ostream* gout;
int totalOps;

void lessThan(int a, int b, int c) {
  (*gout) << "< " << a << " " << b << " " << c << "\n";
  ++totalOps;
  if (v[a] < v[b]) {
    v[c] = 1;
  } else {
    v[c] = 0;
  }
}

void add(int a, int b, int c) {
  (*gout) << "+ " << a << " " << b << " " << c << "\n";
  ++totalOps;
  v[c] = v[a] + v[b];
}

class Task {
 public:
  void solveOne(istream &in, ostream &out) {
    totalOps = 32957;
    out << totalOps << "\n";
    gout = &out;
    int next = 3;
    vector<int> p2;
    v[0] = 243791;
    v[1] = 39478278;
    lessThan(2, 0, next);
    p2.push_back(next);
    ++next;
    for (int i = 1; i < BITS; ++i) {
      add(p2.back(), p2.back(), next);
      p2.push_back(next);
      ++next;
    }
    int aplusone = next;
    add(0, p2[0], aplusone);
    ++next;
    int bplusone = next;
    add(1, p2[0], bplusone);
    ++next;
    int accumulator = next;
    ++next;
    for (int i = p2.size() - 1; i >= 0; --i) {
      int temp = next;
      ++next;
      add(accumulator, p2[i], temp);
      int koef = next;
      ++next;
      lessThan(temp, aplusone, koef);
      int baccumulator = next;
      ++next;
      for (int ii = p2.size() - 1; ii >= 0; --ii) {
        temp = next;
        ++next;
        add(baccumulator, p2[ii], temp);
        int bkoef = next;
        ++next;
        lessThan(temp, bplusone, bkoef);
        temp = next;
        ++next;
        add(koef, bkoef, temp);
        lessThan(temp, p2[1], temp);
        lessThan(temp, p2[0], bkoef);
        for (int j = 0; j < ii; ++j) {
          add(bkoef, bkoef, bkoef);
        }
        add(baccumulator, bkoef, baccumulator);
        for (int j = 0; j < i; ++j) {
          add(bkoef, bkoef, bkoef);
        }
        add(2, bkoef, 2);
      }
      for (int j = 0; j < i; ++j) {
        add(koef, koef, koef);
      }
      add(accumulator, koef, accumulator);
    }
    assert(v[2] == v[0] * v[1]);
  }

  void solve(std::istream &in, std::ostream &out) {
    int nt = 1;
    for (int it = 0; it < nt; ++it) {
      solveOne(in, out);
    }
  }
};


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


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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    long long S = 0;
    for (int i = 0; i < N; i++) {
        S += A.at(i);
    }
    long long Sd = 0;
    long long t = 10000000000;
    for (int i = 0; i < N; i++) {
        Sd += A.at(i);
        long long Sdd = S - Sd;
        long long d = abs(Sd - Sdd);
        t = min(t,d);
    }
    cout << t << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

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

		int n = scan.nextInt();
		int num = String.valueOf(n).length();
		int waru = 1;
		int ans = 0;

		if(num == 1) {
			waru = 1;
		}else if(num == 2) {
			waru = 10;
		}else {
			waru = 100;
		}

		if(String.valueOf(n).length() == 1) {
			ans = n;
		}else if(String.valueOf(n).length() == 2){
			ans = n % waru;
		}else {
			ans = n % waru;
			ans %= 10;
		}

		if(ans == 2 || ans == 4 || ans == 5 || ans == 7 || ans == 9) {
			System.out.println("hon");
		}else if(ans == 0 || ans == 1 || ans == 6 || ans == 8) {
			System.out.println("pon");
		}else {
			System.out.println("bon");
		}
	}
}


Measured memory_bytes: 35576
N, Q = map(int, input().split())

F = [0 for i in range(N)]
T = [[]for i in range(N)]

for i in range(N-1):
    a, b = map(int, input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)

X = [0 for i in range(N)]
for i in range(Q):
    p, x = map(int, input().split())
    X[p-1] += x

ans = [X[i] for i in range(N)]
for i in range(N):
    F[i] = 1
    for j in range(len(T[i])):
        if F[T[i][j]] == 1:
            continue
        ans[T[i][j]] += ans[i]

for i in range(N):
    print(ans[i], end =" ")


Measured memory_bytes: 59500
package main

import (
	"fmt"
)

func main() {
	var k, s int
	fmt.Scanf("%d %d", &k, &s)

	count := 0

	for x := 0; x <= k; x++ {
		for y := 0; y <= k; y++ {
			if z := s - (x + y); 0 <= z && z <= k {
				count++
			}
		}
	}

	fmt.Println(count)
}

Measured memory_bytes: 512
import java.io.{BufferedReader, InputStream, InputStreamReader}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}

object Main {
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val H = sc.nextInt()
    val W = sc.nextInt()

    // できるだけ等しくなるようにカットして、２つの面積を返す
    def cutEvenly(h: Long, w: Long): (Long, Long) = {
      val hor = (h / 2 * w, (h - h / 2) * w)
      val ver = (w / 2 * h, (w - w / 2) * h)
      if (abs(hor._1 - hor._2) < abs(ver._1 - ver._2))
        hor
      else
        ver
    }

    def cutBig(short: Long, big: Long, w: Long) = {
      val a = short * w
      val (b, c) = cutEvenly(big, w)
      max(max(a, b), c) - min(min(a, b), c)
    }

    // 一回めのカットが水平方向
    def minCut_hor(h: Int, w: Long): Long = {
      (1 until h map { i =>
        val h1 = i.toLong
        val h2 = h - i
        if (h1 > h2)
          cutBig(h2, h1, w)
        else
          cutBig(h1, h2, w)
      }).min
    }

    val ans = min(minCut_hor(H, W), minCut_hor(W, H))
    println(ans)
  }

  def main(args: Array[String]): Unit = {
    solve()
  }



  private class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }

}


Measured memory_bytes: 40984
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
for i in range(n):
  if a[i] >= b[i]:
    ans += b[i]
  else:
    ans += a[i]
    b[i] -= a[i]
    if b[i] <= a[i+1]:
      a[i+1] -= b[i]
      ans += b[i]
    else:
      ans += a[i+1]
      a[i+1] = 0
      
print(ans)

Measured memory_bytes: 24328
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
//#define s second

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

/*********************************************START**************************************************************************/


int main()
{
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	int T  = 1;
	//int T;
	//cin >> T;
	// cin.ignore(); //must be there when using getline(cin, s)
	while (T--)
	{
		ll x,k,d; cin >> x >> k >> d; 
		x = abs(x);
		if(k <= x/d + 1){
			cout << abs(x - k*d) << endl;
		}else{
			ll a;
			a = x/d;
			if(a%2 == k%2){
				cout << abs(x - a*d )<< endl;
			}else{
				//cerr << "1" << endl;
				cout << abs(x - (a+1)*d) << endl;
			}
		}
					
					
	}

	return 0;
}
 


Measured memory_bytes: 3696
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
using namespace std;
/*int a[1005][1005];
int dp[1005][1005];
int main()
{
   int t;
   scanf("%d",&t);
   int p=1;
   while(t--)
   {
       int r,c;
       scanf("%d %d",&r,&c);
       memset(dp,0,sizeof(dp));
       for(int i=1;i<=r;i++)
       {
           for(int j=1;j<=c;j++)
            scanf("%d",&a[i][j]);
       }
       for(int i=1;i<=r;i++)
       {
           for(int j=1;j<=c;j++)
            dp[i][j]=max(dp[i-1][j],max(dp[i][j-1],dp[i-1][j-1]))+a[i][j];
       }
       printf("Scenario #%d:\n",p++);
       printf("%d\n\n",dp[r][c]);
   }
    return 0;
}
for (int i = 1; i <= n; i++)
    for (int j = V; j >= w[i]; j--)
            f[j] = max(f[j], f[j - w[i]] + v[i]);*/
#define MAX_INT 0X3f3f3f3f
#define MIN_INT -MAX_INT
/*int w[4100],d[4100];
int dp[13000];
int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    for(int i=0;i<n;i++)
        scanf("%d %d",&w[i],&d[i]);
    for(int i=0;i<n;i++)
    {
        for(int j=m;j>=w[i];j--)
        {
            dp[j]=max(dp[j],dp[j-w[i]]+d[i]);
        }
    }
    printf("%d\n",dp[m]);
    return 0;
}*/
/*int p[50005],w[10005];
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int e,f;
        scanf("%d %d",&e,&f);
        int n;
        scanf("%d",&n);
        for(int i=0;i<n;i++)
            scanf("%d %d",&p[i],&w[i]);
        for()
    }
    return 0;
}*/
#include <set>
int main()
{
    int n;
    scanf("%d",&n);
    set<int>stu;
    for(int i=1;i<=n;i++)
    {
        long long x;
        cin>>x;
        if(stu.count(x))
            stu.erase(x);
        else
            stu.insert(x);
    }
    cout<<stu.size()<<endl;
    return 0;
}


Measured memory_bytes: 4864
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <deque>
#include <cmath>

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

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mpa make_pair
#define all(a) (a).begin(), (a).end()

struct zone{
    double v,t,num;
    zone(double _v, double _t, double _num){v = _v;t = _t;num = _num;}
};

bool operator>(const zone &left, const zone &right) {return left.v > right.v;}

int main(){
    int n; cin >> n;
    vector<double> t(n + 2), v(n + 2);
    rip(i, n+1, 1) cin >> t[i];
    rip(i, n+1, 1) cin >> v[i];
    priority_queue<zone, vector<zone>, greater<zone>> pq;
    v[1] = min(v[1],t[1]); v[n] = min(v[n], t[n]); 
    rip(i, n+1, 1) pq.push(zone(v[i], t[i], i));
    vector<bool> ju(n + 2, false);
    while(pq.size()){
        zone now = pq.top(); pq.pop();
        if(ju[now.num]) continue;
        ju[now.num] = true;
        if(v[now.num - 1] > v[now.num] + t[now.num - 1]){
            v[now.num - 1] = v[now.num] + t[now.num - 1];
            pq.push(zone(v[now.num - 1], t[now.num - 1], now.num - 1));
        }
        if(v[now.num + 1] > v[now.num] + t[now.num + 1]){
            v[now.num + 1] = v[now.num] + t[now.num + 1];
            pq.push(zone(v[now.num + 1], t[now.num + 1], now.num + 1));
        }
    }
    double ans = 0;
    auto squ = [](double x) {return x * x;};
    rip(i, n + 1, 1){
        double left = min(v[i - 1], v[i]), right = min(v[i + 1],v[i]);
        if(t[i] - v[i]*2 + left + right < 0){
            double ab = abs(left -right);
            ans += squ(t[i] - ab) / 4;
            ans += (t[i] * 2 - ab) * ab / 2;
            ans += t[i] * min(left, right);
        }
        else{
            ans += v[i] * t[i];
            ans -= squ(v[i] - left) / 2;
            ans -= squ(v[i] - right) / 2;
        }
        //printf("%f %f %f %f %f\n", left, v[i], right, t[i], ans);
    }
    printf("%.03f\n",ans);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    while (1){
        int m, f, r;
        scanf("%d %d %d\n", &m, &f, &r);

        if ((m == -1) && (f == -1) && (r == -1)){
            break;
        }

        if ((m == -1) || (f == -1)){
            printf("F\n");
        }

        else if (m + f >= 80){
            printf("A\n");
        }

        else if (m + f >= 65){
            printf("B\n");
        }

        else if (m + f >= 50 || m+f+r >= 80){
            printf("C\n");
        }

        else if (m+f >= 30){
            printf("D\n");
        }

        else{
            printf("F\n");
        }
    }

    return 0;
}



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

#define IOS                               \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);
#define int long long int
#define endl "\n"
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()

const int N = 500009;
const int mod = 1000000007;

string s;
vector<int> ans;
int n;
void pre()
{
}

int32_t main()
{
	IOS;
	pre();
	cin >> s;
	n = s.length() + 1;
	ans.resize(n, -1);
	if (s[0] == '<')
		ans[0] = 0;
	if (s[s.length() - 1] == '>')
		ans[n - 1] = 0;
	for (int i = 0; i < (s.length() - 1); i++)
	{
		if (s[i] == '>' && s[i + 1] == '<')
		{
			ans[i + 1] = 0;
		}
		if (s[i] == '<' && s[i + 1] == '>')
		{
			ans[i + 1] = INT_MAX;
		}
	}
	// for (auto i : ans)
	// {
	// 	cout << i << " ";
	// }
	// cout << endl;

	for (int i = 1; i < n; i++)
	{
		if (s[i - 1] == '<')
		{
			ans[i] = ans[i - 1] + 1;
		}
	}
	// for (auto i : ans)
	// {
	// 	cout << i << " ";
	// }
	// cout << endl;

	for (int i = (n - 2); i >= 0; i--)
	{

		if (s[i] == '>')
		{
			ans[i] = ans[i + 1] + 1;
		}
	}
	// for (auto i : ans)
	// {
	// 	cout << i << " ";
	// }
	// cout << endl;

	for (int i = 1; i < (n - 1); i++)
	{
		if (s[i - 1] == '<' && s[i] == '>')
		{
			ans[i] = max(ans[i - 1], ans[i + 1]) + 1;
		}
	}
	// for (auto i : ans)
	// {
	// 	cout << i << " ";
	// }
	// cout << endl;
	cout << accumulate(all(ans), (int)0) << endl;
}

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

int main(){
  int A, B, C, total;
  cin >> A >> B >> C >> total;
  int ans = 0;
  for(int a=0;a<=A;a++)for(int b=0;b<=B;b++)for(int c=0;c<=C;c++){
    if(500*a+100*b+50*c == total){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    string moji;
    int all;
    while (1){
        cin >> moji;
        all = 0;
        if (moji == "0") break;
        else{
           //for (int i=0; i<moji.size(); i++){
            for (char i : moji){
               all += i - '0';
           }cout << all << endl;
       }
    }return 0;
}


Measured memory_bytes: 3216
#include<cstdio>
#include<iostream>
#define ll long long
using namespace std;
ll read(){
	ll ans=0,f=1;char a=getchar();while(a>'9'||a<'0'){if(a=='-')f=(-1);a=getchar();}
	while(a>='0'&&a<='9')ans=(ans<<3)+(ans<<1)+a-'0',a=getchar();return ans*f;
}//一条long long的黄金分割线---------------------------------------------------------------------------------------------
const ll maxn = 500005;
ll rt = 1;
const ll mod = 998244353;
ll n,m,cnt,ddd;
ll first[maxn];
ll dep[maxn];
ll siz[maxn];
ll fa[maxn];
ll ms[maxn];
ll dfn[maxn];
ll top[maxn];
struct edge{
	ll to,nxt;
}e[maxn*2];
void add(ll a,ll b){
	e[++cnt]=edge{b,first[a]};
	first[a]=cnt;
}
void dfs1(ll now,ll _fa,ll _dep){
	fa[now]=_fa;dep[now]=_dep;
	siz[now]=1;
	ll mn=0;
	for(ll i=first[now];i;i=e[i].nxt){
		ll v=e[i].to;
		if(v==_fa)continue;
		dfs1(v,now,_dep+1);
		siz[now]+=siz[v];
		if(siz[v]>mn)mn=siz[v],ms[now]=v;
	}
}
void dfs2(ll now,ll _top,ll _fa){
	dfn[now]=++ddd;top[now]=_top;
	if(ms[now])dfs2(ms[now],_top,now);
	for(ll i=first[now];i;i=e[i].nxt)
		if(!dfn[e[i].to])
			dfs2(e[i].to,e[i].to,now);
}
ll lca(ll x,ll y){
	while(top[x]!=top[y]){
		if(dep[top[x]]<dep[top[y]])swap(x,y);
		x=fa[top[x]];
	}
	if(dep[x]<dep[y])return x;
	return y;
}
ll qpow(ll n,ll base){
	ll ans=1;
	while(base){
		if(base&1)ans=(ans*n)%mod;
		n=(n*n)%mod;
		base>>=1;
	}
	return ans;
}
int main(){
	char a=getchar();
	if(a>='a'&&a<='z')cout<<'a';
	else cout<<'A';
	return 0; 
} 

Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
 
#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define ll_cin(X) scanf("%lld", &X)
 
#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)
 
typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)
 
#define S_RTN(S)  s_cout(S);return 0
 
 
#define _itoa(A,N) sprintf(A, "%d", N);
 
int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);
 
int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
 
 
int s_asorts(const void* a, const void* b);
 
//昇順
int s_asorts(const void* a, const void* b) {
    return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
    return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
    return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
    int i;
    rept(i, 0, n) {
        l_cin2(*(a + i), *(b + i));
    }
    return 0;
}
int i_cins(int n, int* a) {
    int i;
    for (i = 0; i < n; i++) {
        i_cin(*(a + i));
    }
 
    return 0;
}
int _gcd(int a, int b) {
    int r, tmp;
    if (a < b) { tmp = a; a = b; b = tmp; }
    r = a % b;
    while (r) {
        if (!r) break;
        a = b; b = r;
        r = a % b;
    }
    return(b);
}
 
long _max(long a, long b) {
    return a > b ? a : b;
}
long _min(long a, long b) {
    return a < b ? a : b;
}
int _swp(int* a, int* b)
{
    int tmp;
    tmp = *b; *b = *a; *a = tmp;
    return 0;
}

//大きい順
int compare_int(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}

//変換(文字から整数)
int ctoi(char c) {
    if (c >= '0' && c <= '9') {
        return c - '0';
    }
    return 0;
}


int main(void){
    int N;
    int cnt=0;
    i_cin(N);
    char color[N];
    scanf("%s",color);
    rept(i,0,N){
        if(color[i]!=color[i+1]){
            cnt++;
        }
        
    }
    printf("%d",cnt);
    
}

    




Measured memory_bytes: 256
import java.util.Scanner; 
class Main {
   public static void main(String[] args){
     Scanner scan = new Scanner(System.in);
     int x = scan.nextInt();
     int hours = x / (60 * 60);
     int y = x - (hours * 60 * 60);
     int min = y / 60;
     int sec = y - (min * 60);
     System.out.println(hours + ":" + min + ":" + sec);
  }
}


Measured memory_bytes: 26204
#include <stdio.h>

int main()
{
    int N,X;
    while(scanf("%d %d",&N,&X)==2)
    {
        int i,L[1000];
        for(i=0;i<N;i++)
            scanf("%d",&L[i]);
        int D[10000]={0};
        for(i=1;i<=N;i++)
            D[i]=D[i-1]+L[i-1];
            int s=0;
        for(i=0;i<N+1;i++)
        {
            if(D[i]<=X)
                s++;
        }
        printf("%d\n",s);
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] inputs = sc.nextLine().split(" ");
        int A = Integer.parseInt(inputs[0]);
        int B = Integer.parseInt(inputs[1]);
        int answer = A+B;
        if (answer >= 24) {
            answer = answer % 24;
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 22996