akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

struct obj{
	long long w, v;
};

const int MAXV = 2e5+10;
const long long INF = 2e18+10;
int main(){
	cin.tie(0);
	cin.sync_with_stdio(0);

	int N, W;
	cin >> N >> W;
	int ans = 0;

	vector<obj>v(N);
	for(auto &i : v) cin >> i.w >> i.v;
	vector<vector<long long>> dp(N, vector<long long>(MAXV, INF));
	dp[0][0] = 0;
	dp[0][v[0].v] = v[0].w;

	for(int i=1; i<N; i++){
		for(int j=0; j<MAXV; j++){
			dp[i][j] = min(dp[i][j], dp[i-1][j]);
			if(dp[i-1][j] + v[i].w <= W)
				dp[i][j + v[i].v] = min(dp[i][j + v[i].v], dp[i-1][j] + v[i].w);
		}
	}

	for(int i=0; i<N; i++)
		for(int j=0; j<MAXV; j++)
			if(dp[i][j] != INF)
				ans = max(ans, j);

	cout << ans;
}


Measured memory_bytes: 158208
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
char a[105];

int main()
{
	int i,len,j;
	bool z=false;
	scanf("%s", a);
	len=strlen(a);
	for (i=0; i<len; i++)
	{
		if (a[i]=='C') 
		{
			for (j=i+1; j<len; j++)
			if (a[j]=='F') z=true;	
		}
	}
	if (z==true) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, a[100005], dp[100005];
int main() {
    cin >> n;
    for (int i=1; i<=n; i++) cin >> a[i];
    dp[2] = abs(a[2] - a[1]);
    for (int i=3; i<=n; i++) {
        dp[i] = min(dp[i-1] + abs(a[i] - a[i-1]), dp[i-2] + abs(a[i] - a[i-2]));
    }
    printf("%d\n", dp[n]);
    return 0;
}

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

const int s=1001;

using namespace std;

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

	int q;
	static unsigned int dp[s][s] = {0};
	
	dp[0][0] = 0; dp[0][1] = 0; dp[1][0] = 0;

	cin >> q;
	for(int k=0; k < q; k++){
		string X,Y;
		cin >> X >> Y;
		int i,j;
		for(i=0;i<X.size();i++){
			for(j=0;j<Y.size();j++){
				if(X[i] == Y[j]) dp[i+1][j+1] = dp[i][j] + 1;
				else dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
			}
		}
		cout << dp[i][j] << "\n";
	}
	return 0;
}


Measured memory_bytes: 7020
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int n,m,x,a[150],cstl=0,cstr=0;
  std::cin >> n >> m >> x;
  for(int i=0; i<n; i++) a[i]=0;
  for(int i=0; i<m; i++){
    int k;
    std::cin >> k;
    a[k]=k;
  }

  for(int i=x; i<n; i++){
    if(a[i]>0) cstr++;
  }
  for(int i=x; i>0; i--){
    if(a[i]>0) cstl++;
  }
  std::cout << min(cstr,cstl) << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x;
  cin >> n;
  x = n/1000;
  if(n%1000==0){
    cout << 0 << endl;
  }else{
    cout << 1000*(x+1)-n << endl;
  }
}
  
  


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

int main() {
    int a, l, r;
    int count = 0;
    int nin = 0;
    cin >> a;
    for(int i = 0; i < a; i++){
        cin >> l >> r;
        nin = r - l + 1;
        count += nin;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>

int arr[100005];
int val[100005];

int main()
{
	int n;
	std::cin >> n;
	for (int i = 0; i < n; ++i)
		std::cin >> arr[i];
	val[0] = 0;
	val[1] = std::abs(arr[1] - arr[0]);
	for (int i = 2; i < n; ++i)
		val[i] = std::min(std::abs(arr[i] - arr[i - 1]) + val[i - 1], std::abs(arr[i] - arr[i - 2]) + val[i - 2]);
	std::cout << val[n - 1] << '\n';
	return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;
    vector<pll> dic;
    REP(i, N){
    	ll A, B;
    	cin >> A >> B;
    	dic.push_back({B, A});
    }
    sort(dic.begin(), dic.end());
    bool flag = true;
    ll now = 0;
    //cout << dic << endl;
    REP(i, N){
    	now += dic[i].second;
    	if(dic[i].first < now) flag = false;
    }
    cout << (flag ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 6512
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

char judge( vector<string> surface )
{
	for ( unsigned int i = 0; i < surface.size(); i++ )
	{
		for ( unsigned int j = 0; j < surface[i].length(); j++ )
		{
			if ( surface[i][j] == '1' )
			{
				// A
				if ( surface[i][j+1] == '1' && surface[i+1][j] == '1' && surface[i+1][j+1] == '1' )
				{
					return 'A';
				}
				// B
				else if ( surface[i+1][j] == '1' &&surface[i+2][j] == '1' &&surface[i+3][j] == '1' )
				{
					return 'B';
				}
				// C
				else if ( surface[i][j+1] == '1' && surface[i][j+2] == '1' && surface[i][j+3] == '1' )
				{
					return 'C';
				}
				// D
				else if ( surface[i+1][j] == '1' && surface[i+1][j-1] == '1' && surface[i+2][j-1] == '1' )
				{
					return 'D';
				}
				// E
				else if ( surface[i][j+1] == '1' && surface[i+1][j+1] == '1' && surface[i+1][j+2] == '1' )
				{
					return 'E';
				}
				// F
				else if ( surface[i+1][j] == '1' && surface[i+1][j+1] == '1' && surface[i+2][j+1] == '1' )
				{
					return 'F';
				}
				// G
				else if ( surface[i][j+1] == '1' && surface[i+1][j-1] == '1' && surface[i+1][j] == '1' )
				{
					return 'G';
				}
				else
				{
					return '-';
				}
			}
		}
	}

	return '-';
}

int main()
{
	while ( true )
	{
		string buffer;
		vector<string> surface;

		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );

		for ( int i = 0; i < 8; i++ )
		{
			if ( cin >> buffer )
			{
				surface.push_back( "000" + buffer + "000" );
			}
			else
			{
				return 0;
			}
		}

		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );

		cout << judge( surface ) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define PI 3.14159265358979323846264338327950L

int res;

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

    int A,B;
    cin >> A>>B;
    cout << A*B << endl;
}

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

int main(){
	int n;
  	cin >> n;
  	vector<P> a(n);
  	rep(i, n){
      cin >> a[i].first;
      a[i].second = i + 1;
    }
      
  	sort(a.begin(), a.end());
  	rep(i, n){
    	cout << a[i].second << " ";
    }
}

Measured memory_bytes: 4044
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;

int64_t mod = 998244353 ;

vector<int> getprime(int n){
    vector<int> p(0) ;
    vector<bool> table(n+1,0) ;
    for (int i = 2; i <= n; i++)
    {
        if (table.at(i) == 0)
        {
            p.push_back(i) ;
            for (size_t j = 2; j < n/i ; j++)
            {
                table.at(i*j) = 1 ;
            }
            
        }
        
    }
    return p ;
}

int d(int64_t n){
    int re = 1 ;
    while (1)
    {
        n /= 10 ;
        if (n > 0)
        {
            re ++ ;
        }else
        {
            return re ;
        }
        
        
    }
    
}

int main(){
    int n,m ;
    cin >> n >> m ;
    vector<bool> path(n,0) ;
    path.at(0) = 1 ;
    vector<int> ball(n,1) ;
    int x,y ;
    for (int i = 0; i < m; i++)
    {
        cin >> x >> y ;
        if (path.at(x-1))
        {
            path.at(y-1) = 1 ;
        }
        ball.at(x-1) -- ;
        ball.at(y-1) ++ ;
        if (ball.at(x-1) == 0)
        {
            path.at(x-1) = 0 ;
        }
        
    }
    int ans = 0 ;
    for (int i = 0; i < n; i++)
    {
        ans += path.at(i) ;
    }
    cout << ans << endl ;
}

Measured memory_bytes: 3716
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int main() {
	double PI = 3.14159265358979, R; cin >> R;
	printf("%.12lf\n", 2.0 * R * PI);
	return 0;
}

Measured memory_bytes: 3756
N = int(input())
A = [0]*(N+2)
B = [0]*N

for i,x in enumerate(input().split()):
  A[i+1] = int(x)

s = 0
for i in range(N+1):
  s += abs(A[i+1] - A[i])

for i in range(N):
  B[i] = abs(A[i+1]-A[i]) + abs(A[i+2]-A[i+1]) - abs(A[i+2]-A[i])

for i in range(N):
  print(s-B[i])


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

int main(){
	int x;
	cin >> x;
	int d = sqrt(2 * x + 0.25) - 0.5;
	int r = (d + 2) * (d + 1) / 2 - x;
	if(x - d * (d + 1) / 2 == 0) cout << d << '\n';
	else cout << d + 1 << '\n';
}

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

signed main(){
    int N; cin>>N;
    vector<int> A(N),ans(N,0),out;
    for(int i=0;i<N;i++)cin>>A[i];
    for(int i=N-1;i>=0;i--){
        int tmp=i+1,sum=0;
        while(tmp-1<N){
            sum+=ans[tmp-1];
            tmp+=i+1;
        }
        sum%=2;
        ans[i]=(sum-A[i]==0 ? 0 : 1);
    }
    for(int i=0;i<N;i++){
        if(ans[i])out.push_back(i+1);
    }
    cout<<out.size()<<endl;
    for(int i=0;i<out.size();i++){
        cout<<out[i]<<' ';
    }
    cout<<endl;
    
}

Measured memory_bytes: 4980
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define int long long
#define D double
#define inf 123456789
#define mod 1000000007
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
#define rep(i, s, t) for(re int i = s; i <= t; ++ i)
#define drep(i, s, t) for(re int i = t; i >= s; -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define lb(x) (x)&(-(x))
#define ls k * 2
#define rs k * 2 + 1
#define maxn 200005
int n, m, q, dis[maxn], fa[maxn], cnt, ans;
struct edge {
	int u, v, w;
}e[maxn << 1];
il bool cmp(edge a, edge b) {
	return a.w < b.w;
}
il int find(int x) {
	while(x != fa[x]) x = fa[x] = fa[fa[x]];
	return x;
}
signed main() {
//	file(a);
	n = read(), q = read(), mem(dis, 63);
	rep(i, 1, n) fa[i] = i;
	while(q --) {
		e[++ cnt].u = read(), e[cnt].v = read(), e[cnt].w = read();
		dis[e[cnt].u] = min(dis[e[cnt].u], e[cnt].w + 1);
		dis[e[cnt].v] = min(dis[e[cnt].v], e[cnt].w + 2);
	}
	rep(i, 0, 2 * n - 1) dis[i % n] = min(dis[i % n], dis[(i - 1 + n) % n] + 2);
	rep(i, 0, n - 1) e[++ cnt].u = i, e[cnt].v = (i + 1) % n, e[cnt].w = dis[i];
	sort(e + 1, e + cnt + 1, cmp);
	rep(i, 1, cnt) {
		//cout << e[i].u << ' ' << e[i].v << ' ' << e[i].w << endl;
		int u = find(e[i].u), v = find(e[i].v);
		if(u == v) continue;
		fa[u] = v, ans += e[i].w;
	}
	printf("%lld", ans);
	return 0;
}


Measured memory_bytes: 12800
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

struct Tag {
    int pat, value, cost;
    Tag(int p, int v, int c) : pat(p), value(v), cost(c) {}
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    while(true) {
        int N, U;
        cin >> N >> U;
        if(!N && !U) break;

        vector<int> need_mask(N, 0);
        vector<int> value(N, 0);
        for(int i = 0; i < N; ++i) {
            int K;
            cin >> value[i] >> K;
            int mask = 0;
            while(K--) {
                int R;
                cin >> R;
                mask |= (1<<R);
            }
            need_mask[i] = mask;
        }
        int ans = N;
        vector<int> seen(1<<N, 0);
        queue<Tag> q;
        q.push(Tag(0, 0, 0));
        seen[0] = 1;
        while(!q.empty()) {
            Tag t = q.front();
            if(t.value >= U) {
                ans = t.cost;
                break;
            }
            q.pop();
            for(int i = 0; i < N; ++i) {
                if(!(t.pat & (1<<i)) && (t.pat & need_mask[i]) == need_mask[i]) {
                    int next_pat = t.pat | (1<<i);
                    if(!seen[next_pat]) {
                        seen[next_pat] = 1;
                        q.push(Tag(next_pat, t.value + value[i], t.cost + 1));
                    }
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main(void){

    int H;
    int W;

    while(1) {
        std::cin >> H >> W;
        if(H == 0 && W == 0) {
            break;
        }
        for(int i = 0; i < H; i++) {
            for(int j = 0; j < W; j++) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
        
    return 0;
    
}

Measured memory_bytes: 3080
#include <iostream>

int main() {
  int A, B;
  std::cin >> A >> B;
  const int want = B - 1;
  if (want % (A - 1) == 0) {
    std::cout << want / (A - 1) << std::endl;
  } else {
    std::cout << want / (A - 1) + 1 << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();

		int ans = t.length();
		for(int i = 0;i <= s.length() - t.length(); ++i){
			int diff = 0;
			for(int j = 0;j < t.length(); ++j){
				if(s.charAt(i+j) != t.charAt(j)) diff++;
			}
			ans = Math.min(diff, ans);
		}
		System.out.print(ans);

	}
}


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

template<class T> long long largest_rectangle (vector<T> a) {
    a.emplace_back(0);
    int n = a.size(); T ret = 0;
    stack<pair<T, int>> sta;
    for (int i = 0; i < n; i++) {
        if (sta.empty()) sta.emplace(a[i], i);
        else if (sta.top().first < a[i]) sta.emplace(a[i], i);
        else if (sta.top().first > a[i]) {
            int idx = i;
            while (!sta.empty()) {
                if (sta.top().first < a[i]) break;
                T h; int t; tie(h, t) = sta.top(); sta.pop();
                T s = h * (i - t); idx = t;
                if (ret < s) ret = s;
            }
            sta.emplace(a[i], idx);
        }
    }
    return ret;
}



int main() {
    int h, w, ans = 0;
    cin >> h >> w;
    vector<vector<int>> s(h, vector<int>(w));
    vector<vector<int>> d(h+1, vector<int>(w, 0));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> s[i][j];
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == 1) d[i+1][j] = 0;
            else d[i+1][j] = d[i][j] + 1;
        }
    }
    
    for (int i = 0; i <= h; i++) {
        int res = largest_rectangle(d[i]);
        if (ans < res) ans = res;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 18360
#include<stdio.h>
int main(void){
    long long int n,a,b,sum,div,mod;
    scanf("%lld %lld %lld",&n,&a,&b);
    sum = a + b;
    div = n / sum;
    mod = n % sum;
    if(mod >= a){
        printf("%lld",div*a + a);
    }
    else{
        printf("%lld",div*a + mod);
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <cmath>
#include<bits/stdc++.h>

using namespace std;
const long long INF = (long long) (1e18)+1;

int main() {
  int h;
  int w;
  cin >> h >> w;

  vector<string> t(h);

  for (int i=0; i < h; ++i) {
    cin >> t[i];
  }
  vector<vector<int>> dp(h, vector<int>(w));

  // dp[0][0] = 0;
  // cout << "here1" << endl;
  for (int i=0; i<h; ++i) {
    for(int j=0; j<w; ++j) {
      if (i==0 && j==0) { // very first cell.
        if (t[i][j] == '.') {
          dp[i][j] = 0;
        } else {
          dp[i][j] = 1;
        }
      } else if (i==0) { // first row except first cell
        if (t[i][j-1] == '.' && t[i][j] == '#') {
          dp[i][j] = dp[i][j-1] + 1;
        } else {
          dp[i][j] = dp[i][j-1];
        }
      } else { // from second row
        if (j==0) { // most left side. so only need to check vertically
          if (t[i-1][j] == '.' && t[i][j] == '#') {
            dp[i][j] = dp[i-1][j] + 1;
          } else {
            dp[i][j] = dp[i-1][j];
          }
        } else { // inside matrix
          if (t[i][j] == '.') {
            dp[i][j] = min(dp[i-1][j], dp[i][j-1]);
          } else {
            dp[i][j] = INT_MAX;
            if ( t[i-1][j] == '#' ) {//vertical
              dp[i][j] = min(dp[i][j], dp[i-1][j]);
            } else {
              dp[i][j] = min(dp[i][j], dp[i-1][j] + 1);
            }
            if ( t[i][j-1] == '#' ) { // row
              dp[i][j] = min(dp[i][j], dp[i][j-1]);
            } else {
              dp[i][j] = min(dp[i][j], dp[i][j-1] + 1);
            }
          }
          // if ( t[i-1][j] == '#' && t[i][j] == '#' ) {//vertical
          //   dp[i][j] = dp[i-1][j];
          // } else if ( t[i][j-1] == '#' && t[i][j] == '#' ){ // row
          //   dp[i][j] = dp[i][j-1]; 
          // } else { // .# pair vertically or horizontally
          //   dp[i][j] = min(dp[i-1][j] + 1, dp[i][j-1] + 1);
          // }
        }
      }   
    }
    // for(auto& n : dp[i]) {
    //   cout << n << " ";
    // }
    // cout << "" << endl;
  }
  cout << dp[h-1][w-1] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){
  string n;
  cin>>n;
  int a[4];
  for(int i = 0; i < 4; i++){
    a[i]=n[i]-'0';
  }
  bool flag = false;
  for(int i = 0; i < 2; i++){
    for(int j = 0; j < 2; j++){
      for(int k = 0; k < 2; k++){
        for(int l = 0; l < 2; l++){
          if(a[0]+a[1]+a[2]+a[3]==7){
            flag = true;
            
            break;
          }
          else{a[3]*=-1;}
        }
        if(flag) break;
        else a[2]*=-1;
      }
      if(flag) break;
      else a[1]*=-1;
    }
    if(flag) break;
    else a[0]*=-1;
  }
  for(int i = 0; i < 4; i++){
    if(a[i]<0){
      cout<<'-';
    }
    else if(i!=0){
      cout<<"+";
    }
    cout<<abs(a[i]);
  }
  cout<<"=7"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
 
typedef long long Int;
typedef vector<int> VI;
typedef pair<int, int> PII;
 
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000;
const Int LINF = INF * (Int) INF;
const int MAX = 107;
const int MOD = 998244353;


void print(VI A) {
    FOR(i,0,SZ(A)) {
        cout << A[i] << ' ';
    }
    cout << endl;
}

int main(int argc, char* argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // mt19937 rng(47);

    
    int n;
    cin >> n;
    string s;
    cin >> s;
    VI A(n);
    FOR(i,0,n)
        A[i] = s[i] - '1';

    bool c = true;
    FOR(i,0,n) {
        if (A[i] == 1)
            c = false;
    }
    if (c) {
        FOR(i,0,n)
            A[i] /= 2;
    }
    FOR(i,0,n)
        A[i] %= 2;

    n = SZ(A);
    int res = 0;
    FOR(i,0,n) {
        if (((n - 1) & i) == i)
            res ^= A[i];
    }
    if (c) res *= 2;
    cout << res << endl;

    
    cerr << 1.0 * clock() / CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 5404
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String c = sc.next();

		if(c.matches("[aeiou]")){
			System.out.println("vowel");
		}else{
			System.out.println("consonant");
		}
	}
}

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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] counts = new int[4];
        for(int i = 0; i < 3; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            counts[a-1] += 1;
            counts[b-1] += 1;
        }
        Arrays.sort(counts);
        if(counts[0] == 1 && counts[1] == 1 && counts[2] == 2 && counts[3] == 2) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 23764
//Never stop trying
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;

typedef pair<int,int> pi;
#define fi first
#define se second

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;

#define pb push_back
#define eb emplace_back
#define pf push_front

#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

const int MOD = 1e9+7; //998244353
const ll INF = 1e18;
const int nx[4]={0,0,1,-1}, ny[4]={1,-1,0,0}; //right left down up

void IO(){
#ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout); 
#endif 
}

int32_t main(){
   boost;
   IO();

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

   int l=1,r=1e9;
   int ans=INF;

   while(l<=r){
   	int m=(l+r)/2;

   	int x=0;
   	for(int i=0; i<N; i++){
   		x+=ceil((ld)a[i]/m)-1;
   	}

   	if(x<=K) ans=min(ans,m),r=m-1;
   	else l=m+1;

   }

	cout << ans << endl;
	

   return 0;
}



Measured memory_bytes: 5040
#include <bits/stdc++.h>
#define PREP(i, s, x) for(ll i = (s); i < (x); i++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i--)
#define REP(i, x) PREP(i, 0, x)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }

// variable -------------------------------------------

constexpr ll INF = (1ll << 59);
constexpr ll MOD = 998244353ll;

// structure ------------------------------------------

// function -------------------------------------------

// main -----------------------------------------------

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

    vector<P> lr(k);
    REP(i, k) {
        cin >> lr[i].first >> lr[i].second;
    }

    vector<ll> dp(n * 2 + 10, 0);
    vector<ll> kousin(n * 2 + 10, 0);

    dp[0] = 1;

    REP(i, n){
        dp[i] += kousin[i];
        dp[i] %= MOD;
        REP(j, k){
            kousin[i + lr[j].first] += dp[i];
            kousin[i + lr[j].first] %= MOD;
            kousin[i + lr[j].second + 1] -= dp[i];
            kousin[i + lr[j].second + 1] += MOD;
            kousin[i + lr[j].second + 1] %= MOD;
        }
        kousin[i+1] += kousin[i];
        kousin[i+1] %= MOD;
    }
    cout << dp[n-1] << endl;

    return 0;
}

Measured memory_bytes: 9592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

int n;
vector<int> edge[100010];
int par[100010];

int dfs(int x){
	int ret = 0;
	for(int y:edge[x]){
		if(par[x]==y) continue;
		par[y]=x;
		ret ^= (1+dfs(y));
	}
	return ret;
}

int main()
{
	read(n);
	for(int i=1; i<n; ++i){
		int a, b;
		read(a, b);
		edge[a].pb(b);
		edge[b].pb(a);
	}
	puts(dfs(1)?"Alice":"Bob");
	return 0;
}


Measured memory_bytes: 10752
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		BigInteger[] a = new BigInteger[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextBigInteger();
			if (a[i].compareTo(BigInteger.ZERO) == 0) {
				System.out.println(0);
				return;
			}
		}
		sc.close();

		BigInteger lim = BigInteger.valueOf(1000000000000000000L);
		BigInteger ans = BigInteger.ONE;
		for (int i = 0; i < n; i++) {
			ans = ans.multiply(a[i]);
			if (ans.compareTo(lim) > 0) {
				System.out.println(-1);
				return;
			}
		}
		System.out.println(ans.toString());
	}
}


Measured memory_bytes: 67472
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#else
#define VS_ENDPAUSE()
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
	func();
	VS_ENDPAUSE();
	return 0;
}


void func(void)
{
	int a,b,c;

	cin >> a >> b >> c;

	int ab = a+b;
	int ac = a+c;
	int bc = b+c;
	int minVal = min(ab, min(ac, bc));
	cout << minVal << endl;

	return;
}




Measured memory_bytes: 256
// abc.053.C - X: Yet Another Die Game

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

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

    ll cnt = ( x - x % 11 ) / 11;
    cnt *= 2;
    if( x % 11 != 0 ) {
        if( x % 11 <= 6 )
            cnt += 1;
        else
            cnt += 2;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
// B - Comparing Strings
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
int a,b;

string solve(){
	string s;
	if(a<b) rp(i,0,b) s += a+'0';
	else rp(i,0,a) s += b+'0';
	return s;
}

int main(){
	cin>>a>>b;
	cout<< solve() <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include<string>
using namespace std;
#define pb push_back
#define pf push_front

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

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define sz(x) int(x.size())
#define INF 1e5

int main(){
	int n;
	cin>>n;
	vi p(n);
	rep(i,n) cin>>p[i];
	int ans=0;
	for(int i=1;i<n-1;i++){
		if((p[i-1]<=p[i]&&p[i]<=p[i+1])|(p[i-1]>p[i]&&p[i]>p[i+1])) ans++;
	}
	cout<<ans<<endl;
}


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

int main(){
    int result = 700;
    char s[3];
    cin >> s;
    if(s[0] == 'o') result += 100;
    if(s[1] == 'o') result += 100;
    if(s[2] == 'o') result += 100;
    
    cout << result << endl;
    return 0; 
}

Measured memory_bytes: 256
N, K, Q = gets.split.map(&:to_i)
A = Q.times.map { gets.to_i }

diff = Array.new(N, 0)

A.each do |a|
  diff[a - 1] += 1
end

diff.each do |d|
  if Q - d >= K
    puts 'No'
  else
    puts 'Yes'
  end
end


Measured memory_bytes: 4148
import copy

s = str(input())
S = []
for x in s:
    S.append(x)

#+を入れるか入れないかで全探索する
#bit 0ならば+を入れない、1ならば入れる

tot = 0
#bitの生成
for i in range(1<<(len(S)-1)):
    #数字間に+を入れるか入れないか判定
    #入れない-> '', 入れる-> '+'
    Cal = []
    T = copy.deepcopy(S)
    for j in range(len(S)-1):
        if (i>>j)&1 == 1:
            Cal.append('+')
        else:
            Cal.append('')
    #上記までで、Cal=['', '+']などのリストが生成
    #''の場合は結合する
    eq = ''
    for k in range(len(S)-1):
        eq = eq + T[k]+Cal[k]
    eq = eq + T[-1]
    res = eval(eq)
    tot += res
print(tot)
        





Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>
#include <fstream>
#include <ctime>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)
        n = a;
    if (n > b)
        n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != 1 && i * i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};

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

    int N;
    cin >> N;
    vector<ll> A(N);
    cin >> A;

    ll ans = 0;
    REP(k, 60) {
        ll x = 0;
        REP(i, N)
        if (A[i] >> k & 1)
            x++;
        ll n = x * (N - x) % MOD;
        REP(i, k) {
            n *= 2;
            n %= MOD;
        }
        ans += n;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V, string sep = " ", string end_ = "endl") {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << sep;
    }
    if(end_ == "endl")
        cout << endl;
    else
        cout << end_;
}

template <class T = int> T in() {
    T x;
    cin >> x;
    return (x);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N = in(), K = in(), c = 0;
    rep(i, N) {
        int h = in();
        if(h >= K) c++;
    }
    cout << c << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int w,n,a[31],temp,i,x,y;
	for(i=0;i<31;i++){
		a[i]=i;
	}
	scanf("%d",&w);
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d,%d",&x,&y);
		temp=a[x];
		a[x]=a[y];
		a[y]=temp;
	}
	for(i=1;i<=w;i++){
		printf("%d",a[i]);
		if(i!=w) printf("\n");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
n,m,x,y = list(map(int,input().split()))
x_list = list(map(int,input().split()))
y_list = list(map(int,input().split()))

x_max = max(x_list)
y_min = min(y_list)

if x_max < y_min and x < x_max and y>= y_min:
    print("No War")
else:
    print("War")

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	vi p;
	for(int i=0;i<28;i++)
	{
		int k;
		cin >> k;
		p.pb(k);
	}
	sort(p.begin(),p.end());
	int q=0;
	int r=0;
	for(int i=0;i<30;i++)
	{
		if(p[i]!=i+1+q)
		{
			r++;
			cout << i+1+q << endl;
			q++;
		}
		if(r==2)break;
	}
	return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define fore(i,a,b) for(int i=a;i<b;++i)
#define sorte(a) sort(a.begin(), a.end())
#define si(a) scanf("%d",&a)
using namespace std;
typedef pair<int,int> pi;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int k;
	si(k);
	ll res = 0;
	fore(a,1,k+1)
	fore(b,1,k+1)
	fore(c,1,k+1)
	res+=__gcd(a,__gcd(b,c));
	printf("%lld\n",res);
	return 0;
}



Measured memory_bytes: 3812
import math
N = int(input())
S = int(N*(N+1)/2)
S -= 3*int(math.floor(N/3)*(math.floor(N/3)+1)/2)
S -= 5*int(math.floor(N/5)*(math.floor(N/5)+1)/2)
S += 15*int(math.floor(N/15)*(math.floor(N/15)+1)/2)
print(S)

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

typedef long long ll;

using namespace std;

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

int main(){
    string s;
    cin >> s;
    if(s[2]==s[3] && s[4]==s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

#define MAX 100001
#define ll long long

using namespace std;

int main()
{
	int n;
	cin>>n;
	int arr[n+1];
	int count[MAX];
	for(int i=0;i<MAX;i++)
		count[i] = 0;
	long sum=0;
	arr[0] = 0;
	for(int i=1;i<n+1;i++)
	{
		cin>>arr[i];
		sum+=arr[i];
		count[arr[i]]++;
	}	
	int q;
	cin>>q;
	while(q-->0)
	{
		int a,b;
		cin>>a>>b;
	
		long diff = b-a;
		sum = sum+(diff*count[a]);
		count[b] = count[a]+count[b];
		count[a] = 0;
			
		cout<<sum<<endl;
	}
	return 0;
}

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

int main() {
    int n , T;
    cin >> n >> T;
    vector<int> t(n);
    for (int i = 0; i < n; i++) {
        cin >> t.at(i);
    }

    long long ans = 0;
    for (int i = 0; i < n - 1; i++) {
        if (t.at(i + 1) - t.at(i) >= T) ans += T;
        else ans += t.at(i + 1) - t.at(i);
    }
    ans += T;
    cout << ans << endl;
}

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

int main(){
    string S;cin >>S;
    
    if(S[0]=='R'&&S[1]=='R'&&S[2]=='R') cout << 3 <<endl;
    if(S[0]=='S'&&S[1]=='S'&&S[2]=='S') cout << 0 <<endl;
    if(S[0]=='S'&&S[1]=='R'&&S[2]=='R') cout << 2 <<endl;
    if(S[0]=='R'&&S[1]=='S'&&S[2]=='R') cout << 1<<endl;
    if(S[0]=='R'&&S[1]=='R'&&S[2]=='S') cout << 2 <<endl;
    if(S[0]=='S'&&S[1]=='S'&&S[2]=='R') cout << 1 <<endl;
    if(S[0]=='S'&&S[1]=='R'&&S[2]=='S') cout << 1 <<endl;
    if(S[0]=='R'&&S[1]=='S'&&S[2]=='S') cout << 1 <<endl;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/09  Problem: ABC 121 B / Link: http://abc121.contest.atcoder.jp/tasks/abc121_b  ----- */


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

	LL N, M, C; cin >> N >> M >> C;
	vector<LL> b(M);
	for (int i = 0; i < M; ++i) {
		cin >> b[i];
	}
	vector<vector<LL>> a(N, vector<LL>(M));
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < M; ++j) {
			cin >> a[i][j];
		}
	}
	LL ans = 0LL;

	FOR(i, 0, N) {
		LL ret = C;
		FOR(j, 0, M) {
			ret += a[i][j] * b[j];
		}
		if (ret > 0)ans++;
	}




	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
X = int(input())
#S = str(input())
#A, B = map(int, input().split())
#C = list(map(int, input().split()))

L = [600, 800, 1000, 1200, 1400, 1600, 1800]
for i in range(7):
  if L[i] > X:
    print(8 - i)
    quit()
  

print(1)




Measured memory_bytes: 9156
n = int(input())

sob = [int(x) for x in input().split()]
pts = [int(p) for p in input().split()]
exex = [int(h) for h in input().split()]

maxi = 0
ex = 0
maxi = sum(pts)
for i in range(n):
	if i != 0:
		if sob[i] - sob[i-1] == 1:
			maxi += exex[sob[i-1]-1]
print(maxi)


Measured memory_bytes: 38384
# A: red, B: green, C: blue
# A < B < C

A, B, C = [ int(v) for v in input().split(" ") ]
K = int(input())

# A < B
for i in range(K):
  if A >= B:
    B *= 2
    K -= 1
  else:
    break

for i in range(K):
  if B >= C:
    C *= 2
    K -= 1
  else:
    break

if A < B and B < C:
  print("Yes")
else:
  print("No")

#print(A,B,C)
#print(K)

Measured memory_bytes: 9184
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = LIST()
for i in range(n):
    a[i] -= i + 1
a.sort()
b = a[n//2]
ans = 0
for x in a:
    ans += abs(x - b)
print(ans)

Measured memory_bytes: 32604
#include<stdio.h>
#include <string.h>
char O[510], E[500], a[1010], c;
int main()
{
    int i, j;
    scanf("%s%s", O, E);
    j = 0;
    int lo=strlen(O);
    int le=strlen(E);
    for(i = 0; i<lo; i++)
    {
        a[j] = O[i];
        j += 2;
    }
    j = 1;
    for(i = 0; i<le; i++)
    {
        a[j] = E[i];
        j += 2;
    }
    //a[j] = '\0';
    printf("%s", a);
}

Measured memory_bytes: 128
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;
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; }

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
typedef long double ldouble;

typedef vector<llong> vecllong;
typedef vector<vecllong> vvecllong;

const llong MOD = 1e9 + 7;
const llong INF = 1e17;

#define FOR(i, n) for (llong i = 0; i < n; i++)
#define FORS(i, a, b) for (llong i = a; i < b; i++)
#define FORR(i, n) for (llong i = n; i > 0; i++)

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

    llong N;
    cin >> N;

    vecllong P(N, 0);
    FOR(i, N) {
        llong p;
        cin >> p;
        p--;
        P[i] = p;
    }

    llong count = 0;

    if(P[0] == 0) {
        count++;
        swap(P[0], P[1]);
    }

    llong now = 1;
    while(now < N) {
        if(P[now] == now) {
            count++;
            if(now < N - 1 && P[now + 1] == now + 1) {
                swap(P[now], P[now + 1]);
                now += 2;
                continue;
            }
            swap(P[now], P[now - 1]);
            now++;
            continue;
        }
        now++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

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


		int sum = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			sum += a[i];
		}


		int avg = (int) Math.round((double)sum / n);
		/*int closest = -1;
		int closestIndex = -1;
		int dif = sum;
		for (int i = 0; i < n; i++) {
			int curDif = Math.abs(avg - a[i]);
			if (curDif < dif) {
				closest = a[i];
				closestIndex = i;
				dif = curDif;
			}
		}
		*/


		int ans = 0;
		for (int i = 0; i < n; i++) {
			ans += Math.pow(a[i] - avg, 2);
		}

		System.out.println(ans);
	}
}

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

int H[100001];
int main(void) {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> H[i];
	H[N] = 1000000001;

	int ans = 0;
	int combo = 0;
	for (int i = 0; i < N; i++) {
		if (H[i] >= H[i+1]) {
			combo++;
		} else {
			ans = max(ans, combo);
			combo = 0;
		}
	}
	ans = max(ans, combo);

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


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, M = 1e2 + 9, oo = 0x3f3f3f3f;
int n, arr[N], k;
int mem[N];
int solve(int i){
   if(i <= 0)
   {
      return 0;
   }
   else if(mem[i] != oo)
   {
      return mem[i];
   }
   for(int m = 1; m <= k; m++)
   {
      if(i - m >= 0)
      {
         mem[i] = min(mem[i], abs(arr[i]-arr[i - m]) + solve(i - m));
      }
      else{
         break;
      }
      //cout<<mem[i]<<endl;
   }
   return mem[i];
}
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   memset(mem, oo, sizeof mem);
   cin>> n >> k;
   for(int i = 0; i < n; i++){
      cin>>arr[i];
   }
   //mem[0] = 0;
   //mem[1] = abs(mem[0] - mem[1]);
   cout<<solve(n-1)<<endl;
   return 0;
}

Measured memory_bytes: 5760
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
vector<char> Q;
int main()
{
	char s[200005];
	scanf("%s",s);//字符串
	int len=strlen(s);
	//printf("%d\n",len);
	for(int i=0;i<len;i++){
		if(!Q.empty()&&s[i]=='T'&&Q.back()=='S'){
			//把S拿出来
			Q.pop_back();
		}
		else
			Q.push_back(s[i]);//入数组
	}
	int cnt=0;
	while(!Q.empty()){
		Q.pop_back();
		cnt++;
	}
	printf("%d\n",cnt);
}

Measured memory_bytes: 896
#include <iostream>

using namespace std;

void swap(int *a,int *b){
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

int main(){

	int data[10001];

	int n,k,m;

	while(cin>>n>>k>>m){
		if(n==0 && k==0 && m==0)break;


		for(int i=0;i<=10000;i++){
			data[i]=i+1;
		}

		data[m-1]=-1;
		long long int pos = m-1;

		for(int i=m-1;i<n;i++){
			swap(&data[i],&data[i+1]);
	//	}
	//	for(int i=0;i<n;i++){
	//		cout<<data[i]<<" ";
		}
	//	cout<<endl;

		n--;

		while(n>1){
			pos--;
			pos+=k;
		//	cout<<"pos%n="<<pos<<endl;
			data[pos%n]=-1;

			for(int i=pos%n;i<n;i++){
				swap(&data[i],&data[i+1]);
			}
			pos%=n;
			n--;
		//	for(int i=0;i<n;i++){
		//		cout<<data[i]<<" ";
		//	}
		//	cout<<endl;
		}
		cout<<data[0]<<endl;
	}

	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=100005,mod=1e9+7;
LL read(){
	LL x=0;
	char ch=getchar();
	while (!isdigit(ch))
		ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x;
}
int n;
LL A,B,s[N];
int dpA[N],sumA[N],hA;
int dpB[N],sumB[N],hB;
int del(int x,int y){return x-y<0?x-y+mod:x-y;}
int add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
void Del(int &x,int y){if ((x-=y)<0)x+=mod;}
void Add(int &x,int y){if ((x+=y)>=mod)x-=mod;}
int main(){
	n=read(),A=read(),B=read();
	for (int i=1;i<=n;i++)
		s[i]=read();
	s[0]=-1.5e18;
	dpA[1]=dpB[1]=sumA[1]=sumB[1]=hA=hB=1;
	for (int i=2;i<=n;i++){
		if (s[i]-s[hB-1]<A)
			dpA[i]=0;
		else {
			int k=upper_bound(s+hB-1,s+i-1,s[i]-A)-s;
//			printf("%d : kA = %d\n",i,k);
			dpA[i]=del(sumB[k],sumB[hB-1]);
		}
		if (s[i]-s[hA-1]<B)
			dpB[i]=0;
		else {
			int k=upper_bound(s+hA-1,s+i-1,s[i]-B)-s;
//			printf("%d : kB = %d\n",i,k);
			dpB[i]=del(sumA[k],sumA[hA-1]);
		}
		sumA[i]=add(sumA[i-1],dpA[i]);
		sumB[i]=add(sumB[i-1],dpB[i]);
		if (s[i]-s[i-1]<A)
			hA=i;
		if (s[i]-s[i-1]<B)
			hB=i;
	}
//	for (int i=1;i<=n;i++)
//		printf("%11d %11d\n",dpA[i],dpB[i]);
	printf("%d",add(del(sumA[n],sumA[hA-1])
				   ,del(sumB[n],sumB[hB-1])));
	return 0;
}

Measured memory_bytes: 2560