akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define EPS (1e-10)
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
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;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>a(n); rep(i, n)cin >> a[i];
	int sum = 0;
	rep(i, n) {
		sum ^= a[i];
	}
	if ((sum^sum) == sum) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_ARRAY_MAX		200000									// 最大配列数

// 内部変数
static FILE *szpFpI;											// 入力
static int si1Array[D_ARRAY_MAX];								// 配列
static int siACnt;												// 配列数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// 出力
int
fOut(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 配列数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siACnt);

	// 配列・最大値 - 取得
	int liMax = INT_MIN;
	int liMax2 = INT_MIN;
	for (i = 0; i < siACnt; i++) {
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
		sscanf(lc1Buf, "%d", &si1Array[i]);

		// 最大値 - 更新
		if (liMax < si1Array[i]) {
			liMax2 = liMax;
			liMax = si1Array[i];
		}
		else if (liMax2 < si1Array[i]) {
			liMax2 = si1Array[i];
		}
	}

	// 出力
	for (i = 0; i < siACnt; i++) {
		if (liMax == si1Array[i]) {
			sprintf(lc1Buf, "%d\n", liMax2);
		}
		else {
			sprintf(lc1Buf, "%d\n", liMax);
		}
		fOut(lc1Buf);
	}

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 2304
//============================================================================
//Everyone has a different way of thinking, so God Created us
//   Hope You Respect My Way..,Thank You ):
// Author      : Murad
// Name        : Codeforces.cpp & Atcoder.cpp
// Description : Problem name
//============================================================================
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define ULL unsigned long long
#define MP make_pair
#define SZ(c) int(c.size())
#define ff first
#define ss second
#define INF 1e9 + 1
#define _INF INT32_MIN
#define PQ priority_queue
#define MM multimap
#define PB push_back
#define vii vector<int>
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define MAXN 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
char alphz[27] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
float Euclidean(LL x1, LL x2, LL y1, LL y2) {
	return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
LL gcd(LL a,LL b) {
	LL c;
	while (a != 0) {
		c = a;
		a = b % a;
		b = c;
	}
	return b;
}
int LCM(int a, int b) {
	return (a*b) / gcd(a, b);
}
void PrimeFactor(LL n)
{
	while (n % 2 == 0) {
		printf("%d ", 2);
		n /= 2;
	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		if (n%i == 0) {
			printf("%d ", i);
			n /= i;
		}
	}
	if (n > 2)printf("%d ", n);
}
bool is_square(LL x) {
	LL l = 0, r = x;
	while (l <= r) {
		LL mid = l + (r - l) / 2;
		if (mid*mid == x)return true;
		if (mid*mid > x)r = mid - 1;
		else l = mid + 1;
	}
	return false;
}
bool is_Prime(int x) {
	if (x == 2)return 1;
	else if (x % 2 == 0 || x < 2)return 0;
	for (int i = 3; i*i <= x; i += 2)
		if (x%i == 0)return 0;
	return 1;
}
int main()
{
	El3zba;
	/***  بسم الله الرحمن الرحيم   ***/
	LL n, m;
	cin >> m >> n;
	vector<LL> vs(n);
	for (int i = 0; i<n; ++i) cin >> vs[i];
	sort(vs.begin(),vs.end());
	multiset<LL> diff;
	for (int i = 1; i<n; ++i) diff.insert(vs[i] - vs[i - 1]);
	m -= 1LL;
	while (m-- && !diff.empty())
		diff.erase(prev(diff.end()));
	LL ans = 0;
	for (auto&x : diff) ans += x;
	cout << ans << endl;
	return 0;
}

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

int main(){
  int num,n,i,j,k,flag=0,count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&num);
    if(num!=2&&num%2==0) continue;
    if(num==3){
      count++;
      continue;
    }
    flag=0;
    for(j=3;j<=sqrt(num);j+=2){
      if(num%j==0){
	flag=1;
	break;
      }
    }
    if(flag==0){
      count++;
    }
  }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2068
#ABC 141
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]
score = [0 for i in range(N)]

for a in A:
	score[a-1] += 1


# 勝ち抜けチェック 
for i in range(N):
	if K-Q+score[i] > 0:
		print("Yes")
	else:
		print("No")

Measured memory_bytes: 8644
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[] w = new int[n];
		int total = 0;
		int zenhan = 0;
		int kouhan = 0;
		int sabun;

		for (int i = 0; i < n; i++) {
			w[i] = sc.nextInt();
			total += w[i];
		}
		sabun = Math.abs(total - w[0] * 2);

		for (int i = 0; i < n; i++) {
			zenhan += w[i];
			kouhan = total - zenhan;

			if (Math.abs(zenhan - kouhan) <= sabun) {
				sabun = Math.abs(zenhan - kouhan);
			} else {
				break;
			}
		}
		System.out.println(sabun);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;

int main() {
	string s;
	cin >> s;
	int count = 0;
	bool flg = false;

	if (s[0] == 'A' && s[1] >= 'a') {

		FOR(i, 2, s.size() - 1) {
			if (s[i] == 'C') {
				++count;
				if (count == 2) { break; }
			}else if (s[i] < 'a') {
				break;
			}
		}
		FOR(i, s.size() - 1, s.size()) {
			if (s[i] < 'a') {
				count = 10;
				break;
			}
		}
		flg = (count == 1) ? true : false;
	}
	cout << ((flg) ? "AC" : "WA") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int D, G;
  cin >> D >> G;
  vector<int> p(D);
  vector<int> c(D);
  for(int i=0; i<D; i++){
    cin >> p.at(i) >> c.at(i);
  }
  long long ans = 1 << 29;
  for(int bit=0; bit<(1<<D); bit++){
    long long sum = 0;
    long long num = 0;
    //piを完答したとき
    for(int i=0; i<D; i++){
      if(bit & (1<<i)){
        sum += c.at(i) + p.at(i)*100*(i+1);
        num += p.at(i);
      }
    }
    if(sum >= G) ans = min(ans, num);
    else{
      for(int i=D-1; i>=0; i--){
        if(bit & (1<<i)) continue;
        for(int j=0; j<p.at(i); j++){
          if(sum >= G) break;
          sum += 100*(i+1);
          num++;
        }
      }
      ans = min(ans, num);
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INFTY 10000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const int MOD=1000000007;
const int di[4] = {-1,0,1,0};
const int dj[4] = {0,-1,0,1};
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
int main(){
    int n;cin>>n;
    ll ans = 0;
    rep(i,n){
        int a;cin>>a;
        ans += a-1;
    }

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

Measured memory_bytes: 256
import Data.Char (isDigit)

nondigit2space :: String -> String
nondigit2space s = map nondigit2space' s
    where
        nondigit2space' c
            | isDigit c = c
            | otherwise = ' '

main :: IO ()
main = putStrLn . show . sum . map read . words . nondigit2space =<< getContents

Measured memory_bytes: 3932
#include <stdio.h>
#include <stdlib.h>

int com(const void *a,const void *b){
	return *(int*)a - *(int*)b;
}

int main(){
	int N,T;
	int i,ans=0;
	
	scanf("%d %d",&N,&T);
	
	int ci[N],ti[N];
	int memT[N],memC[N];
	
	for(i=0;i<N;i++){
		scanf("%d %d",&ci[i],&ti[i]);
		
		if(ti[i]<=T)	memT[i]=1;
		else	memT[i]=0;
	}
	
	for(i=0;i<N;i++){
		if(memT[i]==1)	memC[i]=ci[i];
		else	memC[i]=0;
	}
	
	qsort(memC,N,sizeof(int),com);
	
	for(i=0;i<N;i++){
		if(memC[i]!=0){
			ans=memC[i];
			i=N;
		}
	}
	
	if(ans!=0)	printf("%d",ans);
	else	printf("TLE");
	
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.close();

        int count = 0;
        for (int i = 1; i <= n; i++) {
            int digit = String.valueOf(i).length();
            if (digit % 2 == 1) {
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 30548
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */

using namespace std;

/* ---------- Type Abbreviation ---------- */

template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;

using ll = long long;

#define fst first
#define snd second
#define mp make_pair
#define mt make_tuple

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)


/* ---------- conversion ---------- */

#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)
#define DOUBLE(n) static_cast<double>(n)

/* ---------- container ---------- */

#define ALL(v) (v).begin(), (v).end()
#define SIZE(v) (LL((v).size()))

#define FIND(v, k) (v).find(k) != (v).end()
#define VFIND(v, k) find(ALL(v), k) != (v).end()

#define gsort(b, e) sort(b, e, greater<decltype(*b)>())

/* ----------- debug ---------- */

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
	os << "[";
	for (auto vv : v)
		os << vv << ",";
	return os << "]";
}

template <class T>
ostream& operator<<(ostream& os, set<T> v) {
	os << "[";
	for (auto vv : v)
		os << vv << ",";
	return os << "]";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
	return os << "(" << p.fst << "," << p.snd << ")";
}

/* ---------- Constants ---------- */

// const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */

template <typename T>
T sq(T a) {
	return a * a;
}

template <typename T>
T gcd(T a, T b) {
	if (a > b) return gcd(b, a);
	return a == 0 ? b : gcd(b % a, a);
}

template <typename T, typename U>
T mypow(T b, U n) {
	if (n == 0) return 1;
	if (n == 1) return b /* % MOD */;
	if (n % 2 == 0) {
		return mypow(b * b /* % MOD */, n / 2);
	}
	else {
		return mypow(b, n - 1) * b /* % MOD */;
	}
}

ll pcnt(ll b) {
	return __builtin_popcountll(b);
}



// const ll dx[4] = {0, -1, 1, 0};
// const ll dy[4] = {-1, 0, 0, 1};
// const ll dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const ll dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */



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

	cin >> N >> M;
	cout << (N * 100 + M * 1800)*mypow(2, M);
	return 0;
}

Measured memory_bytes: 256
num_month, day_per_month = map(int, input().split(' '))

ans = 0
for month in range(4, num_month+1):
    ans += len([day for day in range(22, day_per_month+1)
                if day // 10 >= 2 and day % 10 >= 2 and (day // 10) * (day % 10) == month])

print(ans)
exit(0)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[3005][3005];
int pre[3005];
int main() {
    const ll mod=998244353;ll ans=0;
    int n,s;cin>>n>>s;
    for(int i=1;i<=n;i++) cin>>pre[i];
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        dp[i][0]=i+1;
        for(int j=1;j<=s;j++){
            dp[i][j]=(dp[i-1][j]+(j>=pre[i]?dp[i-1][j-pre[i]]:0))%mod;
        }
        if(pre[i]<=s)
            ans=(ans+dp[i-1][s-pre[i]]*(n-i+1)%mod)%mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 70656
#include<cstdio>
using namespace std;
int a,b;
int main(){
    scanf("%d%d",&a,&b);
    if(a>0)puts("Positive");               //情况1
    else if(b>=0)puts("Zero");             //情况2
    else if((a&1)^(b&1))puts("Positive");  //情况3
    else puts("Negative");
    return 0;
}

Measured memory_bytes: 384
def bubbleSort(cards):
    n = len(cards)
    for i in range(n):
        for j in range(n-1, i, -1):
            if cards[j][1] < cards[j-1][1]:
                cards[j], cards[j-1] = cards[j-1], cards[j]
    
    return cards


def selectionSort(cards):
    n = len(cards)
    for i in range(n):
        minj = i
        for j in range(i, n):
            if cards[j][1] < cards[minj][1]:
                minj = j
        cards[i], cards[minj] = cards[minj], cards[i]
    
    return cards


def isStableSort(initialArray, resultArray):
    n = len(initialArray)
    for i in range(n):
        for j in range(i+1, n):
            for a in range(n):
                for b in range(a+1, n):
                    if initialArray[i][1] == initialArray[j][1]:
                        if initialArray[i] == resultArray[b]:
                            if initialArray[j] == resultArray[a]:
                                return False
    
    return True


n = int(input())
array = [x for x in input().split()]
cards = [[a[0], a[1]] for a in array]
cardsForBubble = cards[:]
cardsForSelection = cards[:]

bSort = bubbleSort(cardsForBubble)
sSort = selectionSort(cardsForSelection)

resultForBubble = []
resultForSelection = []

for b in bSort:
    resultForBubble.append(''.join(b))
for s in sSort:
    resultForSelection.append(''.join(s))

print(*resultForBubble)
if isStableSort(array, resultForBubble):
    print("Stable")
else:
    print("Not stable")

print(*resultForSelection)
if isStableSort(array, resultForSelection):
    print("Stable")
else:
    print("Not stable")


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

public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String s = br.readLine();
        String t = br.readLine();
        int count = 0;
        
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) != t.charAt(i)){
                count++;
            }
        }
        
        out.println(count);
        out.close();
        
    }
}

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

const int s[]={0,1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256,289};


int f(int n,int m){
    if(n==0)return 1;
    int ans=1;
    vector<int> t(18,0);
    t[1]=n;
    for (int i = 2; i < m; ++i) {
        if(n<s[i])break;
        while(n-s[i]*t[i]>=s[i]){
            ++t[i];
            ans+=f(n-s[i]*t[i],i);
        }
    }
    return ans;
}

int main(){
    int n;

    while(true){
        cin>>n;
        if(n==0)break;
        int ans=1;
        ans=f(n,18);
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {

    long long int n;
    cin >> n;
    string s;
    cin >> s;

    long long int ans = 1;
    for ( long long int i = 1; i < n; i++ ) {
        if ( s[i] != s[i-1] ) ans++;
    }

    cout << ans << endl;

    return 0;

}


Measured memory_bytes: 512
// atcoder/code-festival-2016-quala/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  str s;
  lli k;
  while (cin >> s >> k) {
    map<char, map<char, int>> m;
    for (int i = 0; i < 26; ++i) {
      for (int j = 0; j < 26; ++j) {
        m['a' + i]['a' + (i + j) % 26] = j;
      }
    }

    for (int i = 0; i < s.size(); ++i) {
      if (m[s[i]]['a'] <= k) {
        k -= m[s[i]]['a'];
        s[i] = 'a';
      }
    }
    s[s.size() - 1] = 'a' + (s[s.size() - 1] - 'a' + (k % 26)) % 26;
    cout << s << endl;
  }

  return 0;
}


Measured memory_bytes: 3756
#include<iostream>
#include<algorithm>
using ull = unsigned long long;

int main() {
	ull a{}, b{};
	std::cin >> a >> b;
	
	ull r{9999};
//	std::pair<ull,ull> mm = std::minmax(a, b); 

	while (r != 0) {

//		std::cout << a << " " << b << " " << r << "\n";
		r = std::max(a,b) % std::min(a,b);
		a = std::min(a,b);
		b = r;
	}

	std::cout << a << "\n";

//	std::cin >> a;
	return 0;
}


Measured memory_bytes: 3088
<?php
$input = trim(fgets(STDIN));
$strs = str_split($input);
$result = array_count_values($strs);//配列$strsの中に同じ値が何個づつあるかを配列$resultに入れる
/*
print_r($result);
    キー   値
    [A] => 2
    [S] => 2
*/
$out = 'No';
if (count($result) == 2) {//    配列の長さが2の時だけ次に行ける
    $c = array_pop($result);//   配列の最後の値を取得して変数$cに入れる
    if ($c == 2) {//     {1,3}じゃなく{3,1}じゃなく{2,2}の時だけ
        $out = 'Yes';
    }
}
print $out;
?>

Measured memory_bytes: 4856
#include<stdio.h>

int main(void){
  int i,j,sum,a,b;
  
  while(1){
    sum=0;
    scanf("%d %d",&a,&b);
    if(a==0 && b==0)break;
    for(i=1;i<=a;i++){
      for(j=1;j<=31;j++){
	sum++;
	if(i==a && j==b)break;
	if(i==2 && j==29)break;
	if(i<=7 && i%2==0 && j==30)break;
	if(i>=8 && i%2==1 && j==30)break;

      }
    }
    switch(sum%7){
    case 1:
      printf("Thursday\n");
      break;
    case 2:
      printf("Friday\n");
      break;
    case 3:
      printf("Saturday\n");
      break;
    case 4:
      printf("Sunday\n");
      break;
    case 5:
      printf("Monday\n");
      break;
    case 6:
      printf("Tuesday\n");
      break;
    case 0:
      printf("Wednesday\n");
      break;
    }
    //printf("%d\n",sum);
  }
  return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#pragma warning(disable : 4996)
int N, ca, cb, sa, sb, la, lb, ret, dpa[100009], dpb[100009], mod = 1000000007; long long A, B, x[100009];
int main() {
	scanf("%d%lld%lld", &N, &A, &B);
	for (int i = 1; i <= N; i++) scanf("%lld", &x[i]);
	dpa[0] = 1; dpb[0] = 1; x[0] = -(1LL << 61);
	for (int i = 1; i < N; i++) {
		while (ca != i && x[ca] + A <= x[i + 1]) {
			sa += (ca >= lb ? dpb[ca] : 0); ca++;
			if (sa >= mod) sa -= mod;
		}
		dpa[i] = sa;
		while (cb != i && x[cb] + B <= x[i + 1]) {
			sb += (cb >= la ? dpa[cb] : 0); cb++;
			if (sb >= mod) sb -= mod;
		}
		dpb[i] = sb;
		if (x[i] + A > x[i + 1]) la = i, sb = 0;
		if (x[i] + B > x[i + 1]) lb = i, sa = 0;
	}
	for (int i = la; i < N; i++) ret = ret + dpa[i] - (ret + dpa[i] < mod ? 0 : mod);
	for (int i = lb; i < N; i++) ret = ret + dpb[i] - (ret + dpb[i] < mod ? 0 : mod);
	printf("%d\n", ret);
	return 0;
}

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

#define crap ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define CN cout<<"No\n"
#define CY cout<<"Yes\n"

using namespace std;
using ll = long long;
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
#define MAXN 1000001 
ll sieve[MAXN]; 
ll h[MAXN] = { 0 }; 
void factors(ll x) 
{ 
    ll temp; 
    while (x != 1) { 
        temp = sieve[x]; 
        if (x % temp == 0) { 
            h[sieve[x]]++; 
            x = x / sieve[x]; 
        } 
        while (x % temp == 0) 
            x = x / temp; 
    } 
} 
bool comp(ll x) 
{ 
    ll temp; 
    while (x != 1) { 
        temp = sieve[x]; 
        if (x % temp == 0 && h[temp] > 1) 
            return false; 
        while (x % temp == 0) 
            x = x / temp; 
    } 
    return true; 
} 
bool pairco(vector<ll> &v, ll n) 
{ 
    for (int i = 0; i < n; i++) 
        factors(v[i]); 
    bool ans=true;
    for (int i = 0; i < n; i++) 
        if (!comp(v[i])) 
            return false; 
    return true; 
} 
void solve()
{
    ll n; cin>>n;
    vector<ll>v(n);
    rep(i,n)
    {
        cin>>v[i];
    }
    sieve[1] = 1; 
    for (int i = 2; i < MAXN; i++) 
        sieve[i] = i; 
    for (int i = 4; i < MAXN; i += 2) 
        sieve[i] = 2; 
    for (int i = 3; i * i < MAXN; i++) { 
        if (sieve[i] == i) { 
            for (int j = i * i; j < MAXN; j += i) 
                if (sieve[j] == j) 
                    sieve[j] = i; 
        } 
    } 
    ll g=v[0];
    rep(i,n) g=gcd(g,v[i]);
    if(g==1)
    {
        if(pairco(v,n)) cout<<"pairwise coprime";
        else cout<<"setwise coprime";
    }
    else cout<<"not coprime";
}
int main()
{
    crap;
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r", stdin) ;
        freopen("output.txt","w", stdout) ;
        freopen("error.txt","w", stderr) ;
    #endif
    int t;t=1;
 //  cin>>t;
    while(t--)
        {solve();}
    return 0;
}

Measured memory_bytes: 26620
N, M = map(int, input().split())
A = [-1*int(i) for i in input().split()]

import heapq

heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A,-1*((-1*a)//2))

print(-1*sum(A))

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

int main() {
    string s;
    cin >> s;
    int result = 700;
    if (s[0] == 'o') result += 100;
    if (s[1] == 'o') result += 100;
    if (s[2] == 'o') result += 100;
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
        
public class Main {

    public static void main(String[] args) {
        
        Scanner scanner = new Scanner(System.in);
        
        int a = Integer.valueOf(scanner.nextLine());
        
        int value;
        
        value = a + (a*a) + (a*a*a);
        
        System.out.println(value);
    }
}

Measured memory_bytes: 35768
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	int X, N; cin >> X >> N;
	vector<int> p_cnt(101);
	vector<int> r_p;
	if (N == 0) {
		cout << X << endl;
		return;
	}
	for (int i = 0; i < N; ++i) {
		int t_num; cin >> t_num;
		p_cnt[t_num]++;
	}
	for (int i = 1; i <= 100; ++i) {
		if (p_cnt[i] == 0) {
			r_p.push_back(i);
		}
	}
	for (int i = 101; i <= 10000; ++i) {
		r_p.push_back(i);
	}
	r_p.push_back(0);
	for (int i = 1; i <= 10000; ++i) {
		r_p.push_back(-i);
	}
	sort(all(r_p));
	int ans = INF;
	int min_dif = INF;
	for (int i = 0; i < r_p.size(); ++i) {
		int diff = 0;
		diff = abs(X - r_p[i]);
		if (diff < min_dif) {
			ans = r_p[i];
			min_dif = diff;
		} else if (diff == min_dif) {
			ans = min(ans, r_p[i]);
		}
	}
	cout << ans << endl;
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <stack>
#include <fstream>
#include <cmath>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

struct edge {
    ll to, cost;
};
typedef pair<ll, ll> P;
vector<vector<edge>> G;
vector<ll> d;

const ll inf = 1LL << 60;

void dijkstra (ll s, ll V) {
    priority_queue<P, vector<P>, greater<P>> que;
    d.assign(V, inf);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        ll v = p.second;
        if (d[v] < p.first) continue;
        for (edge e : G[v]) {
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

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

    ll N, M;
    cin >> N >> M;
    G.assign(N, vector<edge>());
    Rep (i, N-1) {
        G[i+1].push_back(edge{i, 0});
    }
    while (M--) {
        ll L, R, C;
        cin >> L >> R >> C;
        L--; R--;
        G[L].push_back(edge{R, C});
    }

    dijkstra(0, N);

    if (d[N-1] == inf) cout << -1 << "\n";
    else cout << d[N-1] << "\n";
}

Measured memory_bytes: 10112
#include <stdio.h>
#include <stdlib.h>

int main(){
	int N, i, j;
	char S[11];
	scanf("%s", S);
	for(N = 0; S[N] != '\0'; N++){}
	if(S[0] != 'A'){
		printf("WA\n");
		return 0;
	}
	for(i = 1, j = 0; i < N; i++){
		if((int)'A' <= (int)S[i] && (int)S[i] <= (int)'Z'){
			if(S[i] != 'C' || j > 0 || i <= 1 || N - 1 <= i){
				printf("WA\n");
				return 0;
			}
			j++;
		}
	}
	if(j == 1){
		printf("AC\n");
	}
	else{
		printf("WA\n");
	}
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    int t[n], x[n], y[n];
    rep(i, n) cin >> t[i] >> x[i] >> y[i];

    bool ok = true;
    rep(i, n) {
        int dist = 0, dt = 0;
        if (i == 0)
            dist = x[0] + y[0], dt = t[0];
        else {
            dist = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
            dt = t[i] - t[i - 1];
        }

        if (!(dist <= dt && dist % 2 == dt % 2)) ok = false;
    }

    if (ok)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 4644
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int main()
{
  int n;
  cin>>n;
  vector<int> v1(n/2), v2(n/2);
  REP(i,n/2) cin>>v1[i]>>v2[i];
  vector<int> cnt1(100001, n/2), cnt2(100001, n/2);
  REP(i,n/2) {
    --cnt1[v1[i]];
    --cnt2[v2[i]];
  }
  vector<pair<int,int>> vp1, vp2;
  REP(i,100001) {
    vp1.emplace_back(cnt1[i], i);
    vp2.emplace_back(cnt2[i], i);
  }
  sort(ALL(vp1));
  sort(ALL(vp2));
  if (vp1[0].second == vp2[0].second) {
    cout << min(vp1[0].first + vp2[1].first, vp1[1].first + vp2[0].first) << endl;
  } else {
    cout << vp1[0].first + vp2[0].first << endl;
  }
  return 0;
}


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

typedef pair<int, int> ii;
typedef pair<long long, long long> ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<ii> vii;
typedef vector<ll> vll;
const long long INF = (long long)1e18;

int main() {
  int V, E, s, u, v, w, q;
  vector<vii> AdjList;

  scanf("%d", &V);
  E = V - 1;

  AdjList.assign(V, vii()); // assign blank vectors of pair<int, int>s to AdjList
  for (int i = 0; i < E; i++) {
    scanf("%d %d %d", &u, &v, &w);
    u--; v--;
    AdjList[u].push_back(ii(v, w));
    AdjList[v].push_back(ii(u, w));
  }

  scanf("%d %d", &q, &s);
  s--;

  // Dijkstra routine
  vl dist(V, INF); dist[s] = 0;                    // INF = 1B to avoid overflow
  priority_queue< ll, vector<ll>, greater<ll> > pq; pq.push(ll(0, s));
                             // ^to sort the pairs by increasing distance from s
  while (!pq.empty()) {                                             // main loop
    ll front = pq.top(); pq.pop();     // greedy: pick shortest unvisited vertex
    long long d = front.first, u = front.second;
    if (d > dist[u]) continue;   // this check is important, see the explanation
    for (int j = 0; j < (int)AdjList[u].size(); j++) {
      ll v = AdjList[u][j];                       // all outgoing edges from u
      if (dist[u] + v.second < dist[v.first]) {
        dist[v.first] = dist[u] + v.second;                 // relax operation
        pq.push(ll(dist[v.first], v.first));
  } } }  // note: this variant can cause duplicate items in the priority queue

    for(int qq = 0; qq < q; qq++) {
        scanf("%d %d", &u, &v);
        u--; v--;
        printf("%lld\n", dist[u] + dist[v]);
    }

  return 0;
}


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

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

    int ans=0;
    int i=1;
    while(i<=5 and (n % (int)pow(10, i) != n)){
        if(i%2==1) ans+=pow(10, i)-pow(10, i-1);
        // cout << i << ";" << ans << endl;
        i++;
    }
    if(i%2==1) ans+= n-pow(10, i-1)+1;

    cout << ans << endl;
}

Measured memory_bytes: 256
sub f{print"@_
"}$L=0,$|=$R=10,$_.=${f("?",($_.($%=$L+$R>>1))*1e9),<>=~Y?$R:$L=$%while$R-$L>1;L}while$i++<9;f"?",++$_+s/0*$//;f"?",($_.=0)+1while<>=~(/^9*$/?Y:N);f"!",$_

Measured memory_bytes: 852
#include <bits/stdc++.h>
 
using namespace std;
 
 
 
int main()
{
    double a,b;
    int least, step;
    cin>>a>>b;
  if(b==1)
    {
        cout<<0;
        return 0;
    }
    if(a>=b)
    {
        cout<<1;
        return 0;
    }
    step=floor(log(b)/log(a));
    least = (pow(a,step)-1)/(a-1);
    //cout<<step<<" "<<least<<endl;
    for(int i=0; i<=10; i++)
    {
        if(i*(a-1)>=b-pow(a,step))
        {
            cout<<least+i;
            return 0;
        }
    }
 
}

Measured memory_bytes: 640
#include<stdio.h>
int main(void){
    int cnt;
    int N;
    scanf("%d",&N);
    int A[N-1],ans[N];

    for(cnt=0;cnt<N;cnt++){
        ans[cnt]=0;
    }
    
    for(cnt=0;cnt<N-1;cnt++){
        scanf("%d",&A[cnt]);
        
        if(A[cnt]>=1 && A[cnt]<=N)
            ans[A[cnt]-1]++;
        
    }

    for(cnt=0;cnt<N;cnt++){
        printf("%d\n",ans[cnt]);
    }

    return 0;
}

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

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

  long long n,ans=0;
  cin >> n;
  long long a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  long long cnt=0;
  for(int i=n-1;i>0;i--){
    if(a[i]<=a[i-1]) cnt++;
    else cnt=0;
    ans=max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		var A = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
		
		int[] ball = new int[N];
		

		for (int i = N; i >= 1; i--)
		{
			int sum = 0;
			int num = 1;
			while (num * i <= N)
			{
				if (ball[num * i-1] == 1)
				{
					sum++;
				}
				num++;
			}
			if (sum % 2 == A[i-1])
			{
				ball[i-1] = 0;

			}
			else { ball[i-1] = 1; }
		}
		int bsum = 0;
        for(int i = 0; i < N; i++)
		{
			bsum += ball[i];
		}
		if (bsum == 0) { Console.WriteLine(0); }
		else
		{
			Console.WriteLine(bsum);
            for(int i = 0; i < N; i++)
			{
				if (ball[i] == 1)
				{
					Console.Write(i + 1 + " ");
				}
			}
		}

	
		

	}
}




Measured memory_bytes: 30420
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

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


 

Measured memory_bytes: 3620
#include<stdio.h>
int main()
{
    int n,d,x,a[200];
    int i,j,sum=0,k;
    scanf("%d",&n);
    scanf("%d %d",&d,&x);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        for(j=0;;j++)
        {
            k=a[i]*j+1;
            if(k<=d)
                sum++;
            else
                break;

        }
    }
    sum=sum+x;
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
import numpy as np
N, M = [int(a) for a in input().split()]
P = []
Y = []

for _ in range(M):
    p, y =  [int(a) for a in input().split()]
    P.append(p)
    Y.append(y)

index = {}
id = ["" for _ in range(len(P))]

for i in np.argsort(Y):
    index[P[i]] = index.get(P[i], 1)
    id[i] = "{0:06d}".format(P[i])+"{0:06d}".format(index[P[i]])
    index[P[i]] += 1

for i in id:
    print(i)


Measured memory_bytes: 36368
d,g = map(int,input().split())
 
p = []
 
for i in range(d):
    p.append(list(map(int,input().split())))

from itertools import product
from math import ceil
 
ans = 1e09
 
for c in product([0,1],repeat=d):
    score = 0
    num = 0
    ind = 0
    for i in range(d):
        if c[i] == 1:
            score += p[i][0]*100*(i+1) + p[i][1]
            num += p[i][0]
        else:
            ind = max(i,ind)
    
    if g - score <= 0:
        ans = min(ans,num)
    elif g - score <= (p[ind][0]-1)*100*(ind+1):
        num += ceil((g-score)/(100*(ind+1)))
        ans = min(ans,num)
print(ans)
	

Measured memory_bytes: 40560
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/

int main(){
    int n;
    int a, gu = 0, ki = 0;
    cin >> n;
    rep(i, n){
        cin >> a;
        if(a % 2 == 0)gu++;
        else ki++;
    }
    ki = ki % 2;
    
    if(ki == 0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
from collections import deque
N=int(input())

G=[[] for _ in range(N+1)]
edge={}

for i in range(N-1):
    a,b=map(int, input().split())
    G[a].append(b)
    G[b].append(a)
    edge[(a,b)]=i
    edge[(b,a)]=i
que=deque()
que.append(1)
visited=[-1]*(N+1)
visited[1]=0
ans=[0]*(N-1)
while que:
    v=que.pop()
    j=1
    for u in G[v]:
        if visited[u]<0:
            if visited[v]==j:
                j+=1
            visited[u]=j
            ans[edge[(u,v)]]=j
            que.append(u)
            j+=1
print(max(ans))
for a in ans:
    print(a)


Measured memory_bytes: 98208
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

ll dp[41][2];
int main(void) {
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];

    REP(i, 41) REP(j, 2) dp[i][j] = -INF;
    dp[0][0] = 0;
    REP(i, 40) REP(j, 2) {
        if(dp[i][j] == -INF) continue;
        ll lim = j==0 ? !!(m&1LL<<(39-i)) : 1;
        REP(d, lim+1) {
            ll add = 0;
            REP(k, n) {
                ll ta = !!(a[k]&1LL<<(39-i)); 
                if(d^ta) add += 1LL<<(39-i);
            }

            ll nj = j || d<lim;
            chmax(dp[i+1][nj], dp[i][j] + add);
        }
    }

    cout << max(dp[40][0], dp[40][1]) << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
int main()
{
    int n;
    cin >> n;
    vector<pair<double,double>> f(n);
    rep(i,n)cin >> f[i].first >> f[i].second;
    sort(f.begin(),f.end());
    double ans = 0;
    double res = 0;
    do{
        rep(i,n-1){
            double x = f[i].first,y = f[i].second;
            double nx = f[i+1].first,ny = f[i+1].second;
        double dist = sqrt((nx-x)*(nx-x)+(ny-y)*(ny-y));

        ans += dist;
        
        }

        res++;

    }while(next_permutation(f.begin(),f.end()));
    printf("%lf\n",ans/res);



    
    return 0;
}

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

int main(){
    int n;
    int k;
    cin >> n >> k;
    string s;

    cin >> s;

    vector<pair<int, int>> p;
    int num = s[0];
    int cnt = 0;

    for(int i = 0;i < n;i++){
        if(num != s[i]){
            p.push_back(make_pair(num-'0', cnt));
            num = s[i];
            cnt = 1;
        }else{
            cnt++;
        }
    }

    p.push_back(make_pair(num-'0', cnt));

    int rui[100010] = {};
    for(int i = 0;i < p.size();i++){
        rui[i+1] = rui[i] + p[i].second;
    }


    int ans = 0;
    for(int i = 0;i < p.size();i++){
        if(p[i].first == 0){
            ans = max(ans, rui[min(i+2*(k-1)+1+1, (int)p.size())]-rui[i]);
        }else{
            ans = max(ans, rui[min(i+2*k+1,(int)p.size())]-rui[i]);
        }
    }

    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 1652
#include<bits/stdc++.h>
using namespace std;
const int nmax=52;
double x[nmax],y[nmax];
double d(int a,int b){
  return sqrt((x[a]-x[b])*(x[a]-x[b])+(y[a]-y[b])*(y[a]-y[b]));
}
double f(int a,int b,int c){
  vector<double> p(3);
  p[0]=d(a,b),p[1]=d(b,c),p[2]=d(c,a);
  sort(p.begin(),p.end());
  double co=(p[0]*p[0]+p[1]*p[1]-p[2]*p[2])/(2*p[0]*p[1]);
  if(co<=0){
    return p[2]/2;
  }
  double si=sqrt(1-co*co);
  return p[2]/2/si;
}
int main(){
  int n;cin >> n;
  double ans=0;
  for(int i=0;i<n;i++){
    cin >> x[i] >> y[i];
  }
  if(n==2){
    ans=d(0,1)/2;
  }
  else{
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
        if(i!=j&&i!=k&&j!=k){
        ans=max(ans,f(i,j,k));
        }
      }
    }
  }
  }
  cout << fixed << setprecision(15) << ans << endl;
}

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

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    int i=100, cnt=0;
    while(true) {
        if(a%i==0 && b%i==0) cnt++;
        if(cnt==k) break;
        i--;
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter


i=input()
a=[int(i) for i in input().split(' ')]

c = Counter(a)
a=list(set(a))
a.sort()
x=0
for i in a:
  a_1=0
  a_2=0
  if i-2 in c:
    a_2=c[i-2]
  if i-1 in c:
    a_1=c[i-1]
  x0 = a_2 + a_1 + c[i]
  x=max(x,x0)
print(x)

Measured memory_bytes: 15072
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void resolve() {
    string s;
    cin >> s;
    if (s.substr(0,4) == "YAKI") cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

Measured memory_bytes: 256
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <set>

using namespace std;

#define int long long

struct po
{
	int x,y;
	bool operator < (const po &a) const
	{
		return x == a.x ? y > a.y : x < a.x; 
	}
	bool operator == (const po &a) const
	{
		return x == a.x && y == a.y;
	}
}P[100050];

int lis[100050],lcnt;
const int mod = 1000000007;

struct BIT
{
	int val[100050];
	void add(int pos,int vl)
	{
		for(int i = pos;i <= lcnt;i += i & -i)
			val[i] = (val[i] + vl) % mod;
	}
	int query(int pos)
	{
		int ans = 0;
		for(int i = pos;i;i -= i & -i)
			ans = (ans + val[i]) % mod;
		return ans;
	}
}tree;

int n,m;
int minn,maxn;
int seq[100050];
int as = 0;
int f[100050];
set<int> st;

signed main()
{
	minn = 2e9;
	scanf("%lld%lld",&n,&m);
	for(int i = 1;i <= n; ++ i) scanf("%lld",&seq[i]);
	for(int i = 1;i <= m; ++ i)
	{
		int vl2; scanf("%lld",&vl2);
		st.insert(vl2);
		minn = min(minn,vl2); maxn = max(maxn,vl2);
	}
	int c = 0;
	for(int i = 1;i <= n; ++ i)
	{
		if(seq[i] < minn || seq[i] > maxn) continue;
		P[++ c].x = *st.lower_bound(seq[i]) - seq[i];
		P[c].y = seq[i] - *(--st.lower_bound(seq[i]));
		if(P[c].x == 0 || P[c].y == 0)
		{
			c --;
			continue;
		}
		lis[++ lcnt] = P[c].y;
	}
	as = 1;
	sort(lis + 1,lis + 1 + lcnt);
	lcnt = unique(lis + 1,lis + 1 + lcnt) - lis - 1;
	for(int i = 1;i <= c; ++ i)
		P[i].y = lower_bound(lis + 1,lis + 1 + lcnt,P[i].y) - lis;
	sort(P + 1,P + 1 + c);
	c = unique(P + 1,P + 1 + c) - P - 1;
	sort(P + 1,P + 1 + c);
	for(int i = 1;i <= c; ++ i)
	{
		f[i] = tree.query(P[i].y - 1) + 1;
		f[i] %= mod;
		as = (as + f[i]) % mod;
		tree.add(P[i].y,f[i]);
	}
	printf("%lld\n",as);
}

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

using ll = long long;
const int m =3005;
ll dp[m][m];

int32_t main() 
{
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=n-1;i>=0;i--)
    {
        for(int j=i;j<n;j++)
        {
            if(i==j)
                dp[i][j]=a[i];
             else    
                  dp[i][j]=max(a[i]-dp[i+1][j] ,a[j]-dp[i][j-1]);
        }
    }
      cout<<dp[0][n-1];
     return 0;
}


Measured memory_bytes: 70016
import Foundation

let input_line = readLine()!
let array: [String] = input_line.componentsSeparatedByString(" ")
let even = Int(array[0])!
let odd = Int(array[1])!
var count = 0

// 偶数+偶数の数
if even > 1 {
  count += even * (even-1) / 2
}

// 奇数+奇数の数
if odd > 1 {
  count += odd * (odd-1) / 2
}

print(count)

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

int a[50][26];

int main(){
  cin.sync_with_stdio(false);
  int n;
  cin >> n;
  rep(i, n) {
    string s;
    cin >> s;
    rep(j, s.length()) {
      a[i][s[j] - 'a']++;
    }
  }

  string ans = "";
  rep(i, 26) {
    int mini = 50;
    rep(j, n) {
      minch(mini, a[j][i]);
    }
    rep(j, mini) {
      ans += (char)('a' + i);
    }
  }

  if (ans.length() > 0) cout << ans;
  cout << endl;

  return 0;
}

Measured memory_bytes: 256