akhauriyash/Code-Regression huggingface dataset:
//om namah shivaay
//faith over fear
//no one wants to die,yet death is the destination we all share 

#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll a[1000002];
int main(){
   ll n,m,s=0;
   cin>>n>>m;
    forn(i,m) {
        cin>>a[i];
        s+=a[i];
    }
    if(s>n) cout<<"-1";
    else cout<<(n-s);
}

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

int main() {
    string str;
    long k, ans = 1;
    cin >> str >> k;
    rep(i, min(k, (long)(str.length()))) if(str.at(i) != '1') {
        ans = str.at(i) - '0';
        break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cstdio>
#include <climits>
#include <cmath>
#include <array>
#include <functional>
#include <sstream>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;
struct Point
{
  double x,y;
  Point(){x=0;y=0;}
  Point(double d_x,double d_y){x=d_x,y=d_y;}
  double operator*(Point obj){return obj.x*x+obj.y*y;}
  double operator%(Point obj){return obj.y*x-obj.x*y;}
  Point operator*(double b){Point tmp;tmp.x=x*b;tmp.y=y*b;return tmp;}
  Point operator/(double b){Point tmp;tmp.x=x/b;tmp.y=y/b;return tmp;}
  Point operator+(Point obj){Point tmp;tmp.x=x+obj.x;tmp.y=y+obj.y;return tmp;}
  Point operator-(){Point tmp;tmp.x=-x;tmp.y=-y;return tmp;}
  Point operator-(Point obj){Point tmp;tmp.x=x-obj.x;tmp.y=y-obj.y;return tmp;}
  Point operator-=(Point obj){x-=obj.x;y-=obj.y;return *this;}
  Point operator+=(Point obj){x+=obj.x;y+=obj.y;return *this;}
  Point operator/=(double b){x=x/b;y=y/b;return *this;}
  Point operator*=(double b){x=x*b;y=y*b;return *this;}
  double size(){return hypot(x,y);}
  Point unit(){return Point(x/size(),y/size());}
  Point normal(){return Point(y,-x);}
  double atan(){return atan2(y,x);}
};

bool operator<(Point a,Point b){return a.x!=b.x?a.x<b.x:a.y<b.y;}
bool operator>(Point a,Point b){return b<a;}
bool operator<=(Point a,Point b){return !(b<a);}
bool operator>=(Point a,Point b){return !(a<b);}
bool operator==(Point a,Point b){return (a-b).size()<eps;}
bool operator!=(Point a,Point b){return !(a==b);}

bool equal(double a,double b){return abs(a-b)<eps;}
double cross(Point a,Point b){return a%b;}
double dot(Point a,Point b){return a*b;}

int ccw(Point a,Point b,Point c)
{
  b=b-a;
  c=c-a;
  if(b%c>0) return +1;
  else if(b%c<0)return -1;
  else if(b*c<0) return +2;
  else if(b.size()<c.size()) return -2;
  else return 0;
}

int w,h;
vector<string> board;
vector<vector<string> > memo;
int dx[]={1,0};
int dy[]={0,1};

inline bool outrange(int x,int y)
{
  return (x<0 || x>=w || y<0 || y>=h);
}

string cmp(string a,string b)
{
  if(a.size()>b.size()) return a;
  if(b.size()>a.size()) return b;
  return max(a,b);
}

string dfs(int x,int y)
{
  if(outrange(x,y)) return "";
  if(!isdigit(board[y][x])) return "";
  if(memo[y][x]!="") return memo[y][x];
  
  string res="";
  for(int d=0;d<2;d++)
    {
      res=cmp(res,board[y][x]+dfs(x+dx[d],y+dy[d]));
    }
  memo[y][x]=res;
  return res;
}

int main(int argc,char const* argv[])
{
  while(1)
    {
      cin >> w >> h;
      if(!w) break;
      board=vector<string>(h,"");
      memo.assign(h,vector<string>(w,""));
      for(int i=0;i<h;i++)
	{
	  cin >> board[i];
	}
      string ans="";
      for(int y=0;y<h;y++)
	{
	  for(int x=0;x<w;x++)
	    {
	      if(board[y][x]=='0' || !isdigit(board[y][x])) continue;
	      ans=cmp(ans,dfs(x,y));
	    }
	}
      cout << ans << endl;
    }
  return 0;
}



Measured memory_bytes: 3312
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long ll;
vector<ll> fac(1000001);
vector<ll> ifac(1000001);
const ll M = pow(10,9)+7;

ll mpow(ll x, ll n){ 
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ 
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}

int main(){
  ll X,Y;
  cin >> X >> Y;
  ll ans=0;
  ll a,b;
  fac[0] = 1;
  ifac[0] = 1;
  a = (2*Y-X)/3;
  b = (2*X-Y)/3;
  for(ll i = 0; i<a+b; i++){
    fac[i+1] = fac[i]*(i+1) % M;
    ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M;
  }
  if((X+Y)%3!=0) ans=0;
  else{  
    //cout << a+b << " " << b << endl;
    if(a>=0 && b>=0) ans = comb(a+b,a)% M;
  }
  cout << ans << endl;
}


Measured memory_bytes: 18240
import java.util.*;
import java.awt.geom.*;
public class Main {
	//1100 cording
	
	int [] vx = {0,  1,1,0,-1,-1};
	int [] vy = {-1,-1,0,1, 1, 0};
	
	class P{
		int x,y;

		public P(int x, int y) {
			this.x = x;
			this.y = y;
		}
		
	}

	private void doit(){
		Scanner sc = new Scanner(System.in);
		int dataset = Integer.parseInt(sc.nextLine());
		while(dataset-- > 0){
			ArrayList<Integer> a = init(sc.nextLine());
			ArrayList<Integer> b = init(sc.nextLine());
			sc.nextLine();
			
			if(a.size() != b.size()){
				System.out.println(false);
				continue;
			}
			HashSet<P> recordA = step(a);
			boolean flg = false;
			for(int i = 0 ; i < 6; i++){
				//System.out.println(b);
				for(int j = 0 ; j < b.size(); j++){
					int now = (b.get(j) + 1) % 6;
					b.set(j, now);
				}
				//System.out.println(b);
				//System.out.println("--");
				
				HashSet<P> recordB = step(b);
				
				boolean res = compare(recordA, recordB);
				if(res){
					flg = true;
					break;
				}
			}
			System.out.println(flg);
		}
	}

	private boolean compare(HashSet<P> a, HashSet<P> b) {
		int INF = 1 << 24;
		int minxA = INF, minyA = INF, minxB = INF , minyB = INF;
		for(P v: a){
			if(v.x < minxA){
				minxA = v.x;
				minyA = v.y;
			}
			else if(v.x == minxA && v.y < minyA ){
				minyA = v.y;
			}
		}
		for(P v: b){
			if(v.x < minxB){
				minxB = v.x;
				minyB = v.y;
			}
			else if(v.x == minxB && v.y < minyB ){
				minyB = v.y;
			}
		}
		
		for(P va : a){
			boolean flg = false;
			for(P vb: b){
				if(va.x - minxA == vb.x - minxB && va.y - minyA == vb.y - minyB){
					flg = true;
					break;
				}
			}
			if(! flg) return false;
		}
		return true;
	}

	private HashSet<P> step(ArrayList<Integer> a) {
		int len = a.size();
		int x = 0, y = 0;
		HashSet<P> res = new HashSet<P>();
		res.add(new P(x, y));
		for(int i = 0 ; i < len; i++){
			x = x + vx[a.get(i)];
			y = y + vy[a.get(i)];
			res.add(new P(x, y));
			//System.out.println(x + ", " + y);
		}
		//System.out.println("---");
		return res;
	}

	private ArrayList<Integer> init(String next) {
		ArrayList<Integer> res = new ArrayList<Integer>();
		int len = next.length();
		for(int i = 0 ; i < len; i++){
			int now = next.charAt(i) - 'a';
			res.add(now);
		}
		return res;
	}

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

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

int main() {

	int n;
	int key[100];
	
	while(cin >> n, n) {
		for (int i = 0; i < n; i++) {
			cin >> key[i];
		}
		
		string str;
		cin >> str;
		
		for (int i = 0; i < str.size(); i++) {
			char c;
			if (str[i] >= 'A' && str[i] <= 'Z') {
				c = str[i] - 'A';
			} else {
				c = str[i] - 'A' - 6;
			}
			c -= key[i % n];
			if (c < 0) c += 52;
			
			if (c >= 0 && c <= 25) {
				cout << (char)(c + 'A');
			} else {
				cout << (char)(c + 'A' + 6);
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 1200
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
    int n, x, count = 0;
    while (true){
        cin >> n >> x;
        if(n == 0 && x == 0) break;
        for (int i = 1; i <= n; i++){
            for (int j = i + 1; j <= n; j++){
                for (int k = j + 1; k <= n; k++){
                    if (i == j || j == k || i == k) break;
                    if ((i + j + k) == x){
                        count += 1;
                        //cout << i << " " << j << " " << k << endl;
                    }
                }
            }
        }
        cout << count << endl;
        count = 0;
    }
}


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

using namespace std;
using namespace __gnu_cxx;

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

#define F          first
#define S          second
#define pnl        printf("\n")
#define sz(x)      (int)x.size()
#define sf(x)      scanf("%d",&x)
#define pf(x)      printf("%d\n",x)
#define all(x)     x.begin(),x.end()
#define rall(x)    x.rbegin(),x.rend()
#define rep(i, n)  for(int i = 0; i < n; ++i)

const db eps = 1e-9;
const db pi = acos(-1);
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000 * 1000 * 1000 + 7;

int n, w;
pair<int, int> arr[105];
ll dp[105][100005];

ll solve(int i, int cur) {
    if (cur > w) return -LL_INF;
    if (i == n) return 0;
    ll &ret = dp[i][cur];
    if (~ret) return ret;
    ret = max(solve(i + 1, cur), solve(i + 1, cur + arr[i].F) + arr[i].S);
    return ret;
}

int main() {
    scanf("%d%d", &n, &w);
    for (int i = 0; i < n; ++i)
        scanf("%d%d", &arr[i].F, &arr[i].S);
    memset(dp, -1, sizeof dp);
    cout << solve(0, 0) << endl;
    return 0;
}


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


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

    int cnt = 0;
    for (int i = 0; i < 1000; i++) {
        int c[3] = {i/100, (i/10)%10, i%10};
        int f = 0;
        for (int j = 0; j < n; j++) {
            if (s[j] == ('0' + c[f])) {
                f++;
            }
            if (f == 3) {
                break;
            }
        }
        if (f == 3) {
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 384
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    A = list(map(int, readline().rstrip().split()))
    cnt = {k: 0 for k in ['gray', 'brown', 'green', 'light_blue', 'blue', 'yellow', 'orange', 'red', 'free']}
    for a in A:
        if a < 400:
            cnt['gray'] += 1
        elif a < 800:
            cnt['brown'] += 1
        elif a < 1200:
            cnt['green'] += 1
        elif a < 1600:
            cnt['light_blue'] += 1
        elif a < 2000:
            cnt['blue'] += 1
        elif a < 2400:
            cnt['yellow'] += 1
        elif a < 2800:
            cnt['orange'] += 1
        elif a < 3200:
            cnt['red'] += 1
        else:
            cnt['free'] += 1

    mi = 0
    for k, v in zip(cnt.keys(), cnt.values()):
        if k == 'free':
            continue
        if v:
            mi += 1
    ma = mi + cnt['free']
    print(max(1, mi), ma)    


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <string>
 
using namespace std;
 
int main() {
 
    int N;
    cin >> N;
    string S;
    cin >> S;
 
    for(auto & s : S) {
        s += N;
        s %= 'Z' + 1;
        if(s < 'A') s += 'A';
    }
 
    cout << S << endl;
 
    return 0;
}

Measured memory_bytes: 256
N,A,B = map(int,input().split())
H =[]
for i in range(N):
  H.append(int(input()))
H.sort(reverse=True)
  
def judge(k):
  mas=k
  S=B*k
  for i in range(N):
    l = H[i]-S
    if l>0:
      mas-=l//(A-B)+min(1,l%(A-B))
    if mas<0:
      return False
  return True
  
def binary(max):
  l=0
  r=max
  while l<=r:
    m=(l+r)//2
    j = judge(m)
    if j==True:
      r=m-1
      ans=m
    else:
      l=m+1
  return ans
print(binary(H[0]//B+1))



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

int main()
{
    int n; cin >> n;
    vector<int> a(n);
    int ans = 0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(i%2==0){
            if(a[i]%2) ans++;
        }
    } 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3552
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        for (int i=0; i<n; i++) {
            int ai = sc.nextInt();
            if ((i+1)%2 == 0) {
                continue;
            }
            if (ai%2 != 0) {
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 27056
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;cin>>N>>M;
  vector<int> p(N+1,-1);
  bool ok=true;
  for(int i=0; i<M; i++){
    int s,c;cin>>s>>c;
    if(p[s]!=-1&&p[s]!=c)ok=false;
    p[s]=c;
    if(N!=1&&p[1]==0)ok=false;
  }
  if(N==1&&M==0){
    cout<<0<<endl;
  }else if(ok){
    if(N==1&&p[1]==0){
      cout<<0<<endl;
    //}else if(N==2&&p[1]==0){
    //  cout<<0<<endl; 
    }else{
      int ans=0;
      for(int i=1;i<=N;i++){
        if(p[i]==-1){
          p[i]=0;
          if(i==1)p[i]=1;
        }
        ans=ans*10+p[i];
      }
      cout<<ans<<endl;
    }
  }else{
    cout<<-1<<endl;
  }
}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a==b&&b==c){
    cout << "No" << endl;
    return 0;
  }
  if(a==b||b==c||c==a){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3480
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}

int main(){
    int a, b;
    cin >> a >> b;
    int tmp = 1; 
    int ans = 0;

    while(tmp<b){
        tmp += a-1;
        ans++;
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

const int N = 3e5 + 50;

string s, t, u;
int a, b;

int main()
{
#ifdef ONLINE_JUDGE
#else
    // freopen("r.txt", "r", stdin);
// freopen("w.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin >> s;
    for (int i = 0; i < s.length(); i++)
        putchar('x');
}

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

int main (void){

    int k,n;
    int sum = 0;

    scanf("%d", &k);
    scanf("%d", &n);

    for(int x = 0; x <= k; x++){
      for(int y = 0; y <= k; y++){
            
            if(0 <= n-x-y && n-x-y <= k)
              sum++;

      }
    }

    printf("%d", sum);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int N;
vector< pair<double, double> > points;

pair<int, double> calc_max(double s, double t) {
    double r_max = 0;
    int idx = -1;
    REP(i, N) {
        if(r_max < sqrt( pow(points[i].first - s, 2) + pow(points[i].second - t, 2) )) {
            r_max = sqrt( pow(points[i].first - s, 2) + pow(points[i].second - t, 2) );
            idx = i;
        }
    }
    return make_pair(idx, r_max);
}

int main() {
    cin >> N;
    points.resize(N);
    REP(i, N) {
        cin >> points[i].first >> points[i].second;
    }

    double s = 50.0, t = 50.0, lr;
    REP(itr_outer, 50000) {
        if(itr_outer < 1000)
            lr = 1.0 / sqrt(1.0 + itr_outer);
        else if(itr_outer < 5000)
            lr = 1.0 / pow(1 + itr_outer, 1);
        else
            lr = 1.0 / pow(1.1, sqrt(1 + itr_outer));
        pair<int, double> ret = calc_max(s, t);
        double gs = 2 * (s - points[ret.first].first);
        double gt = 2 * (t - points[ret.first].second);
        s -= lr * gs;
        t -= lr * gt;
    }
    double ans = calc_max(s, t).second;
    printf("%.12f\n", ans);

    return 0;
}

Measured memory_bytes: 4376
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	s=split(chomp(readline()),"")
	m = length(s)
	for i in 1:length(s)-1
		if s[i] != s[i+1]
			m = min(m,max(i,length(s)-i))
		end
		if m == 0
			m = length(s)
    	end
	end
	println(m)
end

main()


Measured memory_bytes: 126232
#include<bits/stdc++.h>
using namespace std;
#define reg register
typedef long long ll; //记得开 long long
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
static char buf[100000],*p1=buf,*p2=buf;
inline int read(void){
    reg char ch=getchar();
    reg int res=0;
    while(ch<'0'||'9'<ch)ch=getchar();
    while('0'<=ch&&ch<='9')res=10*res+ch-'0',ch=getchar();
    return res;
}

int n;
vector<ll> a,b,ta,tb;

int main(void){
    n=read();
    for(reg int i=1;i<=n;++i){ //读入 a
        static ll x;
        x=read();
        a.push_back(x);
    }
    for(reg int i=1;i<=n;++i){ //读入 b
        static ll x;
        x=read();
        b.push_back(x);
    }
    reg ll ans=0;
    for(reg int i=29;i>=0;--i){ //枚举每一位
        reg ll T=(1<<i),mod=(T<<1);
        for(reg int j=0;j<n;++j){
            a[j]&=mod-1;
            b[j]&=mod-1; //可以用 & 运算代替这里的取模（对 2 的幂次取模）
        }
        sort(b.begin(),b.end()); //排序
        reg int cnt=0;
        for(reg int j=0;j<n;++j){ //求区间长度
            cnt+=lower_bound(b.begin(),b.end(),T*2-a[j])-lower_bound(b.begin(),b.end(),T-a[j]);
            cnt+=lower_bound(b.begin(),b.end(),T*4-a[j])-lower_bound(b.begin(),b.end(),T*3-a[j]);
        }
        if(cnt&1) //最后求异或的贡献
            ans|=T;
    }
    printf("%lld\n",ans); //输出答案
    return 0;
}


Measured memory_bytes: 7928
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;

int main(){

	string S, T;

	cin >> S >> T;

	bool ok;
	for(int i = 0; i < S.size(); i++){
		ok = true;
		for(int j = 0; j<S.size(); j++){
			if(S[(i+j) % S.size()] != T[j]){
				ok = false;
				break;
			}
		}
		if(ok) break;
	}

	if(ok){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n,k; cin >> n >> k;
  if(k>(n-1)*(n-2)/2){
    cout << -1 << endl;
    return 0;
  }
  int cnt=n-1+(n-1)*(n-2)/2-k;
  int cntt=0;
  cout << cnt << endl;
  for(int i=1;i<=n;i++){
    for(int j=i+1;j<=n;j++){
      cout << i << " " << j << endl;
      cntt++;
      if(cntt==cnt) return 0;
    }
  }
}

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

int main(){
    int N; cin>>N;
    int h[N];
    rep(i, N) cin>>h[i];

    ll dp[N+1];
    dp[0] =0;
    dp[1] = abs(h[1]-h[0]);
    FOR(i, 2, N){
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    }

    cout << dp[N-1] << endl;
}


Measured memory_bytes: 4784
#include <cstdio>
typedef long long ll;

int main() {
    ll k;
    scanf("%lld", &k);


    ll quot = k / 50;
    ll rem  = k % 50;

    printf("50\n");
    for (int i = 0; i < 50; i++) {
        if (i) printf(" ");
        if (i < rem) {
            printf("%lld", (50 + quot - 1) + (50 - rem + 1));
        } else {
            printf("%lld", (50 + quot - 1) - rem);
        }
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 128
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,T,ans,nt;
int read(){
	static int x,f; static char ch; x=0,f=1;
	for (ch=getchar();!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0'; x*=f; return x;
}
int main(){
	n=read(),T=read();
	for (int i=1;i<=n;i++){
		int x=read();
		if (x>nt) ans+=x-nt;
		nt=x+T;
	}
	printf("%d\n",nt-ans);
	return 0;
}

Measured memory_bytes: 256
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=500+10;

int n,m;
char s[N][N],a[N][N],b[N][N];

int main() {
    n=read(),m=read();
    for (re int i=1;i<=n;++i) scanf("%s",s[i]+1);
    memcpy(a,s,sizeof(a)),memcpy(b,s,sizeof(b));
    for (re int i=1;i<=n;++i)
        for (re int j=2;j<m;++j)
            i&1?a[i][j]='#':b[i][j]='#';
    for (re int i=1;i<=m;++i) a[i][1]='#',b[i][m]='#';
    for (re int i=1;i<=n;++i) puts(a[i]+1);
    puts("");
    for (re int i=1;i<=n;++i) puts(b[i]+1);
    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

int N,M,Q;
vector<int> A,B,C,D;

int ans;

void dfs(vector<int> &v){
  int n=v.size();
  if(n==N){
    int res=0;
    for(int i=0;i<Q;i++){
      if(v[B[i]]-v[A[i]]==C[i]) res+=D[i];
    }
    chmax(ans,res);
    return;
  }
  int pre=1;
  if(n) pre=v.back();
  for(int i=pre;i<=M;i++){
    v.push_back(i);
    dfs(v);
    v.pop_back();
  }
}

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

  cin>>N>>M>>Q;
  A.resize(Q);
  B.resize(Q);
  C.resize(Q);
  D.resize(Q);
  rep(i,Q) cin>>A[i]>>B[i]>>C[i]>>D[i];

  rep(i,Q){
    A[i]--;B[i]--;
  }

  vector<int> v;
  dfs(v);

  cout<<ans<<endl;




  return 0;
}


Measured memory_bytes: 3656
function main()
  
  N = parse(Int,readline())
  
  check = [10^9 for i in 1:10^6]
  check[1] = 0
  
  for i in 1:N
    
    check[i+1] = min(check[i+1],check[i]+1)
    
    pow = 6
    while i + pow <= 10^6
      check[i+pow] = min(check[i]+1,check[i+pow])
      pow *= 6
    end
  
    pow = 9
    while i + pow <= 10^6
      check[i+pow] = min(check[i]+1,check[i+pow])
      pow *= 9
    end
    
  end
  
  println(check[N+1])
  
end

main()

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	
	ll lo = INF;
	ll sum = 0;
	F0R(i, N) {
		ll a, b; cin >> a >> b;
		if (a > b) lo = min(lo, b);
		sum += b;
	}

	if (lo == INF) {
		print(0);
	} else {
		print(sum - lo);
	}
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
    ll A,B; cin>>A>>B;
    ll n1 = (A-2)/2+1;
    ll n2 = (B-1)/2+1;
    if(n1%2==1)n1=1;
    else n1=0;
    if(n2%2==1)n2=1;
    else n2=0;
    if((A-1)%2==0)n1 ^= (A-1);
    if(B%2==0)n2 ^= B;

    if(A==0)n1=0;
    if(B==0)n2=0;
    ll res = n1^n2;
    cout<<res<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

long long int INF = 1000000000000000000LL; // 10^18
using namespace std;

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

int N;
P A[500001];

bool compare_y(P a, P b){
	return a.second < b.second;
}

long long int closest_pair(P *a, int n){
	if(n <= 1){
		return INF;
	}
	int m = n / 2;
	long long int x = a[m].first;
	long long int d = min(closest_pair(a, m), closest_pair(a + m, n - m));
	inplace_merge(a, a + m, a + n, compare_y);
	
	vector<P> b;
	for(int i = 0; i < n; i++){
		if(abs(a[i].first - x) >= d){
			continue;
		}
		for(int j = 0; j < b.size(); j++){
			long long int dx = a[i].first - b[b.size() - j - 1].first;
			long long int dy = a[i].second - b[b.size() - j - 1].second;
			if(dy >= d){
				break;
			}
			d = min(d, dx * dx + dy * dy);
		}
		b.push_back(a[i]);
	}
	return d;
}

int main(){
	
	cin >> N;
	
	for(int i = 0; i < N; i++){
		cin >> A[i].first >> A[i].second;
	}
	
	sort(A, A + N);
	
	cout << closest_pair(A, N) << endl;
	
	return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a * b % 2 != 0) {
    cout << "Odd" << endl;
  }  else {
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 3588
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
static const int MAX=1000000;
bool judge(int n){
  while(n%2==0) n/=2;
  if(n==1) return true;
  while(n%3==0) n/=3;
  if(n==1) return true;
  while(n%5==0) n/=5;
  if(n==1) return true;
  return false;
}
int main(void){
  bool isHamming[MAX];
  for(int i=1; i<=MAX; i++){
    isHamming[i] = judge(i);
  }
  int m,n;
  while(cin>>m){
    if(m==0) break;
    cin>>n;
    int count=0;
    for(int i=m; i<=n; i++){
      if(isHamming[i]){
        count++;
      }
    }
    cout<<count<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#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;
typedef long long ll;
typedef pair<ll, ll> P;
template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return 1;}return 0;}

constexpr ll INF = (1ll << 60);
constexpr ll MOD = 1000000007ll;


int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> d(k);
    vector<vector<ll>> a(k);
    REP(i, k){
        cin >> d[i];
        REP(j, d[i]){
            ll aaa;
            cin >> aaa;
            aaa--;
            a[i].push_back(aaa);
        }
    }

    // 持っていないならfalse
    vector<bool> is_haved(n, false);
    REP(i, k){
        for(auto val : a[i]){
            is_haved[val] = true;
        }
    }

    ll ans = 0;
    REP(i, n){
        if(is_haved[i] == false){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3704
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def input():
    return sys.stdin.readline()


def resolve():
    a = int(input().rstrip())
    b = int(input().rstrip())
    h = int(input().rstrip())

    s = (a+b)*h / 2

    print(int(s))


if __name__ == "__main__":
    resolve()



Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <queue>
#include <map>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <algorithm>
#include <limits.h>
#include <bits/stdc++.h>
#define fw(x) freopen("x.txt","w",stdout)
#define For(i,a,b,c) for(int i = a;i < b;i+=c)
#define REP(i,n) for(int i = 0;i < n;++i)
#define REP1(i,n) for(int i = 1; i<=n;i++)
#define mem(a,s) memset(a,s,sizeof a)
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
#define pf printf
#define sc scanf
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define vii vector<int>
#define vll vector<ll>
#define vss vector<string>
#define debug(x)  cout<<#x"="<<(x)<<endl
#define pb push_back


using namespace std;


// moves

//int dx[]= {0,0,1,-1};/*4 side move*/
//int dy[]= {-1,1,0,0};/*4 side move*/
//int dx[]= {1,1,0,-1,-1,-1,0,1};/*8 side move*/
//int dy[]= {0,1,1,1,0,-1,-1,-1};/*8 side move*/
//int dx[]={1,1,2,2,-1,-1,-2,-2};/*knight move*/
//int dy[]={2,-2,1,-1,2,-2,1,-1};/*knight move*/


//big_mod

//ll bigmod(ll a,ll b,ll m)
//{if(b == 0) return 1%m;ll x = bigmod(a,b/2,m);x = (x * x) % m;if(b % 2 == 1) x = (x * a)% m;return x;}
//ll BigMod(ll B,ll P,ll M){ ll R=1%M; while(P>0) {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;} /// (B^P)%M

//ll getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1ll;}
//ll setBit1(ll num, int idx) {return num or (1ll<<idx);}
//ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
//ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}

const int mod = 1000000007;
ll qpow(ll n,ll k)
{
    ll ans=1;
    assert(k>=0);
    n%=mod;
    while(k>0)
    {
        if(k&1)
            ans=(ans*n)%mod;
        n=(n*n)%mod;
        k>>=1;
    }
    return ans%mod;
}
int ar[100009];
int cost[100009];
void run(int i, int n, int k){
    if(i>=n) return;
    if(cost[i]== -1 ){
        REP1(j, k){
            if(i+j < n ){
                if(cost[i+j] == -1 ) run(i+j, n, k);
            }
            else break;
        }
    }
    int mn = INT_MAX;
    REP1(j, k){
        if(i+j <= n){
            int c1 = cost[i+j] + abs(ar[i]-ar[i+j]);
            if(mn>c1) mn=c1;
        }
        else break;
    }
    cost[i] = mn;
}
int main()
{
    fast;
    int n, k, v;
    cin>>n>>k;
    REP1(i, n){
        cin>>v;
        cost[i]= -1;
        ar[i] = v;
    }
    cost[n]=0;
    run(1, n, k);
    cout<<cost[1]<<'\n';
    return 0;
}


Measured memory_bytes: 8832
def checkLeapYear(y)
  return true if y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)
  return false
end

space = false
loop do
  v = $stdin.gets.split(" ").map(&:to_i)
  break if v[0] | v[1] == 0
  puts if space
  result = Array.new
  (v[0]..v[1]).each{|y| result << y if checkLeapYear(y) }
  if result.size == 0
    puts "NA"
  else
    result.each{|r| p r}
  end
  space = true
end

Measured memory_bytes: 6308
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <cassert>
#include <list>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <limits>
using namespace std;
typedef long long          ll;
typedef unsigned long long ull;
typedef long double        ld;
typedef pair<int,int>      pii;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;
typedef vector<long long>  vll;
#define left(x)		   (x << 1)
#define right(x) 	   (x << 1) + 1
#define mid(l, r) 	   ((l + r) >> 1)
#define mp                 make_pair
#define pb                 push_back
#define all(a)             a.begin(),a.end()
#define debug(x)	   {cerr <<#x<<" = " <<x<<"\n"; }
#define debug2(x, y)       {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<"\n";}
#define debug3(x, y, z)    {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<"\n";}
#define debug4(x, y, z, w) {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<", "<<#w << " = " <<w <<"\n";}
#define ss                 second
#define ff                 first
#define m0(x) 		   memset(x,0,sizeof(x))

template<typename T >T min_ ( T a , T b ) { return a > b ? b : a ; }
template < typename T ,  typename... Ts > T min_( T first , Ts... last ){ return  min_(first, min_(last...)); }
template<typename T >T max_ ( T a , T b ) { return a > b ? a : b ; }
template < typename T ,  typename... Ts > T max_( T first , Ts... last ){ return  max_(first, min_(last...)); }

template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<typename T> ostream& operator<< (ostream& out, const vector<T>& v) {
    out << "["; size_t last = v.size() - 1; for(size_t i = 0; i < v.size(); ++i) {
    out << v[i]; if (i != last) out << ", "; } out << "]"; return out;
}
const int mod = 1e9+7;

ll pwr(ll base, ll p){
ll ans = 1; while(p) { if(p&1) ans=(ans*base)%mod; base=(base*base)%mod; p/=2; } return ans;
}
ll gcd(ll a, ll b) {  return b == 0 ? a : gcd(b,a%b); }
ll lcm(ll a, ll b) {  return a*(b/gcd(a,b)); }

const long double PI = (long double)(3.1415926535897932384626433832795);
const ll  mx_ll   = numeric_limits<ll> :: max();
const int mx_int  = numeric_limits<int> :: max();

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ld r; cin >> r;
    cout << setprecision(6) << fixed << 2 * PI * r << endl;


    

    return 0;
}


Measured memory_bytes: 3808
#include <stdio.h>
    #include <string.h>
    int main(int argc, char *argv[])
    {   int n,p=1,i,j;
        char a[27];
    	scanf("%s",a);
    	n=strlen(a);
    	
		 for(i=0;i<n-1&&p;i++)
		   for(j=i+1;j<n&&p;j++)
		     if(a[i]==a[j])p=0;
        if(p)printf("yes");
        else printf("no");
    	return 0;
    }

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0), cin.tie(0) 
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 5;
const ll inf = ~0ull >> 1;
int main() {
    ll n, k;
    cin >> n >> k;
    int cnt = 0;
    while (n) {
        n /= k;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
int main() {
  int n,k;
  string s;
  cin >> n >> s >> k;
  char a=s[k-1];
  for(int i=0; i<n; i++) {
    if(s[i]!=a) {
      s[i]='*';
    }
  }
  cout << s << endl;
}


Measured memory_bytes: 256
D=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for i in range(D)]
T=[]
result=-(D*(D+1)//2)*sum(C)
last=[0 for i in range(26)]

#初期解の算出
for i in range(D):
    change=[S[i][j]+(i-last[j]+1)*(D-last[j])*C[j] for j in range(26)]
    score=max(change)
    t=change.index(score)
    T.append(t+1)
    print(t+1)
    last[t]=i+1
    result+=score

Measured memory_bytes: 9416
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A_Rotation
{
    class Program
    {
        static void Main(string[] args)
        {
            string strC1 = Console.ReadLine();
            string strC2 = Console.ReadLine();

            int intIdx = strC2.Length - 1;
            for (int i = 0; i < strC1.Length; i++) {
                if (strC1.Substring(i, 1) == strC2.Substring(intIdx,1)) {
                    intIdx--;
                    continue;
                } else {
                    Console.WriteLine("NO");
                    return;
                }

            }

            Console.WriteLine("YES");

        }
    }
}


Measured memory_bytes: 13140
// Confessions of a Dangerous Mind

/*
	"We know what we are, but know not what we may be."
*/

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 2e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 20, BL = 400;
const double EPS = 3e-16;

/*
	"You never know how strong you are until being strong is the only choice you have."
*/

int main(){
//  freopen(".in", "r", stdin);
//  freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

/*
	"With self-discipline most anything is possible."
*/
	
	long long n;cin >> n;

	cout << (n + 1) / 2;

	return 0;
}

/*
	"Reach for it. Push yourself as far as you can."
*/


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define NUM 1000000
int prime(int n){
	int i;
	if(n==1)
		return 0;
	for(i=2;i<=sqrt(n);i++){
		if(n%i==0)
			return 0;
	}
	return 1;
}

int main(void)
{
	int a,d,n,c,i;
	while(scanf("%d %d %d",&a,&d,&n)&&a+d+n){
		c=0;
		for(i=0;a+i*d<NUM;i++){
			if(prime(a+i*d))
				c++;
			if(c==n){
				printf("%d\n",a+i*d);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 600
N = int(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for i in range(0, N):
  val = input()
  if val == "AC":
      c0 += 1
  elif val == "WA":
      c1 += 1
  elif val == "TLE":
      c2 += 1
  else :
      c3 += 1

print("AC x ",c0)
print("WA x ",c1)
print("TLE x ",c2)
print("RE x ",c3)


Measured memory_bytes: 9188
// D - Sum of Large Numbers
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll sigma_n(ll s, ll e){
	s--;
	return e*(e+1)/2 - s*(s+1)/2;
}
ll sigma_n2(ll s, ll e){
	s--;
	return e*(e+1)*(2*e+1)/6 - s*(s+1)*(2*s+1)/6;
}

int main(){
	ll n, n2, c, ans, N, K, MOD = 1'000'000'007;
	cin>>N>>K;
	n = sigma_n(K, N+1);
	n2 = sigma_n2(K, N+1);
	c = N - K + 2;

	// cout<<"N "<<N<<" K "<<K<<"\n";//
	// cout<<"n "<<n<<" n2 "<<n2<<" c "<<c<<"\n";//

	ans = (N*n%MOD + n - n2 + c) % MOD;
	ans = (ans + MOD) % MOD;
	cout<< ans <<endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

lin n;
lin a[100001];
lin b[100001];
lin c[100001];

int main(void)
{
    cin >> n;
    rep(i,n)
    {
        cin >> a[i];
    }

    sort(a, a + n);

    rep(i, (n-1)/2)
    {
        b[i*2+1] = a[n-1-i];
        b[i*2+2] = a[i];
    }

    b[0] = a[(n-1)/2];
    if(n % 2 == 0)
        b[n-1] = a[(n-1)/2 + 1];

    lin res1 = 0;
    rep(i, n-1)
    {
        res1 += abs(b[i+1]-b[i]);
    }

    rep(i, (n-1)/2)
    {
        c[i*2+2] = a[n-1-i];
        c[i*2+1] = a[i];
    }

    c[0] = a[(n-1)/2];
    if(n % 2 == 0)
        c[n-1] = a[(n-1)/2 + 1];

    lin res2 = 0;
    rep(i, n-1)
    {
        res2 += abs(c[i+1]-c[i]);
    }

    lin res = max(res1, res2);

    cout << res << endl;

    return 0;
}


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

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

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
using V = vector<ll>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll hcnt[300005],wcnt[300005];

int main() {
  ll N,Q;
  string S;
  cin>>N>>S>>Q;
  vector<ll> cntD(N+1,0),cntM(N+1,0);
  rep(i,N){
    if(S[i]=='D') cntD[i+1]++;
    if(S[i]=='M') cntM[i+1]++;
  }
  rep(i,N) {
    cntD[i+1]+=cntD[i];
    cntM[i+1]+=cntM[i];
  }
  vector<ll> cntDM(N+1,0);
  rep(i,N){
    if(S[i]=='M') cntDM[i+1] += cntD[i+1];
  }
  rep(i,N) cntDM[i+1]+=cntDM[i];
  rep(i,Q){
    ll k;
    cin>>k;
    ll ans = 0;
    rep(i,N){
      if(S[i]=='C') {
        ll DM = cntDM[i]-cntDM[max(0LL,i-k+1)];
        DM -= cntD[max(0LL,i-k+1)]*(cntM[i]-cntM[max(0LL,i-k+1)]);
        ans += DM;
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 27704
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
#include<climits>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<map>

using namespace std;

typedef struct node{
	int val;
	struct node *link;
}node;
typedef pair<int,int> pi;
typedef pair<int,pi > pii;
typedef pair<pi,pi > pi2;
typedef vector<node> vn;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
typedef vector<pi2 > vpi2;
typedef long long ll;

#define sz(a) int((a).size()) 
#define pb push_back 
#define mp make_pair
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 

int main(){
	string s;
	cin>>s;
	int sum=0;
	if(s.length()==1){
		cout<<s[0];
		return 0;
	}
	if(s[0]=='1' && s[1]=='0'){
		sum+=(s[0]-'0')*10+(s[1]-'0');
	}
	else{
		sum+=(s[0]-'0')+(s[1]-'0');
	}
	for(int i=2;i<s.length();i++)
		sum+=s[i]-'0';
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair <int,int> PAIR;
const int N = 1e5+5;
const ll M = 11092019;

int main() {
	string s,t;
	cin >> s >> t;
	
	int n = s.size();
	int m = t.size();
	
	bool f = 1;
	for(int i = 0;i < n;++i){
		if(s[i] != t[i]) f = 0;
	}
	
	if(f && n == m-1) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>

int main(void){
	int a,b,c,temp,max;

	scanf("%d %d %d",&a,&b,&c);

	max = a;
	if(max < b){
		max = b;
	}
	if(max < c){
		max = c;
	}
	if(max == a){
		temp = a;
		a = c;
		c = temp;
	}else if(max == b){
		temp = b;
		b = c;
		c = temp;
	}

	if(a > b){
		temp = a;
		a = b;
		b = temp;
	}

	printf("%d %d %d\n",a,b,c);
	return 0;
}

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

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

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

  vector<vector<ll>> dp(s.size(), vector<ll>(t.size(), 0));

  dp.at(0).at(0) = 0;
  if (s.at(0) == t.at(0)) {
    dp.at(0).at(0) = 1;
  }

  for (long long i = 1; i < s.size(); i++) {
    if (dp.at(i).at(0) == 0 && s.at(i) == t.at(0)) {
      dp.at(i).at(0)++;
    } else {
      dp.at(i).at(0) = dp.at(i - 1).at(0);
    }
  }
  for (long long j = 1; j < t.size(); j++) {
    if (dp.at(0).at(j) == 0 && t.at(j) == s.at(0)) {
      dp.at(0).at(j)++;
    } else {
      dp.at(0).at(j) = dp.at(0).at(j - 1);
    }
  }

  for (long long i = 1; i < s.size(); i++) {
    for (long long j = 1; j < t.size(); j++) {
      if (s.at(i) == t.at(j)) {
        dp.at(i).at(j) = dp.at(i - 1).at(j - 1) + 1;
      } else {
        if (dp.at(i).at(j - 1) > dp.at(i - 1).at(j)) {
          dp.at(i).at(j) = dp.at(i).at(j - 1);
        } else {
          dp.at(i).at(j) = dp.at(i - 1).at(j);
        }
      }
    }
  }

  string ans = "";
  ll i = s.size() - 1, j = t.size() - 1;

  while (i > 0 && j > 0) {
    if (dp.at(i).at(j) == dp.at(i - 1).at(j)) {
      i--;
    } else if (dp.at(i).at(j) == dp.at(i).at(j - 1)) {
      j--;
    } else {
      ans = s.at(i) + ans;
      i--;
      j--;
    }
  }

  if (dp.at(i).at(j) != 0) {
    if (i == 0) {
      ans = s.at(0) + ans;
    } else {
      ans = t.at(0) + ans;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 73980
#include<cstdio>
#include<vector>
#include<cstring>
#include<queue>
#include<cassert>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

int m,a[6],s,g,n[330];
int d[330];
vector<int> G[330];

int main(){
  scanf("%d",&m);
  rep(i,6)scanf("%d",a+i);
  scanf("%d%d",&s,&g); s--; g--;
  rep(i,m)scanf("%d",n+i);

  rep(i,m)rep(j,6){
    int nxt = i+a[j];
    if(0<=nxt && nxt<m){
      nxt += n[nxt];
      G[nxt].push_back(i);
    }
    nxt = i-a[j];
    if(0<=nxt && nxt<m){
      nxt += n[nxt];
      G[nxt].push_back(i);
    }
  }
  
  memset(d,-1,sizeof(d));
  d[g] = 0;
  queue<int> q;
  q.push(g);

  while(q.size()){
    int cur = q.front(); q.pop();
    rep(i,G[cur].size()){
      int nxt = G[cur][i];
      if(d[nxt]<0){
	d[nxt] = d[cur]+1;
	q.push(nxt);
      }
    }
  }

  while(true){
    int dice;
    scanf("%d",&dice); dice--;
    
    int res = 0, pos = s, nxt = s + a[dice];
    if(0<=nxt && nxt<m){
      nxt += n[nxt];
      if(d[nxt]>=0 && d[pos]>d[nxt]){
	pos = nxt; res = 1;
      }
    } 
      
    nxt = s - a[dice];
    if(0<=nxt && nxt<m){
      nxt += n[nxt];
      if(d[nxt]>=0 && d[pos]>d[nxt]){
	pos = nxt; res = -1;
      } 
    }

    printf("%d\n",res); fflush(stdout);
    s = pos;
    if(s == g)return 0;
  }
}

Measured memory_bytes: 1308