akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, a, n) for(int i=(a); i<(n); i++)
using namespace std;

int main(){
    string s;
    cin >> s;
    string ans;
    if(s[0] + s[1] + s[2] == 294 && !(s[0] == 'b' && s[1] == 'b' && s[2] == 'b')){
        ans = "Yes";
    }else{
        ans = "No";
    }

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

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>

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

using namespace std;

void enumCandidates(int h,int m,int s,vector<int> &cnd){
	rep(t,60){
		int hh=(h+t)%60,mm=(m+t)%60,ss=(s+t)%60;
		if(hh/5*5+mm/12==hh) cnd.push_back(hh/5*3600+mm*60+ss);
	}
}

int main(){
	for(int n;scanf("%d",&n),n;){
		vector<int> cnd[10];
		rep(i,n){
			int a[3]; rep(j,3) scanf("%d",a+j);
			sort(a,a+3);
			do{
				enumCandidates(a[0],a[1],a[2],cnd[i]);
			}while(next_permutation(a,a+3));
		}

		static int acc[10][43201];
		memset(acc,0,sizeof acc);
		rep(i,n) rep(j,cnd[i].size()) acc[i][cnd[i][j]+1]=1;
		rep(i,n) rep(t,43200) acc[i][t+1]+=acc[i][t];

		int ans=77777,t1_ans,t2_ans;
		rep(j,n) rep(i,j) {
			rep(k,cnd[i].size()) rep(l,cnd[j].size()) {
				int t1=min(cnd[i][k],cnd[j][l]);
				int t2=max(cnd[i][k],cnd[j][l]);

				bool ok=true;
				rep(p,n) if(acc[p][t2+1]-acc[p][t1]==0) ok=false;
				if(ok && (t2-t1<ans || t2-t1==ans && t1<t1_ans)){
					ans=t2-t1;
					t1_ans=t1;
					t2_ans=t2;
				}
			}
		}

		printf("%02d:%02d:%02d %02d:%02d:%02d\n",
			t1_ans/3600,t1_ans/60%60,t1_ans%60,
			t2_ans/3600,t2_ans/60%60,t2_ans%60);
	}

	return 0;
}

Measured memory_bytes: 2516
#include <stdio.h>

int main()
{
	int a,b,sum,n;
	scanf("%d%d", &a,&b);
	sum = a + b;
	if(a%3==0 || b%3==0 ||sum%3==0) {
		printf("Possible\n");
	}
	else{
		printf("Impossible\n");
	}
	return 0;
}


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

using namespace std;

const double PI = 3.141592653589;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define ll long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  

vector<vector<int>> graph;
int ans = 0;
vector<int> vis;
vector<int> dp;
void dfs(int node)
{
    for(int i:graph[node])
    {
        if(!vis[i])
        {
            vis[i] = 1;
            dfs(i);
        }
        dp[node] = max(dp[node], dp[i]+1);
        ans = max(ans, dp[node]);
    }
}

int32_t main()
{
    fastio;
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    graph.resize(n+1);
    dp.assign(n+1, 0);
    vis.assign(n+1, 0);
    for(int i=0;i<m;i++)
    {
        int a, b;
        cin >> a >> b;
        graph[a].pb(b);
    }

    for(int i=1;i<=n;i++)
    {
        if(!vis[i]) 
        {
            vis[i] = 1;
            dfs(i);
        }
    }
    cout << ans << "\n";

    return 0;
}



Measured memory_bytes: 9344
/**
 *   
 *   Date: 18 August 2019
 *   Time: 17:36:34
**/
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cmath>
#include <cstring>
#include<queue>
#include<stack>
#include<climits>
#include<iomanip>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pi;
typedef vector<ll> vec;
typedef vector<vector<ll> > matrix;

int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll n,x;
	double sum=0,d;
	cout<<fixed<<setprecision(10);
	cin>>n;
	double ar[n+2];

	for(ll i=1;i<=n;i++)
	{
		cin>>ar[i];
		sum+=(double)1/ar[i];
		
	}
	d=(double)1/sum;
	
	cout<<d;

return 0;
}

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

a_s = str(a)
b_s = str(b)

a_w=a_s
b_w=b_s

while b > 1:
    a_w+=a_s
    b -= 1

while a > 1:
    b_w+=b_s
    a -= 1

test_list = [a_w, b_w] 

res = min(filter(lambda s:isinstance(s, str), test_list)) 

print(res)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

int sqrtb(int a) {
	int l = 1, u = (int)2e+9;
	while(u - l > 1) {
		int c = (l + u) / 2;
		if (c * c <= a) {
			l = c;
		} else {
			u = c;
		}
	}
	return l;
}

signed main(){
	int Q;
	cin >> Q;
	for(int i = 0; i < Q; ++i) {
		int A, B;
		cin >> A >> B;
		if(A > B) swap(A,B);
		if(B == 1) {
			cout << 0 << endl;
			continue;
		}
		int M = A * B - 1;
		int L = (int)sqrtb(M);
		int t = 2 * L - (M / L == L);
		if(A <= L) {
			--t;
		}
		cout << t << endl;
	}
	return 0;
}


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

public class Main {

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.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 str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main (String[] args) {
        FastReader sc = new FastReader();
        int m = sc.nextInt();
        System.out.println(48 - m);
    }
}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


char S[4],T[4];

int main(){

	scanf("%s",S);
	scanf("%s",T);

	int ans = 0;

	for(int i = 0; i < 3; i++){
		if(S[i] == T[i]){

			ans++;
		}
	}

	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<int> adj[100010];
int in[100010],val[100010];
int32_t main() {
    ios::sync_with_stdio(false);cin.tie(0);
    int n,m,x,y;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>y;
        adj[x].push_back(y);
        in[y]++;
    }
    queue<int> q;
    for(int i=1;i<=n;i++)
    {
        if(!in[i])
            q.push(i);
    }
    while(q.size())
    {
        int top = q.front();
        q.pop();
        for(auto i:adj[top])
        {
            val[i] = max(val[i],val[top]+1);
            in[i]--;
            if(!in[i])
                q.push(i);
        }
    }
    int fin = 0;
    for(int i=1;i<=n;i++)
        fin = max(fin,val[i]);
    cout<<fin;
    return 0;
}

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

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

  sort(a, a + n);
  double ans = a[0];
  for(int i = 0; i < n; ++i){
    ans = ( a[i] + ans ) / 2.0;
  }
  cout << fixed;
  cout << setprecision(8);
  cout << ans << endl;
}


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

//Headstrong Student
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			int x = sc.nextInt(), y = sc.nextInt();
			if((x|y)==0)break;
			int[] a = new int[y];
			Arrays.fill(a, -1);
			a[x] = 0;
			int p = 0, q = 0, r = 1;
			for(;;){
				x = (x*10)%y;
				if(x==0){
					p = r; break;
				}
				if(a[x]==-1){
					a[x] = r++;
				}
				else{
					p = a[x]; q = r-a[x]; break;
				}
			}
			System.out.println(p+" "+q);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 20000
// Let's bring the sky down :)
// Read comment of Rudy on Cf page.
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 3e3 + 5;
const int M = 1e9 + 7;
int dp[N][N];
int main()
{
    ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n;
    string s;
    cin >> n >> s;
    dp[1][1] = 1;
    int L, R;
    for(int i = 2; i <= n; i++){
        for(int j = 2; j <= n; j++){
            dp[i - 1][j] += dp[i - 1][j - 1];
            dp[i - 1][j] %= M;
        }
        for(int j = 1; j <= i; j++){
            if(s[i - 2] == '>')
                L = j, R = i;
            else
                L = 1, R = j - 1;
            if(L <= R){
                dp[i][j] += (dp[i - 1][R] - dp[i - 1][L - 1] + M) % M;
            }
        }
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ans += dp[n][i];
        ans %= M;
    }
    cout << ans;
return 0;
}


Measured memory_bytes: 35456
lst = [int(i) for i in input().split()]

# lst[1]座標
left = lst[1]-(lst[0]-1)
right = lst[1]+(lst[0]-1)
ans = list(range(left,right+1))

ans_s = ans[0]
for i in range(1,len(ans)):
    ans_s = str(ans_s)+' '+str(ans[i])
    
if lst[0] == 1:
    print(lst[1])
else:
    print(ans_s)

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;

const int len = 2e5+5;
const ll inf = 1e16;
ll tree[4*len], dp[len], lazy[4*len];
vector<ii> vec[len];

void prop(int p, int l, int r){
    if (lazy[p] == 0)
        return;

    tree[p] += lazy[p];
    if (l < r){
        lazy[2*p] += lazy[p];
        lazy[2*p+1] += lazy[p];
    }
    lazy[p] = 0;
}

void update(int p, int l, int r, int i, int j, ll v){
    prop(p, l, r);
    if (r < i || j < l)
        return;
    if (i <= l && r <= j)
        lazy[p] += v;
    else{
        int mid = (l+r)/2;
        update(2*p, l, mid, i, j, v), update(2*p+1, mid+1, r, i, j, v);
        prop(2*p, l, mid), prop(2*p+1, mid+1, r);
        tree[p] = max(tree[2*p], tree[2*p+1]);
    }
}

ll query(int p, int l, int r, int i, int j){
    prop(p, l, r);
    if (r < i || j < l)
        return -inf;
    if (i <= l && r <= j)
        return tree[p];

    int mid = (l+r)/2;
    return max(query(2*p, l, mid, i, j), query(2*p+1, mid+1, r, i, j));
}

int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i = 0; i < m; i++){
        int l, r, c;
        scanf("%d %d %d", &l, &r, &c);
        vec[l].pb(mp(r, c));
    }

    for (int i = n; i >= 0; i--){
        dp[i] = max(0LL, query(1, 1, n, i+1, n));

        if (i == 0)
            break;

        update(1, 1, n, i, i, dp[i]);
        for (int j = 0; j < vec[i].size(); j++){
            ii v = vec[i][j];
            update(1, 1, n, i, v.fi, v.se);
        }
    }

    printf("%lld\n", dp[0]);
    return 0;
}


Measured memory_bytes: 24960
#include<stdio.h>

#define QQ_MAX 9

int main(){

        unsigned int  a = 0,  b = 0;
        int ans = 0;
        int count = 0;

        while(scanf("%d %d",&a , &b) != EOF)
        {
                ans = a + b;
                while(1)
                {
                        ans /= 10;
                        count++;
                        if(1 > ans)
                        {
                                break;
                        }
                }
                printf("%d\n",count);
                ans = 0;
                count = 0;
        }


    return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

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

const int N_MAX = 110;

int n; 
int a[N_MAX];

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

  double tmp=0;
  rep(i, n){
    tmp+=a[i];
  }
  double av = tmp/n;
  int frm=0;
  rep(i, n){
    if(abs(a[i]-av) < abs(a[frm]-av)){
      frm=i;
    }
  }
  cout << frm << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<queue>
using namespace std;

int main(){
    int n;
    string S;
    cin>>n;
    cin>>S;
    int x=0;
    int m=0;
    for(int i=0;i<n;i++){
        if(S[i]=='I'){
            x++;
        }else{
            x--;
        }
        m=max(m,x);
    }
    cout<<m<<endl;
}

Measured memory_bytes: 256
from collections import Counter

N, M = map(int, input().split())
x = list(map(int, input().split()))
xM = [xi % M for xi in x]

ans = 0
Cx = Counter(x)
CxM = Counter(xM)
same_num = {i: 0 for i in range(M)}
for xi in Cx.keys():
    same_num[xi % M] += Cx[xi] // 2

ans += CxM[0] // 2
for i in range(1, M // 2 + 1):
    if i * 2 == M:
        ans += CxM[i] // 2
    else:
        ans += min(CxM[i], CxM[M - i])
        if CxM[i] < CxM[M - i]:
            ans += min(same_num[M - i], (CxM[M - i] - CxM[i]) // 2)
        else:
            ans += min(same_num[i], (CxM[i] - CxM[M - i]) // 2)

print(ans)


Measured memory_bytes: 78180
#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;

int main(void){
  int n,a,b;
  cin >> n >> a >> b;
  int minimum = 0;
  if(a + b <= n){
    minimum = 0;
  } else {
    minimum = min(a,b) - (n - max(a,b));
  }
  cout << min(a,b) << ' ' << minimum << endl;

  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

#define mt make_tuple
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sqr(x) ((ll)(x) * (x))

int bfs(vector <vector<char>> &v, pii pocetak, int h, int w)
{
    vvi resenje(h + 1);
    for(int i = 1; i <= h; i++)
    {
        resenje[i].resize(w + 1);

        for(int j = 1; j <= w; j++)
        {
            resenje[i][j] = INT_MAX;
        }
    }

    queue <pii> q;
    q.push(pocetak);
    resenje[pocetak.fi][pocetak.se] = 0;

    pii zadnji = pocetak;

    while(!q.empty())
    {
        pii trenutni = q.front();
        zadnji = trenutni;
        q.pop();

        if((trenutni.fi + 1 <= h && resenje[trenutni.fi + 1][trenutni.se] == INT_MAX) && v[trenutni.fi + 1][trenutni.se] != '#')
        {
            q.push(mp(trenutni.fi + 1, trenutni.se));
            resenje[trenutni.fi + 1][trenutni.se] = resenje[trenutni.fi][trenutni.se] + 1;
        }

        if((trenutni.fi - 1 >= 1 && resenje[trenutni.fi - 1][trenutni.se] == INT_MAX) && v[trenutni.fi - 1][trenutni.se] != '#')
        {
            q.push(mp(trenutni.fi - 1, trenutni.se));
            resenje[trenutni.fi - 1][trenutni.se] = resenje[trenutni.fi][trenutni.se] + 1;
        }

        if((trenutni.se + 1 <= w && resenje[trenutni.fi][trenutni.se + 1] == INT_MAX) && v[trenutni.fi][trenutni.se + 1] != '#')
        {
            q.push(mp(trenutni.fi, trenutni.se + 1));
            resenje[trenutni.fi][trenutni.se + 1] = resenje[trenutni.fi][trenutni.se] + 1;
        }

        if((trenutni.se - 1 >= 1 && resenje[trenutni.fi][trenutni.se - 1] == INT_MAX) && v[trenutni.fi][trenutni.se - 1] != '#')
        {
            q.push(mp(trenutni.fi, trenutni.se - 1));
            resenje[trenutni.fi][trenutni.se - 1] = resenje[trenutni.fi][trenutni.se] + 1;
        }
    }

    return resenje[zadnji.fi][zadnji.se];
}

int main()
{
    int h, w;

    cin >> h >> w;

    vector <vector<char>> v(h + 1);

    for(int i = 1; i <= h; i++)
    {
        v[i].resize(w + 1);

        for(int j = 1; j <= w; j++)
        {
            cin >> v[i][j];
        }
    }

    int najvece = INT_MIN;

    for(int i = 1; i <= h; i++)
    {
        for(int j = 1; j <= w; j++)
        {
            if(v[i][j] == '#')continue;

            int vrednostBfsa = bfs(v, mp(i, j), h, w);

            if(vrednostBfsa > najvece)najvece = vrednostBfsa;
        }
    }

    cout << najvece << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int h, w;

    cin >> h >> w;

    ll m;
    cin >> m;

    map<ll, ll> r, c;
    map<P, bool> flag;
    ll r_max = 0, c_max = 0;
    ll ri, ci;
    vector<int> a(m), b(m);

    for (int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i];
        flag[{a[i], b[i]}] = true;
        r[a[i]]++;
        r_max = max(r_max, r[a[i]]);
        c[b[i]]++;
        c_max = max(c_max, c[b[i]]);
    }

    set<ll> x, y;

    for (int i = 1; i <= h; i++)
    {
        if (r[i] == r_max)
        {
            x.insert(i);
        }
    }

    for (int i = 1; i <= w; i++)
    {
        if (c[i] == c_max)
        {
            y.insert(i);
        }
    }

    bool z = false;

    for (auto &&i : x)
    {
        for (auto &&j : y)
        {
            if (flag[{i, j}] == false)
            {
                z = true;
                break;
            }
        }
    }

    if (z)
    {
        cout << r_max + c_max << endl;
    }
    else
    {
        cout << r_max + c_max - 1 << endl;
    }
}


Measured memory_bytes: 108744
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int ans;
    if( n== 1){
        cout << "Yes" << endl;
        return 0;
    }
    if( n > 81){
        ans = -1;
        cout << "No" << endl;
        return 0;
    }
    int tmp;
    for( int i=2; i<10; i++){
        if( (n%i == 0) && ( n/i <= 9) ){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <vector>

using namespace std;


int main()
{
	
	int S, K;
	cin >> K >> S ;

	int ans = 0;

	for (int x = 0; x <= K; ++x) {
		for (int y = 0; y <= K; ++y) {
			int z = S - (x + y);
			
			if (z > K) continue;
			if (z < 0) continue;

			if ( x+y+z == S) {
				ans ++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(void){
    string S;
    cin >> S;
    int A{0}, B{0};
    for(int i{0}; i<3; ++i){
        if(S[i]=='A'){
            ++A;
        }
        else{
            ++B;
        }
    }
    if(A>=1 and B>=1){
        cout << "Yes" <<endl;
    }
    else{
        cout << "No" <<endl;
    }

}


Measured memory_bytes: 256
#include <iostream>
int main()
{
	int a;
	std::cin >> a;
	auto hour = a / 3600;
	auto min = a % 3600 /60;
	auto sec = a - (hour * 3600 + min * 60);
	std::cout <<hour<<":"<<min<<":"<< sec << std::endl;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

#define INX(x) (cin >> x)
#define OUTX(x) (cout << x << endl)

#define ADD emplace_back
#define MP make_pair
#define VVEC(type) vector<vector<type>>



ll tesu(ll redred, ll redwhite, ll whitered, ll whitewhite)
{
    ll result;
    if(redwhite == 0)
    {
        result = whitered;
    }
    else if(whitered == 0)
    {
        result = redwhite;
    }
    else if(redwhite <= whitered)
    {
        result = whitered;
    }
    else
    {
        result = redwhite;
    }
    return result;
}

int main()
{
    ll N;
    INX(N);
    
    string c;
    c.resize(N);
    ll cwhite = 0;
    for (ll i = 0; i < N; i++)
    {
        char tmp;
        INX(tmp);
        c[i] = tmp;
        if(tmp == 'W')
        {
            cwhite++;
        }
    }
    
    //赤い石が左から(0含め)i個並んでいる状態なら災いの白い石が無い
    //左からi個まで赤い石を並べた場合と現在の状態の差を求める
    //その中で最小のものが答え

    //全部白と赤の場合を先に考えておいて暫定の答えとする
    ll result = min(cwhite, N - cwhite);

    //[赤側][白側]でそれぞれ何個ずつ赤い石と白い石があるか数える
    //最初の1回は真面目に数えて、後は差分を考える
    ll redred, redwhite, whitered, whitewhite;
    redred = redwhite = whitered = whitewhite = 0;
    if(c[0] == 'W')
    {
        redred = 0;
        redwhite = 1;
    }
    else
    {
        redred = 1;
        redwhite = 0;
    }
    for (ll i = 1; i < N; i++)
    {
        if(c[i] == 'W')
        {
            whitewhite++;
        }
        else
        {
            whitered++;
        }
    }
    result = min(result, tesu(redred, redwhite, whitered, whitewhite));

    //赤が2個以降
    for (ll i = 1; i < N - 1; i++)
    {
        //数調整
        if(c[i] == 'W')
        {
            redwhite++;
            whitewhite--;
        }
        else
        {
            redred++;
            whitered--;
        }
        
        result = min(result, tesu(redred, redwhite, whitered, whitewhite));
    }
    OUTX(result);


    return 0;
}


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

using namespace std;

int mat[1404][1404],dp[1404][1404];
int H,W;
int main(){
    cin>>H>>W;
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            cin>>mat[i][j];
        }
    }
    int ans=0;
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            if(mat[i][j]==0)
                dp[i][j]=min(dp[i-1][j],min(dp[i-1][j-1],dp[i][j-1]))+1;
            else dp[i][j]=0;
            if(dp[i][j]>ans) ans=dp[i][j];
        }
    }
    cout<<ans*ans<<endl;
    return 0;
}

Measured memory_bytes: 18468
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int A, B, C;
	cin >> A >> B >> C;

	if (A + B >= C) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int N;
vector<string> v;
int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) {
		string str; cin >> str;
		v.push_back(str);
	}
	sort(v.begin(), v.end());
	int cnt = 0;
	for (int i = 0; i < N-1; ++i) {
		if (v[i] != v[i + 1]) cnt++;
	}
	
	if (cnt == 3) cout << "Four" << endl;
	else if (cnt == 2) cout << "Three" << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

// #define DEBUG

vector<string> perm_enum(string s, int n)
{
    vector<string> a;
    string t;
    if (n == 1)
    {
        a.push_back(s);
        return a;
    }
    else
    {
        for (int i = 0; i < n; i++)
        {
            t = "";
            for (int j = 0; j < n; j++)
            {
                if (i != j)
                    t += s[j];
            }
            vector<string> b = perm_enum(t, n - 1);
            for (string r : b)
                a.push_back(s[i] + r);
        }

        return a;
    }
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif
    int n;
    cin >> n;
    string t;
    for (int i = 0; i < n; i++)
        t += i + '1';
    vector<string> ans = perm_enum(t, n);
    for (string s : ans)
    {
        for (int i = 0; i < n - 1; i++)
            cout << s[i] << " ";
        cout << s[n - 1] << "\n";
    }

    return 0;
}


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

typedef long long ll;
#define endl "\n"



int main(){
	// INT VS LL
    // freopen("input.txt", "r", stdin);
    //	INT VS LL
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n; cin>>n;
    int whole = n/1000+1;
    cout<<(whole*1000-n)%1000<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;

int main(){
  int a,b;
  cin >> a>>b;

  int A=a,B=b;
  FOR(i,0,b-1){
    A = 10*A+a;
  }
  FOR(i,0,a-1){
    B = 10*B+b;
  }

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


Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let n: isize = read();
    let s: String = read();

    let ans: Vec<&str> = s.as_str().matches("ABC").collect();

    println!("{:?}", ans.len());
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test lli t;cin>>t;while(t--)
#define vll vector<lli>
#define mll map<lli,lli>
#define vvll vector<vector<lli>>
#define vpll vector<pair<lli,lli>>
#define vvpll vector<vector<pair<lli,lli>>>
#define mpll map<pair<lli,lli>,lli>
#define pll pair<lli,lli>
#define sll stack<lli>
#define qll queqe<lli>
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ff first
#define ss second
#define mod 1000000007
#define ma 1000000000000000000
#define mi -1000000000000000000
int main()
{
  
  fastio
  lli n,i,p=1000,s=0,d;
  cin>>n;
  lli a[n+1];
  a[0]=1000;
  for(i=1;i<=n;i++)
    cin>>a[i];
  i=1;
  while(i<=n)
  {
    while(a[i]<=a[i-1]&&i<=n)
    {
      i++;
      
    }
    s=p/a[i-1];
    d=p;
    p=p-s*a[i-1];
  while(a[i]>=a[i-1]&&i<=n)
    {
      i++;
    }
    p=max(d,p+s*a[i-1]);
    s=0;
      
  }
  cout<<max(d,p+s*a[n]);
  
  return 0;
}

Measured memory_bytes: 3648
#require 'pp'

x, y, _, _, _ = gets.split.map(&:to_i)
p_a = gets.split.map(&:to_i).sort!
q_a = gets.split.map(&:to_i).sort!
r_a = gets.split.map(&:to_i).sort!

eats = []
# 無職を使わずに食べた場合
x.times do |i|
    t = p_a.pop
    eats << t
end
y.times do |i|
    t = q_a.pop
    eats << t
end
eats.sort!

loop do
    t = eats.shift
    u = r_a.pop
    if u && t < u
        eats.push(u)
    else
        eats.push(t)
        break
    end
end

#pp eats
puts eats.inject(&:+)


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    cout << (n * (n - 1) + m * (m - 1)) / 2 << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) ((int)(x).size())
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

const int inf = 1 << 30;
const ll INF = 1LL << 60;

int main(){
    int n, k;
    cin >> n >> k;
    VI a(n);
    rep(i,n) cin >> a[i];
    rep(i,n){
        if (i + k == n) break;
        if (a[i] < a[i+k]) view("Yes");
        else view("No");
    }
    return 0;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
#include <unistd.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
 
 
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'

signed main() {
  fio();
  int n;
  cin >> n;
  for (int a = 1; a <= 9; a++) {
    rep1 (b, 9) {
      if (a * b == n) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <cassert>
#include <stack> 

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 1000000007
#define BASE 77747
#define PI acos(-1.0)
#define MAXLEN 29

typedef std::pair <int, int> pii;
typedef long long ll;
typedef std::vector <ll> vll;

using namespace std;

int n;
ll arr[200000];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		arr[i] -= i + 1;
	}
	sort(arr, arr + n);
	ll ans = 0;
	for (int i = 0; i < n; i++) ans += abs(arr[i] - arr[n / 2]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
typedef long long ll;
#define lim 1000000000000000001
 
 
ll root(ll x,vector<ll>&v)
{
    while(v[x]!=x)
    {
        v[x]=v[v[x]];
        x=v[x];
    }
    return x;
}
 
int main()
{
     fast;
     ll n,k;
     cin>>n>>k;
     vector<ll>v(n);
     for(auto &x:v)cin>>x;
     vector<ll>ans(n);
     ans[0]=0LL;
     ans[1]=abs(v[1]-v[0]);
     for(int i=2;i<n;i++)
     ans[i]=INT_MAX;
     for(int i=2;i<n;i++)
        for(int j=1;j<=min(k,(ll)i);j++)
        ans[i]=min(ans[i],(ans[i-j]+abs(v[i]-v[i-j])));
    cout<<ans[n-1];
 
    return 0;
}

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

using namespace std;

const int BLOCK = 707;

int c[500005], ans[500005], res, cnt[500005];

struct dat {
    int l, r, id;

    bool operator < (const dat& T) const {
        if (l / BLOCK != T.l / BLOCK) return l / BLOCK < T.l / BLOCK;
        return r < T.r;
    }
}a[500005];

void remove(int id) {
    cnt[c[id]]--;
    if (cnt[c[id]] == 0) res--;
}

void add(int id) {
    cnt[c[id]]++;
    if (cnt[c[id]] == 1) res++;
}

int main() {
    int n, q;
    scanf("%d%d", &n, &q);

    for (int i = 0; i < n; i++) scanf("%d", &c[i]);

    for (int i = 0; i < q; i++) {
        scanf("%d%d", &a[i].l, &a[i].r);
        a[i].l--;
        a[i].r--;
        a[i].id = i;
    }

    sort(a, a + q);

    int l = 0;
    int r = -1;
    res = 0;

    for (int i = 0; i < q; i++) {
        while (l < a[i].l) remove(l++);
        while (l > a[i].l) add(--l);
        while (r < a[i].r) add(++r);
        while (r > a[i].r) remove(r--);

        ans[a[i].id] = res;
    }

    for (int i = 0; i < q; i++) printf("%d\n", ans[i]);
}


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

// _________コーディングはここから！！___________

int n, m, k, i;
constexpr int N = 200010;
int a[N], b[N];
constexpr int sz = 5000000;
char reader[sz];
char *pos = reader;
int nn,now,ans;
int kk;
main() {
    reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
    while('0' <= *pos and *pos <= '9') n = n * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos and *pos <= '9') m = m * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos and *pos <= '9') k = k * 10 + *pos++ - '0';
    nn = n;
    pos++;
    rep(i, n) {
        while('0' <= *pos and *pos <= '9') a[i + 1] = a[i + 1] * 10 + *pos++ - '0';
        pos++;
        a[i + 1] += a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while('0' <= *pos and *pos <= '9') pos++;
                pos++;
            }
            break;
        }
    }
    while(*pos and *pos <= 32) pos++;
    rep(i, m) {
        while('0' <= *pos and *pos <= '9') b[i + 1] = b[i + 1] * 10 + *pos++ - '0';
        pos++;
        b[i + 1] += b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    now = ans = nn;
    for(i = 1; i <= m; i++) {
        kk = k - b[i];
        while(a[now] > kk) now--;
        ans = max(ans, i + now);
    }
    pos = reader;
    i = 0;
    do {
        *pos++ = ans % 10 + '0';
        ans /= 10;
        i++;
    } while(ans);
    reverse(reader, reader + i);
    fwrite(reader, sizeof(char), sizeof(char) * i, stdout);
}


Measured memory_bytes: 7908
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int a,b,k; cin>>a>>b>>k;
	for(int i=min(a,b); i>=0; i--){
		if(a%i==0 && b%i==0)k--;
		if(k==0){cout<<i<<endl; break;}
	}
}


Measured memory_bytes: 3596
s = input()
f0 = 0
for i in range(len(s)):
    if i % 2 == 0:
        f0 += (0 if s[i] == '0' else 1)
    else:
        f0 += (1 if s[i] == '0' else 0)

print(f0 if f0<=len(s)//2 else len(s)-f0)


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

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";


int main() {
    ll L,R;
    cin>>L>>R;
    ll p,q,l,r;
    ll a = 2019;
    p = L / a;
    q = R / a;
    l = L % a;
    r = R % a;
    if( p < q || l == 0 || r == 0){
        cout<<0<<endl;
        return 0;
    }
    ll mini = a;
    reps(i,l,r){
        reps(j,i+1,r+1){
            mini = min(mini, (i*j)%a);
        }
    }
    cout<<mini<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  long int arr[3],i,c=0,d=0;
  for(i=0;i<3;i++)
  {
    cin>>arr[i];
  }
  for(i=0;i<3;i++)
  {
    if(arr[i]==5)c++;
    else if(arr[i]==7)d++;
  }
  if(c==2 && d==1)
  {
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;

int main(void) {
    ll N; cin >> N;
    
    ll t,x,y;
    ll now_x = 0;
    ll now_y = 0;
    ll now_t = 0;
    ll cost = 0;
    ll point = 0;
    string ans = "No";
    for (int i = 0; i < N; i++) {
        cin >> t >> x >> y;
        cost = abs(now_x - x) + abs(now_y - y);
        point = t - now_t;
        if ((point - cost) >= 0 && (point - cost)%2 == 0) {
            ans = "Yes";
        }else{
            ans = "No";
            break;
        }
        now_x = x;
        now_y = y;
        now_t = t;
        
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3636
from collections import deque

def pr(A,n):
    for i in range(n):
        if i!=n-1:
            print(A[i],end=" ")
        else:
            print(A[i])

n=int(input())
que_r=deque()
data=deque()

for i in range(n):
    s=input()
    l=len(s)
    if s[0]=="i":
        que_r.appendleft(s[7:])
    elif s[6]==" ":
        try:
            que_r.remove(s[7:])
        except: pass
    elif l>10:
        que_r.popleft()
    elif l>6:
        que_r.pop()

pr(que_r,len(que_r))


Measured memory_bytes: 69664
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long K;
  scanf("%lld", &K);
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  if (B / K * K >= A)
    cout << "OK" << endl;
  else
    cout << "NG" << endl;

  return 0;
}


Measured memory_bytes: 3168
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
#include<string.h>
#include<sstream>
using namespace std;

class Card{
    public:
    int value;
    string mark;
    Card(){}
    Card(string info){
        mark=info.substr(0,1);
        stringstream ss;
        ss<<info.substr(1);
        ss>>value;
    }
    string Output(){
        stringstream ss;
        ss<<value;
        return mark+ss.str();
    }
    bool isEqual(Card opponent){
        if(value == opponent.value && mark == opponent.mark)return true;
        else return false;
    }
};

vector<Card> bubblesort(vector<Card> A,int N){
    bool flag=1;
    while(flag){
        flag=0;
        for(int i=N-1;i>0;--i){
            if(A[i].value<A[i-1].value){
                Card buf=A[i];
                A[i]=A[i-1];
                A[i-1]=buf;
                flag=1;
            }
        }
    }
    return A;
}

vector<Card> selectionSort(vector<Card> A,int N){
    int counter=0;
    for(int i=0;i<N;++i){
        int minj=i;
        for(int j=i;j<N;++j){
            if(A[j].value<A[minj].value){
                minj=j;
            }
        }
        if(i!=minj){
            Card buf=A[i];
            A[i]=A[minj];
            A[minj]=buf;
            counter++;
        }
    }
    return A;
}

void CardsOutput(vector<Card> card){
    for(int i=0;i<card.size();++i){
        if(i!=0)cout<<" ";
        cout<<card[i].Output();
    }
    cout<<endl;
}

bool isStable(vector<Card> in,vector<Card> out){
    for(int i=0;i<in.size();++i){
        for(int j=i+1;j<in.size();++j){
            for(int a=0;a<out.size();++a){
                for(int b=a+1;b<out.size();++b){
                    if(in[i].value == in[j].value && in[i].isEqual(out[b]) && in[j].isEqual(out[a])){
                        return false;
                    }
                }   
            }   
        }   
    }
    return true;
}

int N;
vector<Card> card;

int main(){
    cin>>N;
    card.reserve(N);
    for(int i=0;i<N;++i){
        string str;
        cin>>str;
        card.push_back(Card(str));
    }
    vector<Card> sortedCard;
    sortedCard.resize(N);
    sortedCard = bubblesort(card,N);
    CardsOutput(sortedCard);
    if(isStable(card,sortedCard))cout<<"Stable"<<endl;
    else cout<<"Not stable"<<endl;
    sortedCard = selectionSort(card,N);
    CardsOutput(sortedCard);
    if(isStable(card,sortedCard))cout<<"Stable"<<endl;
    else cout<<"Not stable"<<endl;
    return 0;
}



Measured memory_bytes: 3176
def g(a, b):
    if a%b == 0: return b
    return g(b, a%b)

def f(a, b, c, d):
    yes = "Yes"
    no  = "No"
    if a<b or d<b: return no
    if c>=b or a<=c: return yes
    if (a-c)%b>0 and (a-c)%b<b-c: return no
    e = d%b
    if e==0 or b-c==1: return yes
    if e==1: return no
    h = g(b, e)
    if h<b-c: return no
    if (a-c)%h>0 and (a-c)%h<b-c: return no
    return yes

t = int(input())
for i in range(t):
    a, b, c, d = map(int, input().split())
    ans = f(a, b, c, d)
    print(ans)


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

int main(){
	int ansary[101]{0};

	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		int Y, M, D;
		cin >> Y >> M >> D;

		int offset = (10 - M + 1) * 20 - (D - 1);
		if (Y % 3 != 0){
			offset -= (12 - M) / 2; //小の月の分を引く。 int/intだが問題ない
		}

		Y++;
		int uruutime = (1002 - Y) / 3;
		int ans = offset + 195 * (1000 - Y) + uruutime * 5;
		//ansary[i] = ans;
		cout << ans << endl;

	}

	//for (int i = 0; i < n; i++) cout << ansary[i] << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
//#pragma GCC optimize(2)

using namespace std;
#define LL long long
#define Rint register int
#define U unsigned
#define forn(i,a,b) for(int i = a;i <= b;++i)
#define nfor(i,a,b) for(int i = a;i >= b;--i)
#define pii pair<int ,int>
#define MS0(X) memset(X,0,sizeof(X))
#define MSf(X) memset(X,false,sizeof(X))
#define MS1(X) memset(X,-1,sizeof(X))
#define BR printf("--------------------\n")
#define pb push_back
#define rep(i,a,b) for(Rint i=a;i<=b;++i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const double PI=atan(1.)*4.;
const int maxn=1e6+5;
const LL inf = 1e14+5;
const int mod=1e9+7;
const double e=2.71828182845904523536;
int dirx[8]={1,0,-1,0,1,-1,-1,1};
int diry[8]={0,1,0,-1,1,1,-1,-1};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    LL n;
    cin>>n;
    LL ans=inf;
    for(LL i=1;i*i<=n;i++){
        if(n%i==0){
            ans=min(ans,i+n/i-2);
        }
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define vii vector<pair<int,int> >
#define vi vector<ll>
#define ll long long
#define rep(i,a,b) for(i=a;i<=b;i++)
#define inf 100000000000000000

using namespace std;

int h,w;
char c[1001][1001];
ll dp[1001][1001];

ll f(int i, int j)
{
    if(i==h && j==w) return 1;
    if(dp[i][j]!=-1) return dp[i][j];
    dp[i][j]=0;
    if(i+1<=h && c[i+1][j]!='#')
    {
        dp[i][j]=(dp[i][j]+f(i+1,j))%mod;
    }
    if(j+1<=w && c[i][j+1]!='#')
    {
        dp[i][j]=(dp[i][j]+f(i,j+1))%mod;
    }
    return dp[i][j];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>h>>w;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            cin>>c[i][j];
        }
    }
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            dp[i][j]=-1;
        }
    }
    f(1,1);
    cout<<dp[1][1]<<endl;
    return 0;
}

Measured memory_bytes: 9216
// choices and belief 

#include <bits/stdc++.h>
using namespace std;
const int N = 1234567;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef priority_queue<pii, vector<pii>, greater<pii>> min_pq;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define whatis(x) cout << #x << " is " << x << endl;
#define inf 1e18
int main()
{
	ios_base:: sync_with_stdio(false); cin.tie(0);
	// freopen ("inp","r",stdin);
	// freopen ("out","w",stdout);
	int n,m;
	cin>>n;
	int a[n];
	map<int,int>ma;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		ma[a[i]]++;
	}
	cin>>m;
	int val;
	for(int i=0;i<m;i++)
	{
		cin>>val;
		if(ma[val])
		{
			ma[val]--;
		}
		else
		{
			cout<<"NO\n";return 0;
		}
	}
	cout<<"YES\n";
	
	return 0;
}

Measured memory_bytes: 10368