akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct Res{
  char res_name[10];
  int res_point;
  int res_id;
};

int compare_res(const void *a, const void *b) {
  struct Res *A = (struct Res *)a;
  struct Res *B = (struct Res *)b;
  int d0;
  d0=strcmp(A->res_name,B->res_name);
  if(d0) return d0;
  return - A->res_point + B->res_point;
}
int main(){
    int N;
    struct Res S[101];
    scanf("%d",&N);
    int i;
    for(i=0;i<N;i++){
        scanf("%s %d",S[i].res_name,&S[i].res_point);
        S[i].res_id=i+1;
    }
  //printf("%s",S[0].res_name);
    qsort(S,N,sizeof(struct Res),compare_res);
    for(i=0;i<N;i++){
        printf("%d\n",(int)S[i].res_id);
    }
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
struct rgbindex{
  int r;
  int g;
  int b;
};

int main(){
  char rgb[4001];
  char tmp1,tmp2;
  struct rgbindex index[4001];
  int len,i,j,a,b,c,tmp_int;
  long result=0;
  
  scanf("%d",&len);
  scanf("%s",rgb);
  
  a=b=c=0;
  for(i=len-1;0<=i;i--){
    if(rgb[i]=='R'){
      a++;
    }else if(rgb[i]=='G'){
      b++;
    }else if(rgb[i]=='B'){
      c++;
    }
      index[i].r=a;
      index[i].g=b;
      index[i].b=c;
  }
  
  //for(i=0;i<len;i++){
  //  printf("idx[%d]:%d %d %d\n",i,index[i].r,index[i].g,index[i].b);
  //}
      
  for(i=0;i<len-2;i++){
    tmp1=rgb[i];
    for(j=i+1;j<len-1;j++){
      if(rgb[j]!=tmp1){
        tmp2=rgb[j];
        if(tmp1=='R' && tmp2=='G' || tmp1=='G' && tmp2=='R'){
          tmp_int=index[j].b;
        } else if(tmp1=='R' && tmp2=='B' || tmp1=='B' && tmp2=='R'){
          tmp_int=index[j].g;
        } else if(tmp1=='G' && tmp2=='B' || tmp1=='B' && tmp2=='G'){
          tmp_int=index[j].r;
        }
        
        if((j-i)<(len-j) && (rgb[j+(j-i)]!=tmp1 && rgb[j+(j-i)]!=tmp2)){
          tmp_int--;
        }
          result+=tmp_int;
      }
    }
  }
  printf("%ld",result);
}

Measured memory_bytes: 1704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
const int INF = 1e9;

int main(){
  ll N,M,idx;cin>>N>>M;
  vector<ll> A(N+2,-1),dp(N+2,0);
  REP(i,0,M){
    cin>>idx;
    A[idx]=1;
  }
  dp[0]=1;
  REP(i,0,N+1){
    if(A[i+1]+A[i+2]==2){
      print(0);
      return 0;
    }
    //if(A[i]==1)continue;
    if(A[i+1]==-1){dp[i+1]+=dp[i];dp[i+1]%=mod;}
    if(A[i+2]==-1){dp[i+2]+=dp[i];dp[i+2]%=mod;}
  }
  print(dp[N])
}


Measured memory_bytes: 1792
#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>;
#define chmax(x,y) x = max(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

int main() {
    int n;
    cin >> n;
    vector<int> cnt(n+1);
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i; j <= n; j += i) {
        cnt[j]++;
      } 
      ans += (ll)i*cnt[i];
    } 
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;

int main()
{
    ll N, K;

    cin >> N >> K;

    if(N > K)
    {
        ll m = (N - K)/ K ;

        ll a = N - m*K;
        ll b = N - (m+1)*K;

        ll da = a - K;
        ll db = K - b;

        if(da < db)
        {
            cout << da << endl;
        }
        else
        {
            cout << db << endl;      
        }
    }
    else
    {
        ll m = (K - N)/ K ;

        ll a = N + m*K;
        ll b = N + (m+1)*K;

        ll da = K - a;
        ll db = b - K;

        if(da < db)
        {
            cout << da << endl;
        }
        else
        {
            cout << db << endl;      
        }
        
    }
    

    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	pair<int, int> p;
	for (int i = 0; i < n; i++)
	{
		string t, h;
		cin >> t >> h;
		if (t == h)
		{
			p.first++;
			p.second++;
			continue;
		}
		map<string, int> m;
		m[t]++;
		m[h]++;
		for (auto x : m)
		{
			if (x.first == t)
			{
				p.second += 3;
				break;
			}
			else
			{
				p.first += 3;
				break;
			}
		}
	}
	cout << p.first << " " << p.second << endl;
	return 0;
}

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

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

Measured memory_bytes: 4016
<?php
$s = trim(fgets(STDIN));
$s = str_replace(array("\r\n","\r","\n"), '', $s);
$s = explode(" ", $s);

$count = $s[0];
$train_price = $s[2];
$taxi_price = $s[1];

echo min($train_price, $taxi_price * $count);

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

using namespace std;

int main() {

	int r,c;
	cin >> r >> c;

	vector<vector<int>> rc(r+1,vector<int> (c+1,0));
	int summ = 0;
	for (int i = 0; i < r; i++) {
		summ = 0;
		for (int j = 0; j < c; j++) {
			cin >> rc[i][j];
			summ += rc[i][j];
		}
		rc[i][c] = summ;
	}

	for (int j = 0; j < c; j++) {
		summ = 0;
		for (int i = 0; i < r; i++) {
			summ += rc[i][j];
		}
		rc[r][j] = summ;
	}

	summ = 0;
	for (int j = 0; j < c; j++) {
		summ += rc[r][j];
	}
	rc[r][c]=summ;

	for (int i = 0; i < r + 1; i++) {
		for (int j = 0; j < c ; j++) {
			cout << rc[i][j] << " ";
		}
		cout << rc[i][c] << endl;
	}
}


Measured memory_bytes: 3156
#include <cstdio>
#include <iostream>
using namespace std;
int n,a[200002];
int main(){
   scanf("%d",&n);
   long long sum=0;
    for(int i=1;i<=n;++i){
       scanf("%d",&a[i]);
       sum+=a[i];
    }
   long long s=0,ans=200000000000000LL;
    for(int i=1;i<n;++i){
        s+=a[i];
        ans=min(ans,abs(sum-s-s));
   }
    cout<<ans;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <unordered_set>

using ll = long long;

int main()
{
    int x1, y1, x2, y2;
    std::cin >> x1 >> y1 >> x2 >> y2;

    int x = x2 - x1;
    int y = y2 - y1;

    std::cout << x2 - y << " " << y2 + x << " " << x1 - y << " " << y1 + x << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

ll solve(const vector<ll>& A, ll sign) {
  const int N = A.size();
  vector<ll> B(N, 2);
  B[0] = B[N - 1] = 1;
  for (int i = 0; i < N; i++) B[i] *= sign, sign = -sign;
  sort(B.begin(), B.end());
  ll res = 0;
  for (int i = 0; i < N; i++) res += B[i] * A[i];
  return res;
}

int main() {
  int N;
  while (cin >> N) {
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    ll res = max(solve(A, 1), solve(A, -1));
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
ll n, w, w1;
vector<vector<ll> > v(4);
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>w;
    ll tempv;
    cin>>w1>>tempv;
    v[0].push_back(tempv);
    for (int i = 1; i < n; i++)
    {
        int tempw, tempv;
        cin >> tempw>>tempv;
        v[tempw-w1].push_back(tempv);
    }
    for(int i=0;i<4;i++){
        sort(ALL(v[i]),greater<ll>());
    }
    ll ans = 0;
    vector<vector<ll> > sum(4);
    for(int i=0;i<4;i++){
        ll sumv=0;
        sum[i].push_back(0);
        for(int j=0;j<v[i].size();j++){
            sumv+=v[i][j];
            sum[i].push_back(sumv);
            //cout<<sumv<<"\n";
        }
    }
    for(int i=0;i<sum[0].size();i++){
        for(int j=0;j<sum[1].size();j++){
            for(int k=0;k<sum[2].size();k++){
                for(int l=0;l<sum[3].size();l++){
                    //cout<<j+k*2+l*3+(i+j+k+l)*w1<<"\n";
                    if(j+k*2+l*3+(i+j+k+l)*w1<=w){
                        ans=max(ans,sum[0][i]+sum[1][j]+sum[2][k]+sum[3][l]);
                    }
                }
            }
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
import math
L = [input() for _ in range(5)]
lm = int(L[0][-1])
v = int(L[0])
for l in L:
  if int(l[-1])<lm and l[-1]!='0':
    lm = int(l[-1])
    v = int(l)
t = 0
L.remove(str(v))
for l in L:
  t += math.ceil(int(l)/10)*10
print(t + v)

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

int main() {
  int a,b;
  cin >> a >> b;
  if(a<b){
    cout << "a < b" << endl;
  }
  else if(a>b){
    cout << "a > b" << endl;
  }
  else{
    cout << "a == b" << endl;
  }
}



Measured memory_bytes: 3060
#include <iostream>

// #define int long longの会に入会
#define int long long

using namespace std;

int calcBurgerSize(int level)
{
	return level ? 2 * calcBurgerSize(level - 1) + 3 : 1;
}

int countPatties(int level, int x)
{
	if(level == 0)
	{
		return 1;
	}

	int smallSize = calcBurgerSize(level - 1);

	if(x == 1)
	{
		return 0;
	}
	else if(x < 2 + smallSize)
	{
		return countPatties(level - 1, x - 1);
	}
	else if(x == 2 + smallSize)
	{
		return countPatties(level - 1, smallSize) + 1;
	}
	else if(x < 3 + smallSize * 2)
	{
		return countPatties(level - 1, smallSize) + countPatties(level - 1, x - smallSize - 2) + 1;
	}
	else
	{
		return countPatties(level - 1, smallSize) * 2 + 1;
	}
}

signed main()
{
	int n, x;

	cin >> n >> x;

	cout << countPatties(n, x) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;

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

    set<char> st;
    for_each(S.begin(), S.end(), [&](const char &c) { st.insert(c); });

    if (st.size() == 2 && count(S.begin(), S.end(), *(st.begin())) == 2)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

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

    multimap<int, int> mmap;
    int time, deadline;
    for (int i = 0; i < N; i++)
    {
        cin >> time >> deadline;
        mmap.insert(make_pair(deadline, time));
    }

    ll passed = 0;
    for (auto itr = mmap.begin(); itr != mmap.end(); itr++)
    {

        deadline = itr->first;
        time = itr->second;
        passed += time;
        // printf("passed = %d, deadline = %d\n", passed, deadline);
        if (passed <= deadline)
        {
            continue;
        }
        else
        {
            cout << "No" << endl;
            return (0);
        }
        // cout << itr->first << ": " << itr->second << endl;
    }
    cout << "Yes" << endl;
    return (0);
}

Measured memory_bytes: 12968
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

k, s = map(int, input().split())

ans = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - (x+y)
        if (z>=0 and z <= k and x+y+z == s):
            #print(x,y,z)
            ans += 1
print(ans)




Measured memory_bytes: 9160
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
#define INF 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  int k,a,b;
  cin >> k >> a >> b;
  int A = (a - 1) / k,B = b / k;
  if(B - A >= 1)cout << "OK" << endl;
  else cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3604
import Control.Applicative
import Control.Monad
import Data.List

solve :: String -> Int
solve ss = foldr f 0 (zip ss (cycle "gp"))
  where
    f (s, t) a
        | (s, t) == ('g', 'p') = a + 1
        | (s, t) == ('p', 'g') = a - 1
        | otherwise            = a

main = do
    ss <- getLine
    print $ solve ss

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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;

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


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int a;
    cin >> a;
    int a_max = a;
    int a_gcd = a;
    REP(i, n - 1) {
        cin >> a;
        a_gcd = gcd(a_gcd, a);
        a_max = max(a_max, a);
    }
    
    if(k <= a_max and k % a_gcd == 0) {
        cout << "POSSIBLE" << ln;
    } else {
        cout << "IMPOSSIBLE" << ln;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define N 10

int main()
{
  int i,c1,c2,c3;
  int A[N];
  while(scanf("%d %d %d",&c1,&c2,&c3)!=EOF){
    int cnt=0;
    for (i=0;i<N;i++)
      A[i]=1;
    A[c1-1]=0;A[c2-1]=0;A[c3-1]=0;
    for (i=0;i<N;i++){
      if (A[i]==1){
        if (i+1+c1+c2<=20)
          cnt++;
      }
    }
    if ((double)cnt*100/7>=50)
      printf("YES\n");
    else
      printf("NO\n");
  }

  return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a=0,b=0,c=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		int x;
		scanf("%d",&x);
		if(x&1)a++;
		else if(x%4==0)c++;
		else b++;
	}
	if(a==0)
	{
		puts("Yes");
		return 0;
	}
	c-=(a-1);
	if(c<0)
	{
		puts("No");
		return 0;
	}
	if(b)
	{
		if(c)puts("Yes");else puts("No");
		return 0;
	}
	puts("Yes\n");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int n, k, cnt;
int h[100002];

int main() {

	cin >> n >> k;
	rep(i, n)cin >> h[i];

	rep(i, n) {
		if (h[i] >= k)cnt++;
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[2005],b[2005][2005],n,x,ans=10e18;
template <class code>inline code read(const code &a)
{
    code x=0;short w=0;char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return w?-x:x;
}
int main()
{
    scanf("%lld%lld",&n,&x);
    for(int i=1;i<=n;i++)
    {
        a[i]=read(a[i]);
    }
    for(int i=1;i<=n;i++)
    {
        b[i][i]=a[i];
        for(int j=i+1;j<=n;j++)
        {
            b[i][j]=min(b[i][j-1],a[j]);
        }
    }
    for(ll i=0;i<n;i++)
    {
        ll temp=i*x;
        for(ll j=1;j<=n;j++)
        {
            int k=j-i;
            if(k<=0)
            {
                temp+=min(b[k+n][n],b[1][j]);
            }
            else temp+=b[k][j];
        }
        ans=min(ans,temp);
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 31104
import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int n = sc.nextInt();
		byte[] cc = sc.next().getBytes();
		int cnt = 0;
		for (int i = 2; i < n; i++)
			if (cc[i - 2] == 'A' && cc[i - 1] == 'B' && cc[i] == 'C')
				cnt++;
		println(cnt);
	}
}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
typedef long long ll;
const int MAXN = 1e5 + 10;
const int MAX = 1e7;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e10 ;
struct node{
    int a,b;
    int index ;
} ;

string convert(int n){
    string str="";
    while(n > 0){
        str+=(char)(n%10 + '0');
        n/=10;
    }
    reverse(str.begin(),str.end());
    return str ;
}

ll powr(ll a,ll b,int m){
    if(b==0)
        return 1 ;
    ll x = powr(a,b/2,m)%m;
    x = (x*x)%m ;
    if(b%2)
        return ((x%m)*(a%m))%m ;
    return x ;
}
vector<int> adj[MAXN] ;
bool v[MAXN] ;
void dfs(int s,vector<int> &path){
    v[s]=true ;
    path.push_back(s) ;
    for(int i=0;i<adj[s].size();i++)
        if(v[adj[s][i]]==false)
            dfs(adj[s][i],path);
}
int main(){
    /* if(compare("99","9988"))
     cout<<"Yes\n"; */
    int N,M ;
    cin >>N >>M;
    int a[N+1] ;
    for(int i=1;i<=N;i++) cin>>a[i] ;
    while(M--){
        int u,v ;
        cin >>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for(int i=1;i<=N;i++)
        v[i]=false ;
    int cnt=0;
    for(int i=1;i<=N;i++)
        if(v[i]==false){
            vector<int> path ;
            dfs(i,path);
            set<int> s ;
            for(int i=0;i<path.size();i++)
                s.insert(a[path[i]]);
            for(int i=0;i<path.size();i++)
                if(s.find(path[i])!=s.end())
                    cnt++;
        }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 14328
#include <bits/stdc++.h>
#include <vector>
#include <cstdlib> //abs(int)
using namespace std;
int main(void){
  int A, B;
  cin >> A >> B;
  if(A * B % 2 == 0){
    cout << "Even";
  } else {
    cout << "Odd";
  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <random>
#include <map>
#include <set>
#include <boost/lexical_cast.hpp>

using namespace std;


using ULL = decltype(0ull);
constexpr auto DIV = 1000000007ull;
constexpr auto MAX = numeric_limits<ULL>::max();

int dp[1000000 + 5];

ULL Calc(string Exp, std::size_t Index) {
  if (Index == Exp.size() - 1) {
    return boost::lexical_cast<ULL>(Exp.back());
  }
  else {
    ULL result = boost::lexical_cast<ULL>(Exp.substr(Index));
    auto sub = Exp.substr(Index);
    for (int i = 1; i + Index < Exp.size(); ++i) {
      ULL self = boost::lexical_cast<ULL>(Exp.substr(Index, i))*pow(2, Exp.size() - (Index + i) - 1);
      ULL next = Calc(Exp, Index + i);
      result += self + next;
    }
    return result;
  }
}

ULL Calc(string& Exp) {
  if (Exp.size() == 1) {
    return boost::lexical_cast<ULL>(Exp);
  }
  else {
    ULL result = boost::lexical_cast<ULL>(Exp);
    for (int i = 1; i < Exp.size() ; ++i) {
      result += boost::lexical_cast<ULL>(Exp.substr(0, i))*pow(2, Exp.size() - i - 1) + Calc(Exp, i);
    }
    return result;
  }
}

int main() {
  string exp;
  cin >> exp;
  auto result = Calc(exp);
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		String str = scan.next();
		char c;
		
		if(str.length() == 1) {
			c = str.charAt(0);
			read(c);
		}else if(str.length() == 2) {
			c = str.charAt(1);
			read(c);
		}else {
			c = str.charAt(2);
			read(c);
		}
	}
	
	private static void read(char ch) {
		if(ch == '2' || ch == '4' || ch == '5' || ch == '7' || ch == '9') {
			System.out.println("hon");
		}else if(ch == '0' || ch == '1' || ch == '6' || ch == '8'){
			System.out.println("pon");
		}else {
			System.out.println("bon");
		}
	}

}


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

int ordena(const void *a,const void *b){
    int x= (*(int *)a), y = (*(int *)b);
    if(x>y)
        return 1;
    if(x<y)
        return -1;
    return 0;
}
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    int a[n];
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    qsort(a,n,sizeof(a[0]),ordena);
    int cont=0;
    for(int i=n-k;i<n;i++){
        cont+=a[i];
    }
    printf("%d\n",cont);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  ll N;
  cin >> N;
  vll A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  vvll dp(N, vll(2, 0)); //dp.at(i).at(j)はi番目まで、かつ末尾の反転の有無ごとの最大値
  dp.at(1).at(0) = A.at(0) + A.at(1);
  dp.at(1).at(1) = -1 * A.at(0) - A.at(1);
  for(int i = 1; i < N-1; i++){
    dp.at(i+1).at(0) = max(dp.at(i).at(0), dp.at(i).at(1)) + A.at(i+1);
    dp.at(i+1).at(1) = max(dp.at(i).at(0) - 2*A.at(i) - A.at(i+1), dp.at(i).at(1) + 2*A.at(i) - A.at(i+1));
  }
  cout << max(dp.at(N-1).at(0), dp.at(N-1).at(1)) << endl;
}

Measured memory_bytes: 6528
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
 
X=int(input())
ans=0
if(400<=X and X<=599):
    ans=8
if(600<=X and X<=799):
    ans=7
if(800<=X and X<=999):
    ans=6
if(1000<=X and X<=1199):
    ans=5
if(1200<=X and X<=1399):
    ans=4
if(1400<=X and X<=1599):
    ans=3
if(1600<=X and X<=1799):
    ans=2
if(1800<=X and X<=1999):
    ans=1
 
print(ans)

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

using namespace std;

const int maxn = 2010;
const int mod = 1e9+7;

int n, m, K, ans;
int f[maxn<<1][maxn<<1];

int main() {
	scanf("%d%d%d", &n, &m, &K);
	f[0][0] = 1;
	for (int i = 1; i <= (n+m-1)/(K-1); i++) {
		for (int j = 0; j <= n+m; j++) {
			for (int k = 0; k < K && k <= j; k++) {
				f[i][j] = (f[i][j] + f[i-1][j-k]) % mod;
			}
		}
	}
	for (int i = 0; i * (K-1) < m; i++) {
		ans = (ans + f[(n+m-1)/(K-1) - i][m - i * (K-1)]) % mod;
	} 
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 63104
x, k, d = map(int, input().split())
x = abs(x)
q, r = divmod(x, d)

# print(q, r)

if k <= q:
    print(x - k * d)
else:
    k -= q
    # print(f'{k=}')
    
    if k % 2 == 0:
        print(r)
    else:
        print(abs(r - d))
    

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

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> count(n);
  for (int i=0; i<2*m; i++) {
    int c;
    cin >> c;
    for (int j=0; j<n; j++) {
      if (c == j+1) count.at(j)++;
    }
  }
  for (int i; i<n; i++) cout << count.at(i) << endl;
}

Measured memory_bytes: 256
//id:miiifa (AOJ,PEどちらも)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
class Dictionary{
    public:
        vector<string>A;
        Dictionary(){

        }
        void judge(string s,string t){
            if(s=="insert") Insert(t);
            else if(s=="find") Find(t);
        }
        void Insert(string x){
            A.emplace_back(x);
        }
        //unorderset
        //10^6*n
        void Find(string x){
            auto itr= find(A.begin(),A.end(),x);
            size_t index = distance( A.begin(), itr );
            cout << ((index!=A.size())?"yes":"no") << endl;
        }
};
int main(){
    int n,q;
    cin >> n;
    unordered_set<string> USA;
    string key,val;
    REP(i,n){
        cin >> key >> val;
        if(key=="insert"){
            USA.insert(val);
        }else{
            if(USA.find(val)!=USA.end()) cout << "yes" << endl;
            else cout << "no" << endl;
        }
    }

    /*
    Dictionary Dc= Dictionary();
    string com,val;
    REP(i,n){
        cin >> com >> val;
        Dc.judge(com,val);
    }*/
}


Measured memory_bytes: 32168
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(dead_code)]
fn chmin<T>(x: &mut T, y: T) -> bool
where
    T: PartialOrd + Copy,
{
    *x > y && {
        *x = y;
        true
    }
}

#[allow(dead_code)]
fn chmax<T>(x: &mut T, y: T) -> bool
where
    T: PartialOrd + Copy,
{
    *x < y && {
        *x = y;
        true
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input!(n:usize,mut ds:[usize;n],m:usize,ts:[usize;m]);

    let mut ok = true;
    // 配列を用いた二分探索だとTLE(配列からの要素削除がボトルネックになるため)
    let mut map = BTreeMap::new();
    for &d in ds.iter() {
        *map.entry(d).or_insert(0) += 1;
    }
    for &t in ts.iter() {
        if let Some(&cnt) = map.get(&t) {
            let cnt = cnt - 1;
            if cnt <= 0 {
                map.remove(&t);
            } else {
                *map.entry(t).or_insert(0) = cnt;
            }
        } else {
            ok = false;
        }
    }

    println!("{}", if ok { "YES" } else { "NO" });
}


Measured memory_bytes: 12540
import java.util.*;

class Main {
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int Ans = 0;
      int flg = 0;
      int N = sc.nextInt();
      long[] a = new long[N];
      for (int i=0 ; i<N; i++) {
          a[i] = sc.nextLong();
      }
      
      for(int i=1; i<N; i++) {
    	  if(a[i-1]>a[i]) {
    		  if(a[i-1]-1==a[i]) {
    			  if (flg==0) {
    				  flg = 1;
    			  } else {
    				  Ans = 1;
    				  break;
    			  }
    		  } else {
    			  Ans = 1;
    			  break;
    		  }
    	  } else if (a[i-1]==a[i]) {
    		  if(flg == 1) {
    			  flg = 1;
    		  }
    	  }
    	  
    	  else {
    		  flg = 0;
    	  }
      }
      if (Ans == 0) {
    	  System.out.println("Yes");
      } else {
    	  System.out.println("No");
      }
      
  }  
}

Measured memory_bytes: 52180
h,w=map(int,input().split())
S=[]
for i in range(h):
    S.append(input())

cnt=0
D=[[10**9]*w for _ in range(h)]
D[0][0]=0
for i in range(h):
    for j in range(w):
        if j>0:
            D[i][j]=D[i][j-1]+(S[i][j]!=S[i][j-1])
        if i>0:
            D[i][j]=min(D[i][j],D[i-1][j]+(S[i][j]!=S[i-1][j]))   
                
                
if S[0][0]=='#':
    print(1+D[h-1][w-1]//2)
else:
    print(D[h-1][w-1]//2+(S[0][0]!=S[h-1][w-1]))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;
    int ans = lim<int>::max();
    for(int i = -100; i <= 100; i++) {
        int cur = 0;
        for(int j = 0; j < n; j++) {
            cur += (i - a[j]) * (i - a[j]);
        }
        ans = min(ans, cur);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
namespace io {
  template <typename T> inline void read(T &x) {
    bool flag = false;  char c = getchar();
    while ((c < '0' || c > '9') && c != '-')  c = getchar();
    c == '-' ? flag = true, x = 0 : x = c - '0';
    c = getchar();
    while (c >= '0' && c <= '9')  x = (x << 3) + (x << 1) + c - '0', c = getchar();
    if (flag)  x = -x;
  }
  template <typename T> inline void write(T x) {
    char st[10010];
    int cnt = 0;
    if (x < 0)  x = -x, putchar('-');
    if (x == 0)  putchar('0');
    while (x) { st[++cnt] = x % 10 + 48;  x /= 10; }
    while (cnt) { putchar(st[cnt--]); }
  }
}
using namespace io;
int main() {
    long long a, b, c;
    read(a); read(b); read(c);
    if (!((a & 1) && (b & 1) && (c & 1))) {
        puts("0");
    } else if (a > b && a > c) {
        write(b * c); puts("");
    } else if (b > a && b > c) {
        write(a * c); puts("");
    } else {
        write(a * b); puts("");
    }
    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: usize = 1_000_000_007;
const INF: i64 = std::i64::MAX/2;

pub trait SetMinMax {
	fn setmin(&mut self, v: Self) -> bool;
	fn setmax(&mut self, v: Self) -> bool;
}
impl<T> SetMinMax for T where T: PartialOrd {
	fn setmin(&mut self, v: T) -> bool {
		*self > v && { *self = v; true }
	}
	fn setmax(&mut self, v: T) -> bool {
		*self < v && { *self = v; true }
	}
}

fn solve() {
	let mut n = read!(i64);
	let mut ans = 0;
	ans += n/500*1000;
	n %= 500;
	ans += n/5*5;
	println!("{}", ans);
}

fn run() {
    solve();
}


Measured memory_bytes: 8572
n = int(input())
array = list(map(int, input().split()))
print(' '.join([str(e) for e in array]))
for i in range(1, len(array)):
    inserting = array[i]
    j = i - 1
    while j >= 0 and array[j] > inserting:
        array[j+1] = array[j]
        j -= 1
    array[j+1] = inserting
    print(' '.join([str(ele) for ele in array]))



Measured memory_bytes: 5604
#include<stdio.h>
int main()
{
	int i,j,a,b,c,t=0;
	scanf("%d%d%d",&a,&b,&c);
	if(a>b){t=b;b=a;a=t;}
	if(a>c){t=c;c=a;a=t;}
	if(b>c){t=c;c=b;b=a;}
	printf("%d",c-a);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define forn(i,a,n) for(int i =a; i <n;i++)
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
typedef long long int lli;
typedef pair<int,int> pii;
typedef vector<int> vi;
const lli inf = -1e14;
int n,w;
lli dp[105][100005],u[105][100005];
int c[105],p[105];

lli solve(int pos, int cap){
	if(pos == n){
		if(cap >= 0 )
			return 0;
		return -inf;
	}
	if(u[pos][cap]) return dp[pos][cap];

	u[pos][cap] = 1;
	lli ans = solve(pos+1,cap);
	if(cap - p[pos] >=0)
		ans = max(ans,solve(pos+1,cap - p[pos]) + c[pos]);
	return dp[pos][cap] = ans;
}

int main(){__
	cin >> n >> w;
	forn(i,0,n){
		cin >> p[i] >> c[i];
	}
	cout << solve(0,w) << endl;
}


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

        int a,b,c;
        cin>>a>>b>>c;
        if((a==b)&&(b!=c))
            cout<<"Yes";
        else if((a==c)&&(c!=b))
            cout<<"Yes";
        else if((c==b)&&(b!=a))
            cout<<"Yes";
        else
            cout<<"No";
    }


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n,m,a[10000];
    long long sum = 0;
    int i;

    scanf("%d %d", &n,&m);
    for (i = 0; i < m; i++){
        scanf("%d",&a[i]);
        sum += a[i];
    }

    if(sum > n)
    {
        printf("-1");
    }
    else
    {
        printf("%d",n - sum);
    }
    
}


Measured memory_bytes: 1748
import qualified Data.List as L

bothContained :: (Eq a) => [a] -> [a] -> Int
bothContained _ [] = 0
bothContained xs (y:ys)
  | elem y xs = 1 + bothContained xs ys
  | otherwise = bothContained xs ys

solve s = maximum $ flip map [1.. length s - 1] $
  \n -> let (x,y) = splitAt n s in bothContained (L.nub x) (L.nub y)

main :: IO ()
main = do
  getLine
  s <- getLine
  print $ solve s


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

typedef long long ll;
ll n, m, s, cnt, a[1000005];
string ta;
int main()
{
	ll i, j, t;
	cin >> n;
	cin >> ta;
	for (i = 0; i < n; i++) {
		a[i] = ta[i] - '1';
		if (a[i] == 1) cnt++;
	}
	for (i = 0; i < n; i++) {
		j = n - i - 1;
		t = (i ^ j);
		if (t == n - 1) s += a[i];
	}
	if (s % 2) {
		cout << 1;
		return 0;
	}
	if (cnt > 0) {
		cout << 0;
		return 0;
	}
	for (i = 0; i < n; i++) {
		a[i] /= 2;
	}
	s = 0;
	for (i = 0; i < n; i++) {
		j = n - i - 1;
		t = (i ^ j);
		if (t == n - 1) s += a[i];
	}
	if (s % 2) cout << 2;
	else cout << 0;
    return 0;
}


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

int main() {
	int a, b;
	int ans = 0;
	cin >> a >> b;
	for (int i = 0; i < 2; i++) {
		if (a >= b) {
			ans += a;
			a--;
		}
		else {
			ans += b;
			b--;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    K = int(input())
    a = [K//50 + 49] * 50
    kp = K % 50
    for i in range(50):
        if i < kp:
            a[i] += 51 - kp
        else:
            a[i] -= kp
    print(50)
    print(" ".join(map(str, a)))

main()


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

using namespace std;

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

typedef long long int ll;


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

	int n,limit;
	int arr[100];
	cin >> n >> limit;

	rep(i , n)
		cin >> arr[i];

	
	int ans = 1;
	int curr = 0;
	rep(i , n)
	{
	    curr += arr[i];
	    if(curr <=limit)    ans++;
	    else
	        break;
	}

	cout << ans;

	return 0;
}

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

using namespace std;

int main()
{
    int n,z;
    cin>>n>>z;
    
    int a[n];
    
    for(int i=0;i<n;i++)
    cin>>a[i];
    
    int dp[n];
    
    dp[0]=0;
    dp[1]=abs(a[0]-a[1]);
    for(int i=2;i<n;i++)
    {
        int k=INT_MAX;
        for(int j=0;(j<i && j<z);j++)
        {
            k=min(k,(dp[i-j-1]+abs(a[i]-a[i-j-1])));
        }
        dp[i]=k;
    }
    
    cout<<dp[n-1];
   return 0;
}

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

using namespace std;

int main()
{
    int a, b; cin >> a >> b;
    if (a > b)
        cout << "a > b" << '\n';
    else if (a < b)
        cout << "a < b" << '\n';
    else
        cout << "a == b" << '\n';
    return 0;
}



Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n,m; cin >> n >> m;
  vector<vi> to(n);
  vi a(m),b(m);
  rep(i,m){
    cin >> a[i] >> b[i];
    a[i]--;  b[i]--;
    to[a[i]].push_back(b[i]);
    to[b[i]].push_back(a[i]);
  }
  int ans = 0;
  rep(i,m){
    queue<int> q;  q.push(0);
    vi node(n,-1);
    while(!q.empty()){
      int now = q.front();  q.pop();
      for(int next : to[now]){
        if(now==a[i]&&next==b[i] || now==b[i]&&next==a[i]) continue;
        if(0 <= node[next]) continue;
        node[next] = now;
        q.push(next);
      }
    }
    bool ok = false;
    rep(j,n) if(node[j] == -1) ok = true;
    if(ok) ans++;
  }
  cout << ans;
  cout << "\n";
  return 0;
}


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

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

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

    size_t N, W;
    cin >> N >> W;

    vector<int64_t> w(N), v(N);
    for (size_t i = 0; i < N; ++i) {
        cin >> w[i] >> v[i];
    }

    const int max_value = int(1e5);
    vector<int64_t> dp(max_value + 1, LINF);
    dp[0] = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = max_value; j >= 0; --j) {
            if (j - v[i] >= 0) {
                chmin(dp[j], dp[j - v[i]] + w[i]);
            }
        }
    }

    int64_t res = 0;
    for (int64_t value = 0; value <= max_value; ++value) {
        if (dp[value] <= W) {
            chmax(res, value);
        }
    }

    cout << res << "\n";

    return 0;
}


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

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef pair <ll ,ll> pll;
typedef pair <int ,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define prvc(a) {for (auto iiiiiiiiii : a) cout << iiiiiiiiii << ' '; cout << '\n';}
#define fi first
#define se second
#define all(x) (x).begin() , (x).end()

ll next() {ll x; cin >> x; return x;}

const ll inf = 1e18 , mod = 998244353;
const int intf = 2e9 , maxn = 2e3;
const double PI = 3.141592653589 , eps = 1e-8;


void solve(){
    int n , k , s;
    cin >> n >> k >> s;
    vector <int> ans(n);
    for (int i = 0; i < k; i ++) ans[i] = s;
    int b = 1e9;
    if (s == b) b = 1;
    for (int i = k; i < n; i ++) ans[i] = b;
    prvc(ans);
}

int main()
{
    #ifdef HERE
        freopen("input.txt" , "r" , stdin);
    #else
        //freopen(".in" , "r" , stdin); freopen(".out" , "w" , stdout);
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #endif
    cout.precision(20);

    int t = 1;
    while(t --> 0){
        solve();
    }


    #ifdef HERE
        cout << setprecision(3) << fixed << "\n\nRuntime: " << (long double)(clock()) / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0;
}
/*

*/


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  int N, X;
  cin >> N >> X;
  vi x(N);
  int ans;
  for(int i = 0; i < N; i++){
    cin >> x.at(i);
    x.at(i) = abs(X - x.at(i));
    if(i == 0) ans = x.at(i);
    else{
      ans = __gcd(ans, x.at(i));
    }
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 640
import math
a,b = map(int,input().split())

ans = 0
for i in range(1, 1251):
    if (math.floor(i*0.08) == a) and (math.floor(i*0.1) == b): 
        print(i)
        exit()
    else:
        ans+=1

if ans == 1250:
    print("-1")

Measured memory_bytes: 3060
s=input()
n=len(s)
t = 1000
u = 1000
for i in range(n):
  if s[i] == "C":
    t = i
    break
for i in range(n-1,-1,-1):
  if s[i] == "F":
    u = i
    break
if max(t,u) != 1000 and t<u:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064