akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<iomanip>
#include<list>
#include<vector>
#include<queue>

using namespace std;

int main(){
    queue<int> q;
    int n,m,a,b;
    cin>>n>>m;
    vector<list<int>> G(n+1);
    for(int i=0;i<m;i++){
        cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> ans(n+1,-1);
    q.push(1);
    while(q.empty()==false){
        const int tmp=q.front();
        q.pop();
        for(const auto& room:G[tmp]){
            if(ans[room]==-1){
                ans[room]=tmp;
                q.push(room);
            }
        }
    }
    for(int i=2;i<=n;i++){
        if(ans[i]==-1){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    for(int i=2;i<=n;i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 18752
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll a,b;
  cin>>a>>b;
  if(a>b){
    for(ll i=0;i<a;i++){
      cout<<b;
    }
    cout<<endl;
    return 0;
  }
  for(ll i=0;i<b;i++){
      cout<<a;
    }
    cout<<endl;
  
  
}

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

#define ri reverse_iterator
#define pq priority_queue
#define pi 2.0*acos(0.0)
#define mp make_pair
#define ub upper_bound
#define er equal_range
#define nl '\n'
#define F first
#define lb lower_bound
#define mem(a, b) memset(a, b, sizeof(a))
#define Q queue
#define S second
#define pb push_back
#define inp freopen("in.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <long long, long long> pll;
typedef pair <long long, int> pli;

int main()
{
    ios_base :: sync_with_stdio(false);
    int a, b;
    cin >> a >> b;

    if(a == b) cout << "Draw";
    else if (a == 1) cout << "Alice";
    else if(b == 1) cout << "Bob";
    else if(a > b) cout << "Alice";
    else cout << "Bob";

    return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main {
	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			List<Integer> ret = new ArrayList<Integer>();
			do {
				String input = br.readLine();
				if (input.equals("0")) {
					break;
				} else {
					int i, sum = 0;
					for (i = 0; i < input.length(); i++) {
						sum = sum + Integer.parseInt(input.substring(i, i + 1));
					}
					ret.add(sum);
				}
			} while (true);

			for (int num : ret) {
				System.out.println(num);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 16972
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll k, q;
    cin >> k >> q;
    vll d(k);
    rep(i, k) cin >> d[i];
    vll n(q), x(q), m(q);
    rep(i, q) cin >> n[i] >> x[i] >> m[i];
    vll ans(q);
    for(ll i = 0; i < q; i++) {
        x[i] %= m[i];
        vll d2 = d;
        for(ll j = 0; j < k; j++) d2[j] %= m[i];
        ll cycle = (n[i] - 1) / k;
        ll remain = n[i] - 1 - k * cycle;
        vll s(k + 1), sz(k + 1);
        for(ll j = 0; j < k; j++) s[j + 1] = s[j] + d2[j];
        for(ll j = 0; j < k; j++) sz[j + 1] = sz[j] + (d2[j] == 0);
        ll sum = x[i] + cycle * s[k] + s[remain];
        ans[i] = n[i] - 1 - sum / m[i] - cycle * sz[k] - sz[remain];
    }
    for(auto i : ans) cout << i << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 640
def main():
    import sys
    input=sys.stdin.readline
    sys.setrecursionlimit(1000000)
    n=int(input())
    edges=[[] for _ in range(n)]
    for i in range(n-1):
        a,b,c=map(int,input().split())
        a-=1
        b-=1
        edges[a].append([b,c])
        edges[b].append([a,c])
        
    q,k=map(int,input().split())
    k-=1
    
    dist=[10**9+1]*n
    dist[k]=0
    
    def dfs(s,before=-1):
       for edge in edges[s]:
           to=edge[0]
           c=edge[1]
           if to!=before:
               dist[to]=dist[s]+c
               dfs(to,s) 
              
    dfs(k)
    for i in range(q):
        x,y=map(int,input().split())
        x-=1
        y-=1
        print(dist[x]+dist[y])
        
if __name__=='__main__':
    main()

Measured memory_bytes: 156740
#include <algorithm>
#include <cstdio>

using namespace std ;

const int N=2e6+10 ;

struct Edge { int to , nxt , v ; };
Edge e[N<<2] ;
int lst[N] ;
inline void add ( int u , int v )
{
	static int cnt=1 ;
	e[++cnt]=(Edge){v,lst[u]},lst[u]=cnt,
	e[++cnt]=(Edge){u,lst[v]},lst[v]=cnt;
}

int sz[N] ;

int fa[N] , sa , sb ;
int da[N] , db[N] ;
int n ;

int ans[N] ;
inline void Euler ( int x )
{
	for ( int &i=lst[x] ; i ; i=e[i].nxt ) 
		if ( !e[i].v ) 
		{
			// printf("From %d to %d\n",x,e[i].to);
			if ( e[i].to==x+n ) ans[x]=1;
			if ( e[i].to==x-n ) ans[x-n]=-1;
			e[i].v=e[i^1].v=1,Euler(e[i].to);
		}
	return ;
}

int main ()
{
//	freopen("nitai.in","r",stdin);
//	freopen("nitai.out","w",stdout);
	int i ;
	scanf("%d",&n);
	for ( i=1 ; i<=n ; i++ ) 
	{
		scanf("%d",fa+i);
		if ( ~fa[i] ) 
			add(i,fa[i]),
			da[fa[i]]^=1;
		sa=(~fa[i]?sa:i);
	}
	for ( i=1 ; i<=n ; i++ ) 
	{
		scanf("%d",fa+n+i);
		if ( ~fa[i+n] ) 
			add(i+n,fa[i+n]+n),
			db[fa[i+n]]^=1;
		sb=(~fa[i+n]?sb:i+n);
	}
	for ( i=1 ; i<=n ; i++ ) 
		if ( da[i]^db[i] ) 
			return puts("IMPOSSIBLE")*0;
	// for ( i=1 ; i<=n ; i++ ) 
	// 	printf("%d ",v[i]); puts("");
	for ( i=1 ; i<=n ; i++ ) 
		if ( !da[i] ) add(i,i+n);
	int S=2*n+1 ;
	add(S,sa),add(S,sb);
	Euler(S);
	puts("POSSIBLE");
	for ( i=1 ; i<=n ; i++ ) 
		printf("%d ",ans[i]);
	return 0 ;
}

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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);

LL func(LL n,LL bit)
{
    LL pw = 1LL << (bit + 1);
    n = n % pw;
    LL half = pw/2;
    if(n >= half){
        return (n - half + 1) % 2;
    }else{
        return 0;
    }
}
int main()
{
    LL a , b;
    cin >> a >> b;

    LL x = 0;
    for(LL i = 1;i <= 50;i++){
        if(func(b,i))x = x ^ (1LL << i);
    }
    if(a > 0){
        a = a - 1;
        for(LL i = 1;i <= 50;i++){
            if(func(a,i))x = x ^ (1LL << i);
        }
    }
    LL o = (b + 1)/2 - (a + 1)/2;
    if(o % 2 == 1)x = x ^ 1;

    cout << x << "\n";

}


Measured memory_bytes: 256
import java.lang.reflect.Array;
import java.util.*;

/**
 * Created by Santa.
 */
public class Main {

  static int N;
  static int K;
  static long Q;
  static int A;
  static long B;
  static long C;
  // static int[][] map;
  static double min = 9999999;
  static long ans = 0;

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

    int N = scanner.nextInt();
    int K = scanner.nextInt();
    int[] map = new int[N];

    int[] tree = new int[N];

    for (int i = 0; i < N; i++) {
      tree[i] = scanner.nextInt();
    }

    map[0] = 0;

    for (int i = 1; i < N; i++) {
      int min = 999999999;

      for (int j = 1; j <= K; j++) {
        if(i - j < 0)continue;
        min = Math.min(map[i - j] + Math.abs(tree[i - j] - tree[i]), min);
      }

      map[i] = min;

    }

//    for (int i = 0; i < N; i++) {
//      System.out.print(map[i] + " ");
//    }

    System.out.println(map[N - 1]);

  }
}


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

int main() {
	int a, h, hm, m, ms, s;

	cin >> a;
	
	h = a / 3600;
	hm = h * 3600;
	a = a - hm;
	m = a / 60;
	ms = m * 60;
	s = a - ms;

	cout << h << ":" << m << ":" << s << endl;

	return 0;
}

Measured memory_bytes: 3084
# encoding:utf-8
import copy
import numpy as np
import random

n = int(input())
x = [int(i) for i in input().split()]

x_sorted = sorted(x)

middle = n//2
middle_num = x_sorted[middle]
for i in range(n):
    if x[i] < middle_num:
        print(x_sorted[middle])
    else:
        print(x_sorted[middle-1])


Measured memory_bytes: 35384
import sys
from collections import Counter
n, m = map(int, sys.stdin.readline().split())
cAB = Counter()
for i in range(m):
    a,b = map(int, sys.stdin.readline().split())
    cAB[a] += 1
    cAB[b] += 1
print('YES' if all([cAB[key]%2==0 for key in cAB.keys()]) else 'NO')

Measured memory_bytes: 15136
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;

    vector<ll> p(A), q(B), r(C);

    REP(i, A) cin >> p[i];
    REP(i, B) cin >> q[i];
    REP(i, C) cin >> r[i];

    sort(p.begin(), p.end(), greater<ll>());
    sort(q.begin(), q.end(), greater<ll>());
    sort(r.begin(), r.end(), greater<ll>());

    ll ans = 0;
    REP(i, X) ans += p[i];
    REP(i, Y) ans += q[i];

    p.insert(p.begin(), INF);
    q.insert(q.begin(), INF);
    int pi = X, qi = Y;

    int ri = 0;
    while(ri < C) {
        int pp = p[pi], qq = q[qi], rr = r[ri];

        if (rr <= pp && rr <= qq) break;

        if (pp > qq) {
            ans += rr - qq;
            --qi;
        }
        else {
            ans += rr - pp;
            --pi;
        }

        ++ri;
    }

    cout << ans << endl;
}


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

#define INF (INT64_MAX)
#define MOD (1000000000+7)
#define MAX 16

int N;
long long a[MAX][MAX];
long long sv[1 << MAX];
long long memo[1 << MAX];
 
long long dfs( int i )
{
	if ( memo[i] >= 0 ) {
		return memo[i];
	}
	memo[i] = sv[i];
	for ( int k = 1; k * 2 <= i; k++ ) {
		if( ( k & i ) != k ) {
			continue;
		}
		memo[i] = max( memo[i], dfs( k ) + dfs( k ^ i ) );
	}
	return memo[i];
}

int main() {
	cin >> N;
	for( int i = 0; i < N; i++ ) {
		for( int j = 0; j < N; j++ ) {
			cin >> a[i][j];
		}
	}

	for( int k = 0; k < (1 << N); k++ ) {
		for( int i = 0; i < N; i++ ) {
			if( ( (k >> i) & 1 ) == 0 ) {
				continue;
			}
			for( int j = 0; j < i; j++ ) {
				if( ( (k >> j) & 1 ) == 0 ) {
					continue;
				}
				sv[k] += a[i][j];
			}
		}
	}
	memset( memo, -1, sizeof( memo ) );
	long long ans = dfs( (1 << N) - 1 );

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1280
x=int(input())
l=[]

if x==1:
    print(1)

else:

    for i in range(2,x+1):
        for j in range(1,x+1):
            y=j**i
            if y<=x:
                l.append(y)
            elif y>x:
                break
    print(max(l))

Measured memory_bytes: 2940
def resolve():
    A, B, H, M = list(map(int, input().split()))
    ath = ((H*60+M)/(12*60))*360
    bth = M/60*360
    diff = abs(ath - bth) if abs(ath - bth) < 180 else 360-abs(ath - bth)
    import math
    print(math.sqrt((A**2)+(B**2)-2*A*B*math.cos(2*math.pi*diff/360)))


if '__main__' == __name__:
    resolve()

Measured memory_bytes: 9432
N, M = map(int, input().split())

L, R = 0, float("inf")

for _ in range(M):
    l, r = map(int, input().split())
    if l > L:
        L = l
    if r < R:
        R = r

if L <= R:
    print(R - L + 1)
else:
    print(0)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	int n; cin >> n;
	VI a(n); REP(i,n) cin >> a[i];
	ll ans=0, now=a[0];
	REP(i,n-1){
		ans+=max(0ll,now-a[i+1]);
		now=max(now,a[i+1]);
	}
	cout << ans << endl;
	return 0;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N;
    cin >> N;
    vector<int> A(N, 0);
    rep(i, N) { cin >> A[i]; }
    set<int>se{};
    for(auto a : A){
        se.insert(a);
    }
    if(se.size()==N){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define FOR(i, n) for(ll i = 0; i < n; i++)
#define FORR(i, n) for(ll i = n; i >= 0; i--)
#define FORS(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) accumulate(v.begin(),v.end(),0)
#define SORT(v) sort(v.begin(),v.end())
#define OUT(n) (cout << n << endl)
#define IN1(a) (cin >> a)
#define IN2(a,b) (cin >> a >> b)
#define IN3(a,b,c) (cin >> a >> b >> c)
#define IN4(a,b,c,d) (cin >> a >> b >> c >> d)
#define REVS(v) reverse(v.begin(),v.end())
#define PI 3.14159265359
using namespace std;
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){

  int n;
  IN1(n);

  vector<int>darray(n);
  FOR(i,n){
    cin >> darray.at(i);
  }
  SORT(darray);

  int ans;
  ans = darray[darray.size()/2] - darray[darray.size()/2-1];
  OUT(ans);
}

Measured memory_bytes: 640
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define CONCAT_(x,y) x##y
#define CONCAT(x,y) CONCAT_(x,y)
#define _v1 CONCAT(qyw1, __LINE__) // unique name in same line (otherwise use __COUNTER__)
#define _v2 CONCAT(qyw2, __LINE__)
#define forbits(i, m) for (int _v1 = m, i = __builtin_ctz(_v1); _v1 != 0; _v1 ^= _v1 & -_v1, i = __builtin_ctz(_v1))
#define forsubm(s, m) for (int s = m; s >= 0; s = !s ? -1 : m & (s - 1))
int __nextXZW(int v){int t=v|(v-1);int w=(t+1)|(((~t&-~t)-1)>>(__builtin_ctz(v)+1));return w;}
#define ksets(i, n, k) for (int i = (1u << k) - 1, max = i << (n - k); i <= max; i = __nextXZW(i))
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9+7;
const ll N = 2e5+5, inf = 1e9+5000;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <atcoder/lazysegtree> 
#include <atcoder/modint>
using namespace atcoder;
typedef modint998244353 mint;

mint num_rep[10][N];
mint tens[N];

struct S {
	int sz; 
	mint ans;
};
S op (S a, S b) {
	mint ans = a.ans * tens[b.sz] + b.ans;
	return {
		a.sz + b.sz,
		ans
	};
}
S e() { return { 0, 0 }; }

S mapping (int f, S x) {
	return {
		x.sz,
		f != 0 ? num_rep[f][x.sz] : x.ans
	};
}

int comp (int f, int g) {
	if (f == 0) return g;
	return f;
}

int id() {
	return 0;
}

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

	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j < N; j++) {
			num_rep[i][j] = num_rep[i][j-1]*10+i;
		}
	}
	tens[0] = 1;
	for (int i = 1; i < N; i++) {
		tens[i] = tens[i-1]*10;
	}
  
  int n, q; cin >> n >> q;
	vector<S> a(n);
	rep (i, n) a[i] = {1, 1};

	lazy_segtree<S, op, e, int, mapping, comp, id> st(a);

  while (q--) {
    int l, r, x; cin >> l >> r >> x;
		l--;
		st.apply(l, r, x);
		cout << st.all_prod().ans.val() << '\n';
  }
  
  return 0;
}

Measured memory_bytes: 18544
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<ctime>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<cstdlib>
#include<ctime>
#include<random>
#define ll long long
using namespace std;

char s[10];

int main(){
    scanf("%s",s+1);
    if (s[3]==s[4]&&s[5]==s[6]) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define inf LLONG_MAX-5
#define MAX 10000000
#define mod 1000000007
#define pb push_back
#define mk make_pair
using namespace std;
void solve(){
    ll i,n;
    string x;
    unordered_map<string,int> s;
    cin>>n;
    for (i=0;i<n;i++){
        cin>>x;
        s[x]++;
    }
    cout<<"AC"<<" x "<<s["AC"]<<endl;
    cout<<"WA"<<" x "<<s["WA"]<<endl;
    cout<<"TLE"<<" x "<<s["TLE"]<<endl;
    cout<<"RE"<<" x "<<s["RE"]<<endl;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3648
#define _ 2<<17
A[_];long P[_],M=1e9+7,F[_],I[_]={1},X;i,j,k,t;c(a,b)int*a,*b;{t=a[1]-b[1]?:*a-*b;}p(a,b){return b?p(a%M*a%M,b/2)*(b%2?a:1L)%M:1;}f(a,b){return F[a+b]*I[a]%M*I[b]%M;}main(s){for(;++X<_;)I[X]=p(s=F[X]=X*s%M,M-2);for(;~scanf("%d",A+i);)i++-1||gets(P);for(qsort(A,i/2,8,c);j<i;P[j]=X,j+=2)for(X=f(s=A[k=j]-=1,t=A[j+1]-=1);k;X=s<A[k-=2]?X:(X-f(s-A[k],t-A[k+1])*P[k]%M+M)%M);printf("%d",X);}

Measured memory_bytes: 6400
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b;
    cin >> n >> a >> b;
    vll x(n);
    REP(i,n) cin >> x[i];
    ll ans = 0;
    REP(i,n-1){
        if(a*(x[i+1]-x[i])<=b){
            ans += a*(x[i+1]-x[i]);
        }else{
            ans += b;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3996
import sys
input=sys.stdin.readline
N,W=map(int,input().split())
DP=[[0]*(W+1) for _ in range(N+1)]
for i in range(N):
    w,v=map(int,input().split())
    for j in range(W+1):
        if w>j:
            DP[i+1][j]=DP[i][j]
        else:
            DP[i+1][j]=max(DP[i][j],DP[i][j-w]+v)
print(max(DP[-1]))

Measured memory_bytes: 121436
import sys

if __name__ == '__main__':
    N = int(input())
    T, A = map(int, input().split())
    H = list(map(int, input().split()))

    ans = 0
    best = sys.maxsize
    for i in range(0, N):
        target = T - 0.006 * H[i] - A
        if abs(target) < best:
            best = abs(target)
            ans = i + 1

    print(ans)


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

typedef long long int ll;
ll n;

const ll MOD = 1e9 + 7;

ll fastpow(ll x, ll y) {
    ll ans = 1;
    while(y--) {
        ans *= x;
        ans %= MOD;
    }

    return (ans%MOD + MOD)%MOD;
}

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

    cin >> n;
    cout << ((fastpow(10, n) - 2 * fastpow(9, n) + fastpow(8, n))%MOD + MOD)%MOD << '\n';

    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>

int main(void)
{
	//変数の宣言
	int n;
	int array[10010];
	int i;
	int ans=0;
	
	//データの読み込み
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&array[i]);
	}
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	
	//実際の処理
	
	for(i=0;i<n;i++){
		while(array[i]%2==0){
			ans++;
			array[i]=array[i]/2;
		}
	}
	
	
//	printf("計算部分終了\n");
	
	//出力
	
	printf("%d",ans);
	
//	printf("結果の出力終了\n");
	
	return 0;
}


Measured memory_bytes: 256
a, b, c, x, y = gets.chomp.split(" ").map(&:to_i)

price1 = a * x + b * y
price2 = c * 2 * x + b * [y - x, 0].max
price3 = a * [x - y, 0].max + c * 2 * y

puts [price1, price2, price3].min

Measured memory_bytes: 1916
#include<stdio.h>
#define N 100

int main(){
  int i, j, k, key, n, A[N];
  scanf("%d", &n);
  for(i = 0; i < n ; i++)scanf("%d", &A[i]);
  for(i = 1; i <= n; i++){
    key = A[i];
    j = i - 1;
    for(k=0; k < n; k++){
      printf("%d", A[k]);
      if(k < n-1)printf(" ");
    }
    printf("\n");
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
      A[j+1] = key;
    }
  }
  return 0;
}

Measured memory_bytes: 600
/*
Contest: AtCoder Regular Contest
C - Traveling Plan
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN int(1e5)
int n,tot;
int poi[MAXN+5];
int main()
{
	//freopen("in.txt","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&poi[i]),tot+=abs(poi[i-1]-poi[i]);
	tot+=abs(poi[n]);
	for(int i=1;i<=n;i++)
	{
		int ans=tot;
		if(i==n)
			ans=ans-abs(poi[n])-abs(poi[n-1]-poi[n])+abs(poi[n-1]);
		else
			ans=ans-abs(poi[i-1]-poi[i])-abs(poi[i]-poi[i+1])+abs(poi[i-1]-poi[i+1]);
		printf("%d\n",ans);
	}
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799;


double n;
double a[100];
double ans = 0;

int main(){
  cin >> n;
  rep(i, n) cin >> a[i];
  rep(i, n) ans += 1/a[i];
  cout << setprecision(10) << 1/ans <<endl;
}

Measured memory_bytes: 256
# 2 つの正整数 a , b が与えられます。
# a と b の積が偶数か奇数か判定してください。

# 2つの正整数を取得
input = gets.chomp.split
a = input[0].to_i
b = input[1].to_i

# 2つの正整数の積を計算
product = a * b

# 偶数か奇数かの結果を格納する変数を宣言
result = String.new

# 偶数か奇数か判定
if product.even?
  result = "Even"
else
  result = "Odd"
end

# 結果を出力
puts result

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

const int N = 2e5 + 10;

int a[N];

int main(){
	int n;
	long long sum;
	scanf("%d",&n);
	for (int i = 1; i <= n; i++){
		scanf("%d",&a[i]);
		a[i] -= i;
	}
	sort(a + 1, a + n + 1);
	sum = 0;
	for (int i = 1; i <= n; i++) sum += abs(a[i] - a[(n + 1) / 2]);
	printf("%lld\n", sum);
	return 0;
} 

Measured memory_bytes: 1024
/*
.....            
.        .       *
.....   . .      .
    .  .....     .
..... .     .    .
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
   
using namespace std;
   
template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}
   
template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}
#define int long  long
#define left left228
#define right right228
#define prev prev228

const int N = 100 * 1000 + 228;

int a[N];

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> crd;
	for (int i = 1; i <= n; ++i) cin >> a[i], crd.push_back(a[i]);
	sort(crd.begin(), crd.end());
	for (int i = 1; i <= n; ++i) a[i] = lower_bound(crd.begin(), crd.end(), a[i]) - crd.begin() + 1;
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		if (a[i] % 2 != i % 2) ++cnt;
	}
	cout << cnt / 2 << endl;
	return 0;
}


Measured memory_bytes: 1912
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int main() {
    int x, y; cin >> x >> y;
    set<int> a = {1,3,5,7,8,10,12};
    set<int> b = {4,6,9,11};
    set<int> c = {2};
    char x_group, y_group;
    if (a.find(x) != a.end()) x_group = 'a';
    if (b.find(x) != b.end()) x_group = 'b';
    if (c.find(x) != c.end()) x_group = 'c';
    if (a.find(y) != a.end()) y_group = 'a';
    if (b.find(y) != b.end()) y_group = 'b';
    if (c.find(y) != c.end()) y_group = 'c';
    if (x_group == y_group) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vi a(n);
    rep(i,n){
        cin >> a[i];
    }
    double sm = (double)accumulate(all(a),0)/n;
    double mn = 1e100;
    int ans = -1;
    rep(i,n){
        if(abs(a[i]-sm) < mn-EPS){
            mn = abs(a[i]-sm);
            ans = i;
        }
    }
    cout << ans << "\n";
    return 0;
}

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

//define
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long

//constant
const int MOD = 1000000007;

//typedef
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

int main(){
	int n;
	int x;
	cin >> n >> x;
	if (x == 1 || x == 2 * n - 1) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	if (n == 2) {
		for (int i = 0; i < 3; i++)
			cout << i + 1 << endl;
		return 0;
	}
	if (x == 2*n-2) {
		stack<int> st;
		for (int i = 1; i <= 2 * n - 1; i++) {
			if (i != x -1 && i != x && i != 1 && i != 2 * n - 1)
				st.push(i);
		}
		for (int i = 1; i <= n - 2; i++) {
			cout << st.top() << endl;
			st.pop();
		}
		
		cout << 2 * n - 1 << endl;
		cout << x << endl;
		cout << x - 1 << endl;
		cout << 1 << endl;

		for (int i = n+3; i <= 2*n-1; i++) {
			cout << st.top() << endl;
			st.pop();
		}
		
		

		return 0;
	}
	stack<int> st;
	for (int i = 1; i <= 2*n - 1; i++) {
		if (i != x + 1 && i != x && i != 1 && i != 2 * n - 1)
			st.push(i);
	}
	for (int i = 1; i <= n - 2; i++) {
		cout << st.top() << endl;
		st.pop();
	}
	cout << x+1 << endl;
	cout << x << endl;
	cout << 1 << endl;
	cout << 2*n-1 << endl;
	for (int i = n+3; i <= 2*n - 1; i++) {
		cout << st.top() << endl;
		st.pop();
	}
	
}

Measured memory_bytes: 2096
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[m];
        int[] b = new int[m];
        for (int i = 0 ; i < m ; i++) {
            a[i] = sc.nextInt() - 1;
            b[i] = sc.nextInt() - 1;
        }
        long[] ans = new long[m];
        ans[m - 1] = (long) n * (n - 1) / 2;

        UnionFindTree uf = new UnionFindTree(n);

        for (int i = m - 1; i >= 1; i--) {
            ans[i - 1] = ans[i];
            if (uf.find(a[i]) != uf.find(b[i])) {
                ans[i - 1] -= (long) uf.size(a[i]) * uf.size(b[i]);
                uf.union(a[i], b[i]);
            }
        }

        for (int i = 0; i < m; i++) {
            System.out.println(ans[i]);
        }
    }

    static class UnionFindTree {
        ArrayList<Integer> parent;

        public UnionFindTree(int size) {
            parent = new ArrayList<>();
            for (int i = 0; i < size; i++) {
                parent.add(-1);
            }
        }

        public boolean union(int x, int y) {

            x = find(x);
            y = find(y);
            if (x == y) {
                return false;
            }

            if (size(x) < size(y)) {
                int temp = x;
                x = y;
                y = temp;
            }

            parent.set(x, parent.get(x) + parent.get(y));

            parent.set(y, x);
            return true;
        }

        //引数の属する木のrootのidを返す。
        public int find(int i) {
            if (parent.get(i) < 0) {
                return i;
            } else {
                int root = find(parent.get(i));
                parent.set(i, root);
                return root;
            }
        }

//        //同じ木に属しているか判定
//        public boolean same(int x, int y) {
//            return find(x) == find(y);
//        }

        public int size(int x) {
            return -parent.get(find(x));
        }
    }

}

Measured memory_bytes: 96840
def sieve(n):
    primes = [True] * n
    primes[0] = primes[1] = False
    for i in xrange(2, int(n ** 0.5) + 1):
        if primes[i]:
            for j in xrange(i * i, n, i):
                primes[j] = False
    return [i for i in xrange(n) if primes[i]]

primes_a = sieve(25000)
primes_b = set(sieve(50000))
while 1:
    n = input()
    if n == 0:
        break
    ret = 0
    for prime in primes_a:
        if prime > n / 2:
            break
        if n - prime in primes_b:
            ret += 1
    print ret

Measured memory_bytes: 4744
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<deque>
#include<iomanip>
#include<set>
#include<unordered_set>
#include<tuple>
#include<map>
#include<memory>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<double> VD;
typedef pair<int, int> P1;
typedef long long int ll;

//number
#define INF 1e9
#define NUM 1000000007

//itr
#define all(x) begin(x),end(x)

//repeat
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define RREPS(i,x) for(int i=((int)(x));i>=0;i--)

//max,min
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

/*ll gcd(ll a, ll b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}*/

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a * (b / g);
}*/

int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}

//grid template
int x[] = { -1, 0, 1, 0 };
int y[] = { 0,-1,0,1 };
int xx[] = { -1,-1,1,1 };
int yy[] = { 1,-1,1,-1 };

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

	string s;
	cin >> s;
	VI t(n,0);

	rep(i, n-1) {
		if (s[i] == 'A'&& s[i+1] == 'C') {
			t[i+1] = 1;
		}
	}
	rep(i, n) t[i + 1] += t[i];

	int a, b;
	rep(i, q) {
		cin >> a >> b;
		cout << t[b - 1] - t[a - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1408
fn main() {
  let (N, X): (i32, i32) = {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut iter = s.split_whitespace();
    (
      iter.next().unwrap().parse().unwrap(),
      iter.next().unwrap().parse().unwrap()
    )
  };
  let L: Vec<i32> = {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
  };
  let mut d = 0;
  let mut iter = L.iter();
  let mut count = 0;
  while d <= X {
    count += 1;
    match iter.next() {
      Some(x) => d += x,
      None => break
    };
  }
  println!("{}", count);
}

Measured memory_bytes: 2072
N = int(input())
S = [input() for i in range(N)]
ac = S.count("AC")
wa = S.count("WA")
tle = S.count("TLE")
re = S.count("RE")
print(f"AC x {ac}")
print(f"WA x {wa}")
print(f"TLE x {tle}")
print(f"RE x {re}")


Measured memory_bytes: 16132
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rep_ll(i,n) for(ll i = 0; i < (ll)(n); i++)
using namespace std;
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
const long double PI = (acos(-1));
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1};
ll mod = 1000000007;
int main(){
    ll n;
    cin >> n;
    ll ori_n = n;
    ll sq = sqrt(n);
    ll ans=0;
    vector<ll> res(sq+1,0);
    for(ll i=2; i < sq+1; i++){
        if(n==1) break;
        if(n%i==0) {
            while(n%i==0){
                n/=i;
                res[i]++;
            }
        }
    }
    //for(int i=2; i < sq+1; i++) cout << res[i] << endl;
    for(ll i=2; i < sq+1; i++){
        ll cnt=0;
        while(res[i]>=0){
            cnt++;
            res[i]-=cnt;
        }
        //cout << cnt << endl;
        if(cnt==0) continue;
        else ans= ans + cnt-1;
    }
    if((ori_n==1)&&(ans==0)) ans = 0;
    else if((n!=1)&&(ans==0)) ans = 1;
    else if((n!=1)&&(ans!=0)) ans++;
    cout << ans;
}

Measured memory_bytes: 11244
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

bool judge_cap(char);

int main(void){
  string str;
  cin >> str;
  int counter = 0;
  int len = str.size();
  
  if(str[0] != 'A' || judge_cap(str[1])){
    cout << "WA" << endl; return 0;
  } else {
    for(int i = 2; i <= len - 2; i++){
      if(str[i] == 'C'){
	counter++;
      } else if(judge_cap(str[i])){
	cout << "WA" << endl; return 0;
      } else {
	
      }
    }
  }
  if(judge_cap(str[len-1]) || counter != 1){
    cout << "WA" << endl; return 0;
  } else {
    cout << "AC" << endl; return 0;
  }
}
bool judge_cap(char c){
  if(c >= 'A' && c <= 'Z'){
    return true;
  } else {
    return false;
  }
}

Measured memory_bytes: 256
N = int(input())

if N % 10 == 2 or N % 10 == 4 or N % 10 == 5 or N % 10 == 7 or N % 10 == 9:
    print("hon")

elif N % 10 == 0 or N % 10 == 1 or N % 10 == 6 or N % 10 == 8:
    print("pon")

else:
    print("bon")

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

int main(){
  int H, N;
  int sum = 0;
  
  cin >> H >> N ;
  
  while(N--){
    int x;
    cin >> x;
    sum += x;
  }
  if(sum >= H) cout << "Yes";
  else cout << "No";
}

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

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=n-1;i>=m;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };

typedef long long ll;
using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<ll> a(n), b(n);
	REP(i, n) {
		cin >> a[i]>>b[i];
	}
	ll tmp = 0;
	RREP(i, n) {
		if((a[i]+tmp)%b[i]!=0&&a[i]!=0)tmp += b[i] - (a[i] + tmp) % b[i];
	}
	cout << tmp << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

void printAns(long long a) { cout << a << endl; }

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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

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

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

//using Graph = vector<vector<pair<int, int>>>;
//Graph G(100100);


//番号ズレ注意！！
int main() {
    int N;
    cin >> N;
    vector<int> A;
    int minus = 0;
    REP(i, N) {
        int tmp;
        cin >> tmp;
        if (tmp < 0) {
            minus++;
            tmp *= -1;
        }
        A.push_back(tmp);
    }
    sort(A.begin(), A.end());
    REP(i, minus % 2) {
        A[i] *= -1;
    }
    ll sum = 0;
    REP(i, N) {
        sum += A[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=2e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;
const ll Mbit = 22;

ll d[MAXn];
int main(){
  IOS();
  ll n;
  cin >> n;
  REP (i,n) cin >> d[i];

  ll ans = 0,mask = 0,lst = 0;
  REP (i,n) {
    while (lst < n && !(mask&d[lst])) {
      mask |= d[lst];
      lst++;
    }
    debug(lst);
    ans += lst-i;
    mask ^= d[i];
  }
  cout << ans << endl;
}


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

using namespace std;

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

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

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

  ll n;
  cin >> n;
  vll a(n);
  rep(i, n) {
    cin >> a[i];
  }

  // dp[何個取ったか][右から何個取ったか]
  vvll dp(n + 1, vll(n + 2));

  for (int i = n - 1; i >= 0; i--) {
    rep(j, i + 1) {
      if (i % 2 == 0) {
        dp[i][j] = dp[i + 1][j] + a[i - j];
        chmax(dp[i][j], dp[i + 1][j + 1] + a[n - 1 - j]);
      } else {
        dp[i][j] = dp[i + 1][j] - a[i - j];
        chmin(dp[i][j], dp[i + 1][j + 1] - a[n - 1 - j]);
      }
    }
  }

  cout << dp[0][0] << endl;

  return 0;
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  ll N, A, B;
  cin >> N >> A >> B;
  if (A > B)
  {
    cout << 0 << endl;
  }
  else if (N == 1)
  {
    if (A != B)
    {
      cout << 0 << endl;
    }
    else
    {
      cout << 1 << endl;
    }
  }
  else
  {
    cout << (B - A) * (N - 2) + 1 << endl;
  }
  return 0;
}

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

int main(){
	int h, m, s, time, ans1, ans2, ah, am, as;
	while(1){
		scanf("%d %d %d", &h, &m, &s);
		if(h==-1 && m==-1 && s==-1) break;
		time = h*60*60 + m*60 + s;
		ans1 = 120*60 - time;
		ans2 = ans1 * 3;
		as = ans1%60;
		am = (ans1/60)%60;
		ah = ans1/3600;
		printf("%02d:%02d:%02d\n", ah, am, as);
		as = ans2%60;
		am = (ans2/60)%60;
		ah = ans2/60/60;
		printf("%02d:%02d:%02d\n", ah, am, as);
	}
	
	return 0;
}

Measured memory_bytes: 0
use std::io::Read;
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let t: f32 = iter.next().unwrap().parse().unwrap();
    let x: f32 = iter.next().unwrap().parse().unwrap();

    println!("{}", t / x);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
typedef long long ll;
#define rep(i,l,r) for(int i=l; i<(int)(r); i++)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
int upcmpll(const void *a, const void *b){
    return (*(ll*)a == *(ll*)b ? 0 : (*(ll*)a > *(ll*)b ? 1 : -1));
}
void sort_u(ll *a, int n){ qsort(a, n, sizeof(ll), upcmpll); }

int k[12], s[12][12], p[12];

int main(){
    int n,m; scanf("%d%d", &n, &m);
    rep(i,0,m){
        scanf("%d", k+i);
        rep(j,0,k[i]){
            scanf("%d", &s[i][j]);
        }
    }
    rep(i,0,m) scanf("%d", p+i);

    int ans = 0;
    //ビット全探索　初期値は0 (ans=0あり)
    rep(bit, 0, (1 << n)) {
        int t_lmp = 0;
        rep(i, 0, m) {
            int tmp_sum = 0;
            rep(j, 0, k[i]){
                if(bit&(1<<(s[i][j]-1))) tmp_sum++;
            }
            if(tmp_sum%2 == p[i]) t_lmp++;
            else break;
        }
        if(t_lmp == m) ans++;
    }

    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1720