akhauriyash/Code-Regression huggingface dataset:
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            string S = Console.ReadLine();

            var Sn = new String[S.Length];

            int H = 0;
            for(int i = 0;i < S.Length;i++)
            {
                Sn[i] = S.Substring(i,1);
                if(Sn[i] == "x")
                {
                    H++;
                }
            }
            if(H > 7)
            {
                Console.WriteLine("NO");
            }
            else
            {
                Console.WriteLine("YES");
            }


        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int i;
    string s;
    cin>>s;
    int f=0,cnt=0;
    for (i=0;i<s.size();i++)
    {
        if (i==0)
        {
            if (s[i]!='A')
            {
                f=1;
                break;
            }
        }
        else if (i>=2 && i<s.size()-1)
        {
            if (s[i]=='C')
                cnt++;
            else if (s[i]>=97 && s[i]<=122)
                continue;
            else
            {
                f=1;
                break;
            }
        }
        else if (s[i]>=97 && s[i]<=122)
            continue;
        else
        {
            f=1;
            break;
        }
    }
    if (!f && cnt==1)
        cout<<"AC\n";
    else
        cout<<"WA\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int modulo(int x,int N){
    return (x % N + N) %N;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x,y;
    cin>>x>>y;
    int ans = max(x,y);
    if(max(x,y)==x) x--;
    else y--;
    ans+= max(x,y);
    cout<<ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define INF      (int)1e9
#define MOD      (int)1e9+7
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;

int main(){
	int n,k;
	cin>>n>>k;
	
	map<int,int> mp;
	REP(i,n){
		int n;
		cin>>n;
		mp[n]++;
	}
	
	vi cnt;
	for(const auto &elem:mp){
		//cout<<elem.second<<endl;//!!!
		cnt.push_back(elem.second);
	}
	sort(ALL(cnt));
	//REP(i,cnt.size()) cout<<cnt[i]<<endl;//!!!
	
	if(cnt.size()<=k){
		cout<<0<<endl;
		return 0;
	}
	
	llong ans=0;
	REP(i,cnt.size()-k){
		ans+=cnt[i];
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 10748
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int N = 200010;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(auto &t:a)cin>>t;return i;}
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T> void prArr(T a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

class BIT{
public:
  typedef long long ll;
  ll n;
  vector<ll> bit0, bit1;
  BIT(){n=-1;}
  BIT(ll n_){
    n=1;
    while(n<n_)n*=2;
    bit0.resize(n+1,0);
    bit1.resize(n+1,0);
  }
  
  ll sum(vector<ll> &b,ll i){
    ll s=0;
    while(i>0){
      s=(s+b[i]);
      i-=i&-i;
    }
    return s;
  }

  void add(vector<ll> &b,ll i,ll v){
    while(i<=n){
      b[i]=(b[i]+v);
      i+=i&-i;
    }
  }

  //[a,b]にxを加算(1<=a)
  void add (ll a,ll b,ll x){
    assert(a > 0 && n >= 0);

    add(bit0,a,-x*(a-1));
    add(bit1,a,x);
    add(bit0,b+1,x*b);
    add(bit1,b+1,-x);
  }

  //[a,b]のsumを得る(1<=a)
  ll sum(ll a,ll b){
    assert(a > 0 && n >= 0);
    ll res=0;
    res+=sum(bit0,b)+sum(bit1,b)*b;
    res-=sum(bit0,a-1)+sum(bit1,a-1)*(a-1);
    return res;
  }
};
BIT bit;

int n;
vector<int> A;
vector<char> op;
int f[2] = {1,-1};

int used[N][3],mem[N][3];

int dfs(int idx,int cnt){
  if(cnt == 2) return bit.sum(idx+1,n);
  if(idx == n) return 0;
  if(used[idx][cnt]++) return mem[idx][cnt];
  
  char ch = op[idx-1];
  cnt += ch == '-';
  int res = 0;
  int val = f[cnt%2] * A[idx];
  if(cnt) Max(res,val + dfs(idx+1,cnt-1));
  Max(res,val + dfs(idx+1,cnt));
  return mem[idx][cnt] = res;
}


signed main(){
  cin>>n;
  A.resize(n);
  op.resize(n);
  for(int i=0;i<n;i++) {
    cin>>A[i];
    if(i!=n-1) cin>>op[i];
  }
  bit = BIT(n);
  for(int i=0;i<n;i++) bit.add(i+1,i+1,A[i]);
  cout<<A[0] + dfs(1,0)<<endl;
  return 0;
}


Measured memory_bytes: 17664
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう

#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
  int a,b;
  cin>>a>>b;
  int n=1;
  int cnt=0;
  while(b>n){
    cnt++;
    n+=a-1;
  }
  cout<<cnt;
}

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

const int MAX_N=1010101;
ll inv[MAX_N+1], fact[MAX_N+1], ifact[MAX_N+1];

ll comb(int n, int k){
  if(n<k) return 0;
  return fact[n]*ifact[k]%MOD*ifact[n-k]%MOD;
}

void prepare(){
  inv[1]=fact[0]=fact[1]=ifact[0]=ifact[1]=1LL;
  for(int i=2;i<=MAX_N;i++){
    inv[i]=inv[MOD%i]*(MOD-MOD/i)%MOD;
    fact[i]=fact[i-1]*i%MOD;
    ifact[i]=ifact[i-1]*inv[i]%MOD;
  }
}

ll p2[2020];

int main(){
  prepare();
  p2[0]=1;
  rep(i,2010) p2[i+1]=p2[i]*2%MOD;
  int K,N; cin>>K>>N;
  for(int i=2;i<=2*K;i++){
    ll ans=0;
    int p=0;
    for(int j=1;j<=K;j++) if(j<i-j&&i-j<=K) p++;
    int n=K-2*p-(i%2==0?1:0);
    for(int j=0;j<=min(N,p);j++){
      int r=N-j,nn=n+j;
      (ans+=comb(nn+r-1,r)*comb(p,j)%MOD*p2[j])%=MOD;
    }
    if(i%2==0){
      for(int j=0;j<=min(N-1,p);j++){
        int r=N-1-j,nn=n+j;
        (ans+=comb(nn+r-1,r)*comb(p,j)%MOD*p2[j])%=MOD;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}


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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DMP(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%" SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

const int mod=1000000007;
template<class T,class U>
void add(T& a,U b){
	a=((ll)a+b)%mod;
}

template<class T,class U>
void sub(T& a,U b){
	a=((ll)a-b%mod+mod)%mod;
}

template<class T,class U>
void mult(T& a,U b){
	a=((ll)a*b)%mod;
}

ll modPow(ll a,ll p){
	ll s=1;
	REP(i,30){
		if((p>>i)&1)
			mult(s,a);
		mult(a,a);
	}
	return s;
}

ll modInv(ll a){
	return modPow(a,mod-2);
}

const int Nmax=314514;

struct Node{
	Node*ch[2];
	Node(){
		ch[0]=ch[1]=0;
	}
} buf[Nmax];
Node* newNode(){
	static int cnt=0;
	return buf+cnt++;
}

void con(Node*v,int d,const string&s){
	if(d==int(s.size()))return;
	int k=s[d]-'0';
	if(v->ch[k]==0)
		v->ch[k]=newNode();
	con(v->ch[k],d+1,s);
}

int grundy(int x){
	if(x==0)return 0;
	REP(i,60)
		if((x>>i)&1)return 1LL<<i;
	assert(false);
}

void calc(Node*v,int d,int&x,int l){
	if(v){
		if(v->ch[0]==0&&v->ch[1]==0)return;
		REP(k,2)
			calc(v->ch[k],d+1,x,l);
	}else{
		x^=grundy(l-d+1);
	}
}

signed main(){
	int n=read(),l=read();
	Node* root=newNode();
	REP(i,n)
		con(root,0,readString());
	int x=0;
	calc(root,0,x,l);
	if(x)
		cout<<"Alice"<<endl;
	else
		cout<<"Bob"<<endl;
}

Measured memory_bytes: 12928
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
struct edge{int to,cap,rev;};//ikisaki youryou gyakuhen
class MF{//max flow
	public:
	int n;
	vector<vector<edge> >G;//[MAX];
	vector<bool>used;//[MAX];
	MF(int size){
		n=size;
		G=vector<vector<edge> >(n);
	}
	void add_edge(int from, int to, int cap){
		edge q={to,cap,int(G[to].size())};
		G[from].push_back(q);
		q={from,0,int(G[from].size()-1)};
		G[to].push_back(q);
	}
	int dfs(int v,int t, int f) {
		if(v==t)return f;
		used[v]=1;
		for(int i=0;i<G[v].size();i++){
			edge &e=G[v][i];
			if(used[e.to]||e.cap<=0) continue;
			int d =dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
		return 0;
	}
	int ford_fulkerson(int s,int t) {//from s to t
		int flow=0,f;
		while(1){
			used=vector<bool>(n,false);
			f=dfs(s,t,inf);
			if(f==0)return flow;
			flow+=f;
		}
	}
};
int main(){
	int n,m,q;
	cin>>n>>m>>q;
	MF mf(n+m+2);
	int s=n+m,t=s+1;
	while(q--){
		int a,b;
		cin>>a>>b;
		mf.add_edge(a,n+b,1);
	}
	rep(i,n)mf.add_edge(s,i,1);
	rep(i,m)mf.add_edge(n+i,t,1);
	cout<<mf.ford_fulkerson(s,t)<<endl;
}

Measured memory_bytes: 1532
#include <vector>
#include <iostream>
using namespace std;
int n, q, com, x, y; int group[10000]; vector<int> f[10000];
int main() {
	scanf("%d%d", &n, &q);
	for(int i = 0; i < n; i++) group[i] = i, f[i].push_back(i);
	for(int i = 0; i < q; i++) {
		scanf("%d%d%d", &com, &x, &y);
		if(com == 0) {
			if(group[x] == group[y]) continue;
			x = group[x], y = group[y];
			if(f[y].size() > f[x].size()) swap(x, y);
			for(int j = f[y].size() - 1; j >= 0; j--) {
				group[f[y][j]] = group[x];
				f[x].push_back(f[y][j]);
				f[y].pop_back();
			}
		}
		else printf("%d\n", (group[x] == group[y] ? 1 : 0));
	}
	return 0;
}

Measured memory_bytes: 3980
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<vector>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define LL long long int
#define REP(i,n) for (int i = 1; i <= (n); i++)
#define Redge(u) for (int k = h[u],to; k; k = ed[k].nxt)
#define cls(s,v) memset(s,v,sizeof(s))
#define mp(a,b) make_pair<int,int>(a,b)
#define cp pair<int,int>
using namespace std;
const int maxn = 85,maxm = 100005,INF = 0x3f3f3f3f;
inline int read(){
	int out = 0,flag = 1; char c = getchar();
	while (c < 48 || c > 57){if (c == '-') flag = 0; c = getchar();}
	while (c >= 48 && c <= 57){out = (out << 1) + (out << 3) + c - 48; c = getchar();}
	return flag ? out : -out;
}
int n,A[maxn];
LL f[maxn][maxn],g[maxn];
int main(){
	n = read();
	REP(i,n) A[i] = read();
	for (int i = 0; i <= n; i++) g[i] = 1000;
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= i - 1; j++){
			f[i][j] = g[j - 1] / A[j] * A[i] + g[j - 1] - g[j - 1] / A[j] * A[j];
			for (int k = i; k <= n; k++) g[k] = max(g[k],f[i][j]);
		}
	}
	printf("%lld\n",g[n]);
	return 0;
}

Measured memory_bytes: 3744
/*input
999999
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)

#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

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

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int raise(int a,int n,int m = MOD){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= raise(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}

int ceil1(int n,int k){
    return floor1(n+k-1,k);
}

void solve(){
    int n;cin >> n;
    int ans = 0;
    for(int i = 1;i <= n;i++){
      int j = n-i;
      if(i >= j)break;
      ans++;
    }
    cout << ans;
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter

val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (a, b, c) = listOfInt()
    println((b / a).let { if (it > c) c else it } )
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt()= listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 37560
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n, m;
    cin >> n >> m;
    vs32 a(n);
    int sum = 0;
    rep (i, n)
    {
        cin >> a[i];
        sum += a[i];
    }
    sort(a.begin(), a.end(), greater<int>());

    cout << (a[m - 1] * 4 * m >= sum ? "Yes\n" : "No\n");
    return 0;
}



Measured memory_bytes: 256
import sys

from collections import deque
# q = deque(); q.append(x); q.appendleft(x); q.pop() -> x; q.popleft() -> x
from collections import defaultdict
# d = defaultdict(lambda: []); d[key] -> []
import heapq
# hq = []; heapq.heappush(hq, x); heapq.heappop(hq) -> x; heapq.heappushpop(hq, x) -> x
import bisect
# i = bisect.bisect_left([1,2,3,4], 1.5); i = bisect.bisect_right([4,3,2,1], 1.5)

#import numpy as np
#from scipy.misc import comb

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

"""
マスは1つの色を持つ -> c[i][j]
マスは3グループのいずれかに属する -> (i+j)%3
グループは1つの色 gc を持つ、ただし他のグループと同じ色を持てない gc1 != gc2 != gc3
マス違和感 = D[マスの色][グループの色]
グループ違和感 = グループ内のマスの、マス違和感の合計 = DG[グループ色]
全体違和感 = 3グループの、グループ違和感の合計
答え = 全体違和感
"""
def main():
    N, C = i2nn()
    D = ii2nnn(C)
    c = ii2nnn(N)
    iwakanG = [[0] * C for _ in range(3)]  # グループ違和感[グループID][グループ色] = グループID/色ごとのマス違和感の計
    for i in range(N):
        for j in range(N):
            groupID = (i + j) % 3  # グループID
            cM = c[i][j] - 1  # マス色
            for cG in range(C):
                iwakanM = D[cM][cG]   # マス違和感
                iwakanG[groupID][cG] += iwakanM  # グループ違和感にマス違和感を加算
    iwakan = 1e+9
    for gc1 in range(C):
        for gc2 in range(C):
            for gc3 in range(C):
                if gc1 == gc2 or gc2 == gc3 or gc3 == gc1:
                    continue
                n = iwakanG[0][gc1] + iwakanG[1][gc2] + iwakanG[2][gc3]
                if iwakan > n:
                    iwakan = n  # 全体違和感の最小化
    print(iwakan)

main()


Measured memory_bytes: 47324
#include <iostream>

using namespace std;

typedef long long ll;

const int MOD = 998244353; // change if needed

struct Modint {
  ll val;
  
  Modint (ll _val = 0)
    : val(_val % MOD) {}

  Modint operator+ (Modint other) const {
    return Modint(val + other.val);
  }

  void operator+= (Modint other) {
    val += other.val;
    val %= MOD;
  }

  Modint operator- () const {
    return Modint(MOD - val);
  }

  Modint operator- (Modint other) const {
    return Modint(val + MOD - other.val);
  }

  void operator-= (Modint other) {
    val += MOD - other.val;
    val %= MOD;
  }

  Modint operator* (Modint other) const {
    return Modint(val * other.val);
  }

  void operator*= (Modint other) {
    val *= other.val;
    val %= MOD;
  }

  bool operator== (Modint other) const {
    return val == other.val;
  }

  bool operator!= (Modint other) const {
    return val != other.val;
  }
};

Modint exp (Modint a, int k) {
  if (k == 0) {
    return Modint(1);
  } else if (k % 2 == 0) {
    Modint half = exp(a, k / 2);
    return half * half;
  } else {
    return a * exp(a, k - 1);
  }
}

Modint inv (Modint a) {
  return exp(a, MOD - 2);
}

ostream& operator<< (ostream& out, Modint p) {
  out << p.val;
  return out;
}

const int MAX_N = 1e4 + 5;

Modint fact [MAX_N];
Modint ifact [MAX_N];

Modint choose (int n, int r) {
  return fact[n] * ifact[r] * ifact[n - r];
}

Modint seqc [MAX_N]; // # of sequences length N with _exactly_ K diff values
Modint curc [MAX_N];

int main () {
  fact[0] = Modint(1);
  for (int i = 1; i < MAX_N; i++) {
    fact[i] = fact[i - 1] * Modint(i);
  }

  for (int i = 0; i < MAX_N; i++) {
    ifact[i] = inv(fact[i]);
  }

  ios::sync_with_stdio(false);

  string s, t;
  cin >> s >> t;
  int n = s.size();
  
  int K = 0; // # of 1s that exist only in s
  int B = 0; // # of 1s that exist both in s and t
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') {
      if (t[i] == '1') B++;
      else K++;
    }
  }

  /*
  int K, B;
  cin >> K >> B;
  */

  if (K == 0) {
    cout << fact[B] * fact[B] << endl;
    exit(0);
  }
  
  // cerr << K << " " << B << endl;
  
  for (int i = 1; i <= K; i++) {
    curc[i] = exp(Modint(i), K) * choose(K, i);
    if (i % 2 != K % 2) {
      curc[i] = -curc[i];
    }
  }

  for (int i = K; i < MAX_N; i++) {
    if (i != K) {
      for (int j = 1; j <= K; j++) {
        curc[j] *= Modint(j);
      }
    }

    for (int j = 1; j <= K; j++) {
      seqc[i] += curc[j];
    }
  }

  Modint ans (0);
  for (int i = K; i <= K + B; i++) {
    // split type B in two groups
    Modint cur = choose(B, i - K);

    // # of orderings in the left half
    cur *= fact[i - K];

    // # of orderings in the right half
    cur *= fact[B - (i - K)] * fact[B - (i - K)];

    // # of splittings
    cur *= seqc[i];

    // interleaving
    cur *= choose(K + B, i);
    
    ans += cur;
    // cerr << i << " " << cur << endl;
  }

  // orderings + pairings of colors
  ans *= fact[K];

  cout << ans << endl;
}


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

ll mod = 1e9 + 7;

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

    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    // 中
    ll ans = 0;
    rep(i, N) rep(j, N) {
        if (i < j and A[i] > A[j]) ans++;
    }
    ans *= K;
    ans %= mod;

    // 外
    ll k = K * (K-1) / 2;
    k %= mod;
    rep(i, N) {
        ll tmp = 0;
        rep(j, N) {
            if (A[i] > A[j]) tmp++;
        }

        ans += (tmp * k) % mod;
        ans %= mod;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int M, N, sum, max;
    cin >> N;
    vector<string> va(N);
    for(int i = 0; i < N; i++){
        cin >> va[i];
    }
    cin >> M;
    vector<string> vb(M);
    for(int i = 0; i < M; i++){
        cin >> vb[i];
    }
    max = 0;
    for(int i = 0; i < N; i++){
        sum = 1;
        for(int j = 0; j < i; j++){
            if(va[i] == va[j]){
                sum++;
            }
        }
        for(int j = i + 1; j < N; j++){
            if(va[i] == va[j]){
                sum++;
            }
        }
        for(int j = 0; j < M; j++){
            if(va[i] == vb[j]){
                sum--;
            }
        }
        if(max < sum){
            max = sum;
        }
    }
    cout << max << endl;
}

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

int main() {
	ll k, n;
	ll longest = 0;
	cin >> k >> n;
	ll mem, memb,mem1;
	cin >> mem;
	mem1 = mem;
	for (int i = 0; i < n - 1; i++) {
		memb = mem;
		cin >> mem;
		longest = max(mem - memb, longest);
	}
	longest = max(mem1 + k - mem, longest);
	cout << k - longest << endl;
}

Measured memory_bytes: 384
import numpy as np

n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))

left, right = 0, np.max(a)
while right - left > 1:
    mid = left + (right - left) // 2
    if np.sum(np.ceil(a/mid)-1) <= k:
        right = mid
    else:
        left = mid
print(right)


Measured memory_bytes: 49676
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    w,a,b=INTM()
    if a>=b+w:
        ans=a-(b+w)
    elif b>=a+w:
        ans=b-(a+w)
    else:
        ans=0
        
    print(ans)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
N = int(input())
score = []

for i in range(N):
    a, b = map(int, input().split())
    score.append([a,b])

score.sort(key = lambda x:x[0])

ans = score[0][0]

for i in range(1,N):
    ans += score[i][0] - score[i-1][0]
    
if score[-1][1] != 0:
    ans += score[-1][1]

print(ans)

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

int const N = 100000, M = 200000, md = 1e9 + 7;
pair<int, int> in[M];
vector<pair<int, int> > g[N + 1];
int n, m, st, ed, w[M], dp[2][N + 1];
bool good[M], visfg[N + 1];
ll vis[N + 1];

inline void ad(int &x, int y) { if ((x += y) >= md)x -= md; }
inline void sb(int &x, int y) { if ((x -= y) <  0 )x += md; }

int I;
void pl(int st, int ed){
	priority_queue<pair<ll, pair<int, int> > > q;
	q.push(make_pair(0ll, make_pair(st, 0)));
	dp[I][0] = 1;
	while (!q.empty()){
		ll d = -q.top().first;
		int v = q.top().second.first, u = q.top().second.second;
		q.pop();
		if (vis[v] < d)continue;
		if (vis[v] == d) { ad(dp[I][v], dp[I][u]); continue; }
		vis[v] = d;
		dp[I][v] = dp[I][u];
		f(i, 0, g[v].size()){
			u = g[v][i].first;
			int id = g[v][i].second;
			ll nd = d + w[id];
			if (nd <= vis[u]){
				q.push(make_pair(-nd, make_pair(u, v)));
				in[id] = make_pair(v, u);
			}
		}
	}
}

void fg(int v = ed){
	if (visfg[v])return;
	visfg[v] = true;
	f(i, 0, g[v].size()){
		int u = g[v][i].first, id = g[v][i].second;
		if (vis[u] + w[id] != vis[v])continue;
		good[id] = true;
		fg(u);
	}
}

int main(){
	scanf("%d%d%d%d", &n, &m, &st, &ed);
	f(i, 0, m){
		int a, b;
		scanf("%d%d%d", &a, &b, w + i);
		w[i] <<= 1;
		g[a].push_back(make_pair(b, i));
		g[b].push_back(make_pair(a, i));
	}
	f(i, 1, n + 1)vis[i] = 1e18;
	I = 1;
	pl(ed, st);
	f(i, 1, n + 1)vis[i] = 1e18;
	I = 0;
	pl(st, ed);
	fg();
	int an = (ll)dp[0][ed] * dp[0][ed] % md;
	set<int> bad;
	ll mdd = vis[ed] >> 1;
	f(i, 0, m)if (good[i]){
		if (vis[in[i].first] == mdd)bad.insert(in[i].first);
		else if (vis[in[i].second] == mdd)bad.insert(in[i].second);
		else if (mdd > vis[in[i].first] && mdd < vis[in[i].second])sb(an, (ll)dp[0][in[i].first] * dp[1][in[i].second] % md * dp[0][in[i].first] % md * dp[1][in[i].second] % md);
	}
	for (set<int>::iterator it = bad.begin(); it != bad.end(); ++it)sb(an, (ll)dp[0][*it] * dp[1][*it] % md * dp[0][*it] % md * dp[1][*it] % md);
	printf("%d\n", an);
}

Measured memory_bytes: 17856
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

tmp = a[0]//2
s = 10**18
num = 0
for i in range(1, n):
    if(abs(tmp-a[i]) < s):
        s = abs(tmp-a[i])
        num = a[i]

print(a[0], num)

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

int main() {
	int P; int Q; int R;
	cin >> P >> Q >> R;
	vector<int> time(3);
	time[0] = P + Q;
	time[1] = P + R;
	time[2] = Q + R;
	sort(time.begin(), time.end());
	cout << time[0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int DPB,DPG,PG;
  cin >> DPB >> DPG >> PG;
  int ans = 0;
  if ( DPB + DPG >= PG-1 ) {
    ans += PG;
    ans += DPG;
  }
  else {
    ans += DPG;
    ans += DPG;
    ans += DPB;
    ans += 1;
  }
  cout << ans << endl;
}
    

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl


int main(){
    string s;
    cin>>s;
    int p=0,score=0;
    REPARR(i,s){
        if(s[i]=='g'){
            if(p){
                --p;
                ++score;
            }else{
                ++p;
            }
        }else{
            if(p){
                --p;
            }else{
                ++p;
                --score;
            }
        }
    }
    cout<<score<<endl;
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
typedef pair<int, int> P_i;
typedef pair<double,double> P_d;
#define rep(i,n) for(int i=0;i<(n);++i)
#define alrep(i,j,n) for(int i=0;i<(n);++i)for(int j=i+1;j<(n);++j)
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;int ans=0;
#define answer cout << ans << endl;
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 MOD=1e9+7;
const long long INF = 1LL << 60;

signed main(){
  string X,Y; cin >> X >> Y;
  vector<vector<int>> dp(3010,vector<int>(3010,0));
  rep(i,X.size())rep(j,Y.size()){
    if(X[i]==Y[j]){
      dp[i+1][j+1]=max({dp[i][j]+1,dp[i+1][j],dp[i][j+1]});
    }
    else{
      dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
    }
  }
  string res="";
  int i=X.size(),j=Y.size();
  while(i>0 && j>0){
    if(dp[i][j]==dp[i-1][j]) i--;
    else if(dp[i][j]==dp[i][j-1]) j--;
    else{
      res=X[i-1]+res;
      i--;j--;
    }
  }


  cout << res << endl;

  return 0;
}


Measured memory_bytes: 71168
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef vector<ll> vll;

const ll INF = 100000000000;

int main() {FIN

	ll n, k, i, j;
	cin >> n >> k;
	vll hs(n), dp(n, INF);
	
	for (i = 0; i < n; i++)
		cin >> hs[i];

	dp[0] = 0;
	for (i = 0; i < n; i++) {
		for (j = 1; j <= k; j++) {
			if (j <= i)
				dp[i] = min(dp[i], dp[i - j] + abs(hs[i] - hs[i - j]));
			else
				break;
		}
	}

	cout << dp[n - 1] << "\n";

	return 0;
}

Measured memory_bytes: 4768
h,w=map(int,input().split())
canvas=['.'+input()+'.'  for i in range(h)]
canvas.append('#'*(w+2))
canvas.insert(0,'#'*(w+2))

for i in range(1,h+1):
    for j in range(1,w+1):
        if canvas[i][j]=='#':
            if canvas[i-1][j]=='.' and canvas[i][j-1]=='.' and canvas[i+1][j]=='.' and canvas[i][j+1]=='.':
                print('No')
                exit()
print('Yes')

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

#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define ll long long
#define pb push_back
#define zoom                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define pl pair<ll, ll>
#define MOD 1000000007
#define endl "\n"
#define ff first
#define ss second
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define trace3(x, y, z) cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl
#define trace4(a, b, c, d) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl
#define trace(v)                                   \
    for (auto it = v.begin(); it != v.end(); it++) \
        cerr << *it << " ";                        \
    cerr << endl;
#define tr(container, it) \
    for (typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<vi> vvi;

void solve()
{
    int n;
    cin>>n;

    vi v(n);
    vi ans(n);

    forn(i,n){
        cin>>v[i];
    }  

    int temp=0;
    int idx=n-1;

    int cnt=0;
    bool is=true;
    int prev=0,curr=n-1;
    forn(i,n-1){
        temp^=v[i];
    }
    cnt++;
    ans[idx]=temp;
    idx=0;
    forn(i,n-1){
        temp^=v[prev];
        temp^=v[curr];
        prev++;
        curr++;
        if(curr==n){
            curr=0;
        }
        
        ans[idx]=temp;
        idx++;
    }

    for(auto i:ans){
        cout<<i<<" ";
    }

    cout<<endl;
}

int main()
{
    zoom;
    ll t=1;
    //cin >> t;

    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 4768
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000000

int main() {
    int N, K, score, key; cin >> N >> K;
    double prob = 0;
    for (int i = 1; i <= N; i++) {
        if (i < K) {
            score = i;
            for (int j = 1; score < K; j++) {
                score *= 2;
                key = j;
            }
            prob += 1.0 / N / pow(2, key);
        } else {
            prob += 1.0 / N;
        }
    }
    printf("%.15lf\n", prob);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
   int n, m, a, b;
   cin >> n >> m;
   
   vector<int> x(n, 0);
   
   for(int i = 0; i < m*2; ++i){
       cin >> a;
       ++x.at(a-1);
   }
   
   for(int i = 0; i < n; ++i){
       cout << x.at(i) << endl;
   }
}


Measured memory_bytes: 3616
#!/user/bin/env pypy3
import sys
from typing import List


def fast_input():
    return sys.stdin.readline()[:-1]


def print_format(b: bool) -> str:
    return "YES" if b else "NO"


def solve(s: str, tokens: List[str], dp_max: int) -> bool:
    dp = [False] * dp_max
    dp[0] = True

    for s_ind in range(len(s)):
        if not dp[s_ind]:
            continue
        for token in tokens:
            if s[s_ind:s_ind + len(token)] == token:
                dp[s_ind + len(token)] = True
    return dp[len(s)]


def main():
    tokens = ["dream", "erase", "eraser", "dreamer"]
    s = fast_input()
    result = solve(s=s, tokens=tokens, dp_max=len(s) + 6)
    print(print_format(result))


main()


Measured memory_bytes: 10768
#include<cstdio>
#include<cstdlib>
#define llong long long
#define ldouble long double
#define uint unsigned int
#define ullong unsigned long long
#define udouble unsigned double
#define uldouble unsigned long double
#define modinc(x) {if(x>=P) x-=P;}
#define pii pair<int,int>
#define piii pair<pair<int,int>,int>
#define piiii pair<pair<int,int>,pair<int,int> >
#define pli pair<llong,int>
#define pll pair<llong,llong>
using namespace std;

const int N = 1e3;
struct Point
{
	llong x,y;
} a[N+3];
llong ans[N+3];
int n,m;

llong absl(llong x) {return x>=0 ? x : -x;}
llong dist(llong x,llong y) {return absl(x)+absl(y);}

void dfs(llong x,llong y,int dep)
{
//	printf("dfs%lld %lld %d\n",x,y,dep);
	if(dep==-1) return;
	llong lmt = (1ll<<dep)-1,dlt = (1ll<<dep);
	if(dist(x+dlt,y)<=lmt)
	{
		dfs(x+dlt,y,dep-1); printf("L");
	}
	else if(dist(x-dlt,y)<=lmt)
	{
		dfs(x-dlt,y,dep-1); printf("R");
	}
	else if(dist(x,y+dlt)<=lmt)
	{
		dfs(x,y+dlt,dep-1); printf("D");
	}
	else if(dist(x,y-dlt)<=lmt)
	{
		dfs(x,y-dlt,dep-1); printf("U");
	}
}

int main()
{
	scanf("%d",&n);
	for(int i=1; i<=n; i++) scanf("%lld%lld",&a[i].x,&a[i].y);
	int tmp = (a[1].x+a[1].y)&1;
	for(int i=2; i<=n; i++)
	{
		if(((a[i].x+a[i].y)&1)!=tmp)
		{
			printf("-1\n");
			return 0;
		}
	}
	if(!(tmp&1)) {for(int i=1; i<=n; i++) a[i].y--; ans[1] = 1ll; printf("32\n1 ");}
	else printf("31\n");
	for(int i=0; i<=30; i++) printf("%lld ",(1ll<<i)); puts("");
	for(int i=1; i<=n; i++)
	{
		if(!(tmp&1)) {printf("U");}
		dfs(a[i].x,a[i].y,30); puts("");
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int max(int a,int b){
    if(a<b){
        return b;
    }
    else{
        return a;
    }
}


int main(void){
    int x,i,prev,ans,val;
    scanf("%d",&x);
    ans = 1;
    prev = 1;
    for(i=2;i<x;i++){
        val = i;
        while(i){
            val = val*i;
            if(val>x){
                break;
            }
            else{
                ans = max(val,prev);
                prev = ans;
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

int main(void) {
	size_t N;

	double sum = 0;

	scanf("%zu\n", &N);
	for (size_t i = 0; i < N; i++) {
		double x;
		char u[4];
		scanf("%lf %s", &x, u);
		if (i < N - 1) {
			scanf("\n");
		}

		if (u[0] == 'J') {
			sum += x;
		}
		else {
			sum += x * 380000;
		}
	}

	printf("%lf\n", sum);

	return 0;
}


Measured memory_bytes: 128
program Project1;
             
{$APPTYPE CONSOLE}
         
uses
  SysUtils,math;
var
  g,r,a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,t,z:Integer;
  //l:array of Integer;
  l,l1,l2:int64;
  s,s123,s1,s2,s3:string;
  tf:Boolean;
  //nyu:TStringList;
  xc,yc,space:char;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Readln(n);
    l2:=2;
    l1:=1;

    if n=0 then
      Writeln('2')
    else if n=1 then
      Writeln('1')
    else begin
      for i := 3 to n+1 do begin
        l:=l1+l2; 
        l2:=l1;
        l1:=l;
      end;
      Writeln(l);
    end;

    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair

#define ll long long
#define sc(n) int n; scanf("%d",&n);
#define mod 10000007
#define N 100001
#define MX 1000000001
#define log(n) (int)log2(n)
#define logg(a)(b) log(b)/log(a)
#define pb(x) push_back(x);
#define T int t, q=0; scanf("%d", &t); while(q++<t)
#define pi acos(-1)
#define flag bool fl=true;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
int main()
{
    int k,a,b;
    cin>>k>>a>>b;
    for(int i=a; i<=b; i++)
    {
        if(i%k==0)
        {
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define int long long 
using namespace std;
main()
{
    int n, m; cin >> n >> m;
    int ara[m], sum = 0;
    for(int i = 0; i < m; i++) 
    {
        cin >> ara[i];
        sum += ara[i];
    }
    if(sum > n) cout << -1 << endl;
    else cout << n - sum << endl;
}



Measured memory_bytes: 3672
#include <stdio.h>
int main(void)
{
    int x, y;
    int i, st, large, small;

    for(i = 1; i <= 3000; i++){
        scanf("%d", &x); scanf("%d", &y);
        small = x;
            large = y;
            if(y < small){
                small = y;
                large = x;
            }
        if(x == 0 && y == 0) break;
        else printf("%d %d\n", small, large);
    }
    return 0;
}


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

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> A(n, vector<int>(m));
    vector<int> b(m);
    int c;

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> A.at(i).at(j);
        }
    }
    for (int i = 0; i < m; i++)
    {
        cin >> b.at(i);
    }
    
    
    for (int i = 0; i < n; i++)
    {
        c=0;
        for (int j = 0; j < m; j++)
        {
            c += A.at(i).at(j) * b.at(j);
        }
        cout << c << endl;
    }
    
}


Measured memory_bytes: 3204
#include<iostream>
using namespace std;
main(){int c[9];for(int i=0;i<9;i++)cin>>c[i];cout<<(((c[0]+c[4]-c[1]-c[3])|(c[0]+c[5]-c[2]-c[3])|(c[0]+c[7]-c[1]-c[6])|(c[0]+c[8]-c[2]-c[6]))?"No":"Yes")<<endl;}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    string s;cin>>s;
    if(s[1]=='B') cout<<"ARC\n";
    else cout<<"ABC\n";
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    solve();
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
using namespace std;
struct edge{int to,cost;};
vector<edge> G[100010];
int d[100010];
void dfs(int s,int p,int c){
	for(auto v:G[s]){
		if(v.to==p) continue;
		if(v.cost&1){
			d[v.to] = 1 - c;
			dfs(v.to,s,1 - c);
		}else{
			d[v.to] = c;
			dfs(v.to,s,c);
		}
	}
}
int main(){
	int i,n;
	cin >> n;
	for(i=0;i<n-1;i++){
		int a,b,c;
		cin >> a >> b >> c;
		a--; b--;
		G[a].push_back({b,c});
		G[b].push_back({a,c});
	}
	d[0] = 0;
	dfs(0,-1,0);
	for(i=0;i<n;i++){
		cout << d[i] << endl;
	}
}
	

Measured memory_bytes: 9088
# -*- coding: utf-8 -*-
n, x, y = map(int, input().split())
count = [0]*(n-1)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        dist = min(j-i, abs(x-i) + 1 + abs(y-j))
        count[dist-1] += 1

for ci in count:
    print(ci)


Measured memory_bytes: 46684
#include<bits/stdc++.h>
using namespace std;
int main(){
//	freopen("fuck.in","r",stdin);
//	freopen("fuck.out","w",stdout);
	int A,B,C,X,Y;
	cin>>A>>B>>C>>X>>Y;
	int ans=0;
	if(X<Y)swap(A,B),swap(X,Y);
	ans=min(A*Y+B*Y,C*2*Y);
	ans+=min(C*2*(X-Y),A*(X-Y));
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

typedef struct{
    char symbol;
    int number;
} TRUMP;

void bubble_sort(TRUMP *x, int n){
    bool swap_flag = true;
    for(int j=0 ; swap_flag ; j++){
        swap_flag = false;
        for(int i=n-1 ; i>j ; i--){
            if(x[i-1].number > x[i].number){
                swap(x[i-1], x[i]);
                swap_flag = true;
            }
        }
    }
}

// begin??¨end?????????a?????????b??????????????????????????????
bool search_number(TRUMP *x, int begin, int end, int a, int b){
    for(int i=begin+1 ; i<end ; i++){
        if((x[i].number == a) || (x[i].number == b)) return false;
    }
    return true;
}

bool selection_sort(TRUMP *x, int n){
    int min;
    bool stable_flag = true;
    for(int i=0 ; i<n-1 ; i++){
        min = i;
        for(int j=i+1 ; j<n ; j++){
            if(x[j].number < x[min].number) min = j;
        }
        // ???????????????????°??????§????????°???????????????
        if(min != i){
            // ??????????????????????????????????????????
            if(stable_flag){
                stable_flag = search_number(x, i, min, x[i].number, x[min].number);
            }
            swap(x[i], x[min]);
        }
    }
    return stable_flag;
}

int main(int argc, char const *argv[]) {
    int n;
    char tmp[3]; // ???????????????????????¨
    bool stable_flag;
    TRUMP x_b[36], x_s[36];

    // ????´???°??¨??°????????\???
    scanf("%d", &n);
    for(int i=0 ; i<n ; i++){
        scanf("%s", tmp);
        x_b[i].symbol = tmp[0];
        x_b[i].number = (int)(tmp[1] - '0');
    }
    memcpy(x_s, x_b, sizeof(x_b));

    // ??????????????????
    bubble_sort(x_b, n);
    for(int i=0 ; i<n-1 ; i++){
        printf("%c%d ", x_b[i].symbol, x_b[i].number);
    }
    printf("%c%d\n", x_b[n-1].symbol, x_b[n-1].number);
    printf("Stable\n");

    // ???????????????
    stable_flag = selection_sort(x_s, n);
    for(int i=0 ; i<n-1 ; i++){
        printf("%c%d ", x_s[i].symbol, x_s[i].number);
    }
    printf("%c%d\n", x_s[n-1].symbol, x_s[n-1].number);
    if(stable_flag) printf("Stable\n");
    else printf("Not stable\n");

    return 0;
}

Measured memory_bytes: 2720
import java.util.*;

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

      if(a*b%2==0){
      System.out.println("Even");
    }else{
      System.out.println("Odd");
    }
  }
}


Measured memory_bytes: 21460
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

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

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

const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;

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

using MIte = multimap<ll, ll, greater<ll> >::iterator;

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

	// long long?
	int N;
	cin >> N;

	if (N == 1) {
		cout << "Hello World" << endl;
	}
	else if (N == 2) {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include "math.h"


int main(int argc, char *argv[]){

  int a, b;
  int x;

  scanf("%d %d", &a, &b);

  if(a<=9 && b<=9){
    x = a*b;
  }else{
    x = -1;
  }

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

  return 0;
}


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

int main() {
  long long A, B, C, D;
  cin >> A >> B >> C >> D;
  long long Cdiv = B / C - (A - 1) / C;
  long long Ddiv = B / D - (A - 1) / D;
  long long CDdiv;
  long long minCD = min(C, D);
  long long lcm;
  long long gcd = 1;
  long long Cs = C;
  long long Ds = D;
  int i = 2;
  while (i < sqrt(Cs) + 1 && i < sqrt(Ds) + 1) {
    while (Cs % i == 0 && Ds % i == 0) {
      gcd *= i;
      Cs /= i;
      Ds /= i;
    }
    i++;
  }
  lcm = C * D / gcd;
  CDdiv = B / lcm - (A - 1) / lcm;
  cout << (B - A  + 1) - (Cdiv + Ddiv - CDdiv) << endl;
  return 0;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define eps 1e-10
#define LL_INF 0x33ffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 1e5 + 5;
const double PI = acos(-1.0);
const ll mod = 1e6 + 3;
ll po(ll a, ll b,ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a,ll b){ if(a==0){return b;}else{ return gcd(b%a,a);}}

int n;
int val[maxn];
 
void solve()
{
	scanf("%d", &n);
	int maxx=0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &val[i]);
		val[i]++;
		maxx=max(maxx,val[i]);
	}
	n++;
	val[n]=maxx;
	sort(val + 1, val + n + 1);
	reverse(val + 1, val + n + 1);
	int i, j;
	for (i = 1; i <= n; i++)
	{
		if (val[i] < i)
		{
			break;
		}
	}
	int up =val[i-1]-(i-1);
	int right=0;
	//cout<<i<<endl;
	//cout<<n<<endl;
	for (j = i; j <= n; j++)
	{
		if (val[j] < (i-1))
		{
			break;
		}
		else
		{
			right++;
		}
	}
	//cout<<val[i-1]-i<<endl;
	//cout<<j-i<<endl;
	//cout<<i<<endl;
	//cout<<val[1]<<" "<<val[2]<<" "<<val[3]<<" "<<val[4]<<endl;
	int res=0;
	//cout<<up<<" "<<right<<endl;
	if(up%2!=right%2)
	{
		res=1;
	}
	else
	{
		res=up%2;
	}
	if(res)
	{
		puts("First");
	}
	else
	{
		puts("Second");
	}
}
int main()
{
    solve();
	return 0;
}

Measured memory_bytes: 640