akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    int x, y;   cin >> x >> y;
    
    if (a[x] == a[y])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN = 1e5 + 5;

ll fastPow(ll x, ll b) {
    if (b == 0)
        return 1;
    else if (!(b & 1)) {
        return fastPow(x * x, b / 2);
    } else
        return x * fastPow(x * x, (b - 1) / 2);
}

//__builtin_popcount ();
bool arr[105][105];

int main() {
    FAST
    int r, c, n;
    cin >> r >> c >> n;
    for (int i = 0; i < n; i++) {
        int x, y, a;
        cin >> x >> y >> a;
        //x--,y--;
        if (a == 1) {
            for (int i = 1; i <= r; i++) {
                for (int j = 1; j <= c; j++) {
                    if (i <= x) {
                        arr[i][j] = 1;
                    }
                }
            }

        } else if (a == 2) {
            for (int i = 1; i <= r; i++) {
                for (int j = 1; j <= c; j++) {
                    if (i > x) {
                        arr[i][j] = 1;
                    }
                }
            }
        } else if (a == 3) {
            for (int i = 1; i <= r; i++) {
                for (int j = 1; j <= c; j++) {
                    if (j <= y) {
                        arr[i][j] = 1;
                    }
                }
            }

        } else {
            for (int i = 1; i <= r; i++) {
                for (int j = 1; j <= c; j++) {
                    if (j > y) {
                        arr[i][j] = 1;
                    }
                }
            }

        }
    }

    int ans = 0;
    for (int i = 1; i <= r; i++) {
        for (int j = 1; j <= c; j++) {
         //   cout << arr[i][j] << " ";
            if (!arr[i][j])
                ans++;
        }
        //cout << endl;
    }
    cout << ans << endl;


    return 0;
}

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

int main(void){
  int n,x,count=0,sum=0,l;
  cin >> n >> x;
  count++;
  for(int i = 0;i < n;i++){
    cin >> l;
    sum += l;
    if(sum > x){
      break;
    }
    count++;
  }
  cout << count;
  return 0;
}


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

int parse(string a){
int s=0;
for(char b:a){
	s*=10;
	s+=b-48;
}
return s;
}
vector<int>split(string a){
	vector<int>b;
	string c="";
	for(char d:a){
		if(d==','){b.push_back(parse(c));c="";}
		else c+=d;
	}
	b.push_back(parse(c));
	return b;
}
int main() {
	int u=1;
 int a,b;
 while(cin>>b,b){
 	cin>>a;
 vector<vector<int>>dp(a+1,vector<int>(b+1));
 for(int c=0;c<a;c++){
 	string q;
 	cin>>q;
 	int d,e;
 	d=split(q)[0];
 	e=split(q)[1];
 	for(int f=0;f<b+1;f++){
 		if(f<e)dp[c+1][f]=dp[c][f];
 		else dp[c+1][f]=max(dp[c][f],dp[c][f-e]+d);
 	}
 }
 cout<<"Case "<<u<<":"<<endl;
 int y=0,z=0;
 for(int x=0;x<b+1;x++){
 	if(dp[a][x]>y){y=dp[a][x];z=x;}
 }
 cout<<y<<endl<<z<<endl;
 u++;
 }
}

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

#define ll long long
#define mod 1000000007
#define debug1(x) cerr<<#x<<" : "<<x<<"\n";
#define debug2(x,y) cerr<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


int main() {
    IOS;
    ll n;
    cin>>n;
    ll a[n],sum=0;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        sum = (sum+a[i])%mod;
    }
    ll ans=0;
    for(ll i=0;i<n-1;i++){
        sum-=a[i];
        if(sum<0)sum+=mod;
        ans = ( ans + (a[i]*(sum))%mod )%mod;
    }
    cout<<ans;

    return 0 ;
}


Measured memory_bytes: 5172
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <iomanip>
#include <functional>

#define SIZE 300005
#define INF 1000000000
#define FD(d) fixed << setprecision(d)
#define MOD 1000000007
#define ll long long

using namespace std;

typedef pair<ll, ll> P;

int main()
{
	int N, K, X, Y;
	int res;

	cin >> N >> K >> X >> Y;

	if (N <= K) {
		res = N * X;
	}
	else {
		res = K * X + (N-K) * Y;
	}

	cout << res << endl;
	
	return(0);

}


Measured memory_bytes: 764
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using ll = long long;
using namespace std;

void solve() {

    string s;
    cin>>s; int count = 0, m=0;
    int i=0, n = 3;
    while(i<n){
        count = 0;
        if(s[i]!='R') i++;

        else{
            while(s[i]=='R'){
                count++;
                i++;
            }
            m = max(m, count);
        }
    }
    cout<<m<<'\n';
}

int main() 
{
    std::ios::sync_with_stdio(false); \
        std::cin.tie(NULL);
    int test;
   test = 1;
    while (test--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a>b){
        cout<<"a"<<" "<<">"<<" "<<"b"<<endl;
    }else if(a<b){
        cout<<"a"<<" "<<"<"<<" "<<"b"<<endl;
    }else{
        cout<<"a"<<" "<<"=="<<" "<<"b"<<endl;
    }return 0;
}


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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  for (int i=0; i<n-1; i++) {
    if (s[i] == s[i+1]) {
      cout << i+1 << ' ' << i+2 << endl;
      return 0;
    }
  }
  for (int i=0; i<n-2; i++) {
    if (s[i] == s[i+2]) {
      cout << i+1 << ' ' << i+3 << endl;
      return 0;
    }
  }
  cout << -1 << ' ' << -1 << endl;
  return 0;
}


Measured memory_bytes: 3748
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

#define Pig (OO)

using namespace std;

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

const int Days[]={-1,31,28,31,30,31,30,31,31,30,31,30,31};

inline int read()
{
	#define gc getchar
	int ans=0;
	bool f=1;
	char ch=gc();
	
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	
	return f?ans:-ans;
	
	#undef gc
}

typedef long long ll;

int n,k;
ll h[310];
ll DP[310][310][310];

ll DFS(ll lvl,ll cnt,ll idx)
{
	if(DP[lvl][cnt][idx]!=-1)return DP[lvl][cnt][idx];
	
	if(lvl==n)return 0ll;
	
	return DP[lvl][cnt][idx]=min(DFS(lvl+1,cnt,lvl)+max(0ll,h[lvl]-h[idx]),(cnt<k ? DFS(lvl+1,cnt+1,idx) : 1000000000000000000ll));
}

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	for(int i=0;i<310;i++)for(int j=0;j<310;j++)for(int k=0;k<310;k++)DP[i][j][k]=-1;
	
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>h[i];
	
	cout<<DFS(0ll,0ll,n*1ll);
	
	//printf("Time used = %.12f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

/*  GOD BLESS  */


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

int main(void)
{
    string day[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string s;
    cin >> s;
    int ans=0;
    for(int i=0; i<7; i++)
    {
        if(day[i] == s)
        {
            ans = 7-i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
	char a, b;
	cin >> a >> b;
	if(a == 'H'){
			if(b == 'H')cout << 'H' << endl;
			else cout << 'D' << endl;
	}else{
			if(b == 'D')cout << 'H' << endl;
			else cout << 'D' << endl;

	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n;
    cin>>n;
    int A[100000];
    for(int i=0;i<n;i++) cin>>A[i];
    int m=0;
    for(int i=0;i<n;i++){
        if(m<A[i]) m=A[i];
    }
  if(n==2) cout<<max(A[0],A[1])<<endl<<min(A[0],A[1])<<endl;
  else{
    int p=1000000001,q;
    for(int i=0;i<n;i++){
        if(p>max(A[i]-m/2,m/2-A[i])) p=max(A[i]-m/2,m/2-A[i]),q=A[i];
    }
    cout<<m<<endl<<q<<endl;
  }
}

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()

ans = set()
def rec(i, S):
    if S in ans:
        return
    if i == N:
        ans.add(S)
        return
    # 今までに出現した文字は全部追加できる
    for c in S:
        rec(i+1, S+c)
    # 今までに出現した中で最大の文字の次も追加できる
    rec(i+1, S+chr(ord(max(S))+1))
rec(1, 'a')
ans = sorted(ans)
[print(s) for s in ans]


Measured memory_bytes: 78812
import sys
from bisect import bisect
F = sys.stdin
A, B, Q = map(int, F.readline().strip("\n").split(" "))
S, T =[None] * (A+2), [None] * (B+2)
S[0], T[0] = -10**20, -10**20
for i in range(A):
    S[i+1] = int(F.readline().strip("\n"))
for i in range(B):
    T[i+1] = int(F.readline().strip("\n"))
S[A+1] = 10**20
T[B+1] = 10**20

lenS, lenT = len(S), len(T)
for _ in range(Q):
    x = int(F.readline().strip("\n"))
    si, ti = bisect(S, x, 0, lenS), bisect(T, x, 0, lenT)
    sLength0, sLength1 = x - S[si-1], S[si] - x
    tLength0, tLength1 = x - T[ti-1], T[ti] - x
    Ans = (max(sLength0, tLength0), max(sLength1, tLength1), sLength0 + tLength1 + min(sLength0, tLength1), sLength1 + tLength0 + min(sLength1, tLength0))
    print(min(Ans))

Measured memory_bytes: 12180
#include <iostream>

using namespace std;

int main()
{
    string s, t, u;
    int a, b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if (s == u) --a;
    else --b;

    cout << a << " " << b << endl;

    return 0;
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		var N = ri();
		Console.WriteLine(N >= 30 ? "Yes" : "No");
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int main() {
    ll N, C;
    cin >> N >> C;
    vl X(N), V(N);
    rep(i, N) {
        cin >> X[i] >> V[i];
    }

    // 先頭からみる用のvector
    vl AX(N + 1), AV(N + 1);
    rep(i, N) { AX[i + 1] = X[i]; AV[i + 1] = V[i]; }
    rep(i, N) { AV[i + 1] += AV[i]; }

    // 後ろからみる用のvecotr
    vl BX(N + 1), BV(N + 1);
    rep(i, N) { BX[i + 1] = C - X[N - i - 1]; BV[i + 1] = V[N - i - 1]; }
    rep(i, N) { BV[i + 1] += BV[i]; }

    // AとBの組み合わせを全探索したのではO(N^2)なので間に合わない
    // Aの要素を固定した時の最大のBを事前に計算しておく(s2 - d2)
    vl BM(N + 1);
    ll tmpbmax = 0;
    for (int i = 0; i < N + 1; i++) {
        ll b = BV[i] - BX[i];
        if (b > tmpbmax) {
            tmpbmax = b;
        }
        BM[i] = tmpbmax;
    }

    // Bの要素を固定した時の最大のAを事前に計算しておく(s1 - d1)
    vl AM(N + 1);
    ll tmpamax = 0;
    for (int i = 0; i < N + 1; i++) {
        ll a = AV[i] - AX[i];
        if (a > tmpamax) {
            tmpamax = a;
        }
        AM[i] = tmpamax;
    }

    ll ans = 0;
    // (s1 - 2 * d1) + (s2 - d2)のパターン
    for (int i = 0; i < N + 1; i++) {
        ll d1 = AX[i];
        ll s1 = AV[i];
        ans = max(ans, (s1 - 2 * d1 + BM[N - i]));
    }

    // (s2 - 2 * d2) + (s1 - d1)のパターン
    for (int i = 0; i < N + 1; i++) {
        ll d2 = BX[i];
        ll s2 = BV[i];
        ans = max(ans, (s2 - 2 * d2 + AM[N - i]));
    }

    cout << ans << endl;
}

Measured memory_bytes: 9588
#include <algorithm>
#include <iostream>
#include <vector>
#include <array>
#include <cmath>

using namespace std;

int main(int argc, const char *argv[])
{
  int n, m;
  cin >> n >> m;
  vector<int> digits(n, -1);
  bool exists = true;
  for (int i = 0; i < m; i++) {
    int s, c;
    cin >> s >> c;
    int idx = n - s;

    if ((n > 1 && s == 1 && c == 0) || (digits[idx] != -1 && digits[idx] != c)) {
      exists = false;
      break;
    }
    
    digits[idx] = c;
  }
  

  if (!exists) {
    cout << -1 << "\n";
    return 0;
  }

  if (n > 1 && digits[n - 1] == -1) {
    digits[n - 1] = 1;
  }

  int result = 0;
  for (int i = 0; i < n; i++) {
    result += pow(10, i) * max(digits[i], 0);
  }

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

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	N := nextInt()
	_ = nextInt()
	AMap := map[int]int{}
	for i := 0; N > i; i++ {
		K := nextInt()
		for j := 0; K > j; j++ {
			AMap[nextInt()]++
		}
	}

	var cnt int
	for _, v := range AMap {
		if N == v {
			cnt++
		}
	}

	fmt.Println(cnt)
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


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

int main() {
  int n;
  cin >> n;
  
  vector<int> x(n);
  for(int i=0; i<n; i++) cin >> x[i];
  sort(x.begin(), x.end());
  
  int min = x[0];
  int max = x[n-1];
  int ans = 1000000000;
  for(int i=min; i<=max; i++) {
    int sum = 0;
    for(int j=0; j<n; j++) sum += (i-x[j])*(i-x[j]);
    if(ans>sum) ans = sum;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3524
#include<bits/stdc++.h>
int h,m,t1,t2,K;
int main(){
	scanf("%d%d",&h,&m);
	t1=h*60+m;
	scanf("%d%d",&h,&m);
	t2=h*60+m;
	scanf("%d",&K);K=t2-t1-K;
	printf("%d\n",K);
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

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

int main()
{
    string sd,s,t;
    bool a = false;
    cin >> sd >> t;
    s = sd;
    rep(i, sd.size() - t.size() + 1){
        rep(j, t.size()){
            if (sd[s.size() - i - j - 1] != t[t.size() - j - 1] && sd[s.size() - i - j - 1] != '?') {
                goto loopend;
            }
        }
        a = true;
        s.replace(s.size() - t.size() - i, t.size(), t);
        replace(s.begin(), s.end(), '?', 'a');
        break;
    loopend:;
    }
    if (a) {
        cout << s << endl;
    }else{
        cout << "UNRESTORABLE" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int solve( const std::string &s ) {
    int ans;
    int fst = 0, lst = s.size()-1;
    while (s[fst] != 'A') ++fst;
    while (s[lst] != 'Z') --lst;
    return lst - fst + 1;
}

int main() {
    std::string s;
    std::cin >> s;
    std::cout << solve( s ) << std::endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf 10000000000000
#define mod 1000000007
#define maxn 100009
#define maxr 100009
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	ll n;
	rl(n);
	VL tw(n+1),h(n);
	fr(i,0,n+1)
	{
		rl(tw[i]);
	}
	fr(i,0,n)
		rl(h[i]);
	ll ans=0;
	fr(i,0,n)
	{
		if(tw[i]<=h[i])
		{
			h[i]-=tw[i];
			ans+=tw[i];
			tw[i]=0;
			if(tw[i+1]<=h[i])
			{
				ans+=tw[i+1];
				tw[i+1]=0;
			}
			else
			{
				ans+=h[i];
				tw[i+1]-=h[i];
			}
		}
		else
		{
			ans+=h[i];
		}
	}
	wl(ans);
	NL;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main(){
  int N;
  string out = "";
  string tp = "";

  cin >> N;
  cin >> tp;
  out = tp;
  int bnum=0;
  int knum=0;

  for(int i=0;i<N;++i){
    if(tp[i] == ')'){
      bnum--;
    }else{
      bnum++;
    }
    if(bnum<0){
      out="(" + out;
      bnum = 0;
    }
  }
  for(int i=0;i<bnum;++i){
    out=out+")";
  }
  cout<<out;

}


Measured memory_bytes: 256
object Main extends App {
  val Array(a, b, c, x) = Iterator.continually(io.StdIn.readLine.toInt)
    .take(4).toArray

  val ans = {
    var cnt = 0
      for {
        i <- 0 to a takeWhile (_*500 <= x)
        c0 = 500*i
        j <- 0 to b takeWhile (c0 + _*100 <= x)
        c1 = 100*j
        k <- 0 to c
        if c0 + c1 + 50*k == x
      } cnt += 1
    cnt
  }

  println(ans)
}

Measured memory_bytes: 27328
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long 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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    vvi a(3, vi(3));
    rep(i, 3) rep(j, 3) cin >> a[i][j];
    bool ans = true;
    rep(i, 2) rep(j, 2) if (a[i][j] - a[i+1][j] != a[i][j+1] - a[i+1][j+1]) ans = false;
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n,k; cin >> n >> k; vl pnt(n);
  
  rep(i,n) cin >> pnt[i];
  
  for(ll i=0; i+k < n; i++){
    if(pnt[i] < pnt[i+k]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  
}

Measured memory_bytes: 4844
from math import factorial

def resolve():
	n, m = map(int, input().split())
	mod = 10**9+7
	if abs(n - m) > 1:
		print(0)
		return
	a = factorial(m) % mod * factorial(n) % mod
	if (n + m) % 2 == 0:
		a = a * 2 % mod
	print(a)
resolve()

Measured memory_bytes: 4092
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
int main(){
    
	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);
    int k;
    cin>>k;
    string s;
    cin>>s;
    if(s.length()<=k)cout<<s<<"\n";
    else
    {
    	cout<<s.substr(0,k)+"..."<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  string d[4]={"dream","dreamer","erase","eraser"};
  reverse(s.begin(),s.end());
  for(int i = 0; i < 4; ++i) reverse(d[i].begin(),d[i].end());
  bool can = true;
  for(int i = 0; i < s.size();){
    bool anko = false;
    for(int j = 0; j < 4; ++j){
      string t = d[j];
      if(s.substr(i,t.size()) == t){
        anko = true;
        i += t.size();
      }
    }
    if(!anko){
      can = false;
      break;
    }
  }
  if(can) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 512
N = int(input())
cnt_li = [0, 0, 0, 0, 0]
comb = [
    [0, 1, 2],
    [0, 1, 3],
    [0, 1, 4],
    [0, 2, 3],
    [0, 2, 4],
    [0, 3, 4],
    [1, 2, 3],
    [1, 2, 4],
    [1, 3, 4],
    [2, 3, 4],
]
for _ in range(N):
    s = input()
    if s[0] == 'M':
        cnt_li[0] += 1
    if s[0] == 'A':
        cnt_li[1] += 1
    if s[0] == 'R':
        cnt_li[2] += 1
    if s[0] == 'C':
        cnt_li[3] += 1
    if s[0] == 'H':
        cnt_li[4] += 1
ans = 0
for i in range(len(comb)):
    one, two, three = comb[i]
    mid = cnt_li[one] * cnt_li[two] * cnt_li[three]
    ans += mid
print(ans)


Measured memory_bytes: 74724
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);

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

  int n; cin >> n;
  vector<ll> a(5, 0);

  rep(i, n) {
    string s; cin >> s;
    if (s[0] == 'M') a[0]++;
    else if (s[0] == 'A') a[1]++;
    else if (s[0] == 'R') a[2]++;
    else if (s[0] == 'C') a[3]++;
    else if (s[0] == 'H') a[4]++;
  }

  ll ans = 0;
  for (int bit = 0; bit < (1<<5); bit++) {
    bitset<5> bs(bit);
    if (bs.count() != 3) continue;
    ll tmp = 1;
    for (int i = 0; i < 5; i++) {
      if ((bit >> i) & 1 == 1) {
        tmp *= a[i];
      }
    }
    ans += tmp;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
  int i,a,b,c,j,k,l,f=1,t=0,m;
  cin>>m;
  a=m;b=m;c=m;
  for(i=1;i<=a;i++){
    for(j=1;j<=b;j++){
      for(k=1;k<=c;k++){
        l=min(i,min(j,k));
        while(f==1){
          if(i%l==0&&j%l==0&&k%l==0){
            f++;
            
            t=l+t;
            //cout<<i<<j<<k<<t<<l<<endl;
          }
          l--;
        }
        f=1;
      }
    }
  }
  cout<<t<<endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define M 1000000007
#define endl "\n"
#define ll long long
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	ll a{0};
	ll b{0};
	ll c{0};
	ll k{0};
	cin>>a>>b>>c>>k;

	ll count{0};
	while(b<=a){
		count++;
		b=b*2;
	}

	while(c<=b){
		count++;
		c=c*2;
	}

	if(count<=k)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	
	return 0;
}



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

int main(){
    map<string, int> m;
    int N;  cin >> N;
    for(int i=0; i<N; i++){
        string s;  cin >> s;
        if(m.find(s) == m.end()) m[s] = 1;
        else m[s]++;
    }

    int M;  cin >> M;
    for(int i=0; i<M; i++){
        string s;  cin >> s;
        if(m.find(s) == m.end()) m[s] = -1;
        else m[s]--;
    }

    int ans = 0;
    for(auto itr = m.begin(); itr != m.end(); itr++){
        ans = max(ans, itr->second);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const long long N = 1e5 + 5;
const long long inf = 1e18;
using namespace std;

vector <int> mv;
priority_queue <long long, vector <long long>, greater <long long> > mq;

long long n, x, y, z, a[N], b[N], c[N], sum, cnt[3], res = -inf, l[N], r[N];
bool check[N];

bool cmp(int p, int q){
    return ((a[p] - b[p] > a[q] - b[q] || (a[p] - b[p] == a[q] - b[q] && p < q)));
}

int main(){
    cin >> x >> y >> z;
    n = x + y + z;
    for (int i = 1; i <= n; i++){
        cin >> a[i] >> b[i] >> c[i];
        a[i] -= c[i]; b[i] -= c[i];
        sum += c[i];
        mv.push_back(i);
    }
    sort(mv.begin(), mv.end(), cmp);
    long long cur = 0; l[0] = -inf;
    for (int i = 0; i < n; i++){
        int p = mv[i];
        mq.push(a[p]);
        cur += a[p];
        while (mq.size() > x){
            cur -= mq.top(); mq.pop();
        }
        l[i+1] = ((mq.size() >= x) ? cur : -inf);
    }
    cur = 0; r[n+1] = -inf;
    while(mq.size()) mq.pop();
    for (int i = n-1; i >= 0; i--){
        int p = mv[i];
        mq.push(b[p]);
        cur += b[p];
        while (mq.size() > y){
            cur -= mq.top(); mq.pop();
        }
        r[i+1] = ((mq.size() >= y) ? cur : -inf);
    }
    for (int i = 0; i <= n; i++) res = max(res, l[i]+r[i+1]);
    cout << sum + res << endl;
}


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

int main(int argc, char const *argv[]) {
  int a,b;
  cin>>a>>b;
  if(a%3==0 || b%3==0) cout<<"Possible"<<endl;
  else if(a%3==0 && b%3==0) cout<<"Possible"<<endl;
  else if((a+b)%3==0) cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
# print(f'{A=}')
score = sum(A) - A[-1]

l = 0
r = N - 1
while True:
    r_score = A[r - 1]
    l_score = A[l + 1]
    if l_score > r_score:
        score += l_score - r_score
    else:
        break
    l += 1
    r -= 1
    if l >= r:
        break
print(score)


Measured memory_bytes: 29280
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,m,p;
	while(cin>>n>>m>>p,n) 
	{
		int nums[n];
		fill(nums,nums+n,0);
		int sum=0;
		for(int i = 0; i < n; ++i)
		{
			cin>>nums[i];
			sum+=nums[i]*100;
		}

		double ans=0;
		if(nums[m-1]!=0)
			ans=sum*0.01*(100-p)/nums[m-1];
		cout<<(int)ans<<endl;
	}
  return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    int x,y,z,a,b,c=0;
    for(int i=0;i<n-2;i++)
    {
        x=arr[i];
        y=arr[i+1];
        z=arr[i+2];
        a=min({x,y,z});
        b=max({x,y,z});
        if(a!=y&&b!=y)
            c++;
    }
    cout<<c;
    //code goes here
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 500001
#define NIL -1
typedef struct node{
  int left;
  int right;
  int key;
  int p;
  int leftid;
  int rightid;

}Node;
Node node[MAX];
int root=NIL;
void inorder(int);
void preorder(int);
void addTree(int n,int num){
  int tmp;
  //rootが空の場合
  if(node[n].key==root){
    root=n;
    node[root].key=num;
    
  }
  else{
  tmp=root;

  while(1){
    if(node[tmp].key>num){
      if(node[tmp].left!=NIL){
	tmp=node[tmp].leftid;
      }
      else{
	node[tmp].left=num;
	node[tmp].leftid=n+1;
	node[n+1].key=num;
	
	break;
      }
    }
    else{
      if(node[tmp].right!=NIL){
	tmp=node[tmp].rightid;
	
      }
      else{
	node[tmp].right=num;
	node[n+1].key=num;
	node[tmp].rightid=n+1;
	break;
      }
    }
  }
  
  node[n].p=tmp;
  
  }
}
int main(){
  int num,i,n,l=0,tmp;
  char name[100];
  scanf("%d",&n);
 for(i=0;i<MAX;i++){//初期化
    node[i].p=NIL;
    node[i].left=NIL;
    node[i].right=NIL;
    node[i].key=NIL;
    
  }


 for(i=0;i<n;i++){
    scanf("%s",name);
    if(name[0]=='i'){
      scanf("%d",&num);
      addTree(l,num);
      l++;
      }
      
   else if(name[0]=='p'){
    inorder(root);
   printf("\n");
   preorder(root);
   printf("\n");
      
    }
  }
 
 
 
  return 0;
}
void inorder(int t){
  if(node[t].left!=NIL){
    inorder(node[t].leftid);
  }
    printf(" %d",node[t].key);
  if(node[t].right!=NIL){
    inorder(node[t].rightid);
  }
}
void preorder(int t){
 
      printf(" %d",node[t].key);
  if(node[t].left!=NIL){
    preorder(node[t].leftid);
  }
  if(node[t].right!=NIL){
    preorder(node[t].rightid);
  }
}




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

int main() {
  long long H,ans = 0,x=1;
  cin >> H;
  for(long long i=0; i<100; i++){
    if(H == 0){
      cout << ans  << endl;
      return 0;
    }
    else{
    ans += x;
    H /= 2;
    x *= 2;
    }
  }
}


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

#define M_PI       3.14159265358979323846   // pi

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

#define rep(a,n) for(int a = 0;a < n;a++)
#define repi(a,b,n) for(int a = b;a < n;a++)

const ll mod = 1000000007;

int main(void)
{
	ll a, b;
	cin >> a >> b;
	if (a % 2 != b % 2) {
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	cout << (a + b) / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int main() {
    ll N;
    cin >> N;
    ll a = N / 2 + (N % 2);
    cout << a / (double)N << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String moji = scan.nextLine();
		scan.close();
		char mojiChar = moji.charAt(0);
		char mojiCharNext = (char) ((char)mojiChar + 1);
		System.out.println(mojiCharNext);
	}

}


Measured memory_bytes: 21844
#include <stdio.h>

int dic(char c1[],char c2[]){
  int a=0,i=0;
  while(1){
    if(c1[i]<c2[i])return 1;
    if(c1[i]>c2[i])return 2;
    if(c1[i]=='\0'&&c2[i]=='\0')return 0;
    if(c1[i]=='\0')return 1;
    if(c2[i]=='\0')return 2;
    i++;
  }
  return 0;
}

int main(){
  int n,p1=0,p2=0,i,a;
  char c1[102],c2[102];
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%s",&c1);
    scanf("%s",&c2);
    a=dic(c1,c2);
    if(a==0){
      p1+=1;
      p2+=1;
    }else if(a==1)p2+=3;
    else p1+=3;
  }
  printf("%d %d\n",p1,p2);
  return 0;
}

Measured memory_bytes: 596
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n, m = LI()
s = S()
now = n
ans = []
while now:
    nxts = s[max(0, now - m): now]
    for i, bit in enumerate(nxts):
        if bit == '0':
            break
    else:
        print(-1)
        exit()
    move = (len(nxts) - i)
    now -= move
    ans += [move]



print(*ans[::-1])


Measured memory_bytes: 48680
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    int A,B,C;
    cin >> A >> B >> C;
    cout << (A+B>=C?"Yes": "No") << endl;
}

Measured memory_bytes: 256
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fast ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
int n,a;
int main()
{
	fast;
	cin>>n>>a;
	if (n%500<=a)
	   cout<<"Yes";
	else
	   cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {

	public static void main(String args[]) throws Exception {
		MyScanner sc = new MyScanner();
		PrintWriter pr = new PrintWriter(System.out);

		int n = sc.nextInt();
		int ar[] = new int[n];
		HashMap<Integer, Integer> map = new HashMap<>();
		long sum = 0;
		
		for(int i = 0; i < n; i++) {
			
			ar[i] = sc.nextInt();
			map.put(ar[i], map.getOrDefault(ar[i], 0) + 1);
			sum += ar[i];
		}
		
		int q = sc.nextInt();
		
		while(q-- > 0) {
			
			int b = sc.nextInt();
			int c = sc.nextInt();
			
			if(!map.containsKey(b)) {
				
				pr.println(sum);
				continue;
			}
			
			int freq = map.get(b);
			sum -= ((long)b * (long)freq);
			sum += ((long)c * (long)freq);
			
			map.remove(b);
			map.put(c, map.getOrDefault(c, 0) + freq);
			
			pr.println(sum);
		}
		pr.close();
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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


Measured memory_bytes: 58820
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc154_a solver = new abc154_a();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc154_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();
            int A = in.nextInt();
            int B = in.nextInt();
            String U = in.next();
            if (S.compareTo(U) == 0) {
                A--;
            }
            if (T.compareTo(U) == 0) {
                B--;
            }
            out.println(A + " " + B);
        }

    }
}



Measured memory_bytes: 25172
a,b,x = gets.split(" ").map(&:to_i)
s = x.to_f/a.to_f
answer = 0
if s > (a*b / 2)
  t = (((2*b.to_f)/(a.to_f))-((2*x.to_f)/(a*a*a.to_f)))
  answer = (Math.atan(t) * 180) / Math::PI
elsif s <= (a*b / 2)
  u = (a*b*b.to_f)/(2*x.to_f)
  answer = (Math.atan(u) * 180) / Math::PI
end

puts answer

Measured memory_bytes: 3836
#include <cstdio>

int n;
int d[101][2];

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
	scanf("%d %d", &d[i][0], &d[i][1]);
    }
    for (int i = 1; i <= n - 2; i++)
    {
	if (d[i][0] == d[i][1] && d[i + 1][0] == d[i + 1][1] && d[i + 2][0] == d[i + 2][1])
	{
	    printf("Yes\n");
	    return 0;
	}
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 1656
import heapq

N, KK = map(int, input().split())
V = list(map(int, input().split()))
ans = 0

for K in range(KK+1):
	for d in range(K):
		p = K-d
		if not(d < p <= N):
			continue	
		for l in range(p+1):
			r = p-l
			q = []
			for i in range(l):
				heapq.heappush(q,V[i])
			for i in range(r):
				heapq.heappush(q,V[-(i+1)])
			for i in range(d):
				heapq.heappop(q)
			ans = max(ans, sum(q))

print(ans)

	

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  cin>>N;
  vector<int>H(N);
  for(int i=0;i<N;i++)cin>>H[i];
  int ans=0;
  for(int i=0;i<N-1;i++){
    int res=0;
    while(i+1<N&&H[i]>=H[i+1]){
      i++;
      res++;
    }
    ans=max(ans,res);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
from collections import defaultdict

def dfs(edges, n, d, f, time):
    if n in d:
        return
    time[0] += 1
    d[n] = time[0]
    for to in edges[n]:
        dfs(edges, to, d, f, time)
    time[0] += 1
    f[n] = time[0]

N = int(input())

edges = defaultdict(list)

for _ in range(N):
    l = list(map(int, input().split()))
    fr = l[0]
    degree = l[1]
    edges[fr] = l[2:]

d = {} # discover time                                                                                                                                                                                      
f = {} # finish time                                                                                                                                                                                        

time = [0]
for n in range(1, N+1):
    dfs(edges, n, d, f, time)

for n in range(1, N+1):
    print('%d %d %d' % (n, d[n], f[n]))






Measured memory_bytes: 6076
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	int x = n%10;
	int y = n/10;
	if(x == 9 || y == 9) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = 1001010;
typedef long long int LL;
const LL inf = 1e15;
LL ans = inf, sum[MAXN];
int n, a[MAXN];
int main(){
    scanf("%d", &n);
    for(int i = 1; i <= n; i ++){
        scanf("%d", &a[i]);
        sum[i] = sum[i-1] + a[i];
    }
    
    for(int i = 2; i < n-1; i ++){
        LL sum1 = sum[i], sum2 = sum[n] - sum[i];
        LL ave1 = sum1 / 2, ave2 = sum2 / 2;
        int p1 = lower_bound(sum+1, sum+1+i, ave1) - sum;
        int p2 = lower_bound(sum+1, sum+1+n, ave2+sum[i]) - sum;
        //printf("%d %d\n", p1, p2);
        for(int d1 = -1; d1 <= 0; d1 ++){
            for(int d2 = -1; d2 <= 0; d2 ++){
                if(d1 + p1 == 0 || d2 + p2 == i || p1 + d1 == i || p2 + d2 == n) continue;
                LL maxv = -inf, minv = inf, t[4];
                t[0] = sum[d1+p1], t[1] = sum[i] - sum[d1+p1];
                t[2] = sum[d2+p2] - sum[i], t[3] = sum[n] - sum[d2+p2];
                for(int j = 0; j < 4; j ++){
                    minv = min(minv, t[j]), maxv = max(maxv, t[j]);
                }
                ans = min(maxv - minv, ans);
            }
        }
    }
    printf("%lld", ans);
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }

    int cnt = 0;

    for (int i = 0; i < n - 2; i++)
    {
        if((p[i] < p[i+1] && p[i+1] < p[i+2])||(p[i] > p[i+1] && p[i+1] > p[i+2]))
        {
            cnt++;
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<math.h>
#include<assert.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}
//小さい順
int compareInt(const void* a, const void* b){int aNum = *(int*)a;int bNum = *(int*)b;return aNum - bNum;}

long long _gcd(long long a,long long b){
    long long c;
    while(b!=0){c=a%b;a=b;b=c;}
    return a;
    
}
long long _lcm(long long a,long long b){long long c=_gcd(a,b);a/=c;return a*b;}

int main(){
    int N;
    int cnt=0;
    int ans=0;
    scanf("%d",&N);
    for(int i=1;i<=N;i+=2){
        cnt=0;
        for(int j=1;j<=N;j+=2){
            if(i%j==0){
                cnt++;
            }else{
                ;
            }
        }
        if(cnt==8)
            ans++;
    }
    printf("%d",ans);
}




Measured memory_bytes: 128
from collections import deque

n = int(input())
a = list(map(int, input().split()))

order = n%2
ans = deque([])
for i in range(n):
    if i%2 == order:
        ans.append(a[i])
    else:
        ans.appendleft(a[i])
for el in ans:
    print(el, end=' ')

Measured memory_bytes: 106780
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
int b[256];
int c[256];
int d[256];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++){
			scanf("%d",b+i);
		}
		int S=0,A=0,C=0;
		double min=999999999;
		for(int i=0;i<16;i++){
			for(int j=0;j<16;j++){
				for(int k=0;k<16;k++){
					c[0]=i*j+k;
					for(int l=1;l<a;l++){
						c[l]=(c[l-1]*j+k)&255;
					}
					for(int l=0;l<256;l++)d[l]=0;
					for(int l=0;l<a;l++)d[(b[l]+c[l])&255]++;
					double val=0;
					for(int l=0;l<256;l++)if(d[l])val-=(double)d[l]/a*log((double)d[l]/a);
					if(min>val+0.00000001){
						min=val;
						S=i;A=j;C=k;
					}
				}
			}
		}
		printf("%d %d %d\n",S,A,C);
	}
}

Measured memory_bytes: 1068