akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

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

int const MAX = 100000;
typedef long long ll;
bool isnp[MAX+1];
vector<int> primes;

int main() {
  
  for(int i=2; (ll)i*i<=MAX; i++) {
    if(isnp[i]) continue;
    for(int j=i*i; j<=MAX; j+=i) { isnp[j] = 1; }
  }
  
  for(int i=2; i<=MAX; i++) if(!isnp[i]) { primes.push_back(i); }
  /*
  rep(i, 10) { cerr << primes[i] << endl; }
  */
  int m, a, b;
  while(cin >> m >> a >> b && (m|a|b)) {
    ll mx = 0;
    int ansp=-1, ansq=-1;
    REP(q, 1, m) {
      if(isnp[q]) continue;
      double pu = (double)m/q;
      //cerr << "pu: " << pu << endl;
      int k = upper_bound(primes.begin(), primes.end(), pu)-primes.begin()-1;
      REP(pi, max(k-10, 0), k+10) {
        int p = primes[pi];
        //cerr << p << ", " << q << endl;
        if(p > q) continue;
        if(a*q > b*p) continue;
        if(mx < p*q && p*q <= m) { mx = p*q, ansp = p, ansq = q; }
      }
    }
    cout << ansp << " " << ansq << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1420
#! /usr/bin/python
# -*- coding: utf-8 -*-

def bm_search(dat, q, l, r):
    #print q, l, r
    if l == r:
        if q <= dat[l][2]:
            return int(l)
        else:
            return l+1
    elif q <= dat[l+(r-l)/2][2]:
        return bm_search(dat, q, l, l+(r-l)/2)
    elif dat[l+(r-l)/2][2] < q:
        return bm_search(dat, q, l+(r-l)/2+1, r)

while True:
    (N, Q) = map(int, raw_input().split())
    if N == 0: break
    
    dat = []
    for i in range(N):
        dat.append(raw_input().split())
    for i in range(N):
        dat[i][1] = int(dat[i][1])
        dat[i][2] = int(dat[i][2])
    dat.sort(key = lambda x:x[2])
        
    for i in range(Q):
        q = int(raw_input())
        p = bm_search(dat, q, 0, N-1)
        if p < N and dat[p][1] > dat[p][2]-q:
            print dat[p][0], dat[p][1]-(dat[p][2]-q)
        else:
            print "Unknown"
    

Measured memory_bytes: 4512
// 2011/02/22 Tazoe
// Partition Problem

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int m, n;
		cin >> m >> n;
		if(m==0&&n==0)
			break;

		int S[101];
		for(int i=1; i<=n; i++)
			cin >> S[i];

		int P[101];		// S[1]ツつゥツづァS[i]ツづ慊づづ個債計
		int sum = 0;
		for(int i=1; i<=n; i++){
			sum += S[i];
			P[i] = sum;
		}

		int M[101][21];		// iツ氾板姪堋づ慊づづ個要ツ素ツづーツ使ツつ「jツ暗按可コツづ個閉板閉ェツづ可閉ェツ環つオツつスツづつォツづ個催適ツ嘉ー

		for(int i=1; i<=n; i++)
			M[i][1] = P[i];

		for(int j=1; j<=m; j++)
			M[1][j] = S[1];

		for(int i=2; i<=n; i++){
			for(int j=2; j<=m; j++){
				int tmp_min;
				if(M[1][j-1]>P[i]-P[1])
					tmp_min = M[1][j-1];
				else
					tmp_min = P[i]-P[1];
				for(int x=2; x<=i-1; x++){
					int tmp;
					if(M[x][j-1]>P[i]-P[x])
						tmp = M[x][j-1];
					else
						tmp = P[i]-P[x];
					if(tmp<tmp_min)
						tmp_min = tmp;
				}
				M[i][j] = tmp_min;
			}
		}

		cout << M[n][m] << endl;
	}

	return 0;
}

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



int main()
{
    int n,d;
    cin>>n>>d;
    int c=0;
    for(int i=0;i<n;i++)
    {
        long long int x,y;
        cin>>x>>y;
        if((long long)x*x+(long long)y*y<=(long long)d*d)
        {
            c++;
        }
    }
    cout<<c<<endl;
}




















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

using namespace std;
#define X first
#define Y second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define debug(x) cerr << #x << " = " << (x) << endl;
template<typename T>
ostream& operator<<(ostream& o, vector<T>& v) {
    for (auto& x : v) o << x << ' ';
    return o;
}

int uf[100100];
int find(int x){
    return (uf[x] == x) ? x : uf[x] = find(uf[x]);
}

bool merge(int x, int y){
    int p1 = find(x), p2 = find(y);
    if (p1 == p2) return false;
    uf[p2] = p1;
    return true;
}

int main(){
    std::ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    vector<piii> arr(n);
    for (int i = 0; i < n; i++) {
        cin >> arr[i].X.X >> arr[i].X.Y;
        arr[i].Y = i;
    }
    vector<piii> xs(arr), ys(arr);
    sort(xs.begin(), xs.end(), [](const piii &p1, const piii &p2){
            return p1.X.X < p2.X.X;
        });
    sort(ys.begin(), ys.end(), [](const piii &p1, const piii &p2){
            return p1.X.Y < p2.X.Y;
        });
    vector<piii> edges;
    for (int i = 0; i < n-1; i++){
        int dx = xs[i+1].X.X - xs[i].X.X;
        int dy = ys[i+1].X.Y - ys[i].X.Y;
        edges.push_back({{xs[i].Y, xs[i+1].Y}, dx});
        edges.push_back({{ys[i].Y, ys[i+1].Y}, dy});
    }
    sort(edges.begin(), edges.end(), [](const piii &p1, const piii &p2){
            return p1.Y < p2.Y;
        });

    iota(uf, uf+n, 0);

    ll res = 0;
    for (auto &e : edges){
        if (merge(e.X.X, e.X.Y)) res += e.Y;
    }
    cout << res << endl;

}


Measured memory_bytes: 8564
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def YesNo(x): return 'Yes' if x else 'No'
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from collections import defaultdict

def main():
    N = II()
    xy = []
    for _ in range(N):
        xy.append(LI())
    xy2g = defaultdict(int)
    g2xy = defaultdict(set)
    for x, y in xy:
        y = -y
        gx = xy2g[x]
        gy = xy2g[y]
        if gx == gy != 0:
            continue
        elif gx != 0 and gy != 0:  # merge
            if len(g2xy[gx]) < len(g2xy[gy]):
                gx, gy = gy, gx
            for xy in g2xy[gy]:
                xy2g[xy] = gx
            g2xy[gx] |= g2xy[gy]
            g2xy[gy].clear()
        elif gx != 0:
            xy2g[y] = gx
            g2xy[gx].add(y)
        elif gy != 0:
            xy2g[x] = gy
            g2xy[gy].add(x)
        else:
            g = x
            xy2g[x] = xy2g[y] = g
            g2xy[g] |= {x, y}
    ans = -N
    for xys in g2xy.values():
        nx = sum(xy > 0 for xy in xys)
        ny = len(xys) - nx
        ans += nx * ny
    return ans

print(main())

Measured memory_bytes: 114908
A, B, C, D = list(map(int, input().strip().split()))
Takahashi = A
Aoki = C
ans = ''

while True:
  Aoki -= B
  if Aoki <= 0:
    ans = 'Yes'
    break
  Takahashi -= D
  if Takahashi <= 0:
    ans = 'No'
    break
print(ans)

Measured memory_bytes: 9120
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <iomanip>


using namespace std;

int main()
{
    double l;
    cin>>l;

    //cout<<ll;

    cout<<fixed << setprecision(15)<<(l*l*l)/27;

}






Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	char s1[100][201],s2[100][201],a1[201],a2[201];
	int c,count,i,t,str,count_s1,count_s2;
	int br=0,judge=0,j,k;
	
	while(1)
	{
		j=0;
		k=0;
		count=0;
		count_s1=0;
		count_s2=0;
		
		while((c=getchar())!='\n')
		{
			if(c=='.')
			{
				br=1;
				break;
			}
			if(c=='"')
			{
				judge=1-judge;
				if(judge)
				{
					count_s1++;
					str=0;
				}
				else s1[count_s1-1][str]='\0';
			}
			if(judge)
			{
				s1[count_s1-1][str]=c;
				str++;
			}
			else
			{
				a1[j]=c;
				j++;
			}
		}
		a1[j]='\0';
		if(br) break;
		
		while((c=getchar())!='\n')
		{
			if(c=='"')
			{
				judge=1-judge;
				if(judge)
				{
					count_s2++;
					str=0;
				}
				else s2[count_s2-1][str]='\0';
			}
			if(judge)
			{
				s2[count_s2-1][str]=c;
				str++;
			}
			else
			{
				a2[k]=c;
				k++;
			}
		}
		a2[k]='\0';
		for(int i=0;;i++)
		{
			if(a1[i]=='\0' && a2[i]=='\0') break;
			if(a1[i]!=a2[i])
			{
				count=2;
				break;
			}
		}
		if(count_s1==count_s2 && count==0)
		{
			for(int i=0;i<count_s1;i++)
			{
				//printf("%s\n",s1[i]);
				//printf("%s\n\n",s2[i]);
				for(int t=0;;t++)
				{
					if(s1[i][t]=='\0'&&s2[i][t]=='\0') break;
					if(s1[i][t]!=s2[i][t])
					{
						count++;
						break;
					}
					
				}
			}
		}
		else count=2;
		if(count==0) printf("IDENTICAL\n");
		else if(count==1) printf("CLOSE\n");
		else printf("DIFFERENT\n");
	}
	return 0;
}


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

int main()
{
    ll n,m,x,t;
    ll i,j,k;
    ll res=0;
    string s;
    cin>>s;
    for(i=0;i<s.size();i++){
        ll num;
        num=s[i]-48;
        res+=num;
    }
   // cout<<res;
    if(res%9==0)cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3720
import math
n = int(input())
d = math.floor(math.log(1+(26-1)*n, 26))
position = int(n - (26**d - 1) / (26  - 1))
txt = list('a' * d)
for i in range(d):
    txt[d - i - 1] = chr(ord(txt[d - i - 1])+(position % 26))
    position = position // 26
print(''.join(txt))

Measured memory_bytes: 9092
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
using namespace std;


#define ll long long int
#define all(v) begin(v), end(v)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
typedef pair<int, int> Edge;




int main() {
	string s;
	cin >> s;
	int one = 0;
	int zero = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '1') {
			one++;
		}
		else
		{
			zero++;
		}
	}
	cout << s.length() - abs(zero-one) << endl;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

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

		String str=String.valueOf(n);

		for(int i=0;i<str.length();i++) {
			int x=Character.getNumericValue(str.charAt(i));
			System.out.print((x==1)? "9" : ((x==9)? "1":x));
		}
		System.out.println();
    }
}

Measured memory_bytes: 23764
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;
int n;
int A[20];
bool Search(int ite, int SUM){
	if (SUM == 0) return true;
	if (ite == n || SUM<0) return false;
	return (Search(ite+1,SUM-A[ite]) || Search(ite+1,SUM));
}
int main(){
	scanf("%d",&n);
	for (int i = 0; i < n; ++i) scanf("%d", &A[i]);
	int q; scanf("%d", &q);
	for (int i = 0; i < q; ++i){
		int m; scanf("%d", &m);
		if (Search(0,m)) cout << "yes\n"; else cout << "no\n";
	}
}

Measured memory_bytes: 1168
#include <cstdio>
#include <queue>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
#include <string>
#include <cstdio>
#define ll long long
#define TLE std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef pair<int,int> pii;
const ll mod = 1000000007 ;
const int INF=0x3f3f3f3f;
#define test(n) cout<<"Test "<<n<<endl;
#define pb push_back
#define rp(n) for(int i=1;i<=n;i++)
#define rep(n,m) for(int i=1;i<=n;i++) for(int j=1;j<=m;j++)
ll ksm(ll x,ll n){ll ans=1;while (n){if (n&1)ans=(ans*x)%mod;x=x*x%mod;n>>=1;}return ans;}
using namespace std;
double pi = atan(1.0)*4 ;
const int mxn = 1e3+7 ;
int n,t,m,k,l,r;
/// ll mat[mxn][mxn], prime[mxn], isprime[mxn];
ll phi[mxn];
string str,s;char ch[27][27] ;
ll exgcd(ll a,ll b, ll &x ,ll &y){    if(!a&&!b) return -1;    if(!b) {x=1,y=0;return a;}    ll d=exgcd(b,a%b,y,x);    y-=a/b*x ;    return d;}
int vis[mxn][mxn];
int a[mxn];
int check(int x)
{
    int ans = 0 ;
    rp(n) ans+=(x-a[i])*(x-a[i]);
    return ans;
}
int main()
{
    cin>>n;
    int l = 1e3 ,r = -1;
    rp(n) {cin>>a[i];l = min(a[i],l) , r = max(a[i],r) ;}
    int mx = INF;
    for(int k=l;k<=r;k++)
    {
            int ans = check(k) ;
            if(ans < mx )
                m = k , mx = ans ;

    }
    cout<<mx<<endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n;
    cin >> n;
    map<string, int> mp1, mp2;
    forn(i, n) {
        string cur;
        cin >> cur;
        mp1[cur]++;
    }
    int m;
    cin >> m;
    forn(i, m) {
        string cur;
        cin >> cur;
        mp2[cur]++;
    }
    int mx = 0;
    for (auto x : mp1) {
        mx = max(mx, x.S - mp2[x.F]);
    }
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 256
/* ＵＴＦ－８ */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	long K, N;
	std::vector<long> P;
	std::cin >> N >> K;
	P.resize(N);
	for (auto& p : P)
		std::cin >> p;

	long result2 = 0;
	for (long i = 0; i < K; ++i)
		result2 += P[i];

	long rmax = result2;
	for (long i = K; i < N; ++i) {
		result2 -= P[i - K];
		result2 += P[i];
		rmax = std::max(rmax, result2);
	}
	rmax += K;
	std::cout << (rmax / 2) << (rmax % 2 == 1 ? ".5" : "") << "\n";
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll a[110000][3];
ll dp[110000][3];
int main(){
    ll n;
    cin>>n;
    rep(i,0,n){
        rep(j,0,3){
            cin>>a[i][j];
        }
    }
    rep(i,1,n+1){
        rep(j,0,3){
            rep(k,0,3){
                if(j==k)continue;
                dp[i][k]=max(dp[i-1][j]+a[i-1][k],dp[i][k]);
            }
        }
    }
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));
}


Measured memory_bytes: 5120
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>

#define N 128

using namespace std;

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int i;

  for ( ; ; )
  {
    typedef pair<int, int> Point;
    vector<int>   ans;
    vector<Point> lis;
    int n, w, d;

    scanf ( "%d%d%d", &n, &w, &d );
    if ( !( n | w | d ) ) break ;
    lis.push_back ( make_pair ( w, d ) );

    for ( i = 0; i < n; ++i )
    {
      Point tg;
      int p, s;

      scanf ( "%d%d", &p, &s );
      tg = lis[ p - 1 ];
      lis.erase ( lis.begin ( ) + p - 1 );

      s %= ( tg.first + tg.second );
      if ( s > tg.first )
      {
        s -= tg.first;
        lis.push_back ( make_pair ( tg.first, min ( s, tg.second - s ) ) );
        lis.push_back ( make_pair ( tg.first, max ( s, tg.second - s ) ) );
      }
      else
      {
        lis.push_back ( make_pair ( min ( s, tg.first - s ), tg.second ) );
        lis.push_back ( make_pair ( max ( s, tg.first - s ), tg.second ) );
      }
    }

    for ( vector<Point>::iterator it = lis.begin ( )
        ; it != lis.end ( ); ++it )
    {
      ans.push_back ( it->first * it->second );
    }
    sort ( ans.begin ( ), ans.end ( ) );

    for ( vector<int>::iterator it = ans.begin ( )
        ; it != ans.end ( ); ++it )
    {
      if ( it != ans.begin ( ) )  putchar ( ' ' );
      printf ( "%d", *it );
    }
    puts ( "" );
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
using namespace std;
typedef long long ll;
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
 
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b){
	ll g=gcd(a,b);
	return a/g*b;
}
 
ll digitsum(ll a){
	ll x=0;
	while(a>0){
		x+=a%10;
		a/=10;
	}
	return x;
}
int main(){
	char x,y;
	cin>>x>>y;
	if(x>y)cout<<'>'<<endl;
	else if(x==y)cout<<'='<<endl;
	else cout<<'<'<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll

typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<bool> > vvb;
typedef map<int, bool> mib;

typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vpll;

typedef vector<string> vs;

typedef long double ld;

#define _GLIBCXX_DEBUG

#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n-1); i >= 0; --i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << '\n'
#define debug3(x, y, z) cerr << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << '\n'
#define debugs(s) cerr << s << "\n"
#define hyphen() cerr << "--\n"

#define ALL(vec) (vec).begin(), (vec).end()
#define REVALL(vec) (vec).rbegin(), (vec).rend()

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

#define fst first
#define snd second
#define pb push_back
#define mk(x,y) make_pair((x),(y))

// http://ehafib.hatenablog.com/entry/2015/12/23/164137
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qpm(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a, int b) { return a / gcd(a, b) * b; }


#define sz(v) int(v.size())

// x1, x2ライブラリとの被りを避ける
#define x1 x192837465
#define x2 x123456789
#define y1 y192837465
#define y2 y123456789

// typo
#define itn int
#define reutrn return
#define reutnr return

#define make(type, x) type x; cin>>x;
#define make2(type, x, y) type x, y; cin>>x>>y;
#define make3(type, x, y, z) type x, y, z; cin>>x>>y>>z;
#define make4(type, x, y, z, t) type x, y, z, t; cin>>x>>y>>z>>t;

const int MOD = (int)1e9 + 7;
const int INF = numeric_limits<int>::max();

signed main() {
    make2(int, N, K);

    int ans = lcm(N, K);
    cout << ans << endl;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  100010

using namespace std;
int MOD = 1000000007;
vector<vector<ll>> dp(N,vector<ll>(2));

int add_edge(vector<vector<int>> &g, int x , int y ){
    g[x].push_back(y);
    g[y].push_back(x);
    return 0;
}

int dfs1(vector<vector<int>> &g,int cur,int fa){
    int isleaf = 1;
    for(int i = 0 ; i < g[cur].size() ; i++ ){
        if( fa != g[cur][i] ){
            isleaf = 0;
            dfs1(g,g[cur][i],cur);
        }
    }
    if( isleaf == 1 ){
        //cout << "leaf :" << cur  << " fa :" << fa << endl;
        dp[cur][0] = 1;
        dp[cur][1] = 1;
    }
    return 0;
}

int dfs2(vector<vector<int>>& g,int cur,int fa){
    //0 is black
    //1 is white
    if( g[cur].size() == 1 && g[cur][0] == fa ){
      dp[cur][0] = 1;
      dp[cur][1] = 1;
      return 0;
    }
    for(int i = 0 ; i < g[cur].size() ; i++ ) if(g[cur][i] != fa ){
        dfs2(g,g[cur][i],cur);
    }
    ll cnt0 = 1;
    ll cnt1 = 1;
    for(int i = 0 ; i < g[cur].size() ; i++ ) if( g[cur][i] != fa ){
        cnt0  = (cnt0 * dp[g[cur][i]][1]) % MOD;
    }
    for(int i = 0 ; i < g[cur].size() ; i++ ) if( g[cur][i] != fa ){
        cnt1 = (cnt1 * (dp[g[cur][i]][1]+dp[g[cur][i]][0]) % MOD ) % MOD;
        
    }
    dp[cur][0] = cnt0;
    dp[cur][1] = cnt1;
    return 0;
}

int main(){
    int n;
    cin >> n;
    vector<vector<int>> g(n+1);
    vector<int> isroot(n+1,1);
    for(int i = 0 ; i < n-1 ; i++ ){
        int n1,n2;
        cin >> n1 >> n2;
        add_edge(g,n1,n2);
        isroot[n2] = 0;
        //add_edge(g,n2,n1);
    }
    //root == 1
    int root = 0;
    for( int i = 1 ; i <= n ; i++ ){
      if( isroot[i] == 1 ){
        root = i;
        break;
      }
    }

    //dfs1(g,root,-1);//find leaf and initialize
    dfs2(g,root,-1);//clac the # of ways
    int ret =  (dp[root][1] + dp[root][0] ) % MOD;
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 14720
#include <stdio.h>

typedef struct { char suit, value; } Card;

void bubble(Card A[], int N) {
  int i,j;
  Card t;
  for(i = 0; i<N; i++) {
    for(j = N-1; j >= i; j--) {
      if(A[j].value < A[j-1].value) {
        t = A[j]; A[j] = A[j-1]; A[j-1] = t;
      }
    }
  }
}

void selection(Card A[], int N) {
  int i,j,minj;
  Card t;
  for(i=0;i<N;i++) {
    minj = i;
    for(j=i; j<N; j++) {
      if(A[j].value < A[minj].value) minj = j;
    }
    t = A[i]; A[i] = A[minj]; A[minj] = t;
  }
}

void print(Card A[], int N) {
  int i;
  for(i=0; i<N; i++) {
    if(i>0) printf(" ");
      printf("%c%d",A[i].suit,A[i].value);
  }
  printf("\n");
}

int isStable(Card C1[], Card C2[], int N) {
  int i;
  for(i=0; i<N; i++) {
    if(C1[i].suit != C2[i].suit) return 0;
  }
  return 1;
}

/* オリジナル関数を追加 */
void str2Card(Card *t,char str[]) {
    t->suit  = str[0];
    t->value = str[1] - '0';
}

int main(void) {
  Card C1[100], C2[100];
  int N,i;
  char str[3];

  scanf("%d",&N);
  for(i=0;i<N; i++) {
    scanf("%s",str);
    str2Card(&C1[i],str);
  }

  for(i=0; i<N; i++) C2[i] = C1[i];

  bubble(C1,N);
  selection(C2,N);

  print(C1,N);
  printf("Stable\n");
  print(C2,N);
  if(isStable(C1,C2,N)) {
    printf("Stable\n");
  } else {
    printf("Not stable\n");
  }

  return 0;
}




Measured memory_bytes: 2104
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
#include <algorithm>
#include <array>
#include <string.h>
#include <vector>



bool isTasai(char buf[],int mojisu) {
	if (mojisu < 0) {
		return false;
	}
	if (mojisu == 1) {
		return true;
	}

	char buf2[27];
	strcpy(buf2, buf);

	std::sort(buf2,buf2+mojisu);
	for (int i = 0; i < mojisu-1; i++) {
		if (buf2[i] == buf2[i + 1]) {
			return false;
		}
	}
	
	return true;
}

char SmallestUnseen(char buf[], int mojisu) {
	char remain[26];
	remain[0] = 'a';
	for (int i = 1; i < 26; i++) {
		remain[i] = remain[i - 1] + 1;
	}

	for (int i = 0; i < mojisu; i++) {
		remain[buf[i] - 'a'] = 0;
	}

	for (int i = 0; i < 26; i++) {
		if (remain[i] != 0) {
			return remain[i];
		}
	}
	return 0;
}


int main()
{
	char buf[27];
	scanf("%s", buf);

	int mojisu = strlen(buf);

	if (strcmp(buf, "zyxwvutsrqponmlkjihgfedcba")==0) {
		printf("-1");
		return 0;
	}

	while (1) {

		if (mojisu < 26) {
			buf[mojisu] = SmallestUnseen(buf,mojisu); buf[mojisu + 1] = '\0'; mojisu++;
			goto check;
		}

		if (mojisu == 26) {
			std::vector<char> pbuf;
			for (int i = 0; i < 25; i++) {
				if (buf[24-i] > buf[25-i]) {
					pbuf.push_back(buf[25 - i]);
					buf[25 - i] = '\0'; mojisu--;
				}
				else {
					pbuf.push_back(buf[25 - i]);
					buf[25 - i] = '\0'; mojisu--;
					std::sort(pbuf.begin(), pbuf.end());
					for (char c : pbuf) {
						if (buf[24 - i] < c) {
							buf[24 - i] = c;
							goto check;
						}
					}
				}

			}



		}


	

	check:
		if (isTasai(buf, mojisu)) {
			printf("%s", buf);
			return 0;
		}
	}






    return 0;
}

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

int main(void) {
  string S, T;
  cin >> S >> T;
  int index = -1;
  for (int i = 0; i < S.length() - T.length() + 1; i++) {
    bool flag = true;
    for (int j = 0; j < T.length(); j++) {
      if (S[i + j] != '?' && S[i + j] != T[j]) {
        flag = false;
        break;
      }
    }

    if (flag) index = i;
  }

  if (index == -1) {
    cout << "UNRESTORABLE" << endl;
  } else {
    for (int i = 0; i < T.length(); i++) {
      S[index + i] = T[i];
    }
    for (int i = 0; i < S.length(); i++) {
      if (S[i] == '?') S[i] = 'a';
    }
    cout << S << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
const long long mod = 1e9+7;
long long inv2 = -1;
std::vector<int> g[200005];
long long f[200005];
int parent[200005];
int count[200005];
long long power[200005];

long long pow(long long a,long long b){
    long long res = 1;
    while(b){
        if(b&1) res = (res*a)%mod;
        a = (a*a)%mod;
        b /= 2;
    }
    return res;
}

void preWork(int n){
    power[0] = 1;
    for(int i = 1; i <= n; i++){
        power[i] = power[i-1]*inv2%mod;
    }
}

void dp(int u,int n){
    count[u] = 1;
    long long p = ((1ll - power[n-1])%mod + mod)%mod;
    for(unsigned int i = 0; i < g[u].size(); i++){
        int v = g[u][i];
        if(count[v]!=0) continue;
        dp(v,n);
        long long minus = ((1ll-power[count[v]])%mod+mod)%mod*(power[n-count[v]-1])%mod;
        p = ((p - minus)%mod+mod)%mod;
        count[u] += count[v];
    }
    long long minus = ((1ll-power[n-count[u]])%mod+mod)%mod*(power[n-(n-count[u])-1])%mod;
    p = ((p - minus)%mod+mod)%mod;
    //printf("p = %lld\n",p);
    f[u] = p*inv2%mod;
}

//分点算贡献
int main(){
    inv2 = pow(2ll,mod-2);
    preWork(200000);
    int n;
    scanf("%d",&n);
    for(int i = 0; i < n-1; i++){
        int u,v;
        scanf("%d%d",&u,&v);
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dp(1,n);
    long long ans = 0;
    for(int i = 1; i <= n; i++){
        ans = (ans + f[i])%mod;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 27008
import java.util.*;
class Main
{
  static int gcd(int a, int b) 
    { 
        if (a == 0) 
            return b; 
        return gcd(b % a, a); 
    } 
    static int findGCD(int arr[], int n) 
    { 
        int result = arr[0]; 
        for (int i = 1; i < n; i++) 
            result = gcd(arr[i], result); 
  
        return result; 
    } 
  public static void main(String args[])
  {
    long sum=0;
    int a[]=new int [3];
    Scanner sc=new Scanner(System.in);
    int k=sc.nextInt();
    for(int i=1;i<=k;i++)
    {
      for(int j=1;j<=k;j++)
      {
        for(int x=1;x<=k;x++)
        {
            a[0]=i;
          	a[1]=j;
          	a[2]=x;
        	sum+=findGCD(a,3);
        }
      }
    }
    System.out.println(sum);        
  }
}

Measured memory_bytes: 35736
S = input()
c = 0
for i, s in enumerate("keyence"):
    if s == S[i]:
        c += 1
    else:
        break
S = S[::-1]
for i, s in enumerate("keyence"[::-1]):
    if s == S[i]:
        c += 1
    else:
        break

if c >= len("keyence"):
    print("YES")
else:
    print("NO")


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

int main(){
	int x; cin>>x;
	if(x==7||x==5||x==3) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
//priority_queue<int> pque;
//priority_queue<int, vector<int>, greater<int>> pque;
//cout << fixed << setprecision(10) << ans << endl;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;

double p[3010];
double dp[3010][3010];

int main(void){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> p[i];
    }
    dp[0][0] = 1;
    
    for(int i = 1; i <= N; i++){
        for(int j = 0; j <= i; j++){
            if(j - 1 >= 0){
                dp[i][j] = p[i-1] * dp[i-1][j-1] + (1.0 - p[i-1]) * dp[i-1][j];
            }else{
                dp[i][j] =(1.0 - p[i-1]) * dp[i-1][j];
            }
        }
    }
    double ans = 0;
    for(int i = N / 2 + 1; i <= N; i++){
        ans += dp[N][i];
    }
    
    cout << fixed << setprecision(10) << ans << endl;
    
}


Measured memory_bytes: 69120
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> c(h);
  rep(i, h) cin >> c.at(i);
  int ans = 0;
  rep(bit1, 1 << h){
    rep(bit2, 1 << w){
      int co = 0;
      rep(i, h){
        if((bit1 & (1 << i)) != 0) continue;
        rep(j, w){
          if((bit2 & (1 << j)) != 0) continue;
          if(c.at(i).at(j) == '#')co++;
        }
      }
      if(co == k) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3612
s=input()

if s[0]=='R':
    if  s[1]=='R':
        if s[2]=='R':
            print('3')
        else:
            print('2')
    else:
        print('1')
else:
    if s[1]=='R':
        if s[2]=='R':
            print('2')
        else:
            print('1')
    elif s[2]=='R':
        print('1')
    else:
        print('0')

Measured memory_bytes: 9060
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1192&lang=jp
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
using ll = long long;
using namespace std;

int const MOD = 1e9 + 7;

int main(void)
{
    int x, y, s;
    while (cin >> x >> y >> s, x)
    {
        int maxV = 0;
        for (int i = 1; i < s; ++i)
        {
            for (int j = 1; j < s; ++j)
            {
                if (i * (100 + x) / 100 + j * (100 + x) / 100 == s)
                {
                    maxV = max(maxV, i * (100 + y) / 100 + j * (100 + y) / 100);
                }
            }
        }
        cout << maxV << endl;
    }
    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
using namespace std;
int main(){
  int age, yen;
  cin >> age >> yen;
  if(age >= 13) cout << yen << endl;
  else if((age >= 6) && (age <= 12)) cout << yen/2 << endl;
  else cout << "0" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 10;
char s[N];
int n;
int num[N];
signed main(void){
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++){
		if(s[i]=='L')
			continue;
		int sum[2];
		sum[0]=sum[1]=0;
		int depth=0;
		int zz=i + 1;
		bool cp=(s[i]=='R'?1:0);
		sum[0]=1;
		depth=1;
		while(zz<=n){
			bool pc=(s[zz]=='R'?1:0);
			if((pc^cp)==0){
				sum[depth&1]++;
				depth++;
			}
			else if ((pc^cp)==1){
				num[zz-1]+=sum[(depth-1)&1];
				num[zz]+=sum[(depth)&1];
				i = zz;
				depth=0;
				break;
			}
			zz++;
		}
	}
	for(int i=n;i>=1;i--){
		if(s[i]=='R')
			continue;
		int sum[2];
		sum[0]=sum[1]=0;
		int depth=0;
		int zz=i - 1;
		bool cp=(s[i]=='R'?1:0);
		sum[0]=1;
		depth=1;
		while(zz<=n){
			bool pc=(s[zz]=='R'?1:0);
			if((pc^cp)==0){
				sum[depth&1]++;
				depth++;
			}
			else if ((pc^cp)==1){
				num[zz+1]+=sum[(depth-1)&1];
				num[zz]+=sum[(depth)&1];
				i = zz;
				depth=0;
				break;
			}
			zz--;
		}
	}
	for(int i=1;i<=n;i++)
		printf("%d ",num[i]);
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
 
using namespace std;
 
#define ALL(x) x.begin(), x.end()
 
typedef long long int lld;
typedef pair<int, int> pii;
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(15);
	cout << fixed;
 
	int n = 0;
	cin >> n;

	int cnt = 0;

	for (int i = 1; i <= n; i++) {
		int x = 0;
		cin >> x;
		if (i != x)
			cnt++;
	}

	if (cnt > 2)
		cout << "NO" << '\n';
	else
		cout << "YES" << '\n';

	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  a--;b--;c--;d--;
  int ans=INF;
  loop(i,1,n+1){
    int p=abs(a%i-b%i)+abs(a/i-b/i);
    int q=abs(c%i-d%i)+abs(c/i-d/i);
    ans=min(ans,p+q);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define p1 first
#define p2 second
vector<pair<int, int>> ball(55);

int main(){
    // 1. 入力情報取得.
    int N;
    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        int x, y;
        scanf("%d %d", &x, &y);
        ball[i] = {x, y};
    }
    
    // 2. ボールの回収コスト.
    // (p, q) として, 一番出現するものを計算.
    map<pair<int, int>, int> m;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(i != j){
                int p = ball[i].p1 - ball[j].p1;
                int q = ball[i].p2 - ball[j].p2;
                m[{p, q}]++;
            }
        }
    }
    
    // 3. 一番出現する (p, q) の 個数.
    int maxCount = 0;
    for(auto &p : m){
        maxCount = max(maxCount, p.p2);
        // printf("{p11=%d p12=%d} p2=%d\n", p.p1.p1, p.p1.p2, p.p2);
    }
    
    // 4. 出力.
    printf("%d\n", N - maxCount);
    return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            
            List<int> Input = new List<int>();

            for(int i = 0; i < 10001; i++)
            {
                Input.Add(int.Parse(Console.ReadLine()));

                if (Input[i] == 0) break;
            }

            for(int x = 0; x < Input.Count - 1; x++)
            {
                Console.WriteLine("Case {0}: {1}", x + 1, Input[x]);
            }

        }


    }

}

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

int main() {
  string s1,s2,s3;
  cin >> s1 >> s2 >> s3;
  cout << "A" << s2.at(0) << "C\n";
}

Measured memory_bytes: 256
// In the name of God 
#include <bits/stdc++.h>

using namespace std ;
 
#define int long long
#define all(v) v.begin() , v.end()

template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

int a , b ; 

int32_t main()                     
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> a >> b ;
	if ( a <= 0 && b >= 0 )
		return cout << "Zero\n" , 0 ;
	if ( a > 0 && b > 0 )
		return cout << "Positive" , 0 ;
	int len = b - a + 1 ;
	if ( len % 2 == 0 )
		return cout << "Positive" , 0 ;
	cout << "Negative" ; 
}


Measured memory_bytes: 256
/**
 * File              : a.cpp
 * Author            : recurze
 * Date              : 23:55 20.01.2019
 * Last Modified Date: 23:55 20.01.2019
 */
#include <cstdio>

void readInput();
void solve();
void printAns();

int main() {
    int t = 1;
    //(void)scanf("%d", &t);

    for (int tc = 1; tc <= t; ++tc) {
        readInput();
        solve();
        printAns();
    }
}

const int N = 1010101;

int a = 0, b = 0, c = 0;
void readInput() {
    (void)scanf("%d%d%d", &a, &b, &c);
}

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

int ans = 0;
void solve() {
    ans = a*b*c>>1;
    ans /= max(a, max(b, c));
}

void printAns() {
    printf("%d\n", ans);
}


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

typedef long long ll;
int dsort(const void *A,const void *B){return *(ll*)A<*(ll*)B?1:0;}

long long test2[400000000];

int main(void){
    int x,y,z,k;
    scanf("%d%d%d%d",&x,&y,&z,&k);
    long long a[x],b[y],c[z];
    for (int i=0; i<x; i++){
        scanf("%lld",&a[i]);
    }
    for (int i=0; i<y; i++){
        scanf("%lld",&b[i]);
    }
    for (int i=0; i<z; i++){
        scanf("%lld",&c[i]);
    }
    qsort (a,x,sizeof(ll),dsort);
    qsort (b,y,sizeof(ll),dsort);
    qsort (c,z,sizeof(ll),dsort);
    
    long long test[x*y];
    int count=0;
    for (int i=0; i<x; i++){
        for (int j=0; j<y; j++){
            test[count]=a[i]+b[j];
            count++;
        }
    }
    qsort (test,count,sizeof(ll),dsort);
    int count3=3000<count?3000:count;
    
    int count2=0;
    for (int i=0; i<count3; i++){
        for (int j=0; j<z; j++){
            test2[count2]=test[i]+c[j];
            count2++;
        }
    }
    qsort (test2,count2,sizeof(ll),dsort);
    for (int i=0; i<k; i++){
        printf("%lld\n",test2[i]);
    }
    return 0 ;
}


Measured memory_bytes: 55976
#include<iostream>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;

int main() {
  int x1, x2, x3, x4, y1, y2, y3, y4;
  cin >> x1 >> y1 >> x2 >> y2;
  int dx = x2 - x1, dy = y2 - y1;
  x3 = x2 - dy;
  y3 = y2 + dx;
  x4 = x1 - dy;
  y4 = y1 + dx;
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
a_list = list(map(int, input().split()))
color_dic = {"gray":False, "brown":False, "green":False, "thin_blue":False, "blue":False, "yellow":False, "orange":False, "red":False, "legend":0}
for i in a_list:
    if 1<=i and i<=399:
       color_dic["gray"] = True
    elif 400<=i and i<=799:
        color_dic["brown"] = True
    elif 800<=i and i<=1199:
        color_dic["green"] = True
    elif 1200<=i and i<=1599:
        color_dic["thin_blue"] = True
    elif 1600<=i and i<=1999:
        color_dic["blue"] = True
    elif 2000<=i and i<=2399:
        color_dic["yellow"] = True
    elif 2400<=i and i<=2799:
        color_dic["orange"] = True
    elif 2800<=i and i<=3199:
        color_dic["red"] = True
    else:
        color_dic["legend"] += 1
ans = 0
for k, v in color_dic.items():
    if k!="legend":
        if v==True:
            ans += 1
ans_min = ans
ans += color_dic["legend"]
if ans_min == 0:
    if color_dic["legend"]>=1:
        ans_min = 1
print(ans_min, ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <queue>
#include <vector>
using namespace std;
int n, m, r, s, t, f, d[100000]; vector<pair<int, int> > g[100000];
int main() {
	scanf("%d%d%d", &n, &m, &r);
	for(int i = 0; i < m; i++) {
		scanf("%d%d%d", &s, &t, &f);
		g[s].push_back(make_pair(t, f));
	}
	for(int i = 0; i < n; i++) d[i] = 999999999; d[r] = 0;
	priority_queue<pair<int, int> > que; que.push(make_pair(0, r));
	while(!que.empty()) {
		int v = que.top().second; que.pop();
		for(int i = 0; i < g[v].size(); i++) {
			int u = g[v][i].first;
			int e = g[v][i].second;
			if(d[u] > d[v] + e) {
				d[u] = d[v] + e;
				que.push(make_pair(-d[u], u));
			}
		}
	}
	for(int i = 0; i < n; i++) {
		if(d[i] != 999999999) {
			printf("%d\n", d[i]);
		}
		else {
			printf("INF\n");
		}
	}
	return 0;
}

Measured memory_bytes: 12496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
vector<int>vi,vecc,vec[2];
int O,E;
struct edge
{
	int to,cap,rev;
};
vector<edge>G[405];
bool used[405];

void add_edge(int from,int to,int cap)
{
	G[from].push_back((edge){to,cap,G[to].size()});
	G[to].push_back((edge){from,0,G[from].size()-1});
}
int dfs(int v,int t,int f)
{ 
	if(v==t) return f;
	used[v]=true;
	for(int i=0;i<G[v].size();i++)
	{
		edge &e=G[v][i];
		if(!used[e.to] && e.cap>0)
		{ 
			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 max_flow(int s,int t)
{ 
	int flow=0;
	while(1)
	{ 
		memset(used,0,sizeof(used));
		int f=dfs(s,t,INF);
		if(!f) return flow;
		flow+=f;
	}
}
bool f(int v){
	for(int i=2;i*i<=v;i++) if(v%i==0) return 0;
	return 1;
}
int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		int a; cin >> a; vi.pb(a);
		if(i==0 || vi[i-1]+1 != vi[i]){
			vecc.pb(a);
		}
		if(i && vi[i-1]+1 != vi[i]){
			vecc.pb(vi[i-1]+1);
		}
		if(i==n-1){
			vecc.pb(vi[i]+1);
		}
	}
	for(int i=0;i<vecc.size();i++){
		vec[vecc[i]%2].pb(vecc[i]);
	}
	O = vec[1].size(),E = vec[0].size();
	for(int i=0;i<O;i++) add_edge(403,i,1);
	for(int i=0;i<E;i++) add_edge(O+i,404,1);
	for(int i=0;i<O;i++){
		for(int j=0;j<E;j++){
			int x = abs(vec[1][i]-vec[0][j]);
			if(x>=3 && f(x)) add_edge(i,O+j,1);
		}
	}
	int ans = max_flow(403,404);
	O-=ans; E-=ans;
	if( (O%2) + (E%2) == 2) ans += O+E+1;
	else ans += O+E;
	cout << ans << endl;
}

Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
//*********************************************DO IT NOW****************************************************************
#include<bits/stdc++.h> 
#include<random>
#define int long long   
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define mod 1000000007
#define pi 3.14159265359
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "YES"<<endl
#define no  cout<< "NO"<<endl
#define all(v) (v).begin(),(v).end()
#define s(v)   sort(v,v+n)
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" "
#define for1(i,a,n)  for(int i=0;i<n;i++)
#define rep(i, c) for(int i = 0; i < (int)c; i++)
using namespace std;
//**********************************************DO IT NOW***************************************************************
void fastio()
{  
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout); 
  #endif
  ios_base :: sync_with_stdio(false); 
  cin.tie(NULL) ; 
  cout.tie(NULL);
}
int dp[101][1001],ans1=1e9,dp1[1000001];
int num[10];
int a[1000000];
signed main()
{   
    fastio();
    int t=1;
  // cin>>t;
    while(t--)
    {    
       int n;
       cin>>n;
       int a[n];
       read(a,n);
       int c=0;
       sort(a,a+n);
       for(int i=0;i<n-1;i++)
       {
           if(a[i]==a[i+1])
           {
               c++;
               cout<<"NO";
               break;
           }

       }
       if(c==0)
       cout<<"YES";
       
    }
}
    
// 🍪 🍪 🍪


Measured memory_bytes: 5172
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}

map<ll, int> prime(ll x) {
    map<ll, int> e;
    for(int i = 2; i * i <= x; i++) {
        while(x % i == 0) {
            e[i]++;
            x /= i;
        }
    }
    if(x != 1) e[x]++;
    return e;
}
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll p; cin >> p;
    auto mp = prime(p);
    ll ans = 1;
    for(auto pl : mp){
        if(pl.second >= n){
            ans *= pow(pl.first, pl.second / n);
        }
    }

    cout << ans << "\n";
}

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

using namespace std;

typedef long long ll;
#define INF (1<<29)
#define INFF 0x7fffffff
#define LINF (1ll<<60)
#define LINFF 0x7fffffffffffffff
#define PI 3.14159265359
#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define YESNO(ans) cout << (ans?"YES":"NO") << endl;
#define pqueue priority_queue
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl '\n'

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

    char c;cin>>c;
    cout << char(c+1) << endl;

    return 0;
}


Measured memory_bytes: 256
n,k,q = map(int, input().split())
a = [int(input()) for _ in range(q)]

mem = [k - len(a)] * n
for i in range(len(a)):
    mem[a[i]-1] += 1

for i in range(n):
    if mem[i] > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 10452