akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define sync()      ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fileIO()    freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
#define F           first
#define S           second
#define ers         erase
#define ins         insert
#define db          pop_back
#define pb          push_back
#define df          pop_front
#define pf          push_front
#define SZ(x)       ((ll)x.size())
#define sqr(x)      (x)*(x)
#define Blz(x)      __builtin_clz(x)
#define Brz(x)      __builtin_ctz(x)
#define Bones(x)    __builtin_popcount(x)
#define all(x)      x.begin(),x.end()
#define kill(x)     return cout<<x,0
#define dbgp(x)     cerr<< #x << " = " << x.F << ", " << x.S << endl
#define dbg(x)      cerr<< #x << " = " << x << endl
#define ddbg(i,x)   cerr<< #i << " = " << i << " / "; dbg(x[i])
#define tdbg(i,E,x) cerr<< #i << " = " << i << " / "; ddbg(E,x[i])
typedef long long                                 ll;
typedef long double                               ld;
typedef unsigned short int                        usi;
typedef pair<long long,bool>                      plb;
typedef pair<long long,long long>                 pll;
typedef string                                    str;
typedef priority_queue<ll>                        maxheap;
typedef priority_queue<ll,vector<ll>,greater<ll>> minheap;
typedef priority_queue<pll,vector<pll>,greater<pll>> djq;
const ll maxn=1e5+12, inf=4e18, mod=1e9+7; const ld pi=3.14159265359, eps=1e-9;
ll n;
vector<ll> g[maxn];
ll dp[maxn][2];
void dfs(ll v=1,ll p=0){
    for(ll u:g[v]) if(u!=p) dfs(u,v);
    dp[v][0]=dp[v][1]=1;
    for(ll u:g[v]){
        if(u==p) continue;
        dp[v][0]*=(dp[u][0]+dp[u][1]); dp[v][0]%=mod;
        dp[v][1]*=dp[u][0];            dp[v][1]%=mod;
    }
    //dbg(v);dbg(dp[v][0]);dbg(dp[v][1]);
}
int main(){
    sync();
    cin>>n;
    ll v,u;
    for(int i=0;i<n-1;i++){
        cin>>v>>u;
        g[v].pb(u); g[u].pb(v);
    }
    dfs();
    cout<<(dp[1][0]+dp[1][1])%mod;
    return 0;
}
/**
 (                            )   (   )
 )\ )             (      )  ( /(  () /(
(()/(  (  (    (  )\  ( /(  )\()) )\ ())
 /(_))_)  )\   )\((_) )(_))(_)\) ((_)(_)
(_)) __| ((_) ((_)| |((_)_)| |(_)| |_| |
  | (_ |/ _ \/ _ \| |/ _` || / / |  _  |
   \___|\___/\___/|_|\__,_||_\_\ |_| |_|
**/


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

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

    string S;

    cin >> S;

    rep(i, S.size())
    {
        cout << "x";
    }

    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
n = input()
nums = list(map(int, input().split()))
dic = defaultdict(int)
for num in nums:
    dic[num] += 1
keys = sorted(list(dic.keys()))
cnt = 1
for key in keys:
    cnt = max(dic[key] + dic[key + 1] + dic[key - 1], cnt)
print(cnt)

Measured memory_bytes: 19416
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <iterator> 
using namespace std;

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)

#define nl '\n'
#define ioi exit(0);


#define PI 3.14159265

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};

// random generator function:
//~ bool valid(string& s) {
	//~ int m = (int)s.size()/2;
	//~ for (int i = 0; i < m; i++)
		//~ if(s[i] == ')')
			//~ return false;
	//~ return true;
//~ }
//~ int cnt = 0;
//~ vector <int> findLexSmallest(string s) {
	//~ int n = (int)s.size();
	//~ vector<int> ans;
	//~ while (!valid(s)) {
		//~ for (int i = 0; i < n; i++) {
			//~ if (i+ 1 < n && s[i] == ')' && s[i+1] == '(') {
				//~ char c = s[i];
				//~ s.erase(i,1);
				//~ s += c;
				//~ ans.push_back(i);
				//~ ans.push_back(i);
				//~ ans.push_back(n-1);
				//~ cnt++;
			//~ }
		//~ }
	//~ }
	//~ cout<<s<<endl;
	//~ return ans;
//~ }

//~ string compare(string & s1, string& s2) {
	//~ if (s1.size() == s2.size()) {
		//~ int n = min(s1.size(), s2.size());
		//~ for (int i = 0; i < n; i++) {
			//~ if (s1[i] == s2[i]) continue;
			//~ if (s1[i] < s2[i]) {
				//~ return s2;
			//~ }
			//~ else
				//~ return s1;
		//~ }
	//~ }
	//~ return s1.size() > s2.size() ? s1 : s2;
//~ }

//~ int cnt = 0;
//~ string ans;
//~ vector<int> c;
//~ bool vis[10][5001];
//~ int m;
//~ void solve(int n, string& str, int target) {
	
	//~ if (n >= 0 && vis[n][target])
		//~ return;
	//~ if (n < 0 || target <= 0) {
		
		//~ if(target == 0) {
			//~ sort(str.begin(), str.end());
			//~ cout<<target<<" "<<str<<endl;
			//~ if (cnt == 0) {
				//~ ans = str;
			//~ }
			//~ else {
				//~ ans = compare(ans, str);
			//~ }
		//~ }
		//~ return;
	//~ }	
	//~ for (int k = 0; k < m; k++) {
		//~ str += ((k+1) + '0');
		//~ solve(n-1, str, target - c[k]);
		//~ str.pop_back();
	//~ }
	//~ vis[n][target] = true;
//~ }
//~ string largestNumber(vector<int>& cost, int target) {
  //~ clr(vis,false);
  //~ c = cost;
  //~ int n = (int)cost.size();
  //~ m = n;
  //~ string str = "";
  //~ solve(n, str, target); 
  //~ return ans;
//~ }
  

// Driver code 
int main() 
{ 
	int k; cin >>k;
	string s; cin>> s;
	if (k < (int)s.size()) {
		string ans = "";
		for (int i = 0; i < k; i++) {
			ans += s[i];
		}
		ans += "...";
		cout<<ans;
	}
	else
		cout<<s;
  return 0; 
} 



Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int h,w,k;
  cin>>h>>w>>k;
  long long int all=0;
  vector<vector<char>> grid(h,vector<char>(w));
  vector<long long int> tate(w,0);
  vector<long long int> yoko(h,0);
  for(long long int i=0; i<h; i++){
    long long int pre=0;
    for(long long int j=0; j<w; j++){
      cin>>grid.at(i).at(j);
      if(grid.at(i).at(j)=='#'){
        tate.at(j)++;
        pre++;
        all++;
      }
    }
    yoko.at(i)=pre;
  }
  long long int ans=0;
  for(long long int i=0; i<(1<<h); i++){
    for(long long int j=0; j<(1<<w); j++){
      bitset<7> a(i);
      bitset<7> b(j);
      long long int pre=0;
      vector<long long int> bef;
      for(long long int l=0; l<h; l++){
        if(a.test(l)){
          pre+=yoko.at(l);
          bef.push_back(l);
        }
      }
      for(long long int l=0; l<w; l++){
        if(b.test(l)){
          pre+=tate.at(l);
          for(long long int k=0; k<bef.size(); k++){
            if(grid.at(bef.at(k)).at(l)=='#'){
              pre--;
            }
          }
        }
      }
      if(all-pre==k){
        ans++;
      }
    }
  }
  cout<<ans<<endl;
}

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

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	char c;
	cin >> c;
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
		cout << "vowel\n";
	else
		cout << "consonant\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
typedef pair<pll, pll> P;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//



int main() {
	int a[3];
	REP(i, 3) cin >> a[i];
	
	sort(a, a + 3, greater<int>());
	
	cout << a[0] * 10 + a[1] + a[2] << endl;
	
	
	return 0;
}

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

int main() {
     
    int n, k; cin >> n >> k;
    const int p = 200010;
    vector<int> num(p,0);
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        num[a]++;
    }
    sort(num.begin(), num.end(), greater<int>());

    int ans = 0;
    if (num[k] == 0) {
        cout << ans << endl;
        return 0;
    }

    for (int i = k; i < p; i++) {
        if (num[i] == 0) break;
        ans += num[i];
    }
 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
N,K= map(int,input().split())
D = [int(j) for j in input().split()]
D2 = list(set([i for i in range(0,10)])-set(D))
def f(N,D):
    if len(set([int(i) for i in list((str(N)))])&set(D))==0:
        return True
    else:
        return False
if len(D2) ==0:
    print(N)
else:
    while not f(N,D):
        N+=1
print(N)

Measured memory_bytes: 3060
def main():
	k=int(input())
	inp = [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]
	print(inp[k-1])
	#print(inp)
	
main()

Measured memory_bytes: 2940
#include<stdio.h>
#include<stdlib.h>

int main()
{
	int a[3],max,min;
	scanf("%d%d%d", &a[0], &a[1], &a[2]);
	max = a[0];
	for (int i = 1; i < 3; i++)
	{
		if (max < a[i])
			max = a[i];
	}
	min = a[0];
	for (int i = 1; i < 3; i++)
	{
		if (min > a[i])
			min = a[i];
	}
	printf("%d", max - min);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner
import java.io.PrintWriter

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val pw = new PrintWriter(System.out)

    val n = sc.nextInt()
    val d = Seq.fill(n)(sc.nextInt())
    var sum = 0;
    for (i <- 0 until n) {
      for (j <- i + 1 until n) {
        sum += d(i) * d(j);
      }
    }
    pw.println(sum)

    pw.flush()
  }
}

Measured memory_bytes: 25792
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define maxn 200005
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second

int n,cnt; ll k;
int a[maxn],now[maxn],nxt[maxn],id[maxn];
pair<int,ll> b[maxn];

inline int read(){
    int x=0,f=1; char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}

bool vis[maxn];
int top,stack[maxn];

void brute_force(int x){
	for (int i=x;i<=n;i++){
		if (!vis[a[i]]) vis[a[i]]=1,stack[++top]=a[i];
		else{while (stack[top]!=a[i]) vis[stack[top]]=0,--top; --top,vis[a[i]]=0;}
	}
	for (int i=1;i<=top;i++) printf("%d%c",stack[i],i==top?'\n':' ');
}

int main(){
	n=read(); cin>>k;
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=n;i;i--) nxt[i]=now[a[i]],now[a[i]]=i;
	for (int i=n;i;i--) if (!nxt[i]) nxt[i]=now[a[i]];
	int pos=1; b[++cnt]=mp(pos,k); id[1]=1;
	if (k!=1){
		while (1){
			if (nxt[pos]<=pos) --k; pos=nxt[pos]+1;
			if (k==1) break;
			if (pos>n) pos=1,--k;
			if (k==1) break; if (id[pos]) break;
			id[pos]=++cnt; b[cnt]=mp(pos,k);
		}
	}
	if (k==1){brute_force(pos); return 0;}
	int x=b[id[pos]].ss-k; k%=x;
	for (int i=id[pos];i<=cnt;i++) if (b[id[pos]].ss-b[i].ss==k-1){brute_force(b[i].ff); return 0;}
    return 0;
}


Measured memory_bytes: 8192
t=int(input())
for _ in range(0,t):
    n,k= map(int,input().strip().split())
    x= list(map(int,input().split()))
    y=[]
    for i in range(1,n):
        y.append(x[i]-x[i-1])
    y.sort()
    count=0
    if k<n :
        for i in range(0,n-k):
            count+=y[i]
    else:
        count=0
    print(count)


Measured memory_bytes: 21304
S = list(input())
T = list(input())
sl = len(S)
tl = len(T)


# 辞書順最小の文字列を出力するため、
# できるだけ’?'は'a'で置き換えたいので、後ろから探索する
flag = False
for i in range(sl - tl, -1, -1):
    P = S[i:i+tl]
    for p, t in zip(P, T):
        if p != '?' and p != t:
            break
    else:  #合致する文字列が存在した
        S[i:i+tl] = T
        flag = True
        break

if flag:        
    print(''.join(['a' if s == '?' else s for s in S]))
else:
    print('UNRESTORABLE')

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int N, K;
	static int[][] g;

	public static void main(String[] args) {
		while (true) {
			N = sc.nextInt();
			if (N == 0) break;
			int[] stack = new int[N + 1];
			int top = 0;
			int color = sc.nextInt();
			for (int i = 1; i < N; ++i) {
				int cur = sc.next().charAt(0) - '0';
				if (color == cur) continue;
				color = cur;
				if (i % 2 == 0) {
					stack[top++] = i;
				} else {
					if (top > 0) --top;
				}
			}
			stack[top++] = N;
			int ans = 0;
			int cur = 0;
			for (int i = 0; i < top; ++i) {
				if (i % 2 == 0) ans += stack[i] - cur;
				cur = stack[i];
			}
			if (color == 0 ^ top % 2 != 0) ans = N - ans;
			System.out.println(ans);
		}
	}

}

Measured memory_bytes: 13000
#include<stdio.h>

int main(void)
{
  int n,k;
  scanf("%d%d",&n,&k);
  int c=0,h[n],i;
  for(i=0;i<n;i++){
    scanf("%d",&h[i]);
    if(h[i]>=k)
      c++;
  }
  printf("%d\n",c);
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;
const int FIVE = 101010;

//=============================
int N, M, K;
string S, T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin >> S;
}
//=============================
void func() {}
//=============================
void solve()
{
    int N = S.size();
    int l = 77;
    vector<vector<int>> DP(l + 1, vector<int>(N, -1));
    rep(i, N)
    {
        DP[0][i] = i + (S[i] == 'R' ? 1 : -1);
    }
    rep(i,N){
    }
    for (int k = 0; k < l; ++k)
    {
        rep(i, N)
        {
            DP[k + 1][i] = DP[k][DP[k][i]];
        }
    }

    vector<int> aa(N);
    for(auto x : DP[l]){ // 2^l 回操作したときの答え
        aa[x]++;
    }
    rep(i, N)
    {
        cout << aa[i] << (i == N - 1 ? "\n" : " ");
    }

}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 62576
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#define Inf 1000000000000000ll
#define ll long long
using namespace std;

vector<int> edges[111111];

vector<int> path_;
void dfs(int par, int u, int N, vector<int>* verts) {
    if (u == N) {
        path_ = *verts;
        return;
    }
    
    verts->push_back(u);
    for(int j=0;j<edges[u].size();j++) {
        int v = edges[u][j];
        if (v != par) {
            dfs(u,v,N,verts);
        }
    }
    verts->pop_back();
    
}


int dfs2(int par, int u, int block) {
    if (u == block)
        return 0;
    int ret = 1;
    for(int j=0;j<edges[u].size();j++) {
        int v = edges[u][j];
        if (v != par)
            ret += dfs2(u,v,block);
    }
    return ret;
}



int main() {
    int N;
    cin>>N;
    for(int i=1;i<=N-1;i++) {
        int u,v;
        cin>>u>>v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    
    vector<int> verts;
    dfs(-1, 1, N, &verts);
    path_.push_back(N);
    

    int x = path_.size()-2;
    // (x+1)/2 and x-(x+1)/2
    int block = path_[(x+1)/2+1];

    
    int ct = dfs2(-1,1,block);
    if (ct-1>N-1-ct)
        printf("Fennec\n");
    else
        printf("Snuke\n");
    
    
}

Measured memory_bytes: 13560
#include<stdio.h>
#include<stdlib.h>

typedef struct directedGraph{
  int *vertex;
  int *next;
  int *start;
  int v,e;
  int pointer;
} graph;

graph* newGraph(const int v,const int e){
  graph *g=(graph *)malloc(sizeof(graph));
  g->vertex=(int *)calloc(e,sizeof(int));
  g->next=(int *)calloc(e,sizeof(int));
  g->start=(int *)calloc(v,sizeof(int));
  for(int i=0;i<v;i++) g->start[i]=-1;
  g->v=v;
  g->e=e;
  g->pointer=0;
  return g;
}

void freeGraph(graph *g){
  free(g->vertex);
  free(g->next);
  free(g->start);
  free(g);
  return;
}

void addEdge(graph *g,const int from,const int to){
  const int p=g->pointer;
  g->vertex[p]=to;
  g->next[p]=g->start[from];
  g->start[from]=p;
  g->pointer++;
  return;
}

typedef struct node{
  int t;
  int c;
} node;

node calc(node a,node b){
  return a.t>b.t?a:b;
}

#define POS(i,j) ((i)*n+(j))

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  graph *g=newGraph(n,2*m);
  while(m--){
    int a,b;
    scanf("%d%d",&a,&b);
    a--;b--;
    addEdge(g,a,b);
    addEdge(g,b,a);
  }
  int q;
  scanf("%d",&q);
  node *dp=(node *)calloc(n*11,sizeof(node));
  int i,j;
  for(i=1;i<=q;i++){
    int v,d,c;
    scanf("%d%d%d",&v,&d,&c);
    v--;
    dp[POS(d,v)]=(node){i,c};
  }
  for(i=10;i>0;i--){
    for(j=0;j<n;j++){
      if(dp[POS(i,j)].c==0) continue;
      for(int p=g->start[j];p!=-1;p=g->next[p]){
	int u=g->vertex[p];
	dp[POS(i-1,u)]=calc(dp[POS(i-1,u)],dp[POS(i,j)]);
      }
    }
  }
  for(i=0;i<n;i++){
    node t={0,0};
    for(j=0;j<=10;j++){
      t=calc(t,dp[POS(j,i)]);
    }
    printf("%d\n",t.c);
  }
}

int main(void){
  run();
  return 0;
}


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

int main()
{
	int k;
	cin >> k;
	if(k % 7 == 0)
		k /= 7;
	if(__gcd(10, k) != 1)
	{
		cout << -1;
		return 0;
	}

	ll x = 1 % k;
	ll y = 1;

	while(x != 0)
	{
		x = (x*10+1)%k;
		y++;
	}
	cout << y;

	return 0;
}


Measured memory_bytes: 3584
import sys
N, M = map(int, input().split())

ans = 0

if M - (N*2) < 0:
    cpair = M // 2
    S_count = min(N,cpair)
    ans = ans + S_count
    print(ans)
    sys.exit()
    


restM = M - (N*2)

ans = ans + N


ans = ans + restM//4

print(ans)

Measured memory_bytes: 8980
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

int gcd(int a,int b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
int lcm(int a,int b)
{return a*b/gcd(a,b);}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{
  cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;
}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
//------------------------------------------------------------
ll K,A,B;

void solve() {
  cin>>K>>A>>B;
  bool flag=false;

  rep(i,A,B+1)
  {
    if(i%K==0)
    {
      flag=true;
      break;
    }

  }

  if(flag) print("OK");
  else print("NG");

  return;
}


Measured memory_bytes: 3652
#include <iostream>

int n;

int main() {
	std::cin >> n;
  	int t = n % 10;
  	if (t == 2 || t == 4 || t == 5 || t == 7 || t == 9) {
      std::cout << "hon";
    }
  	else if (t == 0 || t == 1 || t == 6 || t == 8) {
      std::cout << "pon";
    }
  	else {
      std::cout << "bon";
    }
  std::cout << std::endl;
  return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,m,a,b,i;
    cin>>n>>m;
    int Graph[n+1][n+1];
    memset(Graph,0,sizeof(Graph));
    for (i=0;i<m;i++)
    {
        cin>>a>>b;
        Graph[a][b]++;
        Graph[b][a]++;
    }
    int path[n];
    for (i=0;i<n;i++)
        path[i]=i+1;
    ll ans=0;
    do{
        int flag=0;
        if (path[0]!=1)
            continue;
        for (i=0;i<n-1;i++)
        {
            if (Graph[path[i]][path[i+1]]==0)
            {
                flag=1;
                break;
            }
        }
        if (!flag)
            ans++;
    } while (next_permutation(path,path+n));
    cout<<ans<<endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

A_list = [0]*10**5
for i in A:
    A_list[i - 1]+=1

goukei = sum(A)

for i in range(Q):
    B, C = map(int, input().split())
    goukei = goukei + A_list[B - 1] * (C - B)
    print(goukei)
    A_list[C - 1] += A_list[B - 1]
    A_list[B - 1] = 0
    

Measured memory_bytes: 84196
# -*- coding: utf-8 -*-
import math

n = int(input())
#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))

tmp= math.ceil(math.sqrt(n))
#print(n)
#print(tmp)
for i in range(0,tmp):
	if(n%(tmp-i)==0):
		break

#print(tmp-i)
ansn=n//(tmp-i)
#print(ansn)
#print(math.log10(ansn))
#print(max(ansn,tmp-i))
#print(math.floor(0.9))
ans=math.floor(math.log10(max(ansn,tmp-i))) + 1

print(ans)



Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define forr(i,m,n) for (int i=(m); i<=(n); i++)
#define forv(i,m,n) for (int i=(m); i>=(n); i--)
#define forall(it,p) for (auto it = p.begin(); it != p.end(); ++it)
#define R 1000000007
#define DBG 1
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;

#define MAXN 250001
int a[MAXN];
int dxs[4] = {0,0,1,-1};
int dys[4] = {1,-1,0,0};

int main() {
  int n;
  cin >> n;
  forr(i,0,n*n-1)
    cin >> a[i];
  vector< vector<int> > s(n);
  forr(i,0,n-1) s[i].resize(n);
  vector< vector<bool> > emp(n);
  forr(i,0,n-1) emp[i].resize(n);
  forr(i,0,n-1)
  forr(j,0,n-1) s[i][j] = min(min(i,n-1-i),min(j,n-1-j));
  //forr(i,0,n-1)
  //forr(j,0,n-1) cerr << s[i][j] << endl;
  int sm = 0;
  forr(i,0,n*n-1) {
    int x = (a[i]-1)/n;
    int y = (a[i]-1)%n;
    sm += s[x][y];
    emp[x][y] = true;
    list<pii> q;
    q.push_front(pii(x,y));
    while (q.size()>0) {
      pii z = q.front();
      //cerr << z.first << '/' << z.second << endl;
      q.pop_front();
      int i = z.first;
      int j = z.second;
      int p = s[i][j]+(emp[i][j] ? 0 : 1);
      forr(k,0,3) {
        int u = i+dxs[k];
        int v = j+dys[k];
        if (0<=u && u<n && 0<=v && v<n && s[u][v]>p) {
          s[u][v] = p;
          q.push_back(pii(u,v));
        }
      }
    }
  }
  cout << sm << endl;

}


Measured memory_bytes: 5636
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
//#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);
double PI = 3.14159265358979;
int n;




signed main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    list<int> lst;
    cin >> n;
    REP(i,n){
        string s;
        cin >> s;
        if(s[0] == 'i'){
            int tmp;
            cin >> tmp;
            lst.push_front(tmp);
        }
        else if(s[6] == 'F'){
            lst.pop_front();
        }
        else if(s[6] == 'L'){
            lst.pop_back();
        }
        else{
            int tmp;
            cin >> tmp; 
            for(auto itr = lst.begin(); itr != lst.end();++itr ) {
                if( *itr == tmp ){       //  要素が 1 ならば
                    lst.erase(itr);    // 要素を削除し、itr は次の要素を指す
                    break;
                }
            }
        }
    }
    for(auto itr = lst.begin(); itr != lst.end();){
        cout << *itr;
        ++itr;
        if(itr != lst.end()){
            cout << " ";
        }
    }
    cout << "\n";
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}

//key以上の初めてのitr
int nibul(auto a,auto b){return lower_bound(All(a),b) - a.begin();}
//key以下の最後のitr
int nibuu(auto a,auto b){return upper_bound(All(a),b) - a.begin()-1;}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}




Measured memory_bytes: 34364
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  string s;
  while(cin >>s && s != "0"){
    int t = 0;
    REP(g, 3){
      if(g) cin >>s;
      int a = 0, b = 0;
      FOR(i, 1, s.length()){
        if(s[i] == 'A') ++a;
        else ++b;
      }
      if(a > b) ++a;
      else ++b;
      t = (a > b ? 0 : 1);
      cout <<a <<" " <<b <<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long int ll;
using namespace std;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int A,B,T;
cin>>A>>B>>T;
int cycle=(T+0.5)/A;
cout<<B*cycle<<endl;


//system("pause");
return 0;
}

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

#define min3(a,b,c)   min(a,min(b,c))
#define max3(a,b,c)   max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)    __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)       __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)       __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b)     __gcd(a,b)
#define lcm(a,b)     (a*(b/gcd(a,b)))

#define pb   push_back
#define PI   M_PI
#define endl "\n"
#define sc   scanf
#define pf   printf

#define ll  long long
#define ull unsigned long long

#define W(t)            while(t--)
#define rep1(i,n)       for(int i = 0; i < n; i++)
#define rep2(a,b)       for(int i = a; i <= b; i++)
#define rep3(a,b,c)     for(int i = a; i <= b; i+=c)
#define irep(a,b,c)     for(int i = b; i >=a; i-=c)
#define repit(it,type)  for(it = type.begin(); it != type.end(); it++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
using namespace __gnu_cxx;

int main()
{
     IOS
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int x,n,i;
    int mx=0,mn=200;

    cin>>x>>n;
    map<int,int> mp;

    int a[200];
    rep1(i,n)
    {
         cin>>a[i];
         mp[a[i]]++;
    }
   // sort(a,a+n);

    for(i = 0; i <= 101; i++)
    {
         if(mp[i] == 0)
         {
              if(abs(i-x) < mn)
              {
                   mn = abs(i-x);
                   mx = i;
              }
         }
    }
    cout<<mx<<endl;

     return 0;
}



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

int main(){
    int n,l,sum=0;
    cin >> n >> l;
    vector<int> a(n),b(n);
    for(int i=0;i<n;i++){
        a[i]=l+(i+1)-1;
        sum+=a[i];
        b[i]=abs(a[i]);
    }
    sort(a.begin(),a.end());
    if(l>0){
        cout << sum-a[0] << endl;
    }else if(l+n-1>=0&&l<=0){
        cout << sum << endl;
    }else if(l+n-1<0){
        cout << sum-(l+n-1) << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b,c;
   cin>>a>>b>>c;
   if(a*b>=c)
   {
       cout<<c;
   }
   else if(a*b<c)
   {
       cout<<a*b;
   }


    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using ll = long long;
using namespace std;

int main() {
    int n = 0;
    cin >> n;
    vector<double> a(n);
    for (int i=0; i<n; i++) {
        cin >> a.at(i);
    }
    double deno = 0;
    for (int i=0; i<n; i++) {
        double buf = 1;
        for (int j=0; j<n; j++) {
            if (j == i) {
                continue;
            }
            buf *= a.at(j);
        }
        deno += buf;
    }
    double mole = 1;
    for (int i=0; i<n; i++) {
        mole *= a.at(i);
    }
    cout << fixed;
    cout << setprecision(6) << mole / deno << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
int main(){
    string N;cin >> N;
    rep(i,N.length()){
        if(N[i]=='7'){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.*;


public class Main {

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

        int H = sc.nextInt();
        int N = sc.nextInt();
        int totalA = 0;

        for(int i=0;i<N;i++){
            totalA += sc.nextInt();
        }
        if(totalA >= H) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

}






Measured memory_bytes: 47800
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;
//階乗できるよ
ll kaizyo(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    sum = sum % ATCODER_AMARI;
  }
  return sum;
}

int main() {
  int a,b;
  cin >> a >> b;
  int ans = a*b;
  cout << ans << endl;
}


Measured memory_bytes: 3624
k = int(input())

ans = 0
for i in range(k):
    if i % 2 == 1:
        e = False
    else:
        e = True

    for j in range(i + 1, k):
        if e and j % 2 == 1:
            ans += 1
        elif not e and j % 2 == 0:
            ans += 1

print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    bool ans = true;
    h[0]--;
    repSE(i,1,n) {
        if (h[i]>h[i-1]) h[i]--;
        if (h[i]<h[i-1]) {ans = false; break;}
    }
    cout << (ans ? "Yes" : "No") << "\n";
    return 0;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vec pa(51,-1);//Nレベルのバーガー丸ごと食べた時のパティの枚数

ll dfs(ll level, ll &eat){
    if(eat == 0) return 0;
    if(level == 0){
        --eat;
        return 1;
    }
    ll ans = 0;
    //バン
    --eat;
    if(eat == 0) return ans;
    //N-1レベル
    if((eat >= (1LL << level+1) - 3) && pa.at(level) != -1){
        eat -= (1LL << level+1) - 3;
        ans += pa.at(level-1);
    }else{
        ans += dfs(level-1,eat);
    }
    if(eat == 0) return ans;
    //パティ
    --eat;
    ++ans;
    if(eat == 0) return ans;
    //N-1レベル
    if((eat >= (1LL << level+1) - 3) && pa.at(level) != -1){
        eat -= (1LL << level+1) - 3;
        ans += pa.at(level-1);
    }else{
        ans += dfs(level-1,eat);
    }
    if(eat == 0) return ans;
    //バン
    --eat;
    pa.at(level) = ans;
    return ans;
}

int main(){
    cin>>N>>K;
    pa.at(0) = 1;
    cout<<dfs(N,K)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define TRAV(i, n) for(auto &i : n)
#define SZ(x) (int)(x).size()
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b;
    cin >> a >> b;
    if (a - 2*b <= 0) cout << 0;
    else cout << a - 2*b;
    return 0;
}


Measured memory_bytes: 256
/* ALDS1_5_D: The number of inversions */

#include <iostream>
#include <cmath>

const int MAX_VALUE = pow(10, 9);

long long count_and_merge(int A[], int left, int mid, int right) {
    int n_left  = mid - left;
    int n_right = right - mid;
    int *L = new int[n_left + 1];
    int *R = new int[n_right + 1];

    for (int i = 0; i < n_left; i++)
        L[i] = A[left + i];
    for (int i = 0; i < n_right; i++)
        R[i] = A[mid + i];
    L[n_left] = R[n_right] = MAX_VALUE + 1;

    int i_l = 0, i_r = 0;
    long long n_invs = 0;
    int n_left_remains = n_left;
    for (int i_a = left; i_a < right; i_a++) {
        if (L[i_l] <= R[i_r]) {
            A[i_a] = L[ i_l++ ];
            n_left_remains--;
        } else {
            A[i_a] = R[ i_r++ ];
            n_invs += n_left_remains;
        }
    }
    return n_invs;
}

long long merge_sort(int A[], int left, int right) {
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        long long n_invs = 0;
        n_invs += merge_sort(A, left, mid);
        n_invs += merge_sort(A, mid, right);
        n_invs += count_and_merge(A, left, mid, right);
        return n_invs;
    }
    return 0;
}

long long count_inversions(int n, int A[]) {
    return merge_sort(A, 0, n);
}

int main() {
    std::ios::sync_with_stdio(false);

    int n;
    std::cin >> n;
    int *A = new int[n];
    for (int i = 0; i < n; i++)
        std::cin >> A[i];

    long long n_invs = count_inversions(n, A);
    std::cout << n_invs << std::endl;
    return 0;
}

Measured memory_bytes: 25396
#include <algorithm>
#include <iostream>
#include <limits>
#include <numeric>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
bool compare_by_b(pair<int, long long> a, pair<int, long long> b) {
    if(a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}
int main() {
    int N;
    cin >> N;
    vector<pair<int, long long>> AB;
    rep(i, 0, N) {
        pair<int, long long> p;
        int a;
        long long b;
        cin >> a >> b;
        p.first = a;
        p.second = b;
        AB.push_back(p);
    }

    sort(AB.begin(), AB.end(), compare_by_b);
    long long T = 0;
    string res = "Yes";
    rep(i, 0, N) {
        // cout << AB[i].first<<","<<AB[i].second << endl;
        T += AB[i].first;
        if(T > AB[i].second) {
            res = "No";
            break;
        }
    }

    cout << res << endl;
}

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

int A[2000];

int toSolve(int,int);

int n;
int q;

int i,j;

int main(){

  int solve;
  int m;
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d",&A[i]);
  }

  scanf("%d",&q);
  for(j = 0;j < q;j++){
    scanf("%d",&m);


    solve = toSolve(0,m);
    if(solve == 1) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}


int toSolve(int i,int m){

  int res;
  if(m == 0) return 1;
  if(i >= n) return 0;
  res = toSolve(i+1,m)||toSolve(i + 1,m - A[i]);
     return res;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int res = 0;
  if(a < b) res += a;
  else res += b;
  if(c < d) res += c;
  else res += d;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program {
    static void Main() {
        var n = NextInt();
        var x = NextInt();
        var a = new int[n];
        foreach (var i in Enumerable.Range(0, n)) {
            a[i] = NextInt();
        }
        Array.Sort(a);

        var ans = 0;
        foreach (var i in Enumerable.Range(0, n)) {
            if (x < a[i] || (i == n - 1 && x != a[i])) {
                break;
            }
            ans++;
            x -= a[i];
        }
        WriteLine(ans);
    }

    static int NextInt() {
        return int.Parse(NextString());
    }

    static string NextString() {
        var result = new List<char>();
        while (true) {
            int next = Read();
            if (next < 0)
                break;
            var nextChar = (char)next;
            if (!char.IsWhiteSpace(nextChar))
                result.Add(nextChar);
            else if (nextChar != '\r')
                break;
        }
        return string.Join("", result);
    }
}

Measured memory_bytes: 13268
<?php
$s = str_split(trim(fgets(STDIN)));
$n = count($s);

$C = 0;
$ans = 0;
$i = 0;
while($i < $n){
 $a = $s[$i];
 if($a == "C"){
  ++$C;
 }
 if($a == "F"){
  if($C > 0){
   ++$ans;
   break;
  }
 }
++$i;
}

if($ans == 0){
 echo "No";
}else{
 echo "Yes";
}
?>


Measured memory_bytes: 3576
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        MyScanner sc = new MyScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int x = sc.nextInt(), y = sc.nextInt();
        out.println(x % y == 0 ? -1 : x);
        out.flush();
        out.close();
    }

    private static class MyScanner {
        StringTokenizer st;
        BufferedReader br;

        public MyScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public MyScanner(String filename) throws IOException {
            br = new BufferedReader(new FileReader(new File(filename)));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}


Measured memory_bytes: 22740
#include <stdio.h>
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<complex>
#include<vector>
#include <climits>

using namespace std;


int main(void)
{
    int x;
    scanf("%d",&x);

    if(x==3 or x==5 or x==7)
    {
        cout << "YES" << "\n";
    }
    else
    {
        cout << "NO" << "\n";
    }

    return 0;
}

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

int main()
{
    int r, g, b;
    int a;
    cin >> r >> g >> b;
    a = g * 10 + b;
    if (a % 4 == 0)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = vector<int>;

int main(){
  int a,b;cin >> a >> b;
  int k;cin >> k;
  int j=0;
  set<int> st;
  for(int i=0;i<k;i++){
    //cout << a+i << endl;
      if(a+i>=a&&a+i<=b) st.insert(a+i);
  }
  for(int i=k-1;i>=0;i--){
    //cout << b-i << endl;
    if(b-i>=a&&b-i<=b)st.insert(b-i);
  }
  for(auto&i:st) cout << i << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] strs = br.readLine().split(" ");
    System.out.println(strs[0].substring(0,1) + strs[1].substring(0, 1) + strs[2].substring(0, 1));
  }
}

Measured memory_bytes: 21204
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;

const int N=200005;
const int mod=1000000007;

struct node{
	int w,b;
}a[N];
int n,ans;
int fac[N];

bool cmp(node a,node b){
	return a.w<b.w;
}

int main(){
//	freopen("a.in","r",stdin);
//	freopen("a.out","w",stdout);
	int i,j,s1=0,s0=0;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i].w),a[i].b=1;
	for (i=1;i<=n;i++) scanf("%d",&a[i+n].w),a[i+n].b=0;
	sort(a+1,a+1+n+n,cmp); ans=1;
	for (i=1;i<=n+n;i++){
		if (a[i].b==1){
			if (s0) ans=1ll*ans*s0%mod,s0--;
			else s1++;
		}
		else{
			if (s1) ans=1ll*ans*s1%mod,s1--;
			else s0++;
		}
	}
	printf("%d\n",ans);
	return 0;
} 

Measured memory_bytes: 1792
def calc_p(F, P, O):
    return P[sum(1 for f, o in zip(F, O) if f == 1 and o == 1)]

def calc_sum(Fs, Ps, O):
    return sum(calc_p(F, P, O) for F, P in zip(Fs, Ps))

def main(Fs, Ps):
    print(max(calc_sum(Fs, Ps, list(map(int, list('{0:010d}'.format(int(format(i, 'b'))))))) for i in range(1, 1024)))

if __name__ == '__main__':
    N = int(input())
    Fs = [list(map(int, input().split(' '))) for _ in range(N)]
    Ps = [list(map(int, input().split(' '))) for _ in range(N)]
    main(Fs, Ps)

Measured memory_bytes: 3064
#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________
template <typename T = long long, const int sz = 5 * 10000000> struct IO {
    char reader[sz], writer[sz];
    char *now, *now2 = writer;
    IO() {
        reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
        now = reader;
    }
    inline T read() {
        while(*now && *now <= 32) now++;
        if(*now == '-') {
            now++;
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return -res;
        } else {
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return res;
        }
    }
    inline string read_str() {
        string res;
        while(*now and *now != '\n' and *now != ' ') res += *now++;
        now++;
        return res;
    }
    inline void write(T x, char margin = ' ') {
        if(x == 0) {
            putchar('0');
            putchar(margin);
            return;
        }
        if(x < 0) {
            putchar('-');
            x = -x;
        }
        while(x) {
            *now2 = '0' + x % 10;
            now2++;
            x /= 10;
        }
        do {
            now2--;
            putchar(*now2);
        } while(now2 != writer);
        putchar(margin);
    }
    inline void write_str(string s, char margin = ' ') {
        for(auto c : s) putchar(c);
        putchar(margin);
    }
};
IO<int> io;
int n, m, k,i;
constexpr int MAX = 1e9 + 1;
constexpr int N = 200010;
int a[N], b[N];
int nn,now,ans;
main() {
    n = io.read(), m = io.read(), k = io.read();
    nn = n;
    rep(i, n) {
        a[i + 1] = io.read() + a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while(*io.now && *io.now <= 32) io.now++;
                while('0' <= *io.now and *io.now <= '9') io.now++;
            }
            break;
        }
    }
    rep(i, m) {
        b[i + 1] = io.read() + b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    now = nn;
    ans = now;
    for(i = 1; i <= m; i++) {
        while(b[i] + a[now] > k) now--;
        ans = max(ans, i + now);
    }
    io.write(ans);
}


Measured memory_bytes: 7940