akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static List<Coordinate> red;
        static List<Coordinate> blue;

        static void Main(string[] args)
        {
            //[summary]C - 2D Plane 2N Points
            int N = int.Parse(Console.ReadLine());

            red = GetCoordinates(N);
            blue = GetCoordinates(N);

            //赤い点は y座標の降順にソート
            red = red.OrderByDescending(c => c.y).ToList();

            //青い点は y座標の昇順にソート
            blue = blue.OrderBy(c => c.y).ToList();

            foreach (var b in blue)
            {
                GetPair(b.y, b.x);
            }

            Console.WriteLine(N - red.Count);
        }

        static void GetPair(int y, int x)
        {
            for (int i = 0; i < red.Count; i++)
            {
                //赤い点のy座標が初めて青い点のy座標より小さくなったとき
                //それ以降の赤い点に対して、x座標が最大の点を求める
                if (red[i].y < y)
                {
                    GetMaxX(i, x);
                    return;
                }
            }
        }

        static void GetMaxX(int start, int x)
        {
            int max = -1;
            int index = 0;

            for(int i = start; i < red.Count; i++)
            {
                if (red[i].x < x && red[i].x > max)
                {
                    max = red[i].x;
                    index = i;
                }
            }

            if (max > -1)
            {
                red.RemoveAt(index);
            }
        }

        static List<Coordinate> GetCoordinates(int N)
        {
            var coords = new List<Coordinate>();

            for (int i = 0; i < N; i++)
            {
                var line = ReadLine();
                int y = line[0];
                int x = line[1];

                coords.Add(new Coordinate(y, x));
            }

            return coords;
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }

        struct Coordinate
        {
            public int y;
            public int x;

            public Coordinate(int y, int x)
            {
                this.y = y;
                this.x = x;
            }
        }
    }
}


Measured memory_bytes: 13396
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[][] sk = new int[M][];
        for (int i = 0; i < M; i++) {
            int k = sc.nextInt();
            int[] nums = new int[k];
            sk[i] =nums;
            for (int j = 0; j < k; j++) {
                nums[j]= sc.nextInt()-1;
            }
        }
        int[] p = new int[M];
        for (int i = 0; i < M; i++) {
            p[i] = sc.nextInt();
        }

        int ans =0;
        for (int i = 0; i < (1<<N); i++) {// all switch pattern in binary representation 0000000 to 11111111
            boolean flag = true;
            for (int j = 0; j < M; j++) {//Check  i-th light
                int count=0;
                for (int k = 0; k < sk[j].length; k++) {//check for all switch connected
                    int idx = sk[j][k];//switch index
                    int ithSwitch =i>> (N-idx-1);
                    if ( ithSwitch %2 == 1 ) count++;//switch on
                }
                if(count%2 != p[j]){ // check off or even
                    flag=false;
                    break;
                }
            }
            if(flag) ans++;
        }

        System.out.println(ans);


    }
}

Measured memory_bytes: 22996
#include <iostream>
#include <deque>

using namespace std;

int main()
{
	for(int price,pay;cin>>price>>pay,price|pay;){
		int change=pay-price;
		deque<int> cnt;
		for(int coin:{1000,500,100})
			cnt.push_front(change/coin),change%=coin;
		for(int i=0;i<3;i++)
			cout<<cnt[i]<<(i<2?' ':'\n');
	}
	
	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
vector<int> ev,od,ans;
int main() {
	int m,n;
	scanf("%d %d",&n,&m);
	for (int i=0;i<m;i++) {
		int x;
		scanf("%d",&x);
		if (x%2) od.push_back(x);
		else ev.push_back(x);
	}
	if (od.size() > 2) {
		printf("Impossible\n");
		return 0;
	}
	if (m == 1 && n == 1) {
		printf("1\n1\n1\n");
		return 0;
	}
	if (m == 1) {
		printf("%d\n",n);
		printf("2\n1 %d",n-1);
		return 0;
	}
		if (od.size() > 0) ans.push_back(od[0]);
		for (int i=0;i<ev.size();i++) ans.push_back(ev[i]);
		if (od.size() == 2) ans.push_back(od[1]);
		for (int i=0;i<m;i++) {
			if (i > 0) printf(" ");
			printf("%d",ans[i]);
		}
		printf("\n");

		printf("%d\n",ans[0] > 1 ? m : m-1);
		if (ans[0] > 1) {
			printf("%d ",ans[0]-1);
			for (int i=1;i<m-1;i++) printf("%d ",ans[i]);
			printf("%d\n",ans[m-1]+1);
		}
		else {
			for (int i=1;i<m-1;i++) printf("%d ",ans[i]);
			printf("%d\n",ans[m-1]+1);			
		}
	return 0;
}

Measured memory_bytes: 256
def solve():
    N = int(input())

    digit_ones_place = N - (N // 10) * 10

    if digit_ones_place is 3:
        return 'bon'
    elif digit_ones_place in [0, 1, 6, 8]:
        return 'pon'
    else:
        return 'hon'


def main():
    print(solve())


if __name__ == "__main__":
    main()


Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)

// AtCoder Library(https://img.atcoder.jp/practice2/ac-library.zip)
// -> 一部改変(2020/09/13).
LL floor_sum(LL n, LL m, LL a, LL b){
    LL ans = 0;
    if(a >= m){
        ans += (n - 1) * n * (a / m) / 2;
        a %= m;
    }
    if(b >= m){
        ans += n * (b / m);
        b %= m;
    }
    LL y_max = (a * n + b) / m, x_max = (y_max * m - b);
    if(y_max == 0) return ans;
    ans += (n - (x_max + a - 1) / a) * y_max;
    ans += floor_sum(y_max, a, m, (a - x_max % a) % a);
    return ans;
}

int main(){
    
    // 1. 入力情報.
    int T;
    scanf("%d", &T);
    
    // 2. クエリ回答.
    rep(i, T){
        LL n, m, a, b;
        scanf("%lld %lld %lld %lld", &n, &m, &a, &b);
        printf("%lld\n", floor_sum(n, m, a, b));
    }
    return 0;
    
}

Measured memory_bytes: 3828
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    v=list(map(int,input().split()))
    c=list(map(int,input().split()))
    ans=0
    for x,y in zip(v,c):
        if x-y>0:
         ans+=x-y
    print(ans)
resolve()

Measured memory_bytes: 38256
from collections import deque

N, M = map(int, input().split())
arr = [[] for n in range(N)]
for m in range(M):
    a, b = map(int, input().split())
    arr[a - 1].append(b - 1)
    arr[b - 1].append(a - 1)

que = deque([0])
dist = [-1] * N
dist[0] = 0
pre = [0] * N

while que:
    c = que.popleft()
    for i in arr[c]:
        if dist[i] != -1:
            continue
        dist[i] = 0
        pre[i] = c
        que.append(i)

print("Yes")  # 必ずYesになる
for i in pre[1:]:
    print(i+1)


Measured memory_bytes: 35852
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <stdio.h>
#include <bitset>
#include <complex>
#include <iomanip>
using namespace std;
using ll = long long;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
int main(){
    int n,d; cin >> n >> d;
    int x[10][10];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < d; j++){
            cin >> x[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            int len = 0;
            for(int k = 0; k < d; k++){
                len += (x[j][k]-x[i][k])*(x[j][k]-x[i][k]);
            }
            int check = sqrt(len);
            if (len == check*check) ans++;
        }
    }
    cout << ans << endl;
}
  



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
typedef long double ld;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define endl '\n'
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define mxe max_element
#define mne min_element
#define vi vector<int>
#define vvi vector<vi>
#define pi pair<int,int>
#define size(a)  (int)(a.size())
#define fill(s,x,n) vector
 x(n); rep(i,0,n) cin>>x[i];
#define mod 1000000007
#define inf 1000000000
void solve(){
    int n,k;
    cin>>n>>k;
    vi h(n);
    rep(i,0,n) cin>>h[i];
    vi dp(n,inf);
    dp[0]=0;
    rep(i,0,n){
    	rep(j,1,k+1){
            if(i+j<n){
            	dp[i+j]= min(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
            }
    	}
    }
    cout<<dp[n-1];

 }
 

signed main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);  
    #endif
    */
	int test;
	//cin>>test;
	test=1;
	while(test--){
         solve();
         cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1792
s=input()
words=[a for a in s]
kazu=len(words)
count=1
for a in words:
    if not a=='A':
        count+=1
    else:
        break
usiro=1
for b in reversed(words):
    if not b=='Z':
        usiro+=1
    else:
        break
print(kazu+2-count-usiro)


Measured memory_bytes: 5096
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int maxn = 1e5 + 100;
#define ll long long 

int a[10005];
int s[105][105];
int main() {

	int h, w;
	scanf("%d %d", &h, &w);
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);

	int x = 0, y = 0;
	int f = 1;
	for (int i = 1; i <= n; i++) {
		int t = a[i];
		while (t--) {
			s[x][y] = i;
			y += f;
			if (y >= w) {
				y = w - 1;
				f = -1;
				x++;
			}
			if (y < 0) {
				y = 0;
				f = 1;
				x++;
			}
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (j) printf(" ");
			printf("%d", s[i][j]);
		}
		printf("\n");
	}




	//system("pause");
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<queue>
using namespace std;
typedef pair<pair<int,int>,int> pa;
#define ff first.first
#define fs first.second
#define f(a,b) for(int a=0;a<b;a++)

int h,w,x,y,sx,sy,gx,gy,i,j,g,m = 999999;
int dx[4]={1,0,-1,0};
int c[20][20];
char n[20][20];
string pat;

int main(){
    while(cin>>h>>w,h){
        f(i,h)f(j,w){
                c[i][j]=m;
                cin>>n[i][j];
                if(n[i][j]=='A')
                    sx=j,sy=i;
                else if(n[i][j]=='B')
                    gx=j,gy=i;
            }
        queue<pa>q;
        q.push(make_pair(make_pair(sx, sy), 0));
        while(q.size()){
            pa p = q.front();
            q.pop();
            if(c[p.fs][p.ff]!=m)
                continue;
            c[p.fs][p.ff]=p.second;
            f(i,4){
                x=p.ff+dx[i];
                y=p.fs+dx[(i+1)%4];
                if(x>=0&&x<w&&y>=0&y<h&&n[y][x]!='#'&&c[y][x]==m)
                    q.push(make_pair(make_pair(x, y), p.second+1));
            }
        }
        cin>>pat;
        g=0;
        f(j,m){
            i=j%pat.length();
            if(c[gy][gx]<=g){
                cout<<g<<" "<<gy<<" "<<gx<<endl;
                break;
            }
            if(g>700){
                cout<<"impossible"<<endl;
                break;
            }
            if(pat[i]=='8')
                gy--;
            else if(pat[i]=='6')
                gx++;
            else if(pat[i]=='4')
                gx--;
            else if(pat[i]=='2')
                gy++;
            gy=max(0,min(h-1,gy));
            gx=max(0,min(w-1,gx));
            g++;
        }
    }
}

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

using namespace std;
map<long long, long long> prime_factor(int n)
{
    map<long long, long long> res;
    for (int i = 2; i*i <= n; i++) {
	while (n % i == 0) {
	    ++res[i];
	    n /= i;
	}
    }
    if (n != 1) res[n] = 1;
    return res;
}
int main() {

  int A, B;
  while(cin >> A >> B && A && B) {
    auto am = prime_factor(A);
    auto bm = prime_factor(B);
    long long suma = 0;
    long long last;
    
    for(auto a: am) {
      suma -= a.first;
      last = a.first;
    }
    suma += last * 2;
    
    long long sumb = 0;
    for(auto b: bm) {
      sumb -= b.first;
      last = b.first;
    }
    sumb += last * 2;

    if(suma > sumb) cout << 'a' << endl;
    else cout << 'b' << endl;
  }
  return 0;
}

Measured memory_bytes: 3020
from itertools import combinations
import numpy as np

N,M,X = (int(x) for x in input().split())
CA = np.zeros((N,M+1))
ans = float('inf')
for i in range(N):
    CA[i] = np.array(list(map(int, input().split())))
for i in range(1,N+1):
    for x in combinations(CA,i):
        temp = np.sum(x,axis=0)
        for j in range(1,M+1):
            if temp[j] < X:
                break
        else:
            ans = min(ans,temp[0])
if ans == float('inf'):
    print('-1')
else:
    print(int(ans))

Measured memory_bytes: 27240
#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){
	double x1,x2,y1,y2,s;
	
	cin>>x1>>y1>>x2>>y2;
	
	s=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
	s=sqrt(s);
	
	printf("%lf",s);
}


Measured memory_bytes: 3284
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define pb push_back
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p = mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 60; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------
int n;
int a[200000];
vector<int>e[200000];
int ans;
int solve(int x, int p) {
	int sum = 0;
	for (int g : e[x]) {
		if (g == p) continue;
		int k = solve(g, x);
		ans += (1 - mod_pow(mod_pow(2, mod - 2), k)) * (1 - mod_pow(mod_pow(2, mod - 2), n - k)) % mod;
		ans %= mod;
		sum += k;
	}
	return sum + 1;
}
signed main() {
	cin >> n;
	rep(i, n-1) {
		int u, v;
		cin >> u >> v;
		e[u].push_back(v);
		e[v].push_back(u);
	}
	ans = -n * mod_pow(2, mod - 2) % mod;
	solve(1, 0);
	ans += (1 - mod_pow(mod_pow(2, mod - 2), n));
	ans %= mod;
	cout << (ans + mod) % mod << endl;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

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

    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    bool flag = true;
    REP(i, N) if(A[i]%2==1) flag = !flag;
    cout << (flag ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 1024
l,r=map(int,input().split())
ans=2018
for i in range(l,r):
    for j in range(i+1,r+1):
        if i*j%2019<ans:
            ans=i*j%2019
        elif i*j%2019==ans:
            print(ans)
            exit()
print(ans)

Measured memory_bytes: 2940
V = [int(input()) for _ in range(5)]

v_mod = [x%10 if x%10 != 0 else 10 for x in V]
min_mod = min(v_mod)

ans = 0
for i, v in enumerate(V):
    ans += v + (10 - v_mod[i])
ans -= (10 - min_mod)
print(ans)


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

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

    int n; cin >> n;
    set<string> S;
    string t;
    for(int i=0;i<n;i++){
        cin >> t;
        S.insert(t);
    }
    cout << S.size();


    return 0;
}

Measured memory_bytes: 19132
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <boost/multiprecision/cpp_int.hpp> 
#include <boost/math/constants/constants.hpp> 

#define ll long long

using namespace std;
using namespace __gnu_pbds;
using namespace boost::multiprecision; 

/// FInd by ordeer return ietrator to kth largest element.
/// Order of key numbers strictly less than k.

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> new_set;

int solve(std::vector<int> v,int n){
	std::vector<int> dp(n+1,0);
	dp[0] = 0;
	dp[1] = abs(v[1] - v[0]);
	for(int i = 2;i<n;i++){
		dp[i] = min(dp[i-1] + abs(v[i] - v[i-1]),dp[i-2] + abs(v[i] - v[i-2]));
	}
	return dp[n-1];
}

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

  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  
  int n;cin >> n;
  std::vector<int> v(n);
  for(int i = 0;i<n;i++){
  	cin >> v[i];
  }
  cout<<solve(v,n)<<endl;
  return 0;
}

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

typedef struct node{
  long key;
  struct node *left;
  struct node *right;
  struct node *p;
}Node;

void print_tree(Node *x,int order) {
  if (order == 0) {
    printf(" %ld", x->key);    
  }
  if(x->left != NULL) print_tree(x->left,order);
  if (order == 1) {
    printf(" %ld", x->key);    
  }
  if(x->right != NULL) print_tree(x->right,order);
  if (order == 2) {
    printf(" %ld", x->key);    
  }
}

Node *insert(Node *root, long key) {
  Node *z = (Node*)malloc(sizeof(Node));
  z->key = key;
  z->p = NULL;
  z->left = NULL;
  z->right = NULL;
  Node *x,*y;
  y = NULL;
  x = root;
  while(x != NULL) {
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->p = y;
  if(y  == NULL) return z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
  return root;
}

int search_tree(Node *root, long key) {
  Node *x = root;
  while(x != NULL) {
    if(x->key == key) return 1;
    else if(x->key > key) x = x->left;
    else if(x->key < key) x = x->right;
  }
  return 0;
}

int main()
{
  long i,N,key;
  char command[7];
  Node *root = NULL;
  scanf("%ld",&N);
  for (i = 0; i < N; i++) {
    scanf("%s",command);
    if(strcmp(command,"insert") == 0) {
      scanf("%ld",&key);
      root = insert(root,key);
    }
    if(strcmp(command,"print") == 0) {
      print_tree(root,1);
      printf("\n");
      print_tree(root,0);
      printf("\n");
    }
    if(strcmp(command,"find") == 0) {
      scanf("%ld",&key);
      (search_tree(root,key) == 1) ? printf("yes\n") : printf("no\n");
    }
  }

  return 0;
}

Measured memory_bytes: 19364
N, S = open(0)
S = S.strip()

cnt = left = 0
for s in S:
    if s == "(":
        cnt += 1
    else:
        cnt -= 1

        if cnt < 0:
            left = max(left, -cnt)

S = "(" * left + S

right = 0
for s in S:
    if s == "(":
        right += 1
    else:
        right -= 1

S = S + ")" * right

print(S)

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

ll gcd(ll a, ll b) {
    return (b == 0) ? a : gcd(b, a%b);
}

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

int main() {
    ll N, M; cin >> N >> M;
    vector<int> A(N);
    ll LCM = 1;
    for(int i = 0; i < N; ++i) {
        cin >> A[i]; A[i] /= 2;
        LCM = lcm(LCM, A[i], M + 1);
    }
    int cnt2 = 0;
    while(A[0] % 2 == 0) {
        cnt2++;
        A[0] /= 2;
    }
    for(int i = 1; i < N; ++i) {
        int cnt = 0;
        while(A[i] % 2 == 0) {
            cnt++;
            A[i] /= 2;
        }
        if(cnt2 != cnt) {
            cout << "0\n";
            return 0;
        }
    }
    cout << (M / LCM + 1) / 2 << endl;
}


Measured memory_bytes: 640
MOD = 10**9 + 7
MAX = 2*10**5
fac = [0]*MAX  # fac[n]:  (n!) mod p
finv = [0]*MAX  # finv[n]: (n!)^-1 mod p
inv = [0]*MAX  # inv[n]:  (n)^-1 mod -p


def comb_init():
    global fac, finv, inv
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i-1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD//i) % MOD
        finv[i] = finv[i-1] * inv[i] % MOD


def comb(n: int, r: int) -> int:
    global fac, finv
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD


H, W, A, B = map(int, input().split())
comb_init()
ans = 0

for i in range(H-A):
    x = comb(B-1+i, i)
    a = H-1-i
    b = W-1-B
    x *= comb(a+b, a)
    x %= MOD
    ans += x
ans %= MOD
print(ans)


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

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        var d = new Dictionary<int,int>();
        string[] line2 = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line2, int.Parse);
        for (int i = 0; i < n; i++)
            if (d.ContainsKey(a[i])) d[a[i]]++;
            else d[a[i]] = 1;
        var ret = d.OrderByDescending(x => x.Value).Skip(k).Sum(x =>x.Value);
        Console.WriteLine(ret);
    }
}

Measured memory_bytes: 43284
#include<stdio.h>
int main()
{  int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51},k;
   scanf("%d",&k);
   printf("%d",a[k-1]);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int maxi = 100005;
typedef long long ll;

ll h[maxi],dp[maxi];
ll n,k;

ll inf = 100000000000000L;
ll fun(ll i)
{
	if(dp[i]!=inf)return dp[i];
	if(i==n)return 0;
	if(i>n) return inf;
	for(int j=i+1;j<(i+1+k) && j<=n ;j++)
	dp[i]=min(dp[i],(abs(h[i]-h[j]))+fun(j));
	
	return dp[i];
	
}


int main()
{
	
	cin>>n>>k;
	for(ll i = 1;i<=n;i++)dp[i]=inf;
	for(ll i =1;i<=n;i++)cin>>h[i];
	cout<<fun(1)<<endl;
	
	
}

Measured memory_bytes: 11316
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
string s;
int main() {
	cin >> s;
	string t = s;
	reverse(t.begin(), t.end());
	string u = t;
	for (int i = 0; i < s.size(); i++) {
		if (t[i] == 'b') u[i] = 'd';
		if (t[i] == 'd') u[i] = 'b';
		if (t[i] == 'p') u[i] = 'q';
		if (t[i] == 'q') u[i] = 'p';
	}
	cout << (s == u ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>

#define REP(idx, end) for(int idx = 0; idx < end; ++idx)
#define DBG(x) cerr << #x << ": " << x << "\n"

using namespace std;
typedef long long lint;
const int MOD = 1000000007;

int main() {

	cin.tie(0);

	int A, B, C, D;
	cin >> A >> B >> C >> D;

	if (A*B > C*D) {

		cout << A * B;
	}
	else cout << C * D;
	
    DBG(A*B);
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
import heapq
h, w = [int(item) for item in input().split()]
c = [[int(item) for item in input().split()] for _ in range(10)]
a = [[int(item) for item in input().split()] for _ in range(h)]
INF = 10**9

class Dijkstra:
    def __init__(self, adj):
        self.adj = adj
        self.num = len(adj)
        self.dist = [INF] * self.num
        self.prev = [INF] * self.num
        self.q = []

    def reset(self):
        self.dist = [INF] * self.num
        self.prev = [INF] * self.num
        self.q = []

    def calc(self, start, goal=None):
        self.dist[start] = 0
        heapq.heappush(self.q, (0, start))
        while len(self.q) != 0:
            prov_cost, src = heapq.heappop(self.q)
            if self.dist[src] < prov_cost:
                continue
            for dest in range(self.num):
                cost = self.adj[src][dest]
                if cost != INF and self.dist[dest] > self.dist[src] + cost:
                    self.dist[dest] = self.dist[src] + cost
                    heapq.heappush(self.q, (self.dist[dest], dest))
                    self.prev[dest] = src
        if goal is not None:
            return self.get_path(goal)
        else:
            return self.dist

    def get_path(self, goal):
        path = [goal]
        dest = goal

        while self.prev[dest] != INF:
            path.append(self.prev[dest])
            dest = self.prev[dest]
        return list(reversed(path))

dijk = Dijkstra(c)
costs = [0] * 10
for i in range(10):
    costs[i] = dijk.calc(i)[1]
    dijk.reset()

count = Counter()
for item in a:
    count.update(item)

ans = 0
for key in count.keys():
    if key >= 0:
        ans += count[key] * costs[key]

print(ans)

Measured memory_bytes: 3696
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
int main(){
    ll n,m;
    ll k;
    vector<ll> a,b;
    cin >> n >> m >> k;
    a.resize(n+10);
    b.resize(m+10);
    vector<ll> sum_a(n+10,0);
    vector<ll> sum_b(m+10,0);
    for(int i=0; i<n; i++){
        cin >> a[i];
        sum_a[i+1] = sum_a[i]+a[i];
    }
    for(int j=0; j<m; j++){
        cin >> b[j];
        sum_b[j+1] = sum_b[j]+b[j];
    } 
    ll ans=0;
    ll j=m;
    for(ll i=0; i<=n; i++){
        if(sum_a[i]>k) break;
        ll temp_max=k-sum_a[i];
        while(sum_b[j]>temp_max) j--;
        ans = max(ans,i+j);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 9592
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    ll n;
    cin >> n;
    cout << 0 << endl;
    vector<string> ans(n);
    cin >> ans[0];
    if(ans[0] == "Vacant"){
        return 0;
    }
    cout << n-1 << endl;
    cin >> ans[n-1];
    if(ans[n-1] == "Vacant"){
        return 0;
    }
    ll right = n-1;
    ll left = 0;
    while(right-left > 1){
        ll mid = (right+left)/2;
        cout << mid << endl;
        cin >> ans[mid];
        if(ans[mid] == "Vacant") return 0;
        else{
            if((right-mid)%2 == 0 && ans[mid] != ans[right]){
                left = mid;
            }
            else if((right-mid)%2 == 1 && ans[mid] == ans[right]){
                left = mid;
            }
            else if((mid-left)%2 == 0 && ans[mid] != ans[left]){
                right = mid;
            }
            else if((mid-left)%2 == 1 && ans[mid] == ans[left]){
                right = mid;
            }
        }
    }

}

Measured memory_bytes: 1620
/* ex2_3
   KKOO  */

#include <stdio.h>

int main(void) {
    int ALL,WHITE;

    //マス目の一辺の入力
    scanf("%d",&ALL);

     //白いマスの入力
    scanf("%d",&WHITE);

    //黒いマスの入力
    printf("%d\n",ALL*ALL-WHITE);

    return 0;
}


Measured memory_bytes: 128
import sys
readline = sys.stdin.readline
 
import heapq
  
T = int(readline())
for t in range(T):
  N,A,B,C,D = map(int,readline().split())
  q = [(0,N)]
  heapq.heapify(q)
  seen = set()
  while q:
    cost,n = heapq.heappop(q)
    if n in seen:
      continue
    if n == 0:
      print(cost)
      break
    seen.add(n)
    heapq.heappush(q, (cost + n * D, 0))
    if n % 2 == 0:
      heapq.heappush(q, (cost + A, n // 2))
    else:
      heapq.heappush(q, (cost + D + A, (n + 1) // 2))
      heapq.heappush(q, (cost + D + A, (n - 1) // 2))
      
    if n % 3 == 0:
      heapq.heappush(q, (cost + B, n // 3))
    else:
      rest = n % 3
      heapq.heappush(q, (cost + rest * D + B, (n - rest) // 3))
      heapq.heappush(q, (cost + (3 - rest) * D + B, (n + (3 - rest)) // 3))
      
    if n % 5 == 0:
      heapq.heappush(q, (cost + C, n // 5))
    else:
      rest = n % 5
      heapq.heappush(q, (cost + rest * D + C, (n - rest) // 5))
      heapq.heappush(q, (cost + (5 - rest) * D + C, (n + (5 - rest)) // 5))

Measured memory_bytes: 12912
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd
from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

n = int(input())
t = [ int(input()) for _ in range(n) ]
# print(t)

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

ans = lcm_list(t)
print(ans)

Measured memory_bytes: 65260
#include<iostream>
#include<set>
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
//#define scanf scanf_s
#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pub push_back
using namespace std;
typedef long long int llint;
const llint one = 1;
const llint big = (one<<61);
const int mod=1000000007;
inline int gcd(int a,int b) { return b ? gcd(b, a % b) : a; }


int main(void){
	string a,b,c;
	cin>>a>>b>>c;
	printf("%c%c%c",a[0]-32,b[0]-32,c[0]-32);
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A.sort()
a=0
for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if A[i]+A[j]>A[k] and A[i]+A[k]>A[j] and A[k]+A[j]>A[i] and A[i]!=A[j] and A[k]!=A[j] and A[i]!=A[k]:
                a+=1
print(a)

Measured memory_bytes: 9148
import kotlin.system.exitProcess

fun main (args:Array<String>) {
    val goal = readLine()!!.toInt()
    val (a , b) = readLine()!!.split(" ").map(String::toInt)

    for (i in a..b){
        if(i % goal == 0){
            print("OK")
            exitProcess(0)
        }
    }
    print("NG")
}

Measured memory_bytes: 36564
s = input()
t = input()

# print(s)
# print(t)

s_list = list(s)
t_list = list(t)
# print(s_list)
# print(t_list)    

s_list_sorted = sorted(s_list)
t_list_sorted = sorted(t_list, reverse=True)
# print(s_list_sorted)
# print(t_list_sorted)

s_sorted = ''.join(s_list_sorted)
t_sorted = ''.join(t_list_sorted)
# print(s_sorted)
# print(t_sorted)

if s_sorted < t_sorted:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9108
import java.util.Scanner;

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

        int a = stdIn.nextInt();
        int p = stdIn.nextInt();

        p = p + a * 3;
        int s = p / 2;
        System.out.println(s);
    }
}

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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, t[100001];
  cin >> n;
  int sum = 0;
  rep(i, 0, n) cin >> t[i + 1], sum += t[i + 1];
  int m;
  cin >> m;
  int mx = 0;
  rep(i, 0, m) {
    int p, x;
    cin >> p >> x;
    cout << sum - (t[p] - x) << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int A,B,C;
	scanf("%d %d %d",&A,&B,&C);
	if(A==7&&B==5&&C==5||A==5&&B==7&&C==5||A==5&&B==5&&C==7)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

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

#define MAX 200

void input(char (*)[], int);
void check(char (*)[], int);
void sort(char(*)[], int);
void swap(char*, char*);

int main()
{
	int n, l;
	char data[MAX][MAX];

	scanf("%d %d", &n, &l);
	input(data, n);

	sort(data, n);

	for (int i = 0; i < n; i++)
		printf("%s", data[i]);

	printf("\n");

	return 0;
}

void input(char (*data)[MAX], int n)
{
	for (int i = 0; i < n; i++)
		scanf("%s", &data[i]);
}

void sort(char(*data)[MAX], int n)
{
	int i, j;

	for (i = 0; i < n - 1; i++) {
		for (j = i + 1; j < n; j++) {
			if (strcmp(data[i], data[j]) > 0)
				swap(data[i], data[j]);
		}
	}
}

void swap(char* s1, char* s2)
{
	char temp[MAX];

	strcpy(temp, s1);
	strcpy(s1, s2);
	strcpy(s2, temp);
}

Measured memory_bytes: 1740
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>


using std::cout;
using std::cin;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


ll gcd(ll a, ll b) {
    while (b != 0) {
        auto tmp = a;
        a = b;
        b = tmp % a;
    }
    return a;
}

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

int isPrime(int a) {
    for (int i = 2; i * i <= a; ++i) {
        if (a % i == 0) {
            return 0;
        }
    }
    return 1;
}





void oneCase () {
    ll n, k;
    cin >> n >> k;
    vector<pair<ll, ll>> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i].first >> a[i].second;
    }
    sort(a.begin(), a.end());
    ll cur = 1;
    for (auto p : a) {
        cur += p.second;
        if (cur > k) {
            cout << p.first << "\n";
            return;
        }
    }



}




int main() {
    int t = 1;
//    cin >> t;
    while (t > 0) {
        oneCase();
        --t;
    }

    return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long

int main() {
 
  int count[130] = {0} ;
  string s ;
  cin >> s; 
  string  ans = "None";
  
  rep(i,s.size()){
    count[(int)s.at(i)] ++;
  }
  
  
  for(int i = 97;i<123;i++){
   if(count[i] == 0){
     ans =  (char) i;
     break ;
   }
  }
  
  cout << ans ;

}


Measured memory_bytes: 512
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static final Pattern DIGIT = Pattern.compile("([0-9]+)");

    public static void main(String[] args) {
        int sum = 0;

        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            Matcher matcher = DIGIT.matcher(scanner.nextLine());
            while (matcher.find()) {
                sum += Integer.parseInt(matcher.group());
            }
        }
        System.out.println(sum);
        scanner.close();
    }
}



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

int main(){
    int n, i, k, count;
    float sqr;
    int input_list[10000];
    
    scanf("%d", &n);
    
    for(i = 0; i < n; i++){
        scanf("%d", &input_list[i]);
    }
    
    count = 0;
    for(i = 0; i < n; i++){
        sqr = sqrt(input_list[i]);
        for(k = 2; k <= sqr; k++){
            if(input_list[i] % k == 0){
                break;
            }
        }
        if(k > (int)sqr){
            count++;
        }
    }
    printf("%d\n", count);
    
    return 0;
}


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

#define int long long 

using namespace std;

void solve()
{
	int n,r=0,cnt=0,c=0;
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<n;i++){
		if(s[i]=='R')
			r++;
	}
	if(r==0){
		cout << cnt << endl;
		return;
	}
	for(int i =0;i<r;i++){
		if(s[i]=='R')
			c++;
	}
	
	cout << r-c << endl;
}

int32_t main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	
	//int t;cin >> t;while(t--)
		solve();

	return 0;
}

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

using namespace std;

int main()
{
    int n, x, a[1000], j = 1;
    cin >> n;
    cin >> x;
    a[1] = x;
    a[2] = x;
    for( int i = 2; i < n; i++ ){
        cin >> x;
        a[i+1] = x;
        a[i] = min(a[i], x);
    }
    int s = 0;
    for( int i = 1; i <= n; i++ ){
        s += a[i];
    }
    cout << s;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

const double PI = 3.14159265358979323846;

double yogen(double a, double b, double kaku)
{
    double tmp = pow(a,2) + pow(b,2) - 2 * a * b * cos(kaku);
    return sqrt(tmp);
}

double kaku(double h, double m)
{
    double hun = 60 * h + m;
    double rad = hun / 360 * PI;
    return rad;
}

int main(int argc, char const *argv[]) {
    double a, b, h, m;
    // cin >> a >> b >> h >> m;
    scanf("%lf%lf%lf%lf",&a,&b,&h,&m);

    double hour_rad = kaku(h,m);
    double min_rad = kaku(0,m)* 12;
    double rad = abs(min_rad - hour_rad);
    double ans = yogen(a,b,rad);
    // cout << ans << endl;
    printf("%20.20lf",ans);
    printf("\n");
    return 0;
}


Measured memory_bytes: 4216
using System;

namespace A
{
    class Solve
    {
        public bool solve(int i, int[] A, int m, int n)
        {
            bool res = false;
            if (m == 0)
            {
                return true;
            }
            if (i>=n)
            {
                return false;
            }
            if (res)
            {
                return res;
            }
            res = solve(i+1, A, m, n);
            if (res)
            {
                return res;
            }
            res = solve(i+1, A, m-A[i], n);
            if (res)
            {
                return res;
            }
            return res;
        }
    }
    

    class A
    {
        static void Main(string[] args)
        {
            Solve check = new Solve();
            int n, q, i;
            int[] A = new int[2000];
            string[] B = new string[10000];
            string input;
            input = Console.ReadLine();
            n = int.Parse(input);
            B = Console.ReadLine().Split(' ');
            for (i = 0; i < n; i++)
            {
                A[i] = int.Parse(B[i]);
            }
            input = Console.ReadLine();
            q = int.Parse(input);
            B = Console.ReadLine().Split(' ');

            for (i=0; i<q; i++)
            {
                if (check.solve(0, A, int.Parse(B[i]), n))
                {
                    Console.WriteLine("yes");
                }
                else
                {
                    Console.WriteLine("no");
                }
            }

        }
    }
}



Measured memory_bytes: 8956
#include <stdio.h>

const int MAX_V = 1000000;
int prime[MAX_V+1];
int a[MAX_V] = {'0'};
int sum[MAX_V+1];
int main() {
  int i, k, v, j, m, n;
  for(i = 2; i <= MAX_V; i++) {
    prime[i] = 1;
  }
  for(i = 2; i*i <= MAX_V; i++) {
    if(prime[i]) {
      for(k = 2 * i; k <= MAX_V; k += i) {
        prime[k] = 0;
      }
    }
  }
  sum[0] = 0;
  for(m = 0; m < MAX_V; m++) {
    sum[m+1] = sum[m] + prime[m];
  }
  while( scanf( "%d", &n ) != EOF ) {
    printf( "%d\n", sum[n+1] );
  }
  return 0;
}

Measured memory_bytes: 8840
#include<bits/stdc++.h> 
 
#define mod 1000000007
#define mod2 998244353
#define int long long
#define endl "\n"
#define p_b push_back
#define m_p make_pair
#define pie pair<int,int>
using namespace std;

int32_t main(){

	string s;cin>>s;
	sort(s.begin(),s.end());
	if(s[0]!=s[2])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
/*************************************************************************
  >         File: C.cc
  >       Author: Riho.Yoshioka
  >         Mail: riho.yoshioka@yandex.com
  > Created Time: Sun 31 Jul 2016 08:22:19 PM CST
*************************************************************************/
#include <bits/stdc++.h>
typedef long long LL;
using namespace std;

const int N = 1e5 + 5;
int a[N], n, L;

int main() {
  ios::sync_with_stdio(0);
  cin >> n >> L;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int mx = 0;
  int idx = 0;
  for (int i = 0; i < n - 1; i++) {
    if (a[i + 1] + a[i + 2] > mx) {
      mx = a[i + 1] + a[i + 2];
      idx = i + 1;
    }
  }
  if (mx < L) {
    cout << "Impossible" << endl;
  }
  else {
    cout << "Possible" << endl;
    for (int i = 1; i < idx; i++) {
      cout << i << endl;
    }
    for (int i = n - 1; i >= idx; i--) {
      cout << i << endl;
    }
  }

  return 0;
}


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

set<pair<int, int>> es;

void dfs(int l, int r) {
    if (r <= l + 1) return;
    int m = (l + r) / 2;
    for (int i = l + 1; i < m; i++) {
        es.insert({l, i});
    }
    for (int i = m + 1; i < r; i++) {
        es.insert({m, i});
    }
    dfs(l, m);
    dfs(m, r);
}

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

    dfs(0, n);
    cout << es.size() << endl;
    for (auto& e : es) {
        cout << e.first + 1 << ' ' << e.second + 1 << endl; 
    }

    while (k--) {
        cout << 1 << endl;
        string s;
        cin >> s;
        if (s == "Yes") continue;
        if (s == "Near") {
            int l = 0, r = n / 2;
            while (1) {
                int m = (l + r) / 2;
                cout << m + 1 << endl;
                string s;
                cin >> s;
                if (s == "Yes") break;
                if (s == "Near") {
                    l = m;
                } else {
                    r = m;
                }
            }
        } else {
            cout << n / 2 + 1 << endl;
            string s;
            cin >> s;
            if (s == "Yes") continue;
            int l = n / 2, r = n;
            while (1) {
                int m = (l + r) / 2;
                cout << m + 1 << endl;
                string s;
                cin >> s;
                if (s == "Yes") break;
                if (s == "Near") {
                    l = m;
                } else {
                    r = m;
                }
            }
        }
    }
}


Measured memory_bytes: 3308
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	x, y := intScanner(), intScanner()
	if y >= x*2 && y <= x*4 && y%2 == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1756
program management
  implicit none
  integer :: n, a(200000) = -1, i, b(200000) = 0
  read(*,*) n
  read(*,*) a(2:n)
  do i = 2, n
    b(a(i)) = b(a(i))+1
  end do
  do i = 1, n
    write(*,'(i0)') b(i)
  end do
end program management

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

#define pb push_back
#define fst first
#define snd second
#define ALL(s) s.begin(),s.end()
#define fill(a,c) memset(&a, c, sizeof(a))
#define fore(i,x,y) for(ll i=x;i<y;i++)
#define SZ(x) ((int)(x).size())
#define PI 3.1415926535897932384626433832795
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef long long ll;
using namespace std;

int main() {FIN;
    string s; cin>>s;
    int ans = 0, p = 0, r = 0;
    fore(i,0,SZ(s)){
        if(p == r){
            r++;
            if(s[i] == 'p') ans--;
        }else{
            p++;
            if(s[i] == 'g') ans++;
        }
    }
    cout<<ans<<"\n";
    return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define fix(n) cout<<fixed<<setprecision(n);
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  ll m=0,n; cin>>n;
  vector<ll> a(n),x(100010);
  rep(i,0,n){
    cin>>a[i];
    x[a[i]]++;
    m+=a[i];
  }
  ll q; cin>>q;
  rep(i,0,q){
    ll b,c; cin>>b>>c;
    ll bb=x[b];
    m+=(c-b)*bb;
    x[c]+=bb;
    co(m);
    x[b]=0;
  }
  
    
  return 0;
}

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

int main() {
	int n;
	string s;

	cin >> n;
	cin.ignore();
	for(int i = 0; i < n; i++) {
		getline(cin, s);
		for(int j = s.find("Hoshino", 0); j != string::npos; j = s.find("Hoshino", j + 1)) {
			s[j + 6] = 'a';
		}
		cout << s << endl;
	}

}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,j;
    cin>>n;
    if(n>=400&&n<600)cout<<"8"<<endl;
    else if(n>599&&n<800)cout<<"7"<<endl;
    else if(n>799&&n<1000)cout<<"6"<<endl;
    else if(n>999&&n<1200)cout<<"5"<<endl;
    else if(n>1199&&n<1400)cout<<"4"<<endl;
    else if(n>1399&&n<1600)cout<<"3"<<endl;
    else if(n>1599&&n<1800)cout<<"2"<<endl;
    else if(n>1799&&n<2000)cout<<"1"<<endl;
    return 0;
}


Measured memory_bytes: 3604