akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define cc continue
#define bb break
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
//fflush(stdin);
// do {
// // process permutation
// } while (next_permutation(permutation.begin(),permutation.end()));
class abc
{
    public:
    ll a,b;
};
ll dp[10001][1001];
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll h,n;
    cin>>h>>n;
    abc arr[n];
    rep (i,0,n)
    {
        cin>>arr[i].a>>arr[i].b;
    }
    ve <ll> mnans(h+1,0);
    ll xd=1e10;
    rep (i,0,n)
    {
        if (arr[i].a>=1)
        {
            dp[1][i]=arr[i].b;
            xd=min(xd,dp[1][i]);
        }
    }
    mnans[1]=xd;
    // cout<<mnans[1]<<"\n";
    rep (i,2,h+1)
    {
        ll xd=1e10;
        rep (j,0,n)
        {
            if (arr[j].a>=i)
            {
                dp[i][j]=arr[j].b;
            }
            else
            {
                dp[i][j]=arr[j].b+mnans[i-arr[j].a];
            }
            xd=min(xd,dp[i][j]);
        }
        mnans[i]=xd;
    }
    cout<<mnans[h]<<"\n";
}


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

int main(){
  int a, b;
  cin >> a;
  b=0;
  vector<int> vec(a,0);
  for(int i=0; i<a;i++){
    cin >> vec[i];
  }
  for(int i=0;i<a;i++){
    if(vec[i]%2==1){
      b++;
      continue;
    }
    else if(vec[i]%3!=0 && vec[i]%5!=0){
      cout << "DENIED" << endl;
      break;
    }
    else
    b++;
  }
  if(b==a)
    cout << "APPROVED" <<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

int n,ac=0,wa=0,tle=0,re=0;
cin>>n;
string s;
int i;
for(i=0;i<n;i++)
{
	cin>>s;
	if(s=="AC")
	{
		ac++;
	}
	else if(s=="WA")
	{
		wa++;
	}
	else if(s=="TLE")
	{
		tle++;
	}
	else
		re++;
}

	
		cout<<"AC"<<" "<<"x"<<" "<<ac<<endl;
		cout<<"WA"<<" "<<"x"<<" "<<wa<<endl;
		cout<<"TLE"<<" "<<"x"<<" "<<tle<<endl;
		cout<<"RE"<<" "<<"x"<<" "<<re<<endl;
	
	return 0;
}










  

Measured memory_bytes: 3616
#include <iostream>
using namespace std;
int main() {
	string s; cin >> s;
	int n = s.size();
	int ans = 2000;
	for(int i=0;i<n-2;i++){
		int a = 100*(s[i]-48)+10*(s[i+1]-48)+s[i+2]-48;
		ans = min(ans, abs(753-a));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 888
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = (ll)a; i < (ll)b; i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(ll i = (ll)a - 1; i >= (ll)b; i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge{ll to, cost;};

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

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

long long extGCD(long long a,long long b,long long &p, long long &q){
    if(b == 0){p = 1; q = 0; return a;}
    long long d = extGCD(b, a % b, q, p);
    q -= a / b * p;
    return d;
}

pair<long long, long long> crt(const vector<long long> &b,const vector<long long> &m){
    long long r = 0, M = 1;
    for(int i = 0; i < b.size(); i++){
        long long p, q;
        long long d = extGCD(M, m[i], p, q);
        if((b[i] - r) % d != 0){
            return {0,0};
        }
        long long tmp = (b[i] - r) / d * p % ( m[i] / d );
        r += M * tmp;
        M *= m[i] / d;
    }
    return {( r >= 0 ? r % M: r % M + M), M};
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N;
    cin >> N;
    N *= 2;
    vP div;
    FOR(i,1,sqrt(N)+1){
        if(N%i==0){
            div.pb({N/i,i});
            div.pb({i,N/i});
        }
    }
    ll ans=INF;
    rep(i,div.size()){
        P X=crt({0,-1},{div[i].first,div[i].second});
        if(X.first==0){
            if(X.second==0)continue;
            X.first+=X.second;
        }
        chmin(ans,X.first);
    }
    cout << ans << '\n';
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 3856
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main(){
	int N,A,B;
	cin >> N >> A >> B;

	int ans;
	ans=min(N*A,B);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <list>

int main()
{
	int n, r;
	while(1){
		std::cin >> n >> r;
		if(n == 0 && r == 0) break;
		int a[50], b[50], i;
		for(i = 0; i < n; i++){
			a[i] = n-i;
		}
		int p, c;
		for(i = 0; i < r; i++){
			std::cin >> p >> c;
			int j;
			for(j = 0; j < p-1; j++){
				b[j] = a[j];
			}
			for(j = 0; j < c; j++){
				a[j] = a[p-1+j];
			}
			for(j = 0; j <p-1; j++){
				a[c+j] = b[j];
			}
		}
		std::cout << a[0] << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>

int main(int argc, char **argv)
{
	int a[4];
	int b[4];
	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
		std::cin >> b[0] >> b[1] >> b[2] >> b[3];
		int hit = 0, blow = 0;
		for(int i = 0; i < 4; i++){
			if(a[i] == b[i]){
				hit++;
			}else{
				for(int j = 0; j < 4; j++){
					if(a[i] == b[j]){
						blow++;
					}
				}
			}
		}
		std::cout << hit << " " << blow << std::endl;
	}
	return 0;
}

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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

#define MOD 1000000007

using ll = long long;
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<P> vpi;
typedef pair<ll,ll> Pl;
typedef vector<ll> vl;
typedef vector<Pl> vpl;

ll gcd(ll a, ll b){
    if(a < b) swap(a, b);
    if(b <= 0) return -1;
    ll r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

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


int main() {
    int N, M, ans=0;
    cin >> N >> M;
    vi H(N);
    vector<bool> ch(N, true);
    rep(i, N) cin >> H[i];
    vpi AB(M);
    rep(i, M) cin >> AB[i].first >> AB[i].second;

    rep(i, M) {
        int A = AB[i].first - 1;
        int B = AB[i].second - 1;
        if(H[A] > H[B]) ch[B] = false;
        else if(H[A] < H[B]) ch[A] = false;
        else {
            ch[A] = false;
            ch[B] = false;
        }
    }

    rep(i,N){
        if(ch[i]) ans++;
    }

    //string ans = ( flag ? "Yes" : "No" );
    //printf("%.8lf", ans);
    cout << ans;
    cout << "\n";
    return 0;
}


Measured memory_bytes: 4580
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

struct UF {
  int n, c;
  vector<int> p;
  UF() {}
  UF(int n) : n(n), c(n), p(n, -1) {}
  int find(int x) {
    return (p[x] < 0 ? x : p[x] = find(p[x]));
  }
  void unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return;
    if (p[x] > p[y]) swap(x,y);
    p[x] += p[y];
    p[y] = x;
    c--;
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
  // x を含む集合のサイズ
  int size(int x) {
    return -p[find(x)];
  }
  // 連結成分の個数
  int count() {
    return c;
  }
};

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

  int N,M;
  cin >> N >> M;
  vector<int> A(M),B(M),ans;
  REP(i,M) cin >> A[i] >> B[i], A[i]--, B[i]--;
  UF uf(N);
  int sum = N*(N-1)/2;
  ans.push_back(sum);
  for (int i = M-1; i > 0; i--) {
    if (!uf.same(A[i],B[i])) {
      sum -= uf.size(A[i]) * uf.size(B[i]);
      uf.unite(A[i],B[i]);
    }
    ans.push_back(sum);
  }
  REV(ans);
  REP(i,M) cout << ans[i] << endl;

  return 0;
}

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

int main() {
  
	int N;
    string S;
    cin >> N >> S;
  
    int hantei = 1;
  
    if ( N % 2 == 1 ){
      hantei = 0;
    }else{
      int a = N / 2;
      for ( int i = 0; i < N / 2; i ++){
        if ( S.at(i) != S.at(i+a) ){
          hantei = 0;
          break;
        }
      }
    }
    
    if (hantei){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>

int main()
{
    long long int x, k, d;
    std::cin >> x >> k >> d;

    x = std::llabs(x);
    long long int n = std::min(k, x / d);
    k -= n;
    x -= n * d;
    if (k & 1)
    {
        std::cout << d - x << std::endl;
    }
    else
    {
        std::cout << x << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}

int main(void) {
  ll N, K;
  cin >> N >> K;
  
  double ans=0;
  
  ll i;
  for(i=1; i<=N; i++) {
    ll cnt=0;
    ll t=i;
    while(t<K) {
      t*=2;
      cnt++;
    }
    
    ans+=1/(N*pow(2, cnt));
  }
  
  printf("%.10f\n", ans);
  
}











Measured memory_bytes: 256
import Data.List

main :: IO ()
main = do
  l1 <- getLine
  let n = read l1 :: Int
  ln <- sequence (replicate n getLine)
  let xys = map (map read . words) ln :: [[Double]]
      (xs, ys) = (map head xys, map (head . tail) xys)
      xys' = zip xs ys
      routes = permutations [0..n-1]
  print $ sum (map (\r -> sum $ zipWith (\i1 i2 -> f (xys' !! i1) (xys' !! i2)) r $ tail r) routes)/fromIntegral (length routes)

f (x1, y1) (x2, y2) = sqrt $ (x2 - x1)**2 + (y2 - y1)**2

Measured memory_bytes: 12028
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

signed main(){
    string s,t;cin >> s >> t;
    string ans;
    int n=s.size(),m=t.size();
    for(int i =0;i<=n-m;i++){
        bool f = 0;
        string a = s;
        for(int j=0;j<m;j++){
            if(a[i+j]=='?') continue;
            if(a[i+j]!=t[j]) f= 1;
        }
        if(f) continue;
        for(int j=0;j<m;j++) a[i+j] = t[j];
        for(int j=0;j<n;j++) if(a[j]=='?') a[j] = 'a';
        if(ans.empty()) ans = a;
        else ans = min(ans,a);
    }
    if(ans.empty()) cout << "UNRESTORABLE" << endl;
    else cout << ans << endl;
    return 0;
}

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

//create arrays outside of main()

int a[20];

int main(){

    int r;
    int d;
    int x;
    
    cin >> r >> d >> x;

    int finalAns = x;

    for(int i=0; i<10; i++){
        x = finalAns;
        finalAns = r*x - d;
        cout << finalAns;
        cout << '\n';
    }

    return 0;
}

Measured memory_bytes: 256
a = int(input(""))
b = int(input(""))
c = int(input(""))
x = int(input(""))
sum = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k == x:
                sum +=1
print(sum)

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


def main():
    h, w = map(int, input().split())
    A = [list(map(int, input().split()))for i in range(h)]
    B = [list(map(int, input().split()))for i in range(h)]
    abss = [[abs(A[i][j]-B[i][j])for j in range(w)] for i in range(h)]
    kmax = 6400
    dp = [[[0]*kmax for j in range(w)]for i in range(h)]
    dp[0][0][abss[0][0]] = 1
    for i in range(h):
        for j in range(w):
            for k in range(kmax):
                if dp[i][j][k] == 1:
                    if i != h-1:
                        dp[i+1][j][abs(k-abss[i+1][j])] = 1
                        if k+abss[i+1][j] < kmax:
                            dp[i+1][j][k+abss[i+1][j]] = 1
                    if j != w-1:
                        dp[i][j+1][abs(k-abss[i][j+1])] = 1
                        if k+abss[i][j+1] < kmax:
                            dp[i][j+1][k+abss[i][j+1]] = 1
    for k in range(kmax):
        if dp[-1][-1][k] == 1:
            print(k)
            break


if __name__ == '__main__':
    main()

Measured memory_bytes: 395176
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう

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

int main() {
  int q;
  string ss;
  cin>>ss>>q;
  deque<char> s;
  for(char c:ss){
    s.emplace_back(c);
  }
  int cnt=0;
  int temp=0;
  int a=0;
  char x;
  int l=ss.size();
  cerr<<l<<endl;
  rep(i,q){
    cin>>a;
    if(a==1){
      cnt++;
      continue;
    }
    else{
      if(cnt%2){a+=2;}
      cin>>temp>>x;
      a+=temp;
      temp=0;
      l++;
      if(a==3||a==6)s.emplace_front(x);
      else s.emplace_back(x);
    }
  }
  if(cnt%2==0){rep(i,l){cout<<s.front();s.pop_front();}}
  else{rep(i,l){cout<<s.back();s.pop_back();}}
  cout<<'\n';
}


Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
inline char nc(){
	static char buf[100000],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline int red(){
	int res=0,f=1;char ch=nc();
	while (ch<'0'||'9'<ch) {if (ch=='-') f=-f;ch=nc();}
	while ('0'<=ch&&ch<='9') res=res*10+ch-48,ch=nc();
	return res*f;
}

const int maxn=100005;
int n,L,T,a[maxn],num;
int main(){
	n=red(),L=red(),T=red();
	for (int i=0;i<n;i++){
		int x=red(),f=red();
		if (f==1){
			(num+=(x+T)/L)%=n;
			a[i]=(x+T)%L;
		}else{
			(num-=(L-x-1+T)/L)%=n;
			a[i]=((x-T)%L+L)%L;
		}
	}
	sort(a,a+n);
	for (int i=0;i<n;i++) printf("%d\n",a[(i+num+n)%n]);
	return 0;
}

Measured memory_bytes: 1536
# しらんけど
# ふつうにこれやったらTLEなったのでアレする
# n = int(input())
# print(sum(range(n)))

n = int(input())
if n % 2 == 0:
    a = (1 + n) * (n // 2)
    print(a - n)
else:
    a = (1 + n) * ((n - 1) // 2) + (n // 2 + 1)
    print(a - n)



Measured memory_bytes: 2940
#時系列の逆順で見る
def root(x):
    if p[x]==x:
        return x
    p[x] = y = root(p[x])
    return y
def union(x,y):
    px = root(x); py = root(y)
    if px == py:
        return
    if r[px]>r[py]:
        p[py]=px
    else:
        p[px]=py
        if r[py]==r[px]:
            r[py]+=1
def same(x,y):
    px = root(x)
    py = root(y)
    if px==py:
        return True
    else:
        return False
n,m = map(int, input().split( ))

e = []

for i in range(m):
    a,b = map(int, input().split( ))
    e.append((a,b))

e.reverse()
p = [i for i in range(n+1)]
r = [0 for i in range(n+1)]
c = [1 for i in range(n+1)]

cnt = 0
ans=[]
for i in range(m-1):
    x,y = e[i]
    if same(x,y):
        ans.append(n*(n-1)//2-cnt)
    else:
        cx = c[root(x)];cy=c[root(y)]
        union(x,y)
        cnt += (cx+cy)*(cx+cy-1)//2 - cx*(cx-1)//2 - cy*(cy-1)//2
        c[root(x)] = 0; c[root(y)]=0
        c[root(x)] = cx+cy
        ans.append(n*(n-1)//2-cnt)
ans.reverse()
for ai in ans:
    print(ai)
print(n*(n-1)//2)
    
    


Measured memory_bytes: 24084
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll K, A, B; cin >> K >> A >> B;
  for (ll i = A; i <= B; i++) {
    if (i % K == 0) {
      cout << "OK\n";
      return 0;
    }
  }
  cout << "NG\n";

  return 0;
}



Measured memory_bytes: 3504
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=500005;
const int NAX=1005;
const long long  MOD=(long long)(1e9+7);

Int N,M,K;
Int X,Y,Z;
Int H,W;
Int perform(Int x){
    return (x*(x+1))/2LL;
}
vector<Int> A;
vector<int> adj[MAXN];
using D=long double;

bool inRange(Int a,Int b){
    return a*b<=0;
}

long long C[NAX][NAX];



long long ModExpo(long long x,unsigned long long y,long long M){
    Int ans=1;
    ans=(long long)ans;
    
    while(y>0){
        if(y&1) ans=((ans%M)*(x%M))%M;
        y>>=1LL;
        x=((x%M)*(x%M))%M;
    }
    return ans%M;
}
long long fac[MAXN];
void fillFac(){
    fac[0]=1;
    for(int i=1;i<MAXN;++i){
        fac[i]=(fac[i-1]*i)%MOD;
    }
}

long long ModInv(long long x){
    return ModExpo(x,MOD-2,MOD);
}

long long FermatLast(long long n,long long r){
    if(r>n) return 0;
    if(!r) return 1;
    return (fac[n] * ModInv(fac[r]) % MOD * ModInv(fac[n - r]) % MOD) % MOD;
}

Int performMod(Int x){
    Int y=((x%MOD)*((x+1)%MOD))%MOD;
    return (y*ModInv(2))%MOD;
}

Int madd(Int x,Int y){
    return (x+y)%MOD;
}


const D pi=3.14159265359;
int main()
{
    cin>>N;
    string S=to_string(N);
    
    if(N<10){
        cout<<N<<"\n";
        exit(0);
    }
    if(floor(log10(N))==ceil(log10(N))){
        cout<<"10\n";
        exit(0);
    }
    Int ans=0;
    for(auto x:S) ans+=x-'0';
    cout<<ans<<"\n";
    
}


Measured memory_bytes: 15744
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,a,b;
	string input;
	cin >> n >> a >> b;	
	cin >> input;
	int passed =0;
	int bPassed =1;
	for(int i = 0;i<n;i++) {
		if(passed < (a+b) && input[i] != 'c') {
			if(input[i] == 'a') {
				cout << "Yes\n";
				passed++;
			}
			else if(input[i] == 'b' && bPassed <= b) {
				cout << "Yes\n";
				passed++;
				bPassed++;
			}
			else 
				cout << "No\n";
		}
		else
			cout << "No\n";
	}
}


Measured memory_bytes: 3792
fun main(args: Array<String>) {
    abc109c()
}

fun abc109c() {
    val (n, x) = readLine()!!.split(" ").map { it.toInt() }
    val xList = readLine()!!.split(" ").map { it.toInt() }

    val distances = xList.map { Math.abs(it - x) }
        .filter { it != 0 }

    var gcd = distances[0]
    (distances.indices).forEach { gcd = gcd(gcd, distances[it]) }

    println(gcd)
}

private fun gcd(a: Int, b: Int): Int {
    var aTemp = a
    var bTemp = b
    var temp: Int
    while (aTemp % bTemp != 0) {
        temp = aTemp
        aTemp = bTemp % aTemp
        bTemp = temp
    }
    return bTemp
}


Measured memory_bytes: 55740
import java.util.*;

class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        int INF = Integer.MAX_VALUE/2;
        int n = sc.nextInt();
        int[] cost = new int[n-1];
        for(int i=0; i<n-1; i++) cost[i] = sc.nextInt();

        int[][][] dp = new int[2][n/2+1][2];
        for(int i=0; i<2; i++)
            for(int j=0; j<dp[i].length; j++) Arrays.fill(dp[i][j], INF);

        dp[0][1][0] = 0;
        dp[0][0][1] = 0;

        int idx = 1;
        for(int i=1; i<n; i++){
            for(int j=0; j<=i && j<=n/2; j++){
                for(int k=0; k<2; k++){
                    int nj = j;
                    if(k==0) nj--;
                    if(nj>=0) dp[idx][j][k] = Math.min(dp[idx][j][k], dp[1-idx][nj][k]);
                    if(nj>=0) dp[idx][j][k] = Math.min(dp[idx][j][k], dp[1-idx][nj][1-k] + cost[i-1]);
                }
            }
            idx = 1-idx;
            for(int j=0; j<dp[idx].length; j++) Arrays.fill(dp[idx][j], INF);
        }

        int ans = Math.min(dp[1-idx][n/2][0], dp[1-idx][n/2][1]);
        System.out.println(ans);
    }

    public static void main(String[] args){
        new Main().solve();
    }
}

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

using namespace std;

long long mod_pow(long long a,long long b,long long mod){
	long long res=1,c=a;
	while(b){
		if(b&1) res=res*c%mod;
		c=c*c%mod;
		b/=2;
	}
	return res;
}

long long inv(long long a,long long mod){
	long long b=mod,p=1,q=0;
	while(b){
		long long c=a/b,d=a;
		a=b;
		b=d%b;
		d=p;
		p=q;
		q=d-c*q;
	}
	return (p+mod)%mod;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	long long mod=1000000007;
	vector<vector<int>> ad(n);
	for(int i=1;i<n;i++){
		int a,b;
		cin >> a >> b;
		a--,b--;
		ad[a].push_back(b);
		ad[b].push_back(a);
	}
	
	long long res=0;
	vector<long long> dp(n);
	function<void(int,int)> dfs=[&](int cur,int par){
		long long sum=1;
		long long sum2=0;
		for(int ch:ad[cur]){
			if(ch==par) continue;
			dfs(ch,cur);
			dp[cur]+=dp[ch];
			sum=sum*mod_pow(2,dp[ch],mod)%mod;
			sum2=(sum2+mod_pow(2,dp[ch],mod)-1+mod)%mod;
		}
		dp[cur]++;
		sum=sum*mod_pow(2,n-dp[cur],mod)%mod;
		sum2=(sum2+mod_pow(2,n-dp[cur],mod)-1+mod)%mod;
		res=(res+mod_pow(2,n-1,mod)-sum2-1+mod+mod)%mod;
		res%=mod;
		//cout << cur << " " << res << "\n";
	};
	dfs(0,-1);
	res=res*mod_pow((mod+1)/2,n,mod)%mod;
	cout << res << "\n";
	return 0;
}

Measured memory_bytes: 26112
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int i = 0, sum = 0;
  while (i < N) {
    int r, l;
    cin >> r >> l;
    sum += l - r + 1;
    i++;
  }
  cout << sum << endl;
}

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

#define int long long
#define fi first
#define se second
#define otp(n) cout << n;
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define ctv(v) rep(i,(v).size()) ct(v[i])
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(int i=0;i<(v).size();i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);

int q,h,s,d,n;

main() {
    cin >> q >> h >> s >> d >> n;
    h = min(h,q*2);
    s = min(s,h*2);
    d = min(d,s*2);
    ct((n/2)*d+(n%2)*s)
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//
        int S;
        cin >> S;

        
        cout << 48-S << endl;

        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    vector<int> a(n), b(n);
    map<int, int> mp;
    rep(i, n) {
        cin >> a[i];
        mp[a[i]] = i%2;
        b[i] = a[i];
    }

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

    int ans = 0;
    rep(i, n) {
        if(mp[b[i]] != i%2) {
            ans++;
        }
    }

    if(ans%2 == 0) {
        ans /= 2;
    }   
    else {
        ans /= 2;
        ans++;
    }

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

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
ll n; string s;
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l;
	cin>>n;
	cin>>s;
	
	ll s1[n+2]={0},s2[n+2]={0},s3[n+2]={0};
	for(i=n-1;i>=0;i--){
		if(s[i]=='R') s1[i]=1;
		else if(s[i]=='G') s2[i]=1;
		else if(s[i]=='B') s3[i]=1;
		s1[i]+=s1[i+1]; s2[i]+=s2[i+1]; s3[i]+=s3[i+1];
	}

	ll an=0;
	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			if(s[i]!=s[j]){
				ll f=0;
				if(j+(j-i)<n&&s[j+(j-i)]!=s[i]&&s[j+(j-i)]!=s[j]){
					f=1;
				}
				if(s[i]=='R'){
					if(s[j]=='B'){
						an+=(s2[j+1]-f);
					}
					else an+=(s3[j+1]-f);
				}
				else if(s[i]=='G'){
					if(s[j]=='B'){
						an+=(s1[j+1]-f);
					}
					else an+=(s3[j+1]-f);
				}
				else if(s[i]=='B'){
					if(s[j]=='R'){
						an+=(s2[j+1]-f);
					}
					else an+=(s1[j+1]-f);
				}
			}
		}
	}
	cout<<an<<endl;
	return 0;
}

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

bool sosuu(int n){
    if(n<=1) return false;
    if(n==2) return true;

    for(int i=2; i<=(int)sqrt(n); i++){
        if(n%i==0) return false;
    }

    return true;
}

int main() {
    int q; cin >> q;
    vector<int> l(q), r(q);
    int mr = 0;
    rep(i,q) {
        cin >> l.at(i) >> r.at(i);
        mr = max(mr, r.at(i));
    }

    vector<int> sum(mr+10);
    sum.at(1) = 0;
    sum.at(2) = 0;

    for(int i=3; i<=mr; i++){
        if(i%2==0){
            sum.at(i) = sum.at(i-1);
            continue;
        }

        if(sosuu(i)&&sosuu((i+1)/2)) sum.at(i) = sum.at(i-1)+1;
        else sum.at(i) = sum.at(i-1);
    }

#if 1
    for(int i=0; i<q; i++){
        cout << sum.at(r.at(i)) - sum.at(l.at(i)-1) << endl;
    }
#endif

}


Measured memory_bytes: 1792
#include<stdio.h>
int main(void)
{
  int A,B,C,left;
  
  scanf("%d",&A);
  scanf("%d",&B);
  scanf("%d",&C);
  
  if(C>A-B){
  left = C-(A-B);
  }
  else{
    left = 0;
  }
  
  printf("%d",left);
  
  return 0;
}

Measured memory_bytes: 128
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=pow(10,18);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const ll dx[4]={0,0,1,-1};
const ll dy[4]={-1,1,0,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

ll count(string s){
  reverse(all(s));
  ll count=0;
  rep(i,s.size()){
    if(s[i]=='0')count++;
    else return count;
  }
  return count;
}

bool solve(){
  ll n,p;cin>>n>>p;
  vector<ll>A(n);
  rep(i,n)cin>>A[i];
  bool isOK=true;
  rep(i,n){
    if(A[i]%2==1)isOK=false;
  }
  if(isOK){
    if(p%2==1)cout<<0<<endl;
    else cout<<(ll)pow(2,n)<<endl;
    return false;
  }
  cout<<(ll)pow(2,n-1)<<endl;
  return false;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed;
  return solve();
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    for (int i=0;i<a;i++){
      int t = scan.nextInt();
      if (t%2 != 0){
        continue;
      }
      else{
        if ((t%3 == 0) || (t%5 == 0)){
          continue;
        }
        System.out.println("DENIED");
        return;
      }
    }
    System.out.println("APPROVED");
  }
}


Measured memory_bytes: 36012
//Be Name Khoda
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma optimize O3
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long int LL;
typedef LL ll;
typedef long double ld;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
#define RET(x) { cout << x; exit(0); } 
#define RETD(x) { cout << fixed << setprecision(15) << x; exit(0); }
const ll M=2e3+5,LG=32,SM=600+5,inf=1e18+5;
ll mod=1e9+7;

ll n,m,q;
str jad[M];
ll ps[M][M];
ll vps[M][M];
ll hps[M][M];

int main()
{
	ios::sync_with_stdio(0);
	cin >> n >> m >> q;
	For(i,0,n)
	{
	    cin >> jad[i];
	}
	For(i,0,n) For(j,0,m)
	{
	    ps[i+1][j+1]=ps[i][j+1]+ps[i+1][j]-ps[i][j];
	    vps[i+1][j+1]=vps[i][j+1]+vps[i+1][j]-vps[i][j];
	    hps[i+1][j+1]=hps[i][j+1]+hps[i+1][j]-hps[i][j];
	    if (jad[i][j]=='1')
	    {
	        ps[i+1][j+1]++;
	        vps[i+1][j+1]+=(j+1<m && jad[i][j+1]=='1');
	        hps[i+1][j+1]+=(i+1<n && jad[i+1][j]=='1');
	    }
	}
    while (q--)
    {
        ll x1,y1,x2,y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1--;
        y1--;
        ll res=ps[x2][y2]-ps[x1][y2]-ps[x2][y1]+ps[x1][y1];
        res-=vps[x2][y2-1]-vps[x2][y1]-vps[x1][y2-1]+vps[x1][y1];
        res-=hps[x2-1][y2]-hps[x2-1][y1]-hps[x1][y2]+hps[x1][y1];
        cout << res << '\n';
    }
}    


Measured memory_bytes: 100224
#include<iostream>
using namespace std;
int main(){
    int N, M, A;
    cin >> N >> M;
    for (int i = 0; i < M; i++){
        cin >> A;
        N -= A;
    }
    if(N < 0)cout << "-1" << endl;
    else     cout << N << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int main()
{
    ciosup;
    ll k;
    cin >> k;
    vector<ll> a(50);
    if (k == 0){
        cout << 2 << endl;
        cout << 1 << " " << 1 << endl;
    }else{
        ll ad = k / 50;
        ll amari = k % 50;
        REP(i,50){
            a[i] = 49 + ad;
        }
        REP(i,amari){
            a[i] += 50;
            REP(j,50){
                if (j != i){
                    --a[j];
                }
            }
        }
        cout << 50 << endl;
        REP(i, 49) { cout << a[i] << " "; }
        cout << a[49] << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <iostream>

using namespace std;

int main()
{
    string a, b;
    cin >> a >> b;
    bool output = true;
    for (int i = 0; i < a.size();i++) {
        if (a[i] != b[i]) {
            output = false;
            break;
        }
        
    }
    if (output) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h> // Include every standard library 
using namespace std; 
  
typedef long long ll; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
  
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define all(v) v.begin(), v.end() 
#define input_arr(a,n) for(int i=0;i<n;i++)cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";



main(){
    int n,k;
    cin>>n>>k;
    vector<ll> h(n);
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    vector<ll> dp(n,INT32_MAX);
    dp[0]=0;
    for(int i=1;i<n;i++){
        for(int j=1;j<=k;j++)
        if(i-j>=0)
        dp[i]=min(dp[i-j]+abs(h[i]-h[i-j]),dp[i]);
    
    }
    cout<<dp[n-1];
    
}
	
	





Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  cout << N * N * N << '\n';
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e9)
using namespace std;
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    ll A[100010];
    cin >> N;
    ll MOD = 1e9 + 7;
    rep(i,0,N){
        cin >> A[i];
    }
    sort(A, A+N);
    ll ans = 1;
    bool is_ok = true;
    rep(i,0,N){
        if(N % 2 != 0){
            if(A[0] != 0){
                is_ok = false;
            }else{
                if(A[i] != 2 *  ((i+1)/2)){
                    is_ok = false;
                }
            }
        }else{
            if(A[i] != 2 * (i/2) + 1){
                is_ok = false;
            }

        }
    }
    if(!is_ok){
        print(0);
        return 0;
    }else{
        if(N % 2 != 0){
            rep(i,0,(N-1)/2){
                ans *= 2;
                ans %= MOD;
            }
        }else{
            rep(i,0,N/2){
                ans *= 2;
                ans %= MOD;
            }
        }
        print(ans);
    }
}


Measured memory_bytes: 1024
s = input()
def check(a):
    ALLOWED = "ACGT"
    for c in a:
        if not c in ALLOWED:
            return False
    return True

ans = 0
for i in range(len(s)):
    for j in range(1, len(s) - i + 1):
        tmp = s[i: i + j]
        if check(tmp):
            ans = max(ans, len(tmp))
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int k;
	cin>>k;
	int x=0,ans=0;
	while (1)
	{
		if (ans>1e6)   break;
		x=x*10+7;
		x%=k;
		ans++;
		if (!x)   break;
	}
	if (!x)   cout<<ans;
	else   cout<<-1;
	return 0;
} 

Measured memory_bytes: 3644
n=int(input())
a=[int(i) for i in input().split()]
while len(a)>1:
    c=[]
    d=min(a)
    for i in range(len(a)):
        if a[i]!=d:
            div=a[i]%d
            if div!=0:
                c.append(div)
    c.append(d)        
    a=c
print(a[0])

Measured memory_bytes: 14252
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

int main() {
	lint N;
	cin >> N;
	vector<lint>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	lint M;
	cin >> M;
	vector<lint>B(M);
	rep(i, M) {
		cin >> B[i];
	}
	vector<vector<lint>>V(2);
	V[0] = A;
	V[1] = B;
	sort(V);
	if (V[0] == B) {
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}
}




Measured memory_bytes: 3200
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

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


ull E = 1000000007;

int main() {
    int N;
    cin >> N;
    ull pow = 1;
    for (int i = 1; i <= N; ++i) {
        pow = ((pow % E) * (i % E)) % E;
    }
    cout << pow << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define vs vector<string>
#define ss second
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<pair<string,int>, int> &a,const pair<pair<string,int>, int> &b)
{
    if(a.ff.ff == b.ff.ff) {
        return (a.ff.ss > b.ff.ss);
    }
    return (a.ff.ff<b.ff.ff);
}
int min(int a, int b){
    if(a<b){
        return a;
    }
    else{
        return b;
    }
}
int max(int a, int b){
    if(a>b){
        return a;
    }
    else{
        return b;
    }
}
int poww(int a, int b)
{
    int res = 1;
    for(int i = 1; i<=b; ++i)
        res *= a;

    return res;
}
int findlcm(int arr[], int n) 
{ 
    // Initialize result 
    int ans = arr[0]; 
  
    // ans contains LCM of arr[0], ..arr[i] 
    // after i'th iteration, 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (__gcd(arr[i], ans))); 
  
    return ans; 
}
bool prime[100001];
void SieveOfEratosthenes(int n) 
{
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
  }
}

//Define mx for maximum range and MOD for large numbers
#define mx 200001
#define MOD 1000000007;
// Declare all the variables and global functions here - 
int n,m;
int32_t main(){
    IOS;
    int n;
    cin >> n;
    cout <<(n-2)*180 << endl;

 }

Measured memory_bytes: 256
#include<bits/stdc++.h>	
#define int long long int
using namespace std;
int dp[105][100005];
main()
{	
	int n,w,ans=0;
	cin>>n>>w;
	vector<pair<int,int> >v;
	v.push_back({0,0});
	for(int i=1;i<=n;i++){
		int x,y;
		cin>>x>>y;
		v.push_back({x,y});
	}
	sort(v.begin(),v.end());
	for(int i=v[1].first;i<=w;i++){
		dp[1][i]=v[1].second;
	}
	for(int i=2;i<=n;i++){
		for(int j=0;j<=w;j++){
			if(j>=v[i].first)
				dp[i][j]=max(dp[i-1][j],v[i].second+dp[i-1][j-v[i].first]);
			else dp[i][j]=dp[i-1][j];		
		}
	}
	for(int i=0;i<=w;i++)
		ans=max(dp[n][i], ans);
	cout<<ans;
}

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

int main(){
	int t[40];
	t[0] = 1;
	int n;
	cin >> n;
	while(n!=0){
		for(int i = 1; i < 40; i++)t[i] = 0;
		for(int i = 0; i < n; i++){
			t[i+1] += t[i];
			t[i+2] += t[i];
			t[i+3] += t[i];
		}
		cout << ceil((double)t[n]/3650) << endl;
	cin >> n;
	}
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

int main ()
{
    char s ;
    cin >> s ;
    s += 1 ;

    cout << s ;

    return 0 ;
}


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

int main()
{
	int m,d;
	cin>>m>>d;
	int count=0;
	for(int k=4;k<=m;k++)
	{
		for(int i=22;i<=d;i++)
		{
			int unit = i%10;
			int tens = i/10;
			if(unit<2 || tens<2)
				continue;
			if(unit*tens==k)
				count++;
		}
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N,K = MI()
S = LI2()

A = []
a = 1
for i in range(1,N):
    if S[i-1] == S[i]:
        a += 1
    else:
        A.append(a)
        a = 1
A.append(a)

l = len(A)
if l <= 2*K-1:
    print(N)
    exit()

if S[0] == 1:
    A = [1]+A
if S[-1] == 1:
    A = A+[1]

A = [0]+A
l = len(A)

from itertools import accumulate

A = list(accumulate(A))
ans = 0
for i in range(l//2-K+1):
    if i == 0:
        ans = max(ans,A[2*(K+i)]-A[2*i])
    elif i == l//2-K:
        ans = max(ans,A[2*(K+i)-1]-A[2*i-1])
    else:
        ans = max(ans,A[2*(K+i)]-A[2*i-1])

print(ans)


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

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i=1; i<10; i++){
        string s = to_string(i);
        int num = stoi(s+s+s);
        if(num >= n){
            cout << num << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int d;
  cin >> d;
  if(d == 25){
    cout << "Christmas" << endl;
  }else if(d == 24) cout << "Christmas Eve" << endl;
  else if(d == 23) cout << "Christmas Eve Eve" << endl;
  else cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
long long max(long long a, long long b){
  return a > b ? a : b;
}

long long min(long long a, long long b){
  return a < b ? a : b;
}
int main(){
        int n=0;
        scanf("%d", &n);
        int a[n];
        for(int i = 0; i < n; i++){
            scanf("%d",&a[i]);
        }

        long long dp[n][n][2]; // dp[i][j] -> x - y value in i to j

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

        for(i = n-2; i >= 0; i--){
            for(j = i+1; j < n; j++){
                    dp[i][j][0] = max(a[i]+ dp[i+1][j][1],a[j] + dp[i][j-1][1]);
                    dp[i][j][1] = min(-a[i]+ dp[i+1][j][0], -a[j] + dp[i][j-1][0]);
            }
        }
        printf("%lld\n", dp[0][n-1][0]);
}

Measured memory_bytes: 140288