akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<queue>
using namespace std;
int n,m,topo[100005],order[100005],in[100005],topo_cnt,dp[100005];
int head[100005],cnt,ans;
queue<int> q;
struct node
{
	int to;
	int next;
}edge[100005];
void add(int x,int y)
{
	cnt++;
	edge[cnt].to=y;
	edge[cnt].next=head[x];
	head[x]=cnt;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y);
		in[y]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(in[i]==0) q.push(i);
	}
	while(!q.empty())
	{
		int temp=q.front(); 
		q.pop();
		if(topo[temp]) continue;
		topo[temp]=++topo_cnt;
		order[topo_cnt]=temp;
//		printf("%d\n",temp);
		for(int i=head[temp];i;i=edge[i].next) 
		{
			if(in[edge[i].to]>0)
			{
				in[edge[i].to]--;
				if(in[edge[i].to]==0) q.push(edge[i].to); 
			}
		}
	}
	for(int i=n;i>=1;i--)
	{
		int temp=order[i];
//		printf("%d\n",temp);
		for(int j=head[temp];j;j=edge[j].next) 
		{
			dp[temp]=max(dp[temp],dp[edge[j].to]);
		}
		ans=max(ans,dp[temp]);
		dp[temp]++;
	}
	printf("%d\n",ans);
	return 0;
}

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

int main() {
  int a;
  cin >> a;
  vector<int> vec(a+1);

	for(int i=0;i<a;i++)cin >> vec.at(i);
	for(int i=1;i<a;i++)vec.at(i)+=vec.at(i-1);
	// cout << vec.at(a-1) << endl; 
	int s = vec.at(a-1);
	int M = 1000000;
	for(int i=0;i<a;i++)M = min(M,abs(s-vec.at(i)*2));
	cout << M << endl;
}

Measured memory_bytes: 3628
while (n, r = gets.split(" ").map!{|i| i = i.to_i}) != [0, 0] do
  yama = []
  r.times {yama.unshift gets.split(" ").map{|i| i.to_i}}
  top = 0
  yama.each do |p, c|
    if top < c
      top += p - 1
    elsif top < p + c - 1
      top -= c
    end
  end
  puts n - top
end

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

using namespace std;
#define mp make_pair
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef pair<int,int> pii;
typedef long long ll;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    if(s.find('7') != s.npos){
        cout << "Yes" << endl;
    }else
    {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Diagnostics;
using static System.Console;
using static System.Math;


namespace AtCoder
{
    class AtCoderrrrr
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            int[] input = ReadLine().Split(' ').Select(int.Parse).ToArray();
            
            int ans = 0;
            for (int i = 0; i < n; i++)
            {
                if (input[input[i]-1]-1 == i) ans++;
            }
            WriteLine(ans/2);
        }
    }
}


Measured memory_bytes: 18016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793

int main(){
    string o, e;
    cin >> o >> e;

    string ans = "";
    int len = e.size();
    for(int i = 0; i < o.size(); i++){
        ans += o[i];
        if(len){
            ans += e[i];
            len--;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){

    double x1,y1,x2,y2,xq,yq,xr,yr;
    while(scanf("%lf,%lf,%lf,%lf,%lf,%lf",&x1,&y1,&x2,&y2,&xq,&yq)!=EOF){

        double a=y1-y2,b=x2-x1,c=x1*(y2-y1)-y1*(x2-x1);
        double x=xq-a*(a*xq+b*yq+c)/(a*a+b*b),y=yq-b*(a*xq+b*yq+c)/(a*a+b*b);
        double xr=x*2-xq,yr=y*2-yq;
        printf("%lf %lf\n",xr,yr);
    }
    return 0;
}

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

using namespace std;

int main()
{
	int N, C, K;
	vector<int> t;
	cin >> N >> C >> K;
	t.resize(N);
	for(int i=0;i<N;i++){
		cin >> t[i];
	}
	sort(t.begin(), t.end());

	int ans = 1;
	int i = 1;
	int passenger = 1;
	int first_time = t[0];
	while(i < t.size()){
		if(passenger < C && t[i] <= first_time + K){
			passenger++;
		}else{
			ans++;
			passenger = 1;
			first_time = t[i];
		}
		i++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
defmodule Main do
  def main do
    k = IO.gets("") |> String.trim() |> String.to_integer()
    s = IO.gets("") |> String.trim()

    ans =
      if String.length(s) > k do
        String.slice(s, 0, k) <> "..."
      else
        s
      end

    IO.puts(ans)
  end
end

Measured memory_bytes: 31060
import itertools
import bisect

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

aa = [0] + list(itertools.accumulate(A))
bb = [0] + list(itertools.accumulate(B))

ans = bisect.bisect_left(aa, K)-1
ans = max(ans, bisect.bisect_left(bb, K)-1)

for i in reversed(range(N+1)):
    tmp_K = K-aa[i]
    if tmp_K == 0:
        ans = max(ans, i)
    elif tmp_K < 0:
        continue

    if i + M <= ans:
        continue

    if tmp_K >= bb[-1]:
        ans = max(ans, i+M)
        continue

    ans = max(ans, bisect.bisect_left(bb, tmp_K)-1+i)
print(ans)


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

int main(void)
{
  ll n; cin >> n;
  string s; cin >> s;
  ll x= 0;

  ll ans = 0;

  REP(i, n) {
    switch(s[i]) {
    case 'I':
      x++;
      if(x>ans) ans = x;
      break;
    case 'D':
      x--;
    }
  }
  
  
   cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;

const int mod = 1e9+7;
const int N = 6e5+6;
const int M = 2e6+6;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
int n;
string s;
void Z(string& s,vector<int>& z){
    int c=0, n=sz(s);
    z.resize(n,0);
    rep(i, 1, n) {
        int l = i - c;
        if(i + z[l] < c + z[c]) z[i] = z[l];
        else{
            int j = max(0, c + z[c] - i);
            for(;i + j < n&&s[j] == s[i+j]; ++j);
            z[i] = j;
            c = i;
        }
    }
    z[0] = n;
}
int main() {
    cin>>n>>s;
    int ans = 0;
    rep(i, 0, n) {
        vi z;
        string t = s.substr(i, n - i);
        Z(t, z);
        //de(t);
        //rep(j, 0, sz(t)) dd(j),de(z[j]);
        rep(j, 0, sz(t)) {
            ans = max(ans, min(j, z[j]));
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

const ll MAXN = 200000;
const ll MOD = 998244353;
 

ll N, ans=1, tmp=0;
map<ll, ll> M;

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

signed main(){
    cin >> N;
    for(int i=0;i<N;i++) {
        ll a;
        cin >> a;
        tmp = max(tmp, a);
        M[a]++;
        if(!i&&a!=0) {
            cout << 0 << endl;
            return 0;
        }
        if(i&&a==0) {
            cout << 0 << endl;
            return 0;
        }
    }
    for(int i=0;i<=tmp;i++) {
        if(i>1) {
            ans *= modpow(M[i-1], M[i], MOD);
            ans %= MOD;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6528
// Template begins
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <math.h>
#include <iomanip>
#include <queue> 
#include <string.h>
#include <string>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(v) (v).begin(),(v).end()
#define sort0(v) sort(all(v))
#define lbb(a,b,arr,x) lower_bound(arr+a,arr+b+1,x)-arr
#define ubb(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-arr
#define freq(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-lower_bound(arr+a,arr+b+1,x)
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
#define max3(a,b,c) max(max((a),(b)),(c))
#define max4(a,b,c,d) max(max((a),(b)),max((c),(d)))
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
#define printp(x) cout << x.ff << " " << x.ss << endl

const ll mod=998244353;
#define inf 9999999999999
#define MAXN   100001 
  
// stores smallest prime factor for every number 

 
ll inv(ll i){if(i==1) return 1;return (mod-((mod/i)*inv(mod%i))%mod)%mod;}
 
ll gcd(ll a,ll b){if(a==0) return b;return gcd(b,b%a);}
inline void fastio(){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
// Template ends
const int MN = 2e5+7;
bool visited[100001];
int color[100001];
vector<long> v; 

//
//ll input[100002][100002];
//ll arr[300000];


int main(){
    fastio();
    //write code
    int n; cin>>n;
    string s; cin>>s;
    ll countw=0;
    for(int i=0;i<n;i++){
        if(s[i]=='W')
            countw++;
    }
    if(countw==n || countw==0){
        cout<<0<<endl;
    }else{
        string compare="";
        for(int i=0;i<n-countw;i++){
            compare+='R';
        }
        for(int i=n-countw;i<n;i++){
            compare+='W';
        }
        ll ans=0;
        for (int i=0;i<n-countw;i++){
            if(compare[i]!=s[i]){
                ans++;
            }
        }
        cout<<ans<<endl;
    }
    
    
}

 

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

using namespace std;

typedef long long ll;

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

double calc(int x, const double K) {
    double possibility = 1;
    while (x < K) {
        x *= 2;
        possibility *= 0.5;
    }
    return possibility;
}

int main(void) {
    int N, K;
    cin >> N >> K;

    double acc = 0;
    for (int i = 1; i <= N; i++) {
        acc += 1.0 / double(N) * calc(i, K);
    }

    printf("%.10f\n", acc);

    return 0;
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

void dfs(ll& flag, vector<vector<int>> edge, int now, int n) {
	flag += ((ll)1 << now);
	int next;
	//printf("%d\n", now);
	rep(i, n) {
		if (edge[now][i] && !(flag & ((ll)1 << i))) {
			dfs(flag, edge, i, n);
		}
	}
	return;
}

int main() {

	int n, m;
	scanf("%d%d", &n, &m);
	vector<vector<int>> edge(n, vector<int>(n));
	int tmp1, tmp2;
	vector<int> a(m);
	vector<int> b(m);
	rep(i, m) {
		scanf("%d%d", &tmp1, &tmp2);
		a[i] = tmp1 - 1;
		b[i] = tmp2 - 1;
		edge[tmp1 - 1][tmp2 - 1] = 1;
		edge[tmp2 - 1][tmp1 - 1] = 1;
	}
	ll ans = 0;
	rep(i, m) {
		ll flag = 0;
		edge[a[i]][b[i]] = 0;
		edge[b[i]][a[i]] = 0;

		dfs(flag, edge, 0, n);

		ans += (flag != ((ll)1 << n) - 1);
		edge[a[i]][b[i]] = 1;
		edge[b[i]][a[i]] = 1;
	}

	printf("%lld\n", ans);
}

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

int main()
{
	vector<char> S(3);
	cin >> S[0] >> S[1] >> S[2];
	sort(S.begin(),S.end());
	if(S[0] == 'a' && S[1] == 'b' && S[2] == 'c'){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LS()
    if a[1][0] == "+":
        print(int("".join(a[0])) + int("".join(a[2])))
    else:
        print(int("".join(a[0])) - int("".join(a[2])))
    return

#B
def B():
    _ = II()
    t = LI()
    tsum = sum(t)
    for _ in range(II()):
        p, x = LI()
        print(tsum - t[p - 1] + x)
    return

#C
def C():
    n = II()
    a = LI()
    d = defaultdict(int)
    ans = 1
    if n & 1:
        for i in a:
            if i & 1:
                print(0)
                return
            d[i] += 1
        for a, b in d.items():
            if a:
                if b == 2:
                    ans *= 2
                    ans %= mod
                    continue
                print(0)
                return
            if b == 1:
                continue
            print(0)
            return
    else:
        for i in a:
            if i & 1:
                d[i] += 1
                continue
            print(0)
            return
        for a, b in d.items():
            if b == 2:
                ans *= 2
                ans %= mod
                continue
            print(0)
            return
    print(ans)
            
        
    return

#D
def D():
    n = II()
    binmax = len(bin(n)) - 2
    dp = [[0] * 3 for i in range(binmax + 1)]
    dp[0][0] = 1
    for i in range(binmax):
        if (n >> binmax - i - 1) & 1:
            dp[i + 1][0] = dp[i][0] % mod
            dp[i + 1][1] = (dp[i][0] + dp[i][1]) % mod
            dp[i + 1][2] = (2 * dp[i][1] + 3 * dp[i][2]) % mod
        else:
            dp[i + 1][0] = (dp[i][0] + dp[i][1]) % mod
            dp[i + 1][1] = dp[i][1] % mod
            dp[i + 1][2] = (dp[i][1] + 3 * dp[i][2]) % mod
    print(sum(dp[binmax]) % mod)

    return


#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 41712
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    string s, t;
    cin >> s >> t;
    ll n = s.size();

    vl v1(26), v2(26);
    rep(i, n) {
        v1[s[i] - 'a']++;
        v2[t[i] - 'a']++;
    }
    sort(all(v1));
    sort(all(v2));

    bool ok = true;
    rep(i, 26) {
        if(v1[i] != v2[i]) {
            ok = false;
        }
    }

    if(ok) {
        out("Yes");
    }
    else {
        out("No");
    }

    re0;
}

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

int main() {
    int N, D;
    cin >> N >> D;
    
    if (N % (2*D+1) != 0) cout << N / (2*D+1) + 1 << endl;
    else cout << N / (2*D+1) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstring>
#define PI 3.14159265358979
using namespace std;
double ans,a,b,x,tp;
int main(){
    scanf("%lf %lf %lf",&a,&b,&x);
    if(0.5*b*a==(x/a))printf("%.10lf",atan(b/a)*180/PI);
    else if(0.5*b*a<(x/a))printf("%.10lf",atan(((b*a*a-x)*2/a)/(a*a))*180/PI);
    else printf("%.10lf",atan(b/((x/a)*2/b))*180/PI);
}

Measured memory_bytes: 256
//Asimple
#include <iostream>
using namespace std;
typedef char TElemType;
#define OK 1
typedef int Status;
typedef struct BiNode {
    TElemType data;
    struct BiNode *lchild, *rchild;
} BiNode, *BiTree;
const int N = 26;
char c;
char s[N];
int i;

void CreateBiTree(BiTree &T) {

    if (T == NULL) {
        T = new BiNode;
        T->data = s[i];
    } else {
        cout << "?" << T->data << s[i]<<endl;
        char ans;
        cin >> ans;
        if (ans == '<') {
            CreateBiTree(T->rchild);
        } else {
            CreateBiTree(T->lchild);
        }
    }
}
int pr(BiTree T){
    if(T==NULL) return OK;
    else{
        pr(T->lchild);
        cout<<T->data;
        pr(T->rchild);
    }
}
int main() {
# ifdef ONLINE_JUDGE
# else
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
# endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    int A,B;
    cin>>A>>B;
    cout<<A*B<<endl;
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<ld> vld;

#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()

int main()
{
	fastIO;
	int x; cin >> x;
	cout << (x == 0) << endl;

	return 0;
}

Measured memory_bytes: 3604
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[][] map = new int[2][n];
            int max = 0;
            for (int i = 0; i < 2; i++) {
                for (int j = 0; j < n; j++) {
                    map[i][j] = in.nextInt();
                }
            }

            int prev = Arrays.stream(map[1]).sum();
            prev += map[0][0];
            max = prev;
            for (int i = 1; i < n; i++) {
                int tmp = prev;
                tmp += map[0][i] - map[1][i - 1];
                max = Math.max(max, tmp);
                prev = tmp;
            }

            out.print(max);

        }

    }
}



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

int main() {
  int n,k;
  cin >> n;
  k=30;
  
  for(int i=0;i<n;i++){
    int a[i];
    cin >> a[i];
    int D=0;
    
    while(a[i]%2==0){
      D++;
      a[i]/=2;
    }
    k=min(D,k);
  }
	cout << k <<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        while (true) {
            int d = sc.nextInt();
            int w = sc.nextInt();

            if (d == 0 && w == 0)
                break;

            int[][] pond = new int[d][w];

            for (int[] row : pond) {
                for (int i=0; i < row.length; i++) {
                    row[i] = sc.nextInt();
                }
            }

            int ans = 0;

            for (int startD = 0; startD < d-2; startD++) {
                for (int startW = 0; startW < w-2; startW++) {

                    for (int endD = startD+2; endD < d; endD++) {
                        for (int endW = startW+2; endW < w; endW++) {

                            int lowestAround = check(pond, startD, startW, endD, endW);
                            if (lowestAround != -1) {

                                int size = lowestAround * (endD - startD - 1) * (endW - startW - 1)
                                        - sum(pond, startD+1, startW+1, endD-1, endW-1);
                                ans = Math.max(ans, size);

                            }

                        }
                    }

                }
            }

            System.out.println(ans);
         }

    }

    private static int check(int[][] pond, int startD, int startW, int endD, int endW) {
        int lowestAround = Integer.MAX_VALUE;
        for (int i=startD; i <= endD; i++) {
            lowestAround = Math.min(pond[i][startW], lowestAround);
            lowestAround = Math.min(pond[i][endW], lowestAround);
        }
        
        for (int i=startW; i <= endW; i++) {
            lowestAround = Math.min(pond[startD][i], lowestAround);
            lowestAround = Math.min(pond[endD][i], lowestAround);
        }

        for (int i=startD+1; i < endD; i++) {
            for (int j=startW+1; j < endW; j++) {
                if (pond[i][j] >= lowestAround)
                    return -1;
            }
        }

        return lowestAround;
    }

    private static int sum(int[][] pond, int startD, int startW, int endD, int endW) {
        int sum = 0;
        for (int i=startD; i <= endD; i++) {
            for (int j=startW; j <= endW; j++) {
                sum += pond[i][j];
            }
        }
        return sum;
    }

}



Measured memory_bytes: 35848
import java.util.*;

class Main{
    public static void main(String[] args){
    	Scanner sc= new Scanner(System.in);
    	int max=-1000000,min=1000000,get=0;
    	long sum=0;
    	int i=sc.nextInt();
    	for(;i>0;i--){
    		get=sc.nextInt();
    		max=Math.max(max, get);
    		min=Math.min(min, get);
    		sum+=get;
    	}
    	System.out.println(min+" "+max+" "+sum);
    }
}

Measured memory_bytes: 42112
#include<cstdio>
#include<iostream>
#include<map>
#include<string>

using namespace std;

typedef map<string,string> MSS;

#define MSSVT MSS::value_type

int main(){
	
	string gc;
	string inp;
	string sea;
	string hen;
	string ans;
	MSS data1,data2;

	data1.insert(MSSVT("101"," "));
	data1.insert(MSSVT("010001","."));
	data1.insert(MSSVT("000011",","));
	data1.insert(MSSVT("10010001","-"));
	data1.insert(MSSVT("000000","'"));
	data1.insert(MSSVT("000001","?"));
	data1.insert(MSSVT("100101","A"));
	data1.insert(MSSVT("10011010","B"));
	data1.insert(MSSVT("0101","C"));
	data1.insert(MSSVT("0001","D"));
	data1.insert(MSSVT("110","E"));
	data1.insert(MSSVT("01001","F"));
	data1.insert(MSSVT("10011011","G"));
	data1.insert(MSSVT("010000","H"));
	data1.insert(MSSVT("0111","I"));
	data1.insert(MSSVT("10011000","J"));
	data1.insert(MSSVT("0110","K"));
	data1.insert(MSSVT("00100","L"));
	data1.insert(MSSVT("10011001","M"));
	data1.insert(MSSVT("10011110","N"));
	data1.insert(MSSVT("00101","O"));
	data1.insert(MSSVT("111","P"));
	data1.insert(MSSVT("10011111","Q"));
	data1.insert(MSSVT("1000","R"));
	data1.insert(MSSVT("00110","S"));
	data1.insert(MSSVT("00111","T"));
	data1.insert(MSSVT("10011100","U"));
	data1.insert(MSSVT("10011101","V"));
	data1.insert(MSSVT("000010","W"));
	data1.insert(MSSVT("10010010","X"));
	data1.insert(MSSVT("10010011","Y"));
	data1.insert(MSSVT("10010000","Z"));
	data2.insert(MSSVT(" ","11010"));
	data2.insert(MSSVT(".","11011"));
	data2.insert(MSSVT(",","11100"));
	data2.insert(MSSVT("-","11101"));
	data2.insert(MSSVT("'","11110"));
	data2.insert(MSSVT("?","11111"));
	data2.insert(MSSVT("A","00000"));
	data2.insert(MSSVT("B","00001"));
	data2.insert(MSSVT("C","00010"));
	data2.insert(MSSVT("D","00011"));
	data2.insert(MSSVT("E","00100"));
	data2.insert(MSSVT("F","00101"));
	data2.insert(MSSVT("G","00110"));
	data2.insert(MSSVT("H","00111"));
	data2.insert(MSSVT("I","01000"));
	data2.insert(MSSVT("J","01001"));
	data2.insert(MSSVT("K","01010"));
	data2.insert(MSSVT("L","01011"));
	data2.insert(MSSVT("M","01100"));
	data2.insert(MSSVT("N","01101"));
	data2.insert(MSSVT("O","01110"));
	data2.insert(MSSVT("P","01111"));
	data2.insert(MSSVT("Q","10000"));
	data2.insert(MSSVT("R","10001"));
	data2.insert(MSSVT("S","10010"));
	data2.insert(MSSVT("T","10011"));
	data2.insert(MSSVT("U","10100"));
	data2.insert(MSSVT("V","10101"));
	data2.insert(MSSVT("W","10110"));
	data2.insert(MSSVT("X","10111"));
	data2.insert(MSSVT("Y","11000"));
	data2.insert(MSSVT("Z","11001"));

	
	while(getline(cin,inp)){
		if(cin.eof()) break;
		hen=("");
		for(int i=0;i<inp.size();i++){
			sea=inp[i];
			//cout<<inp[i]<<"||"<<endl;
			hen+=data2[sea];
		}
		ans=("");
		sea=("");
		for(int i=0;i<hen.size();i++){
			sea+=hen[i];
			if(data1.find(sea)!=data1.end()){
				ans+=data1[sea];
				//cout<<data1[sea]<<","<<sea<<endl;
				sea=("");
			}
		}
		cout<<ans<<endl;
	}

}

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

int main() {
    int k;
    string s;
    string kq;

    cin >> k;
    cin >> s;

    int dodai = s.length();

    if (k < 1 || k > 100)
        return 0;

    if (dodai < 1 || dodai > 100)
        return 0;

    for (int i = 0; i < k; ++i)
    {
        if (k > dodai)
        {
            cout << s;
            return 0;
        }
        if (s[i] >= 'a' && s[i] <= 'z')
            kq += s[i];
        else
            return 0;
    }

    if (k < dodai)
        kq += "...";

    cout << kq;

    return 0;
}

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

int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	for(int i=0, j=0; i<n; i=j) {
		while(j < n && s[i] == s[j])
			j++;
		ans++;
	}
	cout << ans;
}

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

const int INF = 1e+10;


bool buy ( vector<int> Y, int X, int M) {
    bool flg = true;
    for ( int i = 0; i < M; ++i){
        if ( Y[i] < X ) flg = false;
    }
    return flg;
}

int main() {
    int N,M,X;
    cin >> N >> M >> X;
    vector<int> C(N);
    vector<vector<int>> A(N,vector<int>(M));
    
    for ( int i = 0; i < N; ++i){
        cin >> C[i];
        for ( int j = 0; j < M; ++j){
            cin >> A[i][j];
        }
    }
    
    // 参考書で全探索
    int mincost = INF;
    for ( int i = 0; i < (1<<N); ++i){
        //vector<int> B;
        int cost = 0;
        vector<int> Y(M,0);
        for ( int j = 0; j < N; ++j){
            //cout << "B" << endl;
            if ( i & (1<<j) ){
                //参考書jを買う
                cost = cost + C[j];
                for ( int k = 0; k < M; ++k ){
                    Y[k] = Y[k] + A[j][k];
                }
            }
        }
        bool flg = buy(Y,X,M);
        if ( flg ){
            mincost = min(cost,mincost);
        }
    }
    
    
    if ( mincost == INF ){
        cout << -1 << endl;
    } else {
        cout << mincost << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 3628
def isok(n):
    for i in range(w-2):
        if n >> i & 1 and n >> (i+1) & 1:
            return False
    return True
mod = 10**9+7
h,w,k = map(int,input().split())
h += 1
if w == 1:
    print(1)
    exit()
if w == 2:
    print(2**(h-2))
    exit()
dp = [[0]*(w+1) for _ in range(h+1)]
dp[1][1] = 1
amida = [0]*(w)
noamida = [0]*(w+1)
for i in range(2**(w-1)):
    if isok(i):
        for j in range(w-1):
            amida[j+1] += i >> j & 1
        for j in range(w-2):
            if i >> j & 1 == 0 and i >> (j+1) & 1 == 0:
                noamida[j+2] += 1
        if i >> 0 & 1 == 0:
                noamida[1] += 1
        if i >> (w-2) & 1 == 0:
                noamida[w] += 1
for i in range(1,h):
    dp[i+1][1] = (dp[i][2]*amida[1]+dp[i][1]*noamida[1]) % mod
    dp[i+1][w] = (dp[i][w-1]*amida[w-1]+dp[i][w]*noamida[w]) % mod
    for j in range(2,w):
        dp[i+1][j] = (dp[i][j-1]*amida[j-1]+dp[i][j+1]*amida[j]+dp[i][j]*noamida[j]) % mod
print(dp[h][k])

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

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

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

    long long ans = 0;
    for(int i = 1; i < n; i++){
        long long x, y;
        x = (A[i] - A[i - 1]) * a;
        y = b;
        ans += min(x, y);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
n, m = input().split(' ')
n, m = int(n), int(m)

amt = [1 for i in range(n)]
red = [i == 0 for i in range(n)]

for i in range(m):
	a, b = input().split(' ')
	a, b = int(a), int(b)
	a -= 1
	b -= 1

	amt[a] -= 1
	amt[b] += 1

	red[b] |= red[a]

	if amt[a] == 0:
		red[a] = False

print(sum(red))

Measured memory_bytes: 4760
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<ll>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    ll sum = accumulate(all(a), 0LL);

    ll aa = 0, b, c = LINF;
    while(c-aa != 1) {
        b = (c+aa)>>1;

        int j = 0;
        int k = 0;
        ll suma = 0, sumb = 0;
        bool ok = false;
        rep(i, n) {
            while(j <= 2*n and suma < b) {
                suma += a[j%n];
                j++;
            }
            while(k <= 2*n and sumb < b+suma) {
                sumb += a[k%n];
                k++;
            }
            if(sum-sumb >= b) {
                ok = true;
                break;
            }
            suma -= a[i];
            sumb -= a[i];
        }
        if(ok) {
            aa = b;
        } else {
            c = b;
        }
    }
    cout << aa << endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

#define rep(i, n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    int n;
    cin>>n;
    vector<ll> d(n);
    rep(i,n){
        cin>>d[i];
    }

    ll ans=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            ans+=(d[i]*d[j]);
        }

    }
    cout<<ans<<endl;




    return 0;
}


Measured memory_bytes: 256
N = int(input())
H = [int(i) for i in input().split()]

ans = 0
suc = 0
pre_h = 0
for h in H:
    if pre_h >= h:
        suc += 1
        ans = max(ans, suc)
    else:
        suc = 0
    pre_h = h

print(ans)


Measured memory_bytes: 63984
#include <bits/stdc++.h>
using namespace std;
const int N=200005;
int read(){
	int x=0;
	char ch=getchar();
	while (!isdigit(ch))
		ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x;
}
int n,k,a[N];
char s[N];
int main(){
	n=read(),k=read();
	scanf("%s",s+1);
	for (int i=1;i<=n;i++)
		a[i]=s[i]-'A';
	int t=0,h=1;
	while (k--){
		if (!(a[h]^t)){
			a[h]^=1;
			continue;
		}
		if (!((a[h+1]^t)&1))
			a[h]^=1;
		t^=1;
		h++;
		if (h==n)
			break;
	}
	if (k>0&&(n&1))
		a[h]^=k&1;
	else if (k>0)
		h++;
	for (int i=h;i<=n;i++)
		putchar('A'+(a[i]^t));
	for (int i=n-h+2;i<=n;i++)
		putchar('A'+((n-i)&1));
	return 0;
}

/*
const int N=100005;
int n,k;
char s[N],s2[N]="           ";
int t=0;
void print(){
	printf("%s",s+1);
}
int main(){
	cin >> n;
	for (int i=1;i<=n;i++)
		s[i]='A';
	s[n+1]='\0';
	int cnt=0;
	while (1){
		getchar();
		int p=1,add=1;
		s2[p]=add>0?'R':'L';
		while (1<=p&&p<=n){
			if (s[p]=='A')
				add=-add;
			s[p]='A'+((s[p]-'A')^1);
			s2[p]=' ';
			p+=add;
			s2[p]=add>0?'R':'L';
		}
		s2[p]=' ';
		cnt++;
		printf("%3d: ",cnt);print();
	}
	return 0;
}*/
/*
  0: ABBAAABBBBAAAAABBBBBBAAAA						
  1: BBBAAABBBBAAAAABBBBBBAAAA						!
  2:  AABBBAAAABBBBBAAAAAABBBBA						
  3:  BABBBAAAABBBBBAAAAAABBBBA						
  4:   BAAABBBBAAAAABBBBBBAAAABA						
  5:    BBBAAAABBBBBAAAAAABBBBABA					!
  7:     BABBBBAAAAABBBBBBAAAABABA					
  8:      BAAAABBBBBAAAAAABBBBABABA					
  9: 	   BBBBAAAAABBBBBBAAAABABABA					!
 11: 	    BAABBBBBAAAAAABBBBABABABA	
 12: 	     BBAAAAABBBBBBAAAABABABABA				!
 14: 	      BBBBBBAAAAAABBBBABABABABA				!
 16: 		   BAAAABBBBBBAAAABABABABABA		
 17: 			BBBBAAAAAABBBBABABABABABA			!
 19: 			 BAABBBBBBAAAABABABABABABA			
 20: 			  BBAAAAAABBBBABABABABABABA			!
 22: 			   BBBBBBBAAAABABABABABABABA			!
 24: 				BAAAAABBBBABABABABABABABA
 25: 				 BBBBBAAAABABABABABABABABA		!
 27: 				  BAAABBBBABABABABABABABABA
 28: 				   BBBAAAABABABABABABABABABA
 30: 					BABBBBABABABABABABABABABA
 31: 					 BAAAABABABABABABABABABABA
 32: 					  BBBBABABABABABABABABABABA
 34: 					   BAABABABABABABABABABABABA
 35: 					    BBABABABABABABABABABABABA
2 6 10 13 15 18 21 23 26 29 33 
*/

Measured memory_bytes: 1408
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  ll n;cin>>n;
  ll a[n+10];rep(i,0,n)cin>>a[i];

  ll ans=0;
  rep(i,0,60){
    ll x=0;
    rep(j,0,n)if(a[j]>>i&1)x++;
    ll now=x*(n-x)%mod;
    rep(j,0,i)now=now*2%mod;
    ans+=now;
    ans%=mod;
  }
  out(ans);

  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
long long n,m,he,ge=0;
int main()
{
    cin>>n>>m;
    he=((long long)(m/n));//将he定值
    while(he>=1)//如果还>=1
    {
    	he=he/2;//累除
        ge++;//如果还要累除那就把个数++
    }
    cout<<ge;
    return 0;
}

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


int main() {
    int N,M;
    cin >> N >> M;
    vector<vector<int>> d(M,vector<int>(2));
    for(int i=0;i<M;i++){
        for(int j=0;j<2;j++){
            cin >> d.at(i).at(j);
        }
    }

    vector<int> V(N,-1);

    for(int i=0;i<M;i++){
//        V.at(d.at(i).at(0)-1)=d.at(i).at(1);
        int s=d.at(i).at(0);
        int c=d.at(i).at(1);
        if(V.at(s-1)!=-1 && V.at(s-1)!=c){
            V.at(0)=-2;
            break;
        }
        else V.at(s-1)=c;
    }

    if(V.at(0)==-1 && N>1) V.at(0)=1;

    for(int i=0;i<N;i++){
        if(V.at(i)==-1) V.at(i)=0;
    }

    if(V.at(0)==-2){
        cout << -1;
    }
    else if(V.at(0)==0 && N==1){
        cout << 0 ;
    }
    else if(V.at(0)==0 && N>1){
        cout << -1;
    }
    else{
        for(int i=0;i<N;i++){
            cout << V.at(i);
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<algorithm>
using namespace std;
bool slove(int a, int b, int c){ 
		if(a==b) return true;
		if(c*c == a*a + b*b) return true;
	return false;
}
int main(){
	int a,b,c,con_h=0,con_t=0;
	vector<int> n;
	bool flag;
	while(scanf("%d,%d,%d",&a,&b,&c) != EOF){
		n.clear();
		n.push_back(a); n.push_back(b); n.push_back(c);
		vector<int>::iterator it = n.begin();
		flag = slove(*it,*(it+1),0); 
		if(flag == true)
			con_h++;
		else{
			flag = slove(*it,*(it+1),*(it+2)); 
			if(flag == true)
				con_t++;
		}
	}
	cout << con_t << endl << con_h << endl;
}

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

using namespace std;

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

	vector<int> a(2);

	for(int i = 0; i < 2 ; i++){
		cin >> a[i];
	}

	bool is_find = false;

	for(int i = a[0] ; i <= a[1]; i++)
	{
		if( (i % k) == 0)
		{
			is_find=true;
			break;
		}
	}

	if(is_find)
	{
		cout << "OK" << endl;
	}
	else
	{
		cout << "NG" << endl;
	}

}


Measured memory_bytes: 3044
from itertools import accumulate
from math import ceil
N = int(input())
A = list(map(int, input().split()))


class BinaryIndexedTree:
    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= (i & -i)
        return s

    def add(self, i, x):
        while i <= self.size:
            self.bit[i] += x
            i += (i & -i)

    def reset(self):
        self.bit = [0] * (self.size + 1)


lo, hi = -1, 10 ** 9 + 1
BIT = BinaryIndexedTree(N + 1)
while hi - lo > 1:
    X = (hi + lo) // 2
    B = [(1 if a >= X else -1) for a in A]
    B = [0] + list(accumulate(B))
    B_sorted = {b: i for i, b in enumerate(sorted(B), start=1)}

    tmp = 0
    BIT.reset()
    for j, b in enumerate(B):
        tmp += BIT.sum(B_sorted[b])
        BIT.add(B_sorted[b], 1)

    if tmp >= ceil((N * (N + 1) / 2) / 2):
        lo = X
    else:
        hi = X

print(lo)


Measured memory_bytes: 133760
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
bool used[21];
int n,hx,hy,dx,dy;
vector<int> cx(21),cy(21);
vector<double> dist(21);
double pointdistance(int x1, int y1, int x2, int y2){
  return sqrt( (x1-x2)*(x1-x2) +(y1-y2)*(y1-y2) );
}
int dfs(int x, int y, int t,double s){
  if(t==n) return true;
  double nexts;
  REP(i,n){
    if(!used[i]){
      nexts = s + pointdistance(x,y,cx[i],cy[i]);
      if(nexts > dist[i] - EPS) return false; 
    }
  }
  REP(i,n){
    if(!used[i]){
      nexts = s + pointdistance(x,y,cx[i],cy[i]);
      used[i] = true;
      if(dfs(cx[i],cy[i],t+1,nexts)) return true;
      used[i] = false;
    }
  }
  return false;
}

int main(void){
  while(cin>>n>>hx>>hy>>dx>>dy,n){
    REP(i,n)cin>>cx[i]>>cy[i];
    REP(i,n)dist[i] = sqrt((cx[i]-dx)*(cx[i]-dx) +(cy[i]-dy)*(cy[i]-dy) );
    memset(used,0,sizeof(used));
    if(dfs(hx,hy,0,0.0)) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

Measured memory_bytes: 904
#include <iostream>
#include <vector>

using namespace std;

int main(){
  long long N; cin>>N;
  vector<long long> A(N);
  for(long long i=0;i<N;i++) cin>>A[i];
  volatile long long ans=0,sum=0,r=0,l=0;
  for(l=0;l<N;l++){
    while(r<N){ 
      if(r==l||((sum^A[r])==(sum+A[r]))){
        sum+=A[r];
        r++; 
      }
      else break;
    }
    ans+=r-l;
    sum-=A[l];
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int W, H;
	cin >> W >> H;

	vector<pii> P;
	REP(i, W) {
		int a;
		cin >> a;
		P.push_back(make_pair(a, 0));
	}
	REP(i, H) {
		int a;
		cin >> a;
		P.push_back(make_pair(a, 1));
	}
	SORT(P);
	int ans = 0;
	W++;
	H++;

	REP(i, P.size()) {
		if (P[i].second == 1) {
			ans += W * P[i].first;
			H--;
		}
		else {
			ans += H * P[i].first;
			W--;
		}
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 6512
import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    numbers = {}
    for ai in a:
        if not ai in numbers:
            numbers[ai] = 0
        numbers[ai] += 1
    s = sum(a)
    for b, c in bc:
        if b in numbers:
            s = s + (-b + c) * numbers[b]
            if not c in numbers:
                numbers[c] = 0
            numbers[c] += numbers[b]
            del numbers[b]
        print s
    return




n = RN()
a = RA()
q = RN()
bc = [RA() for _ in range(q)]
solve()


Measured memory_bytes: 105592
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<list>
#include<functional>
#define _USE_MATH_DEFINES
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define MOD 1000000007
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef complex<double> base;
int a[100];
int main() {
	int ans = INF;
	int n;
	scanf("%d", &n);
	fup(i, 0, n - 1, 1)
		scanf("%d", a + i);
	fup(k, -100, 100, 1)
	{
		int t = 0;
		fup(i, 0, n - 1, 1)
			t += (a[i] - k)*(a[i] - k);
		ans = min(ans, t);
	}
	printf("%d", ans);
}

Measured memory_bytes: 256
n=int(input())
a=[int(x) for x in input().split()]
anses=set()
for i in [0,1]:
    for j in range(1, int(a[i]**0.5)+1):
        if a[i] % j == 0:
            anses.add(j)
            if j != a[i] // j:
                anses.add(a[i] // j)
anses=sorted(anses,reverse=True)
for ans in anses:
    solvenum=0
    for j in a:
        if j%ans==0:
            solvenum+=1
    if solvenum==n or solvenum==n-1:
        print(ans)
        break

Measured memory_bytes: 63984