akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(){

    string A;
    getline(cin, A);
    string n1, n2, n3, n4;
    int count = 1;

    for(int i=0; i<A.size(); i++){
        if(A[i] == ' ' && count == 1 ){
            n1 = A[i-1];
            n2 = A[i+1];
            count++;           
        }
        if(A[i] == ' ' && count == 2 ){
            n3 = A[i-1];
            n4 = A[i+1];           
        }
    }
    if((n1 == n2) && (n3 == n4) ){
        cout << "YES" << endl;
    } else{
        cout << "NO" << endl;
    }

    return 0;
}

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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("7");
            WillReturn.Add("beat");
            WillReturn.Add("vet");
            WillReturn.Add("beet");
            WillReturn.Add("bed");
            WillReturn.Add("vet");
            WillReturn.Add("bet");
            WillReturn.Add("beet");
            //beet
            //vet
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("8");
            WillReturn.Add("buffalo");
            WillReturn.Add("buffalo");
            WillReturn.Add("buffalo");
            WillReturn.Add("buffalo");
            WillReturn.Add("buffalo");
            WillReturn.Add("buffalo");
            WillReturn.Add("buffalo");
            WillReturn.Add("buffalo");
            //buffalo
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("7");
            WillReturn.Add("bass");
            WillReturn.Add("bass");
            WillReturn.Add("kick");
            WillReturn.Add("kick");
            WillReturn.Add("bass");
            WillReturn.Add("kick");
            WillReturn.Add("kick");
            //kick
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("4");
            WillReturn.Add("ushi");
            WillReturn.Add("tapu");
            WillReturn.Add("nichia");
            WillReturn.Add("kun");
            //kun
            //nichia
            //tapu
            //ushi
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        string[] SArr = InputList.Skip(1).ToArray();

        var CntDict = new Dictionary<string, int>();
        foreach (string EachStr in SArr) {
            if (CntDict.ContainsKey(EachStr)) {
                CntDict[EachStr]++;
            }
            else {
                CntDict[EachStr] = 1;
            }
        }

        int MaxCnt = CntDict.Values.Max();
        var wkList = new List<string>();
        foreach (var EachPair in CntDict) {
            if (EachPair.Value == MaxCnt) {
                wkList.Add(EachPair.Key);
            }
        }
        wkList.Sort(StringComparer.Ordinal);
        wkList.ForEach(pX => Console.WriteLine(pX));
    }
}


Measured memory_bytes: 47752
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll a, b, n;
  cin >> a >> b >> n;
  ll x = min(n, b - 1);
  ll ans = a * x / b - a * (x / b);
  cout << ans << endl;
}

Measured memory_bytes: 3624
#MLE注意！0や1のケースに注意

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    n,m = map(int, input().split())
    h = list(map(int, input().split()))
    adj = [[] for _ in range(n)] #頂点数, 場合によって変える
    for _ in range(m):
        a,b = map(int, input().split())
        adj[a-1].append(b-1)
        adj[b-1].append(a-1)
    #-1まだ　0負け確　1良い
    check = [-1]*n
    for i in range(n):
        if check[i] == 0:
            continue
        if len(adj[i]) == 0:
            check[i] = 1
        else:
            for j in adj[i]:
                if h[i] < h[j]:
                    check[i] = 0
                    break
                elif h[i] == h[j]:
                    check[i] = 0
                    check[j] = 0
                    break
                else:
                    check[j] = 0
            if check[i] == -1:
                check[i] = 1
    res = 0
    for i in check:
        if i == 1:
            res += 1
    print(res)


if __name__ == '__main__':
    main()

Measured memory_bytes: 90832
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <utility>
#include <vector>

static const int MAXS = 1e5 + 4;
static const int MAXN = 1e5 + 3;

static int l;
static char s[MAXS];

static int n;
static std::vector<int> r[MAXS / 2];

static int d[MAXS / 2];
static int e[MAXS / 2];

int main()
{
    scanf("%s", s);
    l = strlen(s);
    scanf("%d", &n);
    for (int i = 0, lf, rg; i < n; ++i) {
        scanf("%d%d", &lf, &rg);
        --lf;
        if (lf >= (l + 1) / 2) lf = l - lf;
        if (rg >= (l + 1) / 2) rg = l - rg;
        if (lf > rg) std::swap(lf, rg);
        if (lf != rg) r[lf].push_back(rg);
    }

    int h = l / 2;
    for (int i = 0; i < h; ++i) d[i] = ((s[i] - s[l - i - 1]) % 26 + 26) % 26;

    // priority_queue<time, decrement>
    std::priority_queue<
        std::pair<int, int>,
        std::vector<std::pair<int, int>>,
        std::greater<std::pair<int, int>>
    > q;
    for (int i = 0; i < h; ++i) {
        e[i] = (i == 0 ? 0 : e[i - 1]);
        while (!q.empty() && q.top().first == i) {
            e[i] = (e[i] - q.top().second + 26) % 26;
            q.pop();
        }
        if (!r[i].empty()) {
            std::sort(r[i].begin(), r[i].end());
            r[i].resize(std::unique(r[i].begin(), r[i].end()) - r[i].begin());
            for (int j = 1; j < r[i].size(); ++j)
                r[r[i][j - 1]].push_back(r[i][j]);
            int j = r[i][0];
            int diff = (d[i] - e[i] + 26) % 26;
            if (diff != 0) {
                (e[i] += diff) %= 26;
                q.push({ j, diff });
            }
            r[i].clear();
        }
    }

    for (int i = 0; i < h; ++i)
        if (e[i] != d[i]) { puts("NO"); return 0; }

    puts("YES"); return 0;
}


Measured memory_bytes: 6528
object Main {
  def main(args: Array[String]): Unit = {
    val sides = io.StdIn.readLine().split(" ").map(_.toInt)
    val dice = Dice(sides(0), sides(1), sides(2), sides(3), sides(4), sides(5))
    val q = io.StdIn.readInt()
    (0 until q).map(_ => io.StdIn.readLine().split(" ").map(_.toInt)).foreach { case Array(up, south) =>
      println(
        detectEast(dice, sides.indexWhere(_ == up), sides.indexWhere(_ == south))
      )
    }
  }

  private[this] val eastIndexes: Map[(Int, Int), Int] = {
    def toIndexMap(around: Array[Int], east: Int): Map[(Int, Int), Int] = {
      around.zip(around.tail)
          .map { case (up, south) => (up - 1, south - 1) -> (east - 1) }
          .toMap
    }

    val _1 = Array(2, 3, 5, 4, 2)
    val _6 = _1.reverse
    val _3 = Array(1, 2, 6, 5, 1)
    val _4 = _3.reverse
    val _2 = Array(1, 4, 6, 3, 1)
    val _5 = _2.reverse

    toIndexMap(_1, 1) ++ toIndexMap(_6, 6) ++
        toIndexMap(_3, 3) ++ toIndexMap(_4, 4) ++
        toIndexMap(_2, 2) ++ toIndexMap(_5, 5)
  }

  def detectEast(dice: Dice, upIndex: Int, southIndex: Int): Int = {
    import dice._
    eastIndexes.get((upIndex, southIndex)) match {
      case Some(0) => upSide
      case Some(1) => southSide
      case Some(2) => eastSide
      case Some(3) => westSide
      case Some(4) => northSide
      case Some(5) => downSide
      case _ => -1
    }
  }

  case class Dice(upSide: Int, southSide: Int, eastSide: Int, westSide: Int, northSide: Int, downSide: Int) {
    import Direction._
    def spinClockwise: Dice = Dice(upSide, eastSide, northSide, southSide, westSide, downSide)
    def spinCounterclockwise: Dice = Dice(upSide, westSide, southSide, northSide, eastSide, downSide)
    def roll(direction: Direction): Dice = direction match {
      case North =>
        Dice(southSide, downSide, eastSide, westSide, upSide, northSide)
      case South =>
        Dice(northSide, upSide, eastSide, westSide, downSide, southSide)
      case West =>
        Dice(eastSide, southSide, downSide, upSide, northSide, westSide)
      case East =>
        Dice(westSide, southSide, upSide, downSide, northSide, eastSide)
    }
  }

  sealed trait Direction
  object Direction {
    case object North extends Direction
    case object South extends Direction
    case object West extends Direction
    case object East extends Direction

    def apply(c: Char): Direction = c match {
      case 'N' => North
      case 'S' => South
      case 'E' => East
      case 'W' => West
      case _ => throw new Exception
    }
  }
}

Measured memory_bytes: 44068
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "benri.h"
#else
#define out(args...)
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
const ll MOD=1e9+7; //998244353
const ll INF=1e10;
int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	int n;
	cin>>n;
	vv<int> g(n);
	rep(i,n-1){
		int a,b;
		cin>>a>>b; --a; --b;
		g[a].pb(b);
		g[b].pb(a);
	}
	vector<int> a(n),b(n);
	for(int &x:a) cin>>x;
	for(int &x:b) cin>>x;
	vector<ll> dif(n);
	rep(i,n) dif[i]=b[i]-a[i];
	vector<ll> sum(n);
	{
		function<void(int,int)> dfs=
			[&](int v,int p){
				ll s=0;
				for(int w:g[v])if(w!=p){
						dfs(w,v);
						s+=sum[w];
					}
				s+=dif[v];
				sum[v]=s;
			};
		dfs(0,-1);
	}
	vector<ll> cnt(n);
	{
		function<void(int,int)> dfs=
			[&](int v,int p){
				for(int w:g[v])if(w!=p){
						cnt[w]=-sum[w]+cnt[v];
						dfs(w,v);
					}
			};
		dfs(0,-1);
		out(cnt,1);
	}
	auto mn=*min_element(all(cnt));
	for(auto &x:cnt) x-=mn;
	out(cnt,1);
	cout<<accumulate(all(cnt),0ll) NL;
  return 0;
}



Measured memory_bytes: 20052
#include <bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mod 1000000007
using namespace std;

void fast(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
}

int main(){
    fast();
    ll t=1;
//    cin>>t;
    while(t--){
    	string s;
    	cin>>s;
    	ll n=s.length();
    	if(s[n-1]!='s')
    	cout<<s<<"s";
    	else{
    		cout<<s;
    		cout<<"es";	
		}
    	
	}
}

Measured memory_bytes: 3644
#include <iostream>
using namespace std;
int main(){
        int N;
        int a[1000];
        cin >> N;
        for(int i=0 ; i<N ; i++ )
                cin >> a[i];
        int counter=0;
        int flag=1;
        while(flag){
                flag=0;
                for(int j=N-1 ; j>0 ; j-- ){
                        if( a[j]<a[j-1]){
                                swap(a[j],a[j-1]);
                                counter++;
                                flag=1;
                        }
                }
        }
        for(int i=0 ; i<N ; i++ ){
                cout << a[i];
                if(i!=N-1)
                        cout<<" ";
        }
        cout << endl << counter << endl;
        return 0;
}


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

using namespace std; 

#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mmp make_pair
#define st first
#define nd second
#define rd third
#define ll long long
#define pii pair <int, int>
#define tri pair <pii, int>
#define itr pair <int, pii>
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, n) for (int (i) = (a); (i) < (int)(n); i++)
#define FORN(i, a, n) for (int (i) = (a); (i) > (int)(n); i--)
#define Rep(i, n) for (int (i) = 0; (i) <= (int)(n); i++)
#define For(i, a, n) for (int (i) = (a); (i) <= (int)(n); i++)
#define Forn(i, a, n) for (int (i) = (a); (i) >= (int)(n); i--)
#define rep(i, n) for (int (i) = 1; (i) <= (int)(n); i++)
#define pi 3.1415926535897932384626433832795028841971
//#define LOCAL

const int INF = 1e9; 
const int Maxn = 1005; 
const int dx[] = {-1, 0, 1, 0}; 
const int dy[] = {0, 1, 0, -1}; 

struct pos { int first, second, third; }; 

int n; 
int ans; 

void check(int x)
{
	int cnt = 0; 
	for (int i = 1; i <= x; i += 2) if (x % i == 0) cnt++; 
	if (cnt == 8) ans++; 
}

int main()
{
	#ifdef LOCAL
		freopen("input.txt", "r", stdin); 
		freopen("output.txt", "w", stdout); 
	#endif
	
	scanf("%d", &n); 
	
	for (int i = 1; i <= n; i += 2) check(i); 
	
	printf("%d\n", ans); 
	
	return 0; 
}


Measured memory_bytes: 256
def main():
	import sys
	input=sys.stdin.readline
	n,q=map(int,input().split())
	seg=[]
	cnt=-1
	inf=2**31-1
	while 2**cnt<=n:
		cnt+=1
		seg.append([0 for _ in range(2**cnt)])
	#seg tree 初期化
	def f(i,j):
		Range=(2**(cnt-i)*j,2**(cnt-i)*(j+1)-1)
		if Range[0]>y or Range[1]<x:
			return 0
		elif Range[0]>=x and Range[1]<=y:
			return seg[i][j]
		else:
			return f(i+1,2*j)+f(i+1,2*j+1)
	for _ in range(q):
		c,x,y=map(int,input().split())
		if c==0:
			seg[-1][x]+=y
			x//=2
			for j in range(1,cnt+1):
				seg[-j-1][x]=seg[-j][x*2]+seg[-j][x*2+1]
				x//=2
		else:
			print(f(0,0))
if __name__ == '__main__':
	main()


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

int main(void)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long X;
    cin >> X;

    int year = 0;
    long long cash = 100;
    while(true){
        if(cash >= X){
            break;
        }
        cash *= 1.01;
        year++;
    }
    cout << year << endl;
    return 0;
}

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

int main(void){
    int a,b;
    cin>>a>>b;
    if(a%3==0){
        printf("Possible\n");
    }else if(b%3==0){
        printf("Possible\n");
    }else if((a+b)%3==0){
        printf("Possible\n");
    }else{
        printf("Impossible\n");
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define ll long long
int main(){
	int n,m;
	ll ans=1;
	cin >> n >> m;
	if(abs(n-m) > 1){
		cout << 0;
		return 0;
	}
	FOR(i,1,n+1) ans = (ans*i) % mod;
	FOR(i,1,m+1) ans = (ans*i) % mod;
	if(n == m) ans = (ans*2) % mod;
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
    char a[10],b[10];
    int c;
    scanf("%s%s",a,b);
    strcat(a,b);
    c = atoi(a);
    if((int)sqrt(c)==sqrt(c)) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 128
import sys,queue,math,copy,itertools
from fractions import gcd
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N = NI()
S = input()
sr = S[-1:N - 1:-1]
ans = 0
fwd = []
rev = {}
for bit in range(2**N):
    red1 = ''
    blue1 = ''
    red2 = ''
    blue2 = ''
    b = 1
    for i in range(N):
        if b & bit:
            red1 += S[i]
            red2 += sr[i]
        else:
            blue1 += S[i]
            blue2 += sr[i]
        b <<= 1
    fwd.append(red1 + ' ' +  blue1)
    key = blue2 + ' ' + red2
    if key in rev:
        rev[key] += 1
    else:
        rev[key] = 1

for s in fwd:
    if s in rev:
        ans += rev[s]
print (ans)

Measured memory_bytes: 123608
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>  
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 231548613323;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 1e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
 
ll mpow(ll a, ll b){
	if(b >= (MOD-1)) b %= (MOD-1);
	if(b==0) return 1;
	ll t1 = mpow(a,b/2);
	t1 *= t1;
	t1 %= MOD;
	if(b%2) t1 *= a;
	t1 %= MOD;
	return t1;
}
 
ll mpow(ll a, ll b, ll p){
	if(b==0) return 1;
	ll t1 = mpow(a,b/2,p);
	t1 *= t1;
	t1 %= p;
	if(b%2) t1 *= a;
	t1 %= p;
	return t1;
}
 
ll modinverse(ll a, ll m){
	ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) return 0; 
    while (a > 1){
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    }
    if (x < 0) x += m0; 
    return x; 
}
 
ll range(ll l, ll r){
	return l + rand()%(r-l+1);
}
 
ll rev(ll v){
	return mpow(v,MOD-2);
}
 
void solve(){
	ll a,b,c;
	cin >> a >> b >> c;
	ll v = max(a,b);
	cout << (c+v-1)/v << ln;
}
 
int main()
{
	fast_cin();
    ll t=1;
    // cin>>t;
    forn(i,t) {
    	// cout << "Case #" << i+1 << ": ";
    	solve();
    }
    return 0;
}

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

double length(double x1, double y1, double x2, double y2){
	double x = x1 - x2;
	double y = y1 - y2;
	return sqrt(x*x + y*y);
}

int main(){
	int n, i;
	double x1, x2, x3, y1, y2, y3;
	double r, xp, yp, a, b, c, S;
	cin >> n;
	for(i=0; i<n; i++){
		cin >> x1 >> y1 >> x2 >>  y2 >> x3 >> y3;

		a = length(x1, y1, x2, y2);
		b = length(x2, y2, x3, y3);
		c = length(x3, y3, x1, y1);

		r = a*b*c/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
		S = a*b*c/(4*r);
		xp = ((a*a)*(b*b + c*c - a*a)*x3+(b*b)*(c*c + a*a - b*b)*x1+(c*c)*(a*a + b*b - c*c)*x2)/(16*S*S); 
		yp = ((a*a)*(b*b + c*c - a*a)*y3+(b*b)*(c*c + a*a - b*b)*y1+(c*c)*(a*a + b*b - c*c)*y2)/(16*S*S); 

		printf("%.3f %.3f %.3f\n", xp, yp, r);
	}

	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
using namespace std;
long long n,t;
int sum=0;
int main()
{
	scanf("%lld",&n);
	t=n;
	while (n!=0)
	{
		sum+=n%10;
		n/=10;
	}
	if (t%sum==0) printf("Yes");
	else printf("No");
	return 0;
}

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

int main(){
                                                                     

    int a, b, c;   


    cin >> a >> b >> c;


    if( b - a == c - b ){

        cout << "YES" << endl;

        return 0;

        }

    else cout << "NO" << endl;

    return 0;

    }

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n,k; 
llong T[MAX];

//最大積載量 p の k 台のトラックで何個の荷物を積めるか?
int check(llong P) {
  int i = 0;
  for ( int j = 0; j < k; j++ ){
    llong s = 0;
    while( s + T[i] <= P ){
    	s += T[i];
    	i++;
    	if ( i == n ) return n;
    }
  }
  return i;
}

int solve() {
  llong left = 0;
  llong right = 100000 * 100000;//荷物の個数 × 一個当たりの最大重量
  llong mid;
  while ( right - left > 1 ){
  	mid = (left + right) /2;
  	int v = check(mid); // mid == p を決めて何個積めるかチェック
  	if ( v >= n ) right = mid;
  	else left = mid;
  }
  return right;
}  

int main() {
  cin >> n >> k;
  for ( int i = 0; i < n; i++ ) cin>>T[i];
  llong ans = solve();
  cout << ans << endl;
}


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

int main(int argc, char const *argv[]) {

while(1){
  int n, x, counter = 0;

  cin >> n >> x;

  if ( n == 0 && x == 0) break;

  for (int i = 1; i <= n; i++)
    for (int j = i + 1 ; j <= n; j++)
      for (int k = j + 1; k <= n; k++)
        if( i + j + k  == x ) counter += 1;

  cout << counter << endl ;
}
  return 0;
}

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

using namespace std;

int main() {
    long long a, b, c, d;   cin >> a >> b >> c >> d;
    long long ans = b * d;
    ans = max(ans, a * c);
    ans = max(ans, a * d);
    ans = max(ans, b * c);
    if (a <= 0 && b >= 0)   ans = max(ans, 0LL);
    if (c <= 0 && d >= 0)   ans = max(ans, 0LL);
    cout << ans;
    return 0;
}

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

using namespace std;

int main()
{
    int v[10000], n=0;
    while(n < 10000)
    {
        cin >> v[n];
        if(v[n]==0) break;
        cout << "Case " << n+1 << ": " << v[n] << endl;
        n++;
    }    

    return 0;
}


Measured memory_bytes: 3024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6+10 , OO = 0x3f3f3f3f ;
const int mod = 1e9 + 7;
 
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(vec) for(auto &x : vec) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

int n , c;

int main()
{
   // startTime = (double)clock();
    #ifndef ONLINE_JUDGE
        //freopen("in.in", "r", stdin);
        //freopen("out.in", "w", stdout);
    #endif
	//ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    

    scanf("%d", &n);
    vector < int > arkam;
    
    int rkm = 0;
    while (rkm < n)
    {
        rkm += 1000;
        arkam.push_back(rkm);
    }
    
    auto idx = lower_bound(arkam.begin() , arkam.end() , n);
    printf("%d\n" , *idx - n);
    

    return 0;
}

Measured memory_bytes: 3772
#include<bits/stdc++.h>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
//lower_bound like o_set.find_by_order(val) strictly less then val
//upper_bound like o_set.order_of_key(MAX)– o_set.order_of_key(val)
//if u need multiset elements then use second parameter as time and think 
//typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x,s) for(i=x;i>=s;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<int,int>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const int MAX=2e5+5;
const ll MM=1e16;
const ll mod=998244353;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

ll expo(ll x,ll n,ll M=mod)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%M;}
                x=(x*x)%M;
                n>>=1;
    }
    return ans;
}
vector<string> v;
void fun(string s,int index,int last,string a)
{
    if(index==s.length())
    {
        v.pb(a);return;
    }
    if(last==1)
    {
        fun(s,index+1,0,a+s[index]);
        int val=a[a.size()-1]-'0';
        char c='0'+val+1;
        a[a.size()-1]=c;
        fun(s,index+1,1,a);
    }
    else if(last==0)
    {
        fun(s,index+1,0,a+s[index]);
        char c='1';
        a+=c;
        fun(s,index+1,1,a);   
    }
    
    
}

void solve()
{
    ll n,m,i,j,k;
    cin>>n;
    vl a(n);
    fn(i,n)cin>>a[i];
    ll ans=0;
    fn(i,n)
    {
        if(a[i]%2)ans++;
        i++;
    }
    cout<<ans<<endl;
    
    
}

int main()
{
  boost;
  ll t=1;
// cin>>t;
  while(t--)
  {
      solve();
  }
}


Measured memory_bytes: 3644
O=[]
dic={}
for i in range(3):
    d={}
    for j in range(8):
        n,t=map(float,raw_input().split())
        d[t]=int(n)
    ls=sorted(d)
    for j in ls[:2]:
        O.append((d[j],j))
    for j in ls[2:]:
        dic[j]=d[j]
for i in sorted(dic)[:2]:
    O.append((dic[i],i))
for i in O:
    print i[0],i[1]

Measured memory_bytes: 4276
#include <string>
#include <set>
#include <cstdio>
#include <algorithm>
using namespace std;
const int M=4;
int m[10][10];
char s0[M+2];
int chk(const string &s){
	int d=0;
	for(int i=0;i<4;i++)d=m[d][s[i]-'0'];
	return d;
}
bool correct(const string &s){
	return m[chk(s)][s[M]-'0']==0;
}
int main(){
	set<string>se;
	for(int i=0;i<10;i++)for(int j=0;j<10;j++)scanf("%d",m[i]+j);
	for(int i=0;i<10000;i++){
		sprintf(s0,"%04d",i);
		string s=s0;
		s+=chk(s)+'0';
		se.insert(s);
	}
	printf("%d\n",count_if(se.begin(),se.end(),[&](string s)->bool{
		for(int i=0;i<M;i++)if(s[i]!=s[i+1]){
			swap(s[i],s[i+1]);
			if(correct(s))return true;
			swap(s[i],s[i+1]);
		}
		for(int i=0;i<=M;i++)for(int j='0';j<='9';j++)if(s[i]!=j){
			string t=s;
			t[i]=j;
			if(correct(t))return true;
		}
		return false;
	}));
}

Measured memory_bytes: 3872
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<ll>>;
#define MAX 200003
#define MOD 1000000007

template<class T>
class BIT{
  ll N;
  std::vector<T> bit;
public:
  BIT(ll n){
    N=n;
    bit.resize(N+1,0);
  }

  //i番目の要素にwを追加
  void add(ll i,T w){
    for(ll x=i;x<=N;x+=x&-x){
      bit[x]+=w;
    }
  }

  //[1,i]の和を求める
  T sum(ll i){
    ll ret=0;
    for(ll x=i;x>0;x-=x&-x){
      ret+=bit[x];
    }
    return ret;
  }
};


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


  ll ok=0;
  ll ng=1000000001;
  while(ok+1<ng){
    ll x=(ok+ng)/2;
    vector<ll> sum(N,0);
    if(a.at(0)>=x){
      sum.at(0)++;
    }else{
      sum.at(0)--;
    }
    for(ll i=1;i<N;i++){
      if(a.at(i)>=x){
        sum.at(i)=sum.at(i-1)+1;
      }else{
        sum.at(i)=sum.at(i-1)-1;
      }
    }

    ll count=0;
    BIT<ll> tree(3*N);
    for(ll i=0;i<N;i++){
      count+=tree.sum(sum.at(i)+N+1);
      tree.add(sum.at(i)+N+1,1);
      if(sum.at(i)>=0){
        count++;
      }
    }

    if(count>=(N*(N+1)/2-1)/2+1){
      ok=x;
    }else{
      ng=x;
    }
  }

  cout<<ok<<endl;
}


Measured memory_bytes: 4180
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
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; }
 
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }
 
const int INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;
 
long long rui(long long a, long long b){
  long long ans = 1;
  while (b > 0){
    if (b & 1)
      ans = ans * a % MOD;
    a = a * a % MOD;
    b /= 2;
  }
  return ans;
}

long long comb(long long a, long long b){
  long long ans = 1;
  for (long long i = a; i > a - b; i--){
    ans = ans * i % MOD;
  }
  for (long long i = 1; i <= b; i++){
    ans = (ans * rui(i, MOD - 2)) % MOD;
  }
  return ans;
}
 
signed main()
{
  ll x,y; cin>>x>>y;
  if((x+y)%3!=0){
    cout<<0<<endl;
    return 0;
  }
  ll a=(2*y-x)/3;
  ll b=(2*x-y)/3;
  
  if(x-2*b<0||y-2*a<0){
    cout<<0<<endl;
    return 0;
  }
  
  cout<<comb(a+b,a)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll ;
#define rep(i, a, b) for (int i = a; i <= b; ++i)
using namespace std;
template <typename tn> void read (tn & a) {
	tn x = 0, f = 1; char c = getchar();
	while (c < '0' || c > '9') { if (c == '-') f = 0; c = getchar(); }
	while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	a = f ? x : -x;
}
const int MAXN = 1e5 + 10;
int x, k, q;
int r[MAXN];
int sign, kx;
void calc (ll &k) {
	if(k < 0) k = 0;
	if(k > x) k = x;
}


int main () {
//	freopen("in.txt","r",stdin);
	read(x);
	read(k);
	rep(i, 1, k) read(r[i]);
	read(q);
	ll L = 0, R = x, kx = 1, m = 0;
	sign = -1;
	rep(i, 1, q) {
		int a, t;
		read(t);
		read(a);
		while (kx <= k && r[kx] <= t) {
			ll vx = (r[kx] - r[kx - 1]) * sign;
			R += vx;
			L += vx;
			m += vx;
			calc(R);
			calc(m);
			++kx;
			sign = -sign;
		}
		ll an = a + L;
		ll hh = (t - r[kx - 1]) * sign;
//		cerr<<" ]  "<<kx<<" "<<i<<" "<<t<<" "<<r[kx - 1]<<"\n";
		if (an < m) an = m;
		if (an > R) an = R;
		an += hh;
		calc(an);
//		cerr<<"! "<<kx<<" "<<L<<" "<<R<<" "<<m<<" "<<hh<<"\n";
		printf("%lld\n", an);
	}
	
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3000 + 10;
int n;
int a[maxn];
vector<int> E[maxn];
bool dfs(int x, int fa)
{
	for(auto v : E[x])
		if(v != fa && a[v] < a[x] && !dfs(v, x))
			return 1;
	return 0;
}			
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	for(int i = 1; i < n; ++i)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		E[u].push_back(v);
		E[v].push_back(u);
	}
	for(int i = 1; i <= n; ++i)
		if(dfs(i, 0)) printf("%d ", i);
	return 0;
}

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

#define MAX_K (100000)
#define INF (1000000000000000000L)

long calc_final(const long *as, long k, long n) {
  long ret = n;
  for (int i = 0; i < k; i++) {
    ret = ret / as[i] * as[i];
  }
  return ret;
}

long calc_lb(long le, long ri, const long *as, long k, long thresh) {
  if (ri - le <= 1) {
    return ri;
  }
  const long m = (le + ri) / 2, num = calc_final(as, k, m);
  // printf("le = %ld, ri = %ld, m = %ld, num = %ld\n", le, ri, m, num);
  if (num >= thresh) {
    return calc_lb(le, m, as, k, thresh);
  } else {
    return calc_lb(m, ri, as, k, thresh);
  }
}

int main(int argc, char *argv[]) {
  // read inputs
  long K, as[MAX_K];
  scanf("%ld", &K);
  for (int i = 0; i < K; i++) {
    scanf("%ld", &as[i]);
  }

  // solve
  const long ans_min = calc_lb(1, INF, as, K, 2);
  const long ans_max = calc_lb(1, INF, as, K, 3) - 1;
  if (calc_final(as, K, ans_min) == 2 && calc_final(as, K, ans_max) == 2) {
    printf("%ld %ld\n", ans_min, ans_max);
  } else {
    printf("-1\n");
  }

  return 0;
}


Measured memory_bytes: 896
//
// Created by yamunaku on 2019/09/07.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int n;
    cin >> n;
    vi a(n),b(n),c(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n-1) cin >> c[i];
    int ans=0;
    rep(i,n){
        ans+=b[a[i]-1];
        if(i<n-1){
            if(a[i+1]==a[i]+1){
                ans+=c[a[i]-1];
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

int main() {
    ll k; cin >> k;
    vector<ll> ans(50);
    REP(i, 50) ans[i] = k / 50 + i + 1;
    REP(i, 50 - k % 50) {
        ans[i]--;
    }
    cout << 50 << endl;
    REP(i, 50) cout << ans[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
num_lis = [int(x) for x in input()]
N = len(num_lis)
ans = 0
temp = 0

for b in range(1 << (N-1)):
    for c in range(N-1):
        if (b >> c) & 1:
            ans += temp + num_lis[c]
            temp = 0
        else:
            temp = (temp + num_lis[c]) * 10
    ans += temp + num_lis[-1]
    temp = 0

print(ans)

Measured memory_bytes: 3060
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      m: usize,
      xs: [i64; m],
    }
    let mut xs = xs;
    xs.sort();
    let mut ds = vec![];
    for i in 1..m {
        let d = (xs[i] - xs[i-1]).abs();
        ds.push(d);
    }
    ds.sort();
    ds.reverse();
    let mut ans = 0;
    for i in (n-1)..ds.len() {
        ans += ds[i];
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const double PI=3.14159265358979323846;
ll dp;

int main(){
   ll x;
   cin>>x;
   ll n=100,ans=0;
   while(n<x){
      n*=1.01;
      ans++;

   }
   cout<<ans<<endl;
}


Measured memory_bytes: 3644
import java.util.Scanner;

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

			int R = A == 1 ? (B==2 ? 3: 2) : (A==2 ? ( B==1 ? 3:1) : (B==2?1:2));
			
			
			System.out.println(R);
	}	
}

Measured memory_bytes: 35660
n,q=map(int,input().split())
Q=[list(map(int,input().split())) for i in range(q)]


for i in range(30):#要素数以上の2のベキを見つける
    if n<1<<i:#前の問題と違って1-indexなので.
        seg_el=1<<i#Segment treeの台の要素数
        break

SEG=[0 for i in range(2*seg_el-1)]#Segment tree（遅延を用いるが、伝搬が不要。一本のセグ木でOK）

def update(a,b,x,k,l,r):  
    if r<=a or b<=l:#区間[a,b)が対象区間の外にあれば終了
        return 
    if a<=l and r<=b:#区間[a,b)が対象区間の中にあればSEG[k]を更新.後にアクセスされたときに遅延評価する.
        SEG[k]+=x
        return 
    update(a,b,x,k*2+1,l,(l+r)//2)#それ以外のときは,SEG[k*2+1]とSEG[k*2+2]で場合分け
    update(a,b,x,k*2+2,(l+r)//2,r)

def getvalue(n):#値を得る
    i=n+seg_el-1
    ANS=SEG[i]
    i=(i-1)//2
    height=1

    while i>=0:
        ANS+=SEG[i]#親をたどって得た和が答え
        i=(i-1)//2
        height+=1
    return ANS

for query in Q:
    if query[0]==0:
        update(query[1],query[2]+1,query[3],0,0,seg_el)
    else:
        print(getvalue(query[1]))


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

int main() {
  int n;
  cin >> n;
  int x[9] = {0};
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a >= 1 && a <= 399) x[0]++;
    else if (a >= 400 && a <= 799) x[1]++;
    else if (a >= 800 && a <= 1199) x[2]++;
    else if (a >= 1200 && a <= 1599) x[3]++;
    else if (a >= 1600 && a <= 1999) x[4]++;
    else if (a >= 2000 && a <= 2399) x[5]++;
    else if (a >= 2400 && a <= 2799) x[6]++;
    else if (a >= 2800 && a <= 3199) x[7]++;
    else x[8]++;
  }
  int cnt1 = 0, cnt2 = x[8];
  for (int i = 0; i < 8; i++) {
    if (x[i] >= 1) {
      cnt1++;
    }
  }
  int minans = cnt1;
  if (cnt1 == 0) {
    minans++;
  }
  int maxans = cnt1 + cnt2;
  cout << minans << " " << maxans << endl;
  return 0;
}

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

int main() {
  
  int A;
  int B;
  cin >> A >> B;
  
  if(A < B * 2){
    cout << "0" << endl;
  }
  else{
    cout << A - B * 2 << endl;
  }
      
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define ll long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
using namespace std;
int cnt[300];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin>>s;
	rep(i,0,s.size()){cnt[s[i]]=1;}
	if((cnt['E']^cnt['W'])||(cnt['N']^cnt['S'])){
		cout<<"No\n";
	}else cout<<"Yes\n";
	RE 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007

struct Corr {
    int x;
    int y;
    int depth;
};
queue<Corr> q;
int32_t bfs(vector<vector<string>> grid) {
    // 既に探索の場所を1，探索していなかったら0を格納する配列
    vector<vector<bool>> ispassed(grid.size(), vector<bool>(grid[0].size(), false));
    // このような記述をしておくと，この後のfor文が綺麗にかける
    int dx[8] = {1, 0, -1, 0};
    int dy[8] = {0, 1, 0, -1};
    int depth = 0;
    while(!q.empty()) {
        Corr now = q.front();q.pop();
        //cerr << "\tnow:" << now.x << "," << now.y << endl;
        ispassed[now.y][now.x] = true;
        for(int i = 0; i < 4; i++) {
            int nextx = now.x + dx[i];
            int nexty = now.y + dy[i];
            //cerr << nextx << "," << nexty << endl;
            // 探索する場所が配列外の場合
            if(nextx < 0 || nextx >= grid[0].size() || nexty < 0 || nexty >= grid.size()) continue;
            // 次に探索する場所のX座標がはみ出した時
            if(nextx >= grid[0].size() || grid[nexty][nextx] == "#") continue;
            if(nextx < 0 || grid[nexty][nextx] == "#") continue;
            // 次に探索する場所のY座標がはみ出した時
            if(nexty >= grid.size() || grid[nexty][nextx] == "#") continue;
            if(nexty < 0 || grid[nexty][nextx] == "#") continue;
            // 次に探索する場所が既に探索済みの場合
            if(ispassed[nexty][nextx]) continue;
            ispassed[nexty][nextx] = true;
            Corr next = {nextx, nexty, now.depth+1};
            depth = max(depth, next.depth);
            q.push(next);
        }
        //cerr << "size:" << q.size() << endl;
        //if(q.size()>0) cerr << "depth:" << q.front().depth << endl;
    }
    return depth;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long idx=0;
    long H, W;
    cin >> H >> W;
    std::vector<std::vector<string>> mat(H, vector<string>(W, ""));
    for(size_t i=0;i<H; i++)
    {
        string line;
        cin >> line;
        for(size_t j=0;j<W; j++)
        {
            mat[i][j] = line[j];
        }
    }
    //cerr << H << "," << W <<endl;
    int max_distance = 0;

    for(size_t i=0;i<H; i++)
    {
        for(size_t j=0;j<W; j++)
        {
            int cost = 0;
            //cerr << mat[i][j] << " ";
            if(mat[i][j] == ".")
            {
                Corr start = {(int)j, (int)i, 0};
                q.push(start);
                cost = bfs(mat);
            }
            max_distance = max(max_distance, cost);
        }
        //cerr << endl;
    }
    cout << max_distance << endl;
    return 0;
}

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	int a = n%10;
	if (a == 3)
		cout << "bon\n";
	else if (a == 0 || a == 1 || a == 6 || a == 8)
		cout << "pon\n";
	else
		cout << "hon\n";
}

Measured memory_bytes: 3612
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
typedef pair<int,int> pint;
typedef vector<int> vint;
int INF=2e+9+1;
int main(){
	string s;
	vector<string> subs;
	int K;
	scan(s);
	scan(K);
	int subsize=min((int)s.size(),K);
	rep1(i,subsize){
		rep(j,s.size()-i+1){
			if(find(subs.begin(),subs.end(),s.substr(j,i))==subs.end()) subs.push_back(s.substr(j,i));
		}
	}
	sort(subs.begin(),subs.end());
	prin(subs[K-1]);
	return 0;
}


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

vector<int> cycle(int u, vector<int>& v) {
	vector<int> ans(1, u);
	for (int w = v[u]; w != u; w = v[w]) {
		ans.push_back(w);
	}
	return ans;
}

int main() {
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	long long n, k;
	cin >> n >> k;
	vector<int> a(n+1);
	for (int i=0; i<n; i++) scanf("%d", &a[i+1]);

	vector<int> c;
	vector<bool> vis(n+1, false);
	int u = 1;

	while (k) {
		if (a[u] == u) break;
		vis[u] = true;
		if (vis[a[u]]) {
			u = a[u];
			c = cycle(u, a);
			--k;
			break;
		} else {
			u = a[u];
			--k;
		}
	}

	if (!k || !c.size())
		cout << u << endl;
	else 
		cout << c[k%c.size()] << endl;
	

	return 0;
}

Measured memory_bytes: 5088