akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
using namespace std;

long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
void indexsort(long* first, long* last ,long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

int main() {

	long res = 0;
	string S; cin >> S;
	long mylen = S.length();
    //白黒か黒白で最小値。
	long ow = 0, ew = 0;

	for (int i = 1; i <= mylen; i++) {

		if (i % 2 == 0 && S[i - 1] == '1') ew++; 
		if (i % 2 == 1 && S[i - 1] == '1') ow++;


	}

	long evenc = mylen / 2; //偶数の数。

	res = min(ow + evenc - ew, ew + mylen - evenc - ow);

	cout << res << endl;
}

Measured memory_bytes: 512
import itertools

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

l = [i+1 for i in range(n)]
m =[]

for v in itertools.permutations(l, n):
    m.append(list(v))

a = 0
b = 0
for i in range(len(m)):
    if m[i] == p:
        a = i
    if m[i] == q:
        b = i

print(abs(a - b))

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

int main() {
  string S;
  cin >> S;
  for(int i=0; i<3; i++){
    if(S[i] =='1'){
      S[i] = '9';
    }
    else {
      S[i] = '1';
    }
  }
    cout << S << endl;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define LLIandI pair<long long int , int>
#define ll long long
struct Bellman_Ford{ //たどり着けないときはLLINF、負の閉路を持つときは-LLINFを返す。
    int N;
    long long int *d;
    int *pre;
    bool *negative;
    vector< pair< pair<int,int> , int> > edges;
    Bellman_Ford(int N) : N(N){
        d=new long long int[N];
        pre=new int[N];
        negative=new bool[N];
        rep(i,N){
            d[i]=LLINF;
            pre[i]=-1;
            negative[i]=false;
        }
    }
    void push_nondir(int a,int b, int c){
        edges.pb( mp( mp(a,b),c) );
        edges.pb( mp( mp(b,a),c) );
    }
    void push_dir(int a,int b, int c){
        edges.pb( mp( mp(a,b) ,c) );
    }
    long long int solve(int start, int end){
        d[start]=0;
        rep(i,N-1){
            rep(j,edges.size()){
                int from=edges[j].first.first;int to=edges[j].first.second;int cost=edges[j].second;
                if(d[to]>d[from]+cost){
                    d[to]=d[from]+cost;
                    pre[to]=from;
                }
            }
        }
        //startからendにいく回路の中に負の重みの閉路がある？
        rep(i,N){
            rep(j,edges.size()){
                int from=edges[j].first.first;int to=edges[j].first.second;int cost=edges[j].second;
                if(d[to]>d[from]+cost){
                    d[to]=d[from]+cost;
                    negative[to]=true;
                }
                if(negative[from])negative[to]=true;
            }
        }
        if(negative[end]) return -LLINF;
        else return d[end];
    }
    bool anywhere_negativeC(){//do after solve()
        rep(i,edges.size()){
            int from=edges[i].first.first;int to=edges[i].first.second;int cost=edges[i].second;
            if(d[to]>d[from]+cost)return true;
        }
        return false;
    }
    void free_BF(){
        delete[] d;
        delete[] pre;
        delete[] negative;
    }
    
};
int main(void){
    int N,M;
    scanf("%d %d",&N,&M);
    Bellman_Ford BF(N);
    rep(i,M){
        int a,b,c;
        scanf("%d %d %d",&a,&b,&c);
        a--;b--;
        BF.push_dir(a,b,-c);
    }
    long long int ans=BF.solve(0,N-1);
    if(ans==-LLINF)printf("inf\n");
    else printf("%lld\n",-ans);
    BF.free_BF();
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef pair<int, int> P;

bool solve(vector<string> &ops, map<string, P> &vs){
  vector< set<int> > v;
  for(string s : ops){
    set<int> tmp;
    if(vs.find(s) != vs.end()) FOR(i, vs[s].first, vs[s].second + 1) tmp.insert(i);
    else if(isdigit(s[0])) tmp.insert(atoi(s.c_str()));
    else if(s == "+") {
      set<int> b = v.back(); v.pop_back();
      set<int> a = v.back(); v.pop_back();
      for(int x : a){
        for(int y : b){
          int n = x + y;
          while(n >= 256) n -= 256;
          tmp.insert(n);
        }
      }
    } else if(s == "-"){
      set<int> b = v.back(); v.pop_back();
      set<int> a = v.back(); v.pop_back();
      for(int x : a){
        for(int y : b){
          int n = x - y;
          while(n < 0) n += 256;
          tmp.insert(n);
        }
      }
    } else if(s == "*"){
      set<int> b = v.back(); v.pop_back();
      set<int> a = v.back(); v.pop_back();
      for(int x : a){
        for(int y : b){
          int n = x * y;
          while(n >= 256) n -= 256;
          tmp.insert(n);
        }
      }
    } else if(s == "/"){
      set<int> b = v.back(); v.pop_back();
      set<int> a = v.back(); v.pop_back();
      for(int x : a){
        for(int y : b){
          if(y == 0) return false;
          int n = x / y;
          while(n >= 256) n -= 256;
          tmp.insert(n);
        }
      }
    }
    v.push_back(tmp);
  }
  return true;
}

int main() {
  int M; cin >>M;
  map<string, P> vs;
  REP(i, M){
    string s; cin >>s;
    int l, u; cin >>l >>u;
    vs[s] = P(l, u);
  }
  int N; cin >>N;
  vector<string> ops(N);
  REP(i, N) cin >>ops[i];
  cout <<(solve(ops, vs) ? "correct" : "error")  <<endl;
  return 0;
}

Measured memory_bytes: 1296
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int main() {
	int a, v, b, w, t;
	read(a), read(v), read(b), read(w), read(t);
	int dist = abs(a - b);
	if (v > w && 1ll * t * (v - w) >= dist) puts("YES");
	else puts("NO");
	return 0;
}


Measured memory_bytes: 3608
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstdint>

int main() {
  int N;
  std::cin >> N;
  std::vector<int> prices;
  bool up = true;
  for (int i = 0; i < N; ++i) {
    int A;
    std::cin >> A;
    if (prices.empty() ||
        (up && A < prices.back()) ||
        (!up && A > prices.back())) {
      prices.push_back(A);
      up = !up;
    } else {
      prices.back() = A;
    }
  }
  std::int64_t money = 1000;
  std::int64_t stock = 0;
  for (std::size_t i = 0; i < prices.size(); ++i) {
    if (i & 1) {
      money += prices[i] * stock;
      stock = 0;
    } else {
      const auto num = money / prices[i];
      money -= num * prices[i];
      stock += num;
    }
  }
  money += prices.back() * stock;
  std::cout << money << std::endl;
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod = 1e9 + 7;
/* 自分で考えたやつ */
// int main() {
    
//     int n, x;
//     cin >> n >> x;
//     vector<int> y(n+1);
//     rep(i, n) cin >> y[i];

//     y[n] = x;
//     sort(y.begin(), y.end());

//     vector<int> v(n);
//     rep(i, n){
//         v[i] = y[i+1] - y[i];
//     }

//     int ans = v[0];
//     rep(i, n){
//         ans = min(ans, v[i]);
//     }

//     bool check = true;
//     for(int i=ans; i>=1; i--){
//         check = true;
//         rep(j, n){
//             if(v[j] % i != 0){
//                 check = false;
//             }
//         }
//         if(check){
//             ans = i;
//             break;
//         }
//     }
//     cout << ans << endl;
//     return 0;
// }

/*　模範解答　ユークリッドの互除法を用いた最速の解き方　*/
int gcd(int a, int b) {

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

int main(){
    int n, x;
    cin >> n >> x;
    int ans = 0;
    rep(i, n){
        int y;
        cin >> y;
        ans = gcd(ans, abs(x-y));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
inline void read (int &x) {
	char ch = getchar(); int f = 0; x = 0;
	while (!isdigit(ch)) { if (ch == '-') f = 1; ch = getchar(); }
	while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar(); if (f) x = -x;
}
signed main() {
	int s, w; read (s), read (w);
	s <= w ? puts ("unsafe") : puts ("safe");
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> l(n);
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    int temp;
    for(int i=n-1;i>0;i--){
        for(int j=n-1;j>n-i-1;j--){
            if(l[j]<l[j-1]){
                temp=l[j-1];
                l[j-1]=l[j];
                l[j]=temp;
            }
        }
    }
    
    int sum=0;
    for(int i=n-1;i>n-k-1;i--){
        sum+=l[i];
    }
    cout<<sum<<endl;
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cout <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cout <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb() fflush(stdout);

using namespace std;

int n;
VI g[212345];
int d[212345];

void dfs(int v, int p) {
	FORE(i, g[v]) {
		int w = *i;
		if (w == p) continue;
		d[w] = d[v] + 1;
		dfs(w, v);
	}
}

int main() {
	read(n);
	FOR(i,0,n-1) {
		make2(a, b);
		a--; b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	d[0] = 0;
	dfs(0, 0);
	int x = 0;
	FOR(i,0,n) if (d[x] < d[i]) x = i;
	d[x] = 0;
	dfs(x, x);
	int y = x;
	FOR(i,0,n) if (d[y] < d[i]) y = i;
	int a = d[y];
	if (a % 3 == 1) {
		printf("Second\n");
	} else {
		printf("First\n");
	}
}






Measured memory_bytes: 21632
#include<iostream>
int main(){
  long long int ID[100010],N,M,L,R,OPEN=0,result=0;
  std::cin>>N>>M;
  for(int i=1;i<N+1;i++)
    ID[i]=0;
  for(int i=0;i<M;i++){
    std::cin>>L>>R;
    ID[L]++;ID[R+1]--;
  }
  for(int i=1;i<N+1;i++){
    OPEN+=ID[i];
    if(OPEN==M) result++;
  }
  std::cout<<result<<std::endl;
  return 0;
}


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

int main(){
    ll n, k; cin >> n >> k;
    vector<ll> p(n); 
    for(ll i=0; i<n; ++i){cin >> p[i];}
    sort(p.begin(), p.end());
    ll res = 0;
    for(ll i=0; i<k; ++i){
        res += p[i];
    }
    cout << res << endl;
    return 0;
}

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

int const N = 200 * 1000 + 16;
int const M = 1000*1000*1000 + 7;

int n;
char a[2][64];
int dp[64][4][4];

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);

  cin >> n;
  cin >> a[0] >> a[1];

  int z = 1;
  if(a[0][z-1] == a[1][z-1])
    dp[0][0][0] = dp[0][1][1] = dp[0][2][2] = 1;
  else {
    z++;
    dp[0][0][1] = dp[0][0][2] = dp[0][1][2] =
    dp[0][1][0] = dp[0][2][0] = dp[0][2][1] =
    dp[1][0][1] = dp[1][0][2] = dp[1][1][2] =
    dp[1][1][0] = dp[1][2][0] = dp[1][2][1] = 1;
  }

  for(int i = z; i < n; ++i) {
    bool one = (a[0][i] == a[1][i]);

    if(one) {
      for(int x = 0; x < 3; ++x)
        for(int y = 0; y < 3; ++y)
          for(int z = 0; z < 3; ++z)
            if(x != y && z != x) {
              dp[i][x][x] += dp[i-1][y][z];
              dp[i][x][x] %= M;
            }
    } else {
      for(int x = 0; x < 3; ++x)
        for(int y = 0; y < 3; ++y)
          for(int z = 0; z < 3; ++z)
            for(int w = 0; w < 3; ++w)
              if(x != y && z != x && y != w) {
                dp[i][x][y] += dp[i-1][z][w];
                dp[i][x][y] %= M;
              }

      for(int x = 0; x < 3; ++x)
        for(int y = 0; y < 3; ++y)
          dp[i+1][x][y] = dp[i][x][y];
      i++;
    }
  }


  int ans = 0;
  for(int i = 0; i < 3; ++i)
    for(int j = 0; j < 3; ++j)
      ans = (ans + dp[n-1][i][j]) % M;

  cout << ans;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args) {
 
    while(kbd.hasNext()){
        String n = kbd.next();
        if(!(n.equals("0"))){
        int sum = 0;
        int i=0;
        for(; i<n.length(); i++){
            String a = n.substring(i,i+1);
            //System.out.println(a);
            int b = Integer.parseInt(a);
            //System.out.println(sum+"+"+b);
            sum += b;
        }
            System.out.println(sum);
        }
    }
    }
}       

Measured memory_bytes: 18164
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

const long long INF = 1LL << 60;

int main()
{
  int N;
  int array[2][110];
  int a[110] = {0};
  int b[110] = {0};
  int i, j;
  long long maxed = -INF;

  cin >> N;

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

  //累積和
  for (int i = 0; i < N; i++)
  {
    a[i + 1] = a[i] + array[0][i];
    b[i + 1] = b[i] + array[1][i];
  }

  j = 1;

  //累積和を用いて答えを求める
  for (int i = 0; i <= N; i++)
  {
    //j = 1;
    long long res = a[j] + (b[N] - b[i]);
    maxed = max(maxed, res);
    j++;
  }

  cout << maxed << endl;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
    string first,second;
    int f,s;
    cin >> first >> second;
    cin >> f >> s;
    string str;
    cin >> str;
    if(str == first)
        cout << f-1 << " " << s;
    else
        cout << f << " " << s-1;
    return 0;
}


Measured memory_bytes: 256
import sys
if sys.version_info[0]>=3: raw_input=input

def checkio(data):
	y=len(data)
	x=len(data[0])
	m=[[0]*x for i in range(y)]
	for j in range(y):
		r=0
		for i in range(x):
			#if data[j][i]=='.': r+=1
			if data[j][i]==1: r+=1
			else: r=0
			m[j][i]=r
	r=0
	for i in range(x):
		for j in range(y):
			M=9999999
			for k in range(j,y):
				M=min(M,m[k][i])
				r=max(r,M*(k-j+1))
	return r

if __name__=='__main__':
	n=int(raw_input())
	try:
		for _i in range(n):
			data=[[int(e) for e in raw_input().split()] for i in range(5)]
			print(checkio(data))
			raw_input()
	except EOFError:
		pass

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

typedef pair<long long, long long> pi;
typedef pair<long long, pi> pii;

long long n, c, p[100000];
pii a[100000];
vector<pii> edges;

long long root(long long x){
	return p[x] == -1 ? x : p[x] = root(p[x]);
}

void connect(long long x, long long y){
	p[root(x)] = root(y);
}

bool cmp1(pii a, pii b){
	return a.second.first < b.second.first;
}

bool cmp2(pii a, pii b){
	return a.second.second < b.second.second;
}

int main(){
	cin >> n;
	for(int i = 0; i < n; i++){ cin >> a[i].second.first >> a[i].second.second; a[i].first = i; }
	sort(a, a+n, cmp1);
	for(int i = 1; i < n; i++) edges.push_back(pii(min(abs(a[i].second.first-a[i-1].second.first), abs(a[i].second.second-a[i-1].second.second)), pi(a[i].first, a[i-1].first)));
	sort(a, a+n, cmp2);
	for(int i = 1; i < n; i++) edges.push_back(pii(min(abs(a[i].second.first-a[i-1].second.first), abs(a[i].second.second-a[i-1].second.second)), pi(a[i].first, a[i-1].first)));
	sort(edges.begin(), edges.end());
	memset(p, -1, sizeof(p));
	for(auto &it : edges){
		if(root(it.second.first) != root(it.second.second)){
			c += it.first;
			connect(it.second.first, it.second.second);
		}
	}
	cout << c;
}

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

int main(){
  ll n;
  int tot = 0;
  cin >> n;
  if(n == 1){
    cout << 0 <<endl; return 0;
  }
  for (ll i=2; i<=sqrt(n); i++){
    int count = 0;
    while(n%i==0){
      n /=i;
      count +=1;
    }
    int ccount =0;
    int j = 0;
    for(int i=1;i<=count;i++){
        j +=i;
        ccount +=1;
        if (count-j<= i){
          break;
        }
    }
    tot += ccount;
    /*if (count > 0){
      cout << i << ": "<< count << ": "<< ccount<<endl;
    }*/
  }
  if (n>1){
    //  cout << n << ": " << 1 << ": "<< 1 << endl;
      tot +=1;
  }
  cout << tot <<endl;

return 0;
}


Measured memory_bytes: 3688
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

#define MaxNum 260000
bool isprime[MaxNum];

void makeprime(){
	REP(i,MaxNum) isprime[i] = true;
	FOR(i,2,(int)sqrt(MaxNum)+1){
		FOR(j,i+1,MaxNum){
			if(j%i==0) isprime[j] = false;
		}
	}
}

int main(){
	ll int tmp;
	makeprime();
	while(cin>>tmp,tmp){
		ll int ans = 0;
		FOR(i,tmp+1,2*tmp+1){
			if(isprime[i]) ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

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

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

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

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


int main(){
  ll n,m; cin >> n >> m; vl num(m);
  if(n >= m) cout << 0 << endl;
  
  else{
    rep(i,m){ ll x; cin >> x; num[i] = x; }
  
    sort(all(num));
    
    vl dis(m-1); ll dissum = 0;
    for(ll i=0; i < m-1; i++){
      dis[i] =  num[i+1] - num[i];
    }
    
    sort(all(dis));
    
    for(ll i=0; i < m-n; i++){
      dissum += dis[i];
    }
    
    cout << dissum << endl;
  }
}


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

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

using namespace std;

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

	bool flag = false;

	rep(i,s.size()-1)
		if (s.substr(i, 2) == "AC") {
			flag = true;
			break;
		}

	if (flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,a,n) for (register int i=a;i<=n;i++)
#define per(i,a,n) for (register int i=n;i>=a;i--)
#define FOR(i,a,n,x) for (register int i=a;i<=n;i+=x)
#define ROF(i,a,n,x) for (register int i=n;i>=a;i-=x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define VI vector<int>
#define ll long long
#define ull unsigned long long
#define lowbit(x) ((x)&(-x))
#define mem(i, a) memset(i, a, sizeof(i))
#define sqr(x) ((x)*(x))
#define ls (p << 1)
#define rs (p << 1 | 1)
using namespace std;

template <typename T>

inline void read(T &X) {
  X = 0; char ch = 0; T op = 1;
  for(; ch > '9' || ch < '0'; ch = getchar())
    if(ch == '-') op = -1;
  for(; ch >= '0' && ch <= '9'; ch = getchar())
    X = (X << 3) + (X << 1) + ch - 48;
  X *= op;
}

const int INF = 0x3f3f3f3f;
const int MAXN = 1e5 + 5;

int n, m;
ll sum = 0;
int arr[MAXN];

int main() {
#ifdef WiLe
  freopen ("input.txt", "rt", stdin);
#endif

  read(n), read(m);
  rep (i, 1, n) read(arr[i]), sum += arr[i];

  // cout << sum << endl;
  sum = (sum + 4 * m - 1) / (4 * m);
  // cout << sum << endl;

  sort(arr+1, arr+n+1, greater<int>());

  rep (i, 1, m) {
    if (arr[i] < sum) {puts("No"); return 0;}
  }

  puts("Yes");

#ifdef WiLe
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}
/*
# author : WiLe
# date : 2020/04/17
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h1, s1, h2, s2, c1=0, c2=0;
    cin>>h1>>s1>>h2>>s2;
    c1=h1/s2;
    if(h1%s2!=0)
        c1++;
    c2=h2/s1;
    if(h2%s1!=0)
        c2++;
    if(c1>=c2)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3616
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a<b&&b<c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 26196
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define NIL -1
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<vector<int>>;

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}

const double PI=(acos(-1));

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n)cin>>a[i];
    sort(a.rbegin(),a.rend());
    ll ans=a[0];
    for(int i=2;i<n;++i){
        ans+=a[i/2];
    }
    cout<<ans<<endl;

}

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

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

  if (N <= 999)
    cout << "ABC" << endl;
  else
    cout << "ABD" << endl;
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
typedef unsigned u32;
typedef long long s64;
typedef unsigned long long u64;
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
const int N=185;
int h, w, f[N][N][N], g[N][N][N];
char a[N][N+1];
int main() {
	assert(scanf("%d%d", &h, &w)==2);
	for(int i=0; i<h; ++i) assert(scanf("%s", a[i])==1);
	for(int i=h; i--; )
		for(int j=w; j--; ) {
			f[i][j][i]=j+1<w&&a[i][j]==a[i][j+1]?f[i][j+1][i]+1:1;
			g[i][j][j]=i+1<h&&a[i][j]==a[i+1][j]?g[i+1][j][j]+1:1;
		}
	for(int i=0; i<h; ++i)
		for(int j=0; j<w; ++j) {
			for(int d=i+1; d<h; ++d)
				f[i][j][d]=a[d][j]==a[d-1][j]?std::min(f[i][j][d-1], f[d][j][d]):0;
			for(int r=j+1; r<w; ++r)
				g[i][j][r]=a[i][r]==a[i][r-1]?std::min(g[i][j][r-1], g[i][r][r]):0;
		}
	int complexity=0;
	while(f[0][0][h-1]<w) {
		++complexity;
		for(int i=0; i<h; ++i)
			for(int j=0; j<w; ++j) {
				for(int k=i; k<h; ++k)
					if(f[i][j][k]+j<w) f[i][j][k]+=f[i][f[i][j][k]+j][k];
				for(int k=j; k<w; ++k)
					if(g[i][j][k]+i<h) g[i][j][k]+=g[g[i][j][k]+i][j][k];
				for(int k=h, l=j; k--; )
					for(; l<f[i][j][k]+j; ++l) cmax(g[i][j][l], k-i+1);
				for(int k=i, l=w; l--; )
					for(; k<g[i][j][l]+i; ++k) cmax(f[i][j][k], l-j+1);
			}
	}
	printf("%d\n", complexity);
	return 0;
}


Measured memory_bytes: 49792
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>
#include <cmath>

int main(){
    
    int a;
    int b;
    cin >> a >> b;


    int res = -1;
    for (int i = 1; i < 100000; ++i) {
        if (i * 8 / 100 == a && i * 10 / 100 == b) {
            res = i;
            break;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a;
  cin >> n >> a;
  cout << n*n-a << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
S = list(map(int,list(str(input()))))

#print(S)
count = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            num = 0
            for l in range(N):
                if num == 0 and S[l] == i:
                    num = 1
                elif num == 1 and S[l] == j:
                    num = 2
                elif num == 2 and S[l] == k:
                    count += 1
                    break

print(count)

Measured memory_bytes: 44636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

// 10進数から2進数
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}






#define int long long int 

int32_t main()
{
    int n;
    cin>>n;
    int a[n+2],ans=0;
    a[0]=0;
    a[n+1]=0;
    for(int i=1;i<=n;i++)
     {
     cin>>a[i];
      ans+=abs(a[i]-a[i-1]);
     }
     ans+=abs(a[n]);
    
     
    int diff[n+2];
   
    diff[0]=0;
    diff[n+1]=0;
    for(int i=1;i<=n;i++)
       diff[i]=abs(a[i]-a[i-1])+abs(a[i+1]-a[i]);
    //     for(auto i:diff)
    // cout<<i<<" ";
    // cout<<endl;
    // cout<<ans<<endl;
    for(int i=1;i<n;i++)
     cout<<ans-diff[i]+abs(a[i+1]-a[i-1])<<endl;
     cout<<ans-abs(a[n-1]-a[n])-abs(a[n])+abs(a[n-1])<<endl;
    
    
}


Measured memory_bytes: 5252
#include <vector>
#include <stack>
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <typeinfo>


typedef long long ll;

void divide_cube(){
	ll a,b,c;
	ll m1,m2;
	std::cin >> a >> b >> c;
	if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0)
		std::cout << 0 << std::endl;
	else{
		/*
		int ab = a*b;
		int bc = b*c;
		int ca = c*a;
		int result = std::min(ab,bc);
		result = std::min(result,ca);
		*/
		
		m1 = std::min(a,b);
		if(m1 == a)
			m2 = std::min(b,c);
		else
			m2 = std::min(a,c);
		ll result = m1 * m2;
		std::cout << result << std::endl;
	}
}

int main(){
	divide_cube();
	return 0;
}

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

int main() {
	int x = 0,some = 1;
	int s = 0;
	std::vector<int> v;
	std::cin >> x;
	if (x < 4) {
		std::cout << '1' << std::endl;
		return 0;
	}
	//31*31が最高
	for (int j = 2; j < 32; j++) {
		for (int i = j * j; i <= 1000;) {
			v.push_back(i);
			i *= j;
		}
	}
	std::sort(v.begin(), v.end());
	v.erase(std::unique(v.begin(), v.end()), v.end());
	for (int i = v.size()-1; i >= 0; i--) {
		if (x >= v[i]) {
			std::cout << v[i] << std::endl;
			return 0;
		}
	}
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  long long x; scanf("%lld", &x);
  long long  b = 100, ans = 0;
  while (x > b) {
    b = b*1.01;
    ++ans;
  }
  printf("%lld", ans);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


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

main(){
int a,b,c;
cin >> a;
cin >> b;
cin >> c;

if(a<=b && a<=c){
cout << a <<" ";
if(b<=c){
cout << b << " "<<c <<"\n";
}
else{
cout << c  <<" "<<b <<"\n";
}
}

else if(b<=a && b<=c){
cout << b <<" ";
if(a<=c){
cout << a<<" "<<c << "\n";
}
else{
cout << c << " "<<a <<"\n";
}
}

else{
cout << c <<" ";
if(a<=b){
cout << a << " "<< b <<"\n";
}
else{
cout << b <<" " <<a<<"\n";
}
}
}

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

int main() {
	int N;
	int K;
	int a[200010];

	cin >> N >> K;

	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < N - K; i++) {
		if (a[i]<a[i+K]){
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 4416
S=list(input())
count=0
for i in range(len(S)):
  if i%2==0 and (S[i]=="R" or S[i]=="U" or S[i]=="D"):
    count+=1  
  elif i%2==1 and (S[i]=="L" or S[i]=="U" or S[i]=="D"):
    count+=1
if count==len(S):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9000
from collections import deque
N=int(input())
A=deque(list(map(int,input().split())))
D={}
ans=[]
M=0
for i in range(N):
    a=A.pop()
    if N//(N-i)==1:
        D[N-i]=a
        if a==1:
            M+=1
            ans.append(str(N-i))
    else:
        p=N//(N-i)
        memo=0
        for j in range(1,p):
            memo+=D[(N-i)*(j+1)]
        if memo%2==a:
            D[N-i]=0
        else:
            D[N-i]=1
            M+=1
            ans.append(str(N-i))
print(M)
print(" ".join(ans))

Measured memory_bytes: 38812
#include <iostream>
#include <vector>


int main() {
  std::vector<unsigned long> vec(5, 0);
  int n;
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    std::string name;
    std::cin >> name;
    switch (name[0]) {
      case 'M':
        vec[0]++;
        break;
      case 'A':
        vec[1]++;
        break;
      case 'R':
        vec[2]++;
        break;
      case 'C':
        vec[3]++;
        break;
      case 'H':
        vec[4]++;
        break;
    }
  }
  unsigned long ans = 0;
  for (int i = 0; i < 5; i++) {
    for (int j = i + 1; j < 5; j++) {
      for (int k = j + 1; k < 5; k++) {
        ans += vec[i] * vec[j] * vec[k];
      }
    }
  }
  std::cout << ans;
}

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

using namespace std;

set<int> hoge[100000];

int main(int argc, char **argv) {
  int N, a;
  unsigned ans = 0;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> a;
    if (a > i) {
      hoge[a - 1].insert(i);
    } else {
      if (hoge[i].find(a - 1) != hoge[i].end()) {
        ++ans;
      }
    }
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 7296
n = int(input())
a = list(map(int,input().split()))

i = 1
ans = 1
change = [False,False]

while i<n:
    if change == [True,True]:
        ans += 1
        change = [False,False]
        #print(change)
    elif a[i]>a[i-1]:
        change[0] = True
        i += 1
        #print(change)
    elif a[i]<a[i-1]:
        change[1] = True
        i += 1
        #print(change)
    else:
        i += 1
        #print(change)
if i==n and change==[True,True]:
    ans += 1
print(ans)

Measured memory_bytes: 62704
n,m = map(int,input().split())
x = sorted(list(map(int,input().split())))
if n>=m:
  print(0)
else: 
  step = []
  div = []
  num = []
  for i in range(m-1):
    step.append([x[i+1]-x[i],i+1])
  step.sort(reverse=True)
  for i in range(n-1):
    num.append(step[i][1])
  num.sort()
  temp = []
  for i in range(m):
    if len(num)!=0:
      if i==num[0]:
        div.append(temp)
        del num[0]
        temp = []
    temp.append(x[i])
  div.append(temp)
  ans = 0
  for l in div:
    ans += l[-1]-l[0]
  print(ans)
    

Measured memory_bytes: 33416
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
   ll dp[2000000];
 int gcd(int a, int b)
{
  if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b,a%b));
}
}
  vector<vector<bool>>d(5001,vector<bool>(5001));
int main(){
  ll a,ans=0,c=0;cin>>a;
  string b;cin>>b;
  rep(i,a)if(b[i]=='R')c++;
  for (ll i = c; i < a; i++)
  {
    if(b[i]=='R')ans++;
  }
  
  cout<<ans;
}



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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll W, a, b;
    cin >> W >> a >> b;

    if (a+W <= b) {
        cout << b-(a+W) << endl;
    } else if (a > b+W) {
        cout << a-(b+W) << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
typedef long long ll;
typedef unsigned long long ull;
const ll LINF = 1e18;
const int INF = 1e8;
using namespace std;


//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()		
#define debug system("pause")				//デバッグ用


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

	int a, b, c;

	cin >> a >> b >> c;

	cout << (c / a) * b << endl;


}

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

int main(){
    string s;int k;
    cin>>s>>k;
    vvv dp(s.size()+1, vv (2, vi (k+2,0)));
    //less 1:ちょうど 0: たりない
    for(int i=0; i<s.size(); i++){
        if(!i){
            dp[i][1][1] = 1;
            dp[i][0][1] = s[0]-'1';
            dp[i][0][0] = 1;
        }
        else{
            if(s[i]=='0'){
                rep(dk,k+1){
                    dp[i][1][dk]   += dp[i-1][1][dk];
                    dp[i][0][dk+1] += dp[i-1][0][dk]*9;
                    dp[i][0][dk]   += dp[i-1][0][dk];
                }
            }
            else{
                rep(dk,k+1){
                    dp[i][1][dk+1] += dp[i-1][1][dk];
                    dp[i][0][dk+1] += dp[i-1][1][dk]*(s[i]-'1');
                    dp[i][0][dk]   += dp[i-1][1][dk];
                    dp[i][0][dk+1] += dp[i-1][0][dk]*9;
                    dp[i][0][dk]   += dp[i-1][0][dk];
                }
            }
        }
    }
    cout << dp[s.size()-1][0][k]+dp[s.size()-1][1][k] << endl;
    return 0;
}

Measured memory_bytes: 3572
#include<stdio.h>

#define MAXN 200005

long long buf[MAXN];

void merge_sort(long long *a, long long size)
{
    static long long i, j, k;
    if(size <= 1)
        return;
    merge_sort(a, size >> 1);
    merge_sort(a + (size >> 1), size - (size >> 1));

    for(i = 0, j = (size >> 1), k = 0; i < (size >> 1) && j < size;)
    {
        if(a[j] < a[i])
            buf[k++] = a[j++];
        else
            buf[k++] = a[i++];
    }
    while(i < (size >> 1))
        buf[k++] = a[i++];

    for(i = 0; i < k; i++)
        a[i] = buf[i];
}


int main()
{
    long long i, N, a[MAXN];
    scanf("%lld", &N);
    for(i = 0; i < N; i++)
      scanf("%lld", a + i);
    merge_sort(a, N);
    for(i = 0; i < (N - 1); i++)
      if(a[i] == a[i + 1])
        break;
    printf("%s\n", i == (N - 1) ? "YES" : "NO");
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N, M;
    cin >> N >> M;
    vector<int> H(N);
    vector<bool> good(N, true);
    rep(i,N) cin >> H[i];

    int A, B;
    rep(i,M) {
        cin >> A >> B;
        A--; B--;
        if (H[A] > H[B]) good[B] = false;
        else if (H[A] < H[B]) good[A] = false;
        else {
            good[A] = false;
            good[B] = false;
        }
    }

    int count = 0;
    rep(i,N) if (good[i]) count++;
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,int>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    int x,t; cin >> x >> t;
    cout << x+(t/2) << endl;
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
using namespace std;
int main() {
    int n;
    cin>>n;
    int t[114514]={};
    int x[114514]={};
    int y[114514]={};
    for(int i=1;i<=n;i++){
        cin>>t[i]>>x[i]>>y[i];
    }
    for(int i=1;i<=n;i++){
        int k=abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
        int ti=abs(t[i]-t[i-1]);
        if(k>ti){
          cout<<"No"<<endl;
          return 0;
        }else if((ti-k)%2==1){
            cout<<"No"<<endl;
            return 0;
        }
    }
	cout<<"Yes"<<endl;
}   



Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int n,t,to,from,res;
int main(){
	scanf("%d%d",&n,&t);
	from = to = -1;
	while(n--){
		int x;
		scanf("%d",&x);
		if(x > to){
			res += to - from;
			from = x;
			to = x + t;
		}else
			to = max(to, x + t);
	}
	res += to - from;
	printf("%d\n",res);
	return 0;
}


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

#define lol long long

int main() {

	lol n;
	cin >> n;

	lol cnt = 0;
	for (int i = 1; i <= n; i++) {
		int cnt2=0;
		if (i % 2 == 1) {

			for (int j = 1; j <= i; j++) {

				if (i%j == 0) cnt2++;
			}
			if (cnt2 == 8) cnt++;


		}
	}

	cout << cnt;

	return 0;
}

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





int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int a,b;cin>>a>>b;
    map<int,int> mp;
    mp[a]++;
    mp[b]++;
    if(mp[1]==0) cout<<1;
    else if(mp[2]==0) cout<<2;
    else cout<<3;
    return 0;
}


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

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll k;
    vector<pair<ll, int> > v(3);
    for(int i = 0; i < 3; i++){
        cin >> v[i].F;
        if(i == 0) v[i].S = 1;
        if(i == 1) v[i].S = 0;
        if(i == 2) v[i].S = -1;
    }
    cin >> k;
    ll ans = 0;
    ans += min(k, v[0].F);
    k -= min(k, v[0].F);
    // ans += min(k, v[1].F);
    k -= min(k, v[1].F);
    ans -= min(k, v[2].F);
    cout << ans;
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s,t;
	cin >> s;
	cin >> t;
	int cnt;
	int mn = INT_MAX;
	for (int i = 0; i <= s.length()-t.length(); i++) {
		cnt = 0;
		//int k = i;
		for (int j = 0; j < t.length(); j++) {
			if (s[i+j] == t[j]) {
			//	k++;
				continue;
			}
			else {
			//	k++;
				cnt++;
			}
		}
		mn = min(mn, cnt);

	}
	cout << mn;

	return 0;
}


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

#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 EPS (1e-7)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int MAX=1e9;


int main(){
	int n,a,b;
	cin>>n>>a>>b;
	cout<<min(a*n,b)<<endl;
	return 0;
}


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

import sys
from itertools import accumulate

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

N, K = MAP()
mod = K * 2
XY = []
MAX = K*4 + 7
acc = list2d(MAX, MAX, 0)
for i in range(N):
    x, y, c = input().split()
    x = int(x)
    y = int(y)
    x %= mod
    y %= mod
    if c == 'B':
        x += K
    for a1 in range(3):
        for a2 in range(3):
            for b in [0, K]:
                if c == 'B':
                    b = -b
                x1 = x + a1 * mod + b
                y1 = y + a2 * mod + b
                x2 = x1 + K
                y2 = y1 + K
                x1 = max(min(x1, MAX-1), 0)
                y1 = max(min(y1, MAX-1), 0)
                x2 = max(min(x2, MAX-1), 0)
                y2 = max(min(y2, MAX-1), 0)
                acc[x1][y1] += 1
                acc[x2][y2] += 1
                acc[x1][y2] -= 1
                acc[x2][y1] -= 1

for i in range(MAX):
    acc[i] = list(accumulate(acc[i]))
for j in range(MAX):
    for i in range(MAX-1):
        acc[i+1][j] += acc[i][j]
mx = 0
for j in range(K*2, K*4):
    for i in range(K*2, K*4):
        mx = max(mx, acc[i][j])
print(mx)


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

using namespace std;
#define ll long long
#define ld long double

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

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

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    double a, b, t;
    cin >> a >> b >> t;
    t += 0.5;
    int cnt = 0;
    for(int i=1;i<=20;i++) {
        if(a * i <= t) cnt += b;
    }    
    cout << (int)cnt << endl;
}


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

int main() {
    std::string S;
    std::cin >> S;
    
    int year = stoi(S.substr(0, 4));
    int month = stoi(S.substr(5, 2));
    
    if (year < 2019) {
        std::cout << "Heisei" << std::endl;
        return 0;
    }
    if (year > 2020) {
        std::cout << "TBD" << std::endl;
        return 0;
    }
    if (month < 5) {
        std::cout << "Heisei" << std::endl;
        return 0;
    }
    if (month > 4) {
        std::cout << "TBD" << std::endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MD 1000000007
#define INF 1ll<<60
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    ll k;
    cin>>k;
    vector<ll> v(51);
    ll num=k/50;
    for(ll i=0;i<50;i++) v[i]=(i+num);
    for(ll i=0;i<(k%50);i++){
        for(ll j=0;j<50;j++){
            if(j==i) v[j]+=50;
            else v[j]--;
        }
    }
    cout<<50<<endl;
    for(int i=0;i<50;i++) cout<<v[i]<<' ';
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256