akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

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

using namespace std;
/** Problem0180 : Stellar Performance of the Debunkey Family **/
int cost[100][100];
int mincost[100];
bool used[100];
int V, E;

int prim()
{
	for (int i=0; i<V; i++) {
		mincost[i] = INF;
		used[i] = false;
	}
	mincost[0]=0;
	int res=0;
	
	while (1) {
		int v=-1;
		for (int u=0; u<V; u++) {
			if (!used[u] && (v == -1 || mincost[u] < mincost[v])) v=u;
		}
		
		if (v == -1) break;
		used[v] = true;
		res += mincost[v];
		
		for (int u=0; u<V; u++) {
			mincost[u] = min(mincost[u], cost[v][u]);
		}
	}
	return res;
}

int main()
{
	while (cin >> V >> E, V!=0 && E!= 0) {
		rep(i, 100) rep(j, 100) cost[i][j]=INF;
		
		rep(i, E) {
			int a, b, c;
			cin >> a >> b >> c;
			cost[a][b] = c;
			cost[b][a] = c;
		}
		cout << prim() << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,v,b,w,t;
    cin>>a>>v>>b>>w>>t;
    ll vv=abs(a-b);
    if(v<=w)return NO,0;
    ll tt=v-w;
    ll temp=(vv+tt-1)/tt;
    if(temp<=t)YES;
    else NO;
}


Measured memory_bytes: 3616
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 100010
#define LL long long
#define MO 1000000007
LL g[MAXN],p[MAXN],A,B,ans,a[MAXN];
int la[MAXN],lb[MAXN],ua[MAXN],ub[MAXN];
int n;
int main()
{
	scanf("%d%lld%lld",&n,&A,&B);
	n++;
	for(int i=2,j=2,k=2;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		if(i==1) la[i]=i,lb[i]=i,ua[i]=0,ub[i]=0;
		else
		{
			if(a[i-1]+A<=a[i]) la[i]=la[i-1];
			else la[i]=i;
			while(a[j]+A<=a[i])	j++;
			ua[i]=j-1;
			if(a[i-1]+B<=a[i]) lb[i]=lb[i-1];
			else lb[i]=i;
			while(a[k]+B<=a[i]) k++;
			ub[i]=k-1;
		}
	}
	g[1]=1,p[1]=1;
	ua[n+1]=n-1,ub[n+1]=n-1;
	for(int i=2;i<=n;i++)
	{
		if(ub[i+1]>la[i]-2)
			g[i]=(p[min(ub[i+1],i-1)]-p[max(0,la[i]-2)]+MO)%MO;
		if(ua[i+1]>lb[i]-2)
			p[i]=(g[min(ua[i+1],i-1)]-g[max(0,lb[i]-2)]+MO)%MO;
		g[i]=(g[i]+g[i-1])%MO;
		p[i]=(p[i]+p[i-1])%MO;
	}
	ans=(g[n]-g[n-1]+MO)%MO+(p[n]-p[n-1]+MO)%MO;
	ans%=MO;
	printf("%lld\n",ans);
}


Measured memory_bytes: 4096
s = int(input())
MAX = 10**6
def f(n):
    if n%2==0:
        return n//2
    else:
        return 3*n + 1

l = [0] * MAX
l[s] = 1
for i in range(2,MAX+1):
    temp = f(s)
    if l[temp]==1:
        print(i)
        exit()
    l[temp] = 1
    s = temp


Measured memory_bytes: 10868
import java.util.*;
//import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
     
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
// 		constructST(a,n);RMQ(n, qs, qe)
        // sieveOfEratosthenes();
//		Stack<Character> st=new Stack <> ();
		int n=sc.nextInt(),a[]=new int[n],i,flag1=0,flag2=0,count=0;
		long l=1,b=0;
		for(i=0;i<n;i++)
			a[i]=sc.nextInt();
		Arrays.sort(a);
		HashSet <Integer> ar=new HashSet <> ();
		for(i=n-1;i>0;i--) {
			if(a[i]==a[i-1]) {
				l*=a[i];count++;
				if(count==2)
					break;
				i--;
			}
		}
		if(count==2)
			System.out.println(l);
		else 
			System.out.println("0");
	}
	static int lower_bound(int a[],int x){
         int n=a.length,low=0,high=n-1,res=-1;
         while(low<=high){
             int mid=(low+high)>>1;
             if(a[mid]>=x){
                res=mid;high=mid-1;
             }
             else 
                low=mid+1;
         }
         return res;
     }
      static int upper_bound(int a[],int x){
          int n=a.length,low=0,high=n-1,res=-1;
          while(low<=high){
              int mid=(low+high)>>1;
              if(a[mid]<=x){
                  res=mid;low=mid+1;
              }
              else 
                  high=mid-1;
          }
          return res;
      }
      static long modexpo(long x,long n,long m){
        if(n==0)
            return 1;
        else if(n%2==0)
            return (modexpo(((x%m)*(x%m))%m,n/2,m))%m;
        else
            return ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m;
      } 
       static int gcd(int a,int b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
       }
       static long gcd(long a,long b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
       }
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
             }
            return str19;
        }
      }    
}


Measured memory_bytes: 36312
def main():
    n = int(input())
    test = [int(input()) for i in range(n)]
    score = sum(test)
    test.sort()
    x_test = list(filter(lambda x:x % 10 != 0, test))
    if len(x_test) == 0:
        print(0)
        exit()
    elif score % 10 != 0:
        print(score)
        exit()
    x_test.sort()
    print(score - x_test[0])

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
from functools import reduce

def cmb(n,r,p):
    r = min(n-r,r)
    if r == 0:
        return 1
    num = reduce(lambda x, y: (x*y)%p, range(n,n-r,-1))
    den = reduce(lambda x, y: (x*y)%p, range(1,r+1))
    return (num * pow(den,p-2,p)) % p

m = 10**9 + 7
n,a,b = map(int, input().split())
ans = pow(2,n,m) - 1
ans -= cmb(n,a,m) + cmb(n,b,m)
print(ans % m)

Measured memory_bytes: 9540
#include <bits/stdc++.h>
using namespace std;
int n,dp[2003][2003],a[6003],ans,tg,MX[2003],cur;
vector<int>A,B,C;
void add(int x,int y,int z){A.push_back(x),B.push_back(y),C.push_back(z);}
int main(){
	cin>>n;
	for(int i=1;i<=3*n;i++)cin>>a[i]; 
	memset(dp,-1,sizeof(dp));
	memset(MX,-1,sizeof(MX));
	dp[a[1]][a[2]]=dp[a[2]][a[1]]=MX[a[1]]=MX[a[2]]=cur=0;
	for(int i=3;i<3*n;i+=3){
		if(a[i]==a[i+1]&&a[i]==a[i+2]){tg++;continue;}
		A.clear(),B.clear(),C.clear();
		sort(a+i,a+i+3);
		if(a[i]==a[i+1])for(int j=1;j<=n;j++)if(dp[j][a[i]]>=0)add(j,a[i+2],dp[j][a[i]]+1);
		if(a[i+1]==a[i+2])for(int j=1;j<=n;j++)if(dp[j][a[i+1]]>=0)add(j,a[i],dp[j][a[i+1]]+1);
		if(dp[a[i]][a[i]]>=0)add(a[i+1],a[i+2],dp[a[i]][a[i]]+1);
		if(dp[a[i+1]][a[i+1]]>=0)add(a[i],a[i+2],dp[a[i+1]][a[i+1]]+1);
		if(dp[a[i+2]][a[i+2]]>=0)add(a[i],a[i+1],dp[a[i+2]][a[i+2]]+1);
		add(a[i],a[i+1],cur),add(a[i+1],a[i+2],cur),add(a[i],a[i+2],cur);
		for(int j=i;j<i+3;j++)for(int k=1;k<=n;k++)if(MX[k]>=0)add(a[j],k,MX[k]);
		for(int j=0;j<(int)A.size();j++)if(dp[A[j]][B[j]]<C[j])
			dp[A[j]][B[j]]=dp[B[j]][A[j]]=C[j],MX[A[j]]=max(MX[A[j]],C[j]),MX[B[j]]=max(MX[B[j]],C[j]),cur=max(cur,C[j]);
	}
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++)if(dp[i][j]>=0)ans=max(ans,dp[i][j]);
		if(dp[i][i]>=0)if(i==a[3*n])ans=max(ans,dp[i][i]+1);
	}
	printf("%d",ans+tg);
}


Measured memory_bytes: 19584
/**
  @file b.cpp
  @title 404 Not Found - AtCoder
  @url https://atcoder.jp/contests/abc133/tasks/abc133_b
**/

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)

double distance(vector<int> A, vector<int> B) {
  int sum = 0;
  for (int i = 0; i < A.size(); i++) {
    sum += (A[i] - B[i]) * (A[i] - B[i]);
  }
  return sqrt(sum);
}

int main() {
  int i, j;

  int N, D;
  cin >> N >> D;

  vector<vector<int>> X(N, vector<int>(D, 0));
  REP(i, N)
  REP(j, D)
  cin >> X[i][j];

  int count = 0;
  for (i = 0; i < N; i++) {
    for (j = i + 1; j < N; j++) {
      double dis = distance(X[i], X[j]);
      if (ceil(dis) == floor(dis)) count++;
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(void) {
	int N,M,K;
	cin >> N >> M >> K;
	vector< vector<int> > tl(N,vector<int>(N,0));
	for (int i = 0; i < M; ++i) {
		int L,R;
		cin >> L >> R;
		++tl[R-1][L-1];
	}
	for (int i = 0; i < N; ++i) {
		for (int j = 1; j < i+1; ++j) {
			tl[i][i-j] += tl[i][i-j+1]; 
		}
	}
	vector< vector<int> > memo(N,vector<int>(N,0));
	for (int i = 0; i < N; ++i) {
		memo[i][i] = tl[i][i];
		for (int j = 1; j < N; ++j) {
			memo[i][j] = memo[i][j-1] + tl[j][i];
		}
	}

	for (int i = 0; i < K; ++i) {
		int p,q;
		cin >> p >> q;
		cout << memo[p-1][q-1] << endl;
	}
	return 0;
}


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

public class Main {
    static List<Integer>[] ar;
    public static void main(final String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        int m = sc.nextInt();
        ar = new ArrayList[n];
        for (int i = 0; i < n; i++)
            ar[i] = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            int key = sc.nextInt();
            int val = sc.nextInt();
            ar[key - 1].add(val-1);
        }

        int val[] = new int[n];
        Arrays.fill(val, -1);
        int max = 0;

        for (int i = 0; i < n; i++) {
            max = Math.max(max, dfs(i, val, ar, 0));
        }
        System.out.println(max);
    }

    public static int dfs(int key,int[] val,List<Integer>[] ar,int sum) {
        if (val[key] != -1)
            return sum + val[key];
        int ans = 0;

        if (ar[key] == null || ar[key].size() == 0) {
            return val[key] = 0;
        }
        for (int i : ar[key]) {
            ans= Math.max(ans,dfs(i,val,ar,sum)+1);
        }
        return val[key] = ans+sum;
    }

    static final Random random = new Random();

    static void sort(final int[] a) {
        final int n = a.length;
        for (int i = 0; i < n; i++) {
            final int val = random.nextInt(n);
            final int cur = a[i];
            a[i] = a[val];
            a[val] = cur;
        }
        Arrays.sort(a);
    }

    static void sortl(final long[] a) {
        final int n = a.length;
        for (int i = 0; i < n; i++) {
            final int val = random.nextInt(n);
            final long cur = a[i];
            a[i] = a[val];
            a[val] = cur;
        }
        Arrays.sort(a);
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (final IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (final IOException e) {
                e.printStackTrace();
            }
            return str;
        }

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

        int[] readArray(final int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

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

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

}


Measured memory_bytes: 71824
#include<stdio.h>
int main(void) {
    int i, n, j, l, k, m, a[100], v, key;
    scanf("%d", &n);
    key = n; i = 0;
    while ( key-- ) {
        scanf("%d", &a[i]);
        i++;
    }
    for ( i = 0; i < n; i++ ) {
        v = a[i];
        j = i - 1;
        while ( j >= 0 && a[j] > v ) {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        printf("%d", a[0]);
        for ( l = 1; l < n; l++ ) printf(" %d", a[l]);
        printf("\n");
    }

}

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

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

int main() {
    ll x;
    cin >> x;
    ll ans = 0;
    ans += x / 500 * 1000;
    x = x - (x / 500) * 500;
    ans += x / 5 * 5;

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

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

////// 二項係数の求め方
// 引用資料：https://drken1215.hatenablog.com/entry/2018/06/08/210000
// COMinit() : O(n), COM(n, k) : O(1)
const int MOD = 1000000007;
const int MAX = 1000000;//510000;

long factorial[MAX], finv[MAX], inv[MAX]; 

// テーブルを作る前処理
void COMinit() {
    factorial[0] = factorial[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        factorial[i] = factorial[i - 1] * i % MOD;      // factorial[] : a! (mod MOD)
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;    // inv[] : a^-1     (mod MOD) 
        finv[i] = finv[i - 1] * inv[i] % MOD;           // finv[] : (a!)^-1 (mod MOD) 
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return factorial[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int x, y;
    cin >> x >> y;

    COMinit();
    int n = (x+y)/3;
    int k = (x+y)/6 - abs(((x-y)/2));
    if ((x+y)%3 == 0){
        cout << COM(n, k) << endl;
    }
    else{
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 27068
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

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

const int L=1e5;
LL a[3*L];
LL v[3*L];
int main() {
	int N;
	scanf("%d",&N);
	for(int i=0;i<3*N;i++){
		scanf("%lld",a+i);
	}
	priority_queue<LL,vector<LL>,greater<LL> > pq;
	LL s=0;
	for(int i=0;i<N;i++){
		s+=a[i];
		pq.push(a[i]);
	}
	v[N]=s;
	for(int i=N;i<2*N;i++){
		pq.push(a[i]);
		s+=a[i];
		s-=pq.top();
		pq.pop();
		v[i+1]=s;
	}
	s=0;
	pq=priority_queue<LL,vector<LL>,greater<LL> >();
	for(int i=3*N-1;i>=2*N;i--){
		s-=a[i];
		pq.push(-a[i]);
	}
	v[2*N]+=s;
	LL ret=v[2*N];
	cerr << s << endl;
	for(int i=2*N-1;i>=N;i--){
		pq.push(-a[i]);
		s-=a[i];
		s-=pq.top();
		pq.pop();
		v[i]+=s;
		ret=max(ret,v[i]);
	}
	printf("%lld\n",ret);

	return 0;
}



Measured memory_bytes: 5488
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
struct arr{
    int w, x, y, z;
}q[10010], u;
int T, n, m, x, y, l, r, res, cnt, nx, ny, sx, sy, nox, noy;
int ans, dx[10], dy[10], f[7][7], c[7][7];
bool flag;
char s[200];
int main(int argc, const char * argv[])
{
    dx[0] = dx[1] = dx[2] = -1;
    dx[5] = dx[6] = dx[7] = 1;
    dy[0] = dy[3] = dy[5] = -1;
    dy[2] = dy[4] = dy[7] = 1;
    while (scanf("%d", &n) != EOF)
    {
        if (!n) break;
        cnt = 0, flag = 1;
        for (int i = 0; i < n; i++)
        {
            scanf("%s", s);
            for (int j = 0; j < n; j++)
            {
                if (s[j] == '#') cnt += 1 << (i * n + j), flag = 0;
                if (s[j] == '@') cnt += 1 << (i * n + j), sx = i, sy = j;
            }
        }
        if (flag)
        {
            printf("0\n");
            continue;
        }
        flag = 1;
        l = r = 0;
        q[++r].x = sx, q[r].y = sy, q[r].z = cnt, q[r].w = 0;
        while (l < r)
        {
            u = q[++l];
            memset(c, 0, sizeof(c));
            cnt = 0;
            for (int j = 1; j <= n; j++)
                for (int k = 1; k <= n; k++)
                    if (u.z & (1 << ((j - 1) * n + k - 1))) c[j][k] = 1, cnt++;
            //printf("%d %d %d %d\n", u.w, u.x, u.y, u.z);
            if (cnt == 1)
            {
                //printf("%d %d %d ", u.w, u.x, u.y);
                printf("%d\n", u.w);
                flag = 0;
                break;
            }
            for (int i = 0; i < 8; i++)
            {
                res = 0;
                nx = u.x + dx[i], ny = u.y + dy[i];
                if (nx < 0 || ny < 0 || nx == n || ny == n || c[nx + 1][ny + 1]) continue;
                memset(f, 0, sizeof(f));
                for (int j = 1; j <= n; j++)
                    for (int k = 1; k <= n; k++)
                        f[j][k] = c[j][k];
                f[u.x + 1][u.y + 1] = 0;
                f[nx + 1][ny + 1] = 1;
                for (int j = 1; j <= n; j++)
                    for (int k = 1; k <= n; k++)
                    {
                        if (j == nx + 1 && k == ny + 1)
                        {
                            res += 1 << ((j - 1) * n + k - 1);
                            continue;
                        }
                        cnt = 0;
                        for (int di = 0; di < 8; di++)
                        {
                            nox = j + dx[di], noy = k + dy[di];
                            cnt += f[nox][noy];
                        }
                        if (cnt == 3) res += 1 << ((j - 1) * n + k - 1);
                        if (cnt == 2 && f[j][k] == 1) res += 1 << ((j - 1) * n + k - 1);
                    }
                if (r <= 10000) q[++r].w = u.w + 1, q[r].x = nx, q[r].y = ny, q[r].z = res;
            }
        }
        if (flag) printf("-1\n");
    }
    return 0;
}

Measured memory_bytes: 1196
n,a,b=map(int,input().split())

def genCombinationFunction(max_k,mod):
    modinv_table = [-1] * (max_k+1)
    modinv_table[1] = 1
    for i in range(2, max_k+1):
        modinv_table[i] = (-modinv_table[mod % i] * (mod // i)) % mod

    def binomial_coefficients(n, k):
        ans = 1
        for i in range(k):
            ans *= n-i
            ans *= modinv_table[i + 1]
            ans %= mod
        return ans
    return binomial_coefficients

  
max_k = 2 * 10 ** 5
mod = 10**9 + 7
f=genCombinationFunction(max_k,mod)


ans=pow(2,n,mod)-1
ans-=f(n,a)
ans-=f(n,b)
print(ans%mod)

Measured memory_bytes: 16948
#include<bits/stdc++.h>
#define N 205
using namespace std;

#define db double
#define eps 1e-8
struct point{db x,y;};
point operator +(point a,point b){return (point){a.x+b.x,a.y+b.y};}
point operator -(point a,point b){return (point){a.x-b.x,a.y-b.y};}
db operator *(point a,point b){return a.x*b.y-b.x*a.y;}
point operator *(point a,db x){return (point){a.x*x,a.y*x};}
point operator /(point a,db x){return (point){a.x/x,a.y/x};}
bool a_onleft(point a,point b){return a*b<-eps;}
db area(point a,point b,point c){return abs((a-c)*(b-c)/2.0);}
point inter(point a1,point a2,point b1,point b2){
	double s1=area(b1,b2,a1),s2=area(b1,b2,a2);
	return (a1-a2)/(s1+s2)*s2+a2;
}
#undef db
#undef eps
const int mod=998244353;
point p[N];
int n,pw[N];
int main(){
	scanf("%d",&n);pw[0]=1;
	for(int i=1;i<=n;i++) scanf("%lf%lf",&p[i].x,&p[i].y),pw[i]=pw[i-1]*2%mod;
	long long ans=pw[n]-1-n;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++){
			int cnt=0;
			for(int k=j+1;k<=n;k++)
				if(area(p[i],p[j],p[k])<1e-8) cnt++;
			ans-=pw[cnt];
		}
	cout<<(ans%mod+mod)%mod<<endl;
	return 0;
}


Measured memory_bytes: 256
var n,tmp,m:longint;
begin
    read(n);
    m:=0;
    tmp:=n;
    while tmp>0 do begin
        inc(m, tmp mod 10);
        tmp:=tmp div 10;
    end;
    if n mod m=0 then
        writeln('Yes')
    else
        writeln('No');
end.

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
    int s,k,ans=0;
    cin>>k>>s;
    for(int x=0;x<=k;x++)
    	for(int y=0;y<=k;y++){
    		if(x+y>s)
    			break;
    		if(s-x-y<=k)
    			ans++;
		}
	cout<<ans; 
    return 0;
}


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

int main() {
  // Input
  int N, K;
  string S, target, repl;
  cin >> N >> K >> S;
  
  // Compute
  target = S.at(K-1);
  if (target == "A") {
    repl = "a";
  }
  else if (target == "B") {
    repl = "b";
  }
  else if (target == "C") {
    repl = "c";
  }
  
  S.replace(K-1, 1, repl);
  
  // Output
  cout << S << endl;
}

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


int main(void){
    int n,t;
    cin >> n >> t;
    bool check = 1;
    vector<int>ans;
    rep(i,n){
        int x,y;
        cin >> x >> y;
        if(y<=t){
            ans.push_back(x);
            check = 0;
        }
    }
    sort(ans.begin(),ans.end());
    if(check == 0){
        cout << ans[0] <<endl;
    }
    else{
        cout << "TLE" <<endl;
    }
    
    return 0;
}









































Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# abc144/abc144_d
import sys
from math import *

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    a, b, x = i2nn()
    if 2 * x > a * a * b:
        r = atan(2 / a**2 * (a * b - x / a))
    else:
        r2 = atan(2 * x / (a * b * b))
        r = pi / 2 - r2
    print(r / pi * 180)
    return

main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  long long a,b;
  cin >> a >> b;
  long long i = 0;
  for(;;i++){
      long long  n = pow(2,i);
      long long p = a*n;
     // cout << p << endl;
      if(p>b){break;}
  }
  cout << i << endl;
}


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

#define ll long long

int main()
{

	string s;
	cin >> s;
	
	if(s[0] == '7' || s[1] == '7' || s[2] == '7')
		cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


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

int main()
{
  int N;
  cin >> N;
  vector<int> x(N), y(N), h(N);
  for (int i = 0; i < N; i++)
  {
    cin >> x[i] >> y[i] >> h[i];
  }

  int MAX = 100;

  for (int posY = 0; posY <= MAX; posY++)
  {
    for (int posX = 0; posX <= MAX; posX++)
    {
      // 頂上がどれくらいの高さであって欲しいか
      // -1はまだよくわからない時。0以上は確定してる時
      // -2はダメだってわかった時
      int needH = -1;

      for (int i = 0; i < N; i++)
      {
        if (h[i] > 0)
        {
          //この頂点から見て、頂上がposY, posXの時に、
          // どれくらいの高さがあって欲しいかとを求める
          int tmp = h[i] + abs(posY - y[i]) + abs(posX - x[i]);

          if (needH == -1)
          {
            needH = tmp;
          }
          else
          {
            if (needH != tmp)
            {
              needH = -2;
              break;
            }
          }
        }
      }
      // ダメだったら他の場所を探す
      if (needH == -2)
        continue;

      for (int i = 0; i < N; i++)
      {
        if (h[i] == 0)
        {
          int dist = abs(posY - y[i]) + abs(posX - x[i]);

          if (needH > dist)
          {
            needH = -2;
            break;
          }
        }
      }

      if (needH == -2)
        continue;

      cout << posX << " " << posY << " " << needH << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LLINF 1<<63-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define MOD 1000000007
void swap(int* x,int* y){
  int tmp=*x;*x=*y;*y=tmp;
}

int GCD(int x,int y){
  int z=1,tmp=MAX(x,y);
  y=MIN(x,y);
  x=tmp;
  while(z!=0){
    z=x%y;
    x=y;
    y=z;
  }
  return x;
}

int main(){
  int N,i,ans=0;
  scanf("%d",&N);
  int A[N],B[N];
  for(i=0;i<N;i++)scanf("%d",&A[i]);
  B[N-1]=A[N-1];
  for(i=0;i<N-1;i++)B[N-2-i]=GCD(A[N-2-i],B[N-1-i]);
  for(i=0;i<N-1;i++)A[i+1]=GCD(A[i],A[i+1]);
  for(i=0;i<N-2;i++)
  if(ans<GCD(A[i],B[i+2]))ans=GCD(A[i],B[i+2]);
  if(ans<A[N-2])ans=A[N-2];
  if(ans<B[1])ans=B[1];
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 896
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repe(i, n) REPN(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
template <typename T>
void coVec(const Vec1<T> &v){for(T i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

int main(void){
	ll n;
	cin >> n;
	Vec a(n), b(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];

	priority_queue<P> que;
	rep(i, n) if(a[i] != b[i]) que.push({b[i], i});
	ll ans = 0;
	while(!que.empty()){
		P p = que.top(); que.pop();
		ll s = b[(p.sc-1+n)%n]+b[(p.sc+1)%n];
		ll t = (b[p.sc]-max(b[(p.sc-1+n)%n], b[(p.sc+1)%n]))/s+1;
		if(b[p.sc]-t*s >= a[p.sc]){
			b[p.sc] -= t*s;
			ans += t;
		}else{
			t = (b[p.sc]-a[p.sc])/s;
			if(!t){
				co(-1);
				return 0;
			}
			b[p.sc] -= t*s;
			ans += t;
		}
		if(b[p.sc] > a[p.sc]){
			que.push({b[p.sc], p.sc});
		}
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 8944
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
  	int A, B, C;
    cin >> A >> B >> C;
    cout << max(0, C-A+B) << endl;
  	

  	return 0;
}



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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll L, R, d; cin >> L >> R >> d;
    cout << R / d - (L - 1) / d << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int main(){
    int w,h,x,y;
    cin >> w >> h >> x >> y;

    double res;
    int res_b;

    res = (double)w * (double)h / 2;
    if (x * 2 == w && y*2 == h) {
        res_b = 1;
    } else {
        res_b = 0;
    }

    cout << res << " " << res_b;

}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> data(m);

    for (int i = 0; i < n; i++){
        int k;
        cin >> k;
        for (int j = 0; j < k; j++){
            int num;
            cin >> num;
            data.at(num - 1)++;
        }
    }

    int count = 0;
    for (int i = 0; i < m; i++){
        if (data.at(i) == n){
            count++;
        }
    }

    cout << count << endl;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[3];
		for(int i = 0; i < 3; ++i)
			a[i] = sc.nextInt();
		int x = sc.nextInt(), y = sc.nextInt();
		sc.close();
		int ans = 1000000000;
		for(int i = 0; i <= 2 * Math.max(x,  y); i += 2) {
			int tmp = a[0] * (x - (i / 2)) + a[1] * (y - (i / 2)) + a[2] * i;
			if(x < i / 2)tmp += a[0] * ((i / 2) - x);
			if(y < i / 2)tmp += a[1] * ((i / 2) - y);
			ans = Math.min(ans,  tmp);
		}
		System.out.println(ans);
	}

}


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

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

  vector<long long int> r(n);
  for(int i = 0; i < n; i++) cin >> r[i];

  long long int Max = -10000000000;
  long long int Min = r[0];

  for(int i = 1; i < n; i++){
    if(r[i] - Min > Max) Max = r[i] - Min;
    if(Min > r[i]) Min = r[i];
  }

  cout << Max << endl;

  return 0;

}



Measured memory_bytes: 4408
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; ++i)
#define rep(i, n) repl(i, 0, n)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define chmax(x,y) x = max(x, y)
#define chmin(x,y) x = min(x, y)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using G = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, -1, 0, 1};

struct UnionFind {
    vector<int> d;
    UnionFind(int n = 0): d(n, -1) {}
    int find(int x) {
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) { return find(x) == find(y);}
    int size(int x) { return -d[find(x)];}
    int count(int x) { return d[x];}
};

int deg[100005];
vector<int> to[100005];

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        ++deg[a];
        ++deg[b];
        uf.unite(a, b);
    }
    rep(i, k) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        to[a].pb(b);
        to[b].pb(a);
    }
    rep(i, n) {
        int ans = uf.size(i)-1-deg[i];
        for(int u : to[i]) {
            if(uf.same(i, u)) --ans;
        }
        printf("%d%c", ans, '\n');
    }
    return 0;
}


Measured memory_bytes: 9216
#include<iostream>
#include<iomanip>
using namespace std;
 
 int main(){
	 int a,b;
	 cin>>a>>b;
	 cout<<a/b<<" "<<a%b<<" "<<fixed<<setprecision(20)<<1.0*a/b<<endl;
	 return 0;
 }
		


Measured memory_bytes: 3260
using System;

namespace B
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			var input = Console.ReadLine().Split();
			var a = int.Parse(input[0]);
			var b = int.Parse(input[1]);
			var k = int.Parse(input[2]);

			for (var i = 0; i < k; i++)
			{
				if (i % 2 == 0)
				{
					b += a / 2;
					a /= 2;
				}
				else
				{
					a += b / 2;
					b /= 2;
				}
			}

			Console.WriteLine($"{a} {b}");
		}
	}
}

Measured memory_bytes: 13268
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
#define SG getchar()
#define P putchar
using namespace std;
signed main()
{
	while(SG-32){;}
	P(65),P(SG),P(67);
	return P(10),0;
}

Measured memory_bytes: 256
#include<stdio.h>
int a[262144];
int wz[262144],val[262144];
int num=0;
int mid;
bool inc(int wz1)
{
	if(wz1<=0)
	{
		return false;
	}
	if(mid==1)
	{
		return false;
	}
	while(num)
	{
		if(wz[num-1]<=wz1)
		{
			break;
		}
		num--;
	}
	if(!num)
	{
		wz[num]=wz1;
		val[num]=0;
		num++;
	}
	if(wz[num-1]<wz1)
	{
		wz[num]=wz1;
		val[num]=0;
		num++;
	}
	val[num-1]++;
	if(val[num-1]==mid)
	{
		return inc(wz1-1);
	}
	return true;
}
int len=0;
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	int l=1,r=n;
	while(l<r)
	{
		mid=((l+r)>>1);
		num=0;
		len=0;
		bool ok=true;
		for(int i=0;i<n;i++)
		{
			if(a[i]>len)
			{
				len=a[i];
			}
			else
			{
				len=a[i];
				if(!inc(len))
				{
					ok=false;
					break;
				}
			}
		}
		if(ok)
		{
			r=mid;
		}
		else
		{
			l=mid+1;
		}
	}
	printf("%d\n",l);
	return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var NK = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (N, K) = (NK[0], NK[1]);
        var S = ReadLine();

        IEnumerable<(char c, int l)> GetRunLength(string S)
        {
            var length = 0;
            var prevChar = ' ';
            foreach (var c in S)
            {
                if (prevChar == ' ')
                    prevChar = c;

                if (prevChar != c)
                {
                    yield return (prevChar, length);
                    length = 0;
                }

                length++;
                prevChar = c;
            }
            if (prevChar != ' ')
                yield return (prevChar, length);
        }

        var stack = new Stack<(char c, int l)>(GetRunLength(S));

        for (int i = 0; i < K; i++)
        {
            if(3 <= stack.Count)
            {
                var first = stack.Pop();
                var second = stack.Pop();
                var third = stack.Pop();

                stack.Push((first.c, first.l + second.l + third.l));

            }
            else if(2 <= stack.Count)
            {
                var first = stack.Pop();
                var second = stack.Pop();

                stack.Push((first.c, first.l + second.l));
            }
        }

        var ans = stack.Select(p => p.l - 1).Where(x => 0 < x).Sum();

        WriteLine(ans);
    }
}


Measured memory_bytes: 30600
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),sum=0;
        double ave,tmpsum=0;
        while(n!=0){
            int [] s = new int[n];
            for(int i=0;i<n;i++) {
                s[i] = sc.nextInt();
                sum += s[i];
            }
            ave = (double)sum/n;
            for(int i=0;i<n;i++) tmpsum += (s[i]-ave)*(s[i]-ave);
            ave = tmpsum/n;
            System.out.println(Math.sqrt(ave));
            sum = 0;
            tmpsum = 0;
            n = sc.nextInt();
        }
    }
}


Measured memory_bytes: 31636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr char sp = ' ';
constexpr int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 };

int N, P[250000], dep[500][500], res;
bool B[500][500];

int main() {
	cin >> N;
	for (int i = 0; i < N*N; i++) {
		cin >> P[i];
		P[i]--;
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			dep[i][j] = min({ i,j,N - 1 - i,N - 1 - j }) + 1;
			B[i][j] = true;
		}
	}
	for (int i = 0; i < N*N; i++) {
		int X, Y;
		X = P[i] % N;
		Y = P[i] / N;
		res += dep[X][Y] - 1;
		queue<pair<int, int>>que;
		B[X][Y] = false;
		que.push({ X,Y });
		dep[X][Y]--;
		while (!que.empty()) {
			int x = que.front().first;
			int y = que.front().second;
			que.pop();
			for (int i = 0; i < 4; i++) {
				int xx = x + dx[i];
				int yy = y + dy[i];
				if (xx == -1 || yy == -1 || xx == N || yy == N)continue;
				if (B[xx][yy]) {
					if (dep[xx][yy] == dep[x][y] + 2) {
						que.push({ xx,yy });
						dep[xx][yy]--;
					}
				}
				else {
					if (dep[xx][yy] == dep[x][y] + 1) {
						que.push({ xx,yy });
						dep[xx][yy]--;
					}
				}
			}
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 5832
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

int main() {
  string s;
  cin >> s;
  if(s == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
  

  
  
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#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 ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX



 
void solve()
{
    int k, a, b;
    cin >> k >> a >> b;
    int curr = k;
    while(curr<=b)
    {
        if(curr>=a)
        {
            cout << "OK" << endl;
            return;
        }
        curr += k;
    }

    cout << "NG" << endl;
}


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

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

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

  vector< int > a(n);
  for(auto &&s : a) {
    int tmp;
    cin >> tmp;
    s = 2 * tmp;
  }

  ll x = 0;
  for(int i = 0; i < n; i++) {
    x += (i % 2 == 0 ? a.at(i) : -a.at(i));
  }
  x /= 2;

  for(const auto &s : a) {
    cout << x << " ";
    x = s - x;
  }

  cout << endl;
  return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

#define MAXM 110000

int main(){
  int n,m;cin>>n>>m;
  vector<int> x(n);
  rep(i, n)cin>>x[i];
  map<int, int>mp, mm;
  rep(i, n){
    mm[x[i]]++;
    mp[x[i]%m]++;
  }

  int result = 0;
  int tr = 0;
  rep(i, m){
//cout<<i<<' '<<result<<endl;
//if(i==12)cout<<"---"<<i<<endl;

    if(i==0 || m%2==0 && i==m/2){
      tr += mp[i]/2;
//if(i==12)cout<<tr<<endl;
    }else{
      int j = m-i;
      int s=mp[i],t=mp[j];
      mp[i]=0,mp[j]=0;
//if(i==12)cout<<t<<':'<<s<<endl;
      if(s>t)swap(s,t);
      //if(s==0)continue;
//if(i==12)cout<<result<<endl;
      result += s;
//if(i==12)cout<<result<<endl;
      t-=s;s=0;
//if(i==12)cout<<t<<':'<<s<<endl;

      int tt=t;
      int tr1 = 0;
      for(int k=i; k<=MAXM; k+=m){
        if(tt>=2 && mm[k]>=2){
          int x = min(mm[k]/2, tt/2);
          tr1 += x;
          tt -= 2*x;
        }
      }

      tt=t;
      int tr2 = 0;
      for(int k=j%m; k<=MAXM; k+=m){
        if(tt>=2 && mm[k]>=2){
          int x = min(mm[k]/2, tt/2);
          tr2 += x;
          tt -= 2*x;
        }
      }

      result += max(tr1, tr2);

//if(i==12)cout<<result<<' '<<tr1<<' '<<tr2<<endl;
//if(i==12)cout<<"---"<<i<<endl;
    }
  }

  cout<<result+tr<<endl;
//  cout<<result<<' '<<tr<<endl;

  return 0;
}


Measured memory_bytes: 12980
N = int(input())
X = list(map(int,input().split()))

Physical_strength = 0
flag = 0
n=0
while 1:
    n += 1
    flag=0
    for Xi in X:
        flag += (Xi-n)**2
    if n == 1:
        Physical_strength = flag
    if Physical_strength > flag:
        Physical_strength = flag
    elif Physical_strength < flag and n > N:
        break

print(Physical_strength)

Measured memory_bytes: 3064
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
typedef long long ll;
string a,b;
map<pair<string,string>,int>m;
char s[40];
int main(){
	int n,i,j;
	ll ans;
	scanf("%d%s",&n,s);
	reverse(s+n,s+n*2);
	for(i=0;i<1<<n;i++){
		a=b="";
		for(j=0;j<n;j++)(i>>j&1?a:b).append(1,s[j]);
		m[make_pair(a,b)]++;
	}
	ans=0;
	for(i=0;i<1<<n;i++){
		a=b="";
		for(j=0;j<n;j++)(i>>j&1?a:b).append(1,s[j+n]);
		ans+=m[make_pair(a,b)];
	}
	printf("%lld",ans);
}

Measured memory_bytes: 91904
//                                               KEEP GRINDING
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>   new_data_set;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define int long long
#define ld long double
#define MOD 1000000007
#define mod 998244353
#define precise(i) fixed << setprecision(10) << i
#define f(i,a,b) for(int i=a;i<b;++i)

#define endl '\n'
#define debug cout<<endl;cout<<"\n========================================\n"<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl;
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;

#define all(a) a.begin(),a.end()
#define show(a) for(auto xyz:a)cout<<xyz<<" ";cout<<endl;
#define mx(a) *max_element(a)
#define mn(a) *min_element(a) 
#define LB lower_bound  //THIS GIVES THE ITR TO THE ELEMENT IN RANGE [SI,EI) THAT IS >= OUR VALUE 
#define UB upper_bound  //THIS GIVES THE ITR TO THE ELEMENT IN RANGE [SI,EI) THAT IS > OUR VALUE 

#define fr first
#define sc second

#define MAXN 200050
#define INF 9223372036854775807
int T(int n){
   return (n*(n+1))/2;
}
signed main(){
    fastio
	int n,ans=0;
	cin>>n;
	vector < int > vec;
	while(n>1){
	  bool f=1;
	  for(int i=2;i*i<=n;i++){
	       if(n%i==0){
	          f=0;
	          int cnt=0;
	          while(n%i==0){
	             n/=i;
	             cnt++;
	          }
	          vec.push_back(cnt);
	          break;
	       }
	   }
	   if(f){
	      vec.push_back(1);
	      break;
	   }
	}
	for(auto x:vec){
	   for(int i=0;;i++){
	      if(T(i)<=x&&x<T(i+1)){
	         ans+=i;
	         break;
	      }
	   }
	}
	cout<<ans;
	
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
#define INF 2000000000
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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメaモ
数値型から文字列に変換　to_string(number);これは簡単
文字列から数値型に変換　stoi(number)
文字列からllに変換　stoll(number)*/

//ここから書き始める
int main(){
	vector<int> a(3);
	rep(i,3) cin>>a[i];
	SORT(a);
	int ans = a[0]+a[1];
	cout<<ans<<endl;
}


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

int digit(int x){
  int sum=0;
  while(x>0){
    sum += x%10;
    x = x/10;
  }
  return sum;
}

int main(){
  int N;
  cin >> N;
  if(N%(digit(N))==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdint.h>

int main(int argc, char const *argv[]) {
  uint16_t n,a[100]={0};
  double ans;

  scanf("%hd",&n );
  for(int i=0;i<n;i++){
    scanf("%hd", &a[i]);
    ans +=  1.0 / a[i];
  }

  printf("%lf\n", 1.0 / ans);


  return 0;
}


Measured memory_bytes: 128
h1, m1, h2, m2, k = map(int, input().split())
if m1 > m2:
    print(((h2 - 1) - h1) * 60 + (m2 + 60 - m1) - k) 
else:
    print((h2 - h1) * 60 + (m2 - m1) - k)

Measured memory_bytes: 9172