akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/
const int MAX = 1000;
const int base=500;

void solve(int t,int n){
  int x,y;
  bool d[MAX][MAX],used[MAX][MAX];
  int dx[6]={1,1,0,-1,-1,0};
  int dy[6]={1,0,-1,-1,-0,1};

  rep(i,MAX)rep(j,MAX){
    d[i][j]=true;
    used[i][j]=false;
  }
  
  rep(i,n){
    int a,b;
    cin>>a>>b;
    d[a+base][b+base]=false;
  }
  cin>>x>>y;
  
  queue<pi> que;
  que.push(mp(x,y));
  used[x+base][y+base]=true;
  for(int i=0;i<t;i++){
    int size=que.size();
    for(int j=0;j<size;j++){
      pi dir=que.front();que.pop();
      for(int k=0;k<6;k++){
	pi tmp=mp(dir.first+dx[k],dir.second+dy[k]);
	if(!used[tmp.first+base][tmp.second+base]&&d[tmp.first+base][tmp.second+base]){
	  que.push(tmp);
	  used[tmp.first+base][tmp.second+base]=true;
	}
      }
    }
  }
  int ans=0;
  rep(i,MAX)rep(j,MAX)ans+=used[i][j];
  cout<<ans<<endl;
}

int main(){
  int t,n;
  while(cin>>t>>n){
    if(t==0&&n==0)break;
    solve(t,n);
  }
  return 0;
}



Measured memory_bytes: 5048
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
const int nax=57;
ll mod;

int n=50;

ll pot[nax][nax];

ll wyn;

int jeszrz[nax];
int jeszkol[nax];

void ff()
{
	fflush(stdout);
}

int pyt(int a, int b, int x, int y)
{
	printf("? %d %d %d %d\n", a, x, b, y);
	ff();
	int v;
	scanf("%d", &v);
	return v;
}

int los(int a, int b)
{
	return (rand()%(b-a+1))+a;
}

void szuk(int a, int b, int x, int y, int w)
{
	if (!w)
		return;
	if (w==(b-a+1)*(y-x+1))
	{
		for (int i=a; i<=b; i++)
		{
			for (int j=x; j<=y; j++)
			{
				wyn+=pot[i][j];
				jeszrz[i]--;
				jeszkol[j]--;
			}
		}
		return;
	}
	if (x==y || (a!=b && (rand()&1)))
	{
		int s=(a+b)>>1;
		//~ int s=los(a, b-1);
		int p=pyt(a, s, x, y);
		szuk(a, s, x, y, p);
		szuk(s+1, b, x, y, w-p);
	}
	else
	{
		int s=(x+y)>>1;
		//~ int s=los(x, y-1);
		int p=pyt(a, b, x, s);
		szuk(a, b, x, s, p);
		szuk(a, b, s+1, y, w-p);
	}
}

int main()
{
	int szit;
	scanf("%d%d%d%lld", &szit, &szit, &szit, &mod);
	ll trz=1;
	for (int i=0; i<n; i++)
	{
		for (int j=0; j<n; j++)
		{
			pot[i][j]=trz;
			trz=(trz*2)%mod;
		}
	}
	for (int i=0; i<n; i++)
	{
		jeszrz[i]=pyt(i, i, 0, n-1);
		jeszkol[i]=pyt(0, n-1, i, i);
	}
	szuk(0, n-1, 0, n-1, 250);
	printf("! %lld\n", wyn%mod);
	ff();
	return 0;
}


Measured memory_bytes: 720
n,k = map(int,input().split(' '))
d = [0]*k
A = [0]*k

for i in range(k):
    d[i] = int(input())
    A[i] = [0]*d[i]
    A[i] = input().split(' ')
    for j in range(d[i]):
        A[i][j] = int(A[i][j])
N = []
for a in range(n):
    N.append(a+1)

def check(A,n,k):
    for i in range(k):
        for j in range(len(A[i])):
            if A[i][j] in N:
                N.remove(A[i][j])

check(A,n,k)
print(len(N))

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

int main(){
	std::vector<int> o;
	for(int i=1;i<=10;i++){
		int in=0;
		std::cin>>in;
		o.push_back(in);
	}
	std::sort(o.begin(),o.end());
	std::cout<<o[9]<<std::endl<<o[8]<<std::endl<<o[7]<<std::endl;
}

Measured memory_bytes: 1216
n,k,*a=map(int,open(0).read().split())
s=sum(a)
b=[]
for i in range(1,30000):b+=[s//i,i]*(s%i<1)
m=1
for i in b:c=sorted(j%i for j in a);m=max(m,i*(sum(c[:-sum(c)//i])<=k))
print(m)

Measured memory_bytes: 3060
//~ #pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//~ #pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//~ #pragma GCC target("avx2")  //Enable AVX
#include<bits/stdc++.h>
using namespace std;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=998244353;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=1000002;

void solve(){
	int n;
	cin>>n;
	vi a(n),b(n);
	cin>>a>>b;
	int moves=(3e7)/n;
	moves=min(moves,3*n);
	vector<pair<int,int>>ans(n);
	int sz=0;
	for(int i=0;i<n;i++){
		int val=a[i]^b[0];
		int cnt=moves,flag=0;
		while(cnt--){
			int z=(rng())%n;
			if((a[(z+i)%n]^val)!=b[z]){
				flag++;
				break;
			}
		}
		if(!flag){
			ans[sz++]={i,val};
		}
	}
	int xr=0,xr2=0;
	for(int i=0;i<n;i++){
		xr^=a[i];
		xr2^=b[i];
	}
	int i=0;
	for(;i<sz;i++){
		int cnt=moves+100,flag=0;
		int val=ans[i].S,j=ans[i].F;
		while(cnt--){
			int z=(rng())%n;
			if((a[(z+j)%n]^val)!=b[z]){
				flag++;
				break;
			}
		}
		int lef=0;
		if(n&1){
			lef=val;
		}
		if(flag==0&&((xr^lef)==xr2)){
			cout<<ans[i].F<<" "<<ans[i].S<<"\n";
		}
	}
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}


Measured memory_bytes: 6656
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var r = input[0];
        var D = input[1];
        long x = input[2];
        
        for (var i = 0; i < 10; i++) {
            Console.WriteLine(r * x - D);
            x = r * x - D;
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
int c=a*b;
if(c%2==0){
cout<<"Even";
system("pause");
return 0;
}
cout<<"Odd";
system("pause");
return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;



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

    vector<int> tonari[110000];

    int a,b;
    for (int i = 0; i < M; ++i) {
        cin>>a>>b; a--; b--;
        tonari[a].push_back(b);
        tonari[b].push_back(a);
    }

    vector<int> element(N,-1); //-1未確定，0偶数，1奇数

    queue<int> q;

    q.push(0);
    element[0]=0;

    bool is_nibu=true;

    while(!q.empty()){
        int node=q.front();
        q.pop();
        int nextele=(element[node]+1)%2;
        for(auto tsugi:tonari[node]){
            if(element[tsugi]==-1){
                element[tsugi]=nextele;
                q.push(tsugi);
            }else{
                if(element[tsugi]!=nextele){
                    is_nibu=false;
                    break;
                }
            }
        }
        if(!is_nibu) break;
    }

    if(is_nibu){
        int cnt=0;
        for (int i = 0; i < N; ++i) {
            if(element[i]==0) cnt++;
        }
        cout<<(ll)cnt*(N-cnt)-M<<endl;
    }else{
        cout<<(ll)N*(N-1)/2-M<<endl;
    }


    return 0;
}

Measured memory_bytes: 6400
#include<iostream>
using namespace std;
#define ll long long int
int main()
{
    ll a,b,c,n;
    cin>>a>>b>>c>>n;
    ll sum=a;
    if(a>=n)
        cout<<n;
    else if(a+b>=n)
        cout<<a;
    else
        cout<<a-n+a+b;
}


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

#define FOR(i,a,b)  for(ll i=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll i=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      v.begin(), v.end()
#define UNIQ(v)     sort(ALL(v)); v.erase(unique(ALL(v)), v.end())
#define BIT(n)      (1LL<<(n))
#define DEBUG(a)    cout << #a << " = " << a << endl

const ll inf = 1e15;
const ll mod = 1e9+7;

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

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

    int s = N % 10;

    if (s == 2 || s == 4 || s == 5 || s == 7 || s == 9) {
        cout << "hon" << endl;
    } else if (s == 0 || s == 1 || s == 6 || s == 8) {
        cout << "pon" << endl;
    } else {
        cout << "bon" << endl;
    }
}


Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(int i=0; i<(n); i++)
#define REPj(n) for(int j=0; j<(n); j++)
#define REPinit(i,a,n) for(int i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(int j=(a); j<(n); j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/*
    add utility Algorithm
*/

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

    int N;
    cin >> N;

    cout << ((N + 2 - 1) / 2)   << endl;


    return 0;
}


Measured memory_bytes: 256
def gcd(x,y):
  if x<y: x,y=y,x
  while True:
    tmp=x%y
    if tmp==0:
      return y
    x,y=y,tmp

K=int(input())
ans=0
for a in range(1,K+1):
  for b in range(1,K+1):
    tmp=gcd(b,a)
    for c in range(1,K+1):
      ans+=gcd(c,tmp)
print(ans)


Measured memory_bytes: 79908
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main { 
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String[] line = sc.nextLine().split(" ");
    	int numberOne = Integer.parseInt(line[0]);
    	int numberTwo = Integer.parseInt(line[1]);
    	
    	int result = 0;
    	if(numberOne > 9 || numberTwo > 9 ) {
    		result = -1;
    	}else {
    		result = numberOne*numberTwo;
    	}
    	System.out.println(result);
    	
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define lint long long
#define ldouble long double
#define all(a) (a).begin(),(a).end()
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


int main(){
    ios_base::sync_with_stdio(0);
    string s,t;
    cin >> s >> t;
    
    int n = (int)s.size();
    int m = (int)t.size();

    vector<vector<int>>dp(n+1,vector<int>(m+1,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i-1] == t[j-1]){
                dp[i][j] = max(dp[i][j],1+dp[i-1][j-1]);
            }
            dp[i][j] = max(dp[i][j],dp[i-1][j]);
            dp[i][j] = max(dp[i][j],dp[i][j-1]);
        }
    }

    string ans="";
    int i=n,j=m;
    while( i>0 && j>0 ){
        if(s[i-1] == t[j-1]){
            ans += s[i-1];
            i--;
            j--;
        }else{
            if(dp[i-1][j] > dp[i][j-1]){
                i--;
            }else{
                j--;
            }
        }
    }
    reverse(all(ans));

    cout << ans << endl ;

    return 0;
}


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

typedef long long ll;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef map<int,int> mii;
typedef pair<int,int> pii; 
typedef vector<pii> vpii; 

#define int ll
#define F first 
#define S second
#define endl "\n"
#define MP make_pair
#define PB push_back
#define WL(t) while(t --) 
#define SZ(x) ((int)(x).size()) 
#define all(v) v.begin(),v.end()
#define REP(i,n) for (int i = 0; i < n;i++) 
#define FOR(i,a,b) for (int i = a; i < b; i++) 
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define REPD(i,n) for (int i = n-1; i >= 0;  i--) 
#define PRECISION(x) cout << fixed << setprecision(x);  
#define inrange(i,a,b) ((i>=min(a,b)) && (i<=max(a,b))) 
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define debug(x) cout << '>' << #x << ':' << x << endl;


const int MAXN = 1000005; 
const int MOD = 1000000007; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);} 
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));} 

 
// typedef unsigned long long int ulli;
bool isPrime(int n);
//                                               <<<  WRITE CODE HERE >>>

void solve()
{   
    int a,b;
    cin >> a >> b;
    cout << lcm(a,b);
}
signed main()
{   
   FAST_IO
    int t=1;
   // cin>>t;   
    WL(t){ solve(); cout<<endl; }
    return 0;
}



bool isPrime(int n){
    if(n<2)
        return false;
    for(int i=2;i*i<=n;i++)
        if(!(n%i))
            return false;
    return true;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  int k=0;
  int x=n;
  while(x>0){
    k+=x%10;
    x/=10;
  }
  if(k==0) cout << "No" << endl;
  else if(n%k==0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD3 1000000000
#define MOD2 998244353 
float PHI = 1.6180339;
const float  PI_F=3.14159265358979f;
#define MAX 1000 m
#define endl "\n"    
#define manhunt 32 
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define pi 3.1415926535897932384626433
//typedef long long float;
#define int long long
//#define double long double
typedef pair<int, int> pii;
//#define float unsigned long long
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define CHAR_SIZE 26 

int modpow(int x, int n, int m) { if (n == 0) return 1%m; long long u = modpow(x,n/2,m); u = (u*u)%m; if (n%2 == 1) u = (u*x)%m; return u; } 


int add(int x, int y,int m) 
{
	x += y;
	if (x >= m) return x - m;
	return x;
}
int sub(int x, int y) 
{
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
int inv(int a, int m = MOD2)
{
	return modpow(a, m - 2, m);
}
int mul(int a, int b,int m) 
{
	return (long long) a * b % m;
}


int nCrModp(int n, int r, int p) 
{ 
    int C[r+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1; 
    for (int i = 1; i <= n; i++) 
    { 
        for (int j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 

bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
    if(a.first==b.first)
    return a.second<b.second;
      return (a.first > b.first); 
       //return (a.first-a.second)>(b.first-b.second);
}

vector<int> z_function(string &s)
{
	int n=s.size();
	vector<int> z(n);
	for(int i=1,l=0,r=0;i<n;i++)
	{
		if(i<=r)
			z[i]=min(r-i+1, z[i-l]);
		while(i+z[i]<n && s[z[i]]==s[i+z[i]])
			z[i]++;
		if(i+z[i]-1>r)
			l=i, r=i+z[i]-1;
	}
	return z;
}

bool isprime(int n) 
{ 
    if (n <= 1)  return false; 
  
    for (int i=2; i*i<=n; i++) 
        if (n%i == 0) 
            return false; 
  
    return true; 
}

void SieveOfEratosthenes(int n, bool isPrime[]) 
{ 
    isPrime[0] = isPrime[1] = false; 
    for (int i=2; i<=n; i++) 
        isPrime[i] = true; 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (isPrime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                isPrime[i] = false; 
        } 
    } 
}


int32_t main()
{
    /* freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout); */
    FAST
    cout << fixed << setprecision(16);

    int n;
    cin>>n;
    vector<pii>v;
    int ok=0;
    for(int i=0;i<n;i++)
    {
        int x,y;
        cin>>x>>y;
        v.push_back({x,y});
    }
    for(int i=2;i<n;i++)
    {
        if(v[i].first==v[i].second && v[i-1].first==v[i-1].second && v[i-2].first==v[i-2].second)
        {
            ok=1;
            break;
        }
    }
    if(ok)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    
    
    
    
    return 0;
}

Measured memory_bytes: 3656
a="dream"
b="dreamer"
c="erase"
d="eraser"

ar=a[::-1]
br=b[::-1]
cr=c[::-1]
dr=d[::-1]

S=input()
Sr=S[::-1]


Sr=Sr.replace(dr,'')
Sr=Sr.replace(cr,'')
Sr=Sr.replace(br,'')
Sr=Sr.replace(ar,'')

if Sr=="":
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
    
int main() {
    int K, X;
    cin >> K >> X;
    int stonemin = X - K + 1,  stonemax = X + K;
    if (stonemin < -1000000){
        stonemin = -1000000;
    }
    if (stonemax > 1000000) {
        stonemax = 1000000;
    }
    
    for (int stone = stonemin ; stone < stonemax; stone++){
        std::cout << stone << " ";
    }
    std::cout << "\n";

    return 0;
}

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

struct edge { int to; long long cap; edge *rev; };

vector<vector<edge*> > adj(102);

void add_edge(int i, int j, long long cap) {
    edge *e = new edge{j, cap, NULL};
    edge *r = new edge{i, 0, e};
    e->rev = r;
    adj[i].push_back(e);
    adj[j].push_back(r);
}

long long maxflow(int n) {
    // 0 = src, n = sink
    long long ans = 0;
    vector<bool> used(n+1, false);
    function<long long(int, long long)> dfs = [&](int i, long long f) {
        if (i == n) return f;
        used[i] = true;
        for (edge *e : adj[i]) {
            if (e->cap <= 0 || used[e->to]) continue;
            long long f1 = dfs(e->to, min(f, e->cap));
            if (f1 > 0) {
                e->cap -= f1;
                e->rev->cap += f1;
                return f1;
            }
        }
        return 0LL;
    };
    while (long long f = dfs(0, 1LL<<60)) {
        ans += f;
        fill(used.begin(), used.end(), false);
    }
    return ans;
}

int main() {
    int n; cin >> n;
    int a[n+1]; for (int i = 1; i <= n; i++) cin >> a[i];
    constexpr long long INF = 1LL << 60;
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        if (a[i] < 0) add_edge(0, i, -a[i]);
        else if (a[i] > 0) ans += a[i], add_edge(i, n+1, a[i]);
        for (int m = 2 * i; m <= n; m += i) add_edge(i, m, INF);
    }
    cout << ans - maxflow(n+1) << endl;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int wideLength = Integer.parseInt(sc.next());
        List<Integer> topList = new ArrayList<>();
        for(int x=1; x<= wideLength; x++) {
            topList.add(Integer.parseInt(sc.next()));
        }
        List<Integer> secondList = new ArrayList<>();
        for(int x=1; x<= wideLength; x++) {
            secondList.add(Integer.parseInt(sc.next()));
        }
        int res = 0;
        for(int x=1; x<= wideLength; x++) {
            int candy = 0;
            for(int y=1; y<=x; y++) {
                candy += topList.get(y-1);
            }
            for(int y=x; y<=wideLength; y++) {
                candy += secondList.get(y-1);
            }
            res = res>=candy?res:candy;
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 21972
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

a,b=map(int,input().split())
ans=lcm(a,b)
print(ans)

Measured memory_bytes: 3060
# Volume0 0028
# Mode Value
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0028&lang=jp

data = Array.new( 101 )
101.times{ |n|
	data[ n ] = 0
}

while line = $stdin.gets
	num = line.chomp.to_i
	data[ num ] += 1
end

max = -1
1.upto( 100 ){ |n|
	max = data[ n ] if data[n] > max
}
1.upto( 100 ){ |n|
	puts n if data[n] == max	
}


Measured memory_bytes: 6084
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        N: i64,
    }
    println!("{}",(N-1)/11*2 + if (N-1)%11<6{1}else{2});
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.nextLine();
		long K = scanner.nextLong();

		StringBuilder sb = new StringBuilder();
		
		for (int i = 0; i < K; i++) {
			if (S.charAt(i) == '1') {
				continue;
			}
			System.out.println(S.charAt(i));
			return;
		}
		System.out.println(1);
		scanner.close();
	}
}

Measured memory_bytes: 21844
/*
 * Problem Description: 8 Puzzle
 * Category: Heuristic Search
 * Author: Khan
 * Date: 22th October, 2017
 */

#include <iostream>
#include <cmath>
#include <string>
#include <map>
#include <queue>

using namespace std;
#define N 3
#define N2 9

struct Puzzle
{
    int f[N2];
    int space;
    string path;

    bool operator < (const Puzzle &p) const
    {
        for (int i = 0; i < N2; ++i)
        {
            if(f[i] == p.f[i])
                continue;
            return f[i] > p.f[i];
        }
        return false;
    }
};

static const int dx[4] = {-1, 0, 1, 0};
static const int dy[4] = {0, -1, 0, 1};
static const char dir[4] = {'u', 'l', 'd', 'r'};

bool isTarget(Puzzle p)
{
    for (int i = 0; i < N2; ++i)
        if(p.f[i] != (i + 1))
            return false;
    return true;
}

string bfs(Puzzle s)
{
    queue<Puzzle> Q;
    map<Puzzle, bool> V;
    Puzzle u, v;
    s.path = "";
    Q.push(s);
    V[s] = true;

    while(!Q.empty())
    {
        u = Q.front(); Q.pop();
        if(isTarget(u))
            return u.path;
        int sx = u.space / N;
        int sy = u.space % N;
        for (int r = 0; r < 4; ++r)
        {
            int tx = sx + dx[r];
            int ty = sy + dy[r];
            if(tx < 0 || ty < 0 || tx >= N || ty >= N)
                continue;
            v = u;
            swap(v.f[u.space], v.f[tx * N + ty]);
            v.space = tx * N + ty;
            if(!V[v])
            {
                V[v] = true;
                v.path += dir[r];
                Q.push(v);
            }
        }
    }
    return "unsolvable";
}

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    Puzzle in;

    for (int i = 0; i < N2; ++i)
    {
        cin >> in.f[i];
        if(in.f[i] == 0)
        {
            in.f[i] = N2;
            in.space = i;
        }
    }
    string ans = bfs(in);
    cout << ans.size() << endl;
    return 0;
}

Measured memory_bytes: 30540
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;

int N;
string s[300];

bool check(int k){
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(s[i][j]!=s[(j+k)%N][(i+N-k)%N]) return false;
        }
    }
    return true;
}

int main(){
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> s[i];
    }
    LL ans=0;
    for(int k=0;k<N;k++){
        if(check(k)) ans+=N;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
using ll = long long;

using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;
using Matrix = vector<vector<ll>>;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

const long long INF = 1LL<<60;
const int mod = 1000000007;

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

int N;
ll K;
Matrix A;

Matrix matmul(Matrix &A, Matrix &B) {
    Matrix res(N, vector<ll>(N, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < N; k++) {
                res.at(i).at(j) = (res.at(i).at(j) + A.at(i).at(k) * B.at(k).at(j)) % mod;
            }
        }
    }
    return res;
}

Matrix matpow(Matrix M, ll k) {
    Matrix res(N, vector<ll>(N, 0));
    for (int i = 0; i < N; i++) res.at(i).at(i) = 1;

    while (k > 0) {
        if (k & 1) res = matmul(res, M);
        M = matmul(M, M);
        k >>= 1;
    }
    return res;
}


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

    cin >> N >> K;
    A.assign(N, vector<ll>(N));

    REP(i, N) {
        REP(j, N) {
            cin >> A.at(i).at(j);
        }
    }

    A = matpow(A, K);

    ll ans = 0;
    REP(i, N) {
        REP(j, N) {
            ans += A.at(i).at(j);
            ans %= mod;
        }
    }

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

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int const INF = 1001001001;


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

int K,T;
cin >> K >> T;
vi a(T);
rep(i,T) cin >> a[i];

sort(all(a));
int A = a[T-1];
int ans = max(A - 1 - (K - A), 0);

cout << ans << endl;

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m=numeric_limits<T>::max()){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


int main() {
  string s; cin >>s;
  vector<int> alph(3);
  int n = s.size();
  rep(i, n) alph[s[i] - 'a']++;
  sort(all(alph));
  bool ok = alph[2]-alph[0] < 2;
  cout <<(ok ? "YES" : "NO") <<endl;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int n; cin >> n;
  vector<P> robot(n);
  rep(i, n) {
    ll x, l; cin >> x >> l;
    robot[i] = make_pair(x-l, x+l);
  }
  auto comp = [&](P a, P b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
  };

  sort(ALL(robot), comp);
  int ans = 0;
  ll lim = -INF64;
  rep(i, n) {
    if(robot[i].first < lim) continue;
    ++ans;
    lim = robot[i].second;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4060
<?php
$tmp = [];
while ($line = fgets(STDIN)) {
    $tmp[] = trim($line);
}


list($H, $W) = explode(' ', $tmp[0]);

$S = [];
for ($i = 1; $i <= $H; $i++) {
    $S[] = str_split($tmp[$i]);
}

$checkList = [[0, 1], [1, 0], [1, 1], [-1, -1], [-1, 1], [1, -1], [0, -1], [-1, 0]];

$results = [];
for ($i = 0; $i < $H; $i++) {
    for ($p = 0; $p < $W; $p++) {

        if ($S[$i][$p] === '#') {
            $results[$i][$p] = '#';
            echo('#');
            continue;
        }
        $results[$i][$p] = 0;

        for ($k = 0; $k < 8; $k++) {
            $target = $S[$i + $checkList[$k][0]][$p + $checkList[$k][1]] ?? null;
            if (!is_null($target) && $target === '#') {
                $results[$i][$p]++;
            }
        }
        echo $results[$i][$p];
    }
    if ($i !== $H - 1)
        echo("\n");
}


Measured memory_bytes: 4604
#include<iostream>
using namespace std;
char d[10];
bool a(int n){
	int k;
	while(true){
		for(int j=0;j<10;j++){
//			cout<<"n%10"<<n%10<<endl<<"d[j]"<<d[j]-'0'<<endl;
			if(n%10==d[j]-'0'&&d[j]!='/0'){
//				cout<<endl;
				return false;
			}
		}
		n/=10;
		if(!n){
//			cout<<n;
			return true;
		}
	}
}
int main(){
	int k,n;
	cin>>n>>k;
	for(int i=0;i<k;i++){
		cin>>d[i];
	}
	while(true){
		if(a(n)==true){
			cout<<n;
			return 0;
		}
		n++;
	}
	return 0;
}

Measured memory_bytes: 256
// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
 
#define mp make_pair
#define bp __builtin_popcountll
#define MOD  1000000007
const int N = 100005;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));

void solve()
{
    ll h,w,k;
    cin >> h >> w >> k;
    string s[h];
    for(ll i=0;i<h;i++)   cin >> s[i];
    ll ans = 0;
    for(ll mask=0;mask<(1<<h);mask++)
    {
        bool row[h] = {0};
        for(ll i=0;i<h;i++)
        {
            if((mask&(1<<i)))  row[i] = 1;
        }
        for(ll mask1=0;mask1<(1<<w);mask1++)
        {
            bool col[w] = {0};
            for(ll i=0;i<w;i++)
            {
                if((mask1&(1<<i)))   col[i] = 1;
            }
            ll sum = 0;
            for(ll i=0;i<h;i++)
            {
                for(ll j=0;j<w;j++)
                {
                    if(row[i] && col[j] && s[i][j]=='#')   sum++;
                }
            }
            if(sum==k)  
            {
                ans++;
            }
        }
    }
    cout<<ans;
}

int main()
{
    FAST;
    ll t = 1;
  //  cin >> t;
    while(t--)
    {
      solve();
    }
}

Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Comparator;
import java.util.Set;

public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値リスト用 int
    static List<Integer> inputIntList() throws Exception {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    }

    // 標準入力数値配列用 integer 降順ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
        // write your code here
        String s = br.readLine();
        char[]chars = s.toCharArray();
        Set<Character> set = new HashSet<>();
        for (char c : chars) {
            set.add(c);
        }
        for (char i = 'a'; i <= 'z'; i++) {
            if (!set.contains(i)) {
                System.out.println(i);
                return;
            }
        }

        System.out.println("None");

    }

}



Measured memory_bytes: 35496
#include<iostream>
using namespace std;
long long a,b,c,k;
int main(){
cin>>a>>b>>c;
if(b>=a){
cout<<1<<endl;
return 0;}
if(c>=b){
cout<<-1<<endl;
return 0;}
if((a-b)%(b-c)>=1)k=1;
cout<<((a-b)/(b-c)+k)*2+1<<endl;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define pi 3.14159265358979323846
#define Endl endl
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
signed main(){
	int n;
	cin >> n;
	string s;
	vector<int> a(n);
	cin>>s;
	for(int i=0;i<n;i++){ a[i] = s[i] - '0'; }
	vector<int> b(n);
	bool alltwo = true;
	for(int i=0;i<n-1;i++){
		b[i] = abs( a[i] - a[i+1] );
		if( b[i] == 1 ) alltwo = false;
	}
	int ans = 0;
	if( alltwo ){
		for(int i=0;i<n-1;i++){
			bool coe = ( (n-2 & i) == i );
			if( b[i] == 2 && coe ) ans += 1;
			ans %= 2;
		}
		if( ans % 2 == 1){
			cout<<2<<endl;
			return 0;
		}
		else{
			cout<<0<<Endl;
			return 0;
		}
	}
	else{
		for(int i=0;i<n-1;i++){
			bool coe = ( (n-2 & i) == i );
			if( b[i] == 1 && coe ) ans += 1;
			ans %= 2;
		}
		cout<< ans % 2 <<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 17028
using System;
class FiveVariables
    {
        static void Main(string[] args)
        {
            string[] input= Console.ReadLine().Split();
            int[] x = new int[input.Length];
            int output = 0;
            for(int i = 0; i < input.Length; i++)
            {
                x[i] = int.Parse(input[i]);
            }
            for (int i = 0; i < input.Length; i++)
            {
                if (x[i] == 0)
                {
                    output = i + 1;
                }
            }
            Console.WriteLine(output);
        }
    }

Measured memory_bytes: 27232
#include <bits/stdc++.h>
#define MAXN 100005
using namespace std;

int n, a[MAXN], b[MAXN];
vector<pair<int, int>> ord;

int getVal(const pair<int, int> &x) {
    return (x.second == 0) ? a[x.first] : b[x.first];
}

struct Comp {
    bool operator()(const pair<int, int> &x, const pair<int, int> &y) const {
        return make_pair(getVal(x), (x.first << 1) | x.second) < make_pair(getVal(y), (y.first << 1) | y.second);
    }
};

int main() {
    ios::sync_with_stdio(0);

    cin >> n;

    long long Sa = 0, Sb = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i] >> b[i];
        ord.push_back(make_pair(i, 0));
        ord.push_back(make_pair(i, 1));
        Sa += a[i];
        Sb += b[i];
    }
    long long sol = min(Sa, Sb);

    sort(ord.begin(), ord.end(), Comp());

    set<pair<int, int>, Comp> s;
    long long S = 0;
    for (int i = 0; i < n; ++i) {
        s.insert(ord[i]);
        S += getVal(ord[i]);
    }

    for (int i = 1; i <= n; ++i) {
        int cnt = 0;
        long long crtS = S;
        if (s.count({i, 0})) {
            ++cnt;
            crtS -= getVal({i, 0});
        }
        if (s.count({i, 1})) {
            ++cnt;
            crtS -= getVal({i, 1});
        }

        for (int j = n; cnt > 0; ++j) {
            if (ord[j].first != i) {
                --cnt;
                crtS += getVal(ord[j]);
            }
        }

        sol = min(sol, crtS);
    }

    cout << sol << "\n";

    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define IREP(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define IMAX INT_MAX
#define IMIN INT_MIN
#define LMAX LLONG_MAX
#define LMIN LLONG_MIN
template<typename T> inline void chmin(T &a, T b){ if(a > b) a = b; }
template<typename T> inline void chmax(T &a, T b){ if(a < b) a = b; }
template<typename T> inline void xch(T &a, T &b){ T w = a; a = b; b = w; }


int main() {
    ll A, B, K;
    cin >> A >> B >> K;
    ll MIN = LMAX;
    MIN = min(A, K);
    cout << A - MIN << " " << B - min(B, K - MIN) << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<random>
using namespace std;
 
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
const double eps = 1e-6;



/////////////////////////////////////////////

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

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

////////////////////////////////

#define int long long

void solve(){

	int n;
	cin>>n;

	int ans = 0;

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

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

			for(int k = 1 ; k <= n ; ++k){


				int g = __gcd(i , j);

				g = __gcd(g , k);

				ans+=g;
			}
		}
	}

	cout<<ans<<endl;
}

signed main(){

    fast;
    int t = 1;
    //cin>>t;
    for(int i = 1 ; i <= t ; ++i){

    	solve();
    	
    	//cout<<"Case #"<<i<<": ";
    }
}


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

using namespace std;

int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif // LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int l, r;
    cin >> l >> r;
    long long ans = 1e9;
    for (int i = l; i <= min(l + 2019, r); i++) {
        for (int j = i + 1; j <= min(l + 2019, r); j++) {
            ans = min(ans, ((long long)i * j) % 2019);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


N,K = map(int,input().split())
W = []
for _ in range(N):
    W.append(int(input()))


def is_OK(P):
    track_index = 0
    w_index = 0
    while w_index < N and track_index < K:
        tmp_sum = 0
        while  w_index < N and tmp_sum+W[w_index] <= P:
            tmp_sum += W[w_index]
            w_index += 1
        track_index += 1
    return w_index == N

L = 0
R = 100000*100000
mid = (L+R)//2
ans = R

while L <= R:
    if is_OK(mid):
        ans = mid
        R = mid-1
    else:
        L = mid+1
    mid = (L+R)//2

print("%d"%ans)



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

int main(){
    int q;
    cin >> q;
    set<int> s;
    for(int i=0; i<q; i++){
        int a, x;
        cin >> a >> x;
        if(a == 0){
            s.insert(x);
            cout << s.size() << endl;
        }else{
            cout << s.count(x) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 12376
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000")

using namespace std;

const double g=10.0,eps=1e-7;
const int N=1500+10,maxn=500+100,inf=0x3f3f3f;

ll a[N];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,ans=0;
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    while(1){
        ll maxx=-1e17,id;
        for(int i=0;i<n;i++)
        {
            if(a[i]>maxx)
            {
                maxx=a[i];
                id=i;
            }
        }
        if(maxx<n)break;
        for(int i=0;i<n;i++)
        {
            if(i==id)a[i]%=n;
            else a[i]+=maxx/n;
        }
        ans+=maxx/n;
    }
    cout<<ans<<endl;
    return 0;
}
/*********************
10
1000 193 256 777 0 1 1192 1234567891011 48 425
*********************/


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    for(int i = 1; ; i++){
      int x = sc.nextInt();
      if(x == 0){
        break;
      }else{
        System.out.println("Case "+i+": "+x);
      }
    }
  }
}



Measured memory_bytes: 41528
#include<stdio.h>
int main(void) {
	int i;
	int n, a = 0, b = 0;
	char s[110];
	scanf("%d%s", &n, s);
	for (i = 0; i < n; i++)
	{
		if (s[i] == '(')	b++;
		else if (b > 0)	b--;
		else a++;
	}
 
	for (int j = 0; j < a; j++)	printf("(");
	printf("%s", s);
	for (int j = 0; j < b; j++)	printf(")");
	return 0;
}

Measured memory_bytes: 128