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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

    // 入力
    int a, b, k;
    cin >> a >> b >> k;

    // 処理
    // 出力
    for (int i = a; i <= b; i++) {
        if (i - a < k || b - i < k) {
            cout << i << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    ll ans = 0;
    for(int i = 1; i <= N; i++){
       if(i % 3 != 0 && i % 5 != 0) 
       ans += i;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main() {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  if (((x - r) >= 0) && ((x + r) <= W) && ((y-r) >= 0) && ((y+r) <= H)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! { mut k: usize }

    let mut sevens: usize = 7;

    for i in 0..k {
        if sevens % k == 0 { 
            println!("{}", i+1);
            return;
        } else {
            let modulo = sevens % k;
            sevens = modulo * 10 + 7;
        }
    }

    println!("-1");
}

Measured memory_bytes: 2176
#include<bits/stdc++.h> 
#define ll                 long long                            
#define ra                 return a;                                          
#define pb                 push_back                                                     
#define sti                stack<ll>
#define spi                stack<pair<ll,ll>>
#define S                  second
#define msi                map<string,ll >
#define msi                map<string,ll >
#define mii                map<ll ,ll >
#define dbg(x)             { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y)          { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z)        { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define mis                map<ll , string>
#define rep(i,a,b)         for(ll  i=a;i<b;i++)
#define mpi                map<pair<ll ,ll >,ll >                                                
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define F                  first 
#define vi                 vector<ll >
#define vii                vector<pair<ll , ll >>
#define pqi                priority_queue<ll>
#define si                 set <ll>
#define vs                 vector<string>
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define hell               1000000007
#define bs                 binary_search
#define mp                 make_pair
#define qi                 queue<ll>
#define qs                 queue<string>
#define qpi                queue<pair<ll,ll>>
#define qps                queue<pair<ll,string>> 
#define inf                1e18L+1
#define endl               '\n' 
#define itr(a,it)          for(typeof(a.begin()) it=a.begin();it!=a.end();it++)// This will produce const_iterator for const object and normal iterator for non-const object
#define ss                 set<string>
using namespace std;
#define N  300005
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll tests=1;
//    cin>>tests;
    while(tests--)
{
    ll n;
    cin>>n;
    ll a[n-1];
    rep(i,0,n-1)
    cin>>a[i];
    ll ans=a[n-2];
    for(ll i=n-2;i>=1;i--)
    	{
    //		dbg(ans);
    		ans+=min(a[i],a[i-1]);
    	}
    ans+=a[0];
  //  dbg(ans);
    cout<<ans;
}
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n + 2), b(n + 1);
    rep(i, n + 1) cin >> a[i + 1];
    rep(i, n) cin >> b[i + 1];
    ll sum = 0;
    for (int i = 1; i <= n; i++)
    {
        if (b[i] - a[i] <= 0)
        {
            sum += b[i];
        }
        else if (b[i] - a[i] - a[i + 1] <= 0)
        {
            sum += b[i];
            a[i + 1] = a[i + 1] - (b[i] - a[i]);
        }
        else
        {
            sum += a[i] + a[i + 1];
            a[i + 1] = 0;
        }
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 1792
if __name__ == "__main__":
    N = int(input()[-1])
    if N == 2 or N == 4 or N == 5 or N == 7 or N == 9:
        print("hon")
    elif N == 0 or N == 1 or N == 6 or N == 8:
        print("pon")
    else:
        print("bon")

Measured memory_bytes: 9172
from collections import deque
 
N = int(input())
Ass = tuple(deque(map(int, input().split())) for _ in range(N))
 
Q = set(range(N))
ans = -1
while Q:
    ans += 1
    Q2 = Q.copy()
    Q.clear()
    for i in Q2:
        if Ass[i]:
            t = Ass[i][0] - 1
            if Ass[t][0] == i + 1:
                Q.add(i)
                Q.add(t)
    for i in Q:
        Ass[i].popleft()

if any(Ass):
    print(-1)
else:
    print(ans)

Measured memory_bytes: 71388
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    foreach(s;stdin.byLine())
    {
        auto m = s.split().map!(to!int);
        auto a=m[0], b=m[1], n=m[2];
        int t=0;
        foreach(_;0..n)
            a=a%b*10,t+=a/b;
        writeln(t);
    }
}

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

int N, x[50], y[50], p[50][50], q[50][50];

int solve(int i, int j){
    int num = 0;
    int dp = x[j] - x[i];
    int dq = y[j] - y[i];
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(dp == p[i][j] && dq == q[i][j])
                num++;
        }
    }
    return num;
}
 
int main(){
    cin >> N;
    for(int i=0;i<N;i++)
        cin >> x[i] >> y[i];
    
    int count = 0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            p[i][j] = x[j] - x[i];
            q[i][j] = y[j] - y[i];
        }
    }

    int num, ans = 0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(i != j){
                num = solve(i, j);
                if(ans < num)
                    ans = num;
            }
        }
    }
    
    cout << N - ans << endl;

}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

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

    ll n;
    cin >> n;
    vector<pair<ll, ll> > p;


    rep(i, n)
    {
        ll a, b;
        cin >> a >> b;
        p.pb(make_pair(a, b));
    }

    sort(all(p),[](pair<ll,ll>a,pair<ll,ll>b){return a.second < b.second;});

    ll ans = 0;
    rep(i, n)
    {
        ans += p[i].first;
        if (ans > p[i].second)
        {
            cout << "No\n";
            return 0;
        }
    }
    cout<<"Yes\n";


    return 0;
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;


int main() {

    int n, m;
    cin >> n >> m;

    if (n == m) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}



Measured memory_bytes: 764
integer N,X
integer location
integer ans
integer,allocatable,dimension(:)::L
read*,N,X
allocate(L(N+1))
L(1)=0
read*,L(2:N+1)

ans=0
location=0
do i=1,N+1
  location=location+L(i)
  if(location>X)exit
  ans=ans+1
end do

print"(i0)",ans

end

Measured memory_bytes: 384
/*
--- My CPP Template ---
@Handle: pruvi007 :)
@Name: Praveen Kumar :)
@Institution: IIIT Guwahati :)
*/

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

#define fast  ios_base::sync_with_stdio(false), cin.tie(NULL) , cout.tie(NULL)
#define ll long long int
#define ld long double
#define pb  push_back
#define mp  make_pair
#define mod 1000000007

ll power(ll x, ll n){
    if(n==0)
    return 1;
    
    if(n%2)
    return (x*power((x*x)%mod, (n-1)/2))%mod;
    else
    return power((x*x)%mod, n/2);
}

template<typename T>
class DSU{
    public:
      T parent [200005];
      T size [200005];
      void init(T x){
          parent[x] = x;
          size[x] = 1;
      }
      T root(T x){
          if(parent[x] == x)
          return x;
          return parent[x] = root(parent[x]);
      }
      void Union(T x, T y){
          x = root(x);
          y = root(y);
          if(x != y){
              if(size[x] < size[y])
              swap(x, y);
              parent[y] = x;
              size[x] += size[y];
          }
      }
};

template <typename T>
class Segment_Tree{
    public:
      ll tree[4*100005];
      ll a[100005];
      void build(ll node, ll s, ll e){
          if(s == e)
          tree[node] = a[s];
          else{
              ll mid = (s + e)/2;
              build(2*node, s, mid);
              build(2*node+1, mid+1, e);
              tree[node] = (tree[2*node] | tree[2*node+1]);
          }
      }
 
      void update(ll node, ll s, ll e, ll pos, ll val){
          if(s == e){
              tree[node] = val;
              a[pos] = val;
          }
          else{
              ll mid = (s + e)/2;
              if(pos <= mid)
              update(2*node, s, mid, pos, val);
              else
              update(2*node+1, mid+1, e, pos, val);
              tree[node] = (tree[2*node] | tree[2*node+1]);
          }
      }
 
      ll query(ll node, ll s, ll e, ll l, ll r){
          if(s >= l && e <= r)
          return tree[node];
          else if(e < l || s > r)
          return 0ll;
          else{
              ll mid = (s + e)/2;
              ll left = query(2*node, s, mid, l, r);
              ll right = query(2*node+1, mid+1, e, l, r);
              return (left | right);
          }
      }
};  

int main()
{
    fast;
    /////////////////////////////////////////////////////////////////////////
    ll n,a,b;
    cin >> n >> a >> b;
    ll d = abs(b-a);
    if(d%2==0)
        cout << d/2 << endl;
    
    else
    {
        ll A = min(a,b);
        ll B = max(a,b);
        ll left = a-1;
        ll right = n-b;
        ll ans;
        ll a1,a2,a3;
        a1 = min(B-1,n-A);
        a2 = (B - A -1 )/2+A;
        a3 = (n- (n-B+1+A))/2+n+1-B;
        cout << min( a1,min(a2,a3)) << endl;
        // if( A-1 < n-B)
        //     cout << B-1 << endl;
        // else 
        //     cout << n-A << endl;
        
    }
    


    ////////////////////////////////////////////////////////////////////////
    return 0;
}


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

const int L = 20, N = 201010;

int n, V, x[N], fa[L][N], siz[L][N], ans[N], lt[1 << L], rt[1 << L];
vector<int> v[N];

int Find(int k, int x) {
  return fa[k][x] == x ? x : fa[k][x] = Find(k, fa[k][x]);
}

void Merge(int k, int x, int y) {
  x = Find(k, x), y = Find(k, y);
  fa[k][y] = x;
  siz[k][x] += siz[k][y];
}

int main(void) {
  scanf("%d%d", &n, &V);
  for(int i = 1; i <= n; i++)
    scanf("%d", &x[i]);
  int now = V, m;
  for(int o = L - 1; ; now >>= 1, o = (o + 1) % L) {
    for(int i = 1; i <= n; i++)
      fa[o][i] = i, siz[o][i] = 1;
    for(int i = 1; i <= n; i++) {
      int j = i;
      while(j < n && x[j + 1] - x[j] <= now) j++;
      for(int k = i + 1; k <= j; k++)
	Merge(o, i, k);
      i = j;
    }
    if(now == 0) { m = o + 1; break; }
  }

  for(int i = 0; i < (1 << m); i++)
    rt[i] = n + 1;
  for(int i = 0; i < (1 << m); i++) {
    for(int j = 0; j < m; j++)
      if(~i >> j & 1) {
	lt[i | (1 << j)] = max(lt[i | (1 << j)], lt[i] + siz[j][lt[i] + 1]);
	rt[i | (1 << j)] = min(rt[i | (1 << j)], Find(j, rt[i] - 1));
      }
  }
  // cerr << lt[27]  <<" " << rt[4] << endl;

  int all = (1 << m) - 1; 
  for(int i = 0; i < (1 << m); i++) {
    v[lt[i]].push_back(rt[all ^ i]);
    //    cerr << lt[i] << " " << rt[all ^ i] << endl;
  }

  int mi = n + 2;
  for(int i = 0; i < v[n].size(); i++)
    mi = min(v[n][i], mi);
  
  for(int i = n; i >= 1; i--) {
    for(int j = 0; j < v[i - 1].size(); j++)
      mi = min(v[i - 1][j], mi);
    if(fa[L - 1][i] != i) continue;
    //cerr << i + siz[L - 1][i] << endl;
    ans[i] = mi <= i + siz[L - 1][i];
  }
  
  for(int i = 1; i <= n; i++)
    puts(ans[Find(L - 1, i)] ? "Possible" : "Impossible");
  return 0;
}


Measured memory_bytes: 45696
w,h = gets.split.map(&:to_i)
p = w.times.map{gets.to_i}.sort.push(1e10)
q = h.times.map{gets.to_i}.sort.push(1e10)
i = j = 0
ans = 0
while i < w || j < h
  if p[i] < q[j]
    ans += p[i]*(h+1-j)
    i += 1
  else
    ans += q[j]*(w+1-i)
    j += 1
  end
end
puts ans

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

int main(){
    int A[3][3];
    for ( int i = 0; i < 3; ++i ){
        for ( int j = 0; j < 3; ++j ){
            cin >> A[i][j];
        }
    }
    
    int N;
    cin >> N;
    int b[N];
    for ( int i = 0; i < N; ++i){
        cin >> b[i];
    }
    
    for ( int i = 0; i < 3; ++i ){
        for ( int j = 0; j < 3; ++j ){
            for ( int k = 0; k < N; ++k ){
                if ( A[i][j] == b[k] ){
                    A[i][j] = 1000;
                }
            }
        }
    }
    
    bool flag = false;
    
    for ( int i = 0; i < 3; ++i){
        if ( A[i][0] == 1000 and  A[i][1] == 1000 and  A[i][2] == 1000 ){
            flag = true;
        }
        if ( A[0][i] == 1000 and  A[1][i] == 1000 and  A[2][i] == 1000 ){
            flag = true;
        }
    }
    if ( A[0][0] == 1000 and A[1][1] == 1000 and A[2][2] == 1000 ){
        flag = true;
    }
    if ( A[2][0] == 1000 and A[1][1] == 1000 and A[0][2] == 1000 ){
        flag = true;
    }
    
    if ( flag ){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
#define rep(n) for( int i = 0 ; i < n ; i++ )
#define REP(n) for( int i = 1 ; i <= n ; i++ )
#define repll(n) for( ll i = 0 ; i < n ; i++ )
#define REPll(n) for( ll i = 1 ; i <= n ; i++ )
#define rep2(n) for( int j = 0 ; j < n ; j++ )
#define REP2(n) for( int j = 1 ; j <= n ; j++ )
#define repll2(n) for( ll j = 0 ; j < n ; j++ )
#define REPll2(n) for( ll j = 1 ; j <= n ; j++ )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n , m;
    cin >> n >> m;
	int c = 1;
    for( int i = 1 ; i * i <= m ; i++ ) {
    	if( m % i == 0 ) {
    		if ( m / i >= n ) c = max( c , i );
        	if ( i >= n ) c = max( c , m / i );
		}
    }
    cout << c; 
}


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

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

  if (n == 0) {
    cout << 0 << endl;
    return 0;
  }

  string s;
  while (n) {
    if (n % 2) {
      s += '1';
      --n;
    } else {
      s += '0';
    }
    n /= -2;
  }
  reverse(s.begin(), s.end());

  cout << s << endl;
}


Measured memory_bytes: 256
import kotlin.math.max

fun main() {
    val (n, k) = readLine()!!.split(" ").map { it.toInt() }
    val p = listOf(0) + readLine()!!.split(" ").map { it.toInt() }
    val c = listOf(0L) + readLine()!!.split(" ").map { it.toLong() }

    val maximum = c.drop(1).max()!!
    if (maximum < 0) {
        println(maximum)
        return
    }

    val isUsed = Array(n + 1) { false }
    var res = 0L

    for (i in 1 until n + 1) {
        if (isUsed[i]) continue
        var current = i
        val loop = mutableListOf(i)
        while (p[current] != i) {
            current = p[current]
            loop.add(current)
        }
        val loopSum = loop.fold(0L) { acc, el -> acc + c[el] }

        for (ia in 0 until loop.count()) {
            val a = loop[ia]
            isUsed[a] = true
            var distAB = 0
            var costAB = -c[a]
            for (ib in ia until ia + loop.count()) {
                val b = loop[ib % loop.count()]
                costAB += c[b]
                val maxCost = costAB + max(0, loopSum) * ((k - distAB) / loop.count())
                res = max(res, maxCost)
                distAB += 1
                if (distAB > k) {
                    break
                }
            }
        }
    }

    println(res)
}


Measured memory_bytes: 45292
#include <stdio.h>

int main(void)
{
	int a,b,c;
	int i;
	int j = 0;

	scanf("%d %d %d",&a,&b,&c);
	for (i = a; i <= b; i++)
	{
		if (c % i == 0)
		{
			j++;
		}
		
	}

	printf("%d\n", j );

	return 0;
}

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

int main(void){
	while( true ){
		int x, y;
		cin >> x >> y;
		if( x == 0 && y == 0 ) break;
		if( x < y ) cout << x << " " << y << endl;
		else cout << y << " " << x << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
// https://atcoder.jp/contests/abc097/tasks/abc097_b
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

// 二乗法によるべき乗
int ipow(int base, int exp) {
    int result = 1;
    while (exp) {
        if (exp & 1)
            result *= base;
        exp >>= 1;
        base *= base;
    }

    return result;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, maxv = 0;
    cin >> n;
    FOR(i, 1, sqrt(n) + 1) FOR(j, 1, sqrt(n) + 1) {
        int t = ipow(i, j);
        if (t > n)
            break;
        maxv = max(maxv, t);
    }
    cout << maxv << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int cntc=0;
        int cnt = 0;
        int num=0;;
        Boolean flag  = false;

        if(s.charAt(0)=='A'){
            for(int i = 2;i<s.length()-1;i++){
                if(s.charAt(i)=='C'){
                    cntc++;
                    num = i;
                }

            }
            if(cntc==1){
                for(int i =1;i<s.length();i++){
                    if(i!=(num) && s.charAt(i)<123 && s.charAt(i)>96){
                        cnt++;
                    }

                }

                if(cnt==s.length()-2){
                    flag = true;
                }
            }
        }

        if(flag){
            System.out.println("AC");
        }else{
            System.out.println("WA");
        }

    }
}


Measured memory_bytes: 23124
#include<stdio.h>

int kiriage( double x )
{
    return (int)( x < 0.0 ? x : x+0.9 );
}

int main(){
  int i,j,k,right,ans;
  int N,K;
  scanf("%d %d",&N,&K);
  int A[N];
  ans = (N-2)/(K-1)+1;
  printf("%d\n",ans);
  return 0;
}
  
  

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

int main(){
  int a;
  int e=0, f=0;
  for(int i=0;i<3;i++){
    cin >> a;
    if(a==5)e++;
    if(a==7)f++;
  }
  if(e==2&&f==1)cout << "YES";
  else cout << "NO";
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 3000050;
using namespace std;
typedef long long ll;
int main()
{
	 int x;
	 cin>>x;
	 x=x/200;
	 cout<<10-x<<endl;
	 return 0;
 } 

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

int main(){
    int N;
    cin >> N;
    long a[100001];
    long count=0;
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    sort(a,a+N);
    int n=0;
    long temp=0;
    long ans=0;
    while(1){
        if(temp==a[n]){
            count++;
        }
        if(temp!=a[n]){
            ans+=count%2;
            temp=a[n];
            count=1;
        }
        if(n==N-1){
            ans+=count%2;
            break;
        }
        n++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
n, k = map(int, input().split())
l = list(map(int, input().split()))

ans = float("inf")
for i in range(n-k+1):
    if i != 0:
        if l[i-1]>=0:
            continue
    if i != n-k:
        if l[i+k]<=0:
            continue

    if l[i]>=0:
        now = l[i+k-1]
    elif l[i+k-1]<=0:
        now = abs(l[i])
    else:
        now = min(abs(l[i])*2+l[i+k-1], abs(l[i])+l[i+k-1]*2)

    ans = min(ans, now)

print(ans)

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

int main(){
  int K,T;cin>>K>>T;
  int m=0;
  for(int i=0;i<T;i++){
    int a;cin>>a;
    m=max(a,m);
  }
  
  cout<<max(0,m-1+m-K);
}

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

using namespace std;

int main(){
  while(true){
    int n, m;
    int b = 0;
    int ans = 0;
    char t = 'i';
    char s[1000010] = {0};
  
    scanf("%d", &n);
    if(!n)
      break;
    scanf("%d%s", &m, s);
    n = 2 * n + 1;
    for(int i = 0; i < m; i++){
      if(s[i] == t){
        //cout << true << i << endl;
        b++;
        t = t == 'I' ? 'O' : 'I';
      }else{ 
        //cout << false << i << endl;
        if(b >= n){
          if(s[i - 1] == 'O')
            b--;
          ans += (b - (n - 2)) / 2;
          //cout << "nn" << b / 2 << endl;
        }
        if(s[i] == 'I'){
          b = 1;
          t = 'O';
        }else{
          b = 0;
          t = 'I';
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

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

using namespace std;

int main() {
	int N, X; cin>>N>>X;
	
	vector<int> D(N + 1);
	D[0] = 0;
	
	for(int i=0; i<N;i++) {
		int x; cin>>x;
		D[i+1] = D[i] +x;
	}
	int ans = 0;
	for(int i = 0; i <= N; ++i) {
		if(D[i] <= X) {
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,M=map(int,input().split())
    L,R=[0]*M,[0]*M
    for i in range(M):
        L[i],R[i]=map(int,input().split())
    print(max(0,min(R)-max(L)+1))

if __name__ == '__main__':
    main()


Measured memory_bytes: 43228
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<double> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

int main(){
    int N; scanf("%d",&N);
    vec t(N),v(N),sup(N);
    rep(i,N){
        scanf("%lf",&t[i]);
    }
    rep(i,N){
        scanf("%lf",&v[i]);
    }
    sup[N-1]=0.0;
    rep(i,N-1){
        sup[N-i-2]=min(v[N-i-2],min(sup[N-i-1]+t[N-i-1],v[N-i-1]));
    }
    double ans=0.0,V=0.0,T;
    rep(i,N){
        if(V+t[i]<sup[i]){
            ans+=t[i]*(t[i]+2.0*V)/2.0;
            V+=t[i];
        }
        else if(sup[i]==v[i]){
            T=v[i]-V;
            ans+=T*(V+v[i])/2.0+v[i]*(t[i]-T);
            V=v[i];
        }
        else{
            T=(t[i]+sup[i]-V)/2.0;
            if(V+T<v[i]){
                ans+=T*(T+2.0*V)/2.0+(t[i]-T)*(V+T+sup[i])/2.0;
                V=sup[i];
            }
            else{
                double T1=v[i]-V,T3=v[i]-sup[i],T2=t[i]-T1-T3;
                ans+=T1*(V+v[i])/2.0+T2*v[i]+T3*(v[i]+sup[i])/2.0;
                V=sup[i];
            }
        }
    }
    printf("%.10lf\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)


int main(){
  ll n;
  cin >> n;
  ll a[n],ans=-1,res=0;
  ll hu=0,sei=0;
  ll suma=0,sumb=0;
  ll sa[n],b[n];
  rep(i,n){
    cin >> a[i];
    suma+=a[i];
  }
  rep(i,n){
    cin >> b[i];
    sa[i]=a[i]-b[i];
    sumb+=b[i];
  }
//  cout << suma << " " << sumb <<endl;
  if(suma>=sumb){
    sort(sa,sa+n);

    rep(i,n){
      if(sa[i]>=0){
        res+=i;
        //cout << "負の直し" << i << endl;
        break;
      }
      hu+=sa[i];
    }

    hu=-hu;
    rep(i,n){
      sei+=sa[n-i-1];
      if(hu==0)break;
      if(sei>hu){
        res+=i+1;
        //cout << "正の直し" << i+1 << endl;
        break;
      }
    }
    ans=res;
  }

  cout << ans << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin>>A>>B;
  int ans=0;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      for(int h=0;h<10;h++){
        if(A<=10001*i+1010*j+100*h&&10001*i+1010*j+100*h<=B) ans++;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
<?php

fscanf(STDIN, '%d', $A);
fscanf(STDIN, '%d', $B);
fscanf(STDIN, '%d', $C);
fscanf(STDIN, '%d', $X);

$count = 0;
for ($i=0; $i <= $A; $i++) {
    for ($j=0; $j <= $B; $j++) {
        for ($k=0; $k <= $C; $k++) {
            // echo '500円' . $i . '枚' . ' ' . '100円' . $j . '枚' . '50円' . $k . '枚' . "\n";
            // echo 500 * $i + 100 * $j + 50 * $k . "\n";
            if (500 * $i + 100 * $j + 50 * $k === $X) {
                $count++;
            }
        }
    }
}

echo $count;

echo PHP_EOL;


Measured memory_bytes: 16144
n, m = input().split()
a = [False] * int(n)
b = [0] * int(n)
AC = 0
WA = 0
for i in range(int(m)):
    p, s = input().split()
    if(s == "AC" and a[int(p) - 1] == False):
        a[int(p) - 1] = True
        AC += 1
        WA += b[int(p) - 1]

    if(s == "WA" and a[int(p) - 1] == False):
        b[int(p)-1] += 1

print(AC, WA)


Measured memory_bytes: 4596
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
    int n,ans=0,ans2=0;
    cin>>n;
    vector<int> len(n),num(5001);
    rep(i,n)cin>>len[i];
    rep(i,n){
        rep(j,len[i]){
            num[j]++;
        }
    }
    int num1,num2,self;
    rep(i,n){
        rep(j,n){
            if(j>i){
                self=2;
                num1=num[len[i]+len[j]-1];
                num2=num[abs(len[i]-len[j])];
                if(min(len[i],len[j])<=abs(len[i]-len[j]))self=1;
                ans+=(num2-num1-self);
                if(ans%3==0){
                    ans2+=ans/3;
                    ans=0;
                }
                //cout<<num2<<" "<<num1<<endl; //kesu
            }
        }
    }
    
    ans/=3;
    cout<<ans+ans2;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
# N = N-1
ans = ''
D = {0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j',10:'k',11:'l',12:'m',13:'n',14:'o',15:'p',16:'q',17:'r',18:'s',19:'t',20:'u',21:'v',22:'w',23:'x',24:'y',25:'z'}
while True:
    N = N-1
    ans = ans+D[N%26]
    N = N//26
    if N == 0:
        break
    elif N <= 26:
        N = N-1
        ans += D[N%26]
        break
print(ans[::-1])

Measured memory_bytes: 61912
using System;

namespace ConsoleApplication15
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b,c,d;
           
                string[] s = Console.ReadLine().Split(' ');
                a = int.Parse(s[0]);
                b = int.Parse(s[1]);
                c = int.Parse(s[2]);
                d = 0;


                for (int x = a; x <= b; x++)
                {
                    if (c % x == 0)
                    {
                        d++;
                    }
                }

            Console.WriteLine(d);

                }


        }
    }

Measured memory_bytes: 9256
#ifndef _WIN32
#include<iostream>
#endif // !_WIN32

#include<string>
#include<iomanip>
#include<vector>
#include<string>
#include<stack>
#include<tuple>
#include<algorithm>
using namespace std;

#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;
const int SZ = 1 << 13;
int g[13][10][2][10];
LL dp[SZ][10];
int n;
void dfs(int bit, int val) {
	LL &ret = dp[bit][val];
	if (ret != -1)return;
	ret = 0;
	const int ed = 1 << (2 * n);
	if (bit&ed)ret++;
	REP(i, 10) {
		int nxtbit = 0;
		REP(j, 2 * n + 1) {
			if ((bit >> j) & 1) {
				if (g[j][val][0][i])nxtbit |= 1 << (j + 1);
				if (g[j][val][1][i])nxtbit |= 1 << (j + 2);
			}
		}
		if (nxtbit == 0)continue;
		dfs(nxtbit, i);
		ret += dp[nxtbit][i];
	}
}
int main() {
	while (cin >> n, n) {
		REP(i, SZ)REP(j, 10)dp[i][j] = -1;
		REP(i, 13)REP(j, 10)REP(k, 2)REP(l, 10)g[i][j][k][l] = 0;
		REP(i, n) {
			int x = i * 2;
			int y = x + 1;
			int z = x + 2;
			int lb, ub;
			cin >> lb >> ub;
			REP(j, 10) {
				if (lb <= j&&j <= ub) {
					REP(k, 10)g[x][k][1][j] = 1;
				}
			}
			FOR(j, 10, 100) {
				if (lb <= j&&j <= ub) {
					REP(k, 10)g[x][k][0][j / 10] = 1;
					g[y][j / 10][0][j % 10] = 1;
				}
			}
		}
		dfs(1, 0);
		cout << dp[1][0] << endl;
	}
	return 0;
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  set<string>s;
  for(int i=0;i<n;i++)
  {
    string t;
    cin>>t;
    s.insert(t);
  }
  cout<<s.size()<<endl;
  return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define sz(obj) ((int)(obj).size())
#define pf push_front
#define pb push_back

int main()
{
  int n, k, m;
  cin >> n;
  
  deque<int> card;
  REP(i, n * 2){
    card.pb(i + 1);
  }
  cin >> m;

  while (m--){
    deque<int> tmpa, tmpb;
    cin >> k;
    if (k == 0){
      REP(i, n){
        tmpa.pb(card.front());
        card.pop_front();
      }
      REP(i, n){
        tmpb.pb(card.front());
        card.pop_front();
      }
      REP(i, n * 2){
        if (i % 2 == 0){
          card.pb(tmpa.front());
          tmpa.pop_front();
        }
        else {
          card.pb(tmpb.front());
          tmpb.pop_front();
        }
      }
    }
    else {
      REP(i, k){
        tmpa.pb(card.front());
        card.pop_front();
      }
      FOR(i, k, n * 2){
        tmpb.pb(card.front());
        card.pop_front();
      }

      REP(i, n * 2 - k){
        card.pb(tmpb.front());
        tmpb.pop_front();
      }
      REP(i, k){
        card.pb(tmpa.front());
        tmpa.pop_front();
      }
    }
  }
  REP(i, n * 2){
    cout << card.front() << endl;
    card.pop_front();
  }
}

Measured memory_bytes: 1216
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()

count = 0

arr = [True] * n
for i in range(n):
    if i >= k:
        if t[i] == t[i-k]:
           if arr[i-k]:
               arr[i] = False
               
for i in range(n):
    if arr[i]:
        if t[i] == "r":
            count += p
        elif t[i] == "s":
            count += r
        else:
            count += s

print(count)

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

int C[3];

int main() {
    for (int i = 0; i < 3; i++)
    {
        C[i] = -1;
    }
    bool flag = true;
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int s, c;
        cin >> s >> c;
        s--;
        if (s == 0 && c == 0 && n != 1)
        {
            flag = false;
            break;
        }
        if (C[s] != -1 && C[s] != c)
        {
            flag = false;
            break;
        }
        else {
            C[s] = c;
        }
    }
    if (!flag) {
        cout << -1 << endl;
        return 0;
    }
    for (int i = 0; i < n; i++)
    {
        if (C[i] == -1)
        {
            C[i] = (i == 0 && n!=1) ? 1 : 0;
        }
    }

    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        sum += C[i] * pow(10, n - i - 1);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll; 
typedef pair<int, int> P; 
const int mod = 1e9 + 7;
const int N = 2e6 + 5;
int n;
ll C(ll x){
	ll num = n / x;
	return (x + num * x) * num / 2;
}
int  main()
{
	scanf("%d", &n);
	printf("%lld", 1ll * (1 + n) * n / 2 - C(3) - C(5) + C(15));
}

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

int main() {
	// your code goes here
	int n,k,i,a=1;
	cin >> n >> k;
	for(i=0;i<n;i++){
		if(a>=k) a+=k;
		else a*=2;
	}
	cout << a << endl;
	return 0;
}

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

int main() {
 long long N,M;
 cin >> N >> M;
 if(N == 1 && M>=2) cout << M-2 << endl;
 else if(M ==1 && N>=2) cout << N-2 << endl;
 else if(N == 1 && M == 1) cout << 1 << endl;
 else cout << N*M-((N-2)*2 + (M-2)*2 +4) << endl;
      
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//------------------------------------------------------------------//
typedef long long ll;
typedef vector<int> vi;
template <typename T> inline T read() {
	bool f = 1; T x = 0; char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = !f;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
	return f ? x : -x;
}
#define gi read<int>()
#define gl read<ll>()
//------------------------------------------------------------------//

int n;
int main() {
	cin >> n;
	map <string, int> mp;
	for (int i = 1; i <= n; ++i) {
		string s;
		cin >> s;
		++mp[s];
	}
	cout << "AC x " << mp["AC"] << '\n';
	cout << "WA x " << mp["WA"] << '\n';
	cout << "TLE x " << mp["TLE"] << '\n';
	cout << "RE x " << mp["RE"] << '\n';
 	return 0;
}


Measured memory_bytes: 3592
N,K,Q=map(int,input().split())

if Q-K>=0:
    lis=[0]*N
    lis_yn=['No']*N
    for _ in range(Q):
        q=int(input())
        lis[q-1]+=1
        if lis[q-1]>Q-K:
            lis_yn[q-1]='Yes'
    #print(lis)
else:
    lis_yn=['Yes']*N
print('\n'.join(lis_yn))


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

#define INF 1e9
using namespace std;

#define REPR(i, n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

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

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

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

typedef long long ll;

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


int main() {
    ll x,y;
    cin >> x >> y;

    ll cx,cy;
    ll score = 1e15;
    // 1 -> 0, 0
    cx = x;
    cy = y;

    if (cy>=cx) chmin(score,cy-cx);

    // 2 -> 1, 0
    cx = x * -1;
    cy = y;

    if (cy>=cx) chmin(score,cy-cx+1);


    // 1 -> 1, 1
    cx = x * -1;
    cy = y * -1;

    if (cy>=cx) chmin(score,cy-cx+2);

    // 1 -> 0, 1
    cx = x;
    cy = y * -1;

    if (cy>=cx) chmin(score,cy-cx+1);

    cout << score << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
int main() {
    int n;
    cin>>n;
    vector<int> a(n+1);
    for(int i=1; i<=n; i++) cin>>a[i];
    vector<int> b(n+1);
    for(int i=n; i>1; i--){
        int ii=i,cnt=0;
        for(int j=2; j<=n; j++){
            if(j*i>n) break;
            cnt+=b[j*i];
        }
        if(a[i]&&cnt%2==0) b[i]++;
        else if(!a[i]&&cnt%2) b[i]++;
    }
    int x=0;
    int m=0;
    for(int i=2; i<=n; i++){
        x+=b[i];
        if(b[i]) m++;

    }
    if(a[1]&&x%2==0){
        b[1]++;
        m++;
    }else if(!a[1]&&x%2){
        b[1]++;
        m++;
    }
    cout<<m<<endl;
    for(int i=1; i<=n; i++){
        if(b[i]) cout<<i<<endl;
    }
}


Measured memory_bytes: 2432
#include <cstdio>
int main() {
 int k, a, b;
 scanf("%d%d%d", &k, &a, &b);
 if (a / k < b / k || a % k == 0 || b % k == 0) {
  printf("OK\n");
 } else {
  printf("NG\n");
 }
 return 0;
}

Measured memory_bytes: 1664
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def BellmanFord(N, e, s, goal):
    dist = [sys.maxsize] * (N+1)
    dist[s] = 0
    for i in range(N+1):
        for u, v, c in e:
            if dist[v] > dist[u] + c:
                if i == N:
                    return 'inf'
                dist[v] = dist[u] + c
    return dist

@mt
def slv(N, M, P, ABC):
    g = [[] for _ in range(N+1)]
    for a, b, c in ABC:
        g[a].append(b)

    def r(s, e):
        q = deque()
        q.append(s)
        done = set([s])
        while q:
            u = q.pop()
            for v in g[u]:
                if v not in done:
                    done.add(v)
                    q.append(v)
        return done

    d = set()
    for i in range(2, N):
        reachable = r(i, N)
        if N not in reachable:
            d.add(i)
    
    e = []
    sr = r(1, N)
    for a, b, c in ABC:
        if a not in d and b not in d and a in sr and b in sr:
            e.append((a, b, -(c - P)))

    d = BellmanFord(N, e, 1, N)
    if d == 'inf':
        return -1
    return max(0, -d[N])


def main():
    N, M, P = read_int_n()
    ABC = [read_int_n() for _ in range(M)]
    print(slv(N, M, P, ABC))

    # N = 2500
    # M = 5000
    # P = random.randint(0, 10**5)
    # P= 0
    # ABC = [
    #     [random.randint(1, N), random.randint(1, N), random.randint(1, 10**5)] for _ in range(M)
    # ]
    # print(slv(N, M, P, ABC))



if __name__ == '__main__':
    main()


Measured memory_bytes: 90584
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    string s,ss="CODEFESTIVAL2016";
    std::cin >> s;
    int ans=0;
    rep(i,s.size()){
        if(s[i]!=ss[i])ans++;
    }
    std::cout << ans << std::endl;
    
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    long N,x[100005],y[100005],t[100005],z;
	while(scanf("%ld",&N)!=EOF)
	{
		int flag=0;
		for(int i=0;i<N;i++)
			scanf("%ld%ld%ld",&t[i],&x[i],&y[i]);
		for(int i=0;i<N;i++)
		{
			z=t[i]-x[i]-y[i];
			if(t[i]<x[i]+y[i])
			{
				printf("No\n");
				flag=1;
				break;
			}
			else if(z%2!=0)
			{
				printf("No\n");
				flag=1;
				break;
			}			
		}
		if(flag==0)
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 2560
#include <cstdio>

int n;
int m, t;

int main(){
	scanf("%d", &n);
	m = n;
	while(n > 0){
		t += n % 10;
		n /= 10;
	}
	if(m % t == 0) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#define read(x) scanf("%d",&x)
using namespace std;

int main()
{
    string s;
    cin>>s;
    int win=0,loss=0, ls = s.length();
    for(int i = 0;i<ls;i++){
        if(s[i]=='o') win++;
        if(s[i]=='x') loss++;
    }
    if(win+15-ls>=8) puts("YES");
    else puts("NO");
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
# . = しろ
# # = 黒
# #の横に.がないようにしたい
# #の横に.があったら#を.に変える
# or #の横に.があったら.を#に変える

# when do you replace now char to .
# 

# テストケース
"""
3
#..

3
##.
"""
# => .....# = 2

def inorderReplace(S , N): 
    S = list(S)
    cnt = 0
    for i in range(N - 1) : 
        nowChar = S[i]
        nextChar = S[i + 1]
        if nowChar == "#" and nextChar == "." : 
            cnt += 1
            S[i + 1] = "#"
    return cnt

def calcCount(S , N) : 
    countingChar = S[0]
    rst = []
    count = 1
    for s in S[1:] :
        if countingChar == s : 
            count += 1
        else : 
            rst.append((countingChar , count))
            count = 1
            countingChar = s
    rst.append((countingChar , count))
    return rst

def countRightChange(countingList) : 
    #全部を.に変えるコスト
    cnt = 0
    for elem in countingList : 
        if elem[0] == "#" : 
            cnt += elem[1]
    return cnt

def countLeftChange(countingList) : 
    # 全部を#に変えるコスト
    cnt = 0
    for elem in countingList : 
        if elem[0] == "." : 
            cnt += elem[1]
    return cnt

def calcPoint(countingList) : 
    a = 0
    b = countLeftChange(countingList)
    minVal = a + b
    for i in range(len(countingList)) : 
        elem = countingList[i]
        if elem[0] == "." : 
            a += 0
            b -= elem[1]
        elif elem[0] == "#" : 
            a += elem[1]
            b -= 0
        if minVal > a + b : 
            minVal = a + b
    return minVal

countingList = calcCount(S , N)
cnt2 = calcPoint(countingList)

print(cnt2)

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define popcnt __builtin_popcount
#define getBit(x, k) ((x >> k) & 1)
#define all(x) (x).begin(),(x).end()
// ---------------------------------

void Main() {
  int n; cin >> n;
  vector<int> a(n);
  for (auto &i : a) cin >> i;
  int x = 0;
  for (int i = 0; i < n; i++) {
    if (i % 2) x -= a[i];
    else x += a[i];
  }
  for (int i = 0; i < n; i++) {
    cout << x << ' ';
    x = a[i] * 2 - x;
  }
  cout << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  cerr << "- ---- -- ----- <3\n";
#endif
  cin.tie(0)->sync_with_stdio(0);
  int T = 1;
  // cin >> T;
  while (T--) Main();
}


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

int main() {
  long long X, depo = 100;
  cin >> X;

  int year = 1;
  while (depo < X) {
    depo = depo * 1.01;
    if (depo < X) year++;
  }

  cout << year << endl;

  return 0;
}

Measured memory_bytes: 3636
/**
* Copyright(c)
* All rights reserved.
* Author : zzy
* Date : 2020-03-07-20.08.34
*/
#include <bits/stdc++.h>

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int)(x).size())

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> 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 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; }

i64 n, a, b;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
#endif

    cin >> n >> a >> b;
    i64 all = a+b;
    i64 rem = n % all;
    i64 ans = (n / all) * a + min(rem, a);
    cout << ans << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll a,b;
    cin>>a>>b;
    ll n=b-a;
    ll ans=n*(n-1)/2-a;
    cout<<ans<<endl;
}

Measured memory_bytes: 256