akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
#define space putchar(' ')
#define endl putchar('\n')
#define debug puts("------------------------")
#define F(i,x,n) for(int i=x;i<=n;++i)
#define F_(i,x,n) for(int i=x;i>=n;--i)
using namespace std;
inline void read(int &a) {a=0;int c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();a*=b; }
inline int  Rem() {int a=0,c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();return a*=b; }
inline void write(int x) {if(x>9)write(x/10);putchar('0'+x%10);}
inline void W(int x) {if(x<0){putchar('-'),x=-x;}write(x);}
/**/
const int N=305,inf=0x3f3f3f3f;
int n,m,head[N],cnt,q,s,t,V,dis[N][N],you[N];
bool vis[N];
struct edge
{
    int nxt,to,w;
}e[N*N];
inline void add_edge(int u,int v,int w)
{
    if(V<w) return;
    e[++cnt]=(edge){head[u],v,w};
    head[u]=cnt;
}
/**/
void dijkstra(int s){
    // cout<<s<<'\n';
    for(int i=1;i<=n;i++) dis[s][i]=inf,you[i]=-1,vis[i]=0;
    dis[s][s]=0;you[s]=V;
    for(int i=1;i<n;i++){
        int u=0;
        for(int j=1;j<=n;j++) if(!vis[j]&&(dis[s][j]<dis[s][u]||!u||(dis[s][j]==dis[s][u]&&you[j]>you[u]))) u=j;
        vis[u]=1;
        for(int j=head[u];j;j=e[j].nxt){
            int v=e[j].to;if(vis[v]) continue;
            if(e[j].w>you[u])
            {
                if(dis[s][v]>dis[s][u]+1) dis[s][v]=dis[s][u]+1,you[v]=V-e[j].w;
                else if(dis[s][v]==dis[s][u]+1&&you[v]<V-e[j].w) you[v]=V-e[j].w;
            }
            else
            {
                if(dis[s][v]>dis[s][u]) dis[s][v]=dis[s][u],you[v]=you[u]-e[j].w;
                else if(dis[s][v]==dis[s][u]&&you[u]-e[j].w>you[v]) you[v]=you[u]-e[j].w;
            }
        }
    } 
} 
int main()
{
    read(n);read(m);read    (V);
    for(int i=1,a,b,c;i<=m;i++)
    {
        read(a);read(b);read(c);
        add_edge(a,b,c);
        add_edge(b,a,c);
    }
    for(int i=1;i<=n;i++) dijkstra(i);
    read(q);
    while(q--)
    {
        read(s);read(t);
        if(dis[s][t]==inf) puts("-1");
        else cout<<dis[s][t]<<'\n';
    }
}


Measured memory_bytes: 1792
# A
X = int(input())
if X >= 400 and X <= 599:
    print(8)
elif X >= 600 and X <= 799:
    print(7)
elif X >= 800 and X <= 999:
    print(6)
elif X >= 1000 and X <= 1199:
    print(5)
elif X >= 1200 and X <= 1399:
    print(4)
elif X >= 1400 and X <= 1599:
    print(3)
elif X >= 1600 and X <= 1799:
    print(2)
elif X >= 1800 and X <= 1999:
    print(1)

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

int main(){
    int N;
    int64_t x;
    cin >> N >> x;

    vector<int64_t> a(N);
    for(auto& i : a){
        cin >> i;
    }

    int64_t ans = 0;
    if(a[0] > x){
        ans += a[0] - x;
        a[0] = x;
    }
    if(a[N - 1] > x){
        ans += a[N - 1] - x;
        a[N - 1] = x;
    }
    for(int i = 1; i < N - 1; ++i){
        if(a[i - 1] + a[i] > x){
            ans += a[i - 1] + a[i] - x;
            a[i] = x - a[i - 1];
        }
    }
    if(a[N - 2] + a[N - 1] > x){
        ans += a[N - 2] + a[N - 1] - x;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=51;

int n,m;

char a[N][N];

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

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%s",a[i]+1);
	bool flag=true;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(a[i][j]=='#')
			{
				bool ok=false;
				for(int k=0;k<4;k++)
				{
					int x=i+dx[k],y=j+dy[k];
					if(x>=1&&x<=n&&y>=1&&y<=m&&a[x][y]=='#')
						ok=true;
				}
				if(!ok)
					flag=false;
			}
	puts(flag?"Yes":"No");
} 

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

typedef complex<int> point;
typedef long long int lli;
typedef long double ld;
#define pii pair<int,int>
#define lasB(b) (b&(-b))
#define pld pair<ld,ld>
#define mod 1000000007
#define PI acos(-1.0)
#define PB push_back
#define N   1000006
#define EPS (1e-8)
#define ss substr
#define S second
#define IM image
#define F first
#define RE real
#define B begin
#define E end

int n;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    if(n==1)
    {
        cout<<"Hello World";
    }
    else
    {
        int a,b;
        cin>>a>>b;
        cout<<a+b;
    }
    return 0;
}


Measured memory_bytes: 256
N,S=map(int,input().split())
A=list(map(int,input().split()))
pr=998244353
def gya(n):
    return pow(n,pr-2,pr)
p=pow(2,N-1,pr)
l=[0]*(S+1)
g=gya(2)
for i in A:
    for j in range(S-i,-1,-1):
        l[i+j]=(l[i+j]+(l[j]*g))%pr
    if i<=S:
        l[i]+=p
print(l[-1])

Measured memory_bytes: 68380
n = int(input())
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]
c = 0

for i in range(n):
    t = min(a[i], b[i])
    c += t
    b[i] -= t
    if b[i]:
        t = min(a[i + 1], b[i])
        c += t
        a[i + 1] -= t
print(c)

Measured memory_bytes: 18468
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 100000

int n,ans;
int x[MAXN+3];

int gcd(int a,int b) {
	if(b==0) return a;
	return gcd(b,a%b);
}
int main() {
	scanf("%d %d",&n,&x[0]);
	for(int i=1;i<=n;i++)
		scanf("%d",&x[i]);
	sort(x,x+n+1);
	ans=x[1]-x[0];
	for(int i=2;i<=n;i++)
		ans=gcd(ans,x[i]-x[i-1]);
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll a, b;
    cin >> a >> b;
    ll ans = 0;
    while(ans*(a-1)+1 < b) ans++;
    cout << ans;
    return 0;
}

Measured memory_bytes: 3540
import numpy as np

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    maxi = 0
    for i in range(N):
        if(A[i] >= maxi):
            ans += 1
        maxi = max(maxi, A[i])
    print(ans)

Measured memory_bytes: 20640
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){

    int N,a[3];
    scanf("%d",&N);
    while(N--){

        scanf("%d%d%d",&a[0],&a[1],&a[2]);

        sort(a,a+3);

        if(a[2]*a[2]==a[1]*a[1]+a[0]*a[0])
            printf("YES\n");

        else
        printf("NO\n");
    }
    return 0;

    }

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long ll;
#define endl '\n'

void solve() {
    ll X;
    cin >> X;

    ll cur = 100;
    for (int i = 1; i <= 3760; ++i) {
        cur *= 1.01;
        if (cur >= X) {
            cout << i << endl;
            break;
        }
    }
}

int main() {
    FAST_IO;

    int t;
    // cin >> t;
    t = 1;

    while (t--) {
        solve();
    }
    
    return 0;
}

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

int main() {
  int A, B;
  scanf("%d%d", &A, &B);
  int ans = 0;
  for (int i = A; i <= B; i++) {
    int o = i % 10;
    int o_pair = i / 10000 % 10;
    int t = i / 10 % 10;
    int t_pair = i / 1000 % 10;
    if (o == o_pair && t == t_pair) ans++;
  }
  printf("%d", ans);
}


Measured memory_bytes: 384
#!/usr/bin/env python3
import sys


def solve(N: int, A: int, B: int):
    per, remain = divmod(N, A + B)
    print(per * A + min(A, remain))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(N, A, B)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
import itertools
import collections
#sys.stdin=file('input.txt')
#sys.stdout=file('output.txt','w')
#10**9+7
mod=1000000007
#mod=1777777777
pi=3.141592653589
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),(1,1),(1,-1)]
def gcd(a,b): return a if b==0 else gcd(b,a%b)
def lcm(a,b): return a*b/gcd(a,b)
#start = time.clock()
#n=int(raw_input())
def dfs(a):
    if len(a)<2:
        yield (a[0],str(a[0]))
    for i in range(len(a)-1):
        for l in dfs(a[:i+1]):
            for r in dfs(a[i+1:]):
                yield (l[0]+r[0],'(%s+%s)'%(l[1],r[1]))
                yield (l[0]-r[0],'(%s-%s)'%(l[1],r[1]))
                yield (l[0]*r[0],'(%s*%s)'%(l[1],r[1]))
def sol(a):
    for e in itertools.permutations(a):
        for n,s in dfs(e):
            if n==10:
                print(s)
                return 1
    pass
                
op='-+*'
while 1:
    a=map(int,raw_input().split())
    if a==[0,0,0,0]:
        break
    if not sol(a):
        print 0

Measured memory_bytes: 6708
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (c1).begin(),(c1).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);

int n, minc1 = INF, minc2 = INF, maxc1 = -INF, maxc2 = -INF;
int c1[101010], c2[101010];

bool cond(int c11, int c21, int c12, int c22, int m) {
	for (int i = 0; i<n; i++) {
		int C1 = c1[i], C2 = c2[i];
		if (min(max(abs(C1 - c11), abs(C2 - c21)), max(abs(C1 - c12), abs(C2 - c22)))>m) return 0;
	}
	return 1;
}

bool calc(int mid) {
	return cond(minc1, minc2, maxc1, maxc2, mid) || cond(minc1, maxc2, maxc1, minc2, mid);
}

int main() {
	cin >> n;
	for (int i = 0; i<n; i++) {
		int a, b;
		cin >> a >> b;
		c1[i] = a - b;
		c2[i] = a + b;
		minc1 = min(minc1, c1[i]);
		minc2 = min(minc2, c2[i]);
		maxc1 = max(maxc1, c1[i]);
		maxc2 = max(maxc2, c2[i]);
	}
	int l = 0, r = INF;
	while (r - l>1) {
		int mid = (l + r) / 2;
		if (calc(mid)) r = mid;
		else l = mid;
	}
	cout << r << endl;
}


Measured memory_bytes: 3836
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <memory.h>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
using namespace std;

const int Maxn=1005;

int h,w,d;

int main(){
	scanf("%d%d%d",&h,&w,&d);
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			int x=i+j+1000*d,y=i-j+1000*d;
			x%=2*d;
			y%=2*d;
			if(!x) x=2*d;
			if(!y) y=2*d;
			if(x<=d){
				if(y<=d) printf("R");
				else printf("Y");
			}
			else{
				if(y<=d) printf("G");
				else printf("B");
			}
		}
		printf("\n"); 
	}
return 0;
}

Measured memory_bytes: 512
def draw_rect(h, w):
    for i in range(h):
        for j in range(w):
            print("#", end="")
            
        print("")
        
    print("")

while True:
    [h, w] = map(int, input().split(" "))
    if h == 0 and w == 0:
        break
    
    draw_rect(h, w)





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

int main()
{
    string X;
    cin >> X;
    
    stack<char> st;
    int dn = 0;

    for (int i = 0; i < (int)X.size(); i++) {
        if (X[i] == 'S') {
            st.push(X[i]);
        }
        else if (st.empty() || st.top() == 'T') {
            st.push(X[i]);
        }
        else {
            st.pop();
        }
    }

    cout << st.size() << endl;

    return 0;
}

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

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

    vector<int> k(m);
    vector<vector<int>> s(m);
    vector<int> p(m);

    rep(i, m){
        cin >> k[i];
        rep(j, k[i]){
            int tmp;
            cin >> tmp;
            s[i].push_back(tmp);
        }
    }
    rep(i, m) cin >> p[i];

    int ans = 0;

    vector<int> sw(n);

    for(int i=0;i<pow(2,n);i++){
        bool flag = 1;
        int tmp = i;

        for(int j=n-1;j>=0;j--){
            sw[j] = tmp % 2;
            tmp /= 2;
        }

        //cout << sw[0] << sw[1] << endl;

        for(int j=0;j<m;j++){
            int sum=0;
            for(int l=0;l<k[j];l++){
                sum += sw[s[j][l]-1];
                //cout << s[j][l]-1 << ": " << sw[s[j][l]-1] << endl;
            }
            //cout << sum << p[j] << endl;
            if(sum % 2 == p[j]) flag *= 1;
            else flag *= 0;
        }

        if(flag) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include<stdlib.h>

int main(void) {
  char *s, *t;
  s = (char *)malloc(sizeof(char) * 200000);
  t = (char *)malloc(sizeof(char) * 200000);
  scanf("%s", s);
  scanf("%s", t);
  int len=strlen(s),i,count=0;
  //printf("len:%d\n", len);
  char sc, tc;
  for (i = 0; i < len; i++) {
    sc = *s;
    tc = *t;
    if (sc != tc) count++;
    s++;
    t++;
  }
  printf("%d", count);
  return 0;
}

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

int main() {
  int a[5];
  for (auto &aa : a) {
    cin >> aa;
  }
  sort(a, a + 5);
  int k;
  cin >> k;
  cout << (a[4] - a[0] <= k ? "Yay!" : ":(") << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
	public static void Main()
	{
		var n = ReadLine().Split().Select(int.Parse).ToArray();
		var a = n[0] / n[1];
		if(n[0] % n[1] != 0)
			a++;
		WriteLine(a * n[2]);
	}
}


Measured memory_bytes: 19016
#include <bits/stdc++.h>
#define INF (int)1e9
#define endl "\n"
#define ll long long
#define ull unsigned long long

using namespace std;

int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << " " << b << " " << c;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        x: u64,
    }

    solve(x);
}

fn solve(x: u64) {
    let mut year = 0;
    let mut amount = 100;

    while amount < x {
        amount += amount / 100;
        year += 1;
    }

    println!("{}", year);
}


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

int gcd(int p,int q){
  if(p%q==0)return q;
  return gcd(q,p%q);
}
int main(){
  int k;
  cin>>k;
  ll ans=0;
  for(int i=1;i<=k;i++){
    for(int j=1;j<=k;j++){
      for(int l=1;l<=k;l++){
        ans+=gcd(gcd(i,j),l);
      }
    }
  }
  cout<<ans<<endl;
}

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

int main()
{
    int n, m, x;
    cin >> n >> m >> x;

    int a = 0, b = 0;
    for (int i = 0; i < m; i++) {
        int t;
        cin >> t;
        (t < x ? a : b)++;
    }

    cout << min(a, b) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  ll n;
  scanf("%lld", &n);
  vll a(n);
  ll sum = 0;
  rep (i, n) {
    scanf("%lld", &a[i]);
    sum += a[i];
  }
  ll tsum = n * (n+1) / 2;
  if (sum % tsum != 0) {
    printf("NO\n");
    return 0;
  }
  ll times = sum / tsum;
  vll diff(n);
  rep (i, n-1) {
    diff[i] = a[i+1] - a[i];
  }
  diff[n-1] = a[0] - a[n-1];
  ll cnt = 0;
  rep (i, n) {
    if (diff[i] == times) {
      continue;
    }
    ll delta = times - diff[i];
    if (delta < 0 || delta % n != 0) {
      printf("NO\n");
      return 0;
    }
    cnt += (delta / n);
  }
  if (cnt != times) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  return 0;
}


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

const int D = 80*160+10;
const int D2 = D*2;
typedef bitset<D2> bs;

int a[100][100];
bs dp[90][90];

int main() {
  int h, w;
  cin >> h >> w;
  rep(i,h)rep(j,w) {
    int x;
    cin >> x;
    a[i][j] = x;
  }
  rep(i,h)rep(j,w) {
    int x;
    cin >> x;
    a[i][j] = abs(x-a[i][j]);
  }

  dp[0][0][D-a[0][0]] = 1;
  dp[0][0][D+a[0][0]] = 1;
  rep(i,h)rep(j,w) {
    if (i) {
      dp[i][j] |= dp[i-1][j]<<a[i][j];
      dp[i][j] |= dp[i-1][j]>>a[i][j];
    }
    if (j) {
      dp[i][j] |= dp[i][j-1]<<a[i][j];
      dp[i][j] |= dp[i][j-1]>>a[i][j];
    }
  }
  int ans = D2;
  rep(i,D2) if (dp[h-1][w-1][i]) {
    ans = min(ans, abs(i-D));
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define ll long long 
#define IOS ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define SIZE 100005

int rest;
double dp[3050][1550];
bool vis[3550][1550];
int t;
double arr[3005];

double func(int indx, int taken)
{
	if(indx > t) return 1.0;
	if(vis[indx][taken]) return dp[indx][taken];
	vis[indx][taken] = 1;
	double ans1 = 0;
	if(taken-1 >= 0)
	{
		ans1 = (1 - arr[indx]) * func(indx+1,taken-1);
	}
	double ans2 = arr[indx] * func(indx+1,taken);
	return dp[indx][taken] = ans1 + ans2;
}

int main()
{   
    scanf("%d", &t);
    for(int i =1 ;i <= t; i++)
    {
		scanf("%lf",&arr[i]);
	}
	rest = t/2;	
	double ans = func(1,rest);
	printf("%0.10lf\n",ans);
	
	//cout << dp[3][0] << endl;
	//cout << dp[2][0] <<endl;
	return 0;
}


Measured memory_bytes: 42112
from collections import deque
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read():
    N = int(input().strip())
    P = list(map(float, input().strip().split()))
    return N, P


def solve(N, P):
    # dp[i, j]: i枚目まで投げて、表がj枚出る確率
    # dp[i, j] = dp[i-1, j-1] * p[j] + dp[i, j-1] * (1-p[j])
    # 2000x(N//2)のテーブルを作るとTLEするので、圧縮して解く
    dp = [[0 for j in range(N+1)] for i in range(2)]
    dp[0][0] = 1
    for j in range(1, N+1):
        dp[0][j] = dp[0][j-1] * (1.0 - P[j-1])
    ans = dp[0][-1]
    for i in range(1, N//2+1):
        b = i % 2
        dp[b][i-1] = 0.0
        for j in range(i, N+1):
            dp[b][j] = dp[(b-1)%2][j-1] * P[j-1] + dp[b][j-1] * (1.0 - P[j-1])
        ans += dp[b][-1]
    return "{:.10f}".format(1.0 - ans)


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))


Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, K, Q;
vi A;

void input() {
  cin >> N >> K >> Q;
  A.resize(Q);
  rep(i, 0, Q - 1) {
    int x;
    cin >> x;
    A[i] = x - 1;
  }
}

int p[MX] = {};
void solve() {
  for (auto x : A) {
    p[x]++;
  }
  // K-(Q-p[i]) > 0

  rep(i, 0, N - 1) {
    if (K - (Q - p[i]) > 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 2176
n = gets.to_i
ret = []
if n == 0
  puts '0'
  exit 0
end

while n != 0
  mod = n % -2 # -1 or 0
  m = mod == -1 ? 1 : 0
  ret.push(m)
  n = n / -2 + m
end
puts ret.reverse.join('')


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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (100006)
ll n,psum[MAXN],ans;
pi A[MAXN];
priority_queue<ll> l;
priority_queue<ll,vector<ll>,greater<ll>> r;
int main(){
	FAST
	cin>>n;
	FOR(i,1,n)cin>>A[i].f>>A[i].s,psum[i]=psum[i-1]+A[i].s-A[i].f;
	FOR(i,1,n){
		if(l.size() && A[i].f <= l.top()-psum[i]){
			ans += l.top()-psum[i] - A[i].f;
			r.emplace(l.top()-psum[i]-psum[i-1]);
			l.pop();
			l.emplace(A[i].f+psum[i]), l.emplace(A[i].f+psum[i]);
		}else if(r.size() && r.top()+psum[i-1] <= A[i].f){
			ans += A[i].f - (r.top()+psum[i-1]);
			l.emplace(r.top()+psum[i-1]+psum[i]);
			r.pop();
			r.emplace(A[i].f-psum[i-1]), r.emplace(A[i].f-psum[i-1]);
		}else{
			l.emplace(A[i].f+psum[i]), r.emplace(A[i].f-psum[i-1]);
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 4364
#include <stdio.h>

int main(void)
{
  char n[201]; //??¬???
  int sha; //?????£??????????????°
  int h; //?????£????????????????????°
  int i,j,k; //????????????
  int num = 0; //????????°
  int temp; //????????????

  while(1){
    scanf("%s",n); //??????????????????????????????
    if(n[0] == '-'){ //???????????????
      break;
    }
    for(num = 0; num < 201; num++){ //????????°????????????
      if(n[num] == '\0'){ //null????????????????????¬??¨????????????
	break;
      }
    }
    scanf("%d",&sha); //?????£??????????????°????¢????
    for(i=0; i<sha; i++){ //sha????????°??°?????????
      scanf("%d",&h); //?????£????????????????????°????¢????
      for(j=0; j<h; j++){ //?????£????????????????????°????????°?????????
	temp = n[0]; //n[0]?????????
	for(k=0; k<num; k++){ //????????°?????°?????????
	  n[k] = n[k+1]; //?????????????????????
	}
	n[num-1] = temp; //???????????????n[0]?????£??????????????\??????
      }
    }
  printf("%s\n",n);
  }
  
  return(0);
}

Measured memory_bytes: 1012
N, M = map(int, input().split())
*A, = map(int, input().split())
A.sort()

l = []
for _ in range(M):
    B, C = map(int, input().split())
    l.append((B, C))
l.sort(key=lambda x:-x[1])

def solve():
    p = 0
    ans = 0
    for i, j in l:
        for _ in range(i):
            ans += max(A[p], j)
            p += 1
            if N==p:
                return ans
    
    for i in range(p, N):
        ans += A[i]
    return ans
    
print(solve())

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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  sort(v.begin(), v.end());
  cout << v.at(n - 1) - v.at(0) << endl;
}

Measured memory_bytes: 256
/*
AuThOr GaRyMr
技巧:
1.区别对待大数据&小数据！
2.Dp难推时算贡献！
3.long long (尤其乘法)！
4.long long INF 要大
5.Dp on trees: 换根法，每次清空当前的节点和换到的子节点
6.long double | 输出浮点数
7.注意特判!(prince and princess)
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	int a;
	cin>>a;
	string s;
	cin>>s;
	if(s.length()&1){
		cout<<"No";
	}
	else{
		rb(i,1,s.length()/2){
			if(s[i-1]!=s[i-1+s.length()/2]){
				cout<<"No";
				return 0; 
			}
		}
		cout<<"Yes";
	}
	return 0;
}


Measured memory_bytes: 256
W,H,x,y = map(int, input().split())
ans = []
ss = False
w_s = W / (10 ** 5)
up = 0
do = W
for i in range(10 ** 5):
    up += w_s
    do -= w_s
    ans.append((up + do) * H * 0.5)

ans.sort()


if x == W/2 and y == H/2:
    print(str(ans[0]) + " " + "1")
else:
    print(str(ans[0]) + " " + "0")

Measured memory_bytes: 6616
list = [
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
    ]

s = input()
t = int(list.index(s))
k = t + 1
print(list[k])


Measured memory_bytes: 2940
#include <stdio.h>
#include <math.h>
  
int main(void)
{
    int a, b, c;
    double d;
    double S, L, h;
    double sinc, cosc;
      
    scanf("%d%d%d", &a, &b, &c);
      
    sinc=sin(c/180.0*3.14159265);
    cosc=cos(c/180.0*3.14159265);
    d=sqrt(a*a+b*b-2*a*b*cosc);
      
    S=a*b*sinc/2.0;
    L=a+b+d;
    h=b*sinc;
      
    printf("%f\n%f\n%f\n", S, L, h);
      
    return 0;
}

Measured memory_bytes: 636
use std::io;
use std::str::FromStr;

fn input_int_tuple() -> (i32, i32) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<i32> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn input_i32_vec() -> Vec<i32> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn flash(switches_condition: &Vec<Vec<i32>>, p_vec: &Vec<i32>, switches: Vec<bool>) -> bool {
    let mut flag = true;
    for light_idx in 0..switches_condition.len() {
        let mut switch_count = 0;
        for target in &switches_condition[light_idx] {
            if switches[(target - 1) as usize] == true {
                switch_count += 1;
            }
        }
        if switch_count % 2 != p_vec[light_idx] {
            flag = false;
            break;
        }
    }
    flag
}

fn main() {
    let (n, m) = input_int_tuple();
    let mut switches_condition: Vec<Vec<i32>> = Vec::new();
    for i in 0..m {
        let mut condition = input_i32_vec();
        condition.remove(0);
        switches_condition.push(condition);
    }
    let p_vec = input_i32_vec();
    let mut count = 0;    
    for bit in 0..1<<n {
        let mut switches: Vec<bool> = vec![false; n as usize];
        for i in 0..n {
            switches[i as usize] = (bit & (1<<i) == 0);
        }
        if flash(&switches_condition, &p_vec, switches) {
            count += 1;
        }
    }
    println!("{}", count);
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  while (1) {
    c -= b;
    if (c < 1) {
      cout << "Yes" << endl;
      break;
    }
    a -= d;
    if (a < 1) {
      cout << "No" << endl;
      break;
    }
  }
  return 0;
}

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

int main() {
  int N, A, P;
  int mn = 1000000000;
  cin >>N;
  rep(i,N){
    P=0;
    cin >> A;
    while(true){
      if(A%2==0){A/=2;P++;}
      else break;
    }
    mn = min(mn,P);
  }
  cout <<mn<<endl;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
  int n=sc.nextInt();
  int[]a=new int[n];
  for(int i=0;i<n;i++)a[i]=sc.nextInt();
  long ans=0;
  for(int i=0;i<n-1;i++){
    if(a[i]-a[i+1]>0){
      ans+=a[i]-a[i+1];
      a[i+1]+=a[i]-a[i+1];
    }
  }
  System.out.println(ans);
}
}

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

int main(){
  int N,M;
  cin >>N>>M;
  if(abs(N-M) > 1){
    cout << 0<< endl;
    return 0;
  }
  long long int ans = 1;
  if(abs(N-M) == 1){
    for(int i=1;i<=N;i++){
      ans = ans*i;
      ans = ans%1000000007;
    }
    for(int i=1;i<=M;i++){
      ans = ans*i;
      ans = ans%1000000007;
    }
  }
  if(abs(N-M) == 0){
    ans = 2;
    for(int i=1;i<=N;i++){
      ans = ans*i;
      ans = ans%1000000007;
    }
    for(int i=1;i<=M;i++){
      ans = ans*i;
      ans = ans%1000000007;
    }
  }
  cout << ans << endl;
}
      

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

a = list(range(1, 10))

while(1):
    if k <= len(a):
        print(a[k-1])
        exit()
    k -= len(a)
    old = []
    old, a = a, old
    for x in old:
        for i in [-1, 0, 1]:
            d = x%10 + i
            if d<0 or d>9: continue
            nx = x*10 + d
            a.append(nx)


Measured memory_bytes: 11028
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs= sys.stdin.buffer.readlines
#rstrip().decode('utf-8')

#import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#scipy.sparse import csr_matrix
#scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10**7)

#map(int,input().split())

def main():
    s=input().rstrip().decode('utf-8')
    n=len(s)
    se0=set()
    t=sorted(s)
    for i in range(5):
        try:
            se0.add(t[i])
        except:
            pass
    se=se0
    for i in range(2,6):
        for j in range(n-i+1):
            try:
                if s[j] in se0:
                    se.add(s[j:j+i])
            except:
                pass
    li=sorted(list(se))
    k=int(input())
    print(li[k-1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner (System.in);
        while(sc.hasNext()){
            String[] inputstr = sc.nextLine().split(" ");
            Arrays.sort(inputstr);
            int inputnum = Integer.parseInt(inputstr[0]);
            int inputnum2 = Integer.parseInt(inputstr[1]);
            int inputnum3 = Integer.parseInt(inputstr[2]);
            System.out.println(inputnum+" "+inputnum2+" "+inputnum3);
        }
    }
}

Measured memory_bytes: 26380
import java.util.Scanner;
import java.util.Arrays;

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

        for (int i = 0; i < house.length; i++) {
            house[i] = sc.nextInt();
        }

        Arrays.sort(house);
        System.out.println(house[house.length-1] - house[0]);
    }
}

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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) \
    sort(all(x));  \
    (x).erase(unique(all(x)), (x).end())
#define mp make_pair
#define r0 return 0

/* const */
const int inf = 1e9 + 7;
const int dxl[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dyl[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dxs[4] = {1, 0, -1, 0};
const int dys[4] = {0, 1, 0, -1};

/* main */
signed main(void)
{
    int x;
    int num;
    int max = 0;
    cin >> x;
    for (int i = 1; i <= x; i++)
    {
        for (int j = 2; j - 1 <= x; j++)
        {
            num = pow(i, j);
            if (num > x)
            {
                break;
            }
            if (num > max)
            {
                max = num;
            }
        }
    }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

bool isprime(int p) {
  if (p==1) return false;
    FOR(i,2,p) {
      if (p%i==0) return false;
    }
  return true;
}

int main(){
  int n,c;
  cin >> n;
  REP(i,10000){
    if (isprime(i*5+1)) {
      cout << i*5+1 << ' ';
      c++;
    }
    if (c==n) return 0;
  }
  return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num // 26) + chr(64 + num % 26)

n = int(readline())
print(num2alpha(n).lower())


Measured memory_bytes: 8884
n = gets.chomp.split(' ').map(&:to_i)[0]
v = gets.chomp.split(' ').map(&:to_i)

count_odd = Hash.new(0)
count_even = Hash.new(0)
v.each_with_index do |x, i|
  count_odd[x] += 1 if i.even?
  count_even[x] += 1 if i.odd?
end

even_max = count_even.max{ |x, y| x[1] <=> y[1] } 
odd_max = count_odd.max{ |x, y| x[1] <=> y[1] } 

if odd_max[0] == even_max[0]
  count_even.delete(odd_max[0])
  count_odd.delete(even_max[0])
  even_max2 = count_even.empty? ? [0, 0] : count_even.max{ |x, y| x[1] <=> y[1] } 
  odd_max2 = count_odd.empty? ? [0, 0] : count_odd.max{ |x, y| x[1] <=> y[1] } 

  puts n - [even_max[1] + odd_max2[1], even_max2[1] + odd_max[1]].max
else
  puts n - odd_max[1] - even_max[1]
end

Measured memory_bytes: 17812
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string str1, str2;
	size_t index;

	getline(cin, str1);
	getline(cin, str2);


	str1 += str1;

	index = str1.find(str2);

	if (index != string::npos)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

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

using namespace std;
using ll = long long;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount

int dp[3100][3100];

int main() {
    string s, t;
    cin >> s >> t;
    for (int i = 1; i <= sz(s); ++i) {
        for (int j = 1; j <= sz(t); ++j) {
            if (s[i - 1] == t[j - 1]) {
                dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
            } else {
                dp[i][j] = max({dp[i][j], dp[i - 1][j], dp[i][j - 1]});
            }
        }
    }

    string ans = "";
    int i = sz(s), j = sz(t);
    while (i > 0 && j > 0) {
        if (dp[i][j] == dp[i - 1][j]) {
            --i;
        } else if (dp[i][j] == dp[i][j - 1]) {
            --j;
        } else {
            ans = s[i - 1] + ans;
            --i, --j;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 37120
s = input()
l = s.split()
N = int(l[0])
M = int(l[1])

A = list()
for i in range(N):
    s = input()
    A.append(s)

B = list()
for j in range(M):
    s = input()
    B.append(s)


def g(n, m, a, b, i, j):
    for k in range(m):
        for l in range(m):
            if a[i + k][j + l] != b[k][l]:
                return False
    return True


def f(N, M, A, B):
    for i in range(N - M + 1):
        for j in range(N - M + 1):
            if g(N, M, A, B, i, j):
                return 'Yes'
    return 'No'

print(f(N, M, A, B))



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF=1001001001;

int main() {
  int H,W,A,B;
  cin>>H>>W>>A>>B;
  vector<vector<int>>s(H,vector<int>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(i<B&&j<A){s[i][j]=1;}
      if(i>=B&&j>=A){s[i][j]=1;}
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cout<<s[i][j];
    }cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 7516
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main(){
  string S;
  cin >> S;
  bool ret = false;

  for(int i=0; i<S.length(); i++)
    if(S[i] == 'A' && S[i+1] == 'C'){
      ret = true;
      break;
    }

  if(ret)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


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

using namespace std;

int f[100005];
int dis[100005]= {0};
int findset(int x)
{
    if(f[x]==x)
        return x;
    else
    {
        int t=f[x];
        f[x]=findset(f[x]);
        dis[x]+=dis[t];
        return f[x];
    }
}

void unionset(int a,int b,int d)
{
    int ll=findset(a);
    int rr=findset(b);
    f[rr]=ll;
    dis[rr]=dis[a]-dis[b]+d;
}

void init(int n)
{
    for(int i=0; i<=n; i++)
        f[i]=i;
}

int main()
{
    int n,m;
    cin>>n>>m;
    init(n);
    int l,r,d,ll,rr;
    while(m--)
    {
        scanf("%d%d%d",&l,&r,&d);
        ll=findset(l);
        rr=findset(r);
//        cout<<"f[l]="<<f[l]<<"f[r]="<<f[r]<<endl;
//        cout<<"disl="<<dis[l]<<"  disr="<<dis[r]<<endl;
        if(ll==rr)
        {
            if(dis[r]-dis[l]!=d)
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
        else
        {
            unionset(l,r,d);
        }
//        cout<<"disl="<<dis[l]<<"  disr="<<dis[r]<<endl;
    }
    cout<<"Yes"<<endl;
}





Measured memory_bytes: 1024
import java.util.*;

class Main {
	Scanner sc;
	int H, W;
	boolean[][][] dp;
	int[][] A, B;
	
	private void calc() {
		sc = new Scanner(System.in);
		H = sc.nextInt();
		W = sc.nextInt();
		A = new int[H][W];
		B = new int[H][W];
		for (int i = 0; i < H; i++)
			for (int j = 0; j < W; j++)
				A[i][j] = sc.nextInt();
		for (int i = 0; i < H; i++)
			for (int j = 0; j < W; j++)
				B[i][j] = sc.nextInt();
		
		int n = 80*(H+W-1)+1;
		dp = new boolean[H][W][n];
		dp[0][0][Math.abs(A[0][0]-B[0][0])] = true;
		
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				for (int k = 0; k < n; k++) {
					if (!dp[i][j][k]) continue;
					if (i < H-1) {
						int v = A[i+1][j] - B[i+1][j];
						dp[i+1][j][Math.abs(k+v)] = true;
						dp[i+1][j][Math.abs(k-v)] = true;
					}
					if (j < W-1) {
						int v = A[i][j+1] - B[i][j+1];
						dp[i][j+1][Math.abs(k+v)] = true;
						dp[i][j+1][Math.abs(k-v)] = true;
					}
				}
			}
		}
		int min = Integer.MAX_VALUE;
		for (int k = 0; k < n; k++) {
			if (!dp[H-1][W-1][k]) continue;
			min = Math.min(min, k);
		}
				
		System.out.println(min);
	}
	
	public static void main(String[] args) {
		new Main().calc();
	}
}


Measured memory_bytes: 119012
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define INF 1e18
using namespace std;
typedef long long ll;
int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll x=0,y=0,z=0;
    ll ans=1;
    rep(i,n){
        ll cnt=0;
        bool flag=true;
        if (x==a[i]){
            ++cnt;
            ++x;
            flag=false;
        } 
        if (y==a[i]){
            ++cnt;
            if (flag){
                ++y;
                flag=false;
            }
        }
        if (z==a[i]){
            ++cnt;
            if (flag){
                ++z;
                flag=false;
            }
        }
        ans*=cnt;
        ans%=1000000007;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int moder = 1000000007;
long long dp[1000006][4];
int main(){
	int n;
	cin>>n;
	dp[1][0] = 1;
	dp[1][1] = 1;
	dp[1][2] = 0;
	dp[1][3] = 8;
	for(int i=2; i<=n; i++){
		//0은 없고 9만 포함하는 시퀀스  
		dp[i][0] = dp[i-1][0]*9; //길이가 1 작은 시퀀스 중 9만 포함하는 시퀀스 뒤에 0을 제외한 아무거나 붙인다
		dp[i][0]+=dp[i-1][3]; //길이가 1 작은 시퀀스 중 둘 다 없는 시퀀스에 9를 붙인다.
		dp[i][0]%=moder; 
		//9는 없고 0만 포함하는 시퀀스
		dp[i][1] = dp[i-1][1]*9;
		dp[i][1]+=dp[i-1][3];
		dp[i][1]%=moder;
		//둘 다 있는 시퀀스
		dp[i][2] = dp[i-1][2]*10; //둘 다 있는 길이 1작은 시퀀스 뒤에 아무거나 붙인다.
		dp[i][2]+=(dp[i-1][0]+dp[i-1][1]); //둘 중 하나가 없는 시퀀스 뒤에 하나를 붙인다.
		dp[i][2]%=moder;
		//둘 다 없는 시퀀스
		dp[i][3] = dp[i-1][3]*8;
		dp[i][3]%=moder;  
	}
	cout<<dp[n][2];
}

Measured memory_bytes: 34796
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	int N,K,S;
	cin>>N>>K>>S;
	
	int D;
	
	if(S==1000000000)D = 1;
	else D = S+1;
	
	for(int i=0;i<N;i++){
		if(i!=0)cout<<' ';
		if(i<K)cout<<S;
		else cout<<D;
	}
	cout<<endl;
	
	return 0;
}


Measured memory_bytes: 1280
A,B,C=map(int,input().split())

x=0
if A==B and A==C:
    if A%2==0 and B%2==0 and C%2==0:
        print(-1)
    else:
        print(0)
else:
    while x>=0:
        if A%2==0 and B%2==0 and C%2==0:
            x+=1
            tmp1=A
            tmp2=B
            tmp3=C
            A=(tmp2+tmp3)//2
            B=(tmp1+tmp3)//2
            C=(tmp1+tmp2)//2
            #print(A,B,C)
        else:
            break
    print(x)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    if(a < 2*b)
    	cout << "0" << endl;
    else
    	cout << a - 2*b << endl;	
} 

Measured memory_bytes: 256
n = int(input())
x = [2, 8, 0]
y = [0,0,0]
mod = 10**9 + 7
for i in range(n-1):
    y[0] = (x[0]*9 + x[1]*2)%mod
    y[1] = (x[1]*8)%mod
    y[2] = (x[0] + x[2]*10)%mod
    x = y.copy()
print(y[-1])

Measured memory_bytes: 67604
#include<stdio.h>
int main(void)
{
    int i,j,n,tokten[35],rui,kaunt,keika;
    rui=0;kaunt=0;keika=0;j=0;
    for(i=0;i<34;i++){
        tokten[i]=0;
    }
    char ibnt[256][8];
    scanf("%d",&n);
    for(i=0;;i++){
        scanf("%s",ibnt[i]);
        if(ibnt[i][0]==72&&ibnt[i][1]==73&&ibnt[i][2]==84){
            rui=rui+1;
        }else if(ibnt[i][0]==79&&ibnt[i][1]==85&&ibnt[i][2]==84){
            kaunt=kaunt+1;
        }else if(ibnt[i][0]==72&&ibnt[i][1]==79&&ibnt[i][2]==77&&ibnt[i][3]==69&&ibnt[i][4]==82&&ibnt[i][5]==85&&ibnt[i][6]==78){
            tokten[j]=tokten[j]+rui+1;
            rui=0;
        }
        if(kaunt==3){
            keika=keika+1;
            kaunt=0;
            rui=0;
            j++;
        }
        if(rui==4){
            rui=rui-1;
            tokten[j]++;
        }
        if(keika==n){
            break;
        }
    }
    for(i=0;i<n;i++){
        printf("%d\n",tokten[i]);
    }
    return 0;
}

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

using namespace std;
using ll = long long;


int main()
{
  ios_base::sync_with_stdio (0);
  cin.tie (0);
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll ans = b / c - (a - 1) / c;
  ans += b / d - (a - 1) / d;
  ll lc = c * d / __gcd (c, d);
  ans -= b / lc - (a - 1) / lc;
  cout << b - a + 1 - ans << '\n';
  return 0;
}


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

int main() {
  int x,data[101] = {0},top;

  while(cin >> x) {
    data[x]++;
  }

  top = *max_element(data,data+101);

  for(int i=1;i<101;i++) {
    if(data[i] == top)
     cout << i << endl;
  }
}

Measured memory_bytes: 0