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

#define rep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrep(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
using ll = long long;
const ll MOD = 1e9+7;

int dfs(int p,vector<vector<vector<int>>>& lis,vector<int>& visited, vector<int>& each , vector<int>& ans){

    visited[p] = 1;
    int ret = each[p];

    rep(i,0,lis[p].size()){

        int nex = lis[p][i][0];
        int eind = lis[p][i][1];

        if (visited[nex] == 0){
            int cat = dfs(nex,lis,visited,each,ans);
            if (cat != 0) ans.push_back(eind+1);
            ret ^= cat;
        }
    }

    return ret;

}

int main(){

    int N,M;
    cin >> N >> M;
    vector<vector<int>> AB(N,vector<int> (2,0));
    vector<int> Alis(N,0);

    rep(i,0,N){
        cin >> AB[i][0] >> AB[i][1];
        Alis[i] = AB[i][0];
    }

    sort(AB.begin(),AB.end());
    sort(Alis.begin(),Alis.end());
    AB.push_back({1000000001,0});
    Alis.push_back(1000000001);

    //rep(i,0,N+1){
    //    cout << AB[i][0] << " " << AB[i][1] << endl;
    //}
    //[] (vector<int>& x , vector<int>& y) {return x[0] < y[0];}

    vector<int> each(1,AB[0][1]);
    rep(i,1,N+1){
        each.push_back(AB[i-1][1] ^ AB[i][1]);
    }

    vector<vector<vector<int>>> lis(N+1,vector<vector<int>> (0,vector<int> (2)));

    int L,R;
    int lind,rind;
    rep(i,0,M){
        cin >> L >> R;
        lind = distance(Alis.begin(),lower_bound(Alis.begin(),Alis.end(),L));
        rind = distance(Alis.begin(),lower_bound(Alis.begin(),Alis.end(),R+1));
    
        if (lind == rind) continue;

        lis[lind].push_back({rind,i});
        lis[rind].push_back({lind,i});
    }

    vector<int> ans(0);
    vector<int> visited(N+1,0);

    rrep(i,N,-1){
        if (visited[i] == 0){
            int st = dfs(i,lis,visited,each,ans);

            if ((i != N) && (st != 0)){
                cout << -1 << endl;
                return 0;
            }
        }
    }

    sort(ans.begin(),ans.end());
    cout << ans.size() << endl;
    rep(i,0,ans.size()){
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 44112
#include <bits/stdc++.h>
using namespace std;
 
string s;
map<char, long long> mp;
 
int main() {
  cin >> s;
 
  long long N = s.size(), ans = 1 + N * (N - 1) / 2, cnt = 0;
 
  for (int i = 0; i < N; ++i) {
    mp[s[i]]++;
  }
 
  for (char c = 'a'; c <= 'z'; c++) {
    if (mp[c] > 1) {
      cnt += mp[c] * (mp[c] - 1) / 2;
    }
  }
 
  ans -= cnt;
 
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Scanner;


public class Main {

	/*
	 * 余りの最大値を求める。
	 */
	public static void main(String[] args) {

		/*
		 * Scannerで値取得。
		 */
		Scanner s = new Scanner(System.in);
		int number = s.nextInt();

		int order1[] = new int[number];
		int order2[] = new int[number];

		for(int i = 0; i < number; i++) {
			order1[i] = s.nextInt() -1;
			order2[i] = order1[i];
		}

		Arrays.parallelSort(order1);

		int numbers[] = new int[number];

		for(int i = 0; i < number; i++) {
			numbers[order2[i]]=i;
			//出席番号と順番を変える
		}

		for(int i = 0; i < number; i++) {
			int order = order1[i];
			System.out.println(numbers[order] +1);
		}

	}

}


Measured memory_bytes: 69232
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)
//__builtin_popcountll()
const int N=6e5+5;
int st[2*N];//initialize to zero


void upd(int node,int start,int end,int x,int val)
{
	if(start==end)
	{
		
		st[node]=val;
	}
	else
	{
		int m=(start+end)/2;
		if(start<=x&&x<=m)
		{
			upd(2*node,start,m,x,val);
		}
		else
		{
			upd(2*node+1,m+1,end,x,val);
		}
		st[node]=max(st[2*node],st[2*node+1]);
	}
}
int query(int node,int start,int end,int l,int r)
{
	if(r<start||end<l) //must modified section
	return 0;
	
	
	if(start>=l&&end<=r)
	{
		return st[node];
	}
	else
	{
		int m=(start+end)/2;
		return max(query(2*node,start,m,l,r),query(2*node+1,m+1,end,l,r));
	}

}




int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	int n,i,j,k;
    	cin>>n>>k;
    	int q=300000;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];
		}
	    int ans=0;
	    for(i=0;i<n;i++)
	    {
	    	int l=max(0,a[i]-k);
	    	int r=min(a[i]+k,300000);
	    	int x=query(1,0,q,l,r);
	    	ans=max(ans,x+1);
	    	upd(1,0,q,a[i],x+1);
		}
		cout<<ans;
    	

    }

}

Measured memory_bytes: 8928
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x = 0;
        for(int i = 0; i < 3; i++) {
            if (a > b) {x = a; a = b; b = x;}
            else if (b > c) { x = b; b = c; c = x;}
            else if (a > b) { x = a; a = b; b = x;}
        }
        System.out.println(a + " " + b + " " + c);
    }
}


Measured memory_bytes: 26328
using System;
using System.Collections.Generic;
using System.Linq;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var dic = new Dictionary<int, int>();
        foreach (var i in A)
        {
            if (dic.ContainsKey(i))
            {
                dic[i]++;
            }
            else
            {
                dic[i] = 1;
            }
        }

        for (int i = 0; i < N; i++)
        {
            if (dic.ContainsKey(i + 1))
            {
                Console.WriteLine(dic[i+1]);
            }
            else
            {
                Console.WriteLine(0);
            }
        }
    }
}

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

int main(void){

    int n,i,cnt=0,keta,tmp;
    scanf("%d",&n);

    for(i=1;i<n+1;i++){
        tmp=i;
        keta=1;
        while(tmp>9){
            tmp/=10;
            keta++;
        }
        if(keta%2){
            cnt++;
        }
    }
    printf("%d\n",cnt);


    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include<string.h>

int main()
{
int N,X,D=0;
scanf("%d %d", &N,&X);
int L[N],i,count=1;
for(i=0; i<N; i++)
{
    scanf("%d", &L[i]);
    D=D+L[i];
    if(D<=X)
        count++;
}
printf("%d", count);
return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {

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

	public void run() {
		Scanner sc = new Scanner(System.in);
		String s =sc.next();
		String t =sc.next();

		int sl = s.length();
		int tl = t.length();

		ArrayList<String>ansl = new ArrayList<>();
		for(int i=0; i<sl; i++) {
			boolean ok=true;
			for(int j=0; j<tl; j++) {
				if(i+j>=sl) {
					ok=false;
					break;
				}
				if(s.charAt(i+j)=='?') {
					continue;
				}
				if(s.charAt(i+j)!=t.charAt(j)) {
					ok=false;
					break;
				}
			}
			if(ok) {
				StringBuffer sb  = new StringBuffer(s);
				sb.replace(i, i+tl, t);
				for(int j=0; j<sl; j++) {
					if(sb.charAt(j)=='?') {
						sb.replace(j, j+1, "a");
					}
				}
				ansl.add(sb.toString());
			}
		}
		Collections.sort(ansl);
		if(ansl.size()==0) {
			System.out.println("UNRESTORABLE");
		}else {
			System.out.println(ansl.get(0));
		}
		sc.close();
	}


}


Measured memory_bytes: 35716
#include <bits/stdc++.h>
#define in freopen("input.txt", "r" ,stdin)
#define out freopen("output.txt", "w" , stdout)
#define ll long long
#define inf 200005
#define fr first
#define  sc second
#define pb push_back
#define p_b pop_back
#define mp make_pair
#define N 100100
#define mod 1000000007
using namespace std;
int w,h;
char c[1005][1005];
int dp[1005][1005];
int main (){
//in;out;
ios_base::sync_with_stdio(0);
cin >> h >> w;
for (int i = 1; i  <= h; i++){
    for (int j = 1; j <= w; j++){
        cin >> c[i][j];
    }
}

dp[1][1] = 1;
if (c[1][1] == '#') dp[1][1] = 0;
for (int i = 2; i <= h; i++) {
if (c[i][1] == '.')dp[i][1] = dp[i-1][1];
}
for (int i = 2; i <= w; i++){
  if (c[1][i] == '.')  dp[1][i] = dp[1][i-1];
}

for (int i = 2; i <= h; i++){
    for (int j= 2; j <= w; j++){
        if (c[i][j] == '.')dp[i][j] = dp[i-1][j] + dp[i][j-1];
        else dp[i][j] = 0;
        dp[i][j]%=mod;
    }
}


cout << dp[h][w]%mod;
}


Measured memory_bytes: 5248
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int n;
ll a[100010];
ll b[100010];
bool check(vector<ll> c, ll x){
	bool used[60]={};
	int m=c.size();
	if(m==0){
		if(x==0) return true;
		else return false;
	}
	for(int i=0; i<m; i++){
		int j1=-1;
		for(int j=0; j<60; j++){
			if(used[j]) continue;
			if(c[i]&(1ll<<j)){
				j1=j; break;
			}
		}
		if(j1==-1) continue;
		used[j1]=1;
		for(int k=0; k<60; k++){
			if(k==j1) continue;
			if(c[i]&(1ll<<k)){
				for(int l=0; l<m; l++){
					if(c[l]&(1ll<<j1)){
						c[l]^=(1ll<<k);
					}
				}
				if(x&(1ll<<j1)) x^=(1ll<<k);
			}
		}
	}
	for(int i=0; i<60; i++){
		if((x&(1ll<<i)) && !used[i]) return false;
	}
	return true;
}
int main()
{
	cin>>n;
	ll s=0;
	for(int i=0; i<n; i++){
		cin>>a[i];
		s^=a[i];
		b[i]=a[i];
	}
	bool used[60]={};
	vector<P> v;
	for(int i=0; i<n; i++){
		int j1=-1;
		for(int j=0; j<60; j++){
			if(used[j]) continue;
			if(b[i]&(1ll<<j)){
				j1=j; break;
			}
		}
		if(j1==-1) continue;
		used[j1]=1;
		for(int k=0; k<60; k++){
			if(k==j1) continue;
			if(b[i]&(1ll<<k)){
				for(int l=0; l<n; l++){
					if(b[l]&(1ll<<j1)){
						b[l]^=(1ll<<k);
					}
				}
				v.push_back({j1, k});
			}
		}
	}
	ll ans=0;
	ll c[60];
	for(int i=0; i<60; i++) c[i]=(1ll<<i);
	for(int i=0; i<60; i++){
		for(auto p:v){
			int j=p.first, k=p.second;
			if(c[i]&(1ll<<j)) c[i]^=(1ll<<k);
		}
	}
	for(int i=0; i<60; i++){
		if(used[i]){
			for(int j=0; j<60; j++) if(c[j]&(1ll<<i)) c[j]^=(1ll<<i);
		}
	}
	for(int i=59; i>=0; i--){
		if(s&(1ll<<i)) continue;
		ll x=ans^(1ll<<i);
		for(auto p:v){
			int j=p.first, k=p.second;
			if(x&(1ll<<j)) x^=(1ll<<k);
		}
		for(int j=0; j<60; j++){
			if(used[j]){
				if(x&(1ll<<j)) x^=(1ll<<j);
			}
		}
		vector<ll> vc;
		for(int j=0; j<60; j++) if(j<i || s&(1ll<<j)) vc.push_back(c[j]);
		if(check(vc, x)){
			ans^=(1ll<<i);
		}
	}
	cout<<s+2*ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
#include <iomanip>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

ll a,b,x;
ll f=0;
static const double pi = 3.141592653589793;

bool binary_j(ll mid){
  double k=0;
  if(f==1){
    mid=9*(1e+10)-mid;
    k=(double)a*a*a*tan((double)2*pi*mid/(360*(1e+9)));
    if(x*2<=k)return false;
    if(x*2>k)return true;
  }
  else{
    k=(double)a*b*b*tan((double)2*pi*mid/(360*(1e+9)));
    if(x*2<=k)return true;
    if(x*2>k)return false;
  }
}

ll binary_search(ll left,ll right){
  ll mid;
  while(left<right){
    mid = (left+right)/2;
    if(binary_j(mid)){
      right = mid;
    }
    else{
      left = mid+1;
    }
  }
  return left;
}

int main(){
  ll n;
  double ans=0;
  cin>>a>>b>>x;
  if(a*a*b<x*2){
    f=1;
    x=a*a*b-x;
    ans=((double)9*(1e+10)-(double)binary_search(0,9*(1e+10)))/(1e+9);
  }
  else{
    ans=((double)9*(1e+10)-(double)binary_search(0,9*(1e+10)))/(1e+9);
  }
  cout<<setprecision(9)<<ans<<endl;
}


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

#define ll long long

using namespace std;

char s[10];
int main() {
    cin >> s;
    sort(s, s+4);
    if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2])
        cout << "Yes";
    else cout << "No";

    return 0;
}


Measured memory_bytes: 256
class Dice:
    def __init__(self):
        self.dice = {'N':2, 'E':4, 'S':5, 'W':3}
        self.currTop = 1

    def top(self):
        return self.currTop

    def rot(self, direction):
        newTop = self.dice[direction]
        currTop = self.currTop
        self.currTop = newTop
        if direction == 'N':
            self.dice['N'] = 7 - currTop
            self.dice['S'] = currTop
        elif direction == 'S':
            self.dice['N'] = currTop
            self.dice['S'] = 7 - currTop
        elif direction == 'E':
            self.dice['E'] = 7 - currTop
            self.dice['W'] = currTop
        elif direction == 'W':
            self.dice['E'] = currTop
            self.dice['W'] = 7 - currTop


faces = list(map(int, input().split()))
cmd = input()

d = Dice()
for c in cmd:
    d.rot(c)

print(faces[d.top()-1])

Measured memory_bytes: 7812
#include<bits/stdc++.h>
using namespace std;
int main(){
        int k; cin>>k;
        string s; cin>>s;
        int n=s.length();
        if(n<=k) cout<<s<<endl;
        else{
                for(int i=0;i<k;i++) cout<<s[i];
                cout<<"..."<<endl;
        }
}



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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("C.in", "r", stdin);
	freopen ("C.out", "w", stdout);
#endif
}

int main () {

	File();

	long long n, m, k;
	cin >> n >> m;
	k = max(0ll, (m - 2 * n) / 4);
	long long ans = min(n + k, (m - 2 * k) / 2);
	printf ("%lld\n", ans);

    return 0;

}

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

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi i <= _##i poi i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi i < _##i poi i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi i >= _##i poi i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi i > _##i poi i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;

using namespace std poi

int main(){
    upto(1, 9, i) upto(1, 9, j) cout << i << 'x' << j << '=' << i * j << endl poi
    return 0 poi
}

Measured memory_bytes: 1112
import java.io.*;
import java.util.*;

class Main{
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String line = br.readLine();
			StringTokenizer st = new StringTokenizer(line," ");
			int a = Integer.parseInt(st.nextToken());
			int b = Integer.parseInt(st.nextToken());
			if(a < b){
				System.out.println("a < b");
			}
			else if(a > b){
				System.out.println("a > b");
			}
			else if(a == b){
				System.out.println("a == b");
			}
		}
		catch(IOException e){
			System.out.println(e);
		}
	}
}

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

using namespace std;

typedef long long ll;
typedef vector<int> pi;
typedef pair<int,int> vi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(vi c, vi d){
	return c.S < d.S;
}

int main() {
	int N;
	string ans="Yes", a;
	set<string> s;
	char prev;
	
	cin >> N;
	REP(i, 0, N){
		cin >> a;
		if(s.count(a) == 0){
			s.insert(a);
			if(prev != a[0] && i > 0){
				ans = "No";
				break;
			}
			prev = a.back();
		}
		else{
			ans = "No";
			break;
		}
	}
	cout << ans;

}


Measured memory_bytes: 256
/* In the name of Allah */
#include <bits/stdc++.h>
using namespace std;

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

	int a, b;
	cin >> a >> b;

	if (a <= 0 && b >= 0)
		cout << "Zero\n";
	else if (a < 0 && min(b + 1, 0) - a & 1)
		cout << "Negative\n";
	else
		cout << "Positive\n";

	return 0;
}


Measured memory_bytes: 256
arr = {}
rankScore = []
while True:
    s = list(map(int, input().split(',')))
    if s[0] == 0:
        break
    arr[s[0]] = s[1]
    if s[1] not in rankScore:
        rankScore.append(s[1])
rankScore.sort(reverse = True)
while True:
    try:
        num = int(input())
        print(rankScore.index(arr[num])+1)
    except:
        break

Measured memory_bytes: 7556
#!/usr/bin/env python3
import sys
from itertools import accumulate


def solve(N: int, A: "List[int]"):
    least = 0
    A.sort()
    acc = list(accumulate(A))
    for i, a in enumerate(A):
        if i == N - 1:
            print(N - least)
            break
        if A[i+1] > 2 * acc[i]:
            least = i + 1
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 20440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define si(x) int(x.size())
const int mod=1000000007,MAX=505,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,M;cin>>N>>M;
    int Q;cin>>Q;
    vector<int> A(Q);
    for(int i=0;i<Q;i++) cin>>A[i];
    
    map<int,int> MA;
    for(int i=1;i<=M;i++) MA[i]=0;
    vector<int> last,when(M+1,INF);
    
    for(int i=Q-1;i>=0;i--){
        
        if(MA[A[i]]==0){
            when[A[i]]=si(last);
            last.push_back(A[i]);
            MA[A[i]]++;
        }else if(si(last)==1){
            MA[A[i]]++;
            if(MA[A[i]]>N) MA[A[i]]=N;
        }else{
            int a,b=MA[A[i]];
            if(when[A[i]]==0){
                MA[A[i]]++;
                if(MA[A[i]]>N) MA[A[i]]=N;
            }else{
                a=MA[last[when[A[i]]-1]];
                if(a>b) MA[A[i]]++;
            }
        }
    }
    
    vector<int> X=last,Y;
    for(int i=1;i<=M;i++){
        if(when[i]==INF) X.push_back(i);
    }
    for(int i=0;i<si(last);i++){
        if(MA[last[i]]==N) Y.push_back(last[i]);
        else when[last[i]]=INF;
    }
    for(int i=1;i<=M;i++){
        if(when[i]==INF) Y.push_back(i);
    }
    
    if(X==Y) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 7412
#include<stdio.h>
int main()
{
int a,b,n,sum,i;
while(scanf("%d %d",&a,&b)==2)
{
    n=0;
    sum=a+b;
    for(i=sum;i>0; )
    {
      i=i/10;
    n++;
    }
    printf("%d\n",n);

}

return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
#include<math.h>
#define inf 1e10
#define min(x,y) x<y?x:y
double cal_time(int r, int h, int x){
    return h + r - sqrt(r*r-x*x);
}
int main(void){
    int r, n, left, right, h;
    while(1){
        int x[40]={0};
        scanf("%d%d",&r,&n);
        if(r==0 && n==0) break;
        for(int i=0; i<n; i++){
            scanf("%d%d%d",&left,&right,&h);
            for(int j=left; j<right; j++){
                if(x[20+j] < h) x[20+j]=h;
            }
        }
        double min=inf,tmp;
        for(int i=-r+1; i<r; i++){
            if((tmp=cal_time(r,min(x[i+19],x[i+20]),i)) < min){
                min=tmp;
            }
        }
        printf("%.4f\n",min);
    }
    return 0;
}



Measured memory_bytes: 2072
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int a, b, n, A[100010], C[100010];

int main() {
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", &A[i]);
    for(int i = 1; i <= n; i += 2) C[A[i]]++;
    int mx = 0, mx2 = 0, v1, v2;
    for(int i = 1; i <= 100000; i++) if(C[i] >= mx) {
        mx2 = mx;
        mx = C[i];
        v1 = i;
    } else if(C[i] > mx2) mx2 = C[i];
    memset(C, 0, sizeof C);
    for(int i = 2; i <= n; i += 2) C[A[i]]++;
    int Mx = 0, Mx2 = 0, V1, V2;
    for(int i = 1; i <= 100000; i++) if(C[i] >= Mx) {
        Mx2 = Mx;
        Mx = C[i];
        V1 = i;
    } else if(C[i] > Mx2) Mx2 = C[i];
    if(v1 != V1) printf("%d\n", n - mx - Mx);
    else printf("%d\n", n - max(mx + Mx2, Mx + mx2));
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

int main(){
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    cout << (H-h) * (W-w) << endl;
    return 0;
}


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

int main(){
    
    string S;
    cin >> S;

    int a, i, l, sum;
    l = S.length();
    sum = 0;
    
    for ( i = 0; i < l; i++){
        a = S.at(i) - '0';
        sum += a;
        sum %= 9;
    }
    
    if (sum == 0) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}



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

#define INF 10000001

#define MAX_SIZE 101
long long g_d[MAX_SIZE][MAX_SIZE];
void warshall_floyd(int v) {
	for (int k = 0; k < v; ++k) {
		for (int i = 0; i < v; ++i) {
			for (int j = 0; j < v; ++j) {
				g_d[i][j] = min(g_d[i][j], g_d[i][k]+g_d[k][j]);
			}
		}
	}
}

int main() {

	while (true) {
		int n,m,s,g1,g2;
		cin >> n >> m >> s >> g1 >> g2;
		--s; --g1; --g2;
		if (n==0) break;

		fill(g_d[0], g_d[0] + MAX_SIZE*MAX_SIZE, INF);
		for (int i = 0; i<MAX_SIZE; ++i) {
			g_d[i][i] = 0;
		}

		for (int i=0; i<m; ++i) {
			int b1,b2;
			cin >> b1 >> b2;
			--b1; --b2;
			cin >> g_d[b1][b2];
		}

		warshall_floyd(n);

		long long cost = INF;
		for (int i=0; i<n; ++i) {
			cost = min(cost, g_d[s][i] + g_d[i][g1] + g_d[i][g2]);
		}

		cout << cost << endl;
	}
}

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

int main()
{
	int num, a1, a2;
	cin >> num >> a1 >> a2;
	bool flag = 1;
	while(a1<=a2)
	{
		if(a1%num==0)
			flag=0;
		a1++;
	}
	if(flag==1)
		cout << "NG";
	else
		cout << "OK";
}

Measured memory_bytes: 3636
/*
 author : arush gupta
 date :26.01.2020
 */
 #include<bits/stdc++.h>
 using namespace std;
 typedef long long ll;
 int main() {
 ios::sync_with_stdio(false);
 cin.tie(0);
 cout.tie(0);
ll h,n;
ll arr[100000];
cin>>h>>n;
ll sum =0;
for(ll i=0;i<n;i++){
	cin>>arr[i];
	sum += arr[i];
}
if(sum >= h){
	cout<<"Yes"<<endl;
}
else{
	cout<<"No"<<endl;
}


 return 0;
 }

Measured memory_bytes: 1024
def rle(s):
    # ex. '01100011110' -> [1 2 3 4 1]
    before_c = s[0]
    ret = list()
    cnt = 0
    for c in s:
        if before_c == c:
            cnt += 1
        else:
            ret.append(cnt)
            before_c = c
            cnt = 1
    if cnt > 0:
        ret.append(cnt)
    return ret


def main():
    S = input()
    N = len(S)
    seq_cnt = rle(S)
    if len(seq_cnt) == 1:
        print(seq_cnt[0])
        return
    if len(seq_cnt) == 2:
        print(max(seq_cnt))
        return
    # cumsum
    cumsum_seq_cnt = [0 for _ in range(len(seq_cnt))]
    rev_cumsum_seq_cnt = [0 for _ in range(len(seq_cnt))]
    cumsum_seq_cnt[0] = seq_cnt[0]
    rev_cumsum_seq_cnt[0] = seq_cnt[-1]
    for i in range(1, len(seq_cnt)):
        cumsum_seq_cnt[i] = cumsum_seq_cnt[i-1] + seq_cnt[i]
        rev_cumsum_seq_cnt[i] = rev_cumsum_seq_cnt[i-1] + seq_cnt[-1-i]
    # search
    max_k = cumsum_seq_cnt[0]
    rev_max_k= rev_cumsum_seq_cnt[0]
    for i in range(1, len(seq_cnt)):
        k = cumsum_seq_cnt[i]
        if k <= N - cumsum_seq_cnt[i-1]:
            max_k = k
        rev_k = rev_cumsum_seq_cnt[i]
        if rev_k <= N - rev_cumsum_seq_cnt[i-1]:
            rev_max_k = rev_k
    print(max([max_k, rev_max_k]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 7548
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {
    private static final StringBuilder builder = new StringBuilder();
    public static void main(String[] args) {
        if (readInt() == 0) System.out.print(1);
        else System.out.print(0);
    }

    private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    }

    private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    }

    private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    }

    private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    }

    private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    }

    private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    }

    private static double readDouble() {
        read();
        return Double.parseDouble(builder.toString());
    }

    private static BigDecimal readBigDecimal() {
        read();
        return new BigDecimal(builder.toString());
    }

    private static float readFloat() {
        read();
        return Float.parseFloat(builder.toString());
    }

    private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    }

}


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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int>a(M);
  vector<int>b(N+1,100);
  b.at(0) = 1;
  for (int i = 0; i < M; i++) {
    cin >> a.at(i);
    b.at(a.at(i)) = 0;
  }
  for (int i = 1; i < N+1; i++) {
    if (i == 1){
      if (b.at(i) != 0){
        b.at(1) = 1;
      }
    }
    else {
      if (b.at(i) != 0){
        b.at(i) = b.at(i-1) + b.at(i-2);
      }
    }
    b.at(i) %= 1000000007;
  }
  cout << b.at(N) << endl;
}
  



Measured memory_bytes: 3924
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;
 
int main(void)
{
    string S;
    cin >> S;
    int a[4];
    for(int i =0;i < 4;i++) a[i] = S[i] - '0';
    int sum = 0;
    for(int i=0;i< (1<<3);i++)
    {
        int ans = a[0];
        string op = "";

        for(int j=0;j<3;j++)
        {
            if(i&1<<j)
            {
                ans += a[j+1];
                op += "+";
            }
            else
            {
                ans -= a[j+1];
                op += "-";
            }
        }
        if (ans == 7) 
        {
            cout << S[0] << op[0] << S[1] << op[1] 
            << S[2] << op[2] << S[3] << "=7" << endl;
            return 0;
        }
    }
    return 0;
}

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

#define pb         push_back

const int INF = 1000000000;
const int MOD = 1000000007;

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

	while(1){
		int n, m;
		cin >> n >> m;
		if(n == 0 && m == 0) break;

		vector< pair<int, int> > pt;
		for(int i=0; i<n; i++){
			int d, p;
			cin >> d >> p;
			pt.push_back(make_pair(p, d));
		}
		sort(pt.begin(), pt.end(), greater< pair<int, int> >());

		for(int i=0; i<n; i++){
			//printf("i: %d %d %d\n", pt[i].first, pt[i].second, m);
			if(pt[i].second <= m){
				m -= pt[i].second;
				pt[i].second = 0;
			}else{
				pt[i].second -= m;
				m = 0;
			}
			if(m == 0) break;
		}

		long long ans = 0;
		for(int i=0; i<n; i++){
			//printf("i: %d %d", pt[i].first, pt[i].second);
			ans += pt[i].first * pt[i].second;
		}
		cout << ans << endl;
	}
	

	return 0;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
int num(int m) {
  int res = 9;
  REP(i, m) {
    res *= 10;
  }
  res /= 10;
  return res;
}
int main() {
  int n;
  cin >> n;
  int d = n;
  int count = 0;
  while (d > 0) {
    d /= 10;
    count++;
  }
  int res = 0;
  if (count % 2 == 0) {
    for (int i = 1; i < count; i += 2) {
      res += num(i);
    }
  }
  else {
    for (int i = 1; i <= count; i += 2) {
      res += num(i);
    }
    res -= pow(10, count) - n - 1;
  }
  cout << res << endl;
}

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

int main(){
    std::vector<int> vec(3);
    std::cin >> vec.at(0) >> vec.at(1) >> vec.at(2);

    std::sort(vec.begin(), vec.end());
    std::cout << abs(vec.at(1) - vec.at(0)) + abs(vec.at(2) - vec.at(1)) << std::endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

EPS = 1e-10

for line in sys.stdin:
    a, b, c, d, e, f = map(float, line.split())
    x = (e * c - b * f) / (a * e - b * d)
    y = (a * f - c * d) / (a * e - b * d)
    print('{:.3f} {:.3f}'.format(x + EPS, y + EPS))



Measured memory_bytes: 5580
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vull = vector<ull>;
#define rep(i, n) for (ull i = 0; i < n; ++i)
#define rep1(i, n) for (ull i = 1; i < n; ++i)
#define iter(it, v) for (auto it = v.begin(); it != v.end(); ++it)
#define pb push_back
#define fi first
#define se second
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
template <typename T> void vecout(const T &v) {
  for (auto it = v.begin(); it != v.end();
       ++it, cout << (it != v.end() ? " " : "\n")) {
    cout << *it;
  }
}

void solve() {
  // main coding
  ull n; cin>>n;
  vull a(n);
  rep(i,n) {
    cin>>a[i];
    a[i]--;
  }
  vull rev(n);
  rep(i,n) rev[a[i]]=i+1;
  vecout(rev);
}

int main() {
  cout << fixed << setprecision(12);
  solve();
  return 0;
}


Measured memory_bytes: 2432
# Problem B - KEYENCE String

# input
s = input()
s_l = len(s)

# initialization
is_ok = False

# check
for i in range(s_l):
    for j in range(i, s_l):
        tmp_s = s[:i] + s[j:]
        if tmp_s=='keyence':
            is_ok = True
            break

# output
if is_ok:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000009;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-4;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int isp[101]; vector<int> p;
void init() {
	fill(isp + 2, isp + 101, true);
	Rep1(i, 2, 100) {
		if (!isp[i])continue;
		p.push_back(i);
		for (int j = 2 * i; j < 101; j += i) {
			isp[j] = false;
		}
	}
}
int n;
int c[26];
int x74() {
	int res = 0;
	rep(i, 25) {
		if (c[i] >= 74) {
			res++;
		}
	}
	return res;
}
int x2y24() {
	int res = 0;
	int c1=0, c2=0;
	rep(i, 25) {
		if (c[i] >= 24)c1++;
		if (c[i] >= 2)c2++;
	}
	res = (c2 - c1)*c1 + c1 * (c1 - 1);
	return res;
}
int x4y14() {
	int res = 0;
	int c1=0, c2=0;
	rep(i, 25) {
		if (c[i] >= 14)c1++;
		if (c[i] >= 4)c2++;
	}
	res = (c2 - c1)*c1 + c1 * (c1 - 1);
	return res;
}
int x2y4z4() {
	int res = 0;
	int c1=0, c2=0;
	rep(i, 25) {
		if (c[i] >= 4)c1++;
		if (c[i] >= 2)c2++;
	}
	res = c1 * (c1 - 1) / 2 * (c2 - 2);
	//cout << res << endl;
	return res;
}
void solve() {
	cout << x74() + x2y24() + x4y14() + x2y4z4() << endl;
}
int main() {
	init();
	cin >> n;
	rep(i, 25) {
		int cop = n;
		while (cop) {
			c[i] += cop / p[i]; cop /= p[i];
		}
		//cout << p[i] << endl;
	}
	solve();
	return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
c=Counter(a).items()
f=0
s=0
for k,v in c:
    if v>=4:
        if k>f:
            s=k
            f=k
        elif k>s:
            s=k
    if v>=2:
        if k>f:
            s=f
            f=k
        elif k>s:
            s=k

print(s*f)


Measured memory_bytes: 68760
#include <iostream>

using namespace std;

int main() {

  unsigned long long a, b, c = 0, d = 0;
  cin >> a;
  for(int i = 1;i <= a;i++){
    cin >> b;
    if(c <= b){
      d++;
      c = b;
    }
  }
  cout << d;
  return 0;
}


Measured memory_bytes: 3576
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define HA(s,t) (sum[(t)]-sum[(s)-1])
const int maxn=1e5+7;
int n;
int a[maxn];
int f[maxn];
int sum[maxn];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d",a+i);
		if(a[i]==a[i-1])--i,--n;
	}
	for(int i=1;i<n;++i)
		sum[i]=sum[i-1]+(a[i+1]>a[i]);
	for(int i=1;i<=n;++i){
		int s=1,t=i-1;
		while(s<=t){
			int mid=(t+s)>>1;
			int xx=HA(mid,i-1);
			if(!xx || xx==i-mid)t=mid-1;
			else s=mid+1;
		}f[i]=f[t]+1;
	}printf("%d\n",f[n]);
	return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,ra,re) for((i)=ra;(i)<(re);(i)++)
#define _rep(i,ra,re) for((i)=ra;(i)>(re);(i)--)
#define rep_(i,ra,re) for((i)=ra;(i)<=(re);(i)++)
#define _rep_(i,ra,re) for((i)=ra;(i)>=(re);(i)--)
#define put(n) cout << n << " "; 
#define puts(n) cout << n << endl;
#define pu(n) cout << n;
#define mod 1000000007
int i,j,k,l;
static const int MAX_N=20;
int A[MAX_N],B[MAX_N],C[MAX_N];
int main(void){
	int N;cin >> N;
	rep(i,0,N){
		cin >> A[i];
	}rep(i,0,N)cin >> B[i];
	rep(i,0,N-1)cin >> C[i];
	int ans=0,front=-1;
	rep(i,0,N){
		int tabe=A[i]-1;
		ans+=B[i];
		if(front!=-1&&front+1==tabe)ans+=C[front];
		front=tabe;
	}puts(ans);
	return 0;
}


Measured memory_bytes: 256
//
// Created on 2020/04/19.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {

    int n ;
    cin>>n;
    vector<int>mp(n,0);
    for (int i = 0; i < n-1; ++i) {
        int a;
        cin>>a;
        mp[a - 1] ++;
    }
    for(int i = 0 ; i < n ; i++){
        cout<<mp[i]<<endl;
    }
    return  0;
}


Measured memory_bytes: 4052
$ii = 0;
while(<STDIN>){
	chomp;
	if ($_ =~ /.+/) {
    	if ($ii == 0) {
        	$N = $_
        } else {
        	@line = split(/ /, $_);
            $data[$ii-1][0] = $line[0] + $line[1];
            $data[$ii-1][1] = $line[0]; # Takahashi
            $data[$ii-1][2] = $line[1]; # Aoki
        }
        $ii++;
    }
}

@score = sort { $b->[0] <=> $a->[0] } @data;

$Ans = 0;
for ($ii = 0; $ii < $N; $ii++) {
    if ($ii % 2 == 0) {
        $Ans += $score[$ii][1];
    } else {
        $Ans -= $score[$ii][2];
    }
}

print "$Ans\n";



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

int main()
{
        ll N;
        cin >> N;
        ll A[N];
        for(int i = 0; i < N; i++) cin >> A[i];

        ll cnt = 0;
        for(int i = 0; i < N; i++)
        {
                while(A[i] % 2 == 0)
                {
                        if(A[i] % 2 == 0)
                        {
                                cnt++;
                                A[i] /= 2;
                        }
                }
        }

        cout << cnt << endl;

        return 0;
}

Measured memory_bytes: 384
def solve(n, m, x, y, z):
    parent = {i: i for i in range(1, n+1)}
    def find(v):
        if v == parent[v]:
            return v
        else:
            return find(parent[v])
    def union(u, v):
        u = find(u)
        v = find(v)
        if u > v:
            u, v = v, u
        parent[v] = u
    for i in range(m):
        union(x[i], y[i])
    return len(set([find(v) for v in parent.keys()]))

n, m = map(int, input().split())
x = [0] * m
y = [0] * m
z = [0] * m
for i in range(m):
    x[i], y[i], z[i] = map(int, input().split())
print(solve(n, m, x, y, z))

Measured memory_bytes: 28576
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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; }
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};



int main(){
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(ALL(a));
    if(a[0] == a[1] && a[1] == a[2]){
        puts("No");
    }
    else if(a[0] == a[1] || a[1] == a[2]){
        puts("Yes");
    }
    else{
        puts("No");
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,ans=0,da=0;
	char c;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>c;
		if(c=='I') ans++;
		else ans--;
		da=max(da,ans);
	}
	cout<<da;
	return 0;
}


Measured memory_bytes: 256
from collections import Counter
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    c = Counter([''.join(sorted(input())) for _ in range(n)]).values()
    print(sum([i * (i - 1) // 2 for i in c]))

if __name__ == '__main__':
    main()


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

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;

int main() {
    lli a[5];
    lli k;
    ncin1(5, a);
    cin1(k);
    sort(a, a+5);
    if (a[4] - a[0] > k)
        cout << ":(" << endl;
    else
        cout << "Yay!" << endl;


}


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

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main() {
	ll N;
	cin >> N;
	double A[N];
	rep(i,0,N) cin >> A[i];

	double ans;
	rep(i,0,N) {
		ans += 1 / A[i];
	}
	ans = 1 / ans;
	cout << setprecision(20) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define MAX(x, y, z) max(x, max(y, z))
#define MIN(x, y, z) min(x, min(y, z))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll N, M;
  cin >> N >> M;

  vvll to(N);
  rep(i, M) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    to[a].pb(b);
    to[b].pb(a);
  }

  rep(i, N) {
    COUT(to[i].size());
  }
  return 0;
}

Measured memory_bytes: 3680
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <limits>
#include <numeric>
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
using namespace std;


int main()
{
	string S;
	int count = 0;
	int flag = 0;
	int i = 0;

	cin >> S;

	if (S[0] != 'A')
	{
		flag = 1;
	}

	if (S[1] < 97) flag = 1;

	for (i = 2; i < S.length(); i++)
	{
		if (i < S.length() - 1)
		{
			if (S[i] == 'C') count++;
		}
		else if(S[i] < 97)
		{
			flag = 1;
		}

		if (i >= S.length() - 1)
		{
			if (S[i] < 97) flag = 1;
		}
	}
	if (count != 1) flag = 1;

	if (flag == 0)
	{
		cout << "AC" << endl;
	}
	else
	{
		cout << "WA" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define N 100000
vi s(N + 1, 1);
void eli(int p)
{
    for (int i = p + p; i <= N; i = i + p)
    {
        s[i] = 0;
    }
}
void eratos(){
    s[0] = s[1] = 0;
    rep(i, N + 1)
    {
        if (s[i])
        {
            eli(i);
        }
    }
}
int main(){
    eratos();
    vi v(N + 1, 0);
    rep(i, N + 1)
    {
        if(s[i]&&s[(i+1)/2]){
            v[i] = 1;
        }
    }
    vi sum(N + 1,0);
    rep(i,N){
        sum[i + 1] = sum[i] + v[i+1];
    }
    int q;
    cin >> q;
    rep(i,q){
        int l, r;
        cin >> l >> r;
        cout << sum[r] - sum[l - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1792
def binary_serach(A, key):
   left = 0
   right = len(A)
   while left < right:
       mid = (left + right) //2
       if A[mid] == key:
           return mid
       elif key < A[mid]:
           right = mid
       else:
           left = mid + 1
   return 'Not Found'

if __name__ == '__main__':
    n = int(input())
    l = list(map(int, input().split()))
    q = int(input())
    t = list(map(int, input().split()))
    res = 0
    for i in t:
        if binary_serach(l,i) == 'Not Found':
            continue
        else:
            res += 1
    print(res)


Measured memory_bytes: 16716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
const int N=200;

 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a,b,n,ans;
	cin >> n >> a >> b;
	ans = min(b,a*n);
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256