akhauriyash/Code-Regression huggingface dataset:
#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;
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; }
#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 A[3][3];
	REP(i, 3)REP(j, 3)cin >> A[i][j];
	int N;
	cin >> N;
	REP(i, N) {
		int a; cin >> a;
		REP(j, 3) {
			REP(k, 3) {
				if (A[j][k] == a)A[j][k] = -1;
			}
		}
	}
	bool F = false;
	if (A[0][0] == A[0][1] && A[0][2] == A[0][0] && A[0][0] == -1)F = true;
	
	if (A[0][2] == A[1][2] && A[0][2] == A[2][2] && A[1][2] == -1)F = true;
	
	if (A[0][0] == A[1][0] && A[0][0] == A[2][0] && A[0][0] == -1)F = true;
	
	if (A[0][0] == A[2][2] && A[0][0] == A[1][1] && A[0][0] == -1)F = true;
	
	if (A[2][1] == A[0][1] && A[1][1] == A[0][1] && A[0][1] == -1)F = true;

	if (A[1][0] == A[1][1] && A[1][0] == A[1][2] && A[1][0] == -1)F = true;

	if (A[2][0] == A[2][1] && A[2][0] == A[2][2] && A[2][0] == -1)F = true;
	if (A[0][2] == A[2][0] && A[0][2] == A[1][1] && A[0][2] == -1)F = true;


	if (F)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

struct edge_t {
	int from;
	int to;
	int cost;
};
typedef struct edge_t Edge;

int main(void) {
	int num, i, k, from, to, cost, update, nedge = 0;
	int dis[10000];
	Edge *edges, *p;

	edges = malloc(sizeof(Edge)*500000);

	scanf("%d", &num);

	for (i = 0; i < num; i++) {
		scanf("%d %d", &from, &k);

		while (k--) {
			scanf("%d %d", &to, &cost);

			p = &edges[nedge++];
			p->from = from;
			p->to = to;
			p->cost = cost;
		}

		dis[i] = INT_MAX;
	}
	dis[0] = 0;

	update = 1;
	while (update) {
		update = 0;
		for (i = 0; i < nedge; i++) {
			from = edges[i].from;
			to = edges[i].to;
			cost = edges[i].cost;
			if (dis[from] < INT_MAX && dis[to] > cost + dis[from]) {
				dis[to] = cost + dis[from];
				update = 1;
			}
		}
	}

	for (i = 0; i < num; i++) {
		printf("%d %d\n", i, dis[i]);
	}
	return 0;
}

Measured memory_bytes: 6464
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 14;

int n;
int a[N];

int main() {


  scanf("%d", &n);
  int mx = 0, sum = 0;
  for (int i = 1; i <= n; ++i) {
    int a;
    scanf("%d", &a);
    mx = max(mx, a);
    sum += a;
  }
  if (mx * 2 < sum)
    puts("Yes");
  else
    puts("No");

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
import static java.lang.System.out;

// AOJ4
public class Main {
	final Scanner sc=new Scanner(System.in);
	final int[] vx={0,1,0,-1}, vy={-1,0,1,0};
	static class Point{
		int x, y;
		Point(int x, int y){	this.x=x;	this.y=y;}
		Point(){	this.x=0; this.y=0;}
		@Override public String toString(){	return "("+this.x+","+this.y+")";}
		static boolean ok(int x,int y,int X,int Y,int min){	return (min<=x&&x<X)&&(min<=y&&y<Y);}
		static boolean ok(int x,int y,int X,int Y){	return ok(x,y,X,Y,0);}
	}
	public static void main(String[] args) {
		new Main().AOJ0169();
	}
	
	void AOJ0169(){
		while(sc.hasNext()){
			String[] s=sc.nextLine().split(" ");
			if(s[0].equals("0"))	break;
			int ans=0,c=0;
			for(String i:s){
				c+=(i.equals("1")?1:0);
				ans+=solve0169(i);
			}
			while(--c>=0){
				if(ans+10>21)	break;
				ans+=10;
			}
			out.println((ans<=21?ans:0));
		}
	}
	int solve0169(String s){
		int r=Integer.parseInt(s);
		if(r>=10)	return 10;
		return r;
	}
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1000 + 5;
const int MAX_N = 1e5 + 5;

int main() {
    int n, m, x, y;
    bool ok = false;
    cin >> n >> m >> x >> y;
    vector<int> X(n), Y(m);
    rep(i, n) cin >> X[i];
    rep(i, m) cin >> Y[i];

    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
    for (int i = x + 1; i <= y; i++) {
        if (X.back() < i && Y[0] >= i) {
            ok = true;
        }
    }
    if (ok)
        cout << "No War" << endl;
    else
        cout << "War" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while (true) {
			int n = sc.nextInt();
			int x = sc.nextInt();

			if (n == 0 && x == 0){
				break;
			}

			int ans=0;

			for (int i=1; i<=n-2;i++){
				for (int j=i+1; j<=n-1; j++){
					for (int k= j+1; k<=n; k++){
						if (i + j + k == x){
							ans++;
						}
					}
				}
			}
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 26736
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
  FAST/**/
   
   ll k;
   cin>>k;
   
   set<ll> rem;
   
   ll curr = 7;
   ll cnt = 1;
   bool pos = 0;
   while(1)
   {
       ll temp = curr%k;
      // cout<<"at "<<temp<<"\n";
       if(temp == 0)
       {
           pos = 1;
           break;
       }
       if(rem.find(temp) == rem.end())
       {
           rem.insert(temp);
           curr = ((10*curr + 7)%k);
           cnt++;
       }
       
       else break;
   }
   
   if(pos)
        cout<<cnt;
   else cout<<-1;        
   
   return 0;        
}  
  
          
   

Measured memory_bytes: 50472
n = int(input())
a = list(map(int, input().split()))
bits = [[0 for _ in range(20)] for _ in range(n)]

for i in range(n):
	for j in range(20):
		bits[i][j] = (a[i] >> j) & 1

ans = 0
bits_sum = [0] * 20

r = 0
for l in range(n):
	r = max(r, l)
	while r < n:
		bits_sum = [bits_sum[j] + bits[r][j] for j in range(20)]
		if max(bits_sum) > 1:
			bits_sum = [bits_sum[j] - bits[r][j] for j in range(20)]
			break
		r += 1
	#print(bits_sum, r)
	ans += r-l
	bits_sum = [bits_sum[j] - bits[l][j] for j in range(20)]
	#print(bits_sum, r)

#ans += 1
print(ans)

Measured memory_bytes: 125900
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	input := nextLine()
	n, _ := strconv.Atoi(input)

	inputs := strings.Split(input, "")
	s := 0
	for _, v := range inputs {
		vInt, _ := strconv.Atoi(v)
		s = s + vInt
	}
	if n%s == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}


Measured memory_bytes: 640
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int N;
  cin >> N;
  vector<ll> S(N);
  ll sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
    sum += S[i];
  }

  if (sum % 10 != 0) {
    cout << sum << endl;
  } else {
    ll mi = 1LL << 61;
    for(int i = 0; i < N; i++) {
      if (S[i] % 10 == 0) continue;
      mi = min(mi, S[i]);
    }
    if (mi == 1LL << 61) {
      cout << 0 << endl;
    } else {
      cout << sum - mi << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a,b,dp[1002]={0},n,k,m,i,j,x,y,z;
	while(1){
		int map[17][17]={0};
		scanf("%d %d",&n,&k);
		if(n==0 && k==0)break;
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf("%d %d",&a,&b);
			map[a][b]=-1;
		}
		map[1][1]=1;
		for(i=1;i<n+1;i++){
			for(j=1;j<k+1;j++){
				if(map[i][j]!=-1){
					if(map[i-1][j]>0 && map[i][j-1]>0)map[i][j]=map[i-1][j]+map[i][j-1];
					else if(map[i-1][j]>0)map[i][j]=map[i-1][j];
					else if(map[i][j-1]>0)map[i][j]=map[i][j-1];
				}
			}
		}
		printf("%d\n",map[n][k]);
	}
	return 0;
}


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

using std::cin;using std::cout;using std::cerr;using std::endl;

#define rep(i,a,b) for(int i = a;i <= b;++i)
#define per(i,a,b) for(int i = a;i >= b;--i)

const int mmax = 2e5;
int n,l,ans = 0;
char t[mmax + 10];

int main(){

	std::ios::sync_with_stdio(0);
	cin.tie(0);

	cin>>n;
	cin>>t;

	rep(i,0,n - 1){
		if(t[i] == 'R') {l++;}
	}

	rep(i,l,n - 1){
		if(t[i] == 'R') ans++;
	}
	cout<<ans;
	

	return 0;
}

Measured memory_bytes: 3844
const lines=readlines()
state=0
input()=lines[global state+=1]
int(s::String)=parse(Int32,s)
intSub(s::SubString{String})=parse(Int32,s)
floatSub(s::SubString{String})=parse(Float64,s)
intLine()=map(intSub,split(input()))
function main()
    p=[int(input()) for i=1:int(input())]
    println(sum(p)-div(maximum(p),2))
end
main()

Measured memory_bytes: 173984
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int ans=0;
    for(int i=N; i>=1; i--){
        if(to_string(i).length()%2==1){
            ans++;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<functional>
#include<string.h>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<queue>
#include<deque>
#include<string>
#include<stack>
#define int long long
using namespace std;

vector<int>V[100000];
int d[100000];
void DFS(int x,int y) {
	for (int i : V[x]) {
		if (y != i&&d[i] == -1) {
			d[i] = d[x] + 1;
			DFS(i, x);
		}
	}
}
signed main() {
	bool OK = false;
	memset(d, -1, sizeof(d));
	d[0] = 0;
	int n, m; cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int x, y; cin >> x >> y;
		x--; y--;
		V[x].push_back(y);
		V[y].push_back(x);
	}
	DFS(0, 0);
	for (int i = 0; i < n; i++) {
		for (int j : V[i]) {
			if (abs(d[i] - d[j]) % 2 ==0) {
				OK = true;
			}
		}
	}
	if (OK)cout << n*(n - 1) / 2 - m << endl;
	else {
		int x = 0, y = 0;
		for (int i = 0; i < n; i++) {
			if (d[i] & 1)x++;
			else y++;
		}
		cout << x*y - m << endl;
	}
}


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

const int M = 1000005; 

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

    vector<int> cnt(M);
    for (int x : a) {
        if (cnt[x] != 0) {
            cnt[x] = 2;
            continue;
        }
        for (int i = x; i < M; i += x) cnt[i]++;
    }

    int ans = 0; 
    for (int x : a) {
        if(cnt[x] == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    ll A, B, M; cin >> A >> B >> M;
    vector<ll> a;
    vector<ll> b;
    ll ans = 100000000;
    REP(i, A) {
        ll tmp; cin >> tmp;
        a.push_back(tmp);
    }
    REP(i, B) {
        ll tmp; cin >> tmp;
        b.push_back(tmp);
    }
    // 割引券使わないパターン
    ans = min(ans, a[distance(a.begin(),min_element(a.begin(), a.end()))] + b[distance(b.begin(),min_element(b.begin(), b.end()))]);
    REP(i, M) {
        ll x, y, c; cin >> x >> y >> c;
        ans = min(ans, (a[x-1] + b[y-1] - c));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2548
import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    String str=sc.next();
    int l=str.length();
    String result="";
    for(int i=0;i<l;i++)
    {
      char ch=str.charAt(i);
      result=result+ch;
    }
    if(result.equals("AAA")||result.equals("BBB"))
    {
      System.out.println("No");
    }
    else
    {
      System.out.println("Yes");
    }
  }
}

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

int main() {
  int n,x; cin >>n >> x;
  vector<int> l(n);
  rep(i, n) {
    cin >>l.at(i);
  }
  int d =0;
  int ans = 1;
  rep(i, n) {
    d = d + l.at(i);
    if (d <= x) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/* ex9_1
    sachiyan*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//スタックに格納するデータの最大数
#define SIZE 100

//スタックの定義
typedef struct stack{
    int size;
    int count;
    char data[SIZE];
    char *top;
} stack;

//スタックの初期化
void initialize_stack(stack *stk){
    stk->count = 0;
    stk->size = SIZE;
    stk->top = &(stk->data[SIZE]);
}

//データの追加
void push(stack *stk, char elem){
    if(stk->count >= stk->size){
        fprintf(stderr, "Error: stack overflow. (x=%c)\n", elem);
        exit(1);
    }
    else{
        stk->top--;
        *(stk->top) = elem;
        stk->count++;
    }
}

//データの取り出し
char pop(stack *stk){
    char latest;
    if(stk->count <= 0){
        fprintf(stdout, "Error: stack underflow.\n");
        exit(1);
    }
    else{
        latest = *(stk->top);
        stk->top++;
        stk->count--;
        return latest;
    }
}

int main(void){
    stack stk;
    char string[SIZE], output;
    int i;
    //スタックを初期化（ポインタ渡しで関数にわたすこと）
    initialize_stack(&stk);

    //与えられた文字列の読み取り
    scanf("%s", string);


    for(i=0; i<strlen(string); i++){
        //与えられた文字のうち、0か1ならスタックに追加
        if(string[i] == '0' | string[i] == '1'){
            push(&stk, string[i]);
        //与えられた文字列がBでスタックの中身があれば消す
        }else if(stk.count > 0){
            pop(&stk);
        }
    }

    //スタックからひとつづつデータを取り出して出力する
    for(i = 1; i <= stk.count; i++){
        printf("%c", stk.data[SIZE - i]);
    }

    printf("\n");
    return 0;
}

Measured memory_bytes: 1612
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

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

		char[] input = sc.next().toCharArray();
		
		int ans = 0;
		
		
		for(int i = 0; i < input.length/2; i++){
			if(input[i] == '(' && input[input.length - i - 1] == ')'){
				continue;
			}else if(input[i] == ')' && input[input.length - i - 1] == '('){
				continue;
			}else if(input[i] == '(' && input[input.length - i - 1] == '('){
				ans++;
			}else if(input[i] == ')' && input[input.length - i - 1] == ')'){
				ans++;
			}else if(input[i] != input[input.length - i - 1]){
				ans++;
			}
		}
		
		if(input.length % 2 == 1){
			if(input[input.length/2] != 'i' && input[input.length/2] != 'w'){
				ans++;
			}
		}
		
		System.out.println(ans);
	}

}

Measured memory_bytes: 12000
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
template <class T> inline void chmax(T &a, T b) { a < b ? a = b : a; };
template <class T> inline void chmin(T &a, T b) { a > b ? a = b : a; };

int main() {
    vi vect;
    int q;
    cin >> q;
    rep(i, q) {
        int query;
        cin >> query;
        if(query == 0) {
            int x;
            cin >> x;
            vect.push_back(x);
        } else if(query == 1) {
            int p;
            cin >> p;
            cout << vect[p] << endl;
        } else {
            vect.pop_back();
        }
    }
}



Measured memory_bytes: 3844
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  rep(i, N) cin >> A[i] >> B[i];
  ll ans = 0;
  for (int i=N-1; i>=0; i--)
    ans += (B[i]-(A[i]+ans)%B[i])%B[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ANumberOfMultiples {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int L, R, d;
        cin >> L >> R >> d;
        int num = 0;
        for (int i = L; i <= R; i++) {
            if (i % d == 0) {
                num++;
            }
        }
        cout << num << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ANumberOfMultiples solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <deque>
#include <complex>
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
typedef long long int LL;
typedef vector<LL> VI;
typedef pair<LL,LL> pL;
typedef vector<pL> vpL;
typedef pair<LL,pL> ppL;
typedef vector<ppL> vppL;
const LL INF=(LL)1<<60;
vpL bug;
LL N;
bool solve(LL n){
	LL sum=0;
	priority_queue<int> pq;
	REP(i,n){
		sum+=bug[i].second;
		pq.push(bug[i].second);
	}
	if(n*bug[n-1].first>=sum) return true;
	FOR(i,n,N){
		sum+=bug[i].second;
		pq.push(bug[i].second);
		sum-=pq.top();
		pq.pop();
		if(n*bug[i].first>=sum) return true;
	}
	return false;
		
}
int main() {
	LL a,b;
	cin >> N;
	REP(i,N){
		cin >> a >> b;
		bug.push_back(pL(b,a));
	}
	int s=0,e=N,f;
	sort(bug.begin(),bug.end(),greater<pL>());
	while(s<=e){
		f=(s+e)/2;
		if(solve(f))
			s=f+1;
		else
			e=f-1;
	}
	cout << e<< endl;
	// your code goes here
	return 0;
}

Measured memory_bytes: 11184
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include<iomanip>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout<<setprecision(10);
  string s,t;
  cin>>s>>t;
  int sl,tl;
  sl=s.length();tl=t.length();
  vector<string> ans;
  if(sl>=tl)
  {
    for(int i=0;i<=sl-tl;i++)
    {
      string tmp=s;
      int flag=1;
      for(int j=0;j<sl;j++)
      {
        if(i<=j && j<i+tl)
        {
          if(tmp[j]=='?'){tmp[j]=t[j-i];}
          if(tmp[j]!=t[j-i]){flag=0;break;}
        }
        else
        {
          if(s[j]=='?')tmp[j]='a';
        }
      }
      if(flag)ans.push_back(tmp);
    }
  }
  sort(all(ans));
  if(ans.size()==0)cout<<"UNRESTORABLE";
  else cout<<ans[0];
  cout<<endl;



  return 0;

}


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

int main(){
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    if(a+b < 2*c){
        cout << a * x + b * y;
    }else{
        int p = min(x,y);
        int q = max(x,y);
        x -= p;
        y -= p;
        cout << min(2*c*p+a*x+b*y,2*c*q) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

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

        // input
        int woods = scan.nextInt();
        int peoples = scan.nextInt();

        // answer
        System.out.println((int)Math.ceil((double)woods / (peoples * 2.0 + 1.0)));

    }
}

Measured memory_bytes: 21844
N, u, v = map(int, input().split())
u -= 1
v -= 1
tonari = [[] for _ in range(N)]
for _ in range(N-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  tonari[a].append(b)
  tonari[b].append(a)

d_from_u = [float('inf') for _ in range(N)]
d_from_v = [float('inf') for _ in range(N)]
d_from_u[u] = 0
d_from_v[v] = 0
#print(tonari)
now = [v] #追いかける方
d = 0
while now:
  d += 1
  nextvisit = []
  for n in now:
    for t in tonari[n]:
      if d_from_v[t] > d:
        d_from_v[t] = d
        nextvisit.append(t)
  now = nextvisit



now = [u] #逃げる方
d = 0
while now:
  d += 1
  nextvisit = []
  for n in now:
    for t in tonari[n]:
      if d_from_v[t] <= d: #追いかける方より遠い地点は排除
        continue
      elif d_from_u[t] > d:
        d_from_u[t] = d
        nextvisit.append(t)
  now = nextvisit


distance = []
ans = 0
for U, V in zip(d_from_u, d_from_v):
  if U < N+1: #infを排除
    ans = max(ans, V-1)
print(ans)

Measured memory_bytes: 34044
x1,y1,x2,y2 = gets.chomp.split(" ").map(&:to_i);
if true || x1 < x2 && y1 < y2 then
  a = y1 - y2
  b = x1 - x2
  x3 = x2 + a
  y3 = y2 - b
  x4 = x3 + b
  y4 = y3 + a
end
print("#{x3} #{y3} #{x4} #{y4}\n")


Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
using namespace std;
typedef long long LL;

int main(void) {
	int n, count;
	cin >> n;

	vector<string> a(n);

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

	for (int i = 0; i < n; i++) {
		if (a[i] == "Y") {
			cout << "Four" << endl;
			return 0;
		}
	}
	cout << "Three" << endl;


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define MAX 36

typedef struct{
  char charcter;
  int number;
}Cards;

void BubbleSort(Cards [],int);
void SelectionSort(Cards [],int);
void swap_n(Cards [],int,int);
void swap_c(Cards [],int,int);
int judge(Cards [],Cards [],int);

int main(){
  Cards card[MAX],card2[MAX];
  int N;
  int i;

  scanf("%d",&N);

  for (i = 0;i < N;i++){
    scanf(" %c %d",&card[i].charcter,&card[i].number);
    card2[i] = card[i];
  }

  BubbleSort(card,N);
  SelectionSort(card2,N);
  
  for (i = 0;i < N;i++){
    if (i)
      printf(" ");
    
    printf("%c%d",card[i].charcter,card[i].number);

  }

  printf("\nStable\n");

   for (i = 0;i < N;i++){
    if (i)
      printf(" ");
    
    printf("%c%d",card2[i].charcter,card2[i].number);

  }
   
  if (judge(card,card2,N))
    printf("\nStable\n");

  else
    printf("\nNot stable\n");
  
  return 0;
}

void BubbleSort(Cards card[],int N){
  int i,j;
  int flag = 1;

  i = 0;
  
  while (flag){
    flag = 0;

    for (j = N - 1;j != i;j--)
      if (card[j].number < card[j - 1].number){
	swap_n(card,j - 1,j);
	swap_c(card,j - 1,j);
	flag = 1;
      }

    i++;
  }
  
}

void SelectionSort(Cards card[],int N){
  int i,j;
  int minj;

  for (i = 0;i < N - 1;i++){
    minj = i;

    for (j = i;j < N;j++)
      if (card[j].number < card[minj].number)
	minj = j;

    swap_n(card,minj,i);
    swap_c(card,minj,i);
  }
  
}

void swap_n(Cards card[],int a,int b){
  int temp;

  temp = card[a].number;
  card[a].number = card[b].number;
  card[b].number = temp;
}

void swap_c(Cards card[],int a,int b){
  char temp;

  temp = card[a].charcter;
  card[a].charcter = card[b].charcter;
  card[b].charcter = temp;
}

int judge(Cards card[],Cards card2[],int N){
  int i;

  for (i = 0;i < N;i++)
    if (card[i].charcter != card2[i].charcter)
      return 0;

  return 1;
}



Measured memory_bytes: 2120
import sys

N = int(sys.stdin.readline())
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
C = int(sys.stdin.readline())
D = int(sys.stdin.readline())
E = int(sys.stdin.readline())

min_v = min(A, B, C, D, E)
print((N - 1) // min_v + 1 + 4)

Measured memory_bytes: 9036
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;
using pll=pair<ll,ll>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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

int main() {
	ll N;
	cin >> N;
	string ans = "";
	ll M = 1;
	while(1) {
		int t = N % 26;
		if(t == 0) t = 26;
		ans = (char)('a' + (t-1)) + ans;
		if(N <= 26) break;
		if(N % 26 == 0) {
			N /=26;
			N -= 1;
		}
		else N /= 26;
		//if(N >= 26) N -= 1;
	}
	cout << ans << endl;

  return 0;
}


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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
  pr(b);
}

int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  cin >> ans;
  if (ans < 1200)
    pr("ABC");
  else if (ans < 2800)
    pr("ARC");
  else
    pr("AGC");

  return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>
#include<math.h>
int main(void){
    int s[1001],i,n;
    double sd,bs,mean,sum;
    while(1){
        scanf("%d",&n);
        if(!n) break;
        for(i=0,sum=0;i<n;i++){
            scanf("%d",&s[i]);
            sum+=s[i];
        }
        mean=sum/n;
        for(i=0,bs=0;i<n;i++){
            bs+=pow(s[i]-mean,2);
        }
        sd=sqrt(bs/n);
        printf("%.8lf\n",sd);
    }
    return 0;
}


Measured memory_bytes: 2112
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll MOD=(ll)1e9+7;
//}}}

ll pow_mod(ll a, ll b){
  ll res = 1;
  while(b > 0){
    if(b & 1) res = (res * a) % MOD;
    b >>= 1;
    a = (a * a) % MOD;
  }
  return res;
}

ll fact_mod(ll n){
  ll res = 1;
  rep(i, n) res = (res * (i + 1)) % MOD;
  return res;
}

ll comb_mod(ll n, ll r){
  ll res = 1;
  rep(i, r) res = (res * (n - i)) % MOD;
  return (res * pow_mod(fact_mod(r), MOD - 2)) % MOD;
}

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> v;
  ll ans = 1;
  rep(n, 2, 100000){
    if(M == 1) break;
    int num = 0;
    while(M % n == 0){
      M /= n;
      num++;
    }
    if(num){
      ans *= comb_mod(num + N - 1, N - 1);
      ans %= MOD;
    }
  }
  if(M != 1){
    ans *= comb_mod(N, N - 1);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
#include<bitset>
#include<iomanip>
using namespace std;

int main() {
	int N,M; cin >> N>>M;
	long long ans = 1,ans2=1,mod= 1000000007;
	if (N == M)ans *= 2;
	for (int i = 0; ; i++) {
		if ((N == 0 && M > 1) || (N > 1 && M == 0)){ans = 0; break;}
		if (N == 0 || M == 0)break;
		ans = ans*N%mod;
		ans2 = ans2 * M%mod;
		N--; M--;
	}
	cout << ans*ans2%mod << endl;
}



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

#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define per(i,n) for (int i=(int)(n)-1;i>=0;i--)
#define For(i,n) for (int i=1;i<=(int)(n);i++)
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define all(x) (x).begin(),(x).end()
#define Max(a,b,c) max(a,max(b,c))
#define Min(a,b,c) min(a,min(b,c))
#define pii pair<int,int>
#define vi vector <int>
#define lb lower_bound
#define ub upper_bound
#define ll long long
#define pb push_back
#define re return
#define se second
#define fi first
const int INF=0x7fffffff;
const int MAXN=3000+3;

int n;
double a[MAXN],f[MAXN][MAXN],ans;

int main(){
	f[0][0]=1;
	cin>>n;
	For(i,n){
		cin>>a[i];
	}
	For(i,n){
		rep(j,i+1){
			if (j) f[i][j]+=f[i-1][j-1]*a[i];
			if (i-j) f[i][j]+=f[i-1][j]*(1-a[i]);
		}
	}
	for (int i=n/2+1;i<=n;i++){
		ans+=f[n][i];
	}
	cout<<fixed<<setprecision(10)<<ans<<endl;
	re 0;
}

Measured memory_bytes: 68992
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define pii pair<int, int>
#define pll pair<long long, long long>
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<vector<ll>> A(N, vector<ll>(N));
    rep(i,N) rep(j,N) cin >> A[i][j];

    int M = 1<<N;
    vector<ll> V(M);
    for (int tmp = 1; tmp<M; tmp++) {
        bitset<16> s(tmp);
        rep(i,N-1) {
            for (int j = i+1; j < N; j++) {
                if (s.test(i) && s.test(j)) V[tmp] += A[i][j];
            }
        }
    }
    vector<ll> DP(M,-1);
    DP[0] = 0;
    rep(i,N) DP[1<<i] = 0;
    function<ll(int)> dfs = [&](int s) {
        if (DP[s] != -1) return DP[s];
        ll val = 0;
        for (int t = s; t != 0; t = (t-1)&s) {
            chmax(val,V[t]+dfs(t^s));
        }
        return DP[s] = val;
    };

    cout << dfs(M-1) << endl;
}

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

int main() {
	int W,H,result,up;
	char c;
	int a[22][22];
	while(1){
		for(int i = 0;i <= 21;i++){
			for(int j = 0;j <= 21;j++){
				a[i][j] = 0;
			}
		}
		result = 1;
		cin >> W >> H;
		if(W == 0)break;
		for(int i = 1;i <= H;i++){
			for(int j = 1;j <= W;j++){
				cin >> c;
				if(c == '.')a[i][j] = 1;
				else if(c == '@')a[i][j] = 2;
			}
		}
		while(1){
			up = 0;
		for(int i = 1;i <= H;i++){
			for(int j = 1;j <= W;j++){
				if(a[i][j] == 2 && a[i-1][j] == 1){
					a[i-1][j] = 2;
					up++;
				}
				if(a[i][j] == 2 && a[i][j-1] == 1){
					a[i][j-1] = 2;
					up++;
				}
				if(a[i][j] == 2 && a[i+1][j] == 1){
					a[i+1][j] = 2;
					up++;
				}
				if(a[i][j] == 2 && a[i][j+1] == 1){
					a[i][j+1] = 2;
					up++;
				}
			}
		}
		result += up;
		if(up == 0)break;	
		}
	cout << result <<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
using System;

namespace ITP1_3_D
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] vs = Console.ReadLine().Split(' ');
			int a = int.Parse(vs[0]);
			int b = int.Parse(vs[1]);
			int c = int.Parse(vs[2]);

			int ans = 0;
			for(int i = a; i <= b; i++) {
				if(c % i == 0) {
					ans++;
				}
			}

			Console.WriteLine(ans);
		}
	}
}



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

int main() {
    int N; cin >> N;
    vector<vector<int>> G(N);
    vector<int> a(N), b(N);
    for(int i=0; i+1<N; ++i) {
        cin >> a[i] >> b[i];
        --a[i]; --b[i];
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }

    int K = 0;
    using pp = pair<int, int>;
    using P = pair<int, pp>;
    queue<P> Q;
    Q.push(P(0, pp(-1, -1)));
    map<pair<int, int>, int> res;

    while(!Q.empty()) {
        auto tmp = Q.front(); Q.pop();
        int cur = tmp.first;
        int par = tmp.second.first;
        int parcol = tmp.second.second;
        int rc = K;
        
        for(int to : G[cur]) {
            if(to == par) continue;
            if(rc > 0 && rc == parcol) --rc;

            if(rc > 0) {
                res[pp(min(cur, to), max(cur, to))] = rc;
                Q.push(P(to, pp(cur, rc)));
                //cout << cur << ' ' << to << ' ' << rc << endl;
                --rc;
            } else {
                ++K;
                res[pp(min(cur, to), max(cur, to))] = K;
                Q.push(P(to, pp(cur, K)));
                //cout << cur << ' ' << to << ' ' << K << endl;
            }
        }
    }

    cout << K << endl;
    for(int i=0; i+1<N; ++i) cout << res[pp(a[i], b[i])] << endl;
}

Measured memory_bytes: 13184
#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
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#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
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int X, N; cin >> X >> N;
	VI A(N);
	bool F[120] = { false };
	REP(i, N) {
		cin >> A[i];
		F[A[i]] = 1;
	}
	
	int ans;
	int tmp = LLINF;

	eFOR(i, 0, 110) {
		if (F[i])continue;
		if (tmp > abs(X - i)) {
			tmp = abs(X - i);
			ans = i;
		}
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3656
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
    int a,b;
    cin>>a>>b;
    if(a<=b){
        for(int i=0; i<b; i++){
            cout<<a;
        }
    }else{
        for(int i=0; i<a; i++){
            cout<<b;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
#define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        2e18
 #define sm         -1e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
   
    #endif
}





void solve()
{
  int k,a,b;
  cin >> k >> a >> b;

  for(int i=a;i<=b;i++)
  {
    if(i%k==0)
    {
      cout<<"OK\n";
      return ;
    }
  }

  cout<<"NG\n";
  
}

int32_t main()
{
  pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
  
    // cout << "Time taken by function: "
    //      << duration.count() << " microseconds" << endl; 

 }


Measured memory_bytes: 3644
n=int(input())
s=input()
l=[]
for i in range(n-1):
    ans=0
    su=list(set(s[:i+1]))
    sd=list(set(s[i+1:]))
    for j in su:
        if j in sd:
            ans+=1
    l.append(ans)
print(max(l))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[100000];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int *x;
  x=unique(a,a+n);
  int d = distance(a, x);
  for(int i=0;i<d;i++){
    if(i!=0) cout<<" ";
    cout<<a[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 3468
n = int(input())
a = [[int(x) for x in input().split()] for i in range(n)]
dp = [[0] * 3 for i in range(n+1)]

for i in range(n):
  for j in range(3):
    for k in range(3):
      if j != k:
        dp[i+1][j] = max(dp[i+1][j], dp[i][k] + a[i][j])
print(max(dp[n][0], dp[n][1], dp[n][2]))
    

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

int main(){
	int N;
	cin >> N;
	int p[N];
	for(int i = 0; i < N; i++) cin >> p[i];
	sort(p, p+N, greater<int>());
	int sum = 0;
	sum = p[0]/2;
	for(int i = 1; i < N; i++) sum += p[i];
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;
 
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x first
#define y second
 
const int MOD = 1e9 + 7;
 
void setIO() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
//    freopen((s+".in").c_str(),"r",stdin);
//    freopen((s+".text").c_str(),"w",stdout);
}

//ctrl q is comment
//ctrl b is run
//ctrl s is compile
//alt r is search & replace
//alt d is delete a line

int main(){
    setIO();
    int n, k; cin >> n >> k;
    int a[n];
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    int f = 0, l = k;
    for(int i = k; i < n; ++i){
        if(a[l] > a[f]) cout << "Yes\n";
        else cout << "No\n";
        ++l; ++f;
    }
    
}

Measured memory_bytes: 4436
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int h = sc.nextInt();
		int w = sc.nextInt();

		char[][] input = new char[h][w];

		for(int i = 0; i < h; i++){
			String str = sc.next();
			for(int j = 0; j < w; j++){
				input[i][j] = str.charAt(j);
			}
		}

		char[][] visit = new char[h][w];
		for(int i = 0; i < h; i++){
			Arrays.fill(visit[i], '.');
		}

		int x = 0;
		int y = 0;

		while(true){
			visit[y][x] = '#';
			if(x == w - 1 && y == h - 1){
				break;
			}

			if(x < w - 1 && input[y][x + 1] == '#'){
				x++;
			}
			else if(y < h - 1 && input[y + 1][x] == '#'){
				y++;
			}
			else{
				break;
			}
		}

		for(int i = 0; i < h; i++){
			for(int j = 0; j < w ; j++){
				if(input[i][j] != visit[i][j]){
					System.out.println("Impossible");
					return;
				}
			}
		}
		System.out.println("Possible");
	}
}


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

#define FOR(i, l, r) for(size_t i = (l); i < (r); i = i + 1)
#define REP(i, n) FOR(i, 0, n)
using ll = long long;

int main() {
    string S;
    cin >> S;
    if(S[2] == S[3] && S[4] == S[5]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner a = new Scanner(System.in);
		int h = 1;
		int w = 1;
		while(h > 0 && w > 0){
		h = a.nextInt();
		w = a.nextInt();
		for(int i = 0;i < h;i++){
			for(int j = 0;j < w;j++){
				System.out.print("#");
			}
			if(h != 0 && w != 0)
			System.out.println();
		}
		if(h != 0 && w != 0)
			System.out.println();
		}
	}

}

Measured memory_bytes: 26816
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//以上テンプレ
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}


int main(){
    ll N;
    cin>>N;
    vector<string> vec(N);
    map<string,int> a;
    ll count=0;
    rep(i,N){
        cin>>vec.at(i);
        sort(all(vec.at(i)));
        a[vec.at(i)]++;
    }
    for(auto p : a ){
        auto y=p.second;
        if(y>=2){
            count+=nCr(y,2);
        }
    }
    cout<<count<<endl;
    }


Measured memory_bytes: 18176
N = int(input())

ans = [0 for _ in range(10001)]

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            num = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if num <= 10000:
                ans[num] += 1
                
for n in range(1,N+1):
    print(ans[n])

Measured memory_bytes: 9236
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
#define mod 1000000007
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    
    int n;
    long long ans=0;
    cin>>n;
    int prev=0;
    for(int i=1;i<=n;i++){
        int x;
        cin>>x;
        ans+=min(prev,x);
        x-=min(x,prev);
        ans+=x/2;
        x%=2;
        prev=x;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8


def main():

    n, limit = map(int, input().split(' '))
    heights = list(map(int, input().split(' ')))
    heights = sorted(heights, reverse=True)

    nakama_count = 0
    for height in heights:
        if height >= limit:
            nakama_count += 1
        else:
            break

    print(nakama_count)

    return 0
    
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 11908
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  int a[5];
  for(int i=0;i<5;i++)cin>>a[i];
  int k;
  cin>>k;
  for(int i=0;i<5;i++)
    for(int j=i+1;j<5;j++)
	 if(abs(a[i]-a[j])>k){
	   cout<<":("<<endl;
	   return 0;
	 }
  cout<<"Yay!"<<endl;
  return 0;
}


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

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(){
    int n;
    cin >> n;
    if(n==7||n==5||n==3) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
main = do
  s <- getLine
  putStrLn (if check s 1 then "Yes" else "No")

check :: String -> Int -> Bool
check s a
  | s == "" = True
  | mod a 2 == 0 && ok (head s) = check (tail s) (a + 1)
  | mod a 2 == 0 = False
  | ok2 (head s) = check (tail s) (a + 1)
  | otherwise = False

ok :: Char -> Bool
ok 'R' = False
ok c = True

ok2 :: Char -> Bool
ok2 'L' = False
ok2 c = True


Measured memory_bytes: 380