akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    int N, Q; cin >> N >> Q;
    vector<vector<int>> G(N);
    vector<int> point(N, 0);
    rep(i, N - 1) {
        int a, b; cin >> a >> b; --a, --b;
        G[a].pb(b), G[b].pb(a);
    }
    rep(i, Q) {
        int p, x; cin >> p >> x; --p;
        point[p] += x;
    }
    queue<int> que;
    que.push(0);
    vector<bool> visited(N, false);
    visited[0] = true;
    while(!que.empty()) {
        int q = que.front(); que.pop();
        for(int v : G[q]) {
            if(visited[v]) continue;
            que.push(v);
            visited[v] = true;
            point[v] += point[q];
        }
    }
    rep(i, N)
        cout << point[i] << ' ';
}


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

int main() {
  int a,b,c;
  cin >> a >> b >>c;
  set<int> n;
  n.insert(a);
  n.insert(b);
  n.insert(c);
  if(n.size()==2) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
string s;
int main()
{
	cin>>s;
	if (s=="SUN")	cout<<7;
	if (s=="SAT")	cout<<1;
	if (s=="FRI")	cout<<2;
	if (s=="THU")	cout<<3;
	if (s=="WED")	cout<<4;
	if (s=="TUE")	cout<<5;
	if (s=="MON")	cout<<6;
	return 0;
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
	rep(i, 5) {
		int temp;
		scanf("%d", &temp);
		if(temp == 0) printf("%d\n", i + 1);
	}
	return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}




int main() {
   int n;
  cin >> n;
  int a=0,b=0,c=0,d=0;
  rep(i,n) {
    string s;
    cin >> s;
    if(s=="AC") a++;
    if(s=="WA") b++;
    if(s=="TLE") c++;
    if(s=="RE") d++;
  }
  cout << "AC x " << a << endl;
    cout << "WA x " << b << endl;
    cout << "TLE x " << c << endl;
    cout << "RE x " << d << endl;
    return 0;
}


Measured memory_bytes: 3628
/*****************************************************

*****************************************************/

#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define pb push_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define ip pair<int, int>

#define loop(i,n) for(int i=0;i<n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1e9+7;
const ll SZ = 107;
const ll N = 2e5+7;
const ll inf = 1e17;

int pwr(int x, int y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x) % MOD;
        y >>= 1;
        x = (x * x) % MOD;
    }
    return r % MOD;
}

int inv(int x)
{
    return pow(x, MOD-2);
}

void solve()
{
    int a,b,c,d; cin>>a>>b>>c>>d;
    a--;
    int gcd = __gcd(c, d);
    int lcm = c*d/gcd;
    int ans = b-(b/c)-(b/d) + b/lcm;
    // cout<<ans<<" ";
    int x = a - (a/c) - (a/d) + a/lcm;
    cout<<ans-x;
}

signed main()
{
    fast;

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

/*****************************


****************************/

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int N,a,b,pre,sum=0,sai;
	cin>>N;
	for(int i=1;i<=9;i++)for(int j=1;j<=9;j++){
		a=b=0;
		for(int k=i;k<=N;k+=10){
			pre=k;
			while(pre>0){
				sai=pre;
				pre/=10;
			}
			if(sai==j)b++;
		}
		for(int k=j;k<=N;k+=10){
			pre=k;
			while(pre>0){
				sai=pre;
				pre/=10;
			}
			if(sai==i)a++;
		}
		sum+=a*b;
	}
	cout<<sum;
	return 0;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))
#define endl '\n'

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second

typedef long long ll;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <ll, ll> pll;
typedef pair <double, double> pd;

//change these according to prob constraints
const int INF = 0x3f3f3f3f;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
//g++ -std=c++11 your_file.cpp -o your_program

ll mypow(ll a, ll b){
	ll ans=1;
	while(b){
		if(b&1)
			ans=(ans*a)%MOD;
		b/=2;
		a=(a*a)%MOD;
	}
	return ans;
}

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ifstream in("");
	ofstream out("");
	clock_t begin = clock();
	int n;
	cin >> n;
	string arr[MAX];
	REP(i, n){
		string s;
		cin >> s;
		sort(ALL(s));
		arr[i] = s;
	}
	sort(arr, arr + n);
	int ct = 1;
	ll res = 0;
	FOR(i, 1, n){
		if (arr[i] == arr[i - 1]){
			++ct;
		}
		else{
			if (ct > 1) res += (ll)ct * (ct - 1) / 2;
			ct = 1;
		}
	}
	if (ct > 1) res += (ll)ct * (ct - 1) / 2;
	cout << res << endl;
	clock_t end = clock();
    double esecs = double(end - begin) / CLOCKS_PER_SEC;
    //cout << esecs << " seconds" << endl;
	return 0;	
}

Measured memory_bytes: 5760
l[10];main(v,V,i,s){for(;~scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",l,l+1,l+2,l+3,l+4,l+5,l+6,l+7,l+8,l+9,&v,&V);printf("%d\n",i+1)){
for(i=s=0;i<10;i++)s+=l[i];
double t=s*1.0/(v+V),p=v*t-.1;
for(i=s=0;i<10;i++)if(s+=l[i],s>p)break;
}exit(0);}

Measured memory_bytes: 592
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
    int X, A, B;
    cin >> X >> A >> B;
    int t = B - A;
    if(t <= 0) cout << "delicious" << endl;
    else if(t <= X) cout << "safe" << endl;
    else cout << "dangerous" << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
ans = int(N * (N + 1) / 2 - (N // 3) * (N // 3 + 1) / 2 * 3 - (N // 5) * (N // 5 + 1) / 2 * 5 + (N // 15) * (N // 15 + 1) / 2 * 15)
print(ans)

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

int main(){
  int N;
  cin >> N;
  vector<int> Lower(N);
  for(int i = 0; i < N; i++)
  cin >> Lower.at(i);
  int sum = 0;
  int maxLower = 0;
  for(int i = 0; i < N - 1; i++){
    if(Lower.at(i) < Lower.at(i + 1))
    sum = 0;
    else{
      sum++;
      maxLower = max(maxLower,sum);  
    }
  }
  cout << maxLower << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

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

        Pattern pattern = Pattern.compile("ABC");
        Matcher matcher = pattern.matcher(s);
        int count = 0;
        while (matcher.find()) {
            count++;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll d, c[30] = {}, s[370][30] = {}, last[30] = {}, ans[30][30][370] = {}, bestk = 0, bestl = 0, sum = 0, newsum = 0;

int main() {
	cin >> d;
	rep(i, 26)cin >> c[i];
	rep(i, d) {
		rep(j, 26)cin >> s[i][j];
	}
	rep(k, 26) {
		last[k] = 0;
		rep(l, 26) {
			last[l] = 1;
			for (int i = 2; i < 26; i++)last[i] = -1;
			for (int i = 2; i < 26; i++) {
				ll satisfaction = -1000000, contest = 0;
				rep(j, 26) {
					if (satisfaction < s[i][j] + c[j] * (i - last[j])) {
						satisfaction = s[i][j] + c[j] * (i - last[j]);
						contest = j;
					}
					ans[k][l][i] = contest;
					last[contest] = i;
				}
				newsum += satisfaction;
			}
			if (sum < newsum) {
				newsum = sum;
				bestk = k;
				bestl = l;
			}
		}
	}
	rep(i, d)cout << ans[bestk][bestl][i] + 1 << endl;
	return 0;
}

Measured memory_bytes: 5724
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

int isPrime(LL p){
	if(p<=1) return 0;
	if(p==2 || p==3 || p==5 || p==7) return 1;
	if(p==4 || p==6 || p==8 || p==9) return 0;

	LL i;
	int ret = 1;
	for(i=2; i*i<=p; i++){
		if(p%i==0 && i!=p){
			ret = 0;
			break;
		}
	}
	return ret;
}

void factorize(long long N, map<long long, int> &mp){
	if(N == 1){
		return;
	}
	if(isPrime(N)){
		mp[N] += 1;
		return;
	}

	long long i = 2, n = N;
	for(i = 2; n != 1 && i < (N/2) + 1; i++){
		if((n % i)==0){
			if(isPrime(i)){
				int e = 0;
				long long u = n;
				while((u % i)==0){
					e++;
					u = u / i;
					n = u;
				}
				mp[i] = e;
				if(isPrime(n)){
					mp[n] = 1;
					break;
				}
			}
		}
	}
	return;
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL N, P;
	cin >> N >> P;

	map<long long, int> mp;
	factorize(P, mp);

	LL ans = 1;
	for(auto itr = mp.begin(); itr != mp.end(); itr++){
		LL k = itr->first;
		int v = itr->second;
		if(v >= N){
			LL u = v / N;
			for(int i=1; i<=u; i++){
				ans *= k;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

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

using namespace std;

vector<int> next_int_vector(int n) {
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v.at(i);
    }
    return v;
}

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> a = next_int_vector(n);
    vector<int> b = next_int_vector(m);

    vector<long> a_cum(n + 1), b_cum(m + 1);
    a_cum[0] = 0;
    b_cum[0] = 0;
    for (int i = 0; i < n; ++i) {
        a_cum.at(i + 1) = a_cum.at(i) + a.at(i);
    }
    for (int i = 0; i < m; ++i) {
        b_cum.at(i + 1) = b_cum.at(i) + b.at(i);
    }

    int max = 0;
    for (int i = 0; i <= n; ++i) {
        long a_sum = a_cum.at(i);
        if (k < a_sum) continue;
        int b_count = distance(b_cum.begin(), --upper_bound(b_cum.begin(), b_cum.end(), k - a_sum));

        int count = i + b_count;
        if (max < count) {
            max = count;
        }
    }
    cout << max << endl;
}


Measured memory_bytes: 7988
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    printf("%d\n", s.size());
}

Measured memory_bytes: 9596
n,a,b,c = map(int,input().split())

l = []
for i in range(n):
    l.append(int(input()))

def dfs(cnt,for_a,for_b,for_c):
    if cnt==n:
        if for_a != 0 and for_b != 0 and for_c != 0:
            return abs(a-for_a) + abs(b-for_b) + abs(c-for_c) - 30
        else:
            return 10**10
    else:
        return min(dfs(cnt+1,for_a,for_b,for_c),\
                   dfs(cnt+1,for_a+l[cnt],for_b,for_c) + 10,\
                   dfs(cnt+1,for_a,for_b+l[cnt],for_c) + 10,\
                   dfs(cnt+1,for_a,for_b,for_c+l[cnt]) + 10)

print(dfs(0,0,0,0))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<algorithm>
#include<iostream>
#include<stack>
#include<stdio.h>
#include<string.h>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
priority_queue<int>que;
struct Node {
    int day;
    int price;
};
int cmd(Node a , Node b){
    return a.day==b.day?a.price>b.price:a.day<b.day;
}
int main(){
    int n,m;
    cin >>n >>m;
    Node p[100000];
    for(int i=0;i<n;i++)
        cin >>p[i].day>>p[i].price;
    sort(p,p+n,cmd);
    int num=0,cnt=0,sum=0;
    for(int j=0;j<m;j++){
        num=0;
        while(p[cnt].day<=j+1&&cnt<=n)
        {
            que.push(p[cnt].price);
            cnt++;
        }
        if(que.empty()==0)
        {
            sum+=que.top();
            que.pop();
        }
    }
    cout<<sum<<endl;
     return 0;
}


Measured memory_bytes: 1660
#include<stdio.h>
#include<math.h>

typedef struct{
  double x,y;
}p;

void koch(int n,p,p);

int main(){

  p a,b;
  int n;

  scanf("%d",&n);

  a.x=0;
  a.y=0;
  b.x=100;
  b.y=0;

  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);


  return 0;
}


void koch(int n,p a,p b){
  p s,t,u;
  double th =M_PI *60.0/180.0;
  
  if(n==0) return;
  s.x = (2.0 * a.x + 1.0 * b.x)/3.0;
  s.y = (2.0 * a.y + 1.0 * b.y)/3.0;
  t.x = (1.0 * a.x + 2.0 * b.x)/3.0;
  t.y = (1.0 * a.y + 2.0 * b.y)/3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y-s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y-s.y) * cos(th) + s.y;

  koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,b);
}





Measured memory_bytes: 2048
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; //mp::cpp_intで宣言
using namespace std;
typedef long long ll;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
//#define i_5 (ll)(1E9+5)
#define i_5 998244351
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////

int main(){
    ll a,b,c;cin>>a>>b>>c;
    if(c<=a+b){
        cout<<b+c<<endl;
    }else{
        c=a+b+1;
        cout<<b+c<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
import Control.Applicative

swap [x,y] | x > y = [y,x]
swap [x,y]         = [x,y]

main = do
    ss <- words <$>getLine
    let x:y:_ = swap $ take 2 [ read s | s <- ss]
    
    if x+y>0 then do
      putStrLn $ show x ++ " " ++ show y
      main
    else return()

Measured memory_bytes: 4060
#include<stdio.h>
int main(){
  int n,i;
  double x,sum=0;
  char u[5];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%lf%s",&x,u);
    if(u[0]=='J'&&u[1]=='P'&&u[2]=='Y'){
      sum+=x;
    }
    else {
      sum+=380000*x;
    }
  }
  printf("%lf",sum);
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> cards(N);
  for (int i = 0; i < N; i++) {
    cin >> cards.at(i);
  }
  
   
  sort(cards.begin(), cards.end());
  int Alice_sum = 0;
  int Bob_sum = 0;

    
  if (N % 2 == 0) {
    for (int i = 0; i < N / 2; i++) {
      Alice_sum += cards.at(2 * i + 1);
      Bob_sum += cards.at(2 * i);
    }
  }
  
  else {  
  	for (int i= 0; i < N / 2; i++) {
      Alice_sum += cards.at(2 * i);
      Bob_sum += cards.at(2 * i + 1);
    }
    Alice_sum += cards.at(N - 1);

  }
  cout << Alice_sum - Bob_sum <<endl;
 

}


Measured memory_bytes: 256
//21171_somesh || asomesh999

#include<bits/stdc++.h>
using namespace std;
#define fr(i,a,b) for(long long i=a;i<b;i++)
#define io ios::sync_with_stdio(false);cin.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
long int mod=1000000007;

template<typename T>
void debug(T arr) {
	for(auto it : arr) {
		cout << it << ' ';
	}
	cout << '\n';
}

int n, m;
vector<vector<char>> mat;
vector<vi> visited, dist;
int X[] = {0, 0, 1, -1};
int Y[] = {1, -1, 0, 0};

bool check(int x, int y) {
	return (x >= 0 && x < n && y >= 0 && y < m && mat[x][y] == '.');
}

void dfs(int x, int y) {
	visited[x][y] = 1;
	fr(i, 0, 4) {
		int dx = x + X[i], dy = y + Y[i];
		if (check(dx, dy) && visited[dx][dy] == 0) {
			dist[dx][dy] = dist[x][y] + 1;
			dfs(dx, dy);
		} else if (check(dx, dy) && dist[dx][dy] > dist[x][y] + 1) {
			dist[dx][dy] = dist[x][y] + 1;
			dfs(dx, dy);
		}
	}
}

int main()
{
	io
	#ifdef CODE
		clock_t startTime = clock();
		freopen("input.txt","r",stdin);
	#endif

	cin >> n >> m;
	mat.resize(n, vector<char>(m));
	dist.resize(n, vi(m));
	visited.resize(n, vi(m));
	fr(i, 0, n) {
		fr(j, 0, m) {
			cin >> mat[i][j];
		}
	}
	int maxDist = 0;
	fr(i, 0, n) {
		fr(j, 0, m) {
			if (mat[i][j] == '.') {
				fr(k, 0, n) {
					fill(dist[k].begin(), dist[k].end(), 0);
					fill(visited[k].begin(), visited[k].end(), 0);
				}
				dfs(i, j);
				fr(k, 0, n) {
					// debug(dist[i]);
					fr(l, 0, m) {
						maxDist = max(maxDist, dist[k][l]);
					}
				}
			}
		}
	}
	cout << maxDist;

	#ifdef CODE
		cerr << endl <<setprecision(20)<< double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;
	#endif
	return 0;
}

Measured memory_bytes: 256
import itertools
N = int(input())
xy = []
for _ in range(N):
    x, y = map(int, input().split())
    xy.append([x, y])

cnt = list(itertools.permutations(xy))
ans = []
for c in cnt:
    ky = []
    for n in range(N-1):
        k = ((c[n][0]-c[n+1][0])**2+(c[n][1]-c[n+1][1])**2)**(1/2)
        ky.append(k)
    ans.append(sum(ky))
print(sum(ans)/len(ans))

Measured memory_bytes: 15736
#include<stdio.h>
int main(){
    int N, T;
    scanf("%d %d", &N, &T);
    int lower=10000;
    for(int i=0;i<N;i++){
        int c, t;
        scanf("%d %d", &c, &t);
        if(t<=T&&c<lower){
            lower=c;
        }
    }
    if(lower==10000){
        printf("TLE\n");
        return 0;
    }
    printf("%d\n",lower);
    return 0;
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int l=s.size();
  if((s.compare(l-1, 1, "s")) == 0){
    s.append("es");
  }
  else{
    s.append("s");
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<30)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll ans;
  ll A,B,K;
  cin >> A >> B >> K;
  int ma=max(A,B);
  int cnt=0;
  for(int i=ma;i>=1;i--){
    if(A%i==0 && B%i==0){
      cnt++;
      if(cnt==K){
        cout << i << endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
		char s[3];
		scanf("%s",s);
		int i,a=0,b=0,c=0;
		for(i=0;i<3;i++){
				if(s[i]=='a')a++;
				if(s[i]=='b')b++;
				if(s[i]=='c')c++;
		}
		if(a==1&&b==1&&c==1)puts("Yes");
		else puts("No");

		return 0;
}


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

using namespace std;

const int MAX_N = 123456;

long long N, C;
long long x[MAX_N], v[MAX_N], cw[MAX_N], ccw[MAX_N], max_query[MAX_N];

int main() {
  cin >> N >> C;
  for (int i = 0; i < N; ++i) cin >> x[i] >> v[i];
  long long res = 0;
  for (int i = 0; i < N; ++i) {
    cw[i] = v[i] - (i == 0 ? x[i] : (x[i] - x[i - 1]));
    if (i - 1 >= 0) cw[i] += cw[i - 1];
    res = max(res, cw[i]);
  }
  for (int i = N - 1; i >= 0; --i) {
    ccw[i] = v[i] - (i == N - 1 ? (C - x[i]) : (x[i + 1] - x[i]));
    if (i + 1 < N) ccw[i] += ccw[i + 1];
    res = max(res, ccw[i]);
  }

  for (int i = N - 1; i >= 0; --i) {
    max_query[i] = ccw[i];
    if (i + 1 < N) max_query[i] = max(max_query[i], max_query[i + 1]);
  } 
 
  for (int i = 0; i + 1 < N; ++i) {
    res = max(res, cw[i] - x[i] + max_query[i + 1]);
  }

  for (int i = 0; i < N; ++i) {
    max_query[i] = cw[i];
    if (i - 1 >= 0) max_query[i] = max(max_query[i], max_query[i - 1]);
  }
  for (int i = N - 1; i - 1 >= 0; --i) {
    res = max(res, ccw[i] - (C - x[i]) + max_query[i - 1]);
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 4480
using System;
using System.Linq;

namespace ABC117D
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            long[] NK = Console.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
            long N = NK[0];
            long K = NK[1];
            long[] A = Console.ReadLine().Split(' ').Select(b => long.Parse(b)).ToArray();

            int[] bits = new int[50];

            for (int i = 0; i < N; i++)
            {
                long Ai = A[i];
                for (int j = 0; j < 50; j++)
                {
                    if (Ai % 2 == 1)
                    {
                        bits[j]++;
                    }

                    Ai = Ai >> 1;
                    if (Ai == 0)
                    {
                        break;
                    }
                }
            }

            bool[] Kbit = new bool[50];
            long KK = K;
            long bit = 1;
            for (int i = 0; i < 49; i++)
            {
                if (KK % 2 == 1)
                {
                    Kbit[i] = true;
                }

                bit *= 2;
                KK = KK >> 1;
            }

            long ans = 0;
            bool any = false;
            for (int i = 49; i >= 0; i--)
            {
                if (any | Kbit[i])
                {
                    if (N - bits[i] < bits[i])
                    {
                        any = true;
                    }
                    ans += Math.Max(N - bits[i], bits[i]) * bit;
                }
                else
                {
                    ans += bits[i] * bit;
                }

                bit /= 2;
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 31324
s = input()
l_s = list(s)
K = int(input())
if K == 1:print(min(l_s));exit()
elif K == 2:
    idx = s.index(min(l_s))
    if idx < len(s)-1:
        print(s[idx:idx+2])
    else:
        print(sorted(l_s)[1])
    exit()
sub = {s}
for d in range(1,6):
    for i in range(len(s)-d+1):
        sub |= {s[i:i+d]}
sub = list(sub)
n = len(sub)
for i in range(K):
    for j in range(n-i):
        a, b = sub[-i-1], sub[j]
        if a > b: sub[-i-1], sub[j] = b, a
print(sub[-K])

Measured memory_bytes: 4476
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
ll x;
cin>>x;
while(true)
{
    bool flag=true;
    for(ll i=2;i*i<=x;i++)
    {
        if(x%i==0)
        {
            flag=false;
            break;
        }
    }
    if(flag)
    {
        break;
    }
    x++;
}
cout<<x<<endl;
return 0;
}


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

int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	if(n&1)for(int i=1;i<=m;i++){
		printf("%d %d\n",i,n-i);
	}
	else{
		int cnt = 0;
		for(int i=1;cnt<m&&i<=n/4;cnt++,i++){
			printf("%d %d\n",i,n/2-i+1);
		}
		int cur = 1;
		for(int i=n/2+1;cnt<m;i++,cnt++){
			printf("%d %d\n",i,n-cur);
			cur++;
		}
	}
}


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

typedef pair<long long, long long> P;

int main() {
	int A, B;
	int Acount = 0, Bcount = 0;
	static bool X[100][100] = {};
	cin >> A >> B;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			if (i < 50) X[i][j] = true;
			else X[i][j] = false;
		}
	}
	for (int i = 0; i < 55; i++) {
		for (int j = (i % 2) * 2; j < 100; j+=4) {
			Acount++;
			if (Acount < A) {
				X[i][j] = false;
			}
		}
	}
	for (int i = 99; i >= 50; i--) {
		for (int j = (i % 2) * 2; j < 100; j += 4) {
			Bcount++;
			if (Bcount < B) {
				X[i][j] = true;
			}
		}
	}
	cout << "100 100" << endl;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			if (X[i][j]) cout << '#';
			else cout << '.';
		}
		cout << endl;
	}
}

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

int main(){
  int n,m;
  priority_queue <int> a;

  scanf("%d %d", &n ,&m);

  int i;
  int x;
  for(i = 0;i < n;i++){
    scanf("%d", &x);
    a.push(x);
  }

  int t;
  if(n == 1){
    t = a.top();
    while(t > 0 && m > 0){
      t /= 2;
    }

    printf("%d\n", t);
    return 0;
  }

  while(m){
    t = a.top();
    a.pop();
    t = t/2;
    a.push(t);
    m--;
  }

  ll ans = 0;
  while(!(a.empty())){
    ans += a.top();
    a.pop();
  }

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

  return 0;
}

Measured memory_bytes: 892
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    h,w = map(int, input().split())
    A = [input() for _ in range(h)]

    print('#'*(w+2))
    for i in range(h):
        print('#' + A[i] + '#')
    print('#'*(w+2))


if __name__ == '__main__':
    main()


Measured memory_bytes: 63748
#include<iostream>
#include<string>

using namespace std;

int main(){
	string s, s2 = "AKIHABARA";
	cin >> s;
    int x = 0, y = 0;
    while(1){
        if(x > s.size() - 1){
            if(y < s2.size() - 1){
                cout << "NO" << endl;
                return 0;
            }else{
                break;
            }
        }else if(y >= s2.size()){
            if(x < s.size()){
                cout << "NO" << endl;
                return 0;
            }else{
                break;
            }
        }
        if(s[x] != s2[y]){
            if(y < s2.size() - 1 && s2[y] == 'A'){
                y++;
            }else{
                cout << "NO" << endl;
                return 0;
            }
        }else{
            x++;
            y++;
        }
    }
	cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 998244353;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
ll A[MAX_N];

ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a % b);
}

void solve() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];
	sort(A, A + N);
	ll res = 1;
	rep(i, 0, N) MUL(res, gcd(A[i], i));
	cout << res << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
using ll = long long;
using ld = long double;

int main()
{
    int D, N;
    cin >> D >> N;

    int pow = 1;
    while ( D-- > 0 ) pow *= 100;

    if ( N == 100 ) ++N;

    cout << pow * N << endl;

    return 0;
}

Measured memory_bytes: 256
fn main(){
    let mut s=String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut n:usize=s.trim().parse().unwrap();
    let mut v=vec![false;n+1];
    v[1]=true;
    for i in 2..32{
        let mut x=i*i;
        while x<=n{
            v[x]=true;
            x*=i;
        }
    }
    while !v[n]{
        n-=1;
    }
    println!("{}",n);
}

Measured memory_bytes: 4352
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        String S = sc.next();
        String ans = "Yes";
        if(S.charAt(A)!='-') ans = "No";
        for(int i=1;i<=A;i++){
            if(S.charAt(i-1)<'0'||S.charAt(i-1)>'9') ans = "No";
        }
        for(int i=A+2;i<=A+B+1;i++){
            if(S.charAt(i-1)<'0'||S.charAt(i-1)>'9') ans = "No";
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 23764
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b := intScanner(), intScanner()
	fmt.Println((a + b) % 24)
}


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

#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
using namespace std;
using ll = long long;

/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/

ll gcd(ll a, ll b)
{
  if (a < b)
  {
    return gcd(b, a);
  }
  while (b != 0)
  {
    ll tmp = b;
    b = a % b;
    a = tmp;
  }
  return a;
}
void apply(vector<vector<int>> &t, vector<int> &c, vector<int> &v, int i) {
  v[i] = 1;
  for (int nextIdx : t[i]) {
    if (v[nextIdx] == 0) {
      c[nextIdx] += c[i];
      v[nextIdx] = 1;
      apply(t, c, v, nextIdx);
    }
  }
}
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N, Q;
    cin >> N >> Q;

    vector<vector<int>> T(N);
    vector<int> C(N);
    vector<int> V(N);
    loop(0, N-1, i) {
      int t1, t2;
      cin >> t1 >> t2;
      t1--;
      t2--;
      T[t1].push_back(t2);
      T[t2].push_back(t1);
    }

    loop(0, Q, i) {
      int j, n;
      cin >> j >> n;
      j--;
      C[j] += n;
    }

    apply(T, C, V, 0);

    loop(0, N, i) {
      if (i != N-1) {
        cout << C[i] << " ";
      } else {
        cout << C[i] << endl;
      }
    }
}

Measured memory_bytes: 28236
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;

/*

A ~ B => 0 ~ B - 0 ~ (A - 1)
累積和とかと同じ考え方
ex)
4 ~ 8 -> (0 ~ 8) - (0 ~ 3)

A xor B = C
=>    C    xor    A    =    B
    0 ~ 8       0 ~ 3     4 ~ 8

こう考えると
問題は，0 ~ A のxorの値を求める．

*/

ll calc (ll A) {
    ll cnt1 = (A + 1) / 2;
    ll ans = cnt1 % 2;
    if (A % 2 == 0) ans ^= A;
    return ans;
}

int main() {

    ll A, B;
    cin >> A >> B;
    ll ans = calc(B) ^ calc(A-1);
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

int main(){
	int a, b, c;
	
	scanf("%d %d %d", &a, &b, &c);
	
	if(a+b==2 || c==1) printf("Open\n");
	else printf("Close\n");

	return 0;
}

Measured memory_bytes: 1172
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b, c;
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		if (a <= b) {
			if (c <= a)
				System.out.println(c + " " + a + " " + b);
			else if (b <= c)
				System.out.println(a + " " + b + " " + c);
			else
				System.out.println(a + " " + c + " " + b);
		} else {
			if (a <= c)
				System.out.println(b + " " + a + " " + c);
			else if (c <= b)
				System.out.println(c + " " + b + " " + a);
			else
				System.out.println(b + " " + c + " " + a);
		}		
	}
}


Measured memory_bytes: 26408
def find(x):
  if x == T[x]:
    return x
  x = T[x]
  return find(x)

def mergeT(x, y):
  a = find(x)
  b = find(y)
  if a != b:
    if NumTable[a] > NumTable[b]:
      T[b] = a
      NumTable[a] += NumTable[b]
    else:
      T[a] = b
      NumTable[b] += NumTable[a]

N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
AB.reverse()

T = [i for i in range(N + 1)]
NumTable = [1 for i in range(N + 1)]

L = []
Ans = N * (N - 1) // 2
for i in AB:
  L.append(Ans)
  a = find(i[0])
  b = find(i[1])
  if a != b:
    ta = NumTable[a]
    tb = NumTable[b]
    mergeT(a, b)
    Ans -= (ta + tb) * (ta + tb - 1) // 2  - ta * (ta - 1) // 2 - tb * (tb - 1) // 2
    mergeT(a, b)

for i in L[::-1]:
  print(i)



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

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int h,w; cin >> h >> w;
	int n; cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	int now=1;
	int fi[h][w];
	int cnt=0;
	for(int i=0;i<w;i++){
		if(i%2==0){
			for(int j=0;j<h;j++){
				if(a[now-1]==cnt){
					now++;
					cnt=0;
				}
				fi[j][i]=now;
				cnt++;
			}
		}
		else{
			for(int j=h-1;j>=0;j--){
				if(a[now-1]==cnt){
					now++;
					cnt=0;
				}
				fi[j][i]=now;
				cnt++;
			}
		}
	}
	for(int i=0;i<h;i++){
		cout << fi[i][0];
		for(int j=1;j<w;j++){
			cout << " " << fi[i][j];
		}
		cout << endl;
	}
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

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

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

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

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

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

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

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

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

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

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

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

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

const int mod = 1e9 + 7;

signed main() {
  int x, a;
  cin >> x >> a;
  print(x < a ? 0 : 10);
}


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

using namespace std;

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

	string str = " == ";

	if (a < b)
	{
		str = " < ";
	}
	else if (a > b)
	{
		str = " > ";
	}
	
	cout << "a" << str << "b" << endl;


	return 0;
}


Measured memory_bytes: 3140
s=input()
n=len(s)
r=0
p=0
ans=0
for i in s:
    if i=='g':#rock
        if r>=p+1:
            ans+=1
            p+=1
        else:
            r+=1
    else:
        #paper
        if r>=p+1:
            p+=1
        else:
            r+=1
            ans-=1
print(ans)



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

int main()
{
	int i, n, maxm=0;
	cin >> n;
	int inp[n+1], a[n+1], b[n+1];
	inp[0]=a[0]=b[0]=0;

	for(i=1; i<=n; i+=1)
		cin >> inp[i];

	for(i=1; i<=n; i+=1)
		a[i]=__gcd(inp[i], a[i-1]);
	b[n]=inp[n];
	for(i=n-1; i>=1; i-=1)
		b[i]=__gcd(inp[i], b[i+1]);
	for(i=2; i<=n-1; i+=1)
	{
		int t1=__gcd(a[i-1], b[i+1]);
		if(t1>maxm)
			maxm=t1;
	}
	if(b[2]>maxm)
		maxm=b[2];
	if(a[n-1]>maxm)
		maxm=a[n-1];

	cout << maxm << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#define ll long long
using namespace std;

ll mod=1000000007;

ll modpow(ll a, ll b, ll m){
    ll res=1, p=0, now=a;
    for(int i=0; b>p; ++i){
        if(b&((ll) 1<<i)){
            res=(res*now)%m;
            p |= ((ll) 1<<i);
        }
        now=(now*now)%mod;
    }
    return res;
}
ll modinv(ll a, ll m){
    return modpow(a, m-2, m);
}
ll moddiv(ll a, ll b, ll m){
    return (a*modinv(b, m))%m;
}

const int arm=200100;
ll fac[arm], finv[arm], inv[arm];
void COMinit(ll m){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2; i<arm; ++i){
        fac[i]=(fac[i-1]*i)%m;
        inv[i]=m-(inv[m%i]*(m/i))%m;
        finv[i]=(finv[i-1]*inv[i])%m;
    }
}
ll COM(ll n, ll k, ll m){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return (fac[n]*((finv[k]*finv[n-k])%m))%m;
}

int main() {
	ll N, A, B, C;
	cin >> N >> A >> B >> C;
	ll p=0, q=modpow(A+B, 2*N-1, mod);
	COMinit(mod);
	for(int i=0; i<N; ++i){
	    ll r=(((modpow(A+B, N-i-1, mod)*COM(N+i-1, i, mod))%mod)*(N+i))%mod, s;
	    s=(A*((modpow(A, N-1, mod)*modpow(B, i, mod))%mod))%mod;
	    s=(s+((B*((modpow(B, N-1, mod)*modpow(A, i, mod))%mod))%mod))%mod;
	    p=(p+(r*s)%mod)%mod;
	}
	p=(p*100)%mod;
	q=(q*(A+B))%mod;
	cout << moddiv(p, q, mod) << endl;
	return 0;
}


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

int main() {
	int n;
	cin >> n;
	double p[n];
	for (int i = 0; i < n; i++) cin >> p[i];
	double dp[3010][3010] = { 0 };
    dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= i; j++) {
			dp[i + 1][j + 1] += dp[i][j] * p[i];
			dp[i + 1][j] += dp[i][j] * (1 - p[i]);
		}
	}
	double ans = 0;
	int a = (n + 1) / 2;
	for (int x = a; x <= n; x++) {
		ans += dp[n][x];
	}
	cout << setprecision(10) << ans << endl;
}

Measured memory_bytes: 71168
from collections import Counter

n = int(input())
counter = Counter(input())
for _ in range(n - 1):
    counter2 = Counter(input())
    for k in counter.keys():
        if counter2[k] > 0:
            counter[k] = min(counter[k], counter2[k])
        else:
            counter[k] = 0

ans = ''
for k in sorted(counter.keys()):
    ans += k * counter[k]

print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include<algorithm>

using namespace std;

int main()
{
	int a[3],i,res=1;
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	for (i = 1; i < 3; i++) {
		if (a[i - 1] != a[i])res++;
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;
int main(){
  ll x;
  cin >> x;
  ll ans = 0;
  ans = x/11 * 2;
  int r = x%11;
  if(r != 0){
    if(r <= 6) ans++;
    else ans += 2;
  }
  cout << ans << endl;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c; cin>>a>>b>>c;
    if (a+b==c||a+c==b||b+c==a){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), T = sc.nextInt();
        int ans = 1001;
        for (int i = 0; i < n; i++) {
            int c = sc.nextInt(), t = sc.nextInt();
            if (t <= T) ans = Math.min(ans, c);
        }
        System.out.println(ans==1001? "TLE": ans);
    }
}


Measured memory_bytes: 23252
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

const string MINUS_INF = "-";

int g_cost[10] = {0,2,5,5,4,5,6,3,7,6};

string g_dp[11000]; // n本のマッチを使って作れる最大の整数文字列

void init_dp() {
  for(int i=0; i<11000; i++) {
    g_dp[i] = MINUS_INF;
  }
  g_dp[0] = "";
}

void chmax(string& a, string b) {
  if(a == MINUS_INF) a = b;
  else if(a.size() < b.size()) a = b;
  else if(a.size() == b.size()) {
    if(a < b) a = b;
  }
}

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

  int N, M; cin>>N>>M;
  vector<int> A(M);
  for(int i=0; i<M; i++) {
    cin>>A[i];
  }

  init_dp();

  for(int i = 0; i <= N; i++) {
    if(g_dp[i] == MINUS_INF) {
      continue;
    }

    for(int j = 0; j < (int)A.size(); j++) {
      chmax(g_dp[i + g_cost[A[j]]], g_dp[i] + (char)('0' + A[j]));
    }
  }

  cout << g_dp[N] << endl;
}


Measured memory_bytes: 43776
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    if ((n % 10) == 0) {
      System.out.println(10);
    } else {
      String s = Integer.toString(n);
      int ans = 0;
      for (int i = 0; i < s.length(); i++) {
        ans += Character.getNumericValue(s.charAt(i));
      }
      System.out.println(ans);
    }

  }
}

Measured memory_bytes: 35492
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String w = sc.next().toLowerCase();
        String t;
        int count = 0;

        while( !((t=sc.next()).equals("END_OF_TEXT")) ){
            if(t.toLowerCase().equals(w)) count++;
        }

        System.out.println(count);
    }
}



Measured memory_bytes: 26232
# A以下の数がN個与えられる。全て素因数分解せよ。
class SpeedPrime:
    # a以下の各数の最小の素因数を記録
    def __init__(self, a):
        self.d = [i for i in range(a+1)]

        i=2
        while i*i<=a:
            if self.d[i]==i:
                j=i*i
                while j<=a:
                    if self.d[j]==j:
                        self.d[j]=i
                    j+=i
            i+=1

    # nを高速素因数分解
    def fac(self, n):
        ret = dict()
        while n!=1:
            prime=self.d[n]
            if prime in ret:
                ret[prime]+=1
            else:
                ret[prime]=1
            n=n//prime
        return ret

import math
from functools import reduce
def gcd(numbers):
    return reduce(math.gcd, numbers)

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

sp=SpeedPrime(max(a))

d=set()
pc=True
for i in a:
    prime=sp.fac(i)
    for k in prime.keys():
        if k in d:
            pc=False
            break
        else:
            d.add(k)

if pc:
    print("pairwise coprime")
    exit()

g=gcd(a)
if g==1:
    print("setwise coprime")
else:
    print("not coprime")


Measured memory_bytes: 231620
import sys
s = raw_input()
 
if s[0] == s[len(s)-1]:
    if len(s) % 2 == 0:
        print "First"
    else:
        print  "Second"
else:
    if len(s) % 2 == 0:
        print  "Second"
    else:
        print  "First"

Measured memory_bytes: 2692