akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    int H,W; cin >> H >> W;

    for(int i=0;i<H+2;i++){
        for(int j=0;j<W+2;j++){
            if(i==0 || i== H+1) cout << '#';
            else if(j==0 || j==W+1) cout << '#';
            else {char c; cin >> c; cout << c;}
            if(j == W+1) cout << endl;
        }
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <functional>
#include <utility>
#include <vector>

#define MAX_N (100000)

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  long N, K, ts[MAX_N], ds[MAX_N];
  scanf("%ld %ld", &N, &K);
  for (int i = 0; i < N; i++) {
    scanf("%ld %ld", &ts[i], &ds[i]);
    ts[i]--;  // note modified input
  }

  // zip ts and ds and sort
  vector<pair<long, long>> ps;
  for (int i = 0; i < N; i++) {
    ps.push_back(make_pair(ds[i], ts[i]));
  }
  sort(ps.begin(), ps.end(), greater<pair<long, long>>());

  // take k from ts
  vector<long> nums(N, 0);
  long num_types = 0, sum_d = 0;
  for (int i = 0; i < K; i++) {
    const long d = ps[i].first, t = ps[i].second;
    if (nums[t] == 0) {
      num_types++;
    }
    sum_d += d;
    nums[t]++;
  }

  // try other candidates by replacing
  int add_i = K, remove_i = K - 1;
  long ans = sum_d + num_types * num_types;
  while (1) {
    // look for next element to remove
    while (remove_i >= 0 && nums[ps[remove_i].second] <= 1) {
      remove_i--;
    }
    if (remove_i < 0) {
      break;
    }

    // look for next element to add
    while (add_i < N && nums[ps[add_i].second] > 0) {
      add_i++;
    }
    if (add_i >= N) {
      break;
    }

    // replace
    nums[ps[remove_i].second]--;
    nums[ps[add_i].second]++;
    num_types++;
    sum_d += ps[add_i].first - ps[remove_i].first;
    ans = max(ans, sum_d + num_types * num_types);
    add_i++, remove_i--;
  }
  printf("%ld\n", ans);

  return 0;
}

Measured memory_bytes: 4080
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		int ans = 0;
		for (int i = 0; i <= N; i++) {
			int tmp = func(S.substring(0, i), S.substring(i));
			ans = Math.max(ans, tmp);
		}

		System.out.println(ans);
	}

	static int func(String s, String t) {
		int ans = 0;
		for (char c = 'a'; c <= 'z'; c++) {
			boolean founds = false, foundt = false;
			for (int i = 0; i < s.length(); i++) {
				if (s.charAt(i) == c) {
					founds = true;
				}
			}
			for (int i = 0; i < t.length(); i++) {
				if (t.charAt(i) == c) {
					foundt = true;
				}
			}
			if(founds && foundt) ans++;
		}

		return ans;
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <cstdio>
#include <cmath>
#include <sstream>
#include <algorithm>

using namespace std;

int main() {
	string S;
	cin >> S;
	for (int i = 0; i < S.length() - 8; i++) {
		cout << S[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int X = scan.nextInt();
        int Y = scan.nextInt();
        int Z = scan.nextInt();
        int K = scan.nextInt();
        Long[] x = new Long[X];
        Long[] y = new Long[Y];
        Long[] z = new Long[Z];
        for (int i = 0; i < X; i++) {
            x[i] = scan.nextLong();
        }
        for (int i = 0; i < Y; i++) {
            y[i] = scan.nextLong();
        }
        for (int i = 0; i < Z; i++) {
            z[i] = scan.nextLong();
        }
        Arrays.sort(x, Comparator.reverseOrder());
        Arrays.sort(y, Comparator.reverseOrder());
        Arrays.sort(z, Comparator.reverseOrder());
        PriorityQueue<Long> queue = new PriorityQueue<>();
        int count = 0;
        long limit = 0;
        for (int i = 0; i < X; i++) {
            for (int j = 0; j < Y; j++) {
                for (int k = 0; k < Z; k++) {
                    if (x[i] + y[j] + z[k] < limit) {
                        break;
                    }
                    queue.add(-x[i]-y[j]-z[k]);
                }
            }
            PriorityQueue<Long> newqueue = new PriorityQueue<>();
            boolean few = false;
            Long a = null;
            for (int d = 0; d < K; d++) {
                a = queue.poll();
                if (a == null) {
                    few = true;
                    break;
                }
                newqueue.add(a);
            }
            if (!few) {
                limit = Math.max(limit, -a);
            }
            queue = newqueue;
        }
        for (int i = 0; i < K; i++) {
            System.out.println(-queue.poll());
        }
    }
}


Measured memory_bytes: 180700
#include <stdio.h>
#define N 101
#define WHITE 0
#define GRAY 1
#define BLACK 2

int t = 0;
int d[N], f[N];
int D[N][N], n;
int v;
int color[N];

void dfs(void);
void visit(int);

int main()
{
    int i, j;
    int u, k, v;

    scanf("%d", &n);

    //入力
    for (i = 1; i <= n; i++)
    {
        scanf("%d%d", &u, &k);
        for (j = 1; j <= k; j++)
        {
            scanf("%d", &v);
            D[i][v] = BLACK;
        }
    }
    //
    /*
    for(j=0;j<n;j++)
     color[j]= WHITE;
     t=0;
     
     for(u=0;u<n;u++){
       if(color[u] == WHITE)dfs(u);
     }
 */
    dfs();

    //出力
    for (i = 1; i <= n; i++)
    {
        printf("%d %d %d\n", i, d[i], f[i]);
    }

    return 0;
}

void dfs(void)
{ // int G
    //for each vertex u in V
    int i;
    int u;

    for (u = 1; u <= n; u++)
    {
        color[u] = WHITE;
    }

    t = 0;
    for (u = 1; u <= n; u++)
    {
        if (color[u] == WHITE)
            visit(u);
    }
}

void visit(int u)
{
    int i;
    int v;
    color[u] = GRAY;
    d[u] = ++t;
    //for each v in Adj[u]

    for (v = 1; v <= n; v++)
    {
        if (color[v] == WHITE && D[u][v] == BLACK)
            visit(v);
    }
    color[u] = BLACK;
    f[u] = ++t; //visit終了
}



Measured memory_bytes: 2056
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    int n;
    cin>>n;
    vector<int> v(n);
    rep(i,n){cin>>v[i];}
    int ans =0;
    for(int i=1;i<n-1;i++){
        if(v[i]>=v[i-1]&&v[i]<=v[i+1]){
            ans++;
        }else if(v[i]<=v[i-1]&&v[i]>=v[i+1]){
            ans++;
        }
    }
    cout<<ans<<endl;




    return 0;
}


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

#define int         long long
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define             push_front
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define pii         pair<int,int>
#define f           first
#define se          second
#define maxn        200005
#define sz(x)       (int)x.size()
#define mod         1000000007
#define mod2        998244353

using namespace std;

/*int power(int a,int n)
{
    if(n == 1)return a%mod;
    if(n == 0)return 1;
    if(n&1)return ((a%mod)*(power((a*a)%mod,n>>1))%mod)%mod;
    return power((a*a)%mod,n>>1)%mod;
}
ll gcd(int a,int b)
{
    if(a%b == 0)return b;
    return gcd(b,a%b);
}*/
int T,n,x,ans;
vector<int>a(maxn);


void solve(int t)
{
    cin >> n >> x;
    FOR(i,0,n)
    cin >> a[i];
    sort(a.begin(),a.begin()+n);
    FOR(i,0,n-1)
    {
        if(x >=  a[i]){x -= a[i];++ans;}
    }
    if(x == a[n-1])++ans;
    cout << ans << "\n";
    //cout << "Case #" <<t << ": " <<  ans << "\n";

}

signed main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //cin >> T;
    T=1;
    for(int t=1;t<=T;++t)
    {
        solve(t);
    }
    return 0;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define pb push_back
#define INF 999999999
#define MOD 1000000007
#define sp ' '


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int H, W, D;
    int d[90001];
    int px[90001], py[90001];
    cin >> H >> W >> D;

    int A[H][W];
    rep(i, H){
        rep(j, W){
            cin >> A[i][j];
            px[A[i][j]] = j;
            py[A[i][j]] = i;
        }
    }

    int Q;
    cin >> Q;
    int L[Q], R[Q];
    rep(i, Q) cin >> L[i] >> R[i];


    for(int i=D+1; i <= H*W; ++i)
        d[i] = d[i-D] + abs(px[i] - px[i-D]) + abs(py[i] - py[i-D]);



    cerr << endl;
    rep(i, 300){
        rep(j, 300){
            cerr << d[i] << sp;
        }
        cerr << endl;
    }


    rep(i, Q)
        cout << d[R[i]] - d[L[i]] << endl;





    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

ll n;
ll a[1000000];
ll sum = 0;


ll f(ll r){
  ll res = 0;
  rep(i,n){
    res += abs(a[i]-r);
  }

  return res;
}

int main(){

  cin>>n;
  rep(i,n){
    cin>>a[i];
    a[i]-=i+1;
  }

  ll r = 1e10,l = -1e10;
  
  while(r-l>1){
    if(f(r)>f(l)) r=(r+l)/2;
    else l = (r+l)/2;

  }


  cout<<min(f(l),f(r))<<endl;
}



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

typedef pair<int, int> P;

int N;
vector<int> X;
vector<int> Xs;

int main() {
    cin >> N;

    for(int i = 0; i < N; i++) {
        int x;
        cin >> x;
        X.push_back(x);
        Xs.push_back(x);
    }
    sort(Xs.begin(), Xs.end());    

    int m = Xs[N/2-1];
    int m2 = Xs[N/2];

    for(int i = 0; i < N; i++) {
        if(X[i] <= m) cout << m2 << endl;
        else cout << m << endl;
    }

    return 0;
}

Measured memory_bytes: 3948
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort( ALL(v) )
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;

ll MAX = 100000000000000;
ll n,h;
ll a[1000000]{};
ll b[1000000]{};

ll dp[1009][10009]{};
map<pair<ll,ll>,ll> mem;
ll minCost(ll i , ll health)
{
    if(i==n || health<=0)
        return 0;

    ll choice1 = MAX;
    ll choice2 = MAX;
    ll &ret = dp[i][health];
    if(ret!=-1)
        return ret;

    ret = MAX;

    choice1 =  b[i] + minCost(i,health-a[i]);
    if(i+1<n)
    choice2 =  minCost(i+1 , health);

    ret = min(choice1,ret);
    ret = min(choice2,ret);

    return ret;
}
int main()
{
   cin>>h>>n;

   memset(dp , -1 , sizeof(dp[0][0])*1009*10009);
   for(int i = 0 ; i<n ; i++)
   {
       cin>>a[i]>>b[i];
   }


   ll ans = minCost(0,h);
   cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 82688
#include<iostream>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,l[10000],sum=0;
	cin>>n;
	for(int i=1;i<=2*n;i++)
	{
		cin>>l[i];
	}
	sort(l+1,l+1+2*n);
	for(int i=1;i<=2*n;i+=2)
	{
		sum+=l[i];
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 256
menu = [int(input()) for i in range(5)]


high = 0
ans = 0
for i in menu:
    if i % 10 != 0:
        takai = abs(10-int(str(i)[-1]))
        #print(int(str(i)[-1]))
        #ans = ans + int(str(i)[:-1]+"0") + takai
        ans += i + takai
        if takai > high:
            high = takai
    else:
        ans += i
    #print(ans)
print(ans-high)

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

int main(){
  int N, K;
  cin >> N >> K;
  vector<char> vector(N);
  rep(i,N)
  cin >> vector.at(i);
    if(vector.at(K-1) == 'A')
      vector.at(K-1) = 'a';
      if(vector.at(K-1) == 'B')
      vector.at(K-1) = 'b';
      if(vector.at(K-1) == 'C')
      vector.at(K-1) = 'c';

  rep(i, N)
    cout  << vector.at(i);
  cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    map<char,ll> m;
    ll ans=0;
    for(int i=0;i<n;i++){
        m[s.at(i)]++;
    }
ans = m['R'] * m['G'] * m['B'];
  ll err=0;
    for(int i=0;i<n;i++){
        for(int k=i+1;k<n;k++){
            if((k+i)%2==0){
                if(s.at(i) != s.at(k) && s.at(k) !=s.at((k+i)/2) && s.at((k+i)/2) != s.at(i)){
                    err++;                
                }
            }
        }
    }
    cout << ans - err << endl;
}


Measured memory_bytes: 3600
N,M = map(int,input().split())
ABlist = [tuple(map(int,input().split())) for _ in range(N)]
ABlist.sort()
money = 0
for AB in ABlist:
    maz_num = AB[1]
    maz_pri = AB[0]
    add_m = maz_pri*maz_num
    if M > 0:
        money += add_m
        M -= maz_num
    if M == 0:
        break
    if M < 0:
        while M!=0:
            money -= maz_pri
            M += 1
        break

print(money)

Measured memory_bytes: 16984
#include<bits/stdc++.h>
using namespace std;
int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = a * x + b * y;
    int t1 = min(x, y) * 2 * c;
    t1 += (x - min(x, y)) * a + (y - min(x, y)) * b;
    ans = min(ans, t1);
    ans = min(max(x, y) * 2 * c, ans);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include<iostream>
using namespace std;
int main(){
    char a[200000];
    scanf("%s",a);       
    printf("%c",a[0]);
    scanf("%s",a);       
    printf("%c",a[0]);
    scanf("%s",a);       
    printf("%c",a[0]);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 10000

int main(void){
  int i,num,j;
  int a,b,n,c;
  double d;
  int s[N];

  for(i=0;
      scanf("%d%d%d",&a,&b,&n)==3;
      i++){
    s[i]=0;
    for(j=0;j<n;j++){
      a%=b;
      a*=10;
      s[i]+=a/b;
    }
  }
  num=i;
  for(i=0;i<num;i++){
    printf("%d\n",s[i]);
  }
  return 0;
}

Measured memory_bytes: 0
from math import atan
from math import degrees

a,b,x = map(int,input().split())
s = x/a
hoge = a*b/2
if hoge < s:
  ans = atan(2*b/a-2*x/a**3)
elif hoge > s:
  ans = atan(a*b**2/2/x)
else:
  ans = atan(b/a)
print(degrees(ans))

Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
int h, w;
string s[64];
string t[64];

void func(int x, int y) {
  int n = 0;
  int d[] = {1, 0, -1};
  if (s[y][x] == '#')
    return;

  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (d[i] == 0 && d[j] == 0)
        continue;
      int xx = x + d[j], yy = y + d[i];
      if (0 <= xx && xx < w && 0 <= yy && yy < h && s[yy][xx] == '#')
        n++;
    }
  }
  t[y][x] = '0' + n;
}

int main(void) {
  cin >> h >> w;
  for (int i = 0; i < h; i++) {
    cin >> s[i];
    t[i] = s[i];
  }
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++)
      func(j, i);
  for (int i = 0; i < h; i++)
    cout << t[i] << endl;
}


Measured memory_bytes: 384
import sys
sys.setrecursionlimit(10 ** 9)

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

T1, T2 = rl()
A1, A2 = rl()
B1, B2 = rl()

if T1 * A1 + T2 * A2 == T1 * B1 + T2 * B2:
    print('infinity')
    exit()
if (A1 > B1 and A1 * T1 + A2 * T2 > B1 * T1 + B2 * T2) or \
        (A1 < B1 and A1 * T1 + A2 * T2 < B1 * T1 + B2 * T2):
    print(0)
    exit()
diff = abs(A1-B1) * T1
diff2 = abs(T1 * A1 + T2 * A2 - (T1 * B1 + T2 * B2))
x, y = divmod(diff, diff2)
print(x * 2 if y == 0 else x * 2 + 1)


Measured memory_bytes: 3064
#include <cstdio>
int main() {
	int n, t, sum = 0;
	scanf("%d", &n);
	t = n;
	while(n) {
		sum += n%10;
		n /= 10;
	}
	if(t % sum == 0) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;using vll = vector<ll>;
int main(){
  ll n;
  cin >> n;
  vll a(3*n);
  for (ll i = 0; i < 3*n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  
  ll ans=0;
  for (ll i = 3*n-2; i > n-2; i-=2) ans += a[i];
  
  cout << ans << endl;
}

Measured memory_bytes: 2560
program sample
	implicit none
    character(len=3) ::a,b,c
    integer :: x(3)
    
    read(*,*) a,b,c
    
    
    write(*,'(a,X,a,X,a)') trim(adjustl(c)),trim(adjustl(a)),trim(adjustl(b))
    
    stop
end program sample



Measured memory_bytes: 2724
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1129&lang=jp

while arr = gets.split(" ").map(&:to_i)
  n , r = arr
  break if n == 0 && r == 0
  arr = n.times.map{|i| i+1}
  r.times.each do
    p, c = gets.split(" ").map(&:to_i)

    arr = arr[0...n-p-c+1] + arr[n-p+1...n] + arr[n-p-c+1...n-p+1]
  end
  p arr.last
end

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

int main(void){
    int n ;
    int sco[1001] ;
    int i ;
    double s , m , t , x , ans ;
    
    while(1){
        
        scanf("%d" , &n) ;
        if(n == 0){break ;}
        for(i = 0 ; i < n ; i++){
            scanf("%d" , &sco[i]) ;
        }
        
        
        s = 0 ;
        m = 0 ;
        for(i = 0 ; i < n ; i++){
            s += sco[i] ;
        }
        m = s / n ;
    
    
    
    t = 0 ;
    for(i = 0 ; i < n ; i++){
        x = sco[i] - m ;
        x = pow(x , 2) ;
        t += x ;
    }
    ans = t / n ;
    ans = sqrt(ans) ;
    
    printf("%f\n" , ans) ;
    
    }
    return 0 ;
}


Measured memory_bytes: 2052
import sys
sys.setrecursionlimit(10**6)

n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]

mod = 10**9+7

memo = [-1]*(2**n)
memo[0] = 1

def dfs(state, c):
    if memo[state] != -1:
        return memo[state]
    r = 0
    for i in range(n):
        if state & (1 << i) and A[c][i]:
            r += dfs(state ^ (1 << i), c+1)
    memo[state] = r%mod
    return r
print(dfs(2**n-1, 0)%mod)

Measured memory_bytes: 62044
#include<cstdio>
using namespace std;
int main(){
	int n;
	while(~scanf("%d",&n)){
		int cnt = 0;
		int pair[12800]={0};
		for(int i = 0; i < 1001; i++){
			for(int j = 0; j < 1001; j++){
				pair[i+j]++;
			}
		}
		for(int i = 0; i < 2001; i++){
			for(int j = 0; j < 2001; j++){
				if(i+j == n)cnt += pair[i]*pair[j];
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}

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

int main() {
  int x, sum = 0, count = 100000000, modNum;
  cin >> x;
  modNum = x;
  
  while (count != 0) {
    int y = modNum / count;
    if (y != 0 && y < 10) {
      modNum = x % count;
      sum += y;
    }
    count /= 10;
  }
  
  string str;
  if (x % sum == 0) {
    str = "Yes";
  }
  else {
    str = "No";
  }
  cout << str << endl;
}

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

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(1){
        c-=b;
        if(c<=0) {puts("Yes");return 0;}
        a-=d;
        if(a<=0) {puts("No");return 0;}
    }
    return 0;
}


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

long mod(long x) {
  return x % 1000000007;
}

long fact(long x) {
  if (x == 0) {
    return 1;
  }
  return mod(x * fact(x - 1));
}

int main(void) {
  long N, M;
  cin >> N >> M;
  long c = N == M ? 2 : abs(N - M) == 1 ? 1 : 0;
  cout << mod(c * mod(fact(N) * fact(M))) << endl;
  return 0;
}


Measured memory_bytes: 1792
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
S = gets.chomp

a_int = 65

arr = S.split('').map do |x|
  num = x.ord - a_int
  num += N
  num = a_int + num % 26
  num.chr
end

puts arr.join


Measured memory_bytes: 15168
import java.util.*;

class Main{

    public static void main(String args[]) throws Exception{
        Main main = new Main();
    }

    public Main(){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        long[] A = new long[N];

        for(int i=0;i<N;i++){
            A[i] = scanner.nextLong();
        }

        Arrays.sort(A);

        for(int i=1;i<N;i++){
            if(A[i] == A[i-1]){
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}


Measured memory_bytes: 88696
#include <iostream>
#include <vector>
#include<map>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;

void factorize(map<ll,ll>& fac, ll a){
    for(ll i = 2;i < ll(sqrt(a)+1);i++){
        while(a % i == 0){
            a /= i;
            fac[i]++;
        }
    }
    if(a > 1)fac[a]++;
}

int f(vector<vector<int>>& dp, int i, int j, int N){
    if(j == N-1){
        dp[i][j] = 0;
        return dp[i][j];
    }else if(i < j){
        dp[i][j] = 0;
        return dp[i][j];
    }
    // cout<<i<<" "<<j<<endl;
    // cout<<"A"<<endl;
    for(int k = j+1;k < N;k++){
        if(i-k < 0){
            // cout<<i-k<<endl;
            // cout<<">"<<endl;
            break;
        }
        // cout<<"!"<<endl;
        dp[i][j] = max(f(dp,i-k,k,N)+1, dp[i][j]);
    }
    return dp[i][j];
}

int main(){
    int A = 40;
    vector<vector<int>> dp(A, vector<int>(A, -1));
    ll N;cin>>N;
    map<ll,ll> fac;
    factorize(fac, N);
    ll res = 0;
    for(auto itr = fac.begin();itr != fac.end();itr++){
        ll p = itr->first;
        ll n = itr->second;
        res += f(dp,n,0,A);
        // cout<<n<<" "<<p<<" "<<f(dp,n,0,A)<<endl;
    }
    cout<<res<<endl;
}

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

vector<ll> prime_factor(long long n)
{
	vector<ll> res;
	for (long long i = 2; i * i <= n; i++)
	{
		while (n % i == 0)
		{
			res.push_back(i);
			n /= i;
		}
	}
	if (n != 1)
		res.push_back(n); //nは素数
	return res;
}

int main()
{
	ll n, p;
	cin >> n >> p;
	ll ans = 1, e = 0, q = 0;
	vector<ll> v = prime_factor(p);
	for (int i = 0; i < v.size(); ++i)
	{
		if (q != v[i])
			q = v[i], e = 1;
		else
			e++;
		if (e % n == 0)
			ans *= v[i];
	}
	cout << ans << endl;
}

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

int main()
{
    int n;
    std::cin>>n;
    std::vector<std::vector<int>> day(n,std::vector<int>(3));
    for(int i=0;i<n;i++)std::cin>>day[i][0]>>day[i][1]>>day[i][2];
    std::vector<std::vector<int>> dp(n,std::vector<int>(3)); //dp[i][j] : i日目にjを取った時の最大コスト


    for(int i=0;i<3;i++)dp[0][i] = day[0][i];
    for(int i=1;i<n;i++){
        //i日目について評価
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(j==k)continue;
                dp[i][k] = std::max(dp[i][k],dp[i-1][j] + day[i][k]);
            }
        }
    }
    std::cout<<*std::max_element(dp[n-1].begin(),dp[n-1].end())<<std::endl;

}

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

map<int,int> count;

int main()
{
	int n,m;
	cin >> n;
	while(n--)
		cin >> m,count[m]++;
	cin >> m;
	while(m--)
	{
		cin >> n;
		if(!count[n]) break;
		else count[n]--;
	}
	if(m>-1) cout << "NO\n";
	else cout << "YES\n";
}

Measured memory_bytes: 9600
#include <algorithm>
#include <complex>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

int sum(int n)
{
    int s = 0;
    while (n) {
        s += n % 10;
        n /= 10;
    }
    return s;
}

int main()
{
    int n;
    cin >> n;
    if (n % sum(n) == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long int mod = 1e9+7;
const long long int mx=5e5;
long long int f1[mx+1],f2[mx+1],inv[mx+1];
long long int ncr(long long int n,long long int r)
{
    return (f1[n]%mod*f2[r]%mod*f2[n-r]%mod)%mod;
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int n,m;
    cin>>n>>m;
    f1[0]=1,f2[0]=1,inv[1]=1;
    for(long long int i=2;i<=mx;i++)
    inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
    for(long long int i=1;i<=mx;i++)
    {
        f1[i]= (f1[i-1]%mod*i%mod)%mod;
        f2[i]= (f2[i-1]%mod*inv[i]%mod)%mod;
    }
    long long int ans =0;
    long long int current1=1;
    for(long long int i=0;i<=n;i++)
    {
        ans+=current1%mod*(ncr(n,i)%mod*ncr(m-i,n-i)%mod*f1[n-i]%mod)%mod;
        ans+=mod;
        ans%=mod;
        current1*=-1;

    }
    cout<<(ans%mod*ncr(m,n)%mod*f1[n]%mod)%mod<<"\n";

}


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

int main() {

	int h, w;
	cin >> h >> w;

	int p = 0;
	rep(i, 0, h) {
		rep(j, 0, w) {
			char a;
			cin >> a;
			if (a == '#') {
				if (p < j) p = j;
				if (p > j) {
					cout << "Impossible" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Possible" << endl;

	return 0;
}

Measured memory_bytes: 764
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int main()
{	
	int n;
	cin >> n;
	
	int s = 0,ind=0;
	FOR(i,1, 10000) {
		if (i*(i + 1)/2 > n) {
			s = i*(i + 1) / 2;
			ind = i;
			break;
		}
	}
	
	FOR(i,1,ind+1) {
		if (i == s - n)continue;
		cout << i << endl;
	}
	return	0;
}




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


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    
    ll h,n;
    cin>>h>>n;
    ll a[n];
    ll sum =0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum += a[i];
    }
    if(sum < h){
        cout << "No\n";
    }
    else cout << "Yes\n";
    

}


Measured memory_bytes: 1024
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if b > a:
  a_2 = v * t + a
  b_2 = w * t + b
else:
  a_2 = -v*t + a
  b_2 = -w*t + b  

if a >= b and b_2 >= a_2:
  print("YES")
  exit()
elif b >= a and a_2 >= b_2:
  print("YES")   
  exit()
else:
  print("NO")


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

using namespace std;

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;

const ld PI = 2.0 * acos(0.0);

ld rad(ld a) {
  return a * PI / 180;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  ld cnth = h + m / (ld) 60;
  ld u1 = cnth * 30;
  ld u2 = m * 6;
  ld deltau = fabs(u1 - u2);
  deltau = min(deltau, 360 - deltau);
  ld ang = rad(deltau);
  ld sol = sqrt(a * a + b * b - 2 * a * b * cos(ang));
  cout << fixed << setprecision(9) << sol << "\n";
  return 0;
}


Measured memory_bytes: 4156
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(); 
		int b = sc.nextInt(); 
		int n, sw=0;
		if(b != 100) {
			if(b/10 == 0) {
				n = a*10+b;
			} else {
				n = a*100+b;
			}
		} else {
			n = a*1000+b;
		}
		for(int i = 1; i*i <= n; i++) {
			if(i*i == n) {
				System.out.println("Yes");
				sw = 1;
				break;
			}
		}
		if(sw == 0)	System.out.println("No");
	}
}

Measured memory_bytes: 21588
package main

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

const mod = 998244353
const facNum = 300001

func main() {
	sc := newScanner(os.Stdin)
	S := sc.s()
	if S[2] == S[3] && S[4] == S[5] {
		fmt.Printf("Yes")
	} else {
		fmt.Printf("No")
	}
}

// fmt.Println("Yes")
// fmt.Println("No")

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

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

//const factorial = new
func Pow(a, n int) int {
	ans := 1
	for n > 0 {
		if (n & 1) == 1 {
			ans = ans * a % mod
		}
		a = a * a % mod
		n = n >> 1
	}
	return ans
}

func Gcd(a, b int) int {
	if a < b {
		return Gcd(b, a)
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func combination(n, k int, fac, ifac []int) int {
	if n < k || n < 0 {
		return 0
	}
	if k == 0 {
		return 1
	}
	//while n != 0
	ans := ifac[k] * ifac[n-k] % mod
	return ans * fac[n] % mod
}

func abs(i int) int {
	if i < 0 {
		return -i
	}
	return i
}

// 階乗: factorial
// コンビネーションを計算する際に前もって計算しておく
// fac[k] => k! (mod M)
// ifac[k] => k!^(M-2) (mod M)
// n: ex. 2 * 10^5 => 200001
// fac, ifac := factorial()
func factorial() (fac []int, ifac []int) {
	fac = make([]int, facNum)
	fac[0] = 1
	ifac = make([]int, facNum)
	ifac[0] = 1
	for i := 1; i < facNum; i++ {
		fac[i] = fac[i-1] * i % mod
		ifac[i] = ifac[i-1] * Pow(i, mod-2) % mod
	}
	return
}

// vs: sorted slice int value
func lowerBound(vs []int, v int) (index int) {
	n := len(vs) / 2
	m := len(vs)
	for m != n {
		if vs[n] < v {
			n = (m-n+1)/2 + n
			//m = m
		} else {
			m = n
			n = n / 2
		}
	}
	return n
}

func IntSlice(n, init int) []int {
	r := make([]int, n)
	for i := range r {
		r[i] = init
	}
	return r
}


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

typedef long long ll;

int main() {
    int x;
    vector<int>num;
    int ans = 0;

    for (int i = 0; i < 3; i++) {
        cin >> x;
        num.push_back(x);
    }

    sort(num.begin(), num.end());

    int d = num[2]-num[1];
    ans += d;
    num[0] += d;
    num[1] += d;
    if ((num[2] - num[0]) % 2 == 0) {
        ans += (num[2]-num[0]) / 2;
    } else {
        ans += (num[2]-num[0]) / 2 + 2;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def solve(l):
    for i in range(l,L):
        if S[i] == '1': return (2*solve(i+1) + pow(3,L-1-i,mod)) %mod
    return 1
mod = 10**9+7
S = input()
L = len(S)
print(solve(0))


Measured memory_bytes: 97064
#!/usr/bin/env python3

class Room:
    sign = -1
    distance = -1
    def __init__(self):
        self.connected = set()
    def print(self, no: str):
        print(f"{no}: sign={self.sign} dist={self.distance} / {self.connected}")

(N, M) = map(int, input().split(" "))

Rooms = []
for i in range(N+1):
    Rooms.append(Room())

for i in range(M):
    (A, B) = map(int, input().split(" "))
    Rooms[A].connected.add(B)
    Rooms[B].connected.add(A)

Rooms[0].distance = 0
Rooms[1].distance = 0
target = [1]

while(len(target)):
    new_target = []
    for t in target:
        for c in Rooms[t].connected:
            if Rooms[c].distance == -1 or Rooms[t].distance + 1 < Rooms[c].distance:
                Rooms[c].sign = t
                Rooms[c].distance = Rooms[t].distance + 1
                new_target.append(c)
    target = list(set(new_target))

if all([r.distance != -1 for r in Rooms]):
    print("Yes")
    for i in range(2, N+1):
        print(Rooms[i].sign)
else:
    print("No")


Measured memory_bytes: 98172
#include <stdio.h>
int main(void){
	int a[100][100];
	int c, r, i, j, ans;
	ans = 0;
	scanf("%d %d", &c, &r);
	for(i = 0; i < c; i++){
		for(j = 0; j < r; j++){
			scanf("%d", &a[i][j]);
		}
	}
	for(i = 0; i < c; i++){
		for(j = 0; j < r; j++){
			printf("%d ", a[i][j]);
			if(j == r-1){
				for(j = 0; j < r; j++){
					ans += a[i][j];
				}
				printf("%d\n", ans);
				ans = 0;
			}
		}
	}
	for(j = 0; j < r; j++){
		for(i = 0; i < c; i++){
			ans += a[i][j];
			if(i == c-1){
				printf("%d ", ans);
				ans = 0;
			}
		}
	}
	for(i = 0; i < c; i++){
		for(j = 0; j < r; j++){
			ans += a[i][j];
		}
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 640
use proconio::input;

pub trait LexicalPermutation {
    /// Return `true` if the slice was permuted, `false` if it is already
    /// at the last ordered permutation.
    fn next_permutation(&mut self) -> bool;
    /// Return `true` if the slice was permuted, `false` if it is already
    /// at the first ordered permutation.
    fn prev_permutation(&mut self) -> bool;
}

impl<T> LexicalPermutation for [T] where T: Ord {
    /// Original author in Rust: Thomas Backman <serenity@exscape.org>
    fn next_permutation(&mut self) -> bool {
        // These cases only have 1 permutation each, so we can't do anything.
        if self.len() < 2 { return false; }

        // Step 1: Identify the longest, rightmost weakly decreasing part of the vector
        let mut i = self.len() - 1;
        while i > 0 && self[i-1] >= self[i] {
            i -= 1;
        }

        // If that is the entire vector, this is the last-ordered permutation.
        if i == 0 {
            return false;
        }

        // Step 2: Find the rightmost element larger than the pivot (i-1)
        let mut j = self.len() - 1;
        while j >= i && self[j] <= self[i-1]  {
            j -= 1;
        }

        // Step 3: Swap that element with the pivot
        self.swap(j, i-1);

        // Step 4: Reverse the (previously) weakly decreasing part
        self[i..].reverse();

        true
    }

    fn prev_permutation(&mut self) -> bool {
        // These cases only have 1 permutation each, so we can't do anything.
        if self.len() < 2 { return false; }

        // Step 1: Identify the longest, rightmost weakly increasing part of the vector
        let mut i = self.len() - 1;
        while i > 0 && self[i-1] <= self[i] {
            i -= 1;
        }

        // If that is the entire vector, this is the first-ordered permutation.
        if i == 0 {
            return false;
        }

        // Step 2: Reverse the weakly increasing part
        self[i..].reverse();

        // Step 3: Find the rightmost element equal to or bigger than the pivot (i-1)
        let mut j = self.len() - 1;
        while j >= i && self[j-1] < self[i-1]  {
            j -= 1;
        }

        // Step 4: Swap that element with the pivot
        self.swap(i-1, j);

        true
    }
}


fn main() {
  input! {
    n: usize,
    points: [(f64,f64);n],
  }
  
  let mut base: Vec<usize> = vec![];
  for v in 0..n {
    base.push(v);
  }
  
  let mut temps: Vec<Vec<(f64,f64)>> = vec![];
  loop {
    let temp_points: Vec<(f64,f64)> = base.iter().map(|i| points[*i]).collect();
    temps.push(temp_points);
    if !base.next_permutation() {
      break;
    }
  }
  
  let mut sum = 0f64;
  for temp in temps {
    let mut last_a = temp[0].0;
    let mut last_b = temp[0].1;
    let mut s_sum = 0f64;
    for i in 1..n {
      let (a,b) = temp[i];
      s_sum += ((last_a - a).powf(2f64) + (last_b - b).powf(2f64)).sqrt();
      last_a = a;
      last_b = b;
    }
    sum += s_sum;
  }
  
  let mut total = 1;
  for v in 1..=n {
    total *= v;
  }

  println!("{}", sum / total as f64);
}

Measured memory_bytes: 8656
#include <iostream>

using namespace std;

const int MAXN = 1e5 + 5;
int h[MAXN];
long long ans[MAXN];

int main() {
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; i ++)
		cin >> h[i];
		
	ans[0] = 0;
	ans[1] = h[1] - h[0];
	ans[1] = ans[1] > 0 ? ans[1] : ans[1] * -1; // ghadr motlagh
	for (int i = 2; i < n; i ++) {

		for (int j = 1; j <= k && j <= i; j ++) {
			long long diff = h[i] - h[i - j];
			diff = diff > 0 ? diff : diff * -1; // ghadr motlagh
			long long temp = ans[i - j] + diff;
			if (j == 1)
				ans[i] = temp;
			ans[i] = ans[i] > temp ? temp : ans[i]; // checking if temp is bigger or maximum ans
		}
	}
	
	cout << ans[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 4752
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const ll inf=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<Pii> v[100001];
ll dp2[300000][60]={};
int main() {
	int n,m;
	cin>>n>>m;
	if(n==m){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}


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

int n;
int main()
{
	scanf("%d", &n);
	int p = n / 10;
	n = n % 10;
	if(p == 9 || n == 9) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define LB(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define UB(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
// typedef vector vec;

ll mod = 1e9 + 7;

#define each(a,x) for( auto &a:(x))
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define rep2r(i, l, r) for (ll i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()
// cout<<endl;


int main()
{
	fastio();
	ll n;
	cin>>n;
	vector<ii> v;
	// map<ll, ll> m;
	ll x, l;
	rep(i, n) cin>>x>>l, v.pb(mp(x+l, x-l));
	sort(range(v));
	ll b = -1e9, ans = 0;
	rep(i, n)
	{
		if(b <= v[i].se)
		{
			b = v[i].fi;
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 2420
import random
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
ans = 0
a = []
last = [0]*26
for i in range(1,d+1):
    res = -float("inf")
    index = 0
    for k in range(26):
        x = k
        tnplast = last
        tnplast[x] = i
        tnp = 0
        tnp += s[i-1][x]
        for j in range(26):
            tnp -= c[j]*(i-last[j])
        if (tnp > res):
            res = tnp
            index = k+1
    ans += res
    a.append(index)

def rec(t):
    r = 0
    l = [0]*26
    for i in range(1,d+1):
        x = t[i-1]-1
        l[x] = i
        r += s[i-1][x]
        for j in range(26):
            r -= c[j]*(i-l[j])
    return r
    
for i in range(1000):
    x = random.randrange(1,d+1)
    y = random.randrange(1,27)
    t = a
    t[x-1] = y
    A = rec(t)
    if (ans < A):
        a = t
        ans = A

print(*a ,sep="\n")
    
    

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

int main(void)
{
    long long H, W;
    long long num;
    cin >> H >> W;
    num = H*W;
    if (H == 1 || W == 1) {
        cout << 1 << endl;
    } else if (num % 2 != 0) {
        cout << num / 2 + 1 << endl;
    } else {
        cout << num / 2 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

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

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
typedef long double ldouble;

typedef vector<llong> vecllong;
typedef vector<vecllong> vvecllong;

const llong MOD = 1e9 + 7;
const llong INF = 1e17;

#define FOR(i, n) for (llong i = 0; i < n; i++)
#define FORS(i, a, b) for (llong i = a; i < b; i++)
#define FORR(i, n) for (llong i = n; i > 0; i++)

llong N;
vvecllong edge(0);
vvecllong memo(0);  // memo[vertex][color]

llong search(llong parent, int parentColor, llong now) {
    if(memo[now][parentColor] != -1) {
        return memo[now][parentColor];
    }

    llong white = 1;
    llong black = 1;
    bool isLeaf = true;
    for_each(edge[now].begin(), edge[now].end(), [&](llong next) {
        if(parent != next) {
            isLeaf = false;
            white = (white * search(now, 0, next)) % MOD;
            if(parentColor == 0) {
                black = (black * search(now, 1, next)) % MOD;
            }
        }
    });

    if(isLeaf) {
        if(parentColor == 0) {
            memo[now][parentColor] = 2;
            return 2;
        } else {
            memo[now][parentColor] = 1;
            return 1;
        }
    }

    llong ret = white % MOD;
    if(parentColor == 0) {
        ret = (ret + black) % MOD;
    }

    memo[now][parentColor] = ret;
    return ret;
};

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

    cin >> N;
    edge.resize(N + 1, vecllong(0));
    memo.resize(N + 1, vecllong(2, -1));
    edge[0].push_back(1);

    FOR(i, N - 1) {
        llong x, y;
        cin >> x >> y;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }

    llong ans = search(0, 0, 1) % MOD;
    cout << ans << endl;

    return 0;
}

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

int main()
{
    int a,b,c,base;
    cin >> base;
    
    int h,m,s;

    h = base / 3600;
    base -= 3600 * h;
    m = base / 60;
    s = base % 60;

    cout << h << ":" << m << ":" << s << endl;

}



Measured memory_bytes: 3136
import sys
input = sys.stdin.readline

N = int(input())
a = [int(i) for i in input().split()]

s = sum(a)
x = [None]*N
x[0] = s - 2 * (sum(a[1::2]))

for i in range(1,N):
    x[i] = 2 * a[i-1] - x[i-1]

print(*x)

Measured memory_bytes: 14108
#include <bits/stdc++.h>
#include <numeric>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}

template<typename... T>
void write_space(T... a){
    ((cout << a << " "),...);
}
void solve(){
    //inflate_prime();
    int n;
    read(n);
    vi a(n);
    REP(i,n) cin >> a[i];
    map<int,int> mp;
    int i ; 
    for(i = 0 ; i < n ; i++){
        int num = a[i];
        bool break_condition = false;
        for(int k = 2; k <=  num / k ; k++){
            if(num % k == 0){
                mp[k]++;
                if(mp[k] > 1){
                    break_condition = true;
                    break;
                }
                while(num % k == 0){
                    num /= k;
                }
            }
        } 
        if(num > 1){
            mp[num]++;
            if(mp[num] > 1){
                break_condition = true;
            }
        }
        if(break_condition){
            break;
        }
    }
    if( i == n){
        cout << "pairwise coprime" << endl;
        return;
    }else{
        //need to check setwise coprime
        int g = gcd(a[0], a[1]);
        for(int k = 2 ; k < n ; k++){
            g = gcd(g, a[k]);
        }
        if( g == 1){
            cout << "setwise coprime" << endl;
        }else{
            cout << "not coprime" << endl;
        }
    }
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    solve();
    return 0;
}



Measured memory_bytes: 7304
S = input().split()
X = int(S[0])+int(S[1])
Y = int(S[0])-int(S[1])
Z = int(S[0])*int(S[1])
if X >= Y:
    if X >= Z:
        print(X)
    else:
        print(Z)
else:
    if Y >= Z:
        print(Y)
    else:
        print(Z)


Measured memory_bytes: 3060
import math

a,b,h,m = map(int,input().split())
H = ((60*h + m) / 720)*360
M = 6*m
o = abs(H - M)
if o >= 180:
    o = 360 - o

rado = math.radians(o)

ans = (a**2 + b**2 - 2*a*b*math.cos(rado))**0.5
print(ans)

Measured memory_bytes: 9468