akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

int main() {
    int n;
    cin >> n;
    while(n - 1000 > 0) n -= 1000;
    cout << 1000 - n << endl;
    return 0;
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

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

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[0]=0;
    dp[1]=1;
    for(ll i=2;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    string s;
    cin >> s ;
    if(s[0]==s[1]&&s[2]==s[0]){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
//		solveA(args);
		solveB(args);
//		solveC(args);
//		solveD(args);
//		solveE(args);
//		solveF(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		int N= nextInt();
		int ans = 0;
		for(int i=1;i<11;i++) {
			if(i*1000-N>=0) {
				pw.println(i*1000-N);
				return;
			}
		}

	}
	public static void solveB(String[] args) throws Exception{
		int N = nextInt();
		String[] S = new String[] {"AC","WA","TLE","RE"};
		int[] ans = new int[S.length];
		for(int i=0;i<N;i++) {
			String s = nextString();
			for(int k=0;k<S.length;k++) {
				if(s.equals(S[k])) {
					ans[k]++;
					break;
				}
			}
		}
		for(int i=0;i<S.length;i++) {
			pw.println(S[i]+" x "+ans[i]);
		}
	}
	public static void solveC(String[] args) throws Exception{

	}
	public static void solveD(String[] args) throws Exception{

	}

	public static void solveE(String[] args) throws Exception{

	}

	public static void solveF(String[] args) throws Exception{

	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 38440
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

struct node{
    int index,length;
	string cost;
    node(int index,int length,string cost):index(index),length(length),cost(cost){}
    bool operator<(const node& other)const{
        return cost>other.cost;
    }
};
const int MAX_LEN=500;

const string MAX(2*MAX_LEN,'z');
const string NONE="-";
const string MIN="";

typedef vector<vs> vvs;
int main(){
    int n,a,s,g;
    while(cin>>n>>a>>s>>g,n){
        vector<vvs> dist(n,vvs(n,vs()));
        REP(i,a){
            int x,y;
			string lab;
            cin>>x>>y>>lab;
			dist[x][y].push_back(lab);
        }
        
        priority_queue<node> q;
        q.push(node(s,0,MIN));
        vvs cost(n,vs(MAX_LEN+6+1,MAX));
        cost[s][0]=MIN;
        while(!q.empty()){
            node cnode=q.top();q.pop();
            if(cost[cnode.index][cnode.length]<cnode.cost){
                continue;
            }
            REP(i,n){
				REP(j,dist[cnode.index][i].size()){
					if(dist[cnode.index][i][j]!=NONE){
						string newcost=cnode.cost+dist[cnode.index][i][j];
						if(newcost.size()<=MAX_LEN+6&&cost[i][newcost.size()]>newcost){
							cost[i][newcost.size()]=newcost;
							q.push(node(i,newcost.size(),newcost));
						}
					}
				}
            }
        }
		string ans=MAX;
		REP(i,MAX_LEN+6+1){
			ans=min(ans,cost[g][i]);
		}
		if(ans.length()>n*6){
			cout<<"NO"<<endl;
		}else{
			cout<<ans<<endl;
		}
    }
}

Measured memory_bytes: 24092
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef double ld;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < ll >
#define vll vector < ll > 
#define dt cout<<"HERE\n";
#define pii pair < ll , ll >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 
const ll inf=1e18+1e17;
const ll mod =1e9+7;
using cd= complex < double > ;
//const ll mod = 998244353;
ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}
const ll N = 2e5+5;
void solve(){
	int n;
	cin>>n;
	map< string , int > m;
	for ( int i=0;i<n;i++){
		string s;
		cin>>s;
		m[s]++;
	}
	cout<<"AC x "<<m["AC"]<<'\n';
	cout<<"WA x "<<m["WA"]<<'\n';
	cout<<"TLE x "<<m["TLE"]<<'\n';
	cout<<"RE x "<<m["RE"]<<'\n';
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie( NULL);
	cout.tie(NULL);

	ll t=1;
	//cin>>t;
	for ( ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
    	solve();
    }
}


Measured memory_bytes: 3668
n,x = map(int,input().split())

t = list(map(int,input().split()))

res = 0

for i in range(n-1):
    if t[i] > x:
        res += t[i]+t[i+1]-x
        t[i] = x
        t[i+1] = 0
    elif t[i]+t[i+1] > x:
        res += t[i+1]+t[i]-x
        t[i+1] = x-t[i]
    #print(t)
print(res)

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

void solve() {
  vector<vector<int>> A(3, vector<int>(3, 0));
  vector<vector<bool>> appear(3, vector<bool>(3, 0));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A[i][j];
    }
  }
  int N;
  cin >> N;
  vector<int> B(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < N; k++) {
        if (A[i][j] == B[k]) {
          appear[i][j] = true;
          break;
        }
      }
    }
  }
  string ans = "No";
  for (int i = 0; i < 3; i++) {
    if (appear[i][0] && appear[i][1] && appear[i][2]) ans = "Yes";
    if (appear[0][i] && appear[1][i] && appear[2][i]) ans = "Yes";
  }
  if (appear[0][0] && appear[1][1] && appear[2][2]) ans = "Yes";
  if (appear[2][0] && appear[1][1] && appear[0][2]) ans = "Yes";
  cout << ans << endl;
  return;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << fixed << setprecision(12);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
//using P = pair<int,int>;
//#########################################
const int mod = 1000000007;
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
vector<int> f = {1},fi = {1};
int fact(int x){
    while((int)f.size() <=x)f.push_back((f.back()*f.size())%mod);
    return f[x];
}
int ifact(int x){
    return modpow(fact(x),mod-2,mod);
}
int C(int x,int y){
    if(x < y)return 0;
    return fact(x)*ifact(y)%mod*ifact(x-y)%mod;
}
int P(int x,int y){
    if(x < y)return 0;
    return fact(x)*ifact(x-y)%mod;
}
signed main(){
    int n,m;cin >> n >> m;
    int ans = 0;
    rep(k,n+1){
        int now = C(n,k)*P(m,k)%mod*P(m-k,n-k)%mod*P(m-k,n-k)%mod;
        if(k%2)now = -now;
        ans += now;
    }
    cout << (ans%mod + mod)%mod << endl;

    return 0;
}

Measured memory_bytes: 7440
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,K;
    cin>>N>>K;
    int A[1024];
    for(int i=1;i<=N;i++) cin>>A[i];
    sort(A+1,A+1+N);
    int Sum=0;
    for(int i=1;i<=K;i++) Sum+=A[i];
    cout<<Sum;
    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int x = sc.nextInt();
    int y = sc.nextInt();

    if ((x == 4 || x == 6 || x == 9 || x == 11) && (y == 4 || y == 6 || y == 9 || y == 11)){
            System.out.println("Yes");
    }
        else if  ((x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12) && (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12)){
                System.out.println("Yes");
        }
        else if  (x == 2 && y == 2){
                System.out.println("Yes");
        }

    else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 23636
import java.util.*;
  public class Main {
      public static void main(String[] args){
          Scanner sc = new Scanner(System.in);
          int x = sc.nextInt();
          int y = sc.nextInt();
        Map<Integer, Integer> m = new HashMap<>(); 
        m.put(1, 300000);
        m.put(2, 200000);
        m.put(3, 100000);
        int ans = 0; 
        
        ans += m.getOrDefault(x, 0); 
        ans += m.getOrDefault(y, 0);
        if (x == 1 && y==1) { ans += 400000;} 
         
         System.out.println(ans);
     }
 }


Measured memory_bytes: 23764
//y13-2
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int main(){
    for(int i=0; i<4; i++){
        int t,n;
        cin >> t >> n;
        int m[5] = {0,6000,4000,3000,2000};
        cout << m[t] * n << endl;
    }
    return 0;
}



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

int main(){
    int i,j,k,n,count = 0,flag = 0;
    
    scanf("%d",&i);
    
    for(j = 0;j < i;j++){
        scanf("%d",&n);
        if((n%2) == 0){
            if(n == 2) count++;
            continue;
        } 
        flag = 0;
        for(k = 1;(2*k+1) <= sqrt(n);k++){
            if((n%(2*k+1)) == 0){
             flag = 1 ;
             break;
            }
        } count++;
        if(flag == 1) count--;
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 2108
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        d[0] = k - a[n - 1] + a[0];
        for (int i = 1; i < n; i++) {
            d[i] = a[i] - a[i - 1];
        }
        int max = d[0];
        for (int i = 1; i < n; i++) {
            if(d[i] > max){
                max = d[i];
            }
        }
        System.out.println(k - max);
    }
}

Measured memory_bytes: 65664
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int num;
	cin >> num;
	vector<int> p;
	for (int i = 0;i < num;i++)
	{
		int n;
		cin >> n;
		p.push_back(n);
	}
	int oper;
	cin >> oper;
	while (oper--)
	{
		int head, end;
		cin >> head >> end;
		int k;
		cin >> k;
		vector<int>::iterator pp;
		for (pp = p.begin() + head;pp != p.begin() + end;pp++)
		{
			swap(*pp, *(pp + k - head));
		}
	}
	vector<int>::iterator temp = p.begin();
	while (temp != p.end())
	{
		cout << *temp;
		if (++temp == p.end())cout << endl;
		else cout << " ";
	}
}


Measured memory_bytes: 3156
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>

using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
struct UnionFind{
    vector<int> par;
    UnionFind(int N){
        par.resize(N);
        for(int i=0;i<N;i++){
            par[i] = i;
        }
    }
    void Union(int x,int y){
        par[Get(x)] = Get(y); 
    }
    bool Same(int x,int y){
        return Get(x) == Get(y);
    }
    int Get(int x){
        if(x != par[x]){
            par[x] = Get(par[x]);
        }
        return par[x];
    }
};
void Calc(){
	int N = rei();
	int M = rei();
	UnionFind U(N);
	int ans = N;
	for(int i=0;i<M;i++){
		int x = rei()-1;
		int y = rei()-1;
		int z = rei();
		if(!U.Same(x,y)){
			ans--;
			U.Union(x,y);
		}
	}
	cout << ans << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

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

int main() {
	int x;
	cin>>x;
	
	while (x>=1000) {
		x = x-1000;
	}
	
	if (0==x) {
		cout << x << endl;
	} else {
		cout << 1000-x << endl;
	}
	
	return 0;
} 

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> lP;

ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}

/*
全探索の場合
 p,qの全探索でout
 差分の数ならN^2よ？


一次元なら座標の差分をとって最大公約数とればpが定まる

次元圧縮してset?
 qx - pyのパターン数を探す
  1,1 3,3, 5,5 6,6 を1としてカウントしてしまうぞ





*/
bool ball_exist(ll x, ll y, vector<lP> &ball, vector<bool>& watched){
    for (int i = 0; i < ball.size(); i++){
        if (ball[i].first == x && ball[i].second == y){
            watched[i] = true;
            return true;
        }
    }
    return false;
}

int main()
{
    int n;
    cin >> n;
    vector<lP> ball(n);
    rep(i, n){
        cin >> ball[i].first >> ball[i].second;
    }

    vector<lP> diff;
    for (int i = 0; i < n; i++)
    {
        for (int j = i+1; j < n; j++)
        {
            if (i == j) continue;
            ll dx = ball[i].first - ball[j].first;
            ll dy = ball[i].second - ball[j].second;
            diff.push_back({dx, dy});
        }
    }
    
    int ans = n;
    for (int i = 0; i < diff.size(); i++)
    {
        ll p = diff[i].first;
        ll q = diff[i].second;
        int tans = 0;
        vector<bool> watched(n);
        for (int j = 0; j < n; j++)
        {   
            if(watched[j]) continue;
            watched[j] = true;
            ll x = ball[j].first;
            ll y = ball[j].second;
            while(ball_exist(x, y, ball, watched)) x+=p, y+=q;
            x = ball[j].first;
            y = ball[j].second;
            while(ball_exist(x, y, ball, watched)) x-=p, y-=q;
            tans++;
        }
        //cout << p << q << pat.size() << endl;
        ans = min(ans, tans);
    }
    cout << ans << endl;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<N;i++)
using namespace std;
long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;
long long s[44];

void prepare(){
    s[0]=1;
    rep(i,43){
        s[i+1]=s[i]*(-2);
    }
}

int main(){

long long N;
cin>>N;

prepare();
long long div=2;
string ans;
long long p=0;

if(N==0)cout<<N;
while(abs(N)>0){

    if((N%div)==0){
        ans.insert(0,1,'0');
    }
    else{
        ans.insert(0,1,'1');
        N-=s[p];
    }
    div*=2;
    p++;
}

rep(i,ans.size()){
    cout<<ans[i];
}


 return 0;
}
/*
first 30m 0s

-9

1011


123456789

11000101011001101110100010101
11000101011001101110100010101


0

0
*/

Measured memory_bytes: 256
N = int(input())
inp = []
for k in range(N-1):
  a, b = map(int, input().split())
  if a > b:
    a, b = b-1, a-1
  else:
    a, b = a-1, b-1
  inp.append((a, b, k))
inp.sort(key = lambda x: x[0])
mark = [[] for _ in range(N)]
def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            #return mid
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    #return None
    return False

from bisect import insort


ans = [0 for _ in range(N-1)]
now = 0
cnt = 0
for item in inp:
  cnt += 1
  if now < item[0]:
    now = item[0]
    cnt = 1
  while binary_search(mark[item[0]], cnt) or binary_search(mark[item[1]], cnt):
    cnt += 1
  insort(mark[item[1]], cnt)
  ans[item[2]] = cnt
color = max(ans)
print(color)
for k in range(N-1):
  print(ans[k])


Measured memory_bytes: 106892
#include <bits/stdc++.h>  
#define ll long long
using namespace std;  
#define N 100005  
int main ()
{
	ll n,num = 0,ans = 0,mm = 0;
	cin >> n;
	while(n)
	{
		ans += n%10ll;
		mm = n%10ll;
		n/=10ll;
		num++; 
	}
	ans = max(ans,(num-1)*9+mm-1);
	cout << ans << endl;
	return 0;
}

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

int main()
{
  int h,w;
  while(1){
    cin>>h>>w;
    if(h==0&&w==0)break;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cout<<'#';
      }
      cout<<endl;
    }
    cout<<endl;
  }
  return 0;
}


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

int main(){
string S;
  cin>>S;
  
 if(S[0]!='A'){cout<<"WA"; return 0;}
  
 int count=0; 
 for(int i=1; i<S.size(); i++){
   if(isupper(S[i])){
     if(i==1 || i==S.size()-1 || S[i]!='C'){
      cout<<"WA"; return 0;
     }
   count++;
   }
 }
 if(count!=1){cout<<"WA"; return 0;}
 
 cout<<"AC";
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;

int main(){
	int n, x;
	long long int sum = 0;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%d", &x);
		sum += x;
	}
	printf("%d\n", sum / n);
	return 0;
}

Measured memory_bytes: 1020
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#define INF 1000000000
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define all(x) (x).begin(),x.end()
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

int c[6];

void DEBUG(){
  rep(i,5)cout<<c[i]<<" ";
  cout<<endl;
}

void tranp_sort(){
  for(int i=0;i<5;i++){
    if(c[i]==1)c[i]+=13;
  }
  sort(c,c+5);
  for(int i=0;i<5;i++){
    if(c[i]==14)c[i]=1;
  }
}

void input(){  
  getchar();cin>>c[1];
  getchar();cin>>c[2];
  getchar();cin>>c[3];
  getchar();cin>>c[4];
}


bool one_pair(){
  for(int i=1;i<5;i++){
    if(c[i]==c[i-1])return true;
  }
  return false;
}

bool two_pair(){
  int cnt=0;
  map<int,int>m;
  for(int i=0;i<5;i++)m[c[i]]++;
  for(int i=1;i<=13;i++){
    if(m[i]==2)cnt++;
  }
  if(cnt==2)return true;
  else return false;
}

bool three_card(){
  for(int i=2;i<5;i++){
    if(c[i]==c[i-1]&&c[i-1]==c[i-2])return true;
  }
  return false;
}

bool four_card(){
  for(int i=3;i<5;i++){
    if(c[i]==c[i-1]&&c[i-1]==c[i-2]&&c[i-2]==c[i-3])return true;
  }
  return false;
}

bool fullhouse(){
  bool a,b;
  a=b=false;
  map<int,int>m;
  for(int i=0;i<5;i++)m[c[i]]++;
  for(int i=1;i<=13;i++){
    if(m[i]==3)a=true;
    if(m[i]==2)b=true;
  }
  if(a==true&&b==true)return true;
  else return false;
}

bool straight(){
  //DEBUG();
  int tmp=c[0];
  if(c[0]==2&&c[1]==3&&c[2]==4&&c[3]==5&&c[4]==1)return true;
  for(int i=0;i<5;i++){
    if(c[i]==1)tmp++;
    //cout<<c[i]<<" = "<<(tmp+i)%14<<endl;
    if((tmp+i)%14!=c[i])return false;
  }
  return true;
}

int main(){

  while(cin>>c[0]){
    input();
    tranp_sort();
    if(four_card())cout<<"four card"<<endl;
    else if(fullhouse())cout<<"full house"<<endl;
    else if(straight())cout<<"straight"<<endl;
    else if(three_card())cout<<"three card"<<endl;
    else if(two_pair())cout<<"two pair"<<endl;
    else if(one_pair())cout<<"one pair"<<endl;
    else cout<<"null"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3092
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a//gcd(lm,a)

ans = 0
for i in range(N):
    ans += lm//A[i]
ans %= Mod

print(ans)


Measured memory_bytes: 6112
//**KEEP IT SHORT AND SIMPLE**
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FILES freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define REP(i,a,b) for (int i = a; i < b; i++)
#define NL '\n'
#define F first
#define S second
#define dot(a, b) (conj(a) * (b)).real()
#define cross(a, b) (conj(a)* (b)).imag()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef bool bl;
typedef vector < vector<long long> > vvl;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
typedef map <long long, long long> mll;
typedef map <long long, bool> mlb;
typedef priority_queue<long long, vector<long long>, greater<long long> > minPq;
typedef tuple<ll, ll, ll> line;
typedef complex<double> point;
const double pi = 2 * acos(0.0);
const int OO = 0x3f3f3f3f;
int main()
{
    IO
    ll n, sum = 0;
    cin >> n;
    ll c[n], v[n];
    REP(i, 0, n)    cin >> c[i];
    REP(i, 0, n)    cin >> v[i];
    REP(i, 0, n)
        sum += (c[i] > v[i] ? c[i] - v[i] : 0);
    cout << sum;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>

using namespace std;

int main() {
    long long int N, M;
    cin >> N >> M;
    bool key = true;

    vector<long long int>ans(N);
    long long int s, c;

    for (int i = 0; i < M; i++) {
        cin >> s >> c;
        if (N != 1 && s == 1 && c== 0) {
            key = false;
        }
        if (ans[s - 1] == NULL) {
            ans[s - 1] = c;
        }
        else {
            if (ans[s - 1] != c) {
                key = false;
            }
        }
    }


    if (key == true) {
        for (int i = 0; i < N; i++) {
            if (ans[i] == NULL) {
                if (i == 0 && N != 1) {
                    cout << 1;
                }
                else {
                    cout << 0;
                }
            }
            else {
                cout << ans[i];
            }
        }
    }
    else {
        cout << "-1";
    }

    return 0;
}

Measured memory_bytes: 3144
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<deque>
#include<sstream>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<bitset>
#include<time.h>
#include<cstdlib>
#include<cassert>
#define ll long long
#define fi first
#define se second
#define show(x) cout<<#x<<"="<<x<<endl;
using namespace std;
                   
int n,m;
string s;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout.precision(10);
  //cout<<fixed;
#ifdef LOCAL_DEFINE
    freopen("in", "r", stdin); 
    freopen("out","w",stdout);
#endif
  cin>>n>>m;
  int a=1;
  for(int i=0;i<m;i++){
    a*=2;
  }
  //cout<<a<<endl;
  double ans=0;
  for(int i=1;i<1000;i++){
    double now=1900*i*m+100*(n-m)*i;
    for(int j=0;j<i-1;j++){
      now*=(double)(a-1)/a;
    }
    now/=a;
    ans+=now;
  }
  cout<<ans<<endl;
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

N, K = MAP()

print(N-K if 1 < K else 0)

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

int main() {
    /* int t;
    cin >> t;
    for (int i=1; i<=t; i++) {
        long long n, d;
        vector<long long> days;
        cin >> n >> d;
        for (int j=0; j<n; j++) {
            long long k;
            cin >> k;
            days.push_back(k);
        }
        long long start = d/days[0];
        long long j = start+1;
        while (j--) {
          long long m_day = start*j;
          for (int k = 1; k < n; k++) {
            long long x = (d/days[k]) * days[k];
            
          }
        }
    } */
    int n, k;
    cin >> n;
    string line;
    vector<pair<int, int>> counts(n, make_pair(0, 0));
    cin.ignore(numeric_limits<streamsize>::max(), '\n');
    getline(cin, line);
    istringstream i(line);
    while (i >> k) {
      auto pp = counts[k-1];
      if (counts[k-1].second)
      counts[k-1].second++;
      else
      counts[k-1].second = 1;
    }
    for (auto pp: counts) {
      cout << pp.second << endl;
    }
}

Measured memory_bytes: 7340
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {
  long long int a,b,c,d,e;
 
  cin >> a>>b>>c;
   
   if(a>1 && 0<=c-b){     
           
     cout <<(a-2)*(c-b)+1 << endl;
   }
 else if(a==1 && 0 ==c-b){
  cout <<"1" << endl;
 }
  else{
    cout << "0" << endl;
  }
  
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAX=1E18;
int main ()
{
    int n;
    cin>>n;
    ll a[n+10];
    ll ans=1,t=MAX;
    bool flag=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(!a[i]) flag=1;
    }
    if(flag)
        cout<<0<<endl;
    else
    {
        for(int i=0;i<n;i++)
        {
            t/=a[i];
            if(t) ans*=a[i];
        }
        t?cout<<ans<<endl:cout<<-1<<endl;
    }
	return 0;
}


Measured memory_bytes: 4404
#include <bits/stdc++.h>
using namespace std;
const int NUM = 4, OP = 3;

int calc(int a[NUM], int b[OP]){
    int res = a[0];
    for(int i=0; i<OP; i++){
        res += a[i+1]*b[i];
    }
    return res;
}

bool dfs(int i, int a[NUM], int b[OP]){
    // std::cout << i  << ": " << b[0] << b[1] << b[2] << endl;
    if(i==OP){
        // std::cout << calc(a, b) << endl;
        if(calc(a, b)==7){
            string equ="";
            for(int i=0; i<OP; i++){
                if (b[i]==1) equ+="+";
                else equ+="-";
            }
            std::cout << a[0] << equ[0] << a[1] << equ[1] << a[2] << equ[2] << a[3] << "=7" << endl;
            return true;
        }else{
            return false;
        }
    }
    int c[OP], d[OP];
    memcpy(c, b, sizeof(int)*OP);
    memcpy(d, b, sizeof(int)*OP);
    c[i] = 1;
    if (dfs(i+1, a, c)) return true;
    d[i] = -1;
    if (dfs(i+1, a, d)) return true;
    return false;
}

int main(void){
    string s;
    int a[NUM];
    std::cin >> s;
    for(int i=0; i<NUM; i++){
        a[i] = s[i]-'0';
    }
    int b[OP] = {1, 1, 1};
    dfs(0, a, b);
    return 0;
}

Measured memory_bytes: 256
# ARC59 D input
nab = list(map(int, input().split()))

N = nab[0]
A = nab[1]
B = nab[2]
V = list(reversed(sorted(list(map(int, input().split())))))

# ARC59 D naive
def count(n):
    result = []
    prev = V[0]
    count = 1
    for i, v in enumerate(V[1:n]):
        if (v == prev):
            count += 1
        else:
            result.append(count)
            count = 1
        
        if(i == n-2):
            result.append(count)
        prev = v
        
    return result
        
def greedy(n):
    return sum(V[0:n])/n

def fact(n):
    res = 1
    for i in range(1,n+1):
        res *= i
    return res

def comb(p, u):
    nume = 1
    for i in range(u):
        nume *= (p-i)
    return int(nume / fact(u))


max_ave = -1
max_ave_comb = 0
counts = count(N)

for i in range(A, B+1):
    u = i # u is the number of items to pick
    ave = greedy(i)
    if (max_ave <= ave):
        for j in counts:
            if (u-j <= 0):
                if (max_ave != ave):
                    max_ave_comb = comb(j, u)
                else:
                    max_ave_comb += comb(j, u)
                break
            else:
                u -= j
        max_ave = ave
print(max_ave)
print(max_ave_comb)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
#define repi(i,a,b) for (int i=a;i<(b);i++)
using namespace std;
typedef long long ll;
int main(){
  int n;
  cin >> n;
  rep(i,n+1){
    rep(j,n+1){
      if((4*i+7*j)==n){
        cout << "Yes" <<endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}
    

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

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

  if ( (a + b ) < ( c + d)) {
    cout << "Right" << endl;
  } else if ( (a + b ) > ( c + d)){
  	cout << "Left" << endl;
  } else {
  	cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 100005
#define LL long long
#define INF (1LL<<60)
using namespace std;
int n,m,a[N]; LL F[N],S[N],ans;
void Mark(int l,int r,int u,int p)
{
	int x=u-p;
	if(x<l){ F[l]++,F[r+1]--,S[l]+=u-l+1,S[r+1]-=u-r; return ;}
	if(x>r){ S[l]+=p,S[r+1]-=p; return ;}
	S[l]+=p,S[x+1]-=p;
	F[x+1]++,F[r+1]--,S[x+1]+=u-x,S[r+1]-=u-r;
}
int main()
{
	int i,p;
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(i=2;i<=n;i++){
		p=a[i]-a[i-1];
		if(p<0) p+=m;
		Mark(1,a[i],a[i]+1,p);
		Mark(a[i]+1,m,a[i]+m+1,p);
	  }
	for(i=1;i<=m;i++)
		F[i]+=F[i-1],S[i]+=S[i-1]-F[i];
	ans=INF;
	for(i=1;i<=m;i++)
		ans=min(ans,S[i]);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 2176
#include <iostream>
using namespace std;
 long long N, K, A[1 << 18];

 int main() {
cin >> N >> K;
for (int i = 1; i <= N; i++) cin >> A[i];
for (int i = K + 1; i <= N; i++) {
if (A[i - K] < A[i]) cout << "Yes" << endl;
 else cout << "No" << endl;
 }
 return 0; }

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

bool IS_PRIME[55556];
vector<int> PRIMES;
int MAX_N = 55556;

void init_prime() {
  rep(i, MAX_N) {
    IS_PRIME[i] = true;
  }

  for(int i = 2; i <= MAX_N; i++) {
    if(!IS_PRIME[i]) continue;
    PRIMES.push_back(i);

    for(int j = i * 2; j <= MAX_N; j += i) {
      IS_PRIME[j] = false;
    }
  }
}

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

  int N;
  cin >> N;
  init_prime();

  int cnt = 0;

  rep(i, PRIMES.size()) {
    if(PRIMES[i] % 5 == 1) {
      cout << PRIMES[i];
      cnt++;
      if(cnt == N) {
        cout << endl;
        break;
      } else {
        cout << " ";
      }
    }
  }

  cout << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;

int S,T,U,N,O,D;
int e[101],c[101];
int h[101],a[101];
int dp[101][101][101];//dp[T][U][X]その日の体力X→その日の消費カロリ

int Dp[101][10001];//Dp[N][X]その日の消費カロリX→その日の幸福

int DP[101][101];// DP[I][J]I日目開始時に体力がJあるときの答

void init();

void print_dp();
void make_dp();

void print_Dp();
void make_Dp();

void print_DP();
void make_DP();

int main(){
  while(cin>>S>>T>>U>>N>>O>>D){
    
    for(int i=1;i<=T;i++)cin>>e[i]>>c[i];
    for(int i=1;i<=N;i++)cin>>h[i]>>a[i];
    init();

    make_dp();
    //print_dp();
    make_Dp();
    //print_Dp();
    make_DP();
    //print_DP();
    cout<<DP[1][S]<<endl;
  }
  return 0;
}

void init(){
  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      for(int k=0;k<=100;k++){
	dp[i][j][k]=(j==0?0:-1);
      }
    }
  }
  for(int i=0;i<=100;i++){
    for(int j=0;j<=10000;j++)Dp[i][j]=0;
  }
  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      DP[i][j]=-1;
    }
  }
}

void make_dp(){
  for(int i=1;i<=T;i++){
    for(int j=1;j<=U;j++){
      for(int k=1;k<=S;k++){
	dp[i][j][k]=dp[i-1][j][k];
	if(k-e[i]>=0){
	  if(dp[i-1][j-1][k-e[i]]!=-1){
	    dp[i][j][k]=max(dp[i][j][k],dp[i-1][j-1][k-e[i]]+c[i]);
	  }
	}
	
      }
    }
  }
}

void print_dp(){
  for(int i=1;i<=T;i++){
    for(int j=1;j<=S;j++){
      printf("%3d",dp[i][U][j]);
    }
    cout<<endl;
  }
  cout<<endl;
}

void make_Dp(){
  for(int i=1;i<=N;i++){
    for(int j=1;j<=10000;j++){
      Dp[i][j]=Dp[i-1][j];
      if(j-a[i]>=0)Dp[i][j]=max(Dp[i][j],Dp[i][j-a[i]]+h[i]);
    }
  }
}

void print_Dp(){
  for(int i=1;i<=20;i++) printf("%3d",i);
  cout<<endl;

  for(int i=1;i<=N;i++){
    for(int j=1;j<=20;j++){
      printf("%3d",Dp[i][j]);
    }
    cout<<endl;
  }
  cout<<endl;
}

void make_DP(){
  for(int j=S;j>=0;j--){
    if(dp[T][U][j]==-1)DP[D][j]=-1;
    else DP[D][j]=Dp[N][dp[T][U][j]];
  }

  for(int i=D-1;i>=1;i--){
    for(int j=S;j>=0;j--){
      for(int k=0;k<=j;k++){
	if(dp[T][U][k]==-1)continue;
	if(j-k+O<0||DP[i+1][min(j-k+O,S)]==-1)continue;
	DP[i][j]=max(DP[i][j],Dp[N][dp[T][U][k]]+DP[i+1][min(j-k+O,S)]);
      }
    }
  }

}

void print_DP(){
  for(int i=1;i<=D;i++){
    for(int j=0;j<=S;j++){
      printf("%3d",DP[i][j]);
    }
    cout<<endl;
  }
  cout<<endl;
}

Measured memory_bytes: 9180
#include<stdio.h>
int main()
{
	int i, a = 0, n;
	for (i = 0; i < 4; i++){
		scanf("%d", &n);
		a += n;
	}
	printf("%d\n", a / 60);
	a = a % 60;
	printf("%d\n", a);
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n],c=0,q,i;
    for(i=0;i<n;i++)
    {
        cin>>a[i];

    }
    q=a[0];

    for(i=1;i<n;i++)
    {

        if(q>=a[i])
        {
            c++;
            q=a[i];
        }


    }
    cout<<c+1;








}


Measured memory_bytes: 3940
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
//ll bp(ll x, ll p){
//    ll res = 1;
//    while(p){
//        if(p & 1)
//            res = res * x % mod;
//        x = x * x % mod;
//        p >>= 1;
//    }
//    return res;
//}
//ll C(ll n, ll k){
//    if(k == 0)
//        return 1;
//    if(k < 0 || k > n)
//        return 0;
//    return f[n] * rf[k] % mod * rf[n - k] % mod;
//}
int a, b;
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//    f[0] = rf[0] = 1;
//    for(int i = 1; i < 500009; i++)
//        f[i] = f[i - 1] * i % mod, rf[i] = bp(f[i], mod - 2);
    cin>>a>>b;
    cout<<a*b;
}
/*
 2
 ((
 )))(
 */


Measured memory_bytes: 3640
import java.util.Scanner;

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

        int ans = 0;

        for (int i = 0; i < N; i++) {
            int l = sc.nextInt();
            int r = sc.nextInt();
            ans += r - l + 1;
        }
        System.out.println(ans);
        sc.close();

    }
}

Measured memory_bytes: 25192
import java.util.*;

public class Main {
    
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Point[] point = new Point[n];
        int[] index = new int[n - 1];
        for (int i = 0; i < n; i++) {
            point[i] = new Point();
        }
        
        for (int i = 0; i < n - 1; i++) {
            int p = sc.nextInt() - 1;
            int q = sc.nextInt() - 1;
            index[i] = q;
            
            point[p].child.add(q);
            point[q].parent = p;
        }
        
        for (int i = 0; i < n; i++) {
            int nowColor = 1;
            int myColor = 0;
            if (i != 0) {
                myColor = point[i].color;
            }
            
            for (Integer children : point[i].child) {
                if (nowColor != myColor) {
                    point[children].color = nowColor;
                } else {
                    point[children].color = nowColor + 1;
                    nowColor++;
                }
                nowColor++;
            }
        }
        
        int max = 0;
        for (Point p : point) {
            max = Math.max(max, p.color);
        }
        System.out.println(max);
        
        for (int i = 0; i < n - 1; i++) {
            System.out.println(point[index[i]].color);
        }
        
    }
    
    public static class Point {
        int parent;
        int color;
        List<Integer> child;
        
        Point() {
            this.child = new ArrayList<Integer>();
        }
    }
}


Measured memory_bytes: 100660
n = int(input())
apple = []
for _ in range(n):
    apple.append(list(map(str, input().split())))
count = 0
for i in apple:
    if i[1] == "JPY":
        count += int(i[0])
    else:
        count += 38e4 * float(i[0])
print(count)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
#define N 200005
int n, A[N], F[N];
ll k, B[N];
bool cmp(ll a, ll b){return a < b;}
int main()
{
	scanf("%d%lld", &n, &k);
	for (int i = 1; i <= n; i++)
		scanf("%d", &A[i]);
	for (int i = 1; i <= n; i++)
		scanf("%d", &F[i]);
	sort(A + 1, A + n + 1);
	ll l = 0, r = 1ll << 60;
	while (l < r)
	{
		ll mid = (l + r) >> 1;
		for (int i = 1; i <= n; i++)
			B[i] = mid / F[i];
		sort(B + 1, B + n + 1);
		ll sum = 0;
		for (int i = 1; i <= n; i++)
			sum += max(0ll, A[i] - B[i]);
		if (sum <= k)
			r = mid;
		else
			l = mid + 1;
	}
	printf("%lld\n", l);
}


Measured memory_bytes: 3328
#include <iostream>
#include <cmath>

int main(){
   int N, D;
   std::cin >> N >> D;
   int X[N][D];
   for(int i=0; i<N; ++i){
      for(int j=0; j<D; ++j){
	 std::cin >> X[i][j];
      }
   }
   int ans = 0;
   for(int i=0; i<N; ++i){
      for(int j=i+1; j<N; ++j){
	 double d = 0;
	 for(int k=0; k<D; ++k){
	    d += (X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
	 }
	 d = sqrt(d);
	 int intd = d;
	 if(d-intd==0) ++ans;
      }
   }
   std::cout << ans << std::endl;
   return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<P,int>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    string st;
    cin>>st;
    if(st.length()<4||st.substr(0,4)!="YAKI"){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 300000
typedef long long ll;

int main(){
  ll ans=0;
  int N;
  cin>>N;
  ll A[110000],B[110000],C[110000];
  for(int i=0;i<N;i++){
    cin>>A[i];
  }

  for(int i=0;i<N;i++){
    cin>>B[i];
  }

  for(int i=0;i<N;i++){
    cin>>C[i];
  }

  sort(A,A+N);
  sort(C,C+N);

  for(int i=0;i<N;i++){
    ans+=distance(A,lower_bound(A,A+N,B[i]))*(N-distance(C,upper_bound(C,C+N,B[i])));
  }
  cout<<ans<<endl;
}


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

template<typename T>
void test(T a){
    return ;
}

signed main(){
    int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k; cin >> k;
    cout << a[k-1] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define ff first
#define ss second
#define p pair<ll,ll>
#define pb push_back
#define endl '\n'
#define w(t) ll test;cin>>test;while(test--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define iof  freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define pi acos(-1)
const int mxn=1e9+5;
int main()
{
    fast;
    set<string>st;
    w(t)
    {
        string s;
        cin>>s;
        st.insert(s);
    }
    cout<<st.size()<<endl;
}



Measured memory_bytes: 19184
using System;
using System.Collections.Generic;
class Program
{
    //static List<string> str = new List<string>();
	static void Main(string[] args)
	{
		// 入力フェーズ
		int N = Int32.Parse(Console.ReadLine());
		string[] input = Console.ReadLine().Split(' ');

		// 並び変えなくても順番に並んでいたらOK
		if(isOrder(N, input))
		{
			Console.WriteLine("YES");
			return;
		}

		// iとj番目を入れ替えて順番に並んでいるかチェックする
		for(int i=0; i<N-1; i++)
		{
				for(int j=i+1; j<N; j++)
				{
					string[] dst = new string[N];
					Array.Copy(input, dst, N);
					if(changeOrder(N, i, j, dst))
					{
						Console.WriteLine("YES");
						return;
					}
				}
		}
		Console.WriteLine("NO");


    }
static bool changeOrder(int N, int i, int j, string[] input)
{
	// iとj番目を入れ替えてチェックする
	string stri = input[i];
	string strj = input[j];
	input[i] = strj;
	input[j] = stri;

	return isOrder(N, input);
}

static bool isOrder(int N, string[] input)
{
	bool ret = true;
	// 順番に並んでいたらOK
	for(int i=0; i<N; i++)
	{
		if(Int32.Parse(input[i]) == (i+1))
			continue;
		else
		{
			ret = false;
			break;
		}
	}
	return ret;
}

}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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 (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  int n,a,b;
  cin >> n >> a >> b;
  cout << min(a*n, b) << "\n";
}


Measured memory_bytes: 256