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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

ll modpow(ll x, ll n, ll mod = MAX)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

//実行部
void Main()
{
  ll n, k; cin >> n >> k;
  ld ans = 0;
  ll flag;
  for(ll i = 1;i <= n;i++)
  {
    flag = i;
    ll K = 1;
    for(;flag < k;)
    {
      flag *= 2;
      K *= 2;
    }
    ans += 1. / (n * K);
  }
  fin(ans)
  return;
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    string S;
    string answer;
    cin>>S;
    for(int i=0;i<S.length();i++){
        if(S[i]=='0'){
            answer+='0';
        }
        else if(S[i]=='1'){
            answer+='1';
        }
        else if(S[i]=='B'){
            if(answer.length()!=0){
                answer.pop_back();
            }
        }
    }
    cout<<answer<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int N, K, X, Y;
  cin >> N; cin >> K; cin >> X; cin >> Y;
  unsigned long long ans;
  if(K > N) ans = N * X;
  else ans = K * X + (N - K) * Y;
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:108777216")
#define _FORTIFY_SOURCE 0
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <utility>
#include <algorithm>
#include <ctime>
#include <cstdarg>
#include <sstream>
#include <functional>
using namespace std;

int const MAX_N = 512 * 1024;

int dg[10];

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	for (int i = 0; i < 3; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--; b--;
		dg[a]++; dg[b]++;
	}
	int cnt = 0, Ok = 1;
	for (int i = 0; i < 4; i++) {
		if (dg[i] > 2) Ok = 0;
		if (dg[i] == 1) cnt++;
	}

	if (cnt == 2 && Ok) {
		cout << "YES";
	}
	else cout << "NO";
	return 0;
}


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

#define MAX_N 100

double distance(int n, int *x, int *y, int p) {
    if (p == -1) {
        double d = 0;
        for (int i = 0; i < n; i++) {
            d = fmax(d, fabs(x[i] - y[i]));
        }
        return d;
    }
    long long dp = 0;
    for (int i = 0; i < n; i++) {
        dp += pow(fabs(x[i] - y[i]), p);
    }
    double d = pow(dp, 1.0 / p);
    return d;
}

int main() {
    int n, x[MAX_N], y[MAX_N];
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", x+i);
    }
    for (int i = 0; i < n; i++) {
        scanf("%d", y+i);
    }
    double d1 = distance(n, x, y, 1);
    double d2 = distance(n, x, y, 2);
    double d3 = distance(n, x, y, 3);
    double dinf = distance(n, x, y, -1);
    printf("%f\n%f\n%f\n%f\n", d1, d2, d3, dinf);
    return 0;
}


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

int64_t MOD;
void add(int64_t& a, int64_t b){
    a = ((a+b)%MOD + MOD) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

vector<int64_t> fact, seq_inv, fact_inv;

void create_fact_mod(int num){
    fact[0] = 1;
    fact[1] = 1;
    for(int i=2; i<=num; i++){
        fact[i] = fact[i-1] * i % MOD;
    }
}

void create_seq_inv_mod(int num){
    seq_inv[0] = 1;
    seq_inv[1] = 1;
    for(int i=2; i<=num; i++){
        seq_inv[i] = (MOD - MOD/i) * seq_inv[MOD%i] % MOD;
    }
}

void create_fact_inv_mod(int num){
    fact_inv[0] = 1;
    fact_inv[1] = 1;
    for(int i=2; i<=num; i++){
        fact_inv[i] = fact_inv[i-1] * seq_inv[i] % MOD;
    }
}

void create_mod_tables(int num){
    fact.resize(num+1);
    seq_inv.resize(num+1);
    fact_inv.resize(num+1);
    create_fact_mod(num);
    create_seq_inv_mod(num);
    create_fact_inv_mod(num);
}

int64_t comb_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD;
}

int64_t perm_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}

int main(){
    cin >> MOD;
    create_mod_tables(3000);
    vector<int64_t> ans(MOD);
    for(int i=0; i<MOD; i++){
        int a;
        cin >> a;
        if(a){
            add(ans[0], 1);
            int64_t pw = 1;
            for(int k=0; k<MOD; k++){
                int64_t C = (k%2 ? -1 : 1) * comb_mod(MOD-1, k) * pw;
                add(ans[MOD-1-k], -C);
                mul(pw, i);
            }
        }
    }
    for(int i=0; i<MOD; i++) cout << ans[i] << " \n"[i==MOD-1];
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define LL long long
#define Accel ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Re(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define REP(I, N) for (int I = 0; I < (N); I++)
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define SZ(a) ((int)a.size())
#define endl "\n"
//#pragma GCC optimize(2)
using namespace std;
const int N=1e3+1;
const int M=1e9+7;
const double eps=1e-6;
typedef complex<double>C;
const double PI(acos(-1.0));
//__gcd, atan2(y,x)=y/x , __int128
//c(n,k)=c(n-1,k-1)+c(n-1,k)
//c(i,r),i for r to n =c(n+1,r+1)
//void add(int x){while(x<N)BIT[x]++,x+=x&-x;}
//int sum(int x){return x?BIT[x]+sum(x-(x&-x)):0;}
//int find(int x){return x==p[x]?x:p[x]=find(p[x]);}
//LL pw(LL a, LL b,LL M) { return b ? b & 1 ? a*pw(a, b - 1,M) % M : pw(a*a%M, b>>1,M) : 1; }
//log() = ln() , log(x)/log(y)=log(y)-base-x
//INT_MAX 127,INT_MIN 128
//int dw[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
//int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
int n,m,a,b;
char p[N][N];
int main(){
	cin>>n>>m>>a>>b;
	FOR(i,1,n)FOR(j,1,m)p[i][j]='.';
	for(int i=1;m&1&&i<n&&b>0;i+=2)
		p[i][m]='^',p[i+1][m]='v',b--;
	if(b&1&&n&1&&m>=3&&n>=3){
		if(m%2==0){
			p[n-1][m-1]='^',p[n][m-1]='v',b--;
		}
		else p[n-1][m-2]='^',p[n][m-2]='v',b--;
	}
	FOR(i,1,n-1)
		for(int j=1;j<=m-(m&1)&&b>0;j++)
			if(p[i][j]=='.'&&p[i+1][j]=='.')
				p[i][j]='^',p[i+1][j]='v',b--;
	if(b){
		cout<<"NO"<<endl;return 0;
	}
	FOR(i,1,n)
		for(int j=1;j<m&&a>0;j++)
			if(p[i][j]=='.'&&p[i][j+1]=='.')
				p[i][j]='<',p[i][j+1]='>',a--;
	if(a){
		cout<<"NO"<<endl;return 0;
	}
	cout<<"YES\n";
	FOR(i,1,n){
		FOR(j,1,m)cout<<p[i][j];
		cout<<endl;
	}
}

Measured memory_bytes: 2176
N=int(input())
SO=[int(input().replace(' ',''), 2) for i in range(N)]
PT=[list(map(int,input().split())) for i in range(N)]
ret=-10**7*N
for sp in range(1,2**10):
  r=0
  for i in range(N):
    r+=PT[i][bin(SO[i] & sp).count('1')]
  ret=max(ret,r)
print(ret)

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

int main(){
    int c[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    //a1 = 0とする
    int a[3] = {0}, b[3] = {0};
    for(int i = 0; i < 3; i++){
        b[i] = c[0][i] - 0;
    }
    for(int i = 0; i < 3; i++){
        a[i] = c[i][0] - b[0];
    }
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            if(c[i][j] != a[i] + b[j]){
                cout << "No\n";
                return 0;
            }
        }
    }
    cout <<"Yes\n";
}

Measured memory_bytes: 256
#include <iomanip>
#include <iostream>
using namespace std;
int n, m, l, p[111], t[111], v[111]; long double r[111][55], dp[55][55];
int main() {
	cin >> n >> m >> l;
	for (int i = 0; i < n; i++) cin >> p[i] >> t[i] >> v[i];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= m; j++) fill(dp[j], dp[j] + m + 1, 0.0);
		dp[0][0] = 1;
		for (int j = 0; j < m; j++) {
			for (int k = 0; k <= j; k++) {
				dp[j + 1][k] += dp[j][k] * (100 - p[i]) / 100;
				dp[j + 1][k + 1] += dp[j][k] * p[i] / 100;
			}
		}
		for (int j = 0; j <= m; j++) r[i][j] = dp[m][j];
	}
	for (int i = 0; i < n; i++) {
		long double ret = 0;
		if (v[i] != 0) {
			long double time1 = 1.0L * l / v[i];
			for (int j = 0; j <= m; j++, time1 += t[i]) {
				long double res = r[i][j];
				for (int k = 0; k < n; k++) {
					if (i == k) continue;
					long double sum = 0;
					if (v[k] != 0) {
						double time2 = 1.0 * l / v[k];
						for (int l = 0; l <= m; l++, time2 += t[k]) {
							if (time1 + 1e-10L < time2) sum += r[k][l];
						}
					}
					else sum = 1;
					res *= sum;
				}
				ret += res;
			}
		}
		cout << fixed << setprecision(15) << ret << endl;
	}
	return 0;
}

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

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

  vector<int> H(N);
  for (int i = 0; i < N; ++i) {
    cin >> H.at(i);
  }

  int ans = 0;
  for (int i = 0; i < N; ++i) {
    ans++;
    for (int j = 0; j < i; ++j) {
      if (H.at(i) < H.at(j)) {
        ans--;
        break;
      }
    }
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <unordered_map>

int main()
{
	int n, a[100010], b[100010], c[100010];
	
	std::cin >> n;
	
	for (int i = 0; i < n; ++i)
	{
		std::cin >> a[i];
	}
	
	for (int i = 0; i < n; ++i)
	{
		std::cin >> b[i];
	}
	
	for (int i = 0; i < n; ++i)
	{
		std::cin >> c[i];
	}
	
	std::sort(a, a + n);
	std::sort(b, b + n);
	std::sort(c, c + n);
	
	long long int bPrefix[100010] = { 0 };
	long long int ans = 0;
	
	for (int i = 0; i < n; ++i)
	{
		int pointer = std::upper_bound(c, c + n, b[i]) - c;
		bPrefix[i] += (n - pointer);
	}
	
	for (int i = n - 1; i >= 0; --i)
		bPrefix[i] += bPrefix[i + 1];
	
	for (int i = 0; i < n; ++i)
	{
		int pointer = std::upper_bound(b, b + n, a[i]) - b;
		ans += bPrefix[pointer] * 1LL;
	}
	
	std::cout << ans;
}

Measured memory_bytes: 2176
#include<iostream>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[100];
	int sum=0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		sum+=a[i];
	}
	int ans=4000000;
	for(int k=-100;k<=100;k++){
		int tmp=0;
		for(int i=0;i<n;i++){
			tmp+=(k-a[i])*(k-a[i]);
		}
		if(tmp<ans) ans=tmp;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <iomanip>
#include <numeric>
using namespace std;

#define INF 1e18
#define int long long

template<typename T>
void printVec(vector<T> &v) {
    for(int i = 0; i < v.size(); i++) {
        cout << v[i] << " ";
    }
    cout << endl;
}

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

    string t;
    for(int i = 0; i < n / 2; i++) {
        t.push_back(s[i]);
    }

    cout << (s == t + t ? "Yes" : "No") << endl;
    return 0;
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 200005;
int N, K;
int A[MAX_N];
vector<long double> B, rB; // 0以上, 負
int rA[MAX_N];

// mid以下となる組み合わせがK個以上ある場合はtrue
bool check(long double mid) {
  int ret = 0;

  REP(n,B.size()-1) {
    int tmp = upper_bound(B.begin()+n+1, B.end(), mid/B[n]) - (B.begin()+n+1);
    ret += tmp;
    // cerr << n << ":" << tmp << endl;
  }
  REP(n,rB.size()) {
    if(n < rB.size()-1) {
      int tmp = rB.end() - lower_bound(rB.begin()+n+1, rB.end(), mid/rB[n]);
      ret += tmp;
      // cerr << "!" << tmp << endl;
    }
    int tmp = B.end() - lower_bound(B.begin(), B.end(), mid/rB[n]);
    ret += tmp;
    // cerr << "!!" << tmp << endl;
  }

  // cerr << mid << "," << ret << endl;

  return ret >= K;
}

signed main()
{
  cin >> N >> K;
  REP(n,N) {
    cin >> A[n];
    if(A[n] >= 0) {
      B.push_back(A[n]);
    } else {
      rB.push_back(A[n]);
    }
  }

  sort(begin(B), end(B));
  sort(begin(rB), end(rB));

  int l = (int)(-1e18)-10, r = (int)(1e18)+10;
  while(r-l>1) {
    int mid = (l+r)/2;
    if(check(mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }

  cout << r << endl;

  return 0;
}


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

int main()
{
	int sum;
	while(cin >> sum){
		if(!sum)
			break;
		int price;
		for(int i=0;i<9;i++){
			cin >> price;
			sum -= price;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 0
def resolve():
    _ = input()
    an = sorted(map(int, input().split()), reverse=True)

    ans = 1
    if an[-1] == 0:
        ans = 0
    else:
        for a in an:
            ans *= a
            if ans > 10 ** 18:
                ans = -1
                break
    print(ans)
    
if __name__ == '__main__':
    resolve()

Measured memory_bytes: 88668
#include <bits/stdc++.h>
#define reg register
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define inf 0x3f3f3f3f
#define eps 1e-8
#define pi acos(-1.0)
#define e exp(1.0)
#define ios ios::sync_with_stdio(false)
#define rep(i,l,r) for(int i=(l);i<(r);i++)
using namespace std;

const int maxn = 2e5 + 10;
const int mod = 1e9 + 7;

int main()
{  
   ll a,b,c,d;
   cin>>a>>b>>c>>d;
   ll res = a * c;
   res = max(res,b * d);
   res = max(res,a * d);
   res = max(res,b * c);
   cout<<res<<endl;
   return 0;
}

Measured memory_bytes: 3632
N, M = map(int, input().split())
AB = []
for i in range(N):
    A, B = map(int, input().split())
    AB.append([A, B])
AB.sort(key=lambda x: x[0])
count = 0
money = 0
for i in range(N):
    count += AB[i][1]
    money += AB[i][0] * AB[i][1]
    if count >= M:
        money -= (count - M) * AB[i][0]
        break
print(money)


Measured memory_bytes: 21224
# Author: cr4zjh0bp
# Created: Tue Mar 24 00:01:43 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, W = na()
vw = nan(n)

dp = [[0] * (W + 1) for _ in range(n + 1)]

for i in range(n):
    v, w = vw[i]
    for j in range(W + 1):
        if j - w < 0:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = max(dp[i][j], dp[i][j - w] + v)

print(dp[n][W])


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

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using ull = unsigned long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vs = vector<string>;
using vvs = vector<vs>;
using vc = vector<char>;
using vvc = vector<vc>;
using ii = pair<int,int>;
using vii = vector<ii>;
using vvii = vector<vii>;
using dd = pair<double, double>;
using vdd = vector<dd>;
using vvdd = vector<vdd>;
using Mii = map<int,int>;
using vMii = vector<Mii>;
using Si = set<int>;
using vSi = vector<Si>;
using vvSi = vector<vSi>;

#define fi first
#define se second
#define INF 1e9 + 5
#define mod(a,m) (a%m+m)%m
#define PB push_back
#define MP make_pair

int main(){
//	cout.setf(ios::fixed);
//	cout.precision(4);
	int a, b;
	cin >> a >> b;
	cout << max(0, a - 2*b) << endl;
}



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

int main(void) {
    int n, count=1;
    string s;
    cin >> n >> s;
    if (n > 1) {
        char temp = s.at(0);
        for (int i=1; i<(int)(s.length()); i++) {
            if (s.at(i) != temp) {
                count++;
                temp = s.at(i);
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 3e5 + 9, M = 1e3 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const ll inf = 1e18;

ll arr[N];

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (int i = 1; i < n; ++i) {
    if(arr[i] == arr[i-1]) continue;
    if(arr[i] > arr[i-1])
      --arr[i];
    if(arr[i] < arr[i-1]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}


Measured memory_bytes: 1024
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

type d struct {
	idx, x, y, c int
}

type ds []d

func (dd ds) Len() int {
	return len(dd)
}
func (dd ds) Swap(i, j int) {
	dd[i], dd[j] = dd[j], dd[i]
}
func (dd ds) Less(i, j int) bool {
	return dd[i].c < dd[j].c
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	A := nextInt(sc)
	B := nextInt(sc)
	M := nextInt(sc)
	a := make([]int, A)
	mina := int(1e8)
	for i := range a {
		a[i] = nextInt(sc)
		mina = min(mina, a[i])
	}
	b := make([]int, B)
	minb := int(1e8)
	for i := range b {
		b[i] = nextInt(sc)
		minb = min(minb, b[i])
	}
	minc := mina + minb
	disc := int(1e11)
	for i := 0; i < M; i++ {
		x := nextInt(sc)
		x--
		y := nextInt(sc)
		y--
		c := nextInt(sc)
		if x < A && y < B {
			disc = min(disc, a[x]+b[y]-c)
		}
	}
	fmt.Println(min(disc, minc))
	// sort.Sort(sort.Reverse(ds(discounts)))
	// fmt.Println("A", A, "a", a, "B", B, "b", b, "minc", minc, "M", M, "disc", discounts)
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


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

int main(){
  string s;
  while(cin>>s){
    int ans=0, tmp;
    int p, pn;
    vector<int> v;
    for(int i=s.length()-1; i>=0; i--){
      if(s[i]=='I')tmp=1;
      if(s[i]=='V')tmp=5;
      if(s[i]=='X')tmp=10;
      if(s[i]=='L')tmp=50;
      if(s[i]=='C')tmp=100;
      if(s[i]=='D')tmp=500;
      if(s[i]=='M')tmp=1000;

      if(i==s.length()-1){
        p=s.length()-1;
        pn=tmp;
      }

      if(pn!=tmp){
        int tmp2=pn*(p-i);
        p=i;
        pn=tmp;
        if(ans<tmp2)ans+=tmp2;
        else ans-=tmp2;
      }

      if(i==0){
        int tmp2=pn*(p+1);
        if(ans<tmp2)ans+=tmp2;
        else ans-=tmp2;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1180
//============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>

using namespace std;



int main(){


	string str1;

	cin>>str1;

	for(int i=0; i<str1.size(); i++){

		if(i%2==0){
			cout<<str1[i];
		}



	}
	cout<<endl;









}





Measured memory_bytes: 512
import java.util.*;
import static java.lang.System.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		boolean[] flag = new boolean[4];
		char[] str = sc.next().toCharArray();
		for(char c: str) {
			if (c == 'N')
				flag[0] = true;
			if(c == 'S')
				flag[1] = true;
			if (c == 'W')
				flag[2] = true;
			if (c == 'E')
				flag[3] = true;
		}
		
		if (
			flag[0] && !flag[1] || flag[1] && !flag[0]
			|| flag[2] && !flag[3] || !flag[2] && flag[3]			
				)
			out.println("No");
		else
			out.println("Yes");
		
		out.close();
	}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
typedef long long     ll;
#define fast          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fr            first
#define sc            second
#define com(i,n)      for(int i=0;i<n;i++)
#define dom(i,n)      for(int i=1;i<=n;i++)
#define mom(i,n)      for(int i=n;i>=0;i--)
#define sortI(a,n)    sort(a,a+n)
#define sortD(a,n)    sort(a,a+n,greater<int>())
#define sortvi(a)     sort(a.begin(),a.end())
#define sortvd(a)     sort(a.begin(),a.end(),greater<int>())
#define sumall(a,x)   accumulate(a.begin(),a.end(),x)
#define pi            3.14159265358979323846264338327950
using namespace std;
int main()
{
    ll n;
    cin>>n;
    string alp="abcdefghijklmnopqrstuvwxyz";
    string a="";

    while(n>26)
    {
        a+=alp[(n-1)%26];
        n-=(n-1)%26;
        n/=26;
    }
    a+=alp[(n-1)%26];
    reverse(a.begin(),a.end());
    cout << a << endl;
}


Measured memory_bytes: 3568
n=int(input())
ans=str()
j=0
m=[" ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
while n!=0 or j==0:
    x=n%26
    if x == 0:
        x=26
        n-=1
    ans=m[x]+ans
    if n==26:
        break
    n//=26
    j=1
print(ans)


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

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

    ll N;
    cin >> N;
    string S;
    cin >> S;

    ll cum = 0;
    ll mi = 0;
    REP(i, N){
        cum += (S[i]=='(' ? 1 : -1);
        chmin(mi, cum);
    }

    while(mi<0){
        S = '('+S;
        mi++;
        cum++;
    }
    while(cum>0){
        S += ')';
        cum--;
    }
    cout << S << endl;

    

    // ll cum = 0;
    // REP(i, N){
    //     ll delta = (S[i]=='(' ? 1 : -1);
    //     if(cum+delta<0){
    //         T += '(';
    //         cum++; 
    //     }
    //     cum += delta;
    //     T += S[i];
    // }    
    // while(cum>0){
    //     T += ')';
    //     cum--;
    // }
    // cout << T << endl;


    return 0;
}

Measured memory_bytes: 3648
readline = open(0).readline
writelines = open(1, 'w').writelines
N, Q = map(int, readline().split())
ans = []
A = [[] for i in range(N)]
def push(t, x):
    A[t].append(str(x))
def dump(t):
    ans.append(" ".join(A[t]))
    ans.append("\n")
def clear(t):
    A[t] = []


C = [push, dump, clear].__getitem__
for i in range(Q):
    t, *a=map(int, readline().split())
    C(t)(*a)
writelines(ans)


Measured memory_bytes: 44068
#include<bits/stdc++.h>
using namespace std;
int main(){
   string f;
  cin>>f;
   if(f=="MON")
      cout<<"6";
  else if(f=="TUE")
     cout<<"5";
  else if(f=="WED")
      cout<<"4";
  else if(f=="THU")
     cout<<"3";
   else if(f=="FRI")
      cout<<"2";
   else if(f=="SAT")
      cout<<"1";
  else
     cout<<"7";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 305
double dp[maxn][maxn][maxn];
inline double dfs(int i, int j, int k, int n) {
    if(i < 0 || j < 0 || k < 0) return 0;
    if (dp[i][j][k] > -1) return dp[i][j][k];
    return dp[i][j][k] = (i * dfs(i-1, j+1, k, n) +
                          j * dfs(i, j-1, k+1, n) + 
                          k * dfs(i, j, k-1, n) +
                          n) / (i + j + k);
}
int main() {
    int n; scanf("%d", &n);
    int cnt[4] = {};
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        cnt[x]++;
    }
    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= n; j++)
            for (int k = 0; k <= n; k++)
                dp[i][j][k] = -10;
    dp[0][0][0] = 0;
    printf("%.9f\n", dfs(cnt[3], cnt[2], cnt[1], n));
    return 0;
}

Measured memory_bytes: 219392
#include <cstdio>
int h, w, a, b;
int main() {
	scanf("%d%d%d%d", &h, &w, &a, &b);
	for(int i=0; i<h; i++, puts("")) for(int j=0; j<w; j++) printf("%d", i<b ^ j<a);
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  cin>>n;
  for(int i=0;i<=n/4;i++){
      if((n-4*i)%7==0){
        cout<<"Yes"<<endl;
        break;
      }
      if(i==n/4){
        cout<<"No"<<endl;
      }
    }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,d[56],c;
int main(){ 
    cin>>n;
    for(int i=0;i<n;i++)cin>>d[i];
    for(int i=0;i<n;i++){
        for(int j=(i+1);j<n;j++)c+=(d[i]*d[j]);
    }
    cout<<c<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;

int n,k;

int main()
{
	if(fopen("vj.in","r"))
	{
		freopen("vj.in","r",stdin);
		freopen("vj.out","w",stdout);
	}

	scanf("%d%d",&n,&k);
	int mv=0,gcd=0;
	for(int i=1,x;i<=n;i++)
	{
		scanf("%d",&x);
		mv=max(mv,x);
		gcd=__gcd(x,gcd);
	}

	if(k%gcd || k>mv)
		puts("IMPOSSIBLE");
	else
		puts("POSSIBLE");
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm> // sort
#include <map>       // pair
#include <vector>
using namespace std;

#define REP(a,b) for(int i =(a);i < (b);i++)
#define FOR(n) for(int i = 0; i<(n); i++)
#define COUT(c)  cout<<(c)<<endl

const int INF = 100100100;
const int MOD = (int)1e9 +7;
const double EPS = 1e-9; 

typedef long long int ll;

//char in[120];
//ex. pair
//pair<pair<string,int>,int> p[110];

int main(){
    int n,m,X,Y; cin>>n>>m>>X>>Y;
    FOR(n){
        int x;cin>>x;
        if(x>X) X=x;
    }
    FOR(m){
        int y;cin>>y;
        if(y<Y) Y=y;
    }
    if(X<Y) cout<<"No War"<<endl;
    else cout<<"War"<<endl;

    return 0;    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;


int main(){
  ll a, b;
  ll r, x, tmp;

  cin >> a;
  cin >> b;

  x = a * b;

  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

  cout << x/b << endl;

  return 0;
}


Measured memory_bytes: 256
N=int(input())
row_1=list(map(lambda x:int(x),input().split()))
row_2=list(map(lambda x:int(x),input().split()))

max_value=0

for i in range(N):
    sum_row_1=sum(row_1[0:i+1])
    sum_row_2=sum(row_2[i:N])
    if max_value<sum_row_1+sum_row_2:max_value=sum_row_1+sum_row_2

print(max_value)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector <int> a(N);
    int sum = 0;
    for (int i=0; i<N;i++) {
        cin >> a[i];
        sum+=a[i];
    }
    int cost = 100000000;
    for (int q= -100; q<101; q++){
        int temp = 0;
        for (int i= 0; i<a.size(); i++) {
            temp += (a[i]-q)*(a[i]-q);

        }
        cost = min(cost, temp);
    }
    cout << cost << endl;
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef long long ll;

int main() {
int n;
   cin>>n;
  int m;
  cin>>m;
  int canf[n+1];
  int val[n+1];

  rep1(i, n){
    canf[i]=0;
    val[i]=1;}
  canf[1]=1;
  rep1(i, m){
    int x,y;
    cin>>x>>y;
    val[x]--;
    val[y]++;
    if(canf[x]==1){
      canf[y]=1;}
    if(val[x]==0){
      canf[x]=0;}
}
  
  int cnt=0;
  rep1(i, n){
    cnt+=canf[i];
    }
  
  cout<<cnt<<endl;
}


Measured memory_bytes: 1024
import sys
N, C, K = map(int, input().split())
A = list(map(int, sys.stdin.readlines()))+[10**10]
A.sort()
a, c, t = 0, 1, A[0]+K
for i in A[1:]:
    if i <= t and c < C:
        c += 1
    else:
        t, c = i + K, 1
        a += 1
 
print(a)

Measured memory_bytes: 20060
import java.util.*;
public class Main{   
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] a = new int[n+1];
      Map<Integer,Integer> map = new HashMap<Integer,Integer>();
      for(int i = 1;i <= n;i++){
        a[i]=sc.nextInt();
        map.put(a[i],i);
      }
      Arrays.sort(a);
      for(int i = 1;i <= n;i++){
      	System.out.print(map.get(a[i]));
        if(i!=n)System.out.print(" ");
      }
      System.out.println("");
    }
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

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

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

vi to[2500], ot[2500];
bool vis[2500], siv[2500];

void dfs(int v){
  if(vis[v]) return;
  vis[v] = true;
  for(int t : to[v]){
    dfs(t);
  }
}

void sfd(int v){
  if(siv[v]) return;
  siv[v] = true;
  for(int t : ot[v]){
    sfd(t);
  }
}

signed main(){
  int n, m, p;
  cin >> n >> m >> p;

  vector<tuple<int, int, int>> es;
  rep(i, 0, m){
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    es.emplace_back(a, b, p-c);
    to[a].emplace_back(b);
    ot[b].emplace_back(a);
  }

  dfs(0);
  sfd(n-1);

  vi d(n, inf);
  int step = 0;
  d[0] = 0;
  while(1){
    bool upd = false;
    for(auto e : es){
      int a, b, c;
      tie(a, b, c) = e;
      if(vis[a] and siv[a] and vis[b] and siv[b]){
        if(chmin(d[b], d[a]+c)){
          upd = true;
        }
      }
    }
    if(!upd) break;
    step++;
    if(step > n){
      cout << -1 << endl;
      return 0;
    }
  }

  cout << max(0LL, -d[n-1]) << endl;

  return 0;
}


Measured memory_bytes: 768
#include<iostream>
using namespace std;
int main(){
	int x,count=0,MSprime[40000];
	bool isMSprime[300000]={};

	for(int i=6;;i+=5){
		if(isMSprime[i]==false){
			for(int k=2;i*k<300000;k++){
				isMSprime[i*k]=true;
			}
			MSprime[count++]=i;
		}
		i+=2;
		if(i>=300000)break;
		if(isMSprime[i]==false){
			for(int k=2;i*k<300000;k++){
				isMSprime[i*k]=true;
			}
			MSprime[count++]=i;
		}
	}
	MSprime[count]=300000;

	while(1){
		cin>>x;
		if(x==1)break;
		cout<<x<<':';
		for(int i=0;MSprime[i]<=x;i++){
			if(x%MSprime[i]==0){
				cout<<' '<<MSprime[i];
			}
		}
		cout<<endl;

	}

	return 0;
}

Measured memory_bytes: 1608
#include <stdio.h>

int main(void)
{
  double v, y, t;
  int  n;

  while(scanf("%lf", &v) != EOF){

    t = v / 9.8;
    y = 4.9 * t * t;
    n = (int)((y + 5)/5)+1;

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

Measured memory_bytes: 628
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
using namespace std;

#define int long long

const int MAX = 1e18;

signed main() { 
    int h, w, ch, cw, dh, dw;
    cin >> h >> w >> ch >> cw >> dh >> dw;
    ch--; cw--; dh--; dw--;
    vector<string> s(h);
    for(int i = 0; i < h; i++) cin >> s[i];

    vector<vector<int>> dist(h, vector<int> (w, MAX));
    deque<pair<int, int>> dq;
    dq.push_front({ch, cw});
    dist[ch][cw] = 0;
    int diff[] = {-1, 0, 1, 0, -1};

    while(!dq.empty()) {
        int cy, cx;
        tie(cy, cx) = dq.front();
        dq.pop_front();
        
        for(int i = 0; i < 4; i++) {
            int ny = cy + diff[i];
            int nx = cx + diff[i + 1];
            if(ny < 0 || h <= ny || nx < 0 || w <= nx) continue;
            if(s[ny][nx] == '#') continue;
            if(dist[ny][nx] > dist[cy][cx]) {
                dist[ny][nx] = dist[cy][cx];
                dq.push_front({ny, nx});
            }
        }

        for(int i = -2; i <= 2; i++) {
            for(int j = -2; j <= 2; j++) {
                int ny = cy + i;
                int nx = cx + j;
                if(ny < 0 || h <= ny || nx < 0 || w <= nx) continue;
                if(s[ny][nx] == '#') continue;
                if(dist[ny][nx] > dist[cy][cx] + 1) {
                    dist[ny][nx] = dist[cy][cx] + 1;
                    dq.push_back({ny, nx});
                }
            }
        }
    }

    cout << (dist[dh][dw] == MAX ? -1 : dist[dh][dw]) << endl;
    return 0;
}

Measured memory_bytes: 13532
// input macro
// ref: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_mut)]
fn main() {
    input!(
        x: String,
        y: String,
    );
    if x < y {
        println!("<");
    }
    else if x > y {
        println!(">");
    }
    else {
        println!("=");
    }
    
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
         
        using namespace std;
        typedef long long ll;
        int main(){
          ll n,k;
          cin>>n>>k;
          ll a[n];ll dp[n];
          ll sum=0;
          for(int i=0;i<n;i++){cin>>a[i];dp[i]=10000000007;}
          dp[0]=0;
          for(int i=0;i<n;i++)
            {
              for(int j=i+1;j<=i+k;j++){
                if(j<n){
        		dp[j]=min(dp[j],dp[i]+abs(a[i]-a[j]));}}}
          
          cout<<fixed;
          cout<<dp[n-1]<<endl;
          }

Measured memory_bytes: 1792
#coding:utf-8

s = int(input())
li = []
li.append(s)
fl = True

while fl:
    # 要素の追加
    if li[-1] % 2 == 0:
        n = int(li[-1] / 2)
        li.append(n)
    elif li[-1] % 2 == 1:
        n = li[-1]*3 + 1
        li.append(n)

    # 一致を調べる
    for j in range(0,len(li)-1):
        if li[j] == n:
            fl = False

print(len(li))

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;


int main() {
    const long long int mod = 1000000007,INF=50000000000000;
	map<long long int, long long int>mp;
	cout << fixed << setprecision(10);
    string str[120];
    long long int n,k,x[60],y[60],x1,x2,y1,y2,res=4000000000000000000;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
    }

    for(int i=0;i<n;i++){
        x1=x[i];
        for(int j=0;j<n;j++){
            x2=x[j];
            for(int p=0;p<n;p++){
                y1=y[p];
                for(int l=0;l<n;l++){
                    y2=y[l];
                    long long int tmp=0;
                    for(int m=0;m<n;m++){
                        if((x2>=x[m]&&x[m]>=x1||x2<=x[m]&&x[m]<=x1)&&(y2>=y[m]&&y[m]>=y1||y2<=y[m]&&y[m]<=y1)){
                            tmp++;
                        }
                    }
                    if(tmp>=k){
                        res=min(res,abs((x2-x1)*(y2-y1)));
                    }
                }
            }
        }
    }
    cout<<res<<endl;
} 


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i = 0; i < n; i++)
#define invrep(i,n) for(int i = n; i > 0; i--)

double dist (int i, int j, vector<int> x, vector<int> y) {
    return pow(pow((x[i] - x[j]), 2) + pow((y[i] - y[j]), 2), 0.5);
}

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

    vector<int> idx;
    rep(i, n) idx.emplace_back(i+1);

    int p[n], q[n];
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];

    int p_n, q_n;
    bool p_f = true, q_f = true;
    int cnt = 0;
    do {
        cnt++;
        p_f = true;
        q_f = true;
        for (int i = 0; i < idx.size()-1; i++) {
            if (idx[i] != p[i]) p_f = false;
            if (idx[i] != q[i]) q_f = false;
        }

        if (p_f == true) p_n = cnt;
        if(q_f == true) q_n = cnt;
    } while(next_permutation(idx.begin(), idx.end()));
    
    // cout << cnt << endl;
    cout << abs(p_n - q_n) << endl;
}

Measured memory_bytes: 3680
import math
num=int(input())
n=math.factorial(num)
prime="2　3　5　7　11　13　17　19　23　29　31　37　41　43　47　53　59　61　67　71　73　79　83　89　97　101　103　107　109　113　127　131　137　139　149　151　157　163　167　173　179　181　191　193　197　199　211　223　227　229　233　239　241　251　257　263　269　271　277　281　283　293　307　311　313　317　331　337　347　349　353　359　367　373　379　383　389　397　401　409　419　421　431　433　439　443　449　457　461　463　467　479　487　491　499　503　509　521　523　541　547　557　563　569　571　577　587　593　599　601　607　613　617　619　631　641　643　647　653　659　661　673　677　683　691　701　709　719　727　733　739　743　751　757　761　769　773　787　797　809　811　821　823　827　829　839　853　857　859　863　877　881　883　887　907　911　919　929　937　941　947　953　967　971　977　983　991 997"
primes=prime.split()
dictionary={}

order=0
k=0
for som in primes:
    some=int(som)
    while n%some**k==0:
            k+=1 
    dictionary[som]=k-1
    k=0
ans=1
for i, v in dictionary.items():
    ans*=(v+1)
    ans=ans%(10**9+7)
print(ans)

Measured memory_bytes: 3316
#include<stdio.h>
#define MAX 100000

int A[MAX],n;

int partition(int p,int r){
  int x,i,j,t;
  x = A[r];
  i = p - 1;
  for(j=p;j<r;j++){
    if(A[j] <= x){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }

  t = A[i+1];
  A[i+1] = A[r];
  A[r] = t;
  return i + 1;
}


int main(){
  int i,q;

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

  q = partition(0,n-1);

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

  return 0;
}




Measured memory_bytes: 2128
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
ll pow(ll b, ll e) {
  if(e == 0)
    return 1LL;
  if(e % 2 == 1)
    return pow(b, e - 1) * b % mod;
  ll m = pow(b, e >> 1);
  return m * m % mod;
}
ll inv(ll a) {
  return pow(a, mod - 2);
}
ll mfact(ll n) {
  ll res = 1;
  rep(i, n) res = res * (i + 1) % mod;
  return res;
}
ll ifact(ll n) {
  ll res = 1;
  rep(i, n) res = res * inv(i + 1) % mod;
  return res;
}
ll mcomb(ll n, ll k) {
  ll res = mfact(n);
  res = res * ifact(k) % mod;
  return res * ifact(n - k) % mod;
}
const int MAX = 1000000;
int main(void) {
  ll x, y;
  cin >> x >> y;
  if((x + y) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  ll n = (2 * y - x) / 3;
  ll m = (2 * x - y) / 3;
  if(n < 0 || m < 0) {
    cout << 0 << endl;
    return 0;
  }
  cout << mcomb(n + m, n) << endl;
  return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    vector<ll> p(n),q(n),a(n);
    rep(i,n){
        cin>>p[i];
        p[i]--;
        a[i]=i;
    }
    rep(i,n){
        cin>>q[i];
        q[i]--;
    }
    ll x,y,cnt=0;
    do{
        cnt++;
        bool aok=true,bok=true;
        rep(i,n) if(a[i]!=p[i]) aok=false;
        rep(i,n) if(a[i]!=q[i]) bok=false;
        if(aok) x=cnt;
        if(bok) y=cnt;
    }while(next_permutation(all(a)));
    cout<<abs(x-y)<<endl;
    return 0;
}

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

const int INF = (int)(1 << 30);

enum OP
{
  ADD,
  DEL,
};

ostream& operator<<(ostream& os, const tuple<int, int, OP>& tpl){
  int t, x;
  OP op;
  tie(t, x, op) = tpl;
  os << t << " " << op << " " << x;
  return os;
}

int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  vector<int> S(N), T(N), X(N);
  vector<int> D(Q);
  for(int i = 0; i < N; i++){
    cin >> S[i] >> T[i] >> X[i];
  }
  for(int i = 0; i < Q; i++){
    cin >> D[i];
  }

  // vector<tuple<int, OP, int>> ev(N*2+Q);
  vector<tuple<int, int, OP>> ev;
  for(int i = 0; i < N; i++){
    ev.push_back(make_tuple(S[i] - X[i], X[i], ADD));
    ev.push_back(make_tuple(T[i] - X[i], X[i], DEL));
  }
  for(int i = 0; i < Q; i++){
    ev.push_back(make_tuple(D[i], INF, ADD));
  }

  sort(ev.begin(), ev.end());
  
#ifdef EBUG
  for(int i = 0; i < (int)ev.size(); i++){
        cout << ev[i] << endl;
  }
#endif

  int idx = 0;
  set<int> que;
  vector<int> ans(Q);
  for(int i = 0; i < (int)ev.size(); i++){
    const auto& e = ev[i];
    int t, x;
    OP op;
    tie(t, x, op) = e;

    if(x == INF){
      if(que.empty()) ans[idx] = -1;
      else ans[idx] = *que.begin();
      // if(ans[idx] == INF) ans[idx] = -1;
      idx++;
    }else{
      if(que.count(x)) que.erase(x);
      else que.insert(x);
      // if(op == ADD) que.insert(x);
      // else que.erase(x);
    }
  }
  for(const auto& a: ans){
    cout << a << endl;
  }
}


Measured memory_bytes: 22248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair

bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

vector<long long> enum_divisors(long long N){
    vector<long long> res;
    for(long long i=1;i*i<=N;i++){
        if(N%i==0){
            res.push_back(i);
            if(N/i!=i) res.push_back(N/i);
        }
    }
    sort(res.begin(),res.end());
    return res;
}

int main(){
	ll a,b;
	cin >> a >> b;
	ll n=__gcd(a,b);
	auto res=enum_divisors(n);
	ll count=0;
	for(auto p:res){
		if(is_prime(p)) count++;
	}
	cout << count+1 << endl;
}


Measured memory_bytes: 3720