akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int a, b;
  cin >> a >> b;
  if (a <= 8 && b <= 8) cout << "Yay!" << endl;
  else cout << ":(" << endl;


  
  return 0;
}

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

int main()
{
    string a,b,c;
    string A[3];
    cin >> a >> b >> c;
    A[0] = a[0];
    A[1] = b[1];
    A[2] = c[2];
    for(int i=0; i<3; i++){
        cout << A[i];
    }
    cout <<endl;
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func binarySearch(ng, ok int64, f func(int64) bool) int64 {
	for abs(ok-ng) > 1 {
		mid := (ng + ok) / 2
		if f(mid) {
			ok = mid
		} else {
			ng = mid
		}
	}
	return ok
}

func main() {
	var n, a, b int64
	fmt.Scan(&n, &a, &b)
	h := make([]int, n)
	for i := int64(0); i < n; i++ {
		fmt.Scan(&h[i])
	}
	f := func(k int64) bool {
		var x int64
		for _, e := range h {
			rem := int64(e) - b*k
			if rem > 0 {
				x += (rem + a - b - 1) / (a - b)
			}
		}
		return x <= k
	}
	ans := binarySearch(0, 1e9*2, f)
	fmt.Println(ans)
}


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

int main(){
	int n;
	cin >> n;
	int w[n];
	int s1 = 0,s2 = 0;
	REP(i,n){
		cin >> w[i];
		s2 += w[i];
	}
	int ans = 1e9;
	REP(i,n){
		s1 += w[i];
		s2 -= w[i];
		ans = min(ans, abs(s1 - s2));
	}
	cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
const int INF = 1e9;

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

	ll N, D;
	ll ans = 0;

	cin >> N >> D;

	ll A[10][20] = { { 0 } };

	rep(i, N) {
		rep(j, D) {
			cin >> A[i][j];
		}
	}

	ll sum = 0;
	double tmp = 0;
	rep(i, N) {
		rep2(j, i + 1, N) {
			sum = 0;
			rep(k, D) {
				sum += (ll)pow(A[i][k] - A[j][k],2);
			}
			tmp = sqrt(sum);
			if (tmp == floor(tmp)) {
				ans++;
			}

		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sum, patternNum := 0, 0
	sums := make(map[int]int)
	for i := 0; i < n; i++ {
		sums[sum]++

		sc.Scan()
		a, _ := strconv.Atoi(sc.Text())
		sum += a
		patternNum += sums[sum]
	}
	fmt.Printf("%d\n", patternNum)
}


Measured memory_bytes: 12672
#include <iostream>
using namespace std;
#define pi 3.14159265

int main()
{
	long long ans = 0, i = 0, j = 0, k = 0, A, B, C;
	cin >> A >> B >> C;

	if (A < B) {
		i = B; B = A; A = i;
	}
	if (A < C) {
		i = C; C = A; A = i;
	}
	if (B < C) {
		i = B; B = C; C = i;
	}

	cout << A*10 + B +C << endl; 
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define check system("pause")
#define all(x) (x).begin(),(x).end()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 0x3f3f3f3f
const ll mod = 1e9+7;
const int N = 1e6+20;
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define mes(p,b) memset(p,b,sizeof(p))
#define sz(x) int(x.size())
ll a,b;
int main()
{
  	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>a>>b;
	cout<<a*b;
	
	
  	return 0;
}



Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String A = br.readLine();
		char[] B = A.toCharArray();
		
		
		for(int i = 0; i < B.length; i++) {
			if(Character.isLowerCase(B[i])) {
				B[i] = Character.toUpperCase(B[i]);
			}
			else if (Character.isUpperCase(B[i])) {
				B[i] = Character.toLowerCase(B[i]);
			}
		}
		
		A = new String(B);
		
		System.out.println(A);
	}
}


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

int main() {
    string S;
    cin >> S;
    int N = S.size();
    vector<char> stack;
    int ans = 0;
    rep(i, N) {
        if (stack.empty() || stack.back() == S.at(i)) {
            stack.push_back(S.at(i));
        } else {
            stack.pop_back();
            ans += 2;
        }
    }
    cout << ans << endl;
}

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

struct UnionFind {
  int *par, *rk;
  UnionFind(int maxIndex) {
    par = new int[maxIndex + 1];
    rk = new int[maxIndex + 1];
    for (int i = 0; i <= maxIndex; i++) {
      par[i] = i;
      rk[i] = 0;
    }
  }

  int find(int a) {
    if (par[a] == a)
      return a;
    return par[a] = find(par[a]);
  }

  void unite(int a, int b) {
    a = find(a);
    b = find(b);
    if (rk[a] > rk[b]) {
      par[b] = a;
    } else if(rk[a] < rk[b]) {
      par[a] = b;
    } else {
      par[a] = b;
      rk[b] += 1;
    }
  }

  bool same(int a, int b) {
    return find(a) == find(b);
  }
};

int main() {
  int n, q;
  cin >> n >> q;
  UnionFind uf(n - 1);
  for (int i = 0; i < q; i++) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com == 0) {
      uf.unite(x, y);
    } else {
      cout << (uf.same(x, y) ? 1 : 0) << endl;
    }
  }

}

Measured memory_bytes: 3188
def main():
    n,m=map(int,input().split())
    s=list(reversed(list(input())))
    cnt=0
    ans=[]
    while cnt<n:
        for i in range(min(m,n-cnt),0,-1):
            if s[cnt+i]=="0":
                cnt+=i
                ans.append(i)
                break
        else:
            print(-1)
            return 0
    print(*list(reversed(ans)))
main()

Measured memory_bytes: 7064
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

void b_minesweeper(void) {
	int h, w;
	char s[52][52] = { '.' };
	char o;

	cin >> h >> w;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> s[i][j];
		}
	}

	int bumb = 0;

	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (s[i][j] == '#') {
				o = '#';
			}
			else {
				bumb = 0;
				for (int k = i - 1; k < i + 2; k++) {
					for (int l = j - 1; l < j + 2; l++) {
						if (s[k][l] == '#') bumb++;
					}
				}
				o = bumb+'0';
			}
			cout << o;
		}
		cout << endl;
		
	}
}

int main()
{
	b_minesweeper();
    return 0;
}

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

#define N 100

int G[N][N];
int d[N];

void dijkstra(int s, int n)
{
    int visited[n], p[n];
    for (int i = 0; i < n; i++)
    {
        visited[i] = 0;
        d[i] = INF;
    }
    d[s] = 0;

    while (true)
    {
        int mincost = INF;
        int u = -1;
        for (int i = 0; i < n; i++)
        {
            if (!visited[i] && d[i] < mincost)
            {
                mincost = d[i];
                u = i;
            }
        }

        if (u == -1)
            break;

        visited[u] = 1;
        for (int i = 0; i < n; i++)
        {
            if (G[u][i] != INF && !visited[i])
            {
                if (d[u] + G[u][i] < d[i])
                {
                    d[i] = d[u] + G[u][i];
                    p[i] = u;
                }
            }
        }
    }
}

signed main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            G[i][j] = INF;

    for (int i = 0; i < n; i++)
    {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++)
        {
            int v, c;
            cin >> v >> c;
            G[u][v] = c;
        }
    }

    dijkstra(0, n);

    for (int i = 0; i < n; i++)
        cout << i << ' ' << d[i] << endl;
}



Measured memory_bytes: 3160
def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    x = a_lst[0]
    y = sum(a_lst) - x

    minimum = abs(x - y)
    for i in range(1, n - 1):
        a = a_lst[i]
        x += a
        y -= a
        minimum = min(minimum, abs(x - y))

    print(minimum)


if __name__ == '__main__':
    main()

Measured memory_bytes: 30592
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
bool prime(int x){
	bool ok=true;
	for(int i=2;i*i<=x;i++)if(x%i==0)ok=false;
	return ok;
}
int cls[100110];
int main(){
	cls[0]=0;
	cls[1]=0;
	cls[2]=0;
	for(int i=3;i<100010;i++){
		cls[i]=cls[i-1];
		if(i%2==1){
			if(prime(i)&&prime((i+1)/2))cls[i]++;
		}
	}
	int q,a,b;
	cin>>q;
	lol(i,q){
		cin>>a>>b;
		cout<<cls[b]-cls[a-1]<<endl;
	}
	return 0;
}

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


int main(){
  int n,k,q;
  cin >> n>>k>>q;
  vector<int> seikai(n,0);
  rep(i,q){
    int a;
    cin >>a;
    seikai[a-1] +=1;
  }
  rep(i,n){
  //  cout<<seikai[i];
    if(q-seikai[i]<k) cout << "Yes"<<endl;
    else cout << "No"<<endl;
  }
}



Measured memory_bytes: 1024
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = scan.nextInt();
        int[] a = new int[n];
        long sum = 0;
        for(int i = 0; i < n; i++){
            a[i] = scan.nextInt();
            sum += a[i];
        }
        if(sum == x){
            System.out.println(n);
        }else if(sum > x){
            Arrays.sort(a);
            int out = 0;
            for(int i = 0; i < n && x > 0; i++){
                x -= a[i];
                out++;
            }
            System.out.println(x == 0 ? out : out - 1);
        }else{
            System.out.println(n - 1);
        }
        scan.close();
    }
}

Measured memory_bytes: 26960
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n;
	cin >> n;
	vector<long double> p(n+1);
	for(int i = 1; i<=n; i++){
		cin >> p[i];
	}
	vector<long double> dp(n+1);
	dp[0] = 1;
 
	for(int i = 1; i<= n ; i++){
		for(int j = i; j >=0 ; j--){
			dp[j] = (j?dp[j-1]*p[i]:0) + (dp[j]*(1-p[i]));
		}
	}
 
	long double res = 0;
	for(int i = (n/2)+1; i <=n ; i++){
		res += dp[i];
	}
	cout<<setprecision(10)<<res<<endl;
 
	return 0;
}

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

#define LL long long
#define VI vector<int>
#define VB vector<bool>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

const std::string YES = "YES";
const std::string Yes = "Yes";
const std::string NO = "NO";
const std::string No = "No";

using namespace std;

template <class T> int find_index(T x, const std::vector<T> &v) {
    auto it = std::find(v.begin(), v.end(), x);
    if (it != v.end()) { return (int)std::distance(v.begin(), it); }
    return -1;
}
template<class T> T ceil(T a, T b) { return (a + b - 1) / b; }

template <class T> void print(T x) {
    std::cout << x << std::endl;
}
// 4近傍（右, 下, 左, 上）
const vector<int> dy = { 0, -1, 0, 1 };
const vector<int> dx = { 1, 0, -1, 0 };


class Imos {
public:
    const unsigned int N;
    vector<long long> dp;
    Imos(unsigned int N) : N(N) {
        dp = vector<long long>(N + 10);
    }

    // [a, b]にkを加える
    void add(int a, int b, int k) {
        dp[a] += k;
        dp[b + 1] -= k;
    }

    // 円環状で[a, b]にk加える
    void add_circle(int a, int b, int k) {
        if (a <= b) {
            add(a, b, k);
        }
        else {
            add(b, N, k);
            add(0, b, k);
        }
    }

    void build() {
        for (int i = 0; i < dp.size() - 1; ++i) {
            dp[i + 1] += dp[i];
        }
    }

    void print() {
        for (int i = 0; i < dp.size(); ++i) {
            if (i != 0) { cout << " "; }
            cout << dp[i];
        }
        cout << endl;
    }

};


void solve(long long m, vector<long long> &a){
    vector<int> dp(m + 2, 0);

    Imos imos1(m), imos2(m);

    FOR(i, 0, a.size() - 1) {
        int x = a[i];
        int y = a[i + 1];

        if (x<=y){
            imos1.add(1, x, y - x);
            imos1.add(x + 1, y, y + 1);
            imos2.add(x + 1, y, -1);
            imos1.add(y + 1, m, y - x);
        }
        else{
            imos1.add(1, y, y + 1);
            imos2.add(1, y, -1);
            imos1.add(y + 1, x, m - x + y);
            imos1.add(x + 1, m, m + y + 1);
            imos2.add(x + 1, m, -1);
        }
    }

    imos1.build();
    imos2.build();

    LL ans = LONG_LONG_MAX;
    FOR(i, 1, m + 1) {
        ans = min(ans, imos1.dp[i] + i * imos2.dp[i]);
    }

    cout << ans - MAX(dp) << endl;
}

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

    long long m;
    long long n;
    cin >> n >> m;
    vector<long long> a(n);

    for(int i = 0 ; i < n; i++){
        cin >> a[i];
    }
    solve(m, a);
    return 0;
}



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

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

    //good luck kittu!
    int n, m, x, y; cin>>n>>m;
    vector<int> h(n+1), hmax(n+1);
    for(int i = 1; i<=n; i++) cin>>h[i];
    while(m--){
        cin>>x>>y;
        hmax[x] = max(hmax[x], h[y]);
        hmax[y] = max(hmax[y], h[x]);
    }    

    int ans = 0;
    for(int i = 1; i<=n; i++){
        if(h[i]>hmax[i]) ans++;
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 4004
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<" ";

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,k;
    cin>>a>>b>>k;
    if(a>k){
        a-=k;
        k=0;
    }else{
        k-=a;
        a=0;
    }
    if(b>k){
        b-=k;
        k=0;
    }else{
        b=0;
    }
    cout << a<<" "<<b<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = str(input())

r = 0
g = 0
b = 0
for s in range(N):
    if S[s] == 'R':
        r += 1
    elif S[s] == 'G':
        g += 1
    elif S[s] == 'B':
        b += 1

ans = (r*g*b)

for i in range(N):
    for k in range(N):
        j = int((i+k)/2)
        if k <= i or (i+k)%2 != 0 or j <= i or k <= j:
            continue
        if (S[i] != S[j]) and (S[j] != S[k]) and (S[i] != S[k]):
            ans -= 1

print(ans)

Measured memory_bytes: 68132
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main() 
{
        int A;
        int B;
        int start;

        scanf("%d %d",&A, &B);
        start=A+B;
        start=start%24;
        printf("%d \n",start);

        return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    long long int A,B;
    int K;
    while(scanf("%lld%lld%d",&A,&B,&K)!=EOF)
    {
        int t;
        if(A>B){t=A;A=B;B=t;}
        long long int i,j;
        if(K>=(B-A+2)/2)
         for( i=A;i<=B;i++)
            printf("%lld\n",i);

        else
        {
            for( j=A;j<A+K;j++)
                printf("%lld\n",j);
            for( j=B-K+1;j<=B;j++)
                printf("%lld\n",j);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=51 ;
int main()
{
   fast ;
   ll r[3][3] ;
   for(ll i=0;i<3;i++) for(ll j=0;j<3;j++) cin>>r[i][j] ;

   ll q ;
   cin>>q ;
   for(ll i=0;i<q;i++){
    ll x ;
    cin>>x ;
    for(ll j=0;j<3;j++){
        for(ll k=0;k<3;k++)
        {
            if(r[j][k]==x) r[j][k]=-r[j][k] ;
        }
    }

   }

   ll f=0 ;
   for(ll i=0;i<3;i++)
   {
       ll ff=1 ;
       for(ll j=0;j<3;j++)
       {
         if(r[i][j]>=0) ff=0 ;
       }
       if(ff)
        f=1 ;
   }
   for(ll j=0;j<3;j++){

         ll ff=1 ;
    for(ll i=0;i<3;i++)
    {


         if(r[i][j]>=0) ff=0 ;

    }
    if(ff)
        f=1 ;
   }

   ll i=0,j=0 ;
   ll ff=1 ;
   while(i<3)
   {
       if(r[i][j]>=0) { ff=0 ; break ;}

       i++ ;
       j++ ;
   }
   if(ff) f=1 ;

   i=2,j=0 ;
   ff=1 ;
   while(i>=0)
   {
       if(r[i][j]>=0){  ff=0 ; break ; }

       i-- ;
       j++ ;

   }
   if(ff) f=1 ;


   if(f) cout<<"Yes" ;
   else cout<<"No" ;
}




Measured memory_bytes: 256
s = gets.chomp
case s
when 'SUN'
  p 7
when 'MON'
  p 6
when 'TUE'
  p 5
when 'WED'
  p 4
when 'THU'
  p 3
when 'FRI'
  p 2
when 'SAT'
  p 1
end


Measured memory_bytes: 1788
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


int N;
long long K;
int main() {
    while (cin >> N >> K) {
        long long res = 1;
        for (int i = 0; i < N; ++i) {
            long long tmp1 = res * 2;
            long long tmp2 = res + K;
            res = min(tmp1, tmp2);
        }
        cout << res << endl;
    }
}







Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>
#include<bitset>
#include<stack>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll, ll> lltpl;

int dy8[8] = { 2,2,-2,-2,1,1,-1,-1 };
int dx8[8] = { 1,-1,1,-1,2,-2,2,-2 };
int dx4[4] = { 1,0,0,-1 };
int dy4[4] = { 0,1,-1,0 };


/******************************************************************************************/


const int IINF = 1e9 + 7;
const ll LINF = 1e18 + 7;
constexpr ll MOD = 1e9 + 7;



template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}

// vector
template <typename T>
istream& operator>>(istream & is, vector<T> & vec) { for (T& x : vec) is >> x; return is; }
// pair
template <typename T, typename U>ostream& operator<<(ostream & os, pair<T, U> & pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; }
// vector
template <typename T>ostream& operator<<(ostream & os, const vector<T> & vec) { os << "{";	for (int i = 0; i < vec.size(); i++) { os << vec[i] << (i + 1 == vec.size() ? "" : ", "); }os << "}"; return os; }
// map
template <typename T, typename U>ostream& operator<<(ostream & os, map<T, U> & map_var) { os << "{";	repi(itr, map_var) { os << *itr; itr++; if (itr != map_var.end()) os << ", "; itr--; }os << "}"; return os; }
// set
template <typename T>ostream& operator<<(ostream & os, set<T> & set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; }os << "}"; return os; }


int main() {

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

	int a, b;
	cin >> a >> b;
	cout << max(a - 2 * b, 0) << endl;


	
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, temp, i;
    number = Integer.parseInt(sc.next());
    int[] num = new int[number];
    for(i = 0; i < number; i++) num[i] = Integer.parseInt(sc.next());
    temp = 0;
    for(i = 0; i < number; i++) temp ^= num[i];
    if(temp == 0) System.out.println("Yes");
    else System.out.println("No");
  }
}


Measured memory_bytes: 46520
#include<bits/stdc++.h>
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define ll long long int
using namespace std;
int main()
{
    ll a,b,c,n,x,y,z,cnt=0,sum=0;
    string str;
    cin>>a>>b>>c;
    if(b*c >=a)
        Yes
    else No

}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
const double pi = 3.141592653589793;
int main(){
    vector<int> a(5);
    int ans=0;
    rep(i,5){
        cin>>a[i];
        if(a[i]==0){
            ans=i+1;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3588
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const ll N = 2e5 + 10, MOD = 1e9 + 7;
ll a[N], ans;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll n, k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        a[i] = i + a[i - 1];
    }
    for(int i = k; i <= n + 1; i++){
        ans = (ans + (a[n] - a[n - i] - a[i - 1] + 1)) % MOD;
    }
    cout << ans << '\n';
}

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

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

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    int x, y;
    cin >> x >> y;
    bool ans = ((2 * x) <= y && y <= (4 * x) && (y % 2 == 0));
    if (ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> count(M);
    for (int i = 0; i < N; i++)
    {
        int K;
        cin >> K;

        for (int j = 0; j < K; j++)
        {
            int A;
            cin >> A;
            A--;
            count[A]++;
        }
    }
    int ans = 0;
    for (int i = 0; i < M; i++)
    {
        if (count[i] == N)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    ll x;
    cin >> x;
    if(x < 1200) {
        cout << "ABC" << endl;
    } else {
        cout << "ARC" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
           int s,h,m;
           scanf("%d",&s);
           h=s/3600;
           s=s-h*3600;
           m=s/60;
           s=s-m*60;
           printf("%d:%d:%d\n",h,m,s);
           return 0;
}

Measured memory_bytes: 592
import math
N, A, B = map(int, input().split())
H = [int(input()) for i in range(N)]
l = 0
r = math.ceil(max(H))
ans = 0
d = A-B
while(1):
    if l+1 == r:
        ans = r
        break
    else:
        m = (l+r) // 2
        count = 0
        for i in range(N):
            if (H[i] - m*B) > 0:
                count += math.ceil((H[i]-m*B) / d)
        if count <= m:
            r = m
        else:
            l = m
print(ans)


Measured memory_bytes: 7120
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a=Integer.parseInt(sc.next());
int b=Integer.parseInt(sc.next());
int c=Integer.parseInt(sc.next());
if(a<b&&b<c){System.out.println("Yes");}else{
 System.out.println("No");   
}
}
}



Measured memory_bytes: 26216
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
#define _LIBCPP_DEBUG 0
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (n); i++)	
using namespace std;


int max(int a,int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main() {
	string s;
	cin >> s;
	cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  string S;
  cin>>S;
  if(S=="ABC") cout<<"ARC"<<endl;
  else cout<<"ABC"<<endl;
}


Measured memory_bytes: 3584
/*
 *      ┌─┐       ┌─┐ + +
 *   ┌──┘ ┴───────┘ ┴──┐++
 *   │                 │
 *   │       ───       │++ + + +
 *   ███████───███████ │+
 *   │                 │+
 *   │       ─┴─       │
 *   │                 │
 *   └───┐         ┌───┘
 *       │         │
 *       │         │   + +
 *       │         │       Code is far away from bug with the animal protecting
 *       │         └──────────────┐
 *       │                        │
 *       │                        ├─┐
 *       │                        ┌─┘
 *       │                        │
 *       └─┐  ┐  ┌───────┬──┐  ┌──┘  + + + +
 *         │ ─┤ ─┤       │ ─┤ ─┤
 *         └──┴──┘       └──┴──┘  + + + +
 *                神兽保佑
 *               代码无BUG!
 */

#include<bits/stdc++.h>
using namespace std;
class IN{
public:
    template<typename T>
    IN& operator >>(T &x){read(x);return *this;}
    IN& operator >>(double &x){scanf("%lf",&x);return *this;}
    IN& operator >>(char *s){scanf("%s",s);return *this;}
    IN& operator >>(char &c){c=getchar();return *this;}
private:
    template<typename T>
    void read(T &x){
        T f=1;int c=getchar();x=0;
        while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
        while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
        x*=f;
    }
}in;
class NL{}nl;
class BK{}bk;
class OUT{
public:
    template<typename T>
    OUT& operator <<(T x){write(x);return *this;}
    OUT& operator <<(const char *s){printf("%s",s);return *this;}
    OUT& operator <<(char c){putchar(c);return *this;}
    OUT& operator <<(BK x){putchar(' ');return *this;}
    OUT& operator <<(NL x){putchar('\n');return *this;}
private:
    template<typename T>
    void write(T x){
        if(x<0)putchar('-'),x=-x;
        if(x>=10)write(x/10);
        putchar(x%10+48);
    }
}out;

#define pb(x) push_back(x)
#define fi first
#define se second
#define rep(i,a,n) for(int i=a;i<=n;++i)
#define per(i,n,a) for(int i=n;i>=a;--i)
#define mem(a,x) memset(a,x,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;
/*****************************************************************************************************/
ll Pow(ll a,ll b,ll mod){ll res=1;a%=mod;while(b){if(b&1)(res*=a)%=mod;(a*=a)%=mod;b>>=1;}return res%mod;}
ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}//p为素数,a<p
ll C(ll n,ll m,ll p){ll res=1;for(ll i=1,j=n-m+1;i<=m;++i,++j){res=res*inv(i,p)%p*j%p;}return res;}
/*****************************************************************************************************/
/*ll ask(int x){ll res=0;while(x)res+=c[x],x-=x&-x;return res;}
void add(ll v,int x){while(x<=n)c[x]+=v,x+=x&-x;}*/
const int p=1e9+7;
const int N=2e5+10;
int a[N];

int main(){
    int n;
    in>>n;
    rep(i,1,n)in>>a[i];
    int cnt=0;
    for(int i=1;i<=n;i+=2)if(a[i]&1)++cnt;
    out<<cnt;
    return 0;
}


Measured memory_bytes: 3620
n, a, b = map(int, input().split())
ca, cb = 0, 0
for s in input():
    if s == 'a':
        if ca + cb < a + b:
            print('Yes')
            ca += 1
        else:
            print('No')
    elif s == 'b':
        if ca + cb < a + b and cb < b:
            print('Yes')
            cb += 1
        else:
            print('No')
    else:
        print('No')

Measured memory_bytes: 4016
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
using namespace std;
#define ll long long
#define INF 1000000007
ll ggd(ll a,ll b){
    ll x = a * b;
    ll tmp;
    /* 自然数 a > b を確認・入替 */
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    ll r;
    /* ユークリッドの互除法 */
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    
    return x/b;
}
signed main(){
    ll a,b,c,d;
    ll cc,cd,ccd;
    cin>>a>>b>>c>>d;
    cc=b/c-(a-1)/c;
    cd=b/d-(a-1)/d;
    ccd=b/ggd(c,d)-(a-1)/ggd(c,d);
    cout<<b-a+1-(cc+cd-ccd)<<endl;
    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll n; cin>>n;
  	vector<ll> l(n); rep(i,n) cin>>l[i];
  	sort(l.begin(),l.end(),greater<ll>());
  	ll s=0;
  	rep(i,n-1) s+=l[i+1];
  	if(l[0]<s) cout<<"Yes"<<endl;
  	else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

	if (a == b) {
		if (a != c) {
			cout << c << endl;
		}
	}
	if (a == c) {
		if (b != c) {
			cout << b << endl;
		}
	}
	if(a != b && a != c) {
		cout << a << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int i =1;
    int x;
     
    while(1){
        scanf("%d",&x);
        if(x == 0){
            break;
        }
    printf("Case %d: %d\n",i,x);
    i +=1;
    }
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
using namespace std;
#define LL long long

#include <cmath>
int gcd(int a, int b, int c)
{
    int result;
    int min_val = min(a, min(b, c));

    for (int i = min_val; i >= 1; --i) {
        if ((a % i == 0) && (b % i == 0) && (c % i == 0)) {
            result = i;
            break;
        }
    }
    return result;
}

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

    LL sum = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            for (int k = 1; k <= n; ++k) {
                sum += gcd(i, j, k);
            }
        }
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 3632
main = do
    n <- getLine
    vs <- (map read) <$> words <$> getLine :: IO [Int]
    cs <- (map read) <$> words <$> getLine :: IO [Int]
    let vcs = zipWith (-) vs cs
    let comb = combs vcs
    print $ maximum $ map sum comb

combs :: [a] -> [[a]]
combs [] = [[]]
combs (x:xs) = [x:rs | rs<-combs xs] ++ (combs xs)

Measured memory_bytes: 41212
# coding: utf-8
N=int(input())
P=list(map(int,input().split()))
#P.insert(0,0)
M=[0]*N
M[0]=P[0]
for i in range(N-1):
    M[i+1]=min(M[i],P[i+1])
#print(P)
#print(M)
ans=0
for i in range(N):
    if P[i]<=M[i]:
        ans+=1
print(ans)

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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Yes or No
void yesno(bool ok, string yes = "Yes", string no = "No") {
  cout << (ok ? yes : no) << endl;
}

// Paste snippets here!!

//

void solve(std::vector<long long> A) {
  auto it1 = min_element(all(A));
  auto it2 = max_element(all(A));
  cout << (*it2) - (*it1) << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  std::vector<long long> A(3);
  for (int i = 0; i < 3; i++) {
    std::cin >> A[i];
  }
  solve(std::move(A));
  return 0;
}


Measured memory_bytes: 3660
#include<iostream>
#include<stdio.h>
#include<math.h>

using namespace std;

int main() {
	while (true) {
		int n;
		int s[1001];
		double m = 0.0f;
		double a = 0.0f;

		cin >> n;
		if (n == 0)break;

		for (int i = 0; i < n; i++) {
			cin >> s[i];
			m += s[i];
		}
		m /= n;

		for (int i = 0; i < n; i++) {
			a += (s[i] - m)*(s[i] - m);
		}
		a = sqrt(a / n);

		printf("%lf\n", a);
	}
}

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

int main(){
  int n,l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i,n){
    cin >> s.at(i);
  }
  sort(s.begin(),s.end());
  rep(i,n){
    cout << s.at(i);
    if(i==n-1){
      cout << endl;
    }
  }
}
  

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created:  2016-10-10
#

# Usage
#
"""

def read_value():
    first_line = input()
    status = first_line.split(" ")

    num_of_contestant = int(status[0])
    basis = int(status[1])
    oversea_limit = int(status[2])

    second_line = input()
    rank_str = second_line

    return [num_of_contestant, basis, oversea_limit, rank_str]


def check_japan(rank, basis, oversea_limit):
    if rank < basis + oversea_limit:
        return "Yes"
    else:
        return "No"

def check_overseas(rank, oversea_rank, basis, oversea_limit):
    if rank < basis + oversea_limit and oversea_rank <= oversea_limit:
        return "Yes"
    else:
        return "No"


if __name__ == "__main__":
    input_items = read_value()

    basis = input_items[1]
    oversea_limit = input_items[2]
    rank_str = input_items[3]

    oversea_rank = 0
    passed = 0

    for rank, type in enumerate(rank_str):
        if type == "a":
            if check_japan(passed, basis, oversea_limit) == "Yes":
                print("Yes")
                passed += 1
            else:
                print("No")

        if type == "b":
            oversea_rank += 1
            if check_overseas(passed, oversea_rank, basis, oversea_limit) == "Yes":
                print("Yes")
                passed += 1
            else:
                print("No")

        if type == "c":
            print("No")


Measured memory_bytes: 4040
import sys
from collections import Counter

N = int(input())
s = Counter(list(map(int, sys.stdin.readline().rsplit())))

if s[0] == N:
    print("Yes")
elif len(s) == 2 and s[0] == N // 3:
    print("Yes")
elif len(s) == 3:
    res = 0
    num = set()
    for k, v in s.items():
        res ^= k
        num.add(v)
    if not res and len(num) == 1:
        print("Yes")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 14468
n, m = map(int, input().split())
pair = []
for i in range(n):
    ai, bi = list(map(int, input().split()))
    pair.append([ai, bi])

count = 0
mount = 0
pair.sort(key=lambda x:x[0])
temp = 0
for i in range(n):
    mount += pair[i][0]*pair[i][1]
    count += pair[i][1]
    if(count >= m): 
        temp = i
        break

print(mount - (count - m)*pair[temp][0])

Measured memory_bytes: 63192
r,D,x = map(int,input().split())
X = [x]*11

for i in range(0,10):
  X[i+1] = r*X[i] - D
  
  
print(X[1])
print(X[2])
print(X[3])
print(X[4])
print(X[5])
print(X[6])
print(X[7])
print(X[8])
print(X[9])
print(X[10])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n, k;
    cin >> n >> k;
    int p[n], a[n+1];
    a[0] = 0;
    int tmp = 0;
    rep(i, n){
        cin >> p[i];
        tmp += p[i];
        a[i+1] = tmp;
    }

    double tmp2 = 0;
    rep(i, n - k + 1){
        tmp2 = max(tmp2, double(a[i+k] - a[i]));
    }
    cout << fixed << setprecision(10) << (tmp2 + double(k)) / 2 << endl;
    return 0;
}

Measured memory_bytes: 1792
*S, = input()
*T, = input()

sl = len(S)
tl = len(T)

ans = tl
if sl == tl:
    ans = tl - sum([1 for a,b in zip(S, T) if a == b])

for i in range(sl):
    if i+tl >= sl:
        break
    count = tl - sum([1 for a,b in zip(S[i:i+tl], T) if a == b])
    ans = min(ans, count)

print(ans)

Measured memory_bytes: 9124
/*
 * Name        : b
 * Creat       : Thu Jul 11 21:43:16 CST 2019
 * Accept      : Thu Jul 11 21:46:04 CST 2019
 * Author      : landcold7
 * Motivation  : Action speaks louder more than words
 */
#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define sz(x) ((int)(x).size())
#ifndef _has_trace
#define trace(...)
#endif
typedef long long ll;

void solve() {
  int n, d;
  cin >> n >> d;
  vector<vector<int>> a(n, vector<int>(d));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < d; ++j) {
      cin >> a[i][j];
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int s = 0;
      for (int k = 0; k < d; ++k) {
        int v = abs(a[i][k] - a[j][k]);
        s += v * v;
      }
      int x = floor(sqrt(s));
      if (x * x == s) {
        ans++;
      }
    }
  }
  cout << ans << "\n";
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=2e6+10;
LL k;
int n,a[N],len[N],tot,c[N],bk[N],id;
int main(){
	while(~scanf("%d%lld",&n,&k)){
		memset(bk,0,sizeof(bk));
		tot=0;
		for(int i=1;i<=n;i++)scanf("%d",&a[i]);
		if(k<=1e7){
			int now=1;
			while(k--)now=a[now];
			cout<<now<<endl;
			return 0;
		}
		c[++tot]=1;bk[1]=1;
		int now=a[1];
		while(!bk[now]){
			c[++tot]=now;bk[now]=1;
			now=a[now];
		}
		for(int i=1;i<=tot;i++)
			if(c[i]==now){
				id=i;break;
			} 
		if(k-1<=id){
			cout<<c[k]<<endl;
			return 0;
		}
		LL len=tot-id+1;
		k-=(id-1);
		int ans=k%len;
		ans+=id;
		cout<<c[ans]<<endl;		
	}

} 

Measured memory_bytes: 12844
#include <stdio.h>

int main(void){
	int height[10];
	int i,j;
	int tmp;
	for(i=0;i<10;i++){
		scanf("%d",&height[i]);
	}
	for(i=0;i<10;i++){
		for(j=0;j<10;j++){
			if(height[i]>height[j]){
			tmp = height[i];
			height[i]=height[j];
			height[j]=tmp;
			}
		}
	}
	printf("%d\n%d\n%d\n",height[0],height[1],height[2]);
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>

using namespace std;

int main(int argc, char const *argv[]) {
	string in;
	std::cin >> in;
	int a,b,c,d;
	a = (int)(in[0] - '0');
	b = (int)(in[1] - '0');
	c = (int)(in[2] - '0');
	d = (int)(in[3] - '0');
	char ope[] = {'+','-'};
	int ans;
	for (size_t i = 0; i < 2; i++) {
		for (size_t j = 0; j < 2; j++) {
			for (size_t k = 0; k < 2; k++) {
				ans = a;
				if (i == 0) {
					ans += b;
				}
				else {
					ans -= b;
				}
				if (j == 0) {
					ans += c;
				}
				else {
					ans -= c;
				}
				if (k == 0) {
					ans += d;
				}
				else {
					ans -= d;
				}
				if (ans == 7) {
					std::cout << a<<ope[i]<<b<<ope[j]<<c<<ope[k]<<d<<"=7" << '\n';
					return 0;
				}
			}
		}
	}
	return 0;
}


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

#define pb push_back
#define fi first
#define se second
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pii pair<int,int>
#define mod 998244353

const int N=1e5+11;

int lowbit(int x) {return x&(-x);}

int n;
int h[N],f[N];

int main(){
	scanf("%d",&n);
	for (int i=0;i<n;i++) scanf("%d",&h[i]),f[i]=2e9;
	f[0]=0;
	for (int i=1;i<n;i++) {
		f[i]=min(f[i],f[i-1]+abs(h[i]-h[i-1]));
		if (i>1) f[i]=min(f[i],f[i-2]+abs(h[i]-h[i-2]));
	}
	printf("%d\n",f[n-1]);
	return 0;
}


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

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)

typedef long long ll;

int main() {
    string s; cin >> s;
    ll r = 0;
    int a = 0;
    fore(i, 0, s.size()) {
        if(s[i] == 'W') r += i - a++;
    }
    cout << r << endl;
    return 0;}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

# なんこか入力
n,m = map(int, input().split())

# 空白区切りの数列をリストに代入
a = [int(i) for i in input().split()]
b = [0]*(n)
c ={0:1}
bb=0
for i in range(0,n) :
    bb = ( bb+a[i] ) % m
    c[bb] = c.get(bb,0) + 1
    
    
answer = 0
#print(c)

for i,j in c.items():
    if j > 1:
        answer +=  (j * (j-1) // 2 )

print(answer)



Measured memory_bytes: 24148
using System;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            // 秒数を受け取る
            var S = int.Parse(Console.ReadLine());

            // 時間
            var h = S / 3600;
            S %= 3600;
            // 分
            var m = S / 60;
            // 秒
            var s = S % 60;

            Console.WriteLine($"{h}:{m}:{s}");
        }
    }
}


Measured memory_bytes: 17940
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
const int MOD = 1e9+7;
using ll = long long;
using vi = vector<int>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(x) x.begin(), x.end()
int main() {
  int a,sum=0,bob=0;
  cin >> a;
  vi ans(a);
  rep(i,a){
    cin >> ans.at(i);
    sum += ans.at(i);
  }
  sort(ALL(ans));
  int i = 1;
  while(i<a){
    bob += ans.at(i);
    i += 2;
  }
  cout << abs(sum-bob*2);
}


Measured memory_bytes: 3616