akhauriyash/Code-Regression huggingface dataset:
// AOJ 1320: City Merger
// 2017.12.31 bal4u@uu

#include <stdio.h>
#include <string.h>

#define INF 0x70707070
char *city[15]; int csz[15]; int sz;
char name[15][22]; int nsz[15]; char f[15];
int dp[16][16];
int memo[16][65536];

int naiveMatch(char *text, int len, char *pattern, int patlen)
{
    char c;
    char *tp, *pp;
    char *textEnd, *patEnd;

    if (len < patlen) return 0;

    textEnd = text + len - patlen + 1;
    patEnd  = pattern + patlen;

    c = *pattern++;
    while (text != textEnd) {
        if (*text++ == c) {
            tp = text;
            pp = pattern;
            do if (pp == patEnd) return 1;
            while (*tp++ == *pp++);
        }
    }
    return 0;
}

int calc(int n, int k, int s)
{
	int i, t, ans;

	if (memo[k][s] < INF) return memo[k][s];
	if (s == (1<<k)) return dp[k][k];
	ans = INF;
	for (i = 0; i < n; i++) {
		if (i == k) continue;
		if ((s >> i) & 1) {
			t = dp[k][i] + calc(n, i, s-(1<<k));
			if (ans > t) ans =  t;
		}
	}
	return memo[k][s] = ans;
}

int main()
{
	int n, i, j, k, lim, ans;

	while (scanf("%d", &n) && n > 0) {
		for (i = 0; i < n; i++) {
			scanf("%s", name[i]), nsz[i] = strlen(name[i]);
		}

		memset(f, 0, sizeof(f));
		for (i = 0; i < n; i++) {
			if (f[i]) continue;
			for (j = 0; j < n; j++) if (j != i) {
				if (naiveMatch(name[i], nsz[i], name[j], nsz[j])) f[j] = 1;
			}
		}

		sz = 0;
		for (i = 0; i < n; i++) {
			if (f[i]) continue;
			city[sz] = name[i], csz[sz++] = nsz[i];
		}

		memset(dp, INF, sizeof(dp));
		for (i = 0; i < sz; i++) for (j = 0; j < sz; j++) {
			k = csz[i]-csz[j];
			if (k < 0) k = 0;
			while (1) {
				if (k == csz[i]) { dp[i][j] = csz[i]; break; }
				if (memcmp(city[i]+k, city[j], csz[i]-k) == 0) {
					dp[i][j] = k; break;
				}
				k++;
			}
		}
		for (i = 0; i < sz; i++) dp[i][i] = csz[i];

		ans = INF, lim = (1<<sz) - 1;
		memset(memo, INF, sizeof(memo));
		for (i = 0; i < sz; i++) {
			k = calc(sz, i, lim);
			if (k < ans) ans = k;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 5840
list = input().split()
x = list[0]
y = list[1]
dic = {"A":10,
"B":11,
"C":12,
"D":13,
"E":14,
"F":15}
x = dic[x]
y = dic[y]

if x > y:
    print(">")
elif x == y:
    print("=")
else:
    print("<")

Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys
import math

def distance(a, b):
    result = 0
    for i in range(len(a)):
        result += (a[i]-b[i])** 2
    return math.sqrt(result)
    

def solve(N: int, D: int, X: "List[List[int]]"):
    count = 0
    for i in range(N):
        for j in range(i+1, N):
            dist = distance(X[i], X[j])
            if dist % 1 == 0:
                count += 1
            else:
                pass
    print(count)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    X = [ [ int(next(tokens)) for _ in range(D) ] for _ in range(N) ]  # type: "List[List[int]]"
    solve(N, D, X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
S = input()

cnt=0

for i in range(3):
    if S[i]=='R':
        cnt+=1
if cnt==0:
    out=0

elif cnt==1:
    out=1
elif cnt==3:
    out=3
else:
    if S[0]=='R' and S[2]=='R':
        out=1
    else:
        out=2
print(out)


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

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

  vector<int> a(n), b(n-1);
  for (int i = 0; i < n-1; i++) {
    cin >> b[i];
  }

  a[0] = b[0];
  for (int i = 1; i < n-1; i++) {
    if (b[i-1] < b[i]){
      a[i] = b[i-1];
    }
    else {
      a[i] = b[i];
    }
  }
  a[n-1] = b[n-2];

  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += a[i];
  }

  cout << ans << endl;
}


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


int f(int n){
  int res = 0;
  while(n>0){
    res += n%10;
    n /=10;
  }
  return res;
}
int main() {
  int N;
  string ans = "No";
  cin >> N;
  if (N % f(N) ==0){
    ans = "Yes";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main 
{
	public static void main(String args[]) 
	{
		Scanner sc=new Scanner(System.in);
		int temp=sc.nextInt();
		if(temp>=30) 
		{
			System.out.println("Yes");
		}
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 35556
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a : A) cin >> a;} 

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

i64 N; cin >> N;
if (N % 2) {
    cout << "0\n";
    return 0;
}

i64 cnt = 0;
N /= 10;
for(; N; N /= 5){
    cnt += N;
}
cout << cnt << "\n";
return 0;
}
// 書いて考える．場合分け．情報整理．
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 256
class PriorityQueue
  def initialize(&comp)
    @heap = []
    @node_num = 0
    if !block_given?
      @comp = Proc.new { |x, y| x <= y }
    else
      @comp = comp
    end
  end

  attr_reader :heap

  def push(x)
    current_node_num = @node_num
    @node_num += 1
    while current_node_num > 0
      parent_node_num = (current_node_num - 1) / 2
      break if @comp.call(@heap[parent_node_num], x) # 逆転してないなら抜ける
      # 親ノードを下ろして自分を上に
      @heap[current_node_num] = @heap[parent_node_num]
      current_node_num = parent_node_num
    end
    @heap[current_node_num] = x
  end

  alias_method(:<<, :push)

  def pop
    # 最(小|大)値
    ret = @heap[0]
    # 根にもってくる値
    @node_num -= 1
    x = @heap[@node_num]
    # 根から下ろしていく
    i = 0
    while (a = i * 2 + 1) < @node_num
      # 子どうしを比較
      b = a + 1
      a = b if b < @node_num && @comp.call(@heap[b], @heap[a])
      break unless @comp.call(@heap[a], x)
      @heap[i] = @heap[a]
      i = a
    end
    @heap[i] = x
    return ret
  end

  def get
    @node_num == 0 ? nil : @heap[0]
  end

  def empty?
    return get.nil?
  end
end

#
# dijkstra
#   O(|E|log|V|)
#   隣接表現グラフgraph, 始点start, inf
#
def dijkstra(graph, start, inf = Float::INFINITY)
  vertex_num = graph.size
  que = PriorityQueue.new { |x, y| x[0] <= y[0] }
  dist = Array.new(vertex_num, inf)
  dist[start] = 0
  que.push([0, start])
  while !que.empty?
    d, v = que.pop
    dist_now = dist[v]
    next if dist_now < d
    graph[v].each do |e|
      # e is an instance of Edge
      #   Edge = Struct.new(:to, :cost)
      # e = graph[v][i]
      if dist[e.to] > dist_now + e.cost
        que.push([dist[e.to] = dist_now + e.cost, e.to])
      end
    end
  end
  return dist
end

Edge = Struct.new(:to, :cost)
n, m = gets.split.map(&:to_i)
g = Array.new(n) { [] }

(n - 2).times do |i|
  g[i + 1] << Edge.new(i, 0)
end

m.times do
  l, r, c = gets.split.map(&:to_i)
  l -= 1
  r -= 1
  g[l] << Edge.new(r, c)
end
ans = dijkstra(g, 0)[n - 1]
puts ans == Float::INFINITY ? -1 : ans


Measured memory_bytes: 29180
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n,k;
  cin >> n >> k;
  vector<ll>p(n);
  rep(i,n)cin>>p[i];
  sort(p.begin(),p.end());
  if(p[n-1]<=0 && k&1){
    ll ans = 1;
    rep(i,k){
      ans*=p[n-1-i];
      ans%=MOD;
    }
    while(ans<0)ans+=MOD;
    cout << ans << endl;
    return 0;
  }
  ll ans = 1;
  ll nowp=n-1,nowm=0;
  ll cnt = 0;
  while(cnt<k){
    if(nowp-nowm>=1 && cnt+2<=k){
      ll resp=p[nowp]*p[nowp-1];
      ll resm=p[nowm]*p[nowm+1];
      if(resp>resm){
        cnt++;
        p[nowp]%=MOD;
        ans*=p[nowp];
        ans%=MOD;
        nowp--;
      }
      else{
        cnt+=2;
        nowm+=2;
        resm%=MOD;
        ans*=resm;
        ans%=MOD;
      }
    }
    else{
      cnt++;
      p[nowp]%=MOD;
      ans*=p[nowp];
      ans%=MOD;
      nowp--;
    }
  }
  while(ans<0)ans+=MOD;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4784
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <map>
using namespace std;
int num[5];

int main()
{
	int ans = 0;
	scanf("%d%d%d", &num[0], &num[1], &num[2]);
	sort(num, num + 3);
	int flag = 2 * num[2] - num[0] - num[1];
	if (flag % 2 == 1)
	{
		ans = (flag + 3) / 2;
	}
	else ans = flag / 2;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S,FR="",BA="";int query,Q,T,X=0;
  cin>>S>>Q;
  for(int i=0;i<Q;i++){
    cin>>query;
    if(query==1)X=1-X;
    else{
      int F;char C;
      cin>>F>>C;
      if((X+F)%2==0)BA+=C;
      else FR+=C;
    }
  }
  reverse(FR.begin(),FR.end());
  S=FR+S+BA;
  if(X)reverse(S.begin(),S.end());
  cout<<S<<endl;
}

Measured memory_bytes: 1348
sa=input()
sb=input()
sc=input()
s='a'
for i in range(len(sa)+len(sb)+len(sc)):
  if s=='a':
    if len(sa)==0:
      print('A')
      exit()
    else:
      s=sa[0]
      sa=sa[1:]    
  elif s=='b':
    if len(sb)==0:
      print('B')
      exit()
    else:
      s=sb[0]
      sb=sb[1:]
  elif s=='c':
    if len(sc)==0:
      print('C')
      exit()
    else:
      s=sc[0]
      sc=sc[1:]

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
const double PI = acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

class UnionFind {
public:
  vector <ll> par;
  vector <ll> siz;
  UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
    for (ll i = 0; i < sz_; ++i) par[i] = i;
  }
  void init(ll sz_) {
    par.resize(sz_);
    siz.assign(sz_, 1LL);
    for (ll i = 0; i < sz_; ++i) par[i] = i;
  }
  ll root(ll x) {
    while (par[x] != x) {
      x = par[x] = par[par[x]];
    }
    return x;
  }
  bool merge(ll x, ll y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }
  bool issame(ll x, ll y) {
    return root(x) == root(y);
  }
  ll size(ll x) {
    return siz[root(x)];
  }
};

int main() {
  ll N,M; cin >> N >> M;
  vector<ll> A(M),B(M);
  rep(i,M) {
    cin >> A[i] >> B[i];
    A[i]--; B[i]--;
  }
  
  UnionFind uf(N);
  vector<ll> ans(M+1);
  ans[M] = N * (N-1) / 2;
  rep(i,M) {
    if (!uf.issame(A[M-1-i],B[M-1-i])) {
      ans[M-1-i] = ans[M-i] - uf.size(A[M-1-i]) * uf.size(B[M-1-i]);
    } else ans[M-1-i] = ans[M-i]; 
    uf.merge(A[M-1-i],B[M-1-i]); 
  }
  
  rep(i,M) cout << ans[i+1] << endl;
}

Measured memory_bytes: 5248
import java.util.*;
import java.io.*;

// This file is a "Hello, world!" in Java language by OpenJDK for wandbox.

class Main
{
    public static void main(String[] args)
    {
        new Main().run();
    }
	
	final long MOD=(long)(1e9+7);

	long pow(long a,long n){
		long ret=1;
		for(;n>0;n>>=1,a=a*a%MOD)if(n%2==1)ret=ret*a%MOD;
		return ret;
	}
	
	long inv(long a){
		return a==0?1:pow(a,MOD-2);
	}
	
	int MAX=(int)(3e5);
	long[] fac=new long[MAX];
	{
		fac[0]=fac[1]=1;
		for(int i=2;i<fac.length;++i)fac[i]=fac[i-1]*i%MOD;
	}
	
	void run(){
        Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long[] x=new long[N];
		for(int i=0;i<N;++i)x[i]=sc.nextLong();
		long cur=0;
		long ans=0;
		for(int i=0;i<N-1;++i){
			cur+=fac[N-1]*inv(i+1)%MOD;
			cur%=MOD;
			ans+=cur*(x[i+1]-x[i])%MOD;
			ans%=MOD;
		}
		System.out.println(ans);
    }
	
	void tr(Object...o){
		System.out.println(Arrays.deepToString(o));
	}
}
// OpenJDK reference:
//   http://openjdk.java.net/

// Java language references:
//   http://docs.oracle.com/javase


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

int main() {
  string A,B;
  cin >> A >> B;
  if (A[0] == B[2] && A[1] == B[1] && A[2] == B[0]) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}


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

int ans = 0;
int h[100];
void func(int l, int r){
    if(l == r){
        ans += h[l];
        h[l] = 0;
        return;
    }
    int index = l;
    int MIN = 1000;
    for (int i = l; i <= r; i++)
    {
        if(h[i] < MIN){
            MIN = h[i];
            index = i;
        }
    }
    ans += MIN;
    for (int i = l; i <=r ; i++)
    {
        h[i] -= MIN;
    }
    
    if(index == l) func(l+1,r);
    else if(index == r) func(l,r-1);
    else{
        func(l,index-1);
        func(index+1,r);
    }
    return;
} 
 
int main(){
    int N; cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }
    func(0,N-1);
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                boolean ebishu = true;
                sc.close();
                while(ebishu){
                        for(int i = 2 ; i <= Math.sqrt(n) ; i++){
                                if((Math.log10(n) / Math.log10(i)) % 1 == 0){
                                        ebishu = false;
                                }
                        }
                        n--;
                        if(n == 0) ebishu = false;
                }
                n++;
                System.out.println(n);

        }
}//0=48
//鶏になれ

Measured memory_bytes: 35672
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

int n;
int b[3][3];
bool marked[3][3];

bool rows() {
    fo(i, 3) {
        if (marked[i][0] && marked[i][1] && marked[i][2]) return true;
    }
    return false;
}

bool columns() {
    fo(i, 3) {
        if (marked[0][i] && marked[1][i] && marked[2][i]) return true;
    }
    return false;
}

bool diagonals() {
    bool yee = true;
    fo(i, 3) {
        if (!marked[i][i]) {
            yee = false;
        }
    }
    if (yee) return true;
    yee = true;
    fo(i, 3) {
        if (!marked[i][2-i]) yee = false;
    }
    return yee;
}
void solve() {
    fo(i, 3) {
        fo(j, 3) {
            cin >> b[i][j];
            marked[i][j] = false;
        }
    }
    cin >> n;
    int bi;
    fo(k, n) {
        cin >> bi;
        fo(i, 3) {
            fo(j, 3) {
                if (b[i][j] == bi) marked[i][j] = true;
            }
        } 
    }
    if (rows() || columns() || diagonals()) Yes();
    else No();
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
using namespace std;


int main() {
	long long int four=0,odd=0,two=0,a=0, b=0, c, d, n, res = 0, m, tmp = 1, q, sum[200000] = {}, x[200000] = {}, v[200000] = {};
	string str;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> x[i];
	}
	for (int i = 1; i <=n; i++) {

		if (x[i] % 4 == 0) { four++; }
		else if (x[i] % 2 == 0) {
			two++;
		}
		else { odd++; }
		
	}

	if (odd == 0) { cout << "Yes"; return 0; }
	if (two >= 1) { odd++; n -= two - 1; }
	if (n % 2 == 0) {
		if (four >= odd) { cout << "Yes"; return 0; }
		else {
			cout << "No"; return 0;
		}
	}
	else {
		if (four+1 >= odd) { cout << "Yes"; return 0; }
		else {
			cout << "No"; return 0;
		}
	}
	
}


Measured memory_bytes: 1792
k=int(input())
arr=[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(arr[k-1])

Measured memory_bytes: 3060
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<memory>
#include<cmath>
#include<stack>
#include<tuple>
#include<numeric>
#include<cassert>

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back
#define DEBUG false

using namespace std;

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

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60;
const int MAX_N=100005;
const ll lmod = 1e9+7;

int main(){
  ll n,m;
  ll a[MAX_N];
  vector<ll> cnt[MAX_N];
  int cnt2[MAX_N];
  cin >> n >> m ;
  fill(cnt2,cnt2+n,0);
  rep(i,n){
    scanf("%lld",&a[i]);
    a[i]--;
    if(i!=0) cnt[a[i]].pb(i);
    if(i!=n-1) cnt2[a[i]]++;
  }
  ll ans,temp=0LL;
  ll imos[MAX_N];
  fill(imos,imos+n,0);
  rep(i,n-1){
    temp += min((a[i+1]-a[i]+m)%m,a[i+1]+1);
    if(a[i]>a[i+1]&&a[i]!=0&&a[i+1]!=0) imos[0]++;
  }
  //cout << "imos "  << imos[0] << endl;
  REP(i,1,m-1){
    //a[l]~a[l+1](0<=l<m-2)の間にiがあるlの数
    imos[i] = imos[i-1] + (cnt2[i-1] - cnt[i].size()); 
    //cout << "imos "  << imos[i] << endl;
  }
  ans = temp;
  rep(i,m-1){
    for(auto&& out:cnt[i]){
      temp += (a[out]-a[out-1]+m)%m-1;
    }
    temp -= imos[i];
    //cout << "temp = " <<  temp << endl;
    ans = min(ans,temp);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6912
N = int(input())
s = [input() for _ in range(N)]
M = int(input())
t = [input() for _ in range(M)]
s_t_set = set(s + t)
ans = 0
for word in s_t_set:
    counter = 0
    counter += s.count(word)
    counter -= t.count(word)
    ans = max(ans, counter)
print(ans)


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    static long min=Long.MAX_VALUE;
    static int n,m,x;
    static int price[];
    static int increment[][];

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
         n = s.nextInt();m=s.nextInt();x=s.nextInt();
        price = new int[n];
        increment = new int[n][m];
        for(int i=0;i<n;i++){
            price[i]=s.nextInt();
            for(int j=0;j<m;j++)increment[i][j]=s.nextInt();
        }
        arr = new ArrayList<>();
        solve(0,0L);
        if(min==Long.MAX_VALUE)System.out.println(-1);
        else System.out.println(min);
    }

    static ArrayList<Integer> arr ;

    public static void solve(int i,long sum){
        if(i==n){
            long algo[] = new long[m];
            for(int j=0;j<arr.size();j++){
                int u = arr.get(j);
                for(int o=0;o<m;o++)algo[o]+=increment[u][o];
            }
            boolean flag = true;
            for(int j=0;j<m;j++){
                if(algo[j]<x){
                    flag=false;
                    break;
                }
            }
            if(flag)min=Math.min(min,sum);

        }
        else{
            arr.add(i);
            solve(i+1,sum+price[i]);
            arr.remove(arr.size()-1);
            solve(i+1,sum);
        }
    }
}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

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

    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: 29236
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(a > b){
            a = a^b;
            b = a^b;
            a = a^b;
        }
        if(a > c ){
            a = a^c;
            c = a^c;
            a = a^c;
        }
        if(b > c){
            b = b^c;
            c = b^c;
            b = b^c;
        }
        System.out.print(a + " " + b + " " + c);
        System.out.println();
    }
}


Measured memory_bytes: 26268
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}
void comb(vector<vector<long long int>> &v)
{
	for (int i = 0; i < v.size(); i++)
	{
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++)
	{
		for (int j = 1; j < k; j++)
		{
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}
bool is_not_out_of_range(size_t now, size_t max_num)
{
	return !(now < 0 || max_num <= now);
}
ll repeat_squaring(ll n, ll p, ll m)
{
	if (p == 0)
		return 1;
	if (p % 2 == 0)
	{
		ll t = repeat_squaring(n, p / 2, m);
		return t * t % m;
	}
	return n * repeat_squaring(n, p - 1, m);
}

int main()
{
	int n;
	cin >> n;
	str ans = "pon";
	switch (n % 10)
	{
	case 0:
	case 1:
	case 6:
	case 8:
		ans = "pon";
		break;
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		ans = "hon";
		break;
	default:
		ans = "bon";
		break;
		/* code */
		break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, q; cin >> n >> q;
	string s; cin >> s;
	VE sum(n+1);
	rep(i, n) {
		bool ok = false;
		if (s[i] == 'C') {
			if (!(i - 1 == -1) && s[i - 1] == 'A') {
				ok = true;
			}
		}
		if (ok)sum[i]++;
		sum[i + 1] = sum[i];
	}
	rep(i, q) {
		int l, r; cin >> l >> r;
		l--; r--;
		cout << sum[r] - sum[l] << endl;
	}
	return 0;
}


Measured memory_bytes: 1872
package main

import (
	"fmt"
	"strings"
)

var N, K int
var S string

func main() {
	fmt.Scan(&N, &K, &S)
	a := strings.Split(S, "")
	var b string

	for i := 0; i < N; i++ {
		if i == K-1 {
			b += strings.ToLower(a[K-1])
		} else {
			b += a[i]
		}
	}
	fmt.Printf("%s\n", b)
}


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

struct Dat{ int x, y, i; };

int n, m;
vector<Dat> pv;
vector<int> sv[200010];
set<int> ss, ts;

int main(){
	scanf("%d%d", &n, &m);
	for(int i = 1, x, y; i <= n; i++){
		scanf("%d%d", &x, &y);
		pv.push_back({x, y, i});
		sv[y].push_back(i);
		ss.insert(i);
	}
	sort(pv.begin(), pv.end(), [](Dat a, Dat b){ return a.x == b.x ? a.y > b.y : a.x < b.x; });
	for(int i = 1, j = 0; i <= m; i++){
		while(j < pv.size() && pv[j].x < i) j++;
		for(auto &t : sv[i]) ts.insert(t);
		if(j < pv.size()){ ss.erase(pv[j].i); j++; }
		else{
			while(!ts.empty()){
				auto t = ts.begin();
				if(ss.find(*t) != ss.end()){
					ss.erase(*t);
					ts.erase(t);
					break;
				}
				ts.erase(t);
			}
		}
	}
	printf("%d\n", ss.size());
}

Measured memory_bytes: 27440
#  --*-coding:utf-8-*--


def f(N, X, L):
    d = 0

    for i, l in enumerate(L):
        d += l
        if d > X:
            return i+1

    return N+1


def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))

    print(f(N, X, L))



if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
ll f[1005],a[1005];
int n,pre[1005][1005],s[1005],top,mxl,mxr;
void dfs(int now){
	if(now==mxl) return;
	int T=pre[mxl][now];
	int o=now-T>>1;
	for(int i=1;i<o;i++) s[++top]=T+2;
	s[++top]=T+1;
	dfs(T);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	ll ans=-1e15,inf=-1e15;
	for(int i=1;i<=n;i++){
		for(int p=i;p<=n;p++) f[p]=-1e15;
		f[i]=a[i];
		if(f[i]>ans) ans=f[i],mxl=i,mxr=i;
		ll mx[2]={a[i],inf};int fr[2]={i,0};
		for(int p=i+2;p<=n;p++){
			f[p]=mx[p-i&1]+a[p];
			pre[i][p]=fr[p-i&1];
			if(f[p]>mx[p-i&1]) mx[p-i&1]=f[p],fr[p-i&1]=p;
			if(f[p]>ans) ans=f[p],mxl=i,mxr=p;
		}
	}
	printf("%lld\n",ans);
	for(int i=n;i>mxr;i--) s[++top]=i;
	dfs(mxr);
	for(int i=1;i<mxl;i++) s[++top]=1;
	printf("%d\n",top);
	for(int i=1;i<=top;i++) printf("%d\n",s[i]);
	return 0;
}

Measured memory_bytes: 4224
f = lambda: list(map(int,input().split()))

n = int(input())
F = [f() for _ in range(n)]
P = [f() for _ in range(n)]

from itertools import product
mul = product((0, 1), repeat=10)

ans = -float('inf')
for m in mul:
    if any(m):
        ben = 0
        for shop in range(n):
            op = sum(m[j] & F[shop][j] for j in range(10))
            ben += P[shop][op]
        ans = max(ans,ben)
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <sstream>

using namespace std;


int main(int argc, const char * argv[]) {
    int N, L;
    cin >> N >> L;
    
    int eatable_index = (L >= 0) ? 0 : min(-L, N-1);
    int t = (N*L) + ((N*(N-1))/2);
    cout << t - (L + eatable_index) << endl;
    
    return 0;
}

Measured memory_bytes: 256
//====== begin of bisma c++ template===========
#include<bits/stdc++.h>
#include <assert.h>
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define ll long long 
#define sum(a,b) a=a+b
#define mem(a, b) memset(a, (b), sizeof(a))


//=======binarysearch===========
int bs(vector<long long>&a,int que){
 auto it=lower_bound(a.begin(),a.end(),que);
 if(*it==que){                                 //The simplest way
    return it-a.begin();
 }
 return -1;
}
//========binarysearch=========



//=======SUBSET WITH BRUTEFORCE=============
void subsets(int S[], int n) {
     int nSub = 1<<n; 
     for(int i=0; i<nSub; i++){
     	  cout<<"{ ";//optional
          for(int k=0; k<n; k++){
               //if the k-th bit is set
               if( (1<<k) & i){
                    cout<<S[k]<<" ";
               } 
          }
          cout<<"}\n"; //optional
     }
}
//======SUBSET WITH BRUTE FORCE================


//======permuatate all ==================
void permutate(){
int n,x;
cin>>n;

vector<int> permutation;
for (int i = 0; i < n; i++) {
	cin>>x;
permutation.push_back(x);
}
do {
 rep(i,0,n-1) cout<<permutation[i];
 cout<<endl;
} while (next_permutation(permutation.begin(),permutation.end()));

}
//====permuatate all======================


//====check prime =========================

bool prima(int x){
	if(x==1){
		return false;
	}

	for(int i=2;i<=sqrt(x);i++){
		if(x % i == 0){
			return false;
		}
	}

	return true;
}
//===check prime ========================


//======= the end of bisma c++ template ============


ll s(ll x){
  string sol=to_string(x);

  ll sum =0;

  rep(i,0,sol.size()-1) sum=sum+(ll)sol[i]-'0';

  return sum;
}


int main() {

string a,b,c;

cin>>a>>b>>c;

cout<<(char)toupper(a[0])<<(char)toupper(b[0])<<(char)toupper(c[0]);

    return 0;
}





















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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    vector<int64_t> a(n), b(n);
    for (auto i : irange(0L, n)) {
        cin >> a[i];
    }
    for (auto i : irange(0L, n)) {
        cin >> b[i];
    }

    int64_t ans = 0;
    for (auto i : irange(0L, 30L)) {
        vector<int64_t> c(n), d(n);
        for (auto j : irange(0L, n)) {
            c[j] = (a[j] & ((1L << i) - 1));
            d[j] = (b[j] & ((1L << i) - 1));
        }
        sort(c.begin(), c.end());
        sort(d.begin(), d.end());
        int64_t carry_over = 0;
        for (auto cc : c) {
            carry_over +=
                    d.end() - lower_bound(d.begin(), d.end(), (1L << i) - cc);
        }

        int64_t na = 0, nb = 0;
        for (auto j : irange(0L, n)) {
            if ((a[j] & (1 << i))) {
                ++na;
            }
            if ((b[j] & (1 << i))) {
                ++nb;
            }
        }

        auto n1 = na * (n - nb) + (n - na) * nb + carry_over;
        if (n1 % 2 > 0) {
            ans |= (1L << i);
        }
    }

    cout << ans << endl;
}

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

int main(){ 

    int a,b,c;
    cin >> a >> b >> c;

    if(a == b){
        cout << c << endl;
    }else if(b == c){
        cout << a << endl;
    }else{
        cout << b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n;
int main()
{
	cin >>n;
	cout <<n*n*3;
	return 0;
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
ll n,y,u,v,res;
double x;
vector<vector<int> > g(20,vector<int>(20,0));
int main(){
	n=read();
	for(int i=0;i<n;i++){
		cin >> x;
		y=x*1000000000+0.1;
		u=v=0;
		while(y%2==0)
			y/=2,u++;
		while(y%5==0)
			y/=5,v++;
		u=min(u,18ll);
		v=min(v,18ll);
		for(int j=18-u;j<=18;j++)
			for(int k=18-v;k<=18;k++)
				res+=g[j][k];
		g[u][v]++;
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <string>

using namespace std;

int main() {
	int N, K, D[10] = {0};
	cin >> N >> K;
	for (int i = 0; i < K; i++){
		int c;
		cin >> c;
		D[c] = 1;
	}
	
	for (int i = N;; i++){
		bool flag = true;
		for (int j = i; j != 0; j /= 10){
			if(D[j % 10]){
				flag = false;
				break;
			}
		}

		if(flag){
			cout << i << endl;
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s, s0 string
	fmt.Scan(&s)
	for v := range s {
		if s0 == s[v:v+1] {
			fmt.Println("Bad")
			return
		}
		s0 = s[v : v+1]
	}
	fmt.Println("Good")
}


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

#define sync {ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
#define ll long long int
#define mod 1000000007


int s;

void solve()
{
    cin>>s;
    
    string ans = "";
    
    for(int i =0;i<s;i++)
        ans +="ACL";
    
    cout<<ans;
    
}

int main()
{
    sync;
    int t = 1;
   // cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
}







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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    string x;
    int l;
    cin >> x;
    l=x.SZ;
    while(l--)cout << "x";
    return 0;
}


Measured memory_bytes: 256
// https://s8pc-4.contest.atcoder.jp/tasks/s8pc_4_d
#include <cstdio>
#include <algorithm>
#include <vector>
#include <tuple>

using namespace std;

vector<tuple<int, double>> G[150000];
double expects[150000];

double dfs(int cur, int last)
{
  double sum = 0;
  int branches = 0;
  for (auto& ce : G[cur]) {
    int c;
    double e;
    c = get<0>(ce);
    if (c == last) {
      continue;
    }
    branches++;
    e = dfs(c, cur);
    e++;
    get<1>(ce) = e;
    sum += e;
  }
  if (branches == 0) {
    return 0;
  }
  return sum / branches;
}

void dfs2(int cur, int last, double cle)
{
  double sum = 0;
  for (auto& ce : G[cur]) {
    int c;
    double e;
    tie(c, e) = ce;
    if (c == last) {
      sum += cle;
      continue;
    }
    sum += e;
  }
  for (auto& ce : G[cur]) {
    int c;
    double e;
    tie(c, e) = ce;
    if (c == last) {
      continue;
    }
    double ep = (sum - e); // / (G[cur].size()-1);
    // printf("cur = %d, last = %d, ep = %f\n", cur, last, ep);
    if (ep != 0) {
      ep /= (G[cur].size()-1);
    }
    dfs2(c, cur, ep+1);
  }
  expects[cur] = sum / G[cur].size();
}

int main()
{
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n-1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    G[u].push_back(make_tuple(v, 0));
    G[v].push_back(make_tuple(u, 0));
  }
  dfs(0, -1);
  dfs2(0, -1, 0);
  for (int i = 0; i < n; i++) {
    printf("%.12f\n", expects[i]);
  }
  return 0;
}


Measured memory_bytes: 21248
#include <bits/stdc++.h>
#define F(i, a, b) for (int i = a; i <= b; ++i)

const int MS = 2e5 + 5;
int n, m, f[MS], s[MS];

int getf(int x) { return x == f[x] ? x : (f[x] = getf(f[x])); }
void merge(int x, int y)
{
	int fx = getf(x), fy = getf(y);
	if (fx == fy) return;
	if (s[fx] >= s[fy]) f[fy] = fx, s[fx] += s[fy];
	else f[fx] = fy, s[fy] += s[fx];
}

int main()
{
	scanf("%d%d", &n, &m);
	F(i, 1, n) s[i] = 1, f[i] = i;
	F(i, 1, m)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		merge(a, b);
	}
	int ans = 0;
	F(i, 1, n) ans = std::max(ans, s[getf(i)]);
	printf("%d", ans);
	return 0;
}

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

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

    ll K, A, B;
    cin >> K >> A >> B;

    ll t1 = A/K * K;;
    ll t2 = (A/K+1) * K;
    if((t1>=A && t1<=B) || (t2>=A && t2<=B)){
        cout << "OK" << endl;
    }
    else cout << "NG" << endl;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <stack>
#include <cstdlib>
using namespace std;

main(){
  string in;
  while(cin >> in){
    char c;
    stack<double> data;
    data.push((double)atoi(in.c_str()));
    while(1){
      scanf("%c", &c);
      if(c=='\n') break;
      cin >> in;
      if(in.size()==1){
	if(in[0]<'0' || in[0]>'9'){
	  if(in[0]=='+'){
	    double a, b;
	    b=data.top(), data.pop();
	    a=data.top(), data.pop();
	    data.push(a+b);
	  }else if(in[0]=='-'){
	    double a, b;
	    b=data.top(), data.pop();
	    a=data.top(), data.pop();
	    data.push(a-b);
	  }else if(in[0]=='*'){
	    double a, b;
	    b=data.top(), data.pop();
	    a=data.top(), data.pop();
	    data.push(a*b);
	  }else if(in[0]=='/'){
	    double a, b;
	    b=data.top(), data.pop();
	    a=data.top(), data.pop();
	    data.push(a/b);
	  }
	}else{
	  data.push((double)atoi(in.c_str()));
	}
      }else{
	data.push((double)atoi(in.c_str()));
      }
    }
    printf("%.6f\n", data.top());
  }
  return 0;
}
      

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

int main()
{
	char c;
	cin>>c;
	cout<<(char)(c+1);
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main
{
	public static void main(String[] ar)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		String[] str = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);
		if(n%k==0)
			out.println(0);
		else
			out.println(1);
		out.flush();		
	}
}
/**

**/

Measured memory_bytes: 21204
import numpy as np

def my_index(l, x, default=-1):
    if x in l:
        return l.index(x)
    else:
        return default

def resolve():
    ansM = np.zeros((3,3))
    A1 = list(map(int,input().split()))
    A2 = list(map(int,input().split()))
    A3 = list(map(int,input().split()))
    A2.extend(A3)
    A1.extend(A2)
    N = int(input())
    for i in range(N):
        Bi = int(input())
        Q = my_index(A1,Bi)
        if Q >= 0:
            ansM[Q//3,Q%3] = 1
    bg = np.zeros(8)
    bg[0] = sum(ansM[0,:]) // 3
    bg[1] = sum(ansM[1,:]) // 3
    bg[2] = sum(ansM[2,:]) // 3
    bg[3] = sum(ansM[:,0]) // 3
    bg[4] = sum(ansM[:,1]) // 3
    bg[5] = sum(ansM[:,2]) // 3
    bg[6] = (ansM[0,0] + ansM[1,1] + ansM[2,2]) // 3
    bg[7] = (ansM[0,2] + ansM[1,1] + ansM[2,0]) // 3
    if sum(bg) > 0:
        print("Yes")
    else:
        print("No")
resolve()

Measured memory_bytes: 21332
# h, w, k = map(int, input().split())
# l = []
# s = 0

# for i in range(h):
#     c = list(input())
#     for j in range(w):
#         if c[j] == "#":
#             c[j] = 1
#         else:
#             c[j] = 0
#     l.append(c)

# l_sum = sum(map(sum, l))


# for i in range(h):
#     for j in range(w):
# print("")

h, w, k = map(int, input().split())
board = [list(input()) for _ in range(h)]
ans = 0
for paint_h in range(2 ** h):  # すべての行の塗りつぶし方を2進数で列挙する
    for paint_w in range(2 ** w):  # すべての列の塗りつぶし方を2進数で列挙する
        cnt = 0
        for i in range(h):  # すべてのi行目j列目の要素についてみる
            for j in range(w):
                if (paint_h >> i) & 1 == 0 and (
                    paint_w >> j
                ) & 1 == 0:  # 各行のi番目のビットと各列のj番目のビットがともに0であればそのマスは塗りつぶされない
                    cnt += board[i][j] == "#"  # 塗りつぶされないマスが黒マスであれば個数を+1する
        ans += cnt == k  # 塗りつぶされない黒マスの個数がKに等しければ答えを+1する
print(ans)


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

using LL = long long;

#define ALL(a) begin((a)), end((a))
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define RFOR(i, a, b) for (int(i) = (a); (i) > (b); (i)--)
#define debug(x) cout << #x << " : " << x << '\n'

const int INF = 1e9;
const LL LINF = 1e16;

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

  string ans = "IMPOSSIBLE";
  int N, M;
  cin >> N >> M;
  vector<vector<int>> liner(N + 1, vector<int>(0));
  FOR(i, 0, M) {
    int a, b;
    cin >> a >> b;
    liner[a].push_back(b);
  }

  int size = liner[1].size();

  FOR(i, 0, size) {
    int index = liner[1][i];
    auto result = find(liner[index].begin(), liner[index].end(), N);
    if (result == liner[index].end()) {
    } else {
      ans = "POSSIBLE";
    }
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
const int N=1000005;
int mark[N],prime[N],f[55];
long long cnt,n,ans;
void getPrime();
long long find(long long x);
int main()
{
	getPrime();
	cin>>n;
	for (int i=1;i<=50;i++)
	{
		f[i]=find(i);
	}
	for (int i=0;i<cnt&&prime[i]*prime[i]<=n;i++)
	{
		if (n%prime[i]==0)
		{
			long long num=0;
			//cout<<prime[i]<<' ';
			while (n%prime[i]==0)
			{
				num++;
				n/=prime[i];
			}
			ans+=f[num];
		}
	}
	if (n!=1)   ans++;
	cout<<ans;
	return 0;
} 
void getPrime()
{
	for (int i=2;i<N;i++)
	{
		if (!mark[i])   prime[cnt++]=i;
		for (int j=0;j<cnt&&prime[j]*i<N;j++)
		{
			mark[i*prime[j]]=1;
			if (i%prime[j]==0)   break;
		}
	}
}
long long find(long long x)
{
	int l=1,r=1000000,res=-1;
	while (l<=r)
	{
		long long mid=(l+r)/2;
		if (mid*(mid+1)/2<=x)
		{
			res=mid;
			l=mid+1;
		}
		else
		{
			r=mid-1;
		}
	}
	return res;
}

Measured memory_bytes: 7856
#include <iostream>

using namespace std;

int main()
{

    int a ,b, c;
    cin >> a >> b>> c;
    if (a!=b && b!=c && a != c){
cout<< 3 ;
    }
    else if (a==b && b ==c && a==c){
        cout<<1;
    }
    else
        cout<<2;
    return 0;
}


Measured memory_bytes: 256
import heapq

n, k = map(int, input().split())
h = list(map(lambda x: int(x)*(-1), input().split()))

if n <= k:
    print(0)
    exit()

heapq.heapify(h)

for _ in range(k):
    heapq.heappop(h)

print(sum(h)*(-1))

Measured memory_bytes: 25896
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 

const ll large_P = 1e9 + 7;


int main(){
  string S;
  cin >> S;
  
  if(S.at(2) == S.at(3) && S.at(4) == S.at(5)) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 256
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int N;
char chr[128];
char K[128];
int main() {
	cin>>N;
	cin>>chr;
	int chrlen=strlen(chr);
	int ans=0;
	for(int i=0;i<N;i++){
		cin>>K;
		int Klen=strlen(K);
		for(int j=0;j<Klen;j++){
			for(int k=1;j+(chrlen-1)*k<Klen;k++){
				for(int l=0;l<chrlen;l++){
					if(K[j+l*k]!=chr[l]){
						goto fail;
					}
				}
				ans++;
				goto naxtk;
			  fail:;
			}
		}
	  naxtk:;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3056