akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <map>
#include <cstring>
#include <algorithm>
#include <string>
#include <set>
#include <sstream>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
#define maxn 100005
int s[200005];
int main()
{
	int ans=0,a,b;
	cin >> a >> b;
	for (int i=1;i<=a;i++)
	{
		cin >> s[i];
	}
	for (int i=b+1;i<=a;i++)
	{
		if (s[i] <= s[i-b])
		{
			cout << "No" << endl;
		}
		else cout << "Yes" << endl;
	}
}

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

#define F first
#define S second
#define int long long
#define pb push_back
#define endl '\n'

using namespace std;

int n , dp[100001] , a[100001] ;

int32_t main()
{
	ios_base :: sync_with_stdio(false) ;
	cin.tie(0); cout.tie(0) ;
	cin >> n ;
	for(int i = 1 ; i <= n ; i++){
		cin >> a[i] ; 
		if(i == 1) dp[i] = 0 ;
		else if(i == 2) dp[i] = abs(a[i] - a[i -1]) ; 
		else{
			dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]) , dp[i - 2] + abs(a[i] - a[i - 2])) ; 
		}
	}
	cout << dp[n] << endl ; 
	return 0 ;
}



Measured memory_bytes: 1792
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


S = sys.stdin.readline().rstrip()


def solve(S):
    key = 'keyence'
    ok = False
    for i in range(len(S)):
        ok |= S.startswith(key[:i]) and S.endswith(key[i:])
    return ok


if solve(S):
    print('YES')
else:
    print('NO')


Measured memory_bytes: 13580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define eb emplace_back
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define cinarr(A,len) for(int i=0;i<len;i++){cin>>A[i];}
#define coutarr(A,len) for(int i=0;i<len;i++){cout<<A[i]<<' ';}cout<<endl
#define coutin(V) for(auto& i : V){cout << i << ' ';}cout<<endl // for vect and set
#define coutmap(U) for(auto& i : U){cout << i.first << "->" << i.second << ", ";}cout<<endl // for map
#define deb(x) cerr << #x << '\t' << x << endl
const int imax = numeric_limits<int>::max(), imin = numeric_limits<int>::min();
const long long	lmax = numeric_limits<long long>::max(), lmin = numeric_limits<long long>::min();
/*========================================================================*/
/* strategi/note:



/================================*/



bool Svd=0;
void solve(){Svd=1;
    string s;
    cin >> s;
    if(s[s.length()-1] == 's'){
        s += "es";
    }
    else{
        s += "s";
    }
    cout << s << endl;
}


/*========================================================================*/

int main(){ios_base::sync_with_stdio(0);cin.tie(0);
//cout<<fixed<<setprecision( ); // iomanip **

 solve();
 //int t;cin>>t;while(t--){solve();}

if(!Svd)cout<<"solve() function blm dipanggil!"<<endl;
//cout.flush(); cin.get();
return 0;
}


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

int out(vector<int> &A,int n,int k){
	int i;
	for (i=0;i<=n-2;i++){
		if(i==k){
			cout << "["<< A[i] <<"] ";
		}else{
			cout << A[i] <<" ";
		}
		
	}
	cout << A[n-1] <<endl;
}

int partition(vector<int> &A, int p, int r){
	int x=A[r];
	int i=p-1;
	int j;
	for (j=p;j<r;j++){
		if (A[j]<=x){
			i++;
			swap(A[i],A[j]);
		}
	}
	swap(A[i+1],A[r]);
	return i+1;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> A(n);
	int i;
	for (i=0;i<n;i++){
		cin >> A[i];
	}
	
	int k=partition(A,0,n-1);
	out(A,n,k);
	return 0;
}

Measured memory_bytes: 1532
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3") 
#pragma GCC optimization ("unroll-loops")
 
// #include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
// const ll RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
// gp_hash_table<int, int> table;
 
#define ll  long long
#define vii vector< ll >
#define pb push_back
#define pii pair<ll,ll>
#define ppi pair<pii,ll>
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define ins insert
#define ld long double
#define lp(l,r) for(i=l;i<=r;++i)
 
#define lpj(l,r) for(j=l;j<=r;++j)
#define lpr(l,r) for(i=r;i>=l;--i)
#define lprj(l,r) for(j=r;j>=l;--j)
 
#define swap(a,b){ auto _t=a;a=b,b=_t;}
#define flush() cout.flush()
#define popcount __builtin_popcount
#define die() return 0;
#define sz() size() 


 
 
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define MD          1000000007
#define M 			    2011
#define N           14
#define fftmod      998244353
#define EPS         (double)1e-10
 
long long  md=MD;
ll inf=1e18;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
 
 
inline ll exp(ll a,ll b){if(a==0&&b==0)return 1ll;if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=(r%md)*(a%md);r=(r+md)%md;}b/=2;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (ll)r;}
 
using cd=complex<double>;
const double PI=acos(-1);
 
inline ll rand(ll l,ll r){
    return l+rng()%(r-l+1);
}

ll a[M];

int main(){
 
     
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
 
   // ifstream fin("input.txt");ofstream fout("outut.txt");
    ll t,i,j,m,n,s,z,k,p;string s1,s2;ll q;ll x,y;
    cin>>n>>k;
    lp(1,n)cin>>a[i];
    ll ans=0;
    lp(1,n){
      p=0;
      lpj(1,n){
        if(a[j]<a[i])++p;
      }
      x=(k*k-k)/2;x%=md;
      ans=ans+p*x%md;ans%=md;
    }
    lp(1,n){
      p=0;
      lpj(1,i){
        if(a[j]>a[i])++p;
      }
      ans=ans+p*k%md;ans%=md;
    }
    cout<<ans<<"\n";








}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main()
{
    int n;
    scanf("%d",&n);
    int mat[105][105]={};
    int line=0;
    int wa=n;
    if(wa%2==0)wa+=1;
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++){
        if(i==j)mat[i][j]=0;
        else if(i+j==wa)mat[i][j]=0;
        else{
            mat[i][j]=1;
            line++;
        }
    }
    line/=2;
    printf("%d\n",line);
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++){
        if(i<j && mat[i][j]==1){
            printf("%d %d\n",i,j);
        }
    }
    return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL)x = x->left;
  return x;
}

Node find(Node u,int k){
  while(u != NIL && k != u->key){
    if(k < u->key)u = u->left;
    else u = u->right;
  }
  return u;
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL)return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node x,y;
  if(z->left == NIL || z->right == NIL)y = z;
  else y = treeSuccessor(z);
  if(y->left != NIL)x = y->left;
  else x = y->right;
  if(x != NIL)x->parent = y->parent;
  if(y->parent == NIL)root = x;
  else{
    if(y == y->parent->left)y->parent->left = x;
    else y->parent->right = x;
  }
  if(y != z)z->key = y->key;
  free(y);
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }

  z->parent = y;
  if(y == NIL){
    root = z;
  }
  else{
    if(z->key < y->key){
      y->left = z;
    }
    else{
      y->right = z;
    }
  }

}

void inorder(Node u){
  if(u == NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u == NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x, a, y;
  char com[20];
  Node t;
  scanf("%d", &n);

  for (i = 0 ; i < n ; i++ ){
    scanf("%s", com);
    if(strcmp(com,"find") == 0){
      scanf("%d",&a);
      t = find(root,a);
      if(t != NIL)printf("yes\n");
      else printf("no\n");
    }
    else if(strcmp(com,"insert") == 0){
      scanf("%d",&x);
      insert(x);
    }
    else if(strcmp(com,"print") == 0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(strcmp(com,"delete") == 0){
      scanf("%d",&y);
      treeDelete(find(root,y));
    }
  }

  return 0;
}



Measured memory_bytes: 20464
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	string s; cin >> s;
	int cnt = 0;
	rep(i,s.size())if(s[i] == 'o')++cnt;
	cout << ((15-s.size() + cnt >= 8)?"YES":"NO") << endl;
	return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define ll   long long int   
#define pb push_back
using namespace std;
const int M=1e9 + 7;

int main()
{   
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n, d;cin>>n>>d;
    int ans=0;
    int i=1;
    while(i<=n)
    {   
       
    	i=i+d+d+1;
    	//cout<<i<<endl;
    	ans++;
	}
	cout<<ans<<endl;
	return 0;
}
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#define FUP(i,x,y) for(int i=(x);i<=(y);i++)
#define FDW(i,x,y) for(int i=(x);i>=(y);i--)
#define MAXN 40
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define ll long long
#define db double
using namespace std;
int read(){
    int w=0,flg=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')flg=-1;ch=getchar();}
    while(ch<='9'&&ch>='0'){w=w*10-'0'+ch,ch=getchar();}
    return w*flg;
}
int n,m1,m2,a[MAXN],b[MAXN],c[MAXN],ans=INF,cnt=1,suma,sumb;
int f[410][410];
int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}
int main(){
	
	memset(f,0x3f,sizeof(f));
	f[0][0]=0;
	n=read(),m1=read(),m2=read();
	FUP(i,1,n)
	{
		a[i]=read(),b[i]=read(),c[i]=read();
		suma+=a[i],sumb+=b[i];
		FDW(j,suma,a[i])
		{
			FDW(k,sumb,b[i])
			{
				f[j][k]=min(f[j][k],f[j-a[i]][k-b[i]]+c[i]);
				int gcdd=gcd(j,k);
				if(j/gcdd==m1&&k/gcdd==m2)
				{
					ans=min(ans,f[j][k]);
					//printf("%d,%d\n",j,k);
				}
			}
		}
		//printf("%d\n",f[2][2]);
	}
	printf("%d\n",ans==INF?-1:ans);
    return 0;
}

Measured memory_bytes: 896
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const ll nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
ll r,d,x,i;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>r>>d>>x;
	for(i=1;i<=10;i++)
	{
		x=r*x-d;
		cout<<x<<endl;
	}
    return 0;
}

Measured memory_bytes: 256
N = int(input())
H = [0] + list(map(int,input().split()))

cnt = 0
stop = max(H)
while stop>0:
    stop += -1
    for i in range(1,N+1):
        if H[i]>0 and H[i-1]==0:
            cnt+=1
    for i in range(1,N+1):
        if H[i]>0:
            H[i]+=-1
print(cnt)


Measured memory_bytes: 39664
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;
    unordered_map<string, int> um;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        um[s]++;
    }
    cout << "AC x ";
    cout << um["AC"] << endl;

    cout << "WA x ";
    cout << um["WA"] << endl;
    cout << "TLE x ";
    cout << um["TLE"] << endl;
    cout << "RE x ";
    cout << um["RE"] << endl;
}


Measured memory_bytes: 3640
ks = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = gets.to_i

puts ks[k-1]

Measured memory_bytes: 1788
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int s[1000],p[1000],q[1000],r[1000],p1,q1,r1,c1;
	int flg,n,c,i;
	while(1)	{
		scanf("%d",&n);
		if(n==0)	break;
		for(i=0;i<n;i++)	{
			scanf("%d %d %d %d",&s[i],&p[i],&q[i],&r[i]);
		}
		scanf("%d %d %d %d",&p1,&q1,&r1,&c1);
		flg=0;
		for(i=0;i<n;i++)	{
			c=p[i]*4+q[i]*9+r[i]*4;
			if(c<=c1 && p[i]<=p1 && q[i]<=q1 && r[i]<=r1)	{
				printf("%d\n",s[i]);
				flg=1;
			}
		}
		if(flg==0)	printf("NA\n");
	}
	return 0;
}


Measured memory_bytes: 2716
N = int(input())
result = 0
for i in range(31, N+1, 2):
    #print(i)
    cnt = 0
    for j in range(1,i+1):
        if i % j == 0:
            cnt += 1
        if cnt == 8:
            result += 1
            #print(j)
        #print(j,cnt,'cnt')
print(result)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define ll long long 

int main() {
  string n;
  cin >> n;
  
  int res = 0;
  for(int i = 0;i<n.size();i++){
    res += n[i]-'0';
    res %= 9;
  }
  if(res%9 ==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

int main(){
    int N,M;
    cin>>N>>M;
    vector<vector<int>> cond(M);
    vi p(M);
    for(int i=0;i<M;i++){
        int k;
        cin>>k;
        cond[i]=vector<int>(k);
        for(int j=0;j<k;j++){
            cin>>cond[i][j];
            cond[i][j]--;
        }
    }
    for(int i=0;i<M;i++){
        cin>>p[i];
    }
    int pt=1<<N;
    int ans=0;
    for(int i=0;i<pt;i++){
        bool on=true;
        for(int j=0;j<M;j++){
            int count=0;
            int L=cond[j].size();
            for(int k=0;k<L;k++){
                if(i&(1<<cond[j][k]))count++;
            }
            if(count%2!=p[j]){
                on=false;break;
            }
        }
        if(on)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define PI 3.14159265358979323846
#define MOD 1000000007
#define INF (int)1e9

using namespace std;
using namespace __gnu_pbds;
//typedef tree<TYPE, null_type, less<TYPE>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//typedef tree<TYPE, null_type, less_equal<TYPE>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;

int H, W;
long long dp[1001][1001];
char G[1001][1001];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> H >> W, cin.get();
	for(int i = 1; i <= H; i++){
		for(int j = 1; j <= W; j++) G[i][j] = cin.get();
		cin.get();
	}
	for(int i = 0; i <= H; i++)
		for(int j = 0; j <= W; j++)
			if(i == 0 || j == 0) dp[i][j] = 0;
			else if(i == 1 && j == 1) dp[i][j] = 1;
			else if(G[i][j] == '.') dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD;
	cout << dp[H][W] << "\n";
	return 0;
}


Measured memory_bytes: 9088
N = int(input())

R = []

for i in range(N):
    x, l = map(int, input().split())
    R.append((x-l,x+l))

R_sorted = sorted(R, key=lambda x:x[1])

ans = 0
right = -10**9 - 1
i = 0
while(i < N):
    left = R_sorted[i][0]
    if left >= right:
        ans += 1
        right = R_sorted[i][1]
    i += 1

print(ans)

Measured memory_bytes: 19016
#include <bits/stdc++.h>
using namespace std;
int read();

int calc(int a, int x) {
    int t = a / x, b = a % x;
    return b ? calc(a - (t + 1) * ((b - 1) / (t + 1) + 1), x) : t;
}
int main() {
    int n = read(), res = 0;
    for (int i = 1, a; i <= n; ++i) a = read(), res ^= calc(a, read());
    puts(res ? "Takahashi" : "Aoki");
    return 0;
}

const int _SIZE = 1 << 22;
char ibuf[_SIZE], *iS = ibuf, *iT = ibuf;
#define gc                                                         \
    (iS == iT ? iT = ((iS = ibuf) + fread(ibuf, 1, _SIZE, stdin)), \
     (iS == iT ? EOF : *iS++) : *iS++)
int read() {
    int x = 0, f = 1;
    char c = gc;
    while (!isdigit(c)) f = (c == '-') ? -1 : f, c = gc;
    while (isdigit(c)) x = x * 10 + c - '0', c = gc;
    return x * f;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int inf = 1e7+7;
const int N = 1e6+9;

int main() {
    ios_base::sync_with_stdio(0);
    int a,b,n;
    cin>>n;
    int rem = 0;
    for(int i=1;i<=inf;++i) {
        rem = rem*10+7;
        rem %= n;
        if(rem==0) {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 3660
from collections import deque

dq=deque()
n=int(input())

for i in range(n):
	com=input().split()
	if com[0]=='insert':
		dq.appendleft(com[1])
	elif com[0]=='deleteFirst':
		dq.popleft()
	elif com[0]=='deleteLast':
		dq.pop()
	else:
		if com[1] in dq:
			dq.remove(com[1])
			
print(' '.join(dq))

Measured memory_bytes: 69732
N = int(input(""))
L = [0 for i in range(N)]
flag = False

for i in range(N):
    a, b = input().strip().split()
    a, b = [int(a), int(b)]
    L[i] = a - b
for i in range(N - 2):
    if (L[i] == 0 and L[i+1] == 0 and L[i+2] == 0):
        flag = True

if flag:
    print("Yes")
else:
    print("No")

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

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

	int a = 0;
	int z = 0;
	rep(i,s.size()){
		if(s.at(i) == 'A'){
			a = i;
			break;
		}
	}
	rep(i, s.size()){
		if(s.at(i) == 'Z')
			z = i;
	}

	cout << z-a+1 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int h,m,s;cin>>h>>m>>s,(h&m&s)!=-1;){
		int remain=7200-(h*3600+m*60+s);
		h=remain/60/60;
		m=remain/60%60;
		s=remain%60;
		printf("%02d:%02d:%02d\n",h,m,s);
		remain*=3;
		h=remain/60/60;
		m=remain/60%60;
		s=remain%60;
		printf("%02d:%02d:%02d\n",h,m,s);
	}
	
	return 0;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n, k; cin >> n >> k;

    int r = (n - 1) * (n - 2) / 2 - k;
    if (r < 0) {
        cout << -1 << endl;
        return 0;
    }

    cout << (n - 1) + r << endl;
    for (int i = 0; i < n - 1; i++) cout << 1 << ' ' << 2 + i << endl;
    for (int i = 2; i <= n - 1; i++) {
        for (int j = i + 1; j <= n; j++) {
            if (!r) break;
            cout << i << ' ' << j << endl;
            r--;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define EPS (1e-14)
#define _PA(x,N) rep(i,N){cout<<x[i]<<" ";}cout<<endl;
#define _PA2(x,H,W) rep(i,(H)){rep(j,(W)){cout<<x[i][j]<<" ";}cout<<endl;}

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef complex<double> Complex;
typedef vector< vector<int> > Mat;

struct BIT {
	int dat[1 << 18];
	int n;
	void init(int size) {
		n = size;
		memset(dat, 0, sizeof(dat));
	}
	int sum(int i) {
		int res = 0;
		while (i > 0) {
			res += dat[i];
			i -= i & -i;
		}
		return res;
	}
	void add(int i, int x) {
		while (i <= n) {
			dat[i] += x;
			i += i & -i;
		}
	}
};

struct rBIT : BIT {
	void init(int size) {
		BIT::init(size);
	}
	int sum(int i) {
		return BIT::sum(n - i + 1);
	}
	void add(int i, int x) {
		BIT::add(n - i + 1, x);
	}
};

map<int, int> freq[100005], query[100005];
rBIT tree;
int N, M;
vector< pair<PII, int> > a; // l, query?, r

void solve() {
	tree.init(M);
	for (int d = 1; d <= M; d++) {
		for (int cur = d, prev = 0; cur <= M; cur += d, prev += d) {
			if (freq[cur][cur] == 0) {
				a.push_back(pair<PII, int>(PII(cur, 1), cur));
				freq[cur][cur] = 1;
			}
			if (freq[prev][cur] == 0) {
				a.push_back(pair<PII, int>(PII(prev, 1), cur));
				freq[prev][cur] = 1;
			}
		}
	}

	sort(a.begin(), a.end());

#if 0
	for (int i = 0; i < a.size(); i++) {
		printf("%d %d type %d\n", a[i].first.first, a[i].second, a[i].first.second);
	}
#endif

	for (int i = 0; i < a.size(); i++) {
		if (a[i].first.second == 0) {
			// add
			tree.add(a[i].second, 1);
		} else {
			// query
			int s = tree.sum(a[i].second);
			int x = a[i].first.first;
			int y = a[i].second;
			query[x][y] = s;
		}
	}

	for (int d = 1; d <= M; d++) {
		int ans = 0;
		for (int cur = d, prev = 0; cur <= M; cur += d, prev += d) {
			ans += query[cur][cur] - query[prev][cur];
		}
		cout << ans << endl;
	}

}



int main() {
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		int l, r;
		cin >> l >> r;
		a.push_back(pair<PII, int>(PII(l, 0), r));
	}
	solve();
	return 0;
}




Measured memory_bytes: 148452
import java.util.HashSet;
import java.util.Set;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n =  Integer.parseInt(br.readLine());
        int count = 0;
        int ans = 0;
        
        for (int i = 1; i <= n; i++) {
            if (i%2==0) continue;
            for (int j = 1; j <= i; j++) {
                if (i % j == 0) count++;
            }
            
            if (count == 8) ans++;
            count = 0;
        }
        System.out.println(ans);
    }
    
    
}


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

using namespace std;

const int MOD = 1e9 + 7 , N = 1e5 + 5;
int memo[N][2];
string s;

int add(int a , int b) {
    a += b;
    while (a >= MOD) a -= MOD;
    return a;
}

int mul(int a , int b) {
    return a * 1ll * b % MOD;
}

int solve (int i , bool l) {
    if (i == s.size())
        return 1;

    int &ret = memo[i][l];
    if (~ret)
        return ret;

    ret = 0;
    int r = l ? 1 : s[i];
    for (int j = 0 ;j <= r ;j++)
        ret = add(ret , mul(solve(i + 1 , l | (j < s[i])) , j + 1));

    return ret;
}

int main() {
    cin >> s;
    for (char &c : s) c -= '0';
    memset(memo , -1 , sizeof memo);
    cout << solve(0 , 0);
}

Measured memory_bytes: 9088
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>

using namespace std;
#define LOCAL  1
#define UPLOAD 2
#define ll long long
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
  int N = input();
  vector<int> S(N);
  string s = input<string>();
  for(int i=0;i<N;i++){
    char c = s[i];
    S[i] = c;
  }

  for(int i=N-1;i>0;i--){
    if(S[i] == S[i-1]){
      S.erase(S.begin()+i);
    }
  }
  output(S.size());

  return 0;
}

Measured memory_bytes: 896
#include<stdio.h>

int main()
{
	int d,n,x,y,area,i;
	
	while(scanf("%d",&d)!=EOF)
	{
		x=0;
		area=0;
		n=600/d;
		for(i=0;i<n;i++)
		{
			y=x*x;
			area+=y*d;
			x+=d;
		}
		printf("%d\n",area);
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>

const int MAXN = 3000 + 5;

using namespace std;

int n;
long double dp[MAXN][MAXN],probability[MAXN];

int main()
{
    cin>>n;
    for(int i = 1; i <= n; i++)
        cin>>probability[i];
    dp[0][0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= i; j++){
            dp[i + 1][j] += dp[i][j] * (1 - probability[i + 1]);
            dp[i + 1][j + 1] += dp[i][j] * probability[i + 1];
        }
    }
    long double ans = 0;
    for(int j = n / 2 + 1; j <= n; j++)
        ans += dp[n][j];
    cout<<setprecision(10)<<fixed<<ans;


    return 0;
}


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

int main()
{
    int i=0,max=0,maxNumber=-1,maxN=0,maxNNumber=0;
    string str[1000];
    while(cin>>str[i]){
        i++;
    }
    int wordCount[i+1];
    for(int j=0;j<i+1;j++){
        wordCount[j]=0;
    }
    bool kaburi[i+1];
    for(int j=0;j<i+1;j++){
        if(kaburi[j]) continue;
        if(max<str[j].length()){
            max=str[j].length();
            maxNumber=j;
        }
        for(int k=0;k<i+1;k++){
            if(str[j]==str[k]){
                wordCount[j]++;
                kaburi[k]=true;
            }
        }
    }
    for(int j=0;j<i+1;j++){
        if(maxN<wordCount[j]){
            maxN=wordCount[j];
            maxNNumber=j;
        }
    }
    cout<<str[maxNNumber]<<' '<<str[maxNumber]<<endl;
    return 0;
}

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

using namespace std;

int main() {
	
	int n;
	cin >> n;
	int m = n;
	int summ = 0;
	for (int i = 0; i <= int((double)log(n)/log(10))+1; i++) {
		summ+=m-int(m/10)*10;
		m=int(m/10);
	}
	if(n%summ==0){cout << "Yes" << endl; }
	else {
		cout << "No"	<<endl;
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int SIZE=205;
//int arr[SIZE]={};
//ここまでテンプレ
int main(){
	int x,a,b;
	cin>>x>>a>>b;
	if(abs(a-x)>=abs(b-x)){
		cout<<"B"<<endl;
	}
	else
		cout<<"A"<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
cards = {} #空の辞書
for i in range(n):
    card = input()
    cards[card] = 1
     
#print(cards)
 
for c in ['S', 'H', 'C', 'D']:
    for n in range(1,14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
template<class T> void chmax(T &a, const T b){ a = max(a, b); }
template<class T> void chmin(T &a, const T b){ a = min(a, b); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll k;
    cin >> k;
    string ans = "";
    rep(i, k) ans += "ACL";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3612
import java.util.Scanner;
 
public class Main {
 
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    final int k = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
    if(a % k == 0 || b % k == 0){
      System.out.println("OK");
    }else{
      if(b/k - a/k == 0){
        System.out.println("NG");
      }else{
        System.out.println("OK");
      }
    }
  }
}

Measured memory_bytes: 26920
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
  int a,b,x; //1000ml,500ml,need

  cin >> a>>b>>x;
  int ax=x/1000,bx=x/500;
  int money=0,needw=0;
  if(ax*a>ax*2*b){
    money+=ax*2*b;
  } else{
    money += ax*a;
  }
  needw += ax * 1000;
  if(x-needw==0){
  }  else if(x-needw<=500){
    if(a<b) money+= a;
    else money += b;
  }else if(a>2*b){
    money += 2*b;
  }else {
    money += a;
  }

  cout << money << endl;
  
  return 0;
}




Measured memory_bytes: 3116
#include<iostream>
using namespace std;
int a[100005],c; 
int main()
{int n,k;
 cin>>n>>k;
 for(int i=0;i<n;i++){
 cin>>a[i];}
 if(n!=k && k!=1){
 for(int i=0;i<n;i++) 
 if(i%(k-1)==0)
 {c++;
 }
 c--;
 if((n+c-1)%k==0){
 int hans1=(n+c-1)/k;
 cout<<hans1<<endl;
}
 else if((n+c-1)%k!=0){
 int hans1=(n+c)/k;
 int hans2=1;
 cout<<hans1+hans2<<endl;
}
}
 else if(n==k)
 {cout<<n/k<<endl;
 }
 system("pause");
 return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
vector <int> G[MAXN], block[MAXN];
int cc[MAXN], sz[MAXN];
void dfs(int pos, int col)
{
	cc[pos] = col;
	sz[col]++;
	for (int i = 0; i < G[pos].size(); ++i)
	{
		if (!cc[G[pos][i]])
			dfs(G[pos][i], col);
	}
}
int main(int argc, char const *argv[])
{
	int n,m,k;
	cin>>n>>m>>k;
	int u,v;
	for (int i = 0; i < m; ++i)
	{
		cin>>u>>v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for (int i = 0; i < k; ++i)
	{
		cin>>u>>v;
		block[u].push_back(v);
		block[v].push_back(u);
	}
	for (int i = 1; i <= n; ++i)
	{
		if (!cc[i])
			dfs(i, i);
	}
	for (int i = 1; i <= n; ++i)
	{
		int ans = sz[cc[i]] - G[i].size() - 1;
		for (int j = 0; j < block[i].size(); ++j)
		{
			if(cc[block[i][j]] == cc[i])
				ans--;
		}
		cout<<ans<<" ";
	}
	return 0;
}

Measured memory_bytes: 13056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};



int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;cin >> n >> m;
	ll ans=(100*(n-m)+1900*m)*(ll)pow(2,m);
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void)
{
	int a,b;
	cin>>a>>b;
	if(13<=a){
		cout<<b<<endl;
	}
	else if(13>a && a>=6){
		cout<<b/2<<endl;
	}
	else{
		cout<<0<<endl;
	}
	return 0;
}

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

int main() {
    int D; 
    cin >> D;
    if (D == 25) {
        cout << "Christmas" << endl;
    }
    if (D == 24) {
        cout << "Christmas Eve" << endl;
    }
    if (D == 23) {
        cout << "Christmas Eve Eve" << endl;
    }
    if (D == 22) {
        cout << "Christmas Eve Eve Eve" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
// #include <cmath>
// #include <math.h>
using namespace std;

int main(){
    int N, Y;
    cin >> N >> Y;
    Y /= 1000;
    int k;
    for (int i=0; i<=N; ++i){
        for (int j=0; j<=N-i; ++j){
            k = N - i - j;
            if (i*10 + j*5 + k == Y){
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   int a[26]={};
   cin>>s;
   int x=s.size();
   for(int i=0;i<x;i++)
   {
       int j=0;
       j=s[i]-'a';
       a[j]++;
   }
   bool ok=true;
   for(int i=0;i<26;i++)
   {
       if(a[i]%2!=0)
       {
         ok=false;
       }
   }
   if(ok==true)
   {
       cout<<"Yes";
   }
   else
   {
       cout<<"No";
   }

return 0;

}


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

using namespace std;

const long double eps = 1e-9;

const int MaxN = 16;
const int INF = 1e9;

int n, m;

int sum[1 << MaxN];
int a[MaxN][MaxN];

int dp[1 << MaxN][MaxN];

int getDif(int mask1, int mask2)
{
    return sum[mask1 | mask2] - sum[mask1] - sum[mask2];
}

void up(int & x, int y)
{
    if(y < x)
        x = y;
}

void print(int mask)
{
    for(int i = 0; i < n; ++i)
        cout << ((mask & (1 << i)) > 0);
}

int main()
{
//    freopen("input.txt", "r", stdin);
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;
    for(int i = 1; i <= m; ++i)
    {
        int x, y, z;
        cin >> x >> y >> z;
        --x, --y;
        a[x][y] = a[y][x] = z;
    }
    for(int mask = 0; mask < (1 << n); ++mask)
        for(int bit = 0; bit < n; ++bit)
            if(mask & (1 << bit))
                for(int otherBit = bit + 1; otherBit < n; ++otherBit)
                    if(mask & (1 << otherBit))
                        sum[mask] += a[bit][otherBit];

    for(int mask = 0; mask < (1 << n); ++mask)
        for(int i = 0; i < n; ++i)
            dp[mask][i] = INF;

    dp[1][0] = 0;
    for(int mask = 1; mask < (1 << n); ++mask)
        for(int bit = 0; bit < n; ++bit)
            if(mask & (1 << bit) && dp[mask][bit] != INF)
            {
                for(int otherBit = 0; otherBit < n; ++otherBit)
                    if(!(mask & (1 << otherBit)) && a[bit][otherBit])
                        up(dp[mask | (1 << otherBit)][otherBit], dp[mask][bit] + getDif(mask - (1 << bit), (1 << otherBit)));

                int otherMask = (1 << n) - 1 - mask;
                for(int subMask = otherMask; subMask; --subMask, subMask &= otherMask)
                    up(dp[mask | subMask][bit], dp[mask][bit] + getDif(mask - (1 << bit), subMask));


            }

    cout << dp[(1 << n) - 1][n - 1] << '\n';
    return 0;
}


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

int main() {
	int N;
	cin >> N;
	vector<int> count(100000);
	rep(i, N) {
		int a;
		cin >> a;
		if (a == 0) {
			count[0]++;
			count[1]++;
		}
		else if (a == 100000 - 1) {
			count[100000 - 1]++;
			count[100000 - 2]++;
		}
		else {
			count[a - 1]++;
			count[a]++;
			count[a + 1]++;
		}
	}
	cout << *max_element(count.begin(), count.end()) << endl;
	return 0;
}

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

int main() {
	string s;
	getline(cin, s);
	string t;
	getline(cin, t);
	s += s;
	if (s.find(t) != -1)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;		
}



Measured memory_bytes: 3200
import math

N = int(input())
arr = []
if N == 1:
    print(0)
    quit()


def loop_attr(num):
    temp = num
    for i in range(2, math.ceil(N**0.5)):
        counter = 0
        while(temp%i == 0):
            counter += 1
            temp //= i
        if counter != 0:
            arr.append(counter)
        if temp == 1:
            break

    if temp != 1:
        arr.append(1)


ans = 0
loop_attr(N)
for j in arr:
    count = 1
    while(j - count >= 0):
        j -= count
        count += 1
    ans += (count-1)

print(ans)

Measured memory_bytes: 9400
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder output = new StringBuilder();
        int i = 1;
        while(true){
            int x = Integer.parseInt(br.readLine());
            if(x == 0){
                break;
            }
            output.append("Case ").append(Integer.toString(i++)).append(": ").append(Integer.toString(x)).append("\n");
      }
      System.out.print(output);
    }
}


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

using namespace std;


int main()
{
    long N, M;
    long a, b;
    long count = 0;
    long accum = 0;
    typedef pair<long, long> pair;
    vector<pair> vec;

    cin >> N >> M;
    for (int i = 0; i < N; i++) {
        cin >> a >> b;
        auto p = make_pair(a, b);
        vec.push_back(p);
    }

    std::sort(
        vec.begin(),
        vec.end(),
        [](const pair& x, const pair& y){return x.first < y.first;}
    );

    for (int i = 0; i < N; i++) {
        auto p = vec[i];
        if (count + p.second < M) {
            accum += p.first * p.second;
            count += p.second;
        } else {
            accum += p.first * (M - count);
            break;
        }
    }

    cout << accum << endl;

    return 0;   
}

Measured memory_bytes: 2420
use std::cmp::max;


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    input! {
        X: i64,
        K: i64,
        D: i64,
    }

    let X = X.abs();
    let div = X / D;
    let ans = X % D;
    if div > K {
        println!("{}", X - K * D);
    } else if (K - div) % 2 == 0 {
        println!("{}", ans);
    } else {
        println!("{}", (ans - D).abs());
    }
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;

string s1, s2, s3;

void solve()
{
    cin >> s1 >> s2 >> s3;
    cout << char(s1[0]+'A'-'a') << char(s2[0]+'A'-'a') << char(s3[0]+'A'-'a') << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();

    return 0;
}

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

int main(){

    set<ll>S;
    for(ll i = 1; i <= 100000; i *= 6)S.insert(i);
    for(ll i = 1; i <= 100000; i *= 9)S.insert(i);
    ll N;
    cin >> N;
    vector<ll>dp(N+1, N);
    dp[0] = 0;
    for(ll i = 0; i < N; i++){
        for(set<ll>::iterator it = S.begin(); it != S.end(); it++){
            ll nxt = *it + i;
            if(nxt > N)break;
            dp[nxt] = min(dp[nxt], dp[i] + 1);
        }
    }
    cout << dp[N] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
const int N = 2e5 + 1;
int n,k,p[N],bit[N],ans;
void add(int at,int val){
	for(int cur = at;cur < N;cur+=cur&(-cur))bit[cur]+=val;
}
int get(int at){
	int ret = 0;
	for(int cur = at;cur;cur-=cur&(-cur))ret+=bit[cur];
	return ret;
}
bool did;
int main(){
	//freopen("input.txt","r",stdin);
	scanf("%d%d",&n,&k);
	for(int i = 0;i < n;i++)scanf("%d",p + i),p[i]++;
	bool lastf = 0;
	long long inv = 0;
	for(int i = 0;i < k;i++){
		inv+=-get(p[i]) + i;
		add(p[i],1);
	}
	if(get(p[0]) - 1)lastf = 1;
	ans+=!!inv;
	did|=!inv;
	for(int i = k;i < n;i++){
		add(p[i - k],-1);
		inv-=get(p[i - k]);
		inv+=k - 1 - get(p[i]);
		add(p[i],1);
		bool curf = get(p[i - k + 1]) - 1;
		bool cure = k - get(p[i]);
		if(lastf || cure)ans+=!!inv;
		lastf = curf;
		did|=!inv;
	}
	printf("%d\n",ans + did);
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<set>

using namespace std;

struct cube{
  int x,y,z;
};

bool operator<(const cube& left, const cube& right){
  if(left.x != right.x)return left.x < right.x ;
  if(left.y != right.y)return left.y < right.y ;
  return left.z < right.z ;
}


int main(void){
  set<cube>st;
  string c;
  int n,h,a,b;

  while(cin >> n >> h,n|h){
    st.clear();
    
    for(int i=0;i<h;i++){
      cin >> c >> a >> b;

      cube in;
    
      if(c=="xy"){
	in.x=a;
	in.y=b;
	for(int j=1;j<=n;j++){
	  in.z=j;
	  st.insert(in);
	}
      }
      else if(c=="xz"){
	in.x=a;
	in.z=b;
	for(int j=1;j<=n;j++){
	  in.y=j;
	  st.insert(in);
	}	
      }
      else if(c=="yz"){
	in.y=a;
	in.z=b;
	for(int j=1;j<=n;j++){
	  in.x=j;
	  st.insert(in);
	}
      }
    }
      cout << n*n*n-st.size() << endl;
  }

  return 0;
}

Measured memory_bytes: 4332
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;
typedef pair<int, int> P;

int V, E;
vector<int> G[100005];
vector<P> bridge;
int pre[100005], low[100005];

int id = 1;
int bridge_dfs(int v, int prev)
{
	pre[v] = id++;
	int ret = pre[v];
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == prev) continue;
		if(pre[G[v][i]]) ret = min(ret, pre[G[v][i]]);
		else ret = min(ret, bridge_dfs(G[v][i], v));
	}
	return low[v] = ret;
}
void findBridge()
{
	bridge_dfs(1, -1);
	for(int i = 1; i <= V; i++){
		for(int j = 0; j < G[i].size(); j++){
			if(pre[i] < pre[G[i][j]] && low[G[i][j]] > pre[i]) bridge.push_back(make_pair(i, G[i][j]));
		}
	}
}

int main(void)
{
	cin >> V >> E;
	int u, v;
	for(int i = 1; i <= E; i++){
		cin >> u >> v;
		u++, v++;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	
	findBridge();
	
	for(int i = 0; i < bridge.size(); i++){
		if(bridge[i].first > bridge[i].second) swap(bridge[i].first, bridge[i].second);
	}
	sort(bridge.begin(), bridge.end());
	
	for(int i = 0; i < bridge.size(); i++){
		cout << bridge[i].first-1 << " " << bridge[i].second-1 << endl;
	}
	
	return 0;
}


Measured memory_bytes: 6880
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int n;
    cin >> n;
    int w[n];
    int sum = 0;
    rep(i,n){
        cin >> w[i];
        sum+=w[i];
    }
    int tem=0;
    int ans = sum;
    for(int i = 0;i<n;i++){
        tem+=w[i];
        ans = min(ans,abs(sum-2*tem));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
r,c=map(int,input().split())
a = []
for i in range(r):
    a.append(list(map(int, input().split())))
    a[i]+=[sum(a[i])]
    print(*a[i])
a=list(zip(*a[::-1]))
for i in range(c):
    print(sum(a[i]),end=' ')
print(sum(a[c]))


Measured memory_bytes: 5776
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int x, a, b;
  cin >> x >> a >> b;

  x -= a;
  x -= b * (x / b);

  // 解答
  cout << x << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k;
long long ans;
int t;
int main() {
	cin>>n>>k;
	if(k%2) {
		t=n/k;
		for(int i=0;i<t;i++)
			for(int j=0;j<t;j++) 
				for(int l=0;l<t;l++) 
					ans++;
		cout<<ans;
	} 
	if(k%2==0) {
		t=n/(k/2);
		for(int i=1;i<=t;i+=2)
			for(int j=1;j<=t;j+=2) 
				for(int l=1;l<=t;l+=2) 
					ans++;
		t=n/k;
		for(int i=0;i<t;i++)
			for(int j=0;j<t;j++) 
				for(int l=0;l<t;l++) 
					ans++;
		cout<<ans;
	}
	return 0;
}

Measured memory_bytes: 384
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  s=S()
  t=S()

  cnt=0
  for i in range(len(s)):
    if s[i]!=t[i]:
      cnt+=1

  return cnt

# main()
print(main())


Measured memory_bytes: 10904