akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#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())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

int count(char c) {
  if (c == 'a') return 0;
  else return 'z' + 1 - c;
}

int main(int argc, char* argv[])
{
  string s;
  cin >> s;
  ll k;
  cin >> k;
  int n = s.size();

  rep(i, n) {
    if (s[i] == 'a') continue;
    int num = count(s[i]);
    // int num = 'z' - s[i] + 1;
    if (num <= k) {
      s[i] = 'a';
      k -= num;
    }
    if (k == 0) break;
  }

  // 最後に残った K を処分
  if (k > 0) {
    k %= 26;
    s[n - 1] += k;

    if (s[n - 1] > 'z') s[n - 1] -= 26;
  }

  cout << s << endl;

  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
int main(void){

    int a, b, c, x;
    scanf("%d %d %d\n", &a, &b, &c);

    if(a > b){
       x = a;
       a = b;
       b = x;
    }if(b > c){
        x = b;
        b = c;
        c = x;
        
        if(a > b){
            x = a;
            a = b;
            b = x;
    }
    }
    printf("%d %d %d\n", a, b, c);
    return 0;
}


Measured memory_bytes: 2100
A,B=map(int,input().split())

def prime_factorization(n):
    arr=[]
    temp=n

    for i in range(2,int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp//=i
            arr.append(i)

    if temp!=1:
        arr.append(temp)
    
    if arr==[]:
        arr.append(n)
    
    return arr

setA=set(prime_factorization(A))
setB=set(prime_factorization(B))
setAB=setA &setB
if setAB=={1}:
    print(1)
else:
    print(len(setAB)+1)

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

int main() {
  int N,a;
  string S;
  cin >> N;
  a = 0;
  // ここにプログラムを追記
  rep(i,N) {
    cin >> S;
    if(S == "Y") {
      a = 1;
    }
  }
  
  if(a == 1) {
    cout << "Four" << endl;
  } else {
	cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

int N, A;
int x[111];
ll coudp[111][111][5555];

int main() 
{
	int A, B,C;
	cin >> A>> B>>C;
	if (A == (B + C) || B == (A + C) || C == (A + B))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	

	return 0;
	
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;

const ll INF = 1LL << 32;

int main() {
  ll n, a, b;
  cin >> n >> a >> b;

  ll curpos;
  cin >> curpos;
  ll ans = 0;
  for (ll i = 1; i < n; i++) {
    ll tmp;
    cin >> tmp;
    ll d = tmp - curpos;
    ll ad = a * d;
    if (ad <= b) {
      ans += a * d;
    } else {
      ans += b;
    }
    curpos = tmp;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <climits>

#define CLR(mat) memset(mat, 0, sizeof(mat))

using namespace std;

static const int DAT_SIZE = 1<<18;
typedef long long ll;

ll data[DAT_SIZE], datb[DAT_SIZE];

void add(ll a, ll  b, ll x, ll  k, ll  l, ll  r){
    
    if(a <= l && r <= b){
        data[k] += x;
    }
    else if(l < b && a < r){
        datb[k] += (min(b, r) - max(a, l)) * x;
        add(a, b, x, k*2+1, l, (l+r)/2);
        add(a, b, x, k*2+2, (l+r)/2, r);
    }
}

ll sum(ll  a, ll  b, ll  k, ll  l, ll  r){
    
    if(b <= l || r <= a){
        return 0;
    }
    else if(a <= l && r <= b){
        return data[k] * (r-l) + datb[k];
    }
    else{
        ll res = (min(b, r) - max(a, l)) * data[k];
        res += sum(a, b, k*2+1, l, (l+r)/2);
        res += sum(a, b, k*2+2, (l+r)/2, r);
        return res;
    }
}

int main(){
    
	int n, k;
	
	while(cin >> n >> k, (n||k)){
    	
		CLR(data);
		CLR(datb);

	    for(int i=0; i<n; ++i){
			int a;
			scanf("%d", &a);
  			add(i, i+1, a, 0, 0, n);
		}
    
		ll ma = LLONG_MIN;

		for(int i=0; i<n-k; ++i){ 
			ma = max(ma, sum(i, i+k, 0, 0, n));
   	 	}
   	 
		cout << ma << endl;
	}

    return 0;
}

Measured memory_bytes: 5344
#include <iostream>
#include <memory>

int partition(int * A, int p, int r) {
    int x = A[r];
    int i = p - 1;

    for (int j = p; j < r; j++) {
        if (A[j] <= x) {
            i++;
            std::swap(A[i], A[j]);
        }
     }
    std::swap(A[i + 1], A[r]);
    return i + 1;
}

int main() {
    int n;
    std::cin >> n;
    int A[n];

    for (int i = 0; i < n; i++) {
        std::cin >> A[i];
    }
    
    int split = partition(A, 0, n - 1);
    for (int i = 0; i < n - 1; i++) {
        if (i == split) {
            std::cout << "[" << A[i] << "] ";
        } else {
            std::cout << A[i] << " ";
        }
    }
    if (split == n - 1) {
        std::cout << "[" << A[n - 1] << "]" << std::endl;
    } else {
        std::cout << A[n - 1] << std::endl;
    }
}



Measured memory_bytes: 3416
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    vector<vector<long long>> dp(s.size()+1,vector<long long>(13));
    dp[0][0] = 1;
    long long i,j,k,g;
    for(i=0;i<s.size();i++)
    {
        for(j=0;j<13;j++)
        {
            if (s[i] == '?')
            {
                for(k=0;k<10;k++)
                {
                    g=(j*10 + k)%13;
                    dp[i + 1][g] += dp[i][j];
                    if(dp[i + 1][g]>=MOD)dp[i + 1][g]-=MOD;
                }
            }
            else
            {
                g=(j * 10 + (s[i] - '0'))%13;
                dp[i + 1][g] += dp[i][j];
                if(dp[i + 1][g]>=MOD)dp[i + 1][g]-=MOD;
            }
        }
    }
    cout << dp[s.size()][5] << endl;
}


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

class PaizaSample
{

    static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        for (int i = 0; i < n; i++)
        {
            int[] input = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();

            int m = input[1] * 60;
            int h = input[0] * 300 + input[1] * 5;

            int angle = Math.Abs(m - h) <= 1800 ? Math.Abs(m - h) : 3600 - Math.Abs(m - h); 

            if (angle < 300)
            {
                Console.WriteLine("alert");
            }
            else if (angle >= 900)
            {
                Console.WriteLine("safe");
            }
            else
            {
                Console.WriteLine("warning");
            }

        }


      //   Console.ReadKey();

    }
}

Measured memory_bytes: 9308
import sqlite3


connection = sqlite3.connect(':memory:')
cursor = connection.cursor()
cursor.execute("""
CREATE TABLE restaurant (
    id INTEGER,
    city TEXT NOT NULL,
    point INTEGER NOT NULL,
    PRIMARY KEY (id)
);
""")

N = int(input())
for i in range(N):
    Si, Pi = input().split()
    cursor.execute("INSERT INTO restaurant (id, city, point) VALUES ({}, '{}', {});".format(
        i + 1, Si, Pi
    ))

for row in cursor.execute("SELECT id FROM restaurant ORDER BY city ASC, point DESC;"):
    print(row[0])


Measured memory_bytes: 5096
#include<cstdio>
#include<cstring>
#define fd(i,a,b)for(int i=b;i>=a;i--)
#define fo(i,a,b)for(int i=a;i<=b;i++)
#define min(a,b)(a<b?a:b)
#define ll long long
using namespace std;
const int N=1e5+5,mo=1e9+7;
ll a[4][4],gg,cc[N],ans;
char c;
int main(){
	a[0][0]=1;
	for(;(c=getchar())<='C'&&c>='A'||c=='?';){
		if(c<='C'&&c>='A'){
			c=c-'A'+1;
			fo(i,0,3)(a[i][c]+=a[i][c-1])%=mo;
		}else{
			fd(i,1,3)fd(j,1,3)(a[i][j]+=a[i-1][j-1])%=mo;
			gg++;
		}
	}
	cc[0]=1;
	fo(i,1,gg)cc[i]=cc[i-1]*3%mo;
	fo(i,0,min(gg,3))ans=(ans+a[i][3]*cc[gg-i])%mo;
	printf("%lld",ans);
}

Measured memory_bytes: 896
#include<stdio.h>

int main(){

	int data[101], number[101], input, i, j, stock;

	for(i = 0; i <= 100; i++){
		data[i] = 0;
	}

	for(i = 0; i <= 100; i++){
		number[i] = i;
	}

	while(scanf("%d",&input) != EOF){
		for(i = 1; i <= 100; i++){
			if(input == i){
				data[i] += 1;
			}
		}
	}

	for(i = 1; i <= 99; i++){
		for(j = i; j <= 100; j++){
			if(data[i] < data[j]){
				stock = data[i];
				data[i] = data[j];
				data[j] = stock;
				stock = number[i];
				number[i] = number[j];
				number[j] = stock;
			}
		}
	}


	for(i = 1; i <= 1005; i++){
		if(data[i] == data[1]){
			printf("%d\n",number[i]);
		}else{
			break;
		}
	}
	return 0;


}

Measured memory_bytes: 0
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
  ll n;
  cin>>n;
  string ss;
  cin>>ss;
  string ans;
  rep(i,0,ss.sz){
    ll p = 0;
    rep(j,0,s.sz){
      if(ss[i]==s[j]){
        p = j;
        break;
      }
    }
    ans += s[p+n];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	// 整数の入力
	int n = sc.nextInt();
	int h = sc.nextInt();
	int w = sc.nextInt();

	int ans = 0;

	int a;
	int b;
	for ( int i = 1; i <= n; i++ ){
	    a = sc.nextInt();
	    b = sc.nextInt();
	    if(a >= h && b >= w){
		ans++;
	    }
	}

	System.out.println(ans);
    }
}




Measured memory_bytes: 24788
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    s = S()
    c = s.count("0")
    print(2*min(c,len(s)-c))
    return

#B
def B():
    n = I()
    h = LI()
    ans = 0
    m = min(h)
    while m:
        ans += m
        k = max(h)
        for i in range(n):
            if h[i] >= m:
                h[i] -= m
                if h[i]:k = min(k,h[i])
            else:break
        m = k
    print(ans)
    return

#C
def C():
    n,k = LI()
    x = LI()
    ans = float("inf")
    j = bisect.bisect_left(x,0)
    if n == 1:
        print(abs(x[0]))
        quit()
    if j < n:
        if x[j] == 0:
            k -= 1
            x.pop(j)
            n -= 1
    for i in range(n):
        if i < j:
            if abs(i-j) > k:continue
            elif abs(i-j) == k:ans = min(ans,abs(x[i]))
            elif k+i-1 < n:
                ans = min(ans,abs(x[i])+x[k+i-1]-x[i])
        else:
            if abs(i-j)+1 > k:continue
            elif abs(i-j)+1 == k:ans = min(ans,x[i])
            elif i-k+1 >= 0:
                ans = min(ans,abs(x[i])+x[i]-x[i-k+1])

    print(ans)
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#I
def I_():
    return

#J
def J():
    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 59120
S = list(input())
num_first = 0
num_last = 0
for i in range(len(S)):
    if S[i] == 'A':
        num_first = i
        break
for j in range(len(S)):
    if S[j] == 'Z':
        num_last = j
print(num_last - num_first + 1)

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

int main()
{
    string S;
    cin >> S;
    int N = S.length();
    if (N == 1)
    {
        cout << 0 << endl;
        return 0;
    }

    int res = 0;
    for (int i = 1; i < N; ++i)
    {
        if (S[i] == S[i - 1])
        {
            if (S[i] == '0')
            {
                S[i] = '1';
                res++;
            }
            else
            {
                S[i] = '0';
                res++;
            }
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 512
XKD = list(map(int, input().split()))

posi = XKD[0]

count = 0
factor = 0
if (XKD[1] > int(abs(posi) / XKD[2])):
    time = XKD[1] - int(abs(posi) / XKD[2])
    factor = int(abs(posi) / XKD[2])
else:
    time = 0
    factor = XKD[1]

if (posi >= 0):
    posi -= XKD[2] * factor
else:
    posi += XKD[2] * factor

if (posi >= 0):
    if (time % 2 == 0):
        print(abs(posi))
    else:
        print(abs(posi - XKD[2]))
else:
    if (time % 2 == 0):
        print(abs(posi))
    else:
        print(abs(posi + XKD[2]))


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
// #define int long long
// #define pow mypow

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9+5;
const int MOD = 1e9+7;

map<string, int> cnt;
int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	int n; cin >> n;
	int mx = 0;
	for(int i=0; i<n; i++){
		string s; cin >> s;
		cnt[s]++;
		mx = max(mx, cnt[s]);
	}

	for(auto x:cnt)
		if (x.nd == mx) cout << x.st << endl;
	
	return 0;
}


Measured memory_bytes: 23808
using System;
class Program
{
	static void Main(string[] args)
	{
		// 整数の入力
		char[] a = Console.ReadLine().ToCharArray();
        string outp = "Yes";
        if(a[2] != a[3]) outp = "No";
        if(a[4] != a[5]) outp = "No";

		//出力
		Console.WriteLine(outp);
	}
}

Measured memory_bytes: 11092
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		int N = sc.nextInt();

		List<Integer> A = new ArrayList<>();
		for (int i = 0; i < N; i++)
			A.add(sc.nextInt());

		List<Integer> B = new ArrayList<>();
		for (int i = 0; i < N; i++)
			B.add(A.get(i));
		Collections.sort(B);

		int max = 0;

		for (int i = 0; i < N; i++) {
			if (A.get(i) != B.get(N - 1))
				max = B.get(N - 1);
			else
				max = B.get(N - 2);
			System.out.println(max);
		}

	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 60140
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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;}

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(s);
  SORT(s);
  int memo = 1;
  bool flg = true;
  REP(i,s.size()-1){
    if(s[i]==s[i+1]) memo++;
    else {
      if(!(memo % 2 == 0)) {
        flg = false;
        break;
      }
      memo = 1;
    }
  }
  if(!(memo % 2 == 0)) {
    flg = false;
  }
  Yes(flg);
}

Measured memory_bytes: 256
#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(a) (a).begin(), (a).end()

int N;

int main() {
  cin >> N;
  vector<int> P(N);
  rep(i, N) cin >> P[i];

  int m = 1e9;
  int ans = 0;
  rep(i, N) {
    if (P[i] <= m) ++ans;
    m = min(m, P[i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool neg=c=='-';
	neg?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return neg?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
template<class T>inline void mset(T a,int v,int n){memset(a,v,n*sizeof(a[0]));}
const int N=200010;
int a[N],f[N];
bool vis[N];
int main(){
	const int n=ni;
	mset(vis,0,n);
	int mx=0;
	for(int i=1;i<=n;i++){
		const int a=ni;
		vis[a]=true;
		f[a]=vis[a-1]?f[a-1]+1:1;
		apmax(mx,f[a]);
	}
	printf("%d\n",n-mx);
	return 0;
}


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

int main () {
  int d, g, p[11], c[11];
  cin >> d >> g;
  rep(i,d) cin >> p[i] >> c[i];

  int ans = 1e9;
  rep(mask,1<<d) {
    int s = 0, num = 0, rest_max = -1;
    rep(i,d) {
      if (mask & 1 << i) {
        s += 100 * (i+1) * p[i] + c[i];
        num += p[i];
      }
      else rest_max = i;
    }
    
    if (s < g) {
      int s1 = 100 * (rest_max + 1);
      int need = (g - s + s1 - 1) / s1;
      if (need >= p[rest_max]) continue;
      num += need;
    }
    
    ans = min(ans, num);
  }
  
  cout << ans << endl;
}

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

const int mx = 1234567;
const double exp1 = 1e-6;
const int md = 1e9+7;
typedef long long ll;

int ar[mx],xar[mx],uses[mx];
ll arr[mx];
string st[1000];

int main(){

    int tk=1,n,m=0;
//    freopen("in.txt","r", stdin);
//    freopen("out.txt","w", stdout);

    while(scanf("%d%d",&n,&m)==2){
        int d =  200000;
        for(int i = 0; i < n; i++){
            scanf("%d",ar + i);
            d = min(d,ar[i]);
        }
//        int ind  = 0;
//        for(int i = 0; i < n; i++){
//            if(ar[i] == d) ind = i;
//        }
//        int cnt = 0,r=0;
//        if (ind>0)
//        for(int i = ind; i >= 0; i--){
//            cnt++;
//            if(cnt%m == 0){
//                //cerr<<"x"<<cnt<<endl;
//                i++;
//                r++;
//                cnt = 0;
//                if(i-1==0)i--;
//            }
//        }
//        if(cnt>0)r++;
//        //cerr<<r<<endl;
//        cnt = 0;
//        if(ind+1 < m && r > 0) ind = m-1;
//
//        if(ind<n-1)
//        for(int i = ind; i < n; i++){
//            cnt++;
//            if(cnt%m == 0){
//               // cerr<<"y"<<cnt<<endl;
//                if(i==n-1){
//                    cnt = 0;
//                    r++;
//                    break;
//                }
//                i--;
//                r++;
//                cnt = 0;
//            }
//        }
//        if(cnt>0)r++;
//
//
//        cout<<r<<endl;


        int cnt = 0,r =0;
        for(int i = 0; i < n; i++){
            cnt++;
            if(cnt%m == 0) { r++;if(i==n-1){cnt = 0;break;}i--;cnt=0;}
        }
        if(cnt > 0)r++;
        cout<<r<<endl;

    }
    return 0;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N; cin >> N;
	for (int i = 0; i <= N; i++)
	{
		if(i * 108 / 100 == N) {
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
	return 0;
}


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

int main(){
  int N;
  cin >> N;
  double money = 0;
  for(int i =0; i < N; i++){
    double tmp_d;
    string tmp_s;
    cin >> tmp_d >> tmp_s;
    if(tmp_s == "JPY"){
      money += tmp_d;
    }else{
      money += tmp_d * 380000.0;
    }
  }
  
  cout << money <<endl;
}

Measured memory_bytes: 256
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 5e3+5;

int k;
int gd[N][N];

int gcd(int a , int b){
    if(b == 0)
        return a;
    return gcd(b , a%b);
}

int main(){
    scanf("%d" , &k);
    for(int i = 1; i <= k; i++){
        for(int j = 1; j <= k; j++){
            gd[i][j] = gcd(i , j);
        }
    }
    ll ans = 0;
    for(int i = 1; i <= k; i++)
        for(int j = 1; j <= k; j++)
            for(int x = 1; x <= k; x++)
                ans += gd[gd[i][j]][x];
    printf("%lld\n" , ans);
}


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

int main() {
    using namespace std;
    unsigned long N, N_{2};
    scanf("%lu", &N);
    {
        while(N_ <= N)N_ <<= 1;
    }
    vector<unsigned long> perm(N), indx(N);
    {
        vector<pair<long, long>> p(N), q(N);
        for(auto& i : p)scanf("%lu%lu", &i.first, &i.second);
        sort(p.begin(), p.end());
        for(unsigned long i = 0; i < N; ++i)p[i] = {p[i].second, i};
        sort(p.begin(), p.end());
        transform(p.cbegin(), p.cend(), perm.begin(), [](auto i){return i.second;});
        transform(perm.cbegin(), perm.cend(), indx.begin(), [&N_](auto i){return i + N_ >> __builtin_ffsl(i + 1);});
    }

    constexpr unsigned long MOD = 998244353;
    vector<unsigned long> binary(N + 1);
    unsigned long n = binary[0] = 1;
    generate(binary.begin() + 1, binary.end(), [&n](){if(n >= MOD)n -= MOD;return n <<= 1;});

    vector<unsigned long> fenwick_tree(N_);
    auto que = [&fenwick_tree](unsigned long i){
        unsigned long s{fenwick_tree[i]}, j{0};
        while(i){
            if(j)s += fenwick_tree[i];
            else++fenwick_tree[i];
            j = i & 1;
            i >>= 1;
        }
        return s;
    };

    vector<unsigned long> coef(N + 1);
    coef[N] = N + MOD - 4;
    for(unsigned long i = 0; i != N; ++i){
        auto p = perm[i], q = que(indx[i]);
        ++coef[q];
        ++coef[i - q];
        ++coef[p - q];
        ++coef[N - i - p + q - 1];
    }

    cout << inner_product(binary.begin(), binary.end(), coef.begin(), 4 + MOD - N) % MOD << endl;
    return 0;
}

Measured memory_bytes: 9600
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<string>

using namespace std;
#define ll long long

bool check(string s1,string s2){
    int l = 0, r = 0;
    bool flag = false;
    int cnt = 0;
    while(l < s1.size() || r < s2.size()){
        if(s1.size() == l || s2.size() == r)return false;
        if(s1[l] != s2[r])return false;
        if(s1[l] == '"'){
            l++;
            string ss;
            while(s1[l]!='"'){
                ss += s1[l];
                l++;
            }
            l++;
            r++;
            string ss2;
            while(s2[r]!='"'){
                ss2 += s2[r];
                r++;
            }
            r++;
            if(ss != ss2)cnt++;
        }else{
            l++;
            r++;
        }
    }
    return (l == s1.size() && r == s2.size() && cnt <= 1);
}
 
int main(){
    while(1){
        string s1,s2;
        cin >> s1;
        if(s1==".")break;
        cin >> s2;
        if(s1 == s2){
            cout <<"IDENTICAL" << endl;
        }else{
            if(check(s1,s2)){
                cout << "CLOSE" << endl;
            }else{
                cout << "DIFFERENT" << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h> 
using namespace std;
int b,l;
string s;
int main(){
    cin>>s;
    l=s.length();
    for(register int i=0;i<l;++i){
        if(s[i]=='S'){
            b=0;
            for(register int i=0;i<l;++i)if(s[i]=='N'){
                b=1;
                break;
            }
            if(!b){
                puts("No");
                return 0;
            }
        }if(s[i]=='N'){
            b=0;
            for(register int i=0;i<l;i++)if(s[i]=='S'){
                b=1;
                break;
            }if(!b){
                puts("No");
                return 0;
            }
        }if(s[i]=='E'){
            b=0;
            for(register int i=0;i<l;i++)if(s[i]=='W'){
                b=1;
                break;
            }
            if(!b){
                puts("No");
                return 0;
            }
        }if(s[i]=='W'){
            b=0;
            for(register int i=0;i<l;i++)if(s[i]=='E'){
                b=1;
                break;
            }if(!b){
                puts("No");
                return 0;
            }
        }
    }
    puts("Yes");
    return 0;
}

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

int main() {
  	int N, M;
  	cin >> N >> M;
  	int A[N];
  	for (int i = 0; i < N; i++) cin >> A[i];
  	int count = 0;
  	for (int i = 0; i < N; i++) count += A[i];
  	int res = 0;
  	
  	int percent = count / (4 * M);
  	if (count % (4 * M) != 0) percent++;
  	
  	for (int i = 0; i < N; i++){
      	if (A[i] >= percent) res++;
    }
  
  	if (res >= M) cout << "Yes" << endl;
  	else cout << "No" << endl;
}

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

typedef long long ll;

int main() {
    int N, K;
    string S;
    cin >> N >> S >> K;
    rep(i, N) {
        if (S[i] != S[K - 1]) cout << "*";
        else cout << S[i];
    }
    cout << "\n";
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n / 2);
  x *= x;
  if (n % 2 == 1) x *= 2;
  return x;
}

mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i, a) {
    x *= n - i;
    y *= i + 1;
  }
  return x / y;
}

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  mint ans = f(n);
  ans -= 1;
  ans -= choose(n, a);
  ans -= choose(n, b);

  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    int sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }

    int cnt = 0;
    rep(i, n){
        if (a[i]*4*m >= sum) {
            cnt++;
        }
    }

    if (cnt >= m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
//#include "h.h"
using namespace std;

#define MOD 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	int N;
	string S;
	cin >> N >> S;
	int cnt = 0;
	for(int i = 0; i < N; i ++){
		if(S[i] == 'R')cnt++;
	}
	if(cnt > N - cnt)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
def time(sec):
    h = sec // 3600
    ti = sec % 3600
    m = ti // 60
    s = ti % 60
    return [h,m,s]

while True:
    t,h,s = map(int,input().split())
    if t == h == s == -1:
        break
    sec = t*3600 + h * 60 + s
    sec = 7200 - sec
    ans = time(sec)
    t_ans = time(3 * sec)
    if ans[2] < 10:
        ans[2] = "0" + str(ans[2])
    if ans[1] < 10:
        ans[1] = "0" + str(ans[1])
    print("0"+ str(ans[0])+ ":" + str(ans[1]) + ":" +str(ans[2]))
    if t_ans[2] < 10:
        t_ans[2] = "0" + str(t_ans[2])
    if t_ans[1] < 10:
        t_ans[1] = "0" + str(t_ans[1])

    print("0"+ str(t_ans[0])+ ":" + str(t_ans[1]) + ":" +str(t_ans[2]))

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


void solve(std::vector<long long> A){
    if(accumulate(A.begin(), A.end(), 0) >= 22)
        cout << "bust"  <<endl;
    else
        cout << "win" << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::vector<long long> A(3);
    for(int i = 0 ; i < 3 ; i++){
        scanf("%lld",&A[i]);
    }
    solve(std::move(A));
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>

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

using namespace std;

int main(void){
  int n;
  cin >> n;
  vector<int> min(n);
  vector<int> max(n);
  rep(i,n){
    cin >> min[i] >> max[i];
  }

  sort(min.begin(),min.end());
  sort(max.begin(),max.end());

  if(n%2 == 1){
    cout << max[n/2]-min[n/2]+1 << endl;
  }
  else{
    cout << max[n/2]-min[n/2-1] + max[n/2-1]-min[n/2] + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 4748
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define endl '\n'
int mod=1e9+7;
int mod2=998244353;

signed main(){
  int n;
  cin>>n;
  vector<int> a(n+2,0);
  for(int i=0;i<n;i++)cin>>a[i];
  vector<int> dp(n+2,1e9);
  dp[0]=0;
  for(int i=0;i<n;i++){
    dp[i+1]=min(dp[i+1],dp[i]+abs(a[i]-a[i+1]));
    dp[i+2]=min(dp[i+2],dp[i]+abs(a[i]-a[i+2]));
  }
  cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <array>
using namespace std;
const char* solve() {
    string S, T;
    cin >> S >> T;
    array<char, 26> R1 {}, R2 {};
    for (int i = 0; i < S.size(); i++) {
        char s = S[i], t = T[i];
        if (R1[s - 'a'] > 0) {
            if (R1[s - 'a'] != t) return "No";
        }
        else R1[s - 'a'] = t;
        if (R2[t - 'a'] > 0) {
            if (R2[t - 'a'] != s) return "No";
        }
        else R2[t - 'a'] = s;
    }
    return "Yes";
}
int main() {
    cout << solve() << endl;
}


Measured memory_bytes: 776
import java.util.Scanner;

//AtCoder Beginner Contest 158
//C - Tax Increase
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());
		sc.close();

		int ans = -1;
		for (int i = 0; i < 2000; i++) {
			if ((int)(i * 0.08) == A && ((int)(i * 0.1) == B)) {
				ans = i;
				break;
			}
		}
		System.out.print(ans);
	}
}


Measured memory_bytes: 23380
using System;

class Plogram
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int ans = 999;

         for(int i = 9; i>0; i--)
         {
                if(N <= (i*100+i*10+i))
                {
                    ans = i * 100 + i * 10 + i;
                }
         }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9+7);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

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

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    a %= mod;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}

vector<ll> FactorialInv, Factorial;

void init_combination(ll MAX){
    Factorial.resize(MAX + 1);
    FactorialInv.resize(MAX + 1);
    Factorial[0] = 1;
    for(int i = 1; i <= MAX; i++){
        Factorial[i] = Factorial[i - 1] * i % mod;
    }
    FactorialInv[MAX] = power(Factorial[MAX], mod - 2);
    for(ll i = MAX - 1; i >= 0; i--) {
        FactorialInv[i] = FactorialInv[i+1] * (i+1) % mod;
    }
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    if(b < 0) return 0;
    ll ans = Factorial[a] * FactorialInv[b] % mod;
    ans = ans * FactorialInv[a - b] % mod;
    return ans;
}

//modの値の確認をすること
int main(){
    ll x,y;
    init_combination(1e6 * 2);
    cin >> x >> y;
    if((x + y) % 3 != 0){
        pf(0);
        return 0;
    }
    ll a = (x + y) / 3;
    x -= a;
    y -= a;
    if(x < 0 || y < 0){
        pf(0);
        return 0;
    }
    pf(combination(x + y, x));
    return 0;
}


Measured memory_bytes: 31488
#include <bits/stdc++.h>
#define N 100005
#define ll long long
using namespace std;
int sm = 0;

int main(){
	int a,ar[101],b;
	cin>>a;
	for(int i=0;i<a;i++){
		cin>>ar[i];
	}
	for(int i=1;i<a;i++){
		ar[i] = ar[i] + ar[i-1];
	}
	b = 20000;
	for(int i=0;i<a-1;i++){
		b = min(b,abs(ar[a-1] - 2*ar[i]));
	}
	cout<<b;
return 0;
}




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

#define ll long long
#define ull unsigned long long
#define N 100005
#define mod 998244353 
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define mii unordered_map<int,int>
#define mll unordered_map<ll,ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pp pop_back
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define all(c) c.begin(),c.end()
#define tr(it,c) for(it = c.begin() ; it!=c.end() ; it++)
int inf = INT_MAX ;
ll modulo(ll num,ll MOD=mod){ return ((num%MOD)+MOD)%MOD;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),MOD-2,MOD); }
ll gcd(ll a,ll b){ return ((b==0) ? a:gcd(b,a%b));}

int main(){
	boost;

	int n;
	cin>>n;
	string str;
	cin>>str;
	int m  = 0;

	int arr[n+1][n+1];
	memset(arr,0,sizeof(arr));
	for(int i=n;i>=0;i--){
		for(int j = n;j>=i;j--){
			if(j==n){
				arr[i][j] = 0;
			}else if(i==j){
				arr[i][j] = 0;
			}else{
				if(str[i]==str[j]){
					arr[i][j] = 1;
					arr[i][j] += min(arr[i+1][j+1],max(j-arr[i][j]-i,0));
				}else{
					arr[i][j] = 0;
				}
			}

			if(arr[i][j]>m){
				m = arr[i][j];
			}
		}
	}

	cout<<m;

	return 0;
}

Measured memory_bytes: 97920
#include <bits/stdc++.h>
#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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int N; cin >> N;
    map<ll,ll> mp;
    vecl A(N);
    ll sum = 0;
    REP(i,N) {
        cin >> A[i];
        if(mp.count(A[i])) mp[A[i]]++;
        else mp[A[i]] = 1;
        sum += A[i];
    }
    int Q; cin >> Q;
    vecl B(Q),C(Q);
    REP(i,Q) cin >> B[i] >> C[i];
    REP(i,Q) {
        if(mp.count(B[i])) {
            sum -= B[i]*mp[B[i]];
            sum += C[i]*mp[B[i]];
            if(mp.count(C[i])) mp[C[i]] += mp[B[i]];
            else mp[C[i]] = mp[B[i]];
            mp[B[i]] = 0;
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 10408
import cmath
import math


if __name__ == '__main__':
    a, b, h, m = map(int, input().split())
    zh = cmath.rect(a, math.radians((60 * h + m) / 2))
    zm = cmath.rect(b, math.radians(m * 6))
    print(abs(zh - zm))


Measured memory_bytes: 9380
import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main //implements Runnable
{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        n--;
    
        
        out.println((long)n*(n+1)/2);
     	out.flush();
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x, y;
//	P(int  x, int y) {
//	  this.x=x;
//	  this.y=y;
//	}
//}

//class P implements Comparable<P>{
//    int a,b;
//    P(int a, int b) {
//    	this.b=b;
//    	this.a=a;
//    }
//
//    public int compareTo(P p){
//    	if(a==p.a) return b-p.b;
//        return -p.a+a;
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 20308
def resolve():
    N = int(input())
    A = list(map(int,input().split()))
    
    A.sort()
    x =1
    for i in A:
        x *= i
        if x==0:
            print(0)
            return
        if x > 10**18:
            print(-1)
            return
    print(x)
resolve()


Measured memory_bytes: 84780
#include<stdio.h>

int main()
{
  long long x,k,d;
  long long ans,i,j,s,t;
  scanf("%lld%lld%lld",&x,&k,&d);
  if(x<0) x*=(-1);
  i=x/d;
  if(k>=i){
    j=x-i*d;
    s=k-i;
    if(s%2==0){
      ans=j;
    }
    else{
      ans=d-j;
    }
  }
  else if(k<i){
    j=x-k*d;
    ans=j;
  }
  printf("%lld",ans);
  return 0;
}


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

int kakuketanowa(int n){
    int sum=0;
    while(n>0){
        sum += n%10;
        n = n/10;
    }
    return sum;
}

int main(){
    int n,a;
    cin >> n ;
    a=kakuketanowa(n);
    if(n%a==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
N = gets.strip.to_i
nums = gets.strip.split(' ').map(&:to_i)

three=[]
N.times do |i|
  N.times do |j|
    N.times do |k|
      three.push([nums[i],nums[j],nums[k]].sort) if i<j && j<k && nums[i] != nums[j] && nums[j]!=nums[k] && nums[k] != nums[i]
    end
  end
end


count = 0
three.each do |t|
  count+=1 if t[0]+t[1]>t[2]
end

puts count

Measured memory_bytes: 25076