akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	if(n <= 100 && n >= 1 && m <= 100 && m >= 1){
		int sum = n + m;
		if(sum % 3 == 0) printf("Possible\n");
		else if(n % 3 == 0) printf("Possible\n");
		else if(m % 3 == 0) printf("Possible\n");
		else printf("Impossible\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
  return *(long int*)b - *(long int*)a; // 大きい順
}
int compare_int_small(const void *a, const void *b){
  return *(long int*)a - *(long int*)b; // 小さい順
}
// 公約数
long long int gcd(long long int a, long long int b){
  if(b == 0){
    return a;
  }else{
    return gcd(b, a % b);
  }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long long int lcm(long long int a, long long int b){
  return a * b / gcd(a, b);
}

#define TRUE 1
#define FALSE 0
#define MAX_NUM 2502
typedef struct pp{
  char c;
  int h;
  int w;
}P;

int top = 0;
P *Stack = NULL;
P *tmp = NULL;


void initialize(){
  Stack = (P *)calloc(MAX_NUM, sizeof(P));
  top = 0;
}

void finalize(){
  if(Stack != NULL){
    free(Stack);
    Stack = NULL;
  }
}

int isEmpty(){
  if(top < 0){
    return TRUE;
  }else{
    return FALSE;
  }
}

int isFull(){
  if(top >= MAX_NUM - 1){
    return TRUE;
  }else{
    return FALSE;
  }
}

int push(P x){
  fprintf(stderr, "pushするのは%c (h, w) = (%d, %d)\n", x.c, x.h, x.w);
  //printf("push x = %d\n",x);
  if(isFull() != FALSE){
    //    fprintf(stderr, "pushしたのは%d top = %d\n", Stack[top], top);
    printf("Error! Overfllow\n");
    return 0;
  }else{
    top++;
    if(Stack != NULL){
      Stack[top] = x;
    }
    return 0;
  }
}

P pop(){
  if(isEmpty() != FALSE){
    printf("Error! Underfllow\n");
    return *tmp;
  }else{
    top--;
    // return では取りだす値を返す
    //    fprintf(stderr, "popしたのは%d top = %d\n", Stack[top + 1], top);
    return Stack[top+1];
  }
}

// min
int main(void){
  int n;
  scanf("%d", &n);

  if(n % 2 == 0){
    printf("%d\n", n / 2 - 1);
  }else{
    printf("%d\n", n / 2);
  }

  return 0;

}


Measured memory_bytes: 128
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();

        int x = Integer.parseInt(sc.next());
        int num1,num2;
        double a = 0;
        double b = 0;
        while(true) {
        	num1 = (int) (Math.pow(a,5.0) - Math.pow(b, 5.0));
        	if(num1 == x) {
        		break;
        	}
        	num2 = (int) (Math.pow(a,5.0) - Math.pow(b * -1, 5.0));
        	if(num2 == x) {
        		b *= -1;
        		break;
        	}
        	if(x < num1) {
        		a = 0;
        		b += 1;
        	}
        	a += 1;
        }

        System.out.println((int)a + " " + (int)b);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
}

Measured memory_bytes: 36292
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
        int num = s.length();
        String[] line = new String[num];
        line = s.split("");
        String former = line[0];
        //System.out.println(former);
        int count = 0;
        for(int i=1; i<num; i++){
          if(line[i].equals(former)){
            if(line[i].equals("0")) line[i] = "1";
            else line[i] = "0";
            former = line[i];
            count++;
          }
          else{
            former = line[i];
          }

        }
        System.out.println(count);
	}
}

Measured memory_bytes: 32636
n = int(input())
query = [list(map(int, input().split())) for _ in range(n)]

cnt = 0
for x, y, h in query:
    if h == 0:
        cnt += 1
    else:
        res = [x, y, 1]

if n - cnt == 1:
    print(*res)
else:
    for cx in range(101):
        for cy in range(101):
            res = []
            for i in range(n):
                x, y, h = query[i]
                p = abs(x - cx) + abs(y - cy)
                H = h + p
                if h != 0:
                    res.append(H)

            if len(set(res)) == 1:
                print(cx, cy, res[0])
                exit()


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

int main(){
    int n,A[100];
    cin >> n;

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

    for(int i=n-1; i>=0; i--){
        if(i!=0) cout << A[i] << " ";
        else cout << A[i];
    }
    cout << endl;
}


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

using namespace std;

void dfs(int u, const vector<vector<int>> &g, vector<int> &vis, 
         vector<int> &par, set<int> &desc) {
    vis[u] = 1;
    for (int v : g[u]) {
        if (!vis[v]) {
            dfs(v, g, vis, par, desc);
        }
    }
    for (int v : g[u]) {
        if (!desc.count(v)) {
            par[v] = u;
            desc.insert(v);
        }
    }
}
int main() {
    std::ios::sync_with_stdio(false); 
    cin.tie(nullptr);
    
    int N, M;
    cin >> N >> M;
    vector<vector<int>> g(N);
    vector<int> indeg(N, 0);
    for (int i = 0; i < N - 1 + M; ++i) {
        int A, B;
        cin >> A >> B;
        g[A - 1].push_back(B - 1);
        ++indeg[B - 1];
    }
    int r = -1;
    for (int i = 0; i < N; ++i) {
        if (indeg[i] == 0) {
            r = i;
        }
    }

    vector<int> vis(N, 0), par(N, -1);
    set<int> desc;
    dfs(r, g, vis, par, desc);

    for (int i = 0; i < N; ++i) {
        cout << par[i] + 1 << "\n";
    }

    return 0;
}

Measured memory_bytes: 19968
#include<bits/stdc++.h>
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define sz(x) int(x.size())
#define All(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef priority_queue<int> BQ;
typedef priority_queue<int,vector<int>,greater<int> > SQ;
const int maxn=3e5+10,mod=1e9+7,INF=0x3f3f3f3f;
int a[maxn];
ll sum[maxn];
int main()
{
	int n;
	cin>>n;
	for (int i=0;i<=n;++i)
		scanf("%d",&a[i]);
	for (int i=n;i>=0;--i)
		sum[i]=sum[i+1]+a[i];
	if (a[0]>1){
		cout<<-1;
		return 0;
	}
	if (a[0]==1){
		if (n>0)
			cout<<-1;
		else
			cout<<1;
		return 0;
	}
	ll last=1,ans=1;
	for (int i=1;i<=n;++i){
		ll now=last*2-a[i];
		if (now<0){
			cout<<-1;
			return 0;
		}
		now=min(now,sum[i+1]);
		ans+=now+a[i];//dd(i),dd(last),de(now);
		last=now;
	}
	cout<<ans;
	return 0;
}


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

using namespace std;

#define DEBUG_MODE
#ifdef DEBUG_MODE
	#define _(n) n;
#else
	#define _(n) ;
#endif
#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

class Mod{
    //static const int MOD = 1000000007;
public:
    long long a;
    Mod(){a = 0;}
    Mod(long long x){a = (x % MOD + MOD) % MOD;}
    const Mod operator+(const Mod& x) const{return Mod(a + x.a);}
    const Mod operator-(const Mod& x) const{return Mod(a - x.a);}
    const Mod operator*(const Mod& x) const{return Mod(a * x.a);}
    const Mod operator/(const Mod& x) const{ //フェルマーの小定理、aとMODが互いに素の時のみ
        if(x.a == 0)return 0;
		if(a % x.a == 0)return Mod(a/x.a);
		int b = MOD - 2;long long c = x.a;long long ret = 1;
        while(b > 0){if(b & 1){ret *= c;ret %= MOD;}
            c *= c;c %= MOD;b >>= 1;
        }
        return Mod(a * ret);
    }
    long long getValue(){return a;}
};

ll kaijo[1111111];

ll combination(ll n,ll r){
	if(n < 0 || r < 0)return 0;
    if(n < r)
        return 0;
    if(n-r < r)
        r = n-r;
    Mod ret = kaijo[n];
	Mod tmp = (kaijo[r]*kaijo[n-r])%MOD;
    ret= ret/tmp;
	return ret.a;
}

ll f(ll a,ll b){
	return (((combination(b-1,2*b-a)*kaijo[b])%MOD)*kaijo[a-b-1])%MOD;
}


int main()
{
	ll n;cin >> n;
	if(n == 2){
		cout << 1 << endl;
		return 0;
	}
	ll ans = 0;
	
	kaijo[0] = 1;
	for(int i = 1;i < 1111111;i++){
		kaijo[i] = (kaijo[i-1]*i)%MOD;
	}
	
	REP(i,n){
		if(i - 1 <= 0 || i * 2 - n < 0)continue;
		ll A = f(n,i);
		ll B = f(n,i-1);
		A -= B;
		while(A < 0)A += MOD;
		A = (A*i)%MOD;
		ans = (ans + A)%MOD;
	}
	
	cout << ans << endl;
				
	return 0;
}

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

int main() {
  string s;
  int a = 0;
  cin >> s;
  
  for (int i = 0; i < s.size(); i++) {
    a += s.at(i) - '0';
  }

  if (a % 9 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3688
import fractions
n,x=map(int,input().split())
l=list(map(int,input().split()))
l.append(x)
l.sort()
dis=[]
for i in range(n):
  dis.append(l[i+1]-l[i])
tmp=dis[0]
for i in range(1,n):
  tmp=fractions.gcd(tmp,dis[i])
print(tmp)

Measured memory_bytes: 16300
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, a, N) for(int i = a; i < N; i++)

int main() {
    int N;
    cin >> N;
    int A[100010];
    A[0] = 0;
    A[N + 1] = 0;
    rep(i, 1, N + 1) scanf("%d", &A[i]);

    ll sum = 0;
    rep(i, 1, N + 2) sum += abs(A[i] - A[i - 1]);
    rep(i, 1, N + 1) {
        printf("%lld\n", (ll)(sum - abs(A[i + 1] - A[i]) - abs(A[i] - A[i - 1]) + abs(A[i + 1] - A[i - 1])));
    }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
bool a[100005];
int dp[100005];
int main()
{
    int n,m;
    cin>>n>>m;
    memset(a,1,sizeof(a));
    for(int i=0; i<m; i++)
	{
        int num;
		cin >> num;
        a[num]=false;
    }
    dp[0] = 1;
    for(int i=0;i<n;i++)
	{
        for(int j=i+1;j<=min(n,i+2);j++)
		{
            if(a[j])
			{
                dp[j]+=dp[i];
                dp[j]%=MOD;
            }
        }
    }
    cout<<dp[n]<<"\n";
    return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int k;
	cin>>k;
	int odd=0,even=0;
	for(int i=1;i<=k;i++){
		if(i%2==0){
			even++;
		}else{
			odd++;
		}
	}
	cout<<even*odd<<endl;
	return 0;
} 

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    s = list(input())
    t = list(input())

    slen = len(s)
    tlen = len(t)
    dp = [[0 for _ in range(tlen + 1)] for _ in range(slen + 1)]

    for i in range(slen):
        for j in range(tlen):
            if s[i] == t[j]:
                dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j], dp[i][j+1])

    ans = []
    while slen > 0 and tlen > 0:
        if dp[slen][tlen] == dp[slen - 1][tlen]:
            slen -= 1
        elif dp[slen][tlen] == dp[slen][tlen - 1]:
            tlen -= 1
        else:
            slen -= 1
            tlen -= 1
            ans.append(s[slen])
    print(*ans[::-1], sep='')

if __name__ == '__main__':
    main()


Measured memory_bytes: 120796
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>

using namespace std;
typedef long long ll;

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

int main() {

    ll N;
    cin >> N;
    ll A;
    ll out[N];
    rep(i,N) out[i] = 0;
    rep(i,N-1){
        cin >> A;
        out[A-1]++;
    }
    rep(i,N) cout << out[i] << endl;
    return 0;
}


Measured memory_bytes: 5132
#include <iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0)break;
		int count[10]={0},in;
		for(int i=0;i<n;++i){
			cin>>in;
			++count[in];
		}
		for(int i=0;i<10;++i){
			if(count[i]==0)cout<<"-";
			for(int j=0;j<count[i];++j) cout<<"*";
			cout<<"\n";
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cstdio>
using namespace std;

int main()
{
	int a[101] = {};
	int in, maxa=0;
	while (cin >> in, !cin.eof()){
		a[in]++;
	}
	for (int i = 0; i < 101; i++){
		maxa = max(maxa, a[i]);
	}
	for (int i = 0; i < 101; i++){
		if (a[i] == maxa){
			cout << i << endl;
		}
	}

	return 0;
}

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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353
#define inf 1e18

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

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

    ll test=1;
    // cin>>test;
    while(test--)
    {
        ll a;
        cin>>a;

        cout<<a+a*a+a*a*a;
    }
}

Measured memory_bytes: 3612
# -*- coding: utf-8 -*-
"""
http://abc064.contest.atcoder.jp/tasks/abc064_c

"""
import sys
from sys import stdin
from collections import defaultdict
input = stdin.readline


def get_color(s):
    ans = 'any'
    if s < 400:
        ans = 'gray'
    elif s < 800:
        ans = 'brown'
    elif s < 1200:
        ans = 'green'
    elif s < 1600:
        ans = 'light blue'
    elif s < 2000:
        ans = 'blue'
    elif s < 2400:
        ans = 'yellow'
    elif s < 2800:
        ans = 'orange'
    elif s < 3200:
        ans = 'red'
    return ans


def main(args):
    N = int(input())
    scores = [int(x) for x in input().split()]

    colors = defaultdict(int)
    for s in scores:
        res = get_color(s)
        colors[res] += 1

    normal_color = 0
    for k, v in colors.items():
        if k != 'any':
            normal_color += 1
    any_color = colors['any']

    print(max(1, normal_color), normal_color + any_color)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 3316
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 505
using namespace std;
int n,m,l,r,ans,mid;
int a[N][N],b2[N],MAX;
int read()
{int t=0;char c;
  c=getchar();
  while(!(c>='0' && c<='9')) c=getchar();
  while(c>='0' && c<='9')
	{
	  t=t*10+c-48;c=getchar();
    }
   return t;
}
bool b1[N];
int main()
{int i,j,k;
   n=read();m=read();
   for(i=1;i<=n;i++)
	   for(j=1;j<=m;j++) a[i][j]=read();
    ans=n;memset(b1,false,sizeof(b1));
    for(i=1;i<=m;i++)
	{
        for(j=1;j<=m;j++) b2[j]=0;
        for(j=1;j<=n;j++)
        for(k=1;k<=m;k++)
        if(!b1[a[j][k]])
		{
         b2[a[j][k]]++;break;
        }
		k=1;
        for(j=2;j<=m;j++) if(b2[j]>b2[k])k=j;
        b1[k]=true;
		ans=min(ans,b2[k]);
    }
	printf("%d\n",ans);
}

Measured memory_bytes: 768
#include<stdio.h>
#define MAX 100005
#define NIL -1


struct Node{ int p, l, r;};
struct Node T[MAX]; 

int keiro(int u){
  if(T[u].p==NIL)return 0;
  else{
    return 1+keiro(T[u].p);
  }
}

int kodomo(int u){
  if(u == NIL)return 0;

  else{
    if(T[u].r==-1)printf("%d",u);
    else{
      printf("%d, ",u);
      kodomo(T[u].r);
    }
  }
}

void print(int u){
  printf("node %d: parent = %d, depth = %d, ",u,T[u].p,keiro(u));
  if(T[u].p==NIL)printf("root, [");
  else if(T[u].l==NIL)printf("leaf, [");
  else printf("internal node, [");
  kodomo(T[u].l);
  printf("]\n");
}

main(){
  int i, j, d, v, c, l,n;

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    T[i].p = T[i].l = T[i].r = NIL;
  }

  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &v, &d);
    for ( j = 0; j < d; j++ ){
      scanf("%d", &c);
      T[c].p=v;
      if(j==0){      
	T[v].l=c;
      }
      else{
	T[l].r=c;
      }
      l=c;
      }
    }

  for ( i = 0; i < n; i++ ) print(i);
  return 0;
}

Measured memory_bytes: 1784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N;
	cin >> N;

	int ki = 0;
	rep(i, N) {
		int a;
		cin >> a;
		ki ^= a;
	}
	if (ki & 1) co("NO");
	else co("YES");

	Would you please return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef long long LL;
typedef unsigned long long ULL;
const LL LINF = 0x3f3f3f3f3f3f3f3f; 
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int mod = 1e9+7;
const ULL P = 131;
const int N = 2e5+7;

int a[N];

int main()
{
	string a,b;
	cin>>a>>b;
	int flag=1;
	for(int i=0;i<a.size();i++){
		if(a[i]!=b[i]) flag=0;
	}
	if(flag) puts("Yes");
	else puts("No");
	return 0;
}

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

int N;
string S[300000];

void input()
{
    cin >> N;

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

int main()
{
    input();

    map<string, int> count;

    for (int i = 0; i < N; i++) {
        if (count.count(S[i])) {
            count[S[i]] += 1;
        } else {
            count[S[i]] = 1;
        }
    }

    vector<string> ans;
    int max = 0;
    for (pair<string, int> p : count) {
        if (max == p.second) {
            ans.push_back(p.first);
        } else if (max < p.second) {
            ans = { p.first };
            max = p.second;
        }
    }

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

    for (string a : ans)
        cout << a << endl;
    return 0;
}


Measured memory_bytes: 29300
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define fix  cout<<std::fixed;
#define mk make_pair
#define time  cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
#define IOS             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{  
 ll n,k;cin>>n>>k;
 ll a[n];
 for(int i=0;i<n;i++)
        cin>>a[i];

        ll dp[n];

        for(int i=0;i<n;i++)
        {
            if(i==0)dp[i]=0;
            else if(i==1)dp[i]=abs(a[i]-a[i-1]);
            else
                {    dp[i]=abs(a[i]-a[i-1])+dp[i-1];
                for(int j=1;j<=k;j++)
                    if(j<=i)
                    dp[i]=min(dp[i],abs(a[i]-a[i-j])+dp[i-j]);
            }
            

        } cout<<dp[n-1]; 

}

Measured memory_bytes: 1792
program main
  implicit none

  integer(16),allocatable :: h(:), dp(:)
  integer(16) :: n, k, inf, i, j

  read(*,*) n, k
  allocate(h(n))
  allocate(dp(n))
  read(*,*) h

  inf = 100000000000_16
  do i = 1, n
     dp(i) = inf
  end do

  dp(1) = 0

  do j = 2, n
     do i = 1, k
        if(j > i) then
           dp(j) = min(dp(j), dp(j-i)+abs(h(j) - h(j-i)))
        end if
     end do
  end do

  write(*,*) dp(n)

end program main


     


Measured memory_bytes: 3968
N = int(input())
a = [int(x) for x in input().split()]
cnt4=0
cnt2=0
cnt1=0
for i in a:
    if(i%4==0):
        cnt4+=1
    elif(i%2==0):
        cnt2+=1
    else:
        cnt1+=1
n = cnt4+1-cnt1
if(n>=0 and cnt2==0):
    print('Yes')
elif(n>=1 and cnt2>=1):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 62576
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

  const int n = s.size();

  if (n < 26) {
    for (int i = 0; i < 26; i++) {
      if (count(s.begin(), s.end(), 'a' + i) == 0) {
        s += 'a' + i;
        cout << s << endl;
        return 0;
      }
    }
  } else {
    for (int i = 24; i >= 0; i--) {
      if (s[i] < s[i + 1]) {
        for (int j = n - 1; j > i; j--) {
          if (s[i] < s[j]) {
            swap(s[i], s[j]);
            cout << s.substr(0, i + 1) << endl;
            return 0;
          }
        }
      }
    }
    cout << -1 << endl;
  }
}

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

using namespace std;

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

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	double n, d;
	cin >> n >> d;

	vector<vector<double>> x(n, vector<double>(d));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			cin >> x[i][j];
		}
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			double score = 0;
			for (int k = 0; k < d; k++) {
				score += abs(x[i][k] - x[j][k]) * abs(x[i][k] - x[j][k]);
			}
			score = sqrt(score);

			if (ceil(score) == floor(score)) {
				ans++;
			}
		}
	}

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


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

main() {
    ll K; cin >> K;
    ll N=50; ll a,b; a=K/50; b=K%50;
    ll A[50];
    rep(i,N) A[i]=i+a;
    rep(i,b){
        A[i]+=50;
        rep(j,50){
            if(j==i)continue;
            else A[j]--;
        }
    }
    cout << 50 << endl;
    rep(i,50) cout << A[i] << " " << flush;
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,D,L,R;
  cin >> A >> B >> C >> D;
  L = A+B;
  R = C+D;
  if(L < R){
    cout << "Right" << endl;
  }else if(L > R){
    cout << "Left" << endl;
  }else{
    cout << "Balanced" << endl;
  }
}

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

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    rep(i, N) cin >> X.at(i);

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

    int ans = 10000000;
    for (int i = X.at(0); i <= X.at(N-1); i++) {
        int sum_value = 0;
        for (int j = 0; j < N; j++) {
            sum_value += pow(X.at(j) - i, 2);
        }
        ans = min(ans, sum_value);
    }

    cout << ans << endl;
}


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

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main(){
    int n,m;
    while(cin>>n>>m){
        if(n==0&&m==0)break;
        
        double data[110][100];
        rep(i,n){
            rep(j,n){
                cin>>data[i][j];
            }
        }
        
        double dp[200][200];
        rep(i,200)rep(j,200)dp[i][j]=0;
        
        rep(i,n)dp[0][i]=1;
        
        for(int i=1;i<m;i++){
            rep(j,n){
                rep(k,n){
                    dp[i][j]=max( dp[i][j] , dp[i-1][k]*data[k][j] );
                }
            }
        }
        
        double ans = 0;
        rep(i,n){
            ans = max( ans , dp[m-1][i] );
        }
        printf("%.2lf\n",ans);
    }
}

Measured memory_bytes: 1644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define inf 1000000000000000000
const double pi = acos(-1);
const int sz = 200002;
int n,m, k;
int main() {
	io
	int x;
	cin>>x>>n;
	vector<int>p(n);
	for(int i = 0; i<n; i++) cin>>p[i];
	set<int>has(p.begin(), p.end());
	int ans = -100000;
	for(int i = x; i >= -100; i--) {
		if(has.count(i) == 0) {
			// cout<<i<<endl;
			ans = i;
			break;
		}
	}
	for(int i = x; i<=101; i++) {
		//cout<<i<<' '<<has.count(i)<<' '<<ans<<endl;
		if(has.count(i) == 0 && abs(x-i) < abs(x-ans)) {
			// cout<<i<<endl;
			ans = i;
		}
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 3652
#include<bits//stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}
#define rep(i,n) for(ll i = 0;i < n;i++)
#define req(i,n) for(ll i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
const ll INF =  1LL << 60;
const int inf = 1 << 25;
ll n, m, x, y, q, d, z, w,  sum = 0, ans = 0;
const int MAX = 510000;
const int MOD = 1000000007;
vector<int> a, b;
int main(void) {
	cin >> n;  a.resize(n+1,1);
	for (int i = 2; i / 2 <= n; i++) {
		x = i;
		while (x <= n) {
			a[x]++;
			x += i;
		}
	}
	req(i, n) {
		ans += a[i]*i;
	}
	cout << ans << endl;
}

Measured memory_bytes: 42300
from collections import deque, defaultdict

v, e = map(int, input().split())
st = [[int(x) for x in input().split()] for  _ in range(e)]

outs = defaultdict(list)
ins = defaultdict(int)
for v1, v2 in st:
    outs[v1].append(v2)
    ins[v2] += 1

q = deque(v1 for v1 in range(v) if ins[v1] == 0)
res = []
while q:
    v1 = q.popleft()
    res.append(v1)
    for v2 in outs[v1]:
        ins[v2] -= 1
        if ins[v2] == 0:
            q.append(v2)

if len(res)!=v: print('1')
else: print('0')



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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

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

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

struct mint {
    ll x;
    mint(ll x=0) : x(x%mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x -= a.x) < 0) x += mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) {
        mint res(*this);
        return res*=a;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    int n, m; std::cin >> n >> m;
    if (abs(n-m) > 1) {
        std::cout << 0 << "\n";
        return 0;
    }
    mint ans = 1;
    rrep(i, n) ans *= i;
    rrep(i, m) ans *= i;
    if (n == m) {
        ans *= 2;
    }
    std::cout << ans.x << "\n";
}


Measured memory_bytes: 256
<?php
$debug = false;
list($n, $k) = ints();
$a = ints();
// ２進数表現で格桁の1の数を数える
for ($i = 0; $i < $n; ++$i) {
    $j = 0;
    while ($a[$i] >> $j > 0) {
        if (isset($cnt1[$j])) $cnt1[$j] += $a[$i] >> $j & 1;
        else $cnt1[$j] = $a[$i] >> $j & 1;
        ++$j;
    }
}
if ($debug) var_dump($cnt1);
$l = strlen(decbin(max($k, max($a))));
$ans = 0;
$smaller = false; // true: xがk以下確定, false: xがk以下か未確定
for ($i = $l - 1; $i >= 0; --$i) {
    $bitx = ($cnt1[$i] ?? 0) < $n / 2 ? 1 : 0;
    if ($smaller) {
        $ans += $bitx ? (1 << $i) * ($n - $cnt1[$i]) : (1 << $i) * $cnt1[$i];
    } else {
        $bitk = $k >> $i & 1;
        $bitx = min($bitx, $bitk);
        if ($debug) var_dump($i, $bitk, $bitx, '-----');
        if ($bitx < $bitk) {
            $ans += (1 << $i) * $cnt1[$i];
            $smaller = true;
        } else {
            $ans += $bitx ? (1 << $i) * ($n - $cnt1[$i]) : (1 << $i) * $cnt1[$i];
        }
    }
}
echo $ans;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 27472
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
#include<deque>
#include<queue>
#include<set>
#include <functional>
#include <cmath>


//マクロ
/*動かない・・・
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _roverload3(_1,_2,_3,name,...) name
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(...) _roverload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
//*/
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
//*/
#define All(a) (a).begin(),(a).end()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
string s, t;

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

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

	cin >> s >> t;
	cout << t << s << endl;
}

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

#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define PYES cout << "Yes" << endl
#define PNO cout << "No" << endl

typedef long long LL;
typedef long double LD;

int main(){
  string s;
  cin >> s;
  int n=s.length();
  int ansa=0,ansb=0;
  for(int i=0;i<n;i++){
    if(s[i]-'0'!=i%2) ansa++;
  }
  for(int i=0;i<n;i++){
    if(s[i]-'0'!=(i+1)%2) ansb++;
  }
  cout << min(ansa,ansb) << endl;
  return 0;
}


Measured memory_bytes: 512
l = list(map(int, input().split()))
a = l[0]
b = l[1]
c = l[2]
d = l[3]
if abs( c - a ) <= d:
    print("Yes")
elif abs(c - b) <= d:
    if abs(b-a) <= d:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 3064
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(false);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N;
  cin >> N;
  cout << (1000 - N % 1000) % 1000 << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, m;
    cin >> n >> m;
    
    vvpll G(n);
    rep(v, n-1) {
        G[v+1].pb(make_pair(v, 0));
    }
    rep(loop, m) {
        ll L, R, c;
        cin >> L >> R >> c;
        L--;  R--;
        G[L].pb(make_pair(R, c));
    }
    
    // ダイクストラ法。計算量はO((V+E)*log(V))
    const ll sv = 0;  // 始点となる頂点。デフォルトでは0
    vl dist(n, INF);  // dist[v] : 頂点svから頂点vへの最短距離
    priority_queue<P, vector<P>, greater<P>> prQ;
    dist[sv] = 0;
    prQ.push(make_pair(sv, 0));  // (頂点番号, 頂点svからの最短距離)
    while(!prQ.empty()) {
        auto p1 = prQ.top();
        prQ.pop();
        ll v = p1.first;
        if(dist[v] < p1.second) {
            continue;
        }
        for(auto p2 : G[v]) {
            ll u = p2.first;
            ll cost = p2.second;
            if(dist[u] > dist[v] + cost) {
                dist[u] = dist[v] + cost;
                prQ.push(make_pair(u, dist[u]));
            }
        }
    }

    if(dist[n-1] == INF) {
        out(-1);
    }
    else {
        out(dist[n-1]);
    }
    
    re0;
}

Measured memory_bytes: 17008
#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
const static int64 INF = 1LL << 55;

int64 N, W[4000], Sum[4001];
int64 dp[4000][4000];
int pos[4000][4000];


int main()
{
  fill_n( *dp, 4000 * 4000, INF);
  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> W[i];
    Sum[i + 1] = Sum[i] + W[i];
    dp[i][i] = 0;
  }
  for(int i = 0; i < N - 1; i++) {
    pos[i][i + 1] = i;
    dp[i][i + 1] = W[i] + W[i + 1];
  }

  for(int i = 3; i <= N; i++) {
    for(int j = 0; j <= N - i; j++) {
      int left = j, right = j + i - 1;
      for(int k = pos[left][right - 1]; k <= pos[left + 1][right]; k++) {
        int64 Next = dp[left][k] + dp[k + 1][right] + Sum[right + 1] - Sum[left];
        if(dp[left][right] > Next) {
          dp[left][right] = Next;
          pos[left][right] = k;
        }
      }
    }
  }
  cout << dp[0][N - 1] << endl;
}

Measured memory_bytes: 188720
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( 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>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

LL a,b;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> a >> b;
   	cout << min(a%b, abs(b-a%b));
    return 0;
}

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

int main() {
  int n;
  cin>>n;
   vector<string> s(n);
  
  rep(i,n) {
    string d;
    cin>>d;
    s.at(i)=d;
    sort(all(s.at(i)));
    
  }
  sort(all(s));
  
	ll ans=0;
 	 rep(i,n){
     ll b=1;
    while(i+1<n&&s[i]==s[i+1]){
       b++; 
      i++;
    }
    ans+=b*(b-1)/2;
  }
  cout<<ans<<endl;   
} 



Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int x = 25, y = 14;
    bool flag = false;
    for (int i = 0; i < x; i++) {
        for (int j = 0; j < y; j++) {
            if (4 * i + 7 * j == n) {
                flag = true;
                break;
            }
        }
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;
const string YES = "Yes";
const string NO = "No";

void solve(long D, long T, long S) {
  cout << (T * S >= D ? YES : NO) << endl;
}

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

  long D, T, S;
  cin >> D >> T >> S;

  solve(D, T, S);

  return 0;
}


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

using namespace std;

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

  vector<int> h(n);
  vector<int> c(n,0);

  long long ans=0;
  for(int i =0; i < n; i++){
    cin >> h[i];
    if(i == 0)c[i] = 0;
    if(h[i] > h[i-1] )c[i] = 0;
    else c[i] = 1;
  }

  long long rs = 0;
  for(int i =0; i < n; i++){
    if(c[i] ) rs++;
    else rs = 0;
    if( rs > ans) ans = rs;
  }

  cout << ans << endl;
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << endl
#define prtd(n, var)     cout << fixed << setprecision(n) << var << endl
#define prt2(v1, v2)     cout << v1 << " " << v2 << endl
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << endl
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << endl

//----------------------------------------------------------------
bool isPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0){
            return false;
        }
    }

    return true;
}

int main(void) {
  int x;
  cin >> x;

  rep(i,10000){
    if(isPrime(x)){
      prt(x); return 0;
    } else {
      x++;
    }
  }
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define int long long

signed main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    
    int ans = 0;
    rep(i,n) ans += a[i]-1;
    
    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
def get_sieve_of_eratosthenes(n):
    import math
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
li = get_sieve_of_eratosthenes(10**5 + 3)
for i in li:
  if i >= n:
    print(i)
    exit()

Measured memory_bytes: 7448
b,r,g,c,s,t;
main(){
	for(;scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t),b|r|g|c|s|t;){
		printf("%d\n",100+b*(15+5*(1+15))+r*(15+3*(1+15))+g*7+c*2+s*3-t*3);
	}
	exit(0);
}

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

int main() {
    long H, N;
    cin>>H>>N;
    long A[N], B[N];
    for(long i=0;i<N;++i){
        cin>>A[i]>>B[i];
    }
    long DP[H+1];
    DP[0] = 0;
    long tmpmp;
    for(long h=1;h<=H;++h){
        if(A[0] >= h) tmpmp = B[0];
        else tmpmp = DP[h-A[0]] + B[0];
        for(long n=1;n<N;++n){
            if(A[n] >= h){
                if(tmpmp > B[n]) tmpmp = B[n];
            }
            else{
                if(tmpmp > DP[h - A[n]] + B[n]) tmpmp = DP[h - A[n]] + B[n];
            }
        }
        DP[h] = tmpmp;
    }
    cout<<DP[H]<<endl;
}


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

const int N = 1e6 + 5;

#define st first
#define nd second

typedef pair<int,int> pun;
typedef long long ll;

int main() {
	int n;
	scanf("%d", &n);
	vector<int> per;
	per.resize(n + 2);
	for (int i = 1; i <= n; i ++) {
		int a;
		scanf("%d", &a);
		per[i] = a;
	}
	int wynik = 0;
	for (int i = 1; i <= n; i ++) {
		if (per[i] == i) {
			wynik ++;
			swap(per[i], per[i+1]);
		}
	}
	printf("%d\n", wynik);
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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

    string s; cin >> s;
    bool ok = true;

    rep(i,3){
        if(s[i] == s[i+1]) ok = false;
    }

    if(ok) cout << "Good" << endl;
    else cout << "Bad" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



string s, t;

signed main() {
	cin >> s;
	each(i,s) {
		if (i=='B' && !t.empty()) t.pop_back();
		else if (i!='B') t.push_back(i);
	}
	cout << t << endl;
}


Measured memory_bytes: 256