akhauriyash/Code-Regression huggingface dataset:
n=97
def c(i,j,k):print('<',i,j,k)
def a(i,j,k):print('+',i,j,k)
def m(i,j,k):
	for t in range(59):
		a(k,k,k)
		for s in range(t+1):
			if t-30<s<30:a(i+t-s,j+s,98);c(n,98,99);a(k,99,k)
def d(x,i,j):
	for t in range(30):
		a(j+t-1,j+t-1,j+t)
		a(j+t,n,j+t)
		for s in range(j+t,j+29):a(s,s,s+1)
		c(j+29,x,i+t)
		a(j+t-1,j+t-1,j+t)
		a(j+t,i+t,j+t)
print(3933)
a(0,1,n)
c(2,n,n)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in range(59):
	a(2,2,2)
	for s in range(t+1):
		if t-30<s<30:a(5+t-s,36+s,98);c(n,98,99);a(2,99,2)

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

int main()
{
    int h1,m1,h2,m2,k,d;
    cin>>h1>>m1>>h2>>m2>>k;
    d=h2*60+m2-h1*60-m1-k;
    cout<<d<<endl;
    return 0;
}


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

// A[i] * A[j] <= keyとなる組み合わせの個数がK以上か
bool C(const ll &key, const vector<ll> &arr, const ll &asize, const ll &k) {
	ll eq_or_less_than_key = 0;
	for(int i = 0;i < asize - 1;i++) {
		// i < jとなり, arr[i] * arr[j] <= keyとなる個数
		if(arr[i] >= 0) {
			int left = i, right = asize;
			while(right - left > 1) {
				int mid = (left + right) >> 1;
				if(arr[i] * arr[mid] <= key) left = mid;
				else right = mid;
			}
			eq_or_less_than_key += (left - i);
		} else {
			int left = i, right = asize;
			while(right - left > 1) {
				int mid = (left + right) >> 1;
				if(arr[i] * arr[mid] <= key) right = mid;
				else left = mid;
			}
			eq_or_less_than_key += (asize - right);
		}
	}
	if(eq_or_less_than_key >= k) return true;
	else return false;
}

int main(void) {
	ll N, K;
	cin >> N >> K;
	vector<ll> A(N);
	for(auto &a : A) cin >> a;
	sort(A.begin(), A.end());
	// ok以下で成立
	ll ok = 1e18, ng = -1e18;
	while(ok - ng > 1) {
		ll mid = (ok + ng) / 2;
		if(C(mid, A, N, K)) ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
}

Measured memory_bytes: 1792
H,W=map(int,input().split())
S=["*"*(W+2)]
for _ in range(H):
    S.append("*"+input()+"*")
S.append("*"*(W+2))

T=[]

for y in range(H+2):
    H=""
    for x in range(W+2):
        if S[y][x]==".":
            K=0
            for b in range(-1,2):
                for a in range(-1,2):
                    K+=(S[y+b][x+a]=="#")
            H+=str(K)
        else:
            H+=S[y][x]
    T.append(H)

print("\n".join(map(lambda x:x[1:-1],T[1:-1])))


Measured memory_bytes: 73588
s = int(input())
a = set()
a.add(s)
index = 2
while True:
  if s % 2 == 0:
    s = int(s/2)
  else:
    s = 3*s + 1

  if s in a:
    print(index)
    exit()
  else:
    index += 1
    a.add(s)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#include<functional>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.20f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define cotu cout
#define Endl endl
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
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;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int k; cin >> k;
    string ans = "ACL";
    rep(i,0,k) cout << ans;
    cout << endl;
    return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll dp[405][405];
ll a[405];
ll sum[405];
void search(int left, int right){
    dp[left][right] = 1e16;
    for(int join = left; join < right; join++){
        ll now = 0;
        now += dp[left][join];
        now += dp[join + 1][right];
        now += sum[right] - sum[join];
        now += sum[join] - sum[left - 1];
        dp[left][right] = min(dp[left][right], now);
    }
    //cout << left << " " << right << " " << dp[left][right] << endl;
}
int main() {
    //cout.precision(10);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        sum[i] = sum[i - 1] + a[i];
    }
    for(int delta = 2; delta <= n; delta++){
        for(int left = 1; left + delta - 1 <= n; left++){
            search(left, left + delta - 1);
        }
    }
    cout << dp[1][n] << endl;
    return 0;
}


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

int main(){
  int a,b;
  string s;
  cin>>a>>b>>s;
  string t="Yes";
  rep(i,0,a+b+1){
    if(i==a){
      if(s[i]!='-'){
        t="No";
      }
    }
    else{
      if(s[i]=='-'){
        t="No";
      }
    }
  }
  cout<<t<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    double A,B;
    cin>>A>>B;
    int a0=ceil(A/0.08),a1=ceil((A+1)/0.08-1),b0=ceil(B/0.1),b1=ceil((B+1)/0.1-1);
    if(a0<=b1&&b0<=a1) cout<<max(a0,b0);
    else cout<<-1;
}


Measured memory_bytes: 256
#include<stdio.h>
int search(int [],int ,int);
int main(){
  int i,n,A[10000+1],q,judge,count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++) {
    scanf("%d",&judge);
    if(search(A,n,judge))count++;
  }
  printf("%d\n",count);
  return 0;
}

int search(int a[],int n,int key){
  int i=0;
  a[n]=key;
  while(a[i]!=key)i++;
  return i!=n;
}



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

map<int,int> m;
vector<int> v;

int main()
{
	int n;
	cin>>n;
	
	for (int i=1; i<=n; i++)
	{
		int x;
		cin>>x;
		if (m[x]==0) v.push_back(x);
		m[x]++;
	}	
	
	int ans=0;
	for (int i=0; i<v.size(); i++)
	{
		if (v[i]>m[v[i]])
			ans+=m[v[i]];
		else if (v[i]<m[v[i]])
			ans+=m[v[i]]-v[i];
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5112
// Problem : A - Duplex Printing
// Contest : AtCoder Beginner Contest 157
// URL : https://atcoder.jp/contests/abc157/tasks/abc157_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#define DEBUG(...) cerr << #__VA_ARGS__ << ": ", debug(__VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator << (ostream &os, const vector<T> &v) {os << "["; for (int i=0; i<(int)v.size(); i++) {if (i) os << ", "; os << v[i];} return os << "]";}
void debug() {cerr << "\n";} template<typename T, typename... Args> void debug(T x, Args... args) {cerr << x << "; "; debug(args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    int n;
    cin >> n;
    cout << (n + 1) / 2 << "\n";

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main
{
  public static void main(String[] args) {
    int x, y;
    Scanner s = new Scanner(System.in);
    x = s.nextInt();
    y = s.nextInt();
    int perimeter = 2*x + 2*y;
    System.out.println(x*y+" "+perimeter);
  }
}

Measured memory_bytes: 26200
#include<cstdio>
#include<cmath>
#include<complex>
#include<string>
#include<map>
using namespace std;
typedef complex<double> xy_t;
xy_t P[110];

int main(){
  int N=0;
  double x,y;
  while(~scanf("%lf,%lf",&x,&y)){
      P[N]=xy_t(x,y);
      N++;
      }
  double sum=0.0;

  for(int i=0;i+2<N;++i){
    xy_t a=P[0],b=P[i+1],c=P[i+2];
    sum+= ((conj(c-a)*(b-a)).imag())/2.0;
  }

  printf("%.6f\n",abs(sum));
  return 0;

}

Measured memory_bytes: 1088
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vector<map<int,int>> vm(N);
  rep(i,N) {
    string s;
    cin >> s;
    rep(j,sz(s)) {
      vm[i][s[j]-'a']++;
    }
  }
  string ans = "";
  rep(k,26) {
    int mi = INF;
    rep(i,N) {
      mi = min(mi,vm[i][k]);
    }
    rep(i,mi) {
      ans += k+'a';
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
$VERBOSE = nil

class String
	def !@
		(?A.ord + (ord - ?A.ord + 1) % 26).chr
	end

	def -@
		(?A.ord + (ord - ?A.ord + 25) % 26).chr
	end

	def contract!
		k = size
		loop do
			0 while gsub!(/\+\-|\-\+/, "")
			0 while gsub!(/\+([A-Z])/){|x| !$1}
			0 while gsub!(/\-([A-Z])/){|x| -$1}

			0 while gsub!(/\[([^\[\]]+?)\]/) do |x|
				$1.scan(/
					[-+]*[A-Z?]	
				/x).reverse.join
			end
			break if k == size
			k = size
		end
	end
end

loop do
	s = gets.chomp
	break if s == ?.
	s.contract!
	s.tr!(?+, ?!)

	k = s.count(??)
	if k == 0
		puts s
	else
		a = []
		(?A..?Z).to_a.repeated_permutation(k) do |perm|
			e = s.dup
			perm.each do |c|
				e.sub!(/([\-\!]*)\?/){|x| eval($1 + "?" + c)}
			end
			a << e
		end	
		puts a.min
	end
end

Measured memory_bytes: 13792
//-----------------------
// author : xyqkoala
// time : 2020-09-14
//-----------------------

#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve();


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


void solve(){
	vector<int> dp1(2,0),dp2(2,0);
	cin>>dp1[0]>>dp1[1]>>dp2[0]>>dp2[1];
	LL res = INT64_MIN;
	for(int i=0;i<2;i++){
		for(int j=0;j<2;j++){
			res = max(res,1ll * dp1[i]*dp2[j]);
		}
	}
	cout<<res<<endl;
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  long long a[n], v[n], f = 0, sum = 0, min = (int)1e9;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    if(a[i] < 0) f += 1; 
    v[i] = (a[i] > 0 ? a[i] : - a[i]);
    sum += v[i];
    if(v[i] < min) min = v[i];
  }
  cout << sum - (f % 2 ? 2 * min : 0) << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void){
	char roma[128];
	int i,sum;
	
	while(scanf("%s",roma) != EOF){
		sum = 0;
		for(i=0;roma[i] != '\0';i++){
			if(roma[i] == 'M'){
				sum += 1000;
			}else if(roma[i] == 'D'){
				if(roma[i+1] == 'M'){
					sum -= 500;
				}else{
					sum += 500;
				}
			}else if(roma[i] == 'C'){
				if(roma[i+1] == 'M' || roma[i+1] == 'D'){
					sum -= 100;
				}else{
					sum += 100;
				}
			}else if(roma[i] == 'L'){
				if(roma[i+1] == 'M' || roma[i+1] == 'D' || roma[i+1] == 'C'){
					sum -= 50;
				}else{
					sum += 50;
				}
			}else if(roma[i] == 'X'){
				if(roma[i+1] == 'M' || roma[i+1] == 'D' || roma[i+1] == 'C' || roma[i+1] == 'L'){
					sum -= 10;
				}else{
					sum += 10;
				}
			}else if(roma[i] == 'V'){
				if(roma[i+1] == 'M' || roma[i+1] == 'D' || roma[i+1] == 'C' || roma[i+1] == 'L' || roma[i+1] == 'X'){
					sum -= 5;
				}else{
					sum += 5;
				}
			}else if(roma[i] == 'I'){
				if(roma[i+1] == 'I' || roma[i+1] == '\0'){
					sum += 1;
				}else{
					sum -= 1;
				}
			}
		}
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 540
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#include <string.h>
#include <map>
#include <bitset>

#define Z class
#define ln cout<<'\n'
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (n); ++i)
//ASCII a=97, A=65
// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
// sort(vec.begin(), vec.end()); std::greater<>()
// reverse(vec.begin(), vec.end());
// scanf("%s",s);
// printf("%d\n",end-start+1);
// ceil (a + (b - 1)) / b

using namespace std;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
using pll = pair<long long, long long>;

template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;

//DFSしながら色塗り
int N;
Graph graph;
vector<int> res;

void DFS(int v, int parent, int color) {
    res[v] = color;
    for (auto e : graph[v]) {
        // 枝刈り
        if (e.first == parent) continue;
        if (e.second & 1) {
            //重みによって分岐
            DFS(e.first, v, 1-color);
        } else {
            DFS(e.first, v, color);
        }
    }  
}

int main(){
    cin >> N;
    graph.assign(N, vector<Edge>());
    for (int i = 0; i < N-1; i++) {
        int u, v, w; cin >> u >> v >> w;
        --u; 
        --v;
        graph[u].push_back(Edge(v, w));
        graph[v].push_back(Edge(u, w));
    }
    res.assign(N, 0);
    DFS(0, -1, 1);
    for (auto v : res) {
        cout << v << endl;
    }
}


Measured memory_bytes: 8960
import math
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
a=[i for i in range(1,n+1)]
b=[i for i in range(1,n+1)]
p1=0
q1=0
for i in range(0,n):
  x=a.index(p[i])
  p1 +=math.factorial(n-1-i)*(x-1)
  a.remove(p[i])
  y=b.index(q[i])
  q1 +=math.factorial(n-1-i)*(y-1)
  b.remove(q[i])
print(abs(p1-q1))

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

int main(int argc, char const *argv[])
{
	int s;
	cin >> s;
	int h = s / 3600;
	int m = (s - 3600 * h) / 60;
	int t = s - 60 * (60 * h + m);
	cout << h << ":" << m << ":" << t << endl;
	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
    s.find_by_order(k) ---> returns iterator to the element at index(from 0) k
    s.order_of_key(val) ---> number of elements that are strictly smaller than the given value
*/
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int tc; cin >> tc; cin.ignore(); while(tc--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define HASH 18014398241046527
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
template <typename T>
ll SIZEOF(T a){return (ll)a.size();}
ll xlcm(ll a, ll b){return (a/__gcd(a, b))*b;}

ll dx[] = {1, 0, -1, 0};
ll dy[] = {0, 1, 0, -1};


const int N = 100005;

void SOLVE(){
    inp(x);
    cout << 1-x << endl;
}

int main() {
	fastIO();
	// #ifndef ONLINE_JUDGE
    //     freopen("i.txt", "r", stdin);
    //     freopen("o.txt", "w", stdout);
	// #endif

    ll TC = 1;
    // cin >> TC;
    for(ll tc1=1; tc1<=TC; tc1++){
        // cout << "Case #" << tc1 << ": ";
        SOLVE();
    }
    printclock;
}

Measured memory_bytes: 3772
#include<vector>
#include<iostream>
#include<string>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> a(101);
	for (int i = 0; i < n; i++)
	{
		cin >> a.at(i);
	}
	for (int i = 1; i <= n; i++)
	{
		int x = 0;
		x = n - i ;
		cout << a.at(x);
		if (i!=n)
		{
			cout << " ";
		}
		else
		{
			cout<<endl;
		}
	}
	return 0;
	
}


Measured memory_bytes: 3104
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <numeric>
 
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
ll N,K;
ll plu;
int main() {
    cin >> N >> K;
    if(K-2*N>=0 && (K-2*N)%2==0 && 4*N-K>=0 && (4*N-K)%2==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" <<endl;
    }
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);
  co(a[0]+a[1]);
  
  
  return 0;
}


Measured memory_bytes: 256
s = gets.delete!("\n").split(//u).map &:to_i
ss = s.each_slice(2).to_a
s1 = ss.map {|x| x[0]}
s2 = ss.map {|x| x[1]}
s2.delete(nil)

ans1 = s1.count(0) + s2.count(1)
ans2 = s1.count(1) + s2.count(0)

puts [ans1, ans2].min


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

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
vector <int> numeri;
int vettore[9],N,Z,r[9],l=0;
cin>>vettore[0]>>vettore[1]>>vettore[2];
cin>>vettore[3]>>vettore[4]>>vettore[5];
cin>>vettore[6]>>vettore[7]>>vettore[8];
cin>>N;
for(int i=0;i<N;i++){
	cin>>Z;
	numeri.push_back(Z);
}
for(int a=0;a<9;a++)
{
	for(int b=0;b<N;b++)
	{
		if(vettore[a]==(numeri.at(b)))
		{
		r[a]=1;
		break;
		}
		else
		{
			r[a]=0;
		}
	}
	
}
for(int z=0;z<3;z++)
{
	if(r[z]==r[z+3]&&r[z+3]==r[z+6]&&r[z]==1)
	{
		l=1;
		break;
	}
	else if(r[0+3*z]==r[1+3*z]&&r[1+3*z]==r[2+3*z]&&r[0+3*z]==1)
	{
		l=1;
		break;
	}
}
if(r[0]==r[4]&&r[4]==r[8]&&r[0]==1)
{
	l=1;
}
if(r[2]==r[4]&&r[4]==r[6]&&r[2]==1)
{
	l=1;
}
if(l==1)
{
	cout<<"Yes";
}
if(l==0)
{
	cout<<"No";
}

	return 0;
}

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

bool prime(ll x){
if(x==1)return false;
else{
    for(ll i=2;i*i<=x;i++)
    {
        if(x%i==0)return false;
    }
}
return true;
}
int main() {
    ll x;cin>>x;
    while(true){
        if(prime(x)){cout<<x;break;}
            else x++;
    }

    }


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chkmax(T& a,T b){return a<b?a=b,1:0;}
template<class T> inline bool chkmin(T& a,T b){return a>b?a=b,1:0;}
template<typename T> inline T& read(T& x){
    static char c; bool flag=0;
    while(!isdigit(c=getchar())) if(c=='-') flag=1;
    for(x=c-'0';isdigit(c=getchar());(x*=10)+=c-'0');
    if(flag) x=-x;
    return x;
}
const int maxn=2010,mo=1e9+7;
int n,m,C[maxn][maxn],ans;
void init(){
    C[0][0]=1;
    for(int i=1;i<=2001;i++){
        C[i][0]=1;
        for(int j=1;j<=i;j++) C[i][j]=(C[i-1][j]+C[i-1][j-1])%mo;
    }
}
int main(){
#ifdef xffyjq
    freopen("exec.in","r",stdin);
    freopen("exec.out","w",stdout);
#endif
    init();
    read(n); read(m);
    ans=n+1;
    for(int i=1;i<m;i++)
        for(int j=0;j<=min(i-1,n-i);j++)
            ans=(1ll*ans+1ll*C[m-1][i]*C[i-1][j]%mo*C[n-i-j+2][2]%mo)%mo;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 15104
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int N, K;
  cin >> N >> K;
  int h[N];
  
  int count = 0;
  for(int i = 0; cin >> h[i]; i++){
    if(h[i] >= K)
      count++;
  }
  
  cout << count << endl;
    
  return 0;
}

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

typedef unsigned long long int ull;

struct data { ull A; int B; };

bool cmp(const data &value_a, const data &value_b) {
  return value_a.A < value_b.A;
}

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

  struct data drink[N]; 
  for (int i = 0; i < N; ++i) {
    cin >> drink[i].A >> drink[i].B; 
  }
  
  sort(drink, drink+N, cmp);
  
  int sum = M;
  ull answer = 0;
  for (int i = 0; i < N; ++i) {
    if (sum == 0) { break; }
    else if (sum - drink[i].B < 0) { 
      for (int j = drink[i].B; j > 0; --j) {
        if (sum == 0) { break; }
        sum--;
        answer += drink[i].A;
      }
    }
    else {
      sum -= drink[i].B;
      answer += drink[i].A * drink[i].B;
    }
  }
  cout << answer << endl;
}

Measured memory_bytes: 1792
// D - Knapsack 1
#include <bits/stdc++.h>
using namespace std;
// void dpprn(vector<long long> &v){ for(int i=0;i<v.size();i++) cout<<v[i]<<(i<v.size()-1?",\t":"\n"); }

int main(){
	int N,W; cin>>N>>W;
	vector<long long> dp(W+1);
	while(N--){
		int w,v; cin>>w>>v;
		for(int n=W; n>=w; n--) dp[n] = max(dp[n], dp[n-w] + v);
		// dpprn(dp);//
	}
	cout<< dp[W] <<endl;
}

Measured memory_bytes: 1024
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n;
    cin >> n;
    vector<int> b(n);
    rep(i, n) cin >> b[i];

    stack<int> ans;
    for(int i = n; i > 0; i--){
        int x = 0;
        for(int j = 1; j <= i; j++){
            if(j == b[j-1]){
                x = j;
            }
        }
        if(x == 0){
            cout << -1 << endl;
            return 0;
        }
        b.erase(b.begin() + x - 1);
        ans.push(x);
    }

    while(not ans.empty()){
        cout << ans.top() << endl;
        ans.pop();
    }

    return 0;
}


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

int main(){
	int r,c,i,j;
	cin>>r;
	cin>>c;
	int sum;
	int seat[r+1][c+1];
	for(i=0;i<r;i++){
		sum=0;
		for(j=0;j<c;j++){
			cin>>seat[i][j];
			sum+=seat[i][j];
		}
		seat[i][c]=sum;
	}
	for(i=0;i<=c;i++){
		sum=0;
		for(j=0;j<r;j++){
			sum+=seat[j][i];
		}
		seat[r][i]=sum;
	}
	for(i=0;i<=r;i++){
		for(j=0;j<c;j++){
			cout<<seat[i][j]<<" ";
		}
		cout<<seat[i][j]<<endl;
	}
	return  0;
}

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

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

int main(){
  int r,d,x;
  cin >> r >> d >> x;

  rep(i,10){
    x = r*x-d;
    cout << x << endl;
  }
}

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

void print_elements(int, int[]);

/* ALDS1_1_A: Insertion sort */
int main() {
    int length;
    cin >> length;

    int elements[length];
    for (int i = 0; i < length; i++) {
        cin >> elements[i];
    }
    print_elements(length, elements);

    int elem, i_before;
    for (int i = 1; i < length; i++) {
        elem = elements[i];
        i_before = i - 1;

        while (0 <= i_before && elem < elements[i_before]) {
            elements[i_before + 1] = elements[i_before];
            i_before--;
        }
        elements[i_before + 1] = elem;
        print_elements(length, elements);
    }

    return 0;
}

void print_elements(int length, int elements[]) {
    cout << elements[0];
    for (int i = 1; i < length; i++) {
        cout << " " << elements[i];
    }
    cout << endl;
}

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

int main() 
{ 
	int n;
	cin>>n;
	const int size=100003;
	bool prime[size];
	int ans=0;
	memset(prime, true, sizeof(prime)); 

	for (int p=2; p*p<=size; p++) 
	{
		if (prime[p] == true) 
		{
			for (int i=p*p; i<=size; i += p) 
				prime[i] = false; 
		} 
	} 

	if(prime[n]==true){
        ans= n;
    }
    else{
        for(int i=n+1;i<=size;i++){
            if(prime[i]==true){
                ans= i;
                break;
            }
        }
    }
	
    cout<<ans;
} 


Measured memory_bytes: 384
#include<stdio.h>
#include<limits.h>
#define N 100

int m[N][N];
int p[N];
int n;

void matrixcChainOrder(){
  int l,j=0,k,q,i;

  for(i=1;i<=n;i++){
    m[i][i]=0;
  }
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=INT_MAX;
      for(k=i;k<=j-1;k++){
	q=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
	if(q<m[i][j]){
	  m[i][j]=q;
	}
      }
    }
  }
}

int main(){
  int i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d%d",&p[i-1],&p[i]);
  }
  matrixcChainOrder();
  printf("%d\n",m[1][n]);
  return 0;
}

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

int main(){
	int n,ac=0,wa=0,tle=0,re=0;
	char tmp[5];
	if(scanf("%d",&n)<0){
		exit(1);
	}

	for(int i=0;i<n;i++){
		if(scanf("%s",tmp)<0){
			exit(1);
		}
		if(strcmp(tmp,"AC")==0){
			ac++;
		}else if(strcmp(tmp,"WA")==0){
			wa++;
		}else if(strcmp(tmp,"TLE")==0){
			tle++;
		}else{
			re++;
		}
	}

	printf("AC x %d\n",ac);
	printf("WA x %d\n",wa);
	printf("TLE x %d\n",tle);
	printf("RE x %d\n",re);

	return 0;
}


Measured memory_bytes: 1736
// compile & run:     g++ main.cpp -o main && ./main < input.txt > out.txt
// Problem Url:
//
// © Jose Garfias Lopez
//

#include <cstdio>
#include <iostream>
#include <string> 

using namespace std;

int main() {
    int N;
    cin>>N;
    if (N%10 == 0) {
        cout<<10<<endl;
    } else {
        string number = to_string(N);
        int sum = 0;
        for (int i=0; i<number.length(); i++) {
            int n = number[i] - 48;
            sum += n;
        }
        cout<<sum<<endl;
    }
    return (0);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		String s = sc.next();
		if (a >= 3200) {
			System.out.println(s);
		} else {
			System.out.println("red");
		}
	}
}


Measured memory_bytes: 20820
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(b%2==0&&(b-2*a)/2<=a&&b-2*a>=0){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
 
}

Measured memory_bytes: 3512
#include<iostream>
#include<vector>
using namespace std;
using ll=long long;
 string s;
 ll cnt[2020];
int main(){
 
  cin>>s;
  int n=s.size();
  ll ans=0;
  cnt[0]=1;
  int tot=0;
  int p=1;
  for(int i=n-1;i>=0;i--){
    tot=(tot+(s[i]-'0')*p)%2019;
    ans+=cnt[tot];
    p=(p*10)%2019;
    cnt[tot]++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3776
import java.util.Arrays;

public class Main {

  private static void solve() {
    char[] s = ns();
    int n = s.length;
    int AL = 26;
    int[] dp = new int[n + 2];
    Arrays.fill(dp, Integer.MAX_VALUE / 2);
    
    dp[n + 1] = 0;
    dp[n] = 1;
    int[][] g = new int[n + 1][2];
    g[n] = new int[] {0, n + 1};
    
    int[] f = new int[AL];
    Arrays.fill(f, n + 1);
    
    for (int i = n - 1; i >= 0; i --) {
      f[s[i] - 'a'] = i + 1;
      for (int j = 0; j < AL; j ++) {
        if (1 + dp[f[j]] < dp[i]) {
          dp[i] = 1 + dp[f[j]];
          g[i] = new int[] {j, f[j]};
        }
      }
    }

    String ret = "";
    for (int i = 0; i < n + 1;) {
      char c = (char)(g[i][0] + 'a');
      ret += c;
      i = g[i][1];
    }
    System.out.println(ret);
  }


  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = System.getProperty("debug");
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 97492
a=[]
b=[]
op=[]
while(True):#"?"が入るまでループ
    x,symbol,y = map(str,input().split())
    if symbol == "?":
        break
    else:
        a.append(int(x))
        b.append(int(y))
        op.append(symbol)
for i in range(len(a)):#計算分け
    if op[i] == "+":
        print(a[i]+b[i])
    elif op[i] == "-":
        print(a[i]-b[i])
    elif op[i] == "*":
        print(a[i]*b[i])
    elif op[i] == "/":
        print(int(a[i]/b[i]))


Measured memory_bytes: 5604
import java.util.*;

public class Main {
	

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int a1 = a + 1;
        int b1 = b + 1;
        int res = -1;
        for(int i = 0; i<=1262; i++) {
        	if(i*0.08>=a && (a+1)>i*0.08 && i*0.1>=b && (b+1)>i*0.1) {
        		res = i;
        		break;
        	}
        }
        
       
        
        
        
        
        
        
        
        System.out.print(res);
        
	}
}

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

int main() {
  int n, k; cin >> n >> k;
  vector<int> l(n);
  for(int i = 0; i < n; i++) cin >> l.at(i);
  
  sort(l.begin(), l.end(), greater<int>());
  int ans = 0;
  for(int i = 0; i < k; i++){
    ans += l.at(i);
  }
  
    cout << ans << endl;
}


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

using namespace std;

using int64 = long long;

int main() {
  string s;
  cin >> s;
  set< string > st;
  for(int i = 0; i < s.size(); i++) {
    for(int j = 1; j <= 10; j++) {
      st.emplace(s.substr(i, j));
    }
  }
  auto cur = st.begin();
  int K;
  cin >> K;
  --K;
  while(K--) ++cur;
  cout << *cur << endl;
}


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

int main()
{
  int64_t N;
  cin >> N;
  
  vector<int64_t> a(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  
  int64_t sum = 0;
  for(int i = 1; i < N; i++){
      if(a.at(i) < a.at(i-1)){
        sum += a.at(i-1) - a.at(i);
        a.at(i) = a.at(i-1);
      }else{
        sum += 0;
      }//else
  }
  
  cout << sum << endl;
}

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

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,M;
	cin >> N >> M;
	string s;
	cin >> s;
	int now = N;
	vector<int> ans;
	while(now>0){
		bool ok = 0;
		for(int i=M;i>0;i--){
			if((now-i)>=0 && s[now-i]=='0'){
				now -=i;
				ok = 1;
				ans.push_back(i);
				break;
			}
		}
		if(!ok){
			cout << -1 << endl;
			return 0;
		}
	}
	for(int i=ans.size()-1;i>=0;i--){
		cout << ans[i] << " ";
	}
}

Measured memory_bytes: 1096
// In the name of GOD
 
#include <bits/stdc++.h>
#define ll long long
#define pp pair <int, int>
using namespace std;
const int N = 2e5 + 10, MOD = 1e9 + 7;
const ll INF = 1e18;

void solve() {
	int n;
	cin >> n;
	vector <double> A(n);
	for (int i = 0; i < n; ++i)
		cin >> A[i];
	sort(A.begin(), A.end());
	for (int i = 0; i < n - 1; ++i) {
		A[i + 1] = (A[i] + A[i + 1])/2;
	}
	cout << A[n - 1];
}

int main () {
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int tt = 1;
    // cin >> tt;
    for (int tc = 1; tc <= tt; ++tc) {
        solve();
    }
}                                  

Measured memory_bytes: 256
using System;

namespace A___Happy_Birthday_
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);
            if(a<=8&&b<=8)
            {
                Console.WriteLine("Yay!");
            }
            else
            {
                Console.WriteLine(":(");
            }
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
#include<math.h>
main()
{
int a,b,f,k=0,i,x=0,y=0,z=0,count=0,n,w;
scanf("%d %d %d",&n,&a,&b);
for(i=1;i<=n;i++)
{
w=floor(i*1.000/10000);
x=floor((i-(w*10000))*1.000/1000);
y=floor((i-(x*1000)-(w*10000))*1.000/100);
z=floor((i-(y*100)-(x*1000)-(w*10000))*1.000/10);
k=floor(i-(y*100)-(z*10)-(x*1000)-(w*10000));
f=x+y+z+k+w;
if(f>=a&&f<=b)
{
count=count+i;
}


}
printf("%d",count);
}

Measured memory_bytes: 128
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

ll n,k,m;
int arr[100005];
map<int,int> pos;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin.exceptions(ios::badbit | ios::failbit);
	
	
	cin>>n>>k>>m;
	ll ans=0;
	
	ll idx=0;
	while (idx<n){
		if (pos.count(k)){
			int length=0;
			ll val=0;
			
			rep(x,pos[k],idx){
				length++;
				val+=arr[x];
			}
			
			ll left=n-idx;
			
			idx+=left/length*length;
			ans+=left/length*val;
			
			while (idx<n){
				ans+=k;
				k=(k*k)%m;
				idx++;
			}
		}
		else{
			arr[idx]=k;
			pos[k]=idx;
			ans+=k;
			idx++;
			
			k=(k*k)%m;
		}
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 6176
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

ll w[100001];
ll d[100001];

struct union_find {
  vector<int> rid_;

  union_find(int n) { rid_.assign(n, -1); }

  void operator()(int u, int v, int c) {
    int nu = operator[](u), nv = operator[](v);
    if(nu == nv) return;
    rid_[nu] = nv;
    d[nu] = c - d[u] + d[v];
  }

  int operator[](int x) {
    if(rid_[x] < 0) {
      return x;
    }
    else {
      int p = rid_[x];
      rid_[x] = operator[](p);
      d[x] += d[p];
      return rid_[x];
    }
  }

};

int main() {

  int N, Q; cin >> N >> Q;
  union_find uf(N);

  rep(_, Q) {
    string query; cin >> query;
    if(query[0] == 'I') {
      ll a, b, c; cin >> a >> b >> c; a--, b--;
      uf(a, b, c + w[a] - w[b]);
      w[a] += c;
      w[b] += c;
    } else {
      ll a, b; cin >> a >> b; a--, b--;
      if(uf[a]==uf[b]) cout << - d[b] + d[a] + w[b] - w[a] << endl;
      else cout << "WARNING" << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 4812
import math
from collections import Counter, defaultdict

def ncr(n, r):
	f = math.factorial
	return f(n)//f(r)//f(n-r)

n = int(input())

dct = defaultdict(int)

for i in range(n):
	counter = Counter(input().strip())
	tpl = tuple(sorted(counter.items()))
	dct[tpl] += 1


ans = sum(ncr(val, 2) for val in dct.values() if val>1)
print(ans)

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

using namespace std;

typedef long long ll;

ll n,m;

bool check(ll p){
	if(m<2*p){
		return 0;
	}
	if(n+(m-2*p)/2<p){
		return 0;
	}
	return 1;
}

int main(){
	cin >> n >> m;
	ll l=0,r=m;
	while(l+1<r){
		ll mid=(l+r)>>1;
		if(check(mid)){
			l=mid;
		}
		else{
			r=mid;
		}
	}
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
 int main()
 {
    char a[15];
    gets(a);
    int i,q=0,m,p=0;
    int x=strlen(a);
    for(i=2;i<x-1;i++){
        if(a[i]=='C'){
            p++;
            m=i;
        }
    }
    for(i=1;i<m;i++){
        if(a[i]>='A' && a[i]<='Z')
        q++;
    }
    for(i=m+1;i<x;i++){
        if(a[i]>='A' && a[i]<='Z')
        q++;
    }
    if(a[0]=='A' && p==1 && q==0){
        printf("AC");
    }
    else{
        printf("WA");
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
using namespace std;
int n,m,a[100005],cnt[100005];
int main(){
	cin>>n;
	int ans=0;
	for(register int i=1;i<=n;i++)cin>>a[i];
	for(register int i=1;i<=n;i++)if(a[i]==i){
		if(i==n)ans++,swap(a[i],a[i-1]);
		else swap(a[i],a[i+1]),ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
from collections import defaultdict
N, M = map(int, input().split())
d = defaultdict(int)
for _ in range(M):
    a, b = map(int, input().split())
    d[a] += 1
    d[b] += 1
for k, v in d.items():
    if v % 2 != 0:
        print("NO")
        exit()
print("YES")

Measured memory_bytes: 9448
N = int(input())

A = []
for i in range(N):
  A.append(int(input()))

def GCD(a,b):
  if a < b:
    a, b = b, a
  while b > 0:
    a, b = b, a%b
  
  return a

def LCM(a,b):
  return a*b // GCD(a,b)

lcm = A[0]
for i in range(1,N):
  lcm = LCM(lcm, A[i])

print(lcm)

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b==c || c+a==b || b+c==a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
#define int long long 
	while (true) {
		int m, t, p, r;
		cin >> m >> t >> p >> r;
		int penalty[1000][1000] = {};
		tuple<int, int, int> team_info[1000] = {};
		if (m == 0) return 0;
		REP(i, r) {
			int a, b, c, d;
			cin >> a >> b >> c >> d;
			if (d == 0) {
				//Accepted
				get<0>(team_info[b]) += 1;//AC counter up
				get<2>(team_info[b]) += penalty[c][b];
				get<1>(team_info[b]) += a + penalty[c][b] * 20;
			}
			else {
				penalty[c][b]++;
			}
		}
		vector<tuple<int, int, int>> sortings;//AC,Time,number
		for (int i = 1; i <= t; ++i) {
			sortings.push_back(make_tuple(get<0>(team_info[i]), get<1>(team_info[i]) * -1, i));
		}
		sort(sortings.begin(), sortings.end(), greater<tuple<int, int, int>>());
		queue<int> teaming;
		pair<int, int> now_back = make_pair(-1, -1);
		for (int i = 0; i < sortings.size(); ++i) {
			if (now_back == make_pair(get<0>(sortings[i]), get<1>(sortings[i]))) {
				teaming.push(get<2>(sortings[i]));
			}
			else {
				if (teaming.empty() == false) {
					int ok = 1;
					while (teaming.empty() == false) {
						if (ok == 0) {
							cout << "=";
						}
						ok = 0;
						cout << teaming.front();
						teaming.pop();
					}
					cout << ",";
				}
				teaming.push(get<2>(sortings[i]));
				now_back = make_pair(get<0>(sortings[i]), get<1>(sortings[i]));
			}
		}
		if (teaming.empty() == false) {
			int ok = 1;
			while (teaming.empty() == false) {
				if (ok == 0) {
					cout << "=";
				}
				ok = 0;
				cout << teaming.front();
				teaming.pop();
			}
		}
		cout << endl;
	}
}



Measured memory_bytes: 10920
//#include </Users/piyush/Desktop/nodejs/first-app/CP/bits/stdc++.h>
 #include <bits/stdc++.h>
typedef long long ll;
using namespace std;


#define print(x) for(auto iuiuiuiuiui:x){ cout<<iuiuiuiuiui<<" ";}br;

#define br cout<<"\n"
//const int INF=1e9+5;
const ll INF=1e18L+5;


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    string a,b;
    cin>>a>>b;

    ll al=a.size();
    ll bl=b.size();

    vector<vector<ll>> dp(a.size()+1,vector<ll>(b.size()+1,0));


    for(ll i=1;i<=al;i++){
        for(ll j=1;j<=bl;j++){
            if(a[i-1]==b[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
            }else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }

    ll x=al,y=bl;
    string ans="";

//    for(ll i=1;i<=al;i++){
//        for(ll j=1;j<=bl;j++){
//            cout<<dp[i][j]<<" ";
//        }
//        br;
//    }

    while(x>0 and y>0)
    {
        while(x>0 and y>0 and dp[x-1][y]==dp[x][y]){
            x-=1;
        }

        while(x>0 and y>0 and dp[x][y-1]==dp[x][y]){
            y-=1;
        }

       if(x>0 and y>0 and dp[x-1][y-1]+1 == dp[x][y] ){
           ans+=b[y-1];

           x-=1;
           y-=1;
       }
    }

    reverse(ans.begin(),ans.end());
    cout<<ans;


}

Measured memory_bytes: 70784
n = int(input())
n = str(n)

a1 = [2,4,5,7,9]
a2 = [0,1,6,8]
a3 = [3]

f = int(n[-1])

if f in a1:
    print('hon')
          
elif f in a2:
    print('pon')
else:
    print('bon')

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

int main(){
  string s, t;
  cin >> s >> t;
  int sl=s.size();
  int tl=t.size();
  int mn = 1001001001;
  rep(i, sl){
    if(i+tl>sl)break;
    int num = 0;
    rep(j, tl){
      if(s[i+j]!=t[j])num++;
    }
    mn = min(num, mn);
  }

  cout << mn << endl;
  
  return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int h, w;
    cin >> h >> w;
    string s[h];
    rep(i, h) cin >> s[i];

    rep(i, h)
    {
        OP(s[i]);
        OP(s[i]);
    }

    return 0;
}

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


using namespace std;

int main(){
    string s,ans = "Yes";
    cin>>s;

    char one = s[0];

    int cnta = 0;
    int cntb = 0;
    int cntc = 0;
    int cntd = 0;
    for(int i = 0; i< 4; i++){
        if(s[0] == s[i]){
            cnta++;
            if(cnta == 3){
                ans = "No";
            }
        }
        if(s[1] == s[i]){
            cntb++;
            if(cnta == 3){
                ans = "No";
            }
        }
        if(s[2] == s[i]){
            cntc++;
            if(cnta == 3){
                ans = "No";
            }
        }
        if(s[3] == s[i]){
            cntd++;
            if(cnta == 3){
                ans = "No";
            }
        }
        
    }

    if(cnta == 2 && cntb==2 && cntc == 2 && cntd == 2){
        if(s[0] == s[1] == s[2] == s[3]){
            ans = "No";
        }
    }else{
        ans = "No";
    }

    
    cout << ans <<endl;

    return 0;
}

Measured memory_bytes: 256