akhauriyash/Code-Regression huggingface dataset:
/////////////////////////////////////////Info/////////////////////////////////////////////////
//Problem:
//Date:
//Skill:
//Bug:
/////////////////////////////////////////Definations/////////////////////////////////////////////////
//循环控制
#define CLR(a) memset((a),0,sizeof(a))
#define F(i,a,b) for(int i=a;i<=int(b);++i)
#define F2(i,a,b) for(int i=a;i>=int(b);--i)
#define RE(i,n)  for(int i=0;i<int(n);i++)
#define RE2(i,n) for(int i=1;i<=int(n);i++)
//简化敲击
#define PII pair<int,int>
#define PLL pari<long long ,long long>
#define PB push_back
#define ENDL '\n'
#define x first
#define y second
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const long long llinf = 0x3f3f3f3f3f3f3f3f;
////////////////////////////////////////Options//////////////////////////////////////////////////////
#define stdcpph
#define CPP_IO

#ifdef stdcpph
#include<bits/stdc++.h>
#else
#include<ctype.h>
#include<string.h>
#include<math.h>
#include<vector>
#include<map>
#include<algorithm>
#include<functional>
#ifdef CPP_IO
#include<iostream>
#include<iomanip>
#include<string>
#else
#include<stdio.h>
#endif
#endif
////////////////////////////////////////Basic Functions//////////////////////////////////////////////
template<typename INint> inline void IN(INint &x)
{
	x = 0; int f = 1; char c; cin.get(c);
	while (c<'0' || c>'9') { if (c == '-')f = -1; cin.get(c); }
	while (c >= '0'&&c <= '9') { x = x * 10 + c - '0'; cin.get(c); }
	x *= f;
}
template<typename INint> inline void OUT(INint x)
{
	if (x > 9)OUT(x / 10); cout.put(x % 10 + '0');
}
////////////////////////////////////////Added Functions//////////////////////////////////////////////
const int maxn = int(20);
bool yymm(string s)
{
	int m = (s[2] - '0') * 10 + s[3] - '0';
	if (m <= 12 && m >= 1)return 1;
	else return 0;
}
bool mmyy(string s)
{
	int m = (s[0] - '0') * 10 + s[1] - '0';
	return m <= 12 && m >= 1;
}
////////////////////////////////////////////Code/////////////////////////////////////////////////////
int main()
{
	//freopen("C:\\Users\\VULCAN\\Desktop\\data.in", "r", stdin);
	int T(1), times(0);
#ifdef CPP_IO// CPP_IO
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//cin >> T;
#else
	//IN(T);
#endif 
	/////////////////////////////////////////////////////////////////////////////////////////////////
	while (++times, T--)
	{
		string s;
		cin >> s;
		if (yymm(s) && mmyy(s))cout << "AMBIGUOUS";
		else if (yymm(s) && !mmyy(s))cout << "YYMM";
		else if (mmyy(s) && !yymm(s))cout << "MMYY";
		else cout << "NA";
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int a[5];
int main(int argc, char *argv[]) {
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;++i){
		int s,c;
		cin>>s>>c;
		if(a[s]&&a[s]!=c){
			cout<<-1<<endl;
			return 0;
		}
		if(n!=1&&s==1&&c==0) {cout<<-1<<endl; return 0;}
		a[s]=c;
	}
	if(a[1]==0&&n==1) cout<<a[1]<<endl;
	else if(a[1]==0) {
		cout<<1;
		for(int i=2;i<=n;++i)
			cout<<a[i];
		cout<<endl;
	}
	else {
		for(int i=1;i<=n;++i)
			cout<<a[i];
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
 int n,p,q,f=0;
 cin>>n;
 int a[n+1];
 for(int i=1;i<=n;i++)cin>>a[i];
 sort(a+1,a+n+1,less<int>());
 q=a[n]+1;
  for(int i=1;i<n;i++){
  	p=abs(2*a[i]-a[n]);
 	if(p<q){q=p;f=i;}
  }
  cout<<a[n]<<' '<<a[f];
 return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
using namespace std;
int a[100010],n,ans;

int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+1+n);
	int sum=1;
	for(int i=2;i<=n;i++){
//	if(a[i]==8)cout<<sum<<" ";
		if(a[i-1]!=a[i]){
			if(a[i-1]!=sum){
				if(sum>a[i-1])ans+=(sum-a[i-1]);
				else if(sum<a[i-1])ans+=sum;//cout<<a[i-1]<<" "<<sum<<" ";
				}
			sum=0;
		}
		sum++;
	}
	if(a[n]!=sum){
//		cout<<sum<<" ";
		if(sum>a[n])ans+=(sum-a[n]);
				else if(sum<a[n])ans+=sum;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
#define EPS (1e-10)
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	VI a(3); rep(i,3)cin>>a[i]; sort(ALL(a));
	if(a[0]+a[1]==a[2]) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
map<int, ll> mp;
char s[200010];

int main()
{
	cin >> s;
	ll len = strlen(s);
	for (int i = 0; i < len; i++)
		mp[s[i] - 'a']++;
	ll ans = 1;
	ans += len*(len - 1) / 2;
	for (int i = 0; i < 26; i++)
		if (mp[i]) ans -= mp[i] * (mp[i] - 1) / 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>

using namespace std;
struct node
{
	int p,l,r;
};
const int MAX=100005;
int D[MAX];
void print(node A[],int u){
   cout<<"node "<<u<<": ";
   cout<<"parent = "<<A[u].p<<", ";
   cout<<"depth = "<<D[u]<<", ";

   if(A[u].p==-1)cout<<"root, ";
   else if(A[u].l==-1)cout<<"leaf, ";
   else cout<<"internal node, ";
   
   cout<<"[";
   int c;
   for(int i=0,c=A[u].l;c!=-1;i++,c=A[c].r){
      if(i)cout<<", ";
   	  cout<<c;
   }
    cout<<"]"<<endl;
}
void rec(node A[],int u,int p){
    D[u]=p;
    if(A[u].r!=-1)rec(A,A[u].r,p);
    if(A[u].l!=-1)rec(A,A[u].l,p+1);

}
int main(){

	int n;
	cin>>n;
	node *A=new node[n];
	for(int i=0;i<n;i++)A[i].p=A[i].l=A[i].r=-1;
    int v,d,c,l;
	for(int i=0;i<n;i++){
		cin>>v>>d;
		for(int j=0;j<d;j++){
			cin>>c;
			
			if(j==0)A[v].l=c;
			else A[l].r=c;
			l=c;
			A[c].p=v;
		}

	}
	int r;
    for(int i=0;i<n;i++){
    	if(A[i].p==-1){  r=i;break;}
    }
    rec(A,r,0);
    
    for(int i=0;i<n;i++)print(A,i);
     
	delete A;

	return 0;
}


Measured memory_bytes: 7504
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
/*
ポイントふりわけ
というわけでもないか
均等に減らすわけでもなし
均等に減らすのがいいかな

11 14
3 1 4 1 5 9 2 6 5 3 5
8 9 7 9 3 2 3 8 4 6 2

31313323333=16
31414424434=10
11233444444
99887643322

最初にでかい順＊小さい順でわりあて
最小値を決めて調整とか
11233455569
99887643322

2分探索かも
*/
int main(){
  ll N,K,s=0; cin>>N>>K;
  vector<ll> A(N,0),F(N,0);
  for(ll i=0; i<N; i++){
    cin>>A[i];
    s+=A[i];
  }
  if(K>=s){
    cout<<0<<endl;
    return 0;
  }
  for(ll i=0; i<N; i++) cin>>F[i];
  sort(A.begin(), A.end());
  sort(F.begin(), F.end(), greater<ll>());
  ll high=1e13, low=0;
  while(high-1>low){
    ll mid=(high+low)/2;
    ll k=K;
    for(ll i=0; i<N; i++){
      ll n=mid/F[i];
      k-=max(0LL,A[i]-n);
      if(k<0) break;   
    }
    if(k<0) low=mid;
    else high=mid;
  }
  cout<<high<<endl;
}

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

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

	bool ans = false;
	for(int i = A; i <= B; i++) {
		if(i % K == 0)
			ans = true;
	}

	if(ans)
		cout << "OK" << endl;
	else
		cout << "NG" << endl;

	return 0;
}

Measured memory_bytes: 3592
c,d,t,u;
long s;
main()
{
	c=getchar_unlocked();
	while(c!=10)
	{
		t+=1;
		d=getchar_unlocked();
		if(c!=d)
		{
			s+=(long)t*(t+1)/2;
			if(c=='>')s-=t<u?t:u;
			u=t;
			t=0;
			c=d;
		}
	}
	printf("%ld",s);
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort
#include <math.h>

#define DEBUG 0

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll mod = 1000000007;
static const ll INF = 1000000000000000000LL;
                    //999999997000000003
                    //1000000000000000000

using namespace std;


int main(){
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    ll N;
    cin >> N;
    if(N % 2 == 1)
    {
        cout << 0 << endl;
        return 0;
    }

    ll res = 0;
    ll bai = 10;

    while(N / bai > 0)
    {
        res += (N / bai);
        bai *= 5;
    }

    cout << res << endl;
    return 0;
}



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

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int y = scanner.nextInt();
			System.out.println(
					Arrays.stream(getResult(n, y)).mapToObj(i -> String.valueOf(i)).collect(Collectors.joining(" ")));
		}
	}

	/**
	 * @param n 合計枚数
	 * @param y 合計金額
	 * @return [1万円札の枚数, 5千円札の枚数, 1千円札の枚数]の配列
	 */
	private static int[] getResult(final int n, final int y) {
		for (int i = 0; i <= Math.min(y / 5000, n); i++) {
			int count = n - i;
			int sum = y - i * 5000;
			int diff = sum - count * 1000;
			if ((diff >= 0) && (0 == diff % 9000) && (diff / 9000 <= count)) {
				return new int[] { diff / 9000, i, count - diff / 9000 };
			}
		}
		return new int[] { -1, -1, -1 };
	}
}


Measured memory_bytes: 29136
'use strict'

/////////////////////////////////////
//コピペスペース//////////////////////

//定数
const INF  =  900719925474099 // Math.floor(Number.MAX_SAFE_INTEGER / 10);

//スペース区切りの数字列を数字の配列にして返す
function mapint(line){return line.split(' ').map((v)=>parseInt(v));}

//コピペスペース//////////////////////
/////////////////////////////////////

function Main(input){
	let temp = input.trim().split('\n');
	let temp2 = mapint(temp[0]);
	let n = temp2.shift();
	let k = temp2.shift();
	let v = mapint(temp[1]);

	//console.log(n,k,v);
	
	let a,b,r;
	r = Math.min(n,k);

	let max = 0;

	for(a=0;a<=r;a++){
		for(b=0;a+b<=r;b++){
			//左からa個、右からb個取り出す
			let v2 = [...v.slice(0,a),...v.slice(n-b)];
			//console.log(v2);
			//余った回数分、負の数を取り除く
			let kk = k-a-b;
			v2.sort((a,b)=>b-a);
			for(let i=v2.length-1;i>=0;i--){
				if(kk-- <= 0) break;
				if(v2[i] >= 0) break;
				v2.pop();
			}

			//最大値か判断
			let sum = 0;
			for(let i=v2.length-1;i>=0;i--){
				sum += v2[i];
			}
			max = Math.max(sum,max);
			//console.log(sum);
		}
	}
	console.log(max);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 10492
#include "bits/stdc++.h"
using namespace std;
int main() {
	int a[1000];
	int n, m;
	while (cin >> n >> m, n) {
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		int ans = 0;
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				if (a[i] + a[j] <= m) ans = max(ans, a[i] + a[j]);
			}
		}
		if (ans == 0) cout << "NONE" << endl;
		else cout << ans << endl;
	}
}


Measured memory_bytes: 3004
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
 
int main()
{
	string IOI = "IOI", JOI = "JOI";
	char s[10000];
	while (scanf("%s", s) != EOF){
		string str = string(s);
		int Icount = 0, Jcount = 0;
		REP(i, (int)str.size() - 2){
			if (str.substr(i, 3) == JOI) Jcount++;
			else if (str.substr(i, 3) == IOI) Icount++;
		}

		cout << Jcount << endl << Icount << endl;

	}
}


Measured memory_bytes: 3272
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define lop(i, n) for(i=0; i<n; i++)

int main()
{
	int n,i,cnt[200001],max=0;
	scanf("%d", &n);
	char s[200000][11];
	
	lop(i, n){
		scanf("%s", s[i]);
	}
	
	qsort(s, n, 11, strcmp);
	
	cnt[0]=1;
	for(i=1; i<n; i++){
		if(strcmp(s[i-1], s[i])==0){
			cnt[i]=cnt[i-1]+1;
		}
		else {
			cnt[i]=1;
			if(max<cnt[i-1])max=cnt[i-1];
		}
	}
	
	if(max<cnt[n-1])max=cnt[n-1];
	lop(i, n){
		if(max==cnt[i]){ printf("%s\n", s[i]); }
	}
	
return 0;
}

Measured memory_bytes: 4884
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define F first
#define S second
#define int long long
#define mod 1000000007
#define mmod 998244353
#define all(v) v.begin(), v.end()
#define INF LLONG_MAX/3
#define PI 3.14159265359
using namespace std;
int mypow(int fa, int fb, int fc) {
	if (fb == 0)return 1;
	if (fb % 2)return mypow(fa, fb - 1, fc)*fa%fc;
	int z = mypow(fa, fb / 2, fc);
	return z * z%fc;
}
int k(int fa) {
	int x = 0;
	while (fa) {
		x++;
		fa /= 10;
	}
	return x;
}
int gcd(int fa, int fb) {
	if (fb == 0)return fa;
	return gcd(fb, fa%fb);
}
signed main() {
	int a, b;
	cin >> a >> b;
	cout << a * b << endl;
}

Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
using System.Linq;

namespace Volumen0
{

    class Program
    {
        static void DS(int[] v, int[] w)
        {
            for (int i = 0; i < v.Length - 1; ++i)
            {
                var a = Console.ReadLine().Split(',').Select(int.Parse).ToArray();
                v[i] = a[0];
                w[i] = a[1];
            }
        }
        static void Main()
        {
            var ds = 0;
            int maxW;
            while ((maxW = int.Parse(Console.ReadLine())) != 0)
            {
                var n = int.Parse(Console.ReadLine());
                var v = new int[n + 1];
                var w = new int[n + 1];
                var p = new int[n + 1, maxW + 1];
                DS(v, w);
                for (int i = 0; i < n; ++i)
                {
                    for (int j = 0; j <= maxW; ++j)
                    {
                        if (j < w[i])
                        {
                            p[i + 1, j] = p[i, j];
                        }
                        else
                        {
                            p[i + 1, j] = Math.Max(p[i, j], p[i, j - w[i]] + v[i]);
                        }
                    }
                }
                var ans = 0;
                for (int i = 0; i <= maxW; ++i)
                {
                    if (p[n, i] == p[n, maxW])
                    {
                        ans = i;
                        break;
                    }
                }
                Console.WriteLine("Case {0}:\n{1}\n{2}", ++ds, p[n, maxW], ans);
            }
        }
    }
}


Measured memory_bytes: 19844
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int allF=1;
  
  vector<int> x(N),y(N);
  for(int i=0; i<N; i++){
   cin >> x[i] >> y[i];
    allF*=(i+1);///全事象を求める
  }
  
  double square;
  double sum=0;
  int count=0;
  
  for(int i=0; i<N-1; i++){
   for(int j=i+1; j<N; j++){
     square = pow(x[i]-x[j],2) + pow(y[i]-y[j],2);
     square = pow(square,0.5);
     sum+=square; //全種類の移動の和
     count++;
   }
  }
  
  double ans;
  ans = sum*(N-1)/count;
  
  cout << fixed << setprecision(10) << ans << endl;
  
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using ll = long long;
#define INF 1e9

int main() {
    string s; cin >> s;

    ll ans = 0; ll cur = 0;
    REP(i, s.size()) {
        if (s[i] == 'W') {
            ans += i - cur;
            ++cur;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

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

	set<int> s;
	for (int i = 0; i < 10000; i++) {
		s.insert(i*i);
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			int val = 0;

			for (int k = 0; k < m; k++) {
				int diff = abs(d[i][k] - d[j][k]);
				val += diff * diff;
			}

			if (s.count(val))ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
typedef long long int ll;

#define p(V) for(int iiv=0;iiv<V.size();iiv++) cout<<V[iiv]<<" ";
#define mp make_pair
#define pb push_back
#define graph vector<vector<int> >
#define pf first
#define ps second
#define pq priority_queue
const int N = 2e5;
const int l = 18;
const double pi = acos(-1);
struct d{
    int a , b , c;
    d(){
        a=b=c=0;
    }
};
int dp[N][3];
int n;
vector<d> day;
int main(){   
    cin >> n;
    day.resize(n);
    for(int i=0;i<n;i++) cin>>day[i].a>>day[i].b>>day[i].c;
    dp[n-1][0] = day[n-1].a;
    dp[n-1][1] = day[n-1].b;
    dp[n-1][2] = day[n-1].c;
    for(int i=n-2;i>=0;i--){
        dp[i][0] = day[i].a + max(dp[i+1][1],dp[i+1][2]);
        dp[i][1] = day[i].b + max(dp[i+1][0],dp[i+1][2]);
        dp[i][2] = day[i].c + max(dp[i+1][0],dp[i+1][1]);
    }
    cout<<max(dp[0][0],max(dp[0][1],dp[0][2]));
    return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<stdlib.h>

int main()
{
    int k,a,b,y;
    scanf("%d %d %d",&k,&a,&b);
    if(a%k==0) printf("OK");
    else{
        y=a+k-a%k;
        if(y<=b) printf("OK");
        else printf("NG");
    }
    return 0;
}


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

using namespace std;

#define K 200001

#define FOE(i, s, t) for (int i = s; i <= t; i++)
#define pb push_back
#define mp make_pair
	
int n;
vector<int> nxt[K];

int dfs[K], de[K], red[K];

priority_queue<pair<int, int> > Q;

int main(){
	scanf("%d", &n);
	FOE(i, 1, n - 1){
		int u, v; scanf("%d%d", &u, &v);
		nxt[u].pb(v);
		nxt[v].pb(u);
		de[u]++; de[v]++;
	}
	
	FOE(i, 1, n) if (de[i] == 1){
		Q.push(mp(0, i));
	}
	
	FOE(i, 1, n){
		pair<int, int> T = Q.top(); Q.pop();
		int u = T.second;
	//	printf("u = %d red[%d] = %d\n", u, u, red[u]);
		if (red[u] == 0){
			// leaf
			for (int j = 0; j < nxt[u].size(); j++) if (!dfs[nxt[u][j]]){
			//	printf("handle %d\n", nxt[u][j]);
				de[nxt[u][j]]--;
				red[nxt[u][j]]++;
				if (de[nxt[u][j]] == 1){
					Q.push(mp(-red[nxt[u][j]], nxt[u][j]));
				}
			}
		} else if (red[u] == 1){
			
			for (int j = 0; j < nxt[u].size(); j++) if (!dfs[nxt[u][j]]){
			//	printf("handle %d\n", nxt[u][j]);
				de[nxt[u][j]]--;
				if (de[nxt[u][j]] == 1){
					Q.push(mp(-red[nxt[u][j]], nxt[u][j]));
				}
			}
		} else if (red[u] >= 2){
			puts("First");
			return 0;
		}
	}
	puts("Second");
}

Measured memory_bytes: 9720
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += i;
        }
        System.out.println(sum);
    }
}


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

typedef long long ll;
const int N = 4e5+2;
int a[N], b[N], c[N], n, m;
ll t1[N], t2[N];

void update1(int i, ll val) {
	while (i <= m) {
		t1[i] += val;
		i += (i & -i);
	}
}
void update2(int i, ll val) {
	while (i <= m) {
		t2[i] += val;
		i += (i & -i);
	}
}
ll get1(int i) {
	ll res = 0;
	while (i > 0) {
		res += t1[i];
		i -= (i & -i);
	}
	return res;
}
ll get2(int i) {
	ll res = 0;
	while (i > 0) {
		res += t2[i];
		i -= (i & -i);
	}
	return res;
}

int main() {
	map<int, int> com;
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i], com[a[i]] = 0;
	for(int i = 1; i <= n; i++) cin >> b[i], com[b[i]] = 0;
	for(int i = 1; i <= n; i++) cin >> c[i], com[c[i]] = 0;

 	m = 0;
	for(auto& x: com) x.second = ++m;
	for(int i = 1; i <= n; i++) a[i] = com[a[i]], b[i] = com[b[i]], c[i] = com[c[i]];

	for(int i = 1; i <= n; i++) update1(a[i], 1);
	for(int i = 1; i <= n; i++) {
		ll x = get1(b[i]-1);
		// cout << i  << ' ' << b[i] << ' ' << x << endl;
		update2(b[i], x);
	}
	ll res = 0;
	for(int i = 1; i <= n; i++) {
		ll x = get2(c[i]-1);
		// cout << i << ' ' << c[i] << ' ' << x << endl;
		res += x;
	}

	cout << res;

}


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

#define print cout <<

int main(){
    string S;
    cin >> S;

    int ans = 0;
    int renzoku = 0;
    for(auto c : S){
      if(c=='R'){
        renzoku +=1;
        if(renzoku>ans){
          ans = renzoku;
        }
      }else{
        renzoku = 0;
      }
    }
    print ans << endl;
}


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

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define F(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define endl '\n'

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int N = 100010, mod = 1000000007;

int n, k, mu[N], prime[N], np[N], cnt;

int qpow(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1) res = 1ll * res * a % mod;
		a = 1ll * a * a % mod;
		b >>= 1;
	} return res; 
}
void calc() {
	mu[1] = 1;
	np[1] = 1;
	for (int i = 2; i <= 100000; ++i) {
		if (!np[i]) prime[++cnt] = i, mu[i] = -1;
		for (int j = 1; j <= cnt && i * prime[j] <= 100000; ++j) {
			np[i * prime[j]] = 1;
			if (i % prime[j]) mu[i * prime[j]] = -mu[i];
			else {
				mu[i * prime[j]] = 0;
				break;
			}
		}
	}
}
ll cal(ll x) {
	ll ans = 0;
	for (int i = 1; i <= x; ++i) {
		ll t = mu[i] * qpow(x / i, n) % mod;
		ans = (ans + t + mod) % mod;
	}
	return ans;
}
void solve() {
	scanf ("%d%d", &n, &k);
	calc();
	ll ans = 0;
	for (int i = 1; i <= k; ++i) {
		ans += 1ll * i * cal(k / i) % 1000000007;
		ans %= 1000000007;
	}
	cout << ans << '\n';
}




int main() {
	ios::sync_with_stdio(false);
	cout << fixed;

#ifdef LOCAL
	double cl = clock();
#endif

	int T = 1;
	while (T--) solve();

#ifdef LOCAL
  cerr << "Time elapsed: " << (clock() - cl) / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}




Measured memory_bytes: 4612
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 10;
    // const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 179;
    // const ld PI = 3.1415926535;
#endif

// #pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")`  

int a, b, n;

int f(int x) {
    return a * x / b - a * (x / b);
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> a >> b >> n;
    cout << f(min(b - 1, n));
}
/*

*/  


Measured memory_bytes: 3652
#include <bits/stdc++.h> 
using namespace std; 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define MOD 1000000007
#define pb push_back
#define ve vector<ll>
#define dos pair<ll,ll>
#define vedos vector<dos>
#define rand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define EPS 0.000001
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
void setIO(string s) {
  ios_base::sync_with_stdio(0); cin.tie(0); 
  freopen((s+".in").c_str(),"r",stdin);
  freopen((s+".out").c_str(),"w",stdout);
}
int main()
{
  //flash;
  int n,k;
  cin>>n>>k;
  ve hed;
  for (int i = 0; i < n; ++i)
  {
    ll yo;
    cin>>yo;
    hed.pb(yo);
  }
  sort(all(hed));
  ll ans=0;
  for (int i = 0; i < k; ++i)
  {
    ans+=hed[i];
  }
  cout<<ans;
  return 0;
}
//code the AC sol !
// BS/queue/map

Measured memory_bytes: 3628
num = int(input())
ac=0
wa=0
tle=0
re =0
for n in range(num):
  str1 =input()
  if str1=="AC":
    ac +=1
  elif str1=="WA":
    wa+=1
  elif str1=="TLE":
    tle+=1
  elif str1 == "RE":
    re +=1

print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))


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

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    a--;

    ll l = c / __gcd(c, d) * d;
    ll ans = (b - b/c - b/d + b/l) - (a - a/c - a/d + a/l);

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


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

vector<int> L;

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

    sort(L.begin(), L.end());
    long long int ans = 0;
    for(int i = 0; i < n-2; i++){
        for(int j = i+2; j < n; j++){
            int k = upper_bound(L.begin(), L.end(), L[j]-L[i]) - L.begin();
            k = max(k, i+1);
            ans += max(0, j-k);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
const int num = 2;
int main() {
  int n;
  cin >> n;
  map<string, int> mp;

  for(int i=0; i<n; i++){ 
      string s; 
      cin>>s;
      sort(s.begin(), s.end());
      mp[s]++;
  }
  
  long long ans=0;
  for(auto& p: mp){
      int s = p.second;
      ans+=(long long)s*(s-1)/2;
  }
  cout << ans  << endl;
  return 0;
}


Measured memory_bytes: 11136
/*=============================================================================================================================/*
                                               Bismillahir Rahmanir Rahim

      _     ____  ___  ____   _   _  _         ___  ____   _         _     __  __
     / \   / ___||_ _|| __ ) | | | || |       |_ _|/ ___| | |       / \   |  \/  |
    / _ \  \___ \ | | |  _ \ | | | || |        | | \___ \ | |      / _ \  | |\/| |
   / ___ \  ___) || | | |_) || |_| || |___     | |  ___) || |___  / ___ \ | |  | |
  /_/   \_\|____/|___||____/  \___/ |_____|   |___||____/ |_____|/_/   \_\|_|  |_|

   _   __           __  __  __
  |_) (_  _  o__   /   (_  |_
  |_)o__)(_  || |  \__ __) |__

    ___                    _   _      _                _ _               __   ___                 _         _        _
   / __|_ _ ___ ___ _ _   | | | |_ _ (_)_ _____ _ _ __(_) |_ _  _   ___ / _| | _ ) __ _ _ _  __ _| |__ _ __| |___ __| |_
  | (_ | '_/ -_) -_) ' \  | |_| | ' \| \ V / -_) '_(_-< |  _| || | / _ \  _| | _ \/ _` | ' \/ _` | / _` / _` / -_|_-< ' \
   \___|_| \___\___|_||_|  \___/|_||_|_|\_/\___|_| /__/_|\__|\_, | \___/_|   |___/\__,_|_||_\__, |_\__,_\__,_\___/__/_||_|
                                                            |__/                           |___/


   FB: https://facebook.com/SIAsibul
   Gmail: asibulislam8@gmail.com

/*=============================================================================================================================*/

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vii;
typedef vector<pil> vil;
typedef vector<pli> vli;
typedef vector<pll> vll;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,n) for(ll i=0;i<(n);i++)
#define f1(i,n) for(ll i=1;i<=(n);i++)
#define f2(i,a,n) for(ll i=(a);i<=(n);i++)
#define fr(i,n,a) for(ll i=(n);i>=(a);i--)
#define rep(i,a,b,c) for(ll i=(a);i!=(b);i+=(c))
#define nl "\n"


const int INF = 1e9 + 5;
const int MXN = 2e5 + 5;
const int MOD = 1e9 + 7;


void solve(){
    int n; cin >> n;
    if(n >= 30) cout << "Yes" << nl;
    else cout << "No" << nl;
}

int main(){
    ll t;
    //cin >> t;
    t = 1;
    while(t--){
        solve();
    }
    return 0;
 }


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;


int main(int argc, char const *argv[])
{
    string a, b;
    cin >> a >> b;
    if (a.size() > b.size())
    {
        cout << "GREATER" << endl;
    }
    else if (a.size() < b.size())
    {
        cout << "LESS" << endl;
    }
    else
    {
        if (a == b)
        {
            cout << "EQUAL" << endl;
        }
        else
        {
            ll i = 0;
            while (i < a.size())
            {
                if (a[i] > b[i])
                {
                    cout << "GREATER" << endl;
                    exit(0);
                }
                else if (a[i] < b[i])
                {
                    cout << "LESS" << endl;
                    exit(0);
                }
                i++;
            }
            cout << "EQUAL" << endl;
        }
    }
}

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

using namespace std;
using ll = long long;
using IP = pair<int, int>;

const ll linf = 1LL << 62;
const int inf = 99999999;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };
const ll atcoder = 1e9 + 7;

#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back
#define pr(x) cout << x << endl
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define rep(i,n) for(int i= 0;i<n;i++)

ll gcd(ll a, ll b) {//最大公約数
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	return (a / gcd(a, b))*b;
}

int main() {

	string s;
	cin >> s;
	int len = s.length()-1;

	while (len >= 0) {
		if (len - 6 >= 0 && s.substr(len - 6, 7) == "dreamer")len -= 7;
		else if (len - 5 >= 0 && s.substr(len - 5, 6) == "eraser")len -= 6;
		else if (len - 4 >= 0 && s.substr(len - 4, 5) == "dream")len -= 5;
		else if (len - 4 >= 0 && s.substr(len - 4, 5) == "erase")len -= 5;
		else {
			pr("NO");
			return 0;
		}
	}
	
	pr("YES");
	//system("pause");
	return 0;
}

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

int main() {
  int a, b;
  string sumac, sumbc;
  cin >> a >> b;
  int suma = 0;
  int sumb = 0;
  for (int i = 0; i < b; i++) {
    suma = suma + a * pow(10, i);
  }
  
  for (int i = 0; i < a; i++) {
    sumb = sumb + b * pow(10, i);
  }
  
  sumac = to_string(suma);
  sumbc = to_string(sumb);
  
  if (sumac > sumbc){
    cout << sumbc << endl;
  }
  else{
    cout << sumac << endl;
  }
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);


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

    rep(i, n - m + 1)rep(j, n - m + 1) {
            rep(k, m)rep(l, m) {
                    if (a[i + k][j + l] != b[k][l]) goto LABEL;
                    if (k == m - 1 && l == m - 1) {
                        cout << "Yes" << endl;
                        return 0;
                    }
                }
            LABEL:;

        }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<queue>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<cstring>
#include<climits>
#include<sstream>
#include<deque>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>

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

using namespace std;

typedef long long ll;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;

int main(){
  string s;
  cin >> s;
  if(s.size()>=4&&s.substr(0,4)=="YAKI") puts("Yes");
  else puts("No");


  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n, m, x;
    cin >> n >> m >> x;

    int c[n], a[n][m];
    rep(i,n){
        cin >> c[i];
        rep(j,m)cin >> a[i][j];
    }

    int ans = 1001001001;

    rep(i,1<<n){
        int ii = i;
        int tmp = 0;
        int b[m] = {};
        rep(j,n){
            if(ii % 2 == 1){
                tmp += c[j];
                rep(k,m) b[k] += a[j][k];
            }
            ii /= 2;
        }
        int flag = 1;
        rep(j,m) if(b[j] < x) flag = 0;
        if(flag) ans = min(ans, tmp);
    }

    if(ans == 1001001001) ans = -1;
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3636
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}


int main(){
	#ifdef LOCAL
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
		#if __cplusplus >= 201103L
		auto start = steady_clock::now();
		#endif
	#endif
	int r = read(), d = read(), x = read();
	rep(i, 1, 10) {
		int t = r * x - d;
		cout << t << endl;
		x = t;
	}

	#ifdef LOCAL
		#if __cplusplus >= 201103L
		auto end = steady_clock::now();
		duration<double> time_span = duration_cast<duration<double>>(end - start);;
		printf("Total time: %.6fs\n", time_span.count());
		#endif
	#endif
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;

int main() {
    char c[5];
    cin >> c;
    for(int i = 0; i < (1 << 4); ++i) {
        int num = c[0] - '0';
        for(int j = 0; j < 3; ++j) {
            if(i & (1 << j))
                num -= c[j + 1] - '0';
            else
                num += c[j + 1] - '0';
        }
        if(num == 7) {
            cout << c[0];
            for(int j = 0; j < 3; ++j) {
                cout << (i & (1 << j) ? '-' : '+');
                cout << c[j + 1];
            }
            cout << "=7" << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

p, q, r=map(int, input().split())

m = 1000

m = min(m, p + q)
m = min(m, p + r)
m = min(m, q + r)

print(m)

Measured memory_bytes: 21768
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let k: usize = sc.read();
    let mut cur = 1;
    for _ in 0..k {
        sc.write(cur.to_string());
        sc.write("\n");

        let mut candidates = vec![];
        for prefix in 0..1000 {
            let mut p = prefix;
            let mut s = s(p);
            while p < cur * 100 {
                if p > cur {
                    candidates.push((p, s));
                }
                p *= 10;
                p += 9;
                s += 9;
            }
        }

        candidates.sort_by(|&a, &b| {
            let (pa, sa) = a;
            let (pb, sb) = b;
            let a = pa * sb;
            let b = pb * sa;
            if a == b {
                pa.cmp(&pb)
            } else {
                a.cmp(&b)
            }
        });
        let (next, _) = candidates[0];
        cur = next;
    }
}

fn s(mut a: usize) -> usize {
    let mut result = 0;
    while a > 0 {
        result += a % 10;
        a /= 10;
    }
    result
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
N, X = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
S = 0
ans = 0
for i in range(N):
  S += A[i]
  if S <= X:
    ans += 1
  else:
    break
if S < X:
  ans = N-1
print(ans)


Measured memory_bytes: 61860
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner  yomi = new Scanner(System.in);
        int a = yomi.nextInt();
        boolean tf=true;
        int[] n = new int[a];
        for (int i=0;i<a;i++){
            n[i] = yomi.nextInt();
    }
        for (int i=0;i<a;i++){
            if (n[i]%2==0){
                if (n[i]%3==0||n[i]%5==0){

                }else tf=false;
            }
        }
        if (tf){
            System.out.println("APPROVED");
        }else System.out.println("DENIED");
    }
}

Measured memory_bytes: 23764
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

bool check(int a, int b) {
	return a > b;
}

int main() {
	char s[17], t[17] = "CODEFESTIVAL2016";
	cin >> s;
	int cnt = 0;
	rep(i, 16) {
		if (s[i] != t[i]) {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat64() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

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

func main() {
	sc.Split(bufio.ScanWords)
	//sc.Buffer(nil, 100000000)
	n := nextInt()

	cnt := 0
	ans := "No"

	d1s := make([]int, n)
	d2s := make([]int, n)
	for i := 0; i < n; i++ {
		d1s[i], d2s[i] = nextInt(), nextInt()
	}
	for i := 0; i < n; i++ {
		d1, d2 := d1s[i], d2s[i]
		if d1 == d2 {
			cnt++
		} else {
			cnt = 0
		}
		if cnt >= 3 {
			ans = "Yes"
			break
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1776
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int
const int MAX = 510000;


using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    ll k;
    cin >> n >> k;
    int a[n];
    rep(i, n) cin >> a[i];
    ll count = 0;
    ll count_each = 0;
    rep(i, n){
        rep(j, n){
            count %= 1000000007;
            count_each %= 1000000007;
            if(i != j){
                if(a[i] > a[j]){
                    count ++;
                    if(i < j) count_each ++;
                }

            }
        }
    }
    //cout << count << " " << count_each << endl;
    ll jj = (k - 1)% 1000000007;
    ll jjj = k % 1000000007;
    ll ans = (((((jj * jjj) / 2)) % 1000000007* count) % 1000000007 + (count_each * jjj) % 1000000007) % 1000000007;
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		
		String a=sc.next();
		String ABC="ABC";
		String ARC="ARC";

		if(a.equals("ABC")) {
			System.out.println("ARC");
		}else if(a.equals("ARC")) {
			System.out.println("ABC");
		}
		sc.close();
	}

}

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

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

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

    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans += b[a[i]];
        if(i > 1 && a[i] == a[i-1] + 1){
            ans += c[a[i-1]];
        }
    }

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

Measured memory_bytes: 256
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# dfs, dp, bit全探索
# 箱が12個以下
N, M = lr()
keys = [None] * M
for i in range(M):
    a, b = lr()
    C = lr()
    bit = 0
    for c in C:
        bit += 1 << (c-1)
    keys[i] = (a, bit)

INF = 10 ** 9
dp = [INF] * 2 ** N # 2**N - 1 が全ての箱を開けられる状態の最小値
dp[0] = 0
for key in keys:
    a, bit = key
    for i in range(2 ** N):
        dp[i|bit] = min(dp[i|bit], dp[i] + a)

print(-1 if dp[-1] == INF else dp[-1])


Measured memory_bytes: 43372