akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

const int inf = 1e9;

vector<vector<int>> warshall_floyd(vector<vector<int>> dist) {
	int n = dist.size();

	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}

	return dist;
}

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

	vector<vector<int>> dist(n, vector<int>(n, inf));

	for (int i = 0; i < m; i++) {
		cin >> a >> b >> c;
		a--;
		b--;

		dist[a][b] = c;
		dist[b][a] = c;
	}
	for (int i = 0; i < n; i++) {
		dist[i][i] = 0;
	}

	int ans = 0;
	auto dist2 = warshall_floyd(dist);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (dist[i][j] != inf && dist[i][j] != dist2[i][j]) {
				ans++;
			}
		}
	}

	// for (int i = 0; i < n; i++) {
	// 	printf("%d: ", i+1);
	// 	for (int j = 0; j < n; j++) {
	// 		int x = dist[i][j];
	// 		printf("%2d ", x != inf ? x : -1);
	// 	}
	// 	printf("\n");
	// }
	// printf("\n");

	// for (int i = 0; i < n; i++) {
	// 	printf("%d: ", i+1);
	// 	for (int j = 0; j < n; j++) {
	// 		printf("%2d ", dist2[i][j]);
	// 	}
	// 	printf("\n");
	// }

	ans /= 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
package main

import "fmt"

//a<=b<=c
func isIn(a, b, c int) bool {
	return (a <= b) && (b <= c)
}

//a<=b,c<=d
func isIn2(a, b, c, d int) bool {
	return isIn(a, b, d) && isIn(a, c, d)
}

func main() {
	var w, h, x, y, r int
	fmt.Scanln(&w, &h, &x, &y, &r)
	if isIn2(0, x-r, x+r, w) && isIn2(0, y-r, y+r, h) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1128
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a * b % 2 == 0){
			System.out.println("Even");
		} else {
			System.out.println("Odd");
		}
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int main() {

  long  N,M;
  int i,j,tmp,tmp2;
  std::cin >> N;
  std::cin >> M;
  
  vector<int> V(M+1);
  for(i=0;i<N;i++){
    cin >>tmp;
    for(j=0;j<tmp;j++){
      cin >> tmp2;
      V[tmp2]++;
    }
  }
  int answer=0;
  for(i=0;i<M+1;i++){
    if(V[i]==N){
      answer++;
    }
  }
  cout <<answer <<endl;
  return 0;
   
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

// 163 Sunday April 1



int main() {
 long S,W,A,B,C,D,i;

 cin >> A >> B >> C >> D;

 i = 1;
 while ((A > 0) && (C > 0)) {
   if (i > 0) {
     C = C-B;
   }
   else
     A = A-D;
   // cout << A << " " << B << " " << C << " " << D << endl;
   i = ((i+1) % 2);
 }

 if (A <= 0)  {
   cout << "No" << endl;
 }
 else
    cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;
 
enum Type{
    SAME,
    A_BIG,
    B_BIG
};
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        Scanner scanner = new Scanner(System.in);
 
        int N = scanner.nextInt();
        String TARO,HANAKO;
        int score_TARO = 0,score_HANAKO = 0;
 
        for(int loop = 0; loop < N; loop++){
 
            TARO = scanner.next();
            HANAKO = scanner.next();
 
            switch(compString(TARO,HANAKO)){
            case SAME:
                score_TARO += 1;
                score_HANAKO += 1;
                break;
            case A_BIG:
                score_TARO += 3;
                break;
            case B_BIG:
                score_HANAKO += 3;
                break;
            }
        }
 
        System.out.printf("%d %d\n", score_TARO,score_HANAKO);
    }
 
    //A基準で比較する関数
    public static Type compString(String A,String B){
        int a_index = 0,b_index = 0;
 
        while(a_index < A.length() && b_index < B.length() && A.charAt(a_index) == B.charAt(b_index)){
            a_index++;
            b_index++;
        }
 
        if(a_index < A.length() && b_index < B.length()){
            if(A.charAt(a_index) > B.charAt(b_index)){
                return Type.A_BIG;
            }else{
                return Type.B_BIG;
            }
 
        }else if(a_index < A.length() && b_index == B.length()){
            return Type.A_BIG;
        }else if(a_index == A.length() && b_index < B.length()){
            return Type.B_BIG;
        }else{
            return Type.SAME;
        }
    }
}


Measured memory_bytes: 30096
#include <iostream>
#include <string.h>
#include<cstdlib>


using namespace std;
struct Node
{
	int key;//??°?????¬????????´??°key
	Node *next, *prev;//???????????????????´??????????next?????????????????????????´???????prev
};
Node *nil;//??´??????
Node* listSearch(int key)
{
	Node *cur = nil->next;//?????´???????????¢???????´?????§???????
	while (cur != nil&&cur->key != key)
	{
		cur=cur->next;
	}
	return cur;//?????????????????????????????????
}
void init()
{
	//malloc???C????¨?????????????????????°?????¨?????¨?????????????????§?°???????????????´???sizeof???Node????????????Node?±???????????????´?????§?°?
	nil = (Node*)malloc(sizeof(Node));
	nil->next = nil;
	nil->prev = nil;
}
void printList()
{
	Node *cur = nil->next;
	int isf = 0;
	while (1)
	{
		if (cur == nil) break;
		if (isf++ > 0)
			cout << " ";
		cout << cur->key;//?????°????????????
		cur = cur->next;//?????????????????????
	}
	cout << endl;
}
void deleteNode(Node *t)
{
	if (t == nil) return;//???t?????´????????¶????????????
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}
void deleteFirst()
{
	deleteNode(nil->next);
}
void deleteLast()
{
	deleteNode(nil->prev);
}
void deleteKey(int key)
{
	deleteNode(listSearch(key));//??????????´¢??°?????????
}
void insert(int key)
{
	Node *x = (Node*)malloc(sizeof(Node));
	x->key = key;
	//??¨??´???????????????????´?
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}
int main()
{
	int key, n;//n???????????°
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	cin >> n;
	init();
	for (int i = 0; i < n; i++)//????????????????°±???????¬???????
	{
	        //scanf("%s%d",com,&key);
		cin >> com ;
		if (com[0] == 'i')
		{
		        cin>> key;
			insert(key);
			np++;
			size++;
			//cout<<"finish"<<endl;
		}
		else if (com[0] == 'd')
		{
		       // cout<<"right";
			if (strlen(com) > 6)
			{
			        //cout<<"finish"<<endl;
				if (com[6] == 'F')
					deleteFirst();
				else if (com[6] == 'L')
					deleteLast();

			}
			else
			{
			        cin>> key;
				deleteKey(key);
				nd++;
			}
			size--;
		}
	}
	printList();
	return 0;
}

Measured memory_bytes: 34232
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
const int N = 309;
const long infty = 1_000_000_000 * 500;
void solve(){
	int n = rint;
	int m = rint;
	long l = rlong;
	
	long[N][N] cost;
	foreach(i; 0 .. n) foreach(j; 0 .. n){
		cost[i][j] = infty;
	}
	foreach(i; 0 .. n){
		cost[i][i] = 0;
	}
	
	foreach(_; 0 .. m){
		int a = rint - 1, b = rint - 1;
		long c = rlong;
		cost[a][b] = c;
		cost[b][a] = c;
	}
	
	foreach(k; 0 .. n){
		foreach(a; 0 .. n) foreach(b; 0 .. n){
			cost[a][b] = min(cost[a][b], cost[a][k] + cost[b][k]);
		}
	}
	
	foreach(a; 0 .. n) foreach(b; 0 .. n){
		if(a == b) cost[a][b] = 0;
		else if(cost[a][b] <= l) cost[a][b] = 1;
		else cost[a][b] = infty;
	}
	
	foreach(k; 0 .. n){
		foreach(a; 0 .. n) foreach(b; 0 .. n){
			cost[a][b] = min(cost[a][b], cost[a][k] + cost[b][k]);
		}
	}
	
	int q = rint;
	foreach(_; 0 .. q){
		int s = rint - 1, t = rint - 1;
		if(cost[s][t] >= infty) "-1".writeln;
		else (cost[s][t] - 1).writeln;
	}
}
/*
・各町の間の最短距離を求める　ワーシャルフロイド
・最短距離がL以下である町どうしはつながっているとする
・そのグラフで、各町の間の最短距離を求める　再度ワーシャルフロイド
・クエリはO(1)
*/
/*
ワーシャルフロイド
・自分への距離は0とする
・初めに隣接している点への距離はその距離とする
・kまで解禁されているとする（ループ）
*/

Measured memory_bytes: 2300
s = input()
k = int(input())

for i in range(len(s)):
    if s[i] != "a":
        req = ord("z") - ord(s[i]) + 1

        if req <= k:
            k -= req
            s = s[:i] + "a" + s[i+1:]

if k > 0:
    s = s[:-1] + chr(ord(s[-1]) + k%26)

print(s)

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
void get_unique(vector<T>& x) {
    x.erase(unique(x.begin(), x.end()), x.end());
}
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int D;
    cin >> D;
    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(D, vector<int>(26));
    rep(i, D) rep(j, 26) cin >> s[i][j];

    vector<int> t(D);
    rep(i, D) cin >> t[i], t[i]--;

    vector<set<int>> st(26);
    rep(i, D) st[t[i]].insert(i);

    vector<int> last(26, -1);
    auto calc = [&](int day, int type) {
        int ret = 0;
        ret += s[day][type];
        rep(i, 26) if (i != type) ret -= c[i] * (day - last[i]);
        return ret;
    };
    int score = 0;
    rep(d, D) {
        score += calc(d, t[d]);
        last[t[d]] = d;
    }

    int tt;
    cin >> tt;
    while (tt--) {
        int d, q;
        cin >> d >> q;
        d--;
        q--;
        int p = t[d];
        t[d] = q;
        int diff = 0;
        diff -= s[d][p];
        diff += s[d][q];
        {
            int d1 = (st[p].find(d) == st[p].begin() ? -1 : *(--st[p].find(d)));
            int d2 = (st[p].find(d) == --st[p].end() ? D : *(++st[p].find(d)));
            diff -= c[p] * (d - d1) * (d2 - d);
        }
        st[p].erase(d);
        st[q].insert(d);
        {
            int d1 = (st[q].find(d) == st[q].begin() ? -1 : *(--st[q].find(d)));
            int d2 = (st[q].find(d) == --st[q].end() ? D : *(++st[q].find(d)));
            diff += c[q] * (d - d1) * (d2 - d);
        }
        score += diff;
        cout << score << '\n';
    }
}

Measured memory_bytes: 3688
//#include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <numeric>
//#include <omp.h>
#include<memory>
#include <cstdio>

using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,s,e) for (int i = s; i > (e); --i)
typedef long long int ll;
const int MOD=1000000007;
int main(){
	int N;
  	int MAX = 1000001;
  	int res = 0;
    int flag;
  	cin >> N;
    int A[N];
  	int dp[MAX];
  	int addr;
  	int mx = 0;
  	rep(i, N){
    	cin >> A[i];
      	if (A[i] > mx){
          mx = A[i];
        }
    }

  	rep(i, MAX){
      	dp[i] = 0;
    }
  	
  
  	rep(i, N){
      	//cout << "--dp:" << dp[A[i]] << " --A:" << A[i] << endl;
      	dp[A[i]] += 1;
      	if(dp[A[i]] >= 1){
            //cout << "x--dp:" << dp[A[i]] << " --A:" << A[i] << " hoge:" << (mx/A[i]-1) << endl;
          	rep(j, (mx/A[i]-1)){
              	dp[ A[i]*(j+2) ] += 1;
              	//cout << "i:" << i << " j:" << j << " dp:" << dp[ A[i]*(j+2) ] << " hoge:" << A[i]*(j+2) << endl; 
            }
        }
    }
  
  	// 結果の集計
  	rep(i, N){
      	//cout << "dp: " << dp[A[i]] << " ai:" << A[i] << endl;
          if(dp[A[i]] == 1){
          	res += 1;
        }
    }
  	//cout << endl;
  	cout << res << endl;
	
    return 0;
}

Measured memory_bytes: 8184
#include <stdio.h>
#include <string.h>
int main(void) {
    int ta=0,ha=0,num,i;
    char strta[101],strha[101];
    scanf("%d\n",&num);
    for (i=0; i<num; i++) {
        scanf("%s %s\n",strta,strha);
        if (strcmp(strta,strha)>0) {
            ta+=3;
        } else if (strcmp(strta,strha)<0) {
            ha+=3;
        } else {
            ta++;
            ha++;
        }
    }
    printf("%d %d\n",ta,ha);
    return 0;
}

Measured memory_bytes: 608
import java.util.Scanner;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long MOD = 1000000007;
		long dp[][] = new long[S.length() + 1][13];
		dp[0][0] = 1;
		for(int i = 0; i < S.length(); i++) {
			if(S.substring(i , i + 1).equals("?")) {
				for(int j = 0; j < 10; j++) {
					for(int k = 0; k < 13; k++) {
						dp[i + 1][(k * 10 + j) % 13] += dp[i][k];
						dp[i + 1][(k * 10 + j) % 13] %= MOD;
					}
				}
			} else {
				for(int k = 0; k < 13; k++) {
					int x = Integer.parseInt(S.substring(i, i + 1));
					dp[i + 1][(k * 10 + x) % 13] += dp[i][k];
					dp[i + 1][(k * 10 + x) % 13] %= MOD;
				}
			}
		}
		System.out.println(dp[S.length()][5]);
	}
}


Measured memory_bytes: 72016
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

LL f(vector<LL>& v,LL N){
	LL ans = 0;
	while(1){
		LL kai = 0;
		for(int i=0;i<N;++i){
			LL cnt = v[i]/N;
			v[i] = v[i] - cnt*N - cnt;//+cnt分
			kai += cnt;
		}

		ans += kai;

		LL MAX = 0;
		for(int i=0;i<N;++i){
			v[i] += kai;
			MAX = max(MAX,v[i]);
		}
		
		if( MAX >= N ){
			continue;
		}else{
			break;
		}
	}
	return ans;
}
void solve(){
	int N;
	cin >> N;
	vector<LL> A(N);
	LL sum = 0;
	for(int i=0;i<N;++i){
		cin >> A[i];
		sum += A[i];
	}
	LL temp = f(A,N);
	cout << temp << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

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

int main(){
	int residents[4][3][10] = {0};
	int n, building, floor, room, value;
	cin >> n;
	for(int i = 0; i < n; ++i) {
		cin >> building >> floor >> room >> value;
		residents[building - 1][floor - 1][room -1] += value;
	}
	for(int b = 0; b < 4; ++b) {
		for(int f = 0; f < 3; ++f) {
			for(int r = 0; r < 10; ++r) {
				cout << " " << residents[b][f][r];
			}
			cout << endl;
		}
		
		if(b != 3) {
			for(int i = 0; i < 20; ++i) {
				cout << "#";
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3068
#include<stdio.h>
long long int num[15] = {};

long long int small(long long int a, long long int b) {
	if (a >= b) {
		return b;
	}
	else {
		return a;
	}
}

int main() {
	long long int n, m = -1;
	int s[15] = {};
	long long int memo, M;
	scanf("%lld", &n);
	for (int i = 0; n != 0; i++) {
		s[i] = n % 10;
		n /= 10;
		m = i;
	}
	for (int i = 2; i <= m; i++) {
		num[i] = 100 * s[i] + 10 * s[i - 1] + s[i-2] - 753;
		if (num[i] < 0) {
			num[i] = -num[i];
		}
	}
	for (int i = m+1; i <= 10; i++) {
		num[i] = 99999;
		
	}
	printf("%lld", small(small(small(small(small(small(small(num[2],num[10]),num[3]),num[4]),num[5]),num[6]),num[8]),num[9]));

}

Measured memory_bytes: 128
def main():
    n,m=map(int,input().split())
    s=list(map(int,input().split()))
    t=list(map(int,input().split()))
    dp=[[0]*(m+1) for _ in [0]*(n+1)]
    for i in range(n+1):
        dp[i][m]=1
    for i in range(m+1):
        dp[n][i]=1
    for i in range(n-1,-1,-1):
        for j in range(m-1,-1,-1):
            dp[i][j]=(dp[i+1][j]+dp[i][j+1]-(s[i]!=t[j])*dp[i+1][j+1])%(10**9+7)
    print(dp[0][0])
main()


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

int main(){
  int N; cin >> N;
  map<string, int> mp;
  rep(i, N) {
    string S; cin >> S;
    mp[S]++;
  }
  int mx = 0;
  for (auto x : mp) {
    mx = max(mx, x.second);
  }
  for (auto x : mp) {
    if (x.second == mx) cout << x.first << endl;
  }
}


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

#define endl '\n'
#define int long long

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int n; cin >> n;
	if(n <= 1) cout << 0 << endl;
	else if(n == 2) cout << 2 << endl;
	else {
		int ans = 1, nonzero = 1, nonnine = 1, nontotal = 1;
		int mod = 1e9 + 7;
		for(int i = 0; i < n; i ++) {
			ans = (ans * 10) % mod;
			nonzero = (nonzero * 9) % mod;
			nonnine = (nonnine * 9) % mod;
			nontotal = (nontotal * 8) % mod;
		}
		ans = ans - nonzero - nonnine + nontotal;
		while(ans < 0) ans += mod;
		ans %= mod;
		cout << ans << endl;
	}

	return 0;
}

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

int main() {
	int n;
	string str;
	int count = 0;
	int count_b_a = 0;
	int count_start_b = 0;
	int count_end_a = 0;
	
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> str;

		if (str[0] == 'B' && str[str.length() - 1] == 'A') {
			count_b_a++;
		}
		else if (str[0] == 'B') {
			count_start_b++;
		}
		else if (str[str.length() - 1] == 'A') {
			count_end_a++;
		}

		for (int j = 0; j <= str.length() - 2; j++) {
			if (str.substr(j, 2) == "AB") {
				count++;
			}
		}
	}

	while (1) {
		if (count_b_a >= 2) {
			count_b_a--;
			count++;
		}
		else if (count_b_a >= 1 && count_end_a >= 1) {
			count_b_a--;
			count++;
		}
		else if (count_b_a >= 1 && count_start_b >= 1) {
			count_b_a--;
			count++;
		}
		else if (count_end_a >= 1 && count_start_b >= 1) {
			count_end_a--;
			count_start_b--;
			count++;
		}
		else {
			break;
		}
	}

	cout << count << endl;
}

Measured memory_bytes: 256
//
// Created by yamunaku on 2019/12/29.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    ll n, k;
    cin >> n >> k;
    ll l = 1, r = k + 1;
    while(r - l > 1){
        ll mid = (l + r) / 2;
        ll ans = 0;
        ll tmp = mid;
        int c = 0;
        while(mid){
            if(ans > k - mid){
                r = tmp;
                goto nxt;
            }
            ans += mid;
            mid /= 2;
            c++;
            if(c == n) break;
        }
        if(ans <= k) l = tmp;
        else r = tmp;
        nxt:;
    }
    cout << l << endl;
    return 0;
}


Measured memory_bytes: 3112
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}

	ans := 0
	for {
		c := 0
		for _, v := range a {
			if v % 2 == 0 {
				c++
			}
		}
		if c == len(a) {
			ans += 1
			for i := range a {
				a[i] = a[i] / 2
			}
		} else {
			break
		}
	}

	fmt.Println(ans)
}

Measured memory_bytes: 1780
#include<stdio.h>

int ans=0;

void count(int*,int,int);
void pluser(int*,int,int);

void pluser(int array[],int left,int right){
  int pivot=array[left];
  int i;
  for(i=left;i<=right;i++){
    if(array[i]<pivot)pivot=array[i];
  }
  for(i=left;i<=right;i++){
    array[i]-=pivot;
  }
  ans+=pivot;
  count(array,left,right);
}

void count(int array[],int left,int right){
  int i,j,c;
  j=1;
  c=0;
  for(i=left;i<=right;i++){
    if(array[i]==0)c++;
  }
  int zero[c+2];
  zero[0]=left-1;
  zero[c+1]=right+1;
  for(i=left;i<=right;i++){
    if(array[i]==0){
      zero[j]=i;
      j++;
    }
  }

  if(c==0){
    pluser(array,left,right);
  }
  for(i=0;i<c+1;i++){
    if(zero[i]+1==zero[i+1]){
      continue;
    }else if(zero[i]+2==zero[i+1]){
      ans+=array[zero[i]+1];
      array[zero[i]+1]=0;
    }else{
      pluser(array,zero[i]+1,zero[i+1]-1);
    }
  }

}

int main(void){
  int n,i,j,ze;
  j=1;
  while(scanf("%d",&n)!=1);
  int array[n];
  for(i=0;i<n;i++){
    while(scanf("%d",&array[i])!=1);
  }
  count(array,0,n-1);
  printf("%d\n",ans);

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;


int main(){
    int n=0;
    string s;
    cin >> s;
    for(int i=0; i<s.length(); i++){
        if(s[i]=='o'){
            n++;
        }
    }
    if(n+(15-s.length())>=8){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}





Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int T = sc.nextInt();
        int[] a = new int[T];
        for(int i=0;i<T;i++) a[i]=sc.nextInt();
        Arrays.sort(a);
        int sum = K - a[T-1];
        int ans = 0;
        if(sum<a[T-1]-1){
            ans = a[T-1]-1-sum;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#define MAX_V 100010
using namespace std;
vector<int> G[MAX_V];
int color[MAX_V];
long long V,sum1=0,sum2=0;
bool dfs(int v, int c){
	color[v]= c;
	if(c==1){
		sum1++;
	}else{
		sum2++;
	}
	for(int i=0;i<G[v].size();i++){
		if(color[G[v][i]]==c) return false;
		if(color[G[v][i]]==0 && !dfs(G[v][i],-c)) return false;
	}
	return true;
}

int main(){
	int m;
	cin >> V >> m;
	for(int i=0;i<m;i++){
		int a,b;
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	
	for(int i=1;i<=V;i++){
		color[i] = 0;
	}
	
	if(!dfs(1,1)){
		cout << V*(V-1)/2 - m<< endl;
	}else{
		cout << sum1*sum2 - m << endl;
	}
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int num,ac,wa,tle,re;
    string str;
    while(cin>>num)
    {
        ac=wa=tle=re=0;
        while(num--)
        {
            cin>>str;
            if(str=="AC")
            {
                ac++;
            }
            else if(str=="WA")
            {
                wa++;
            }
            else if(str=="TLE")
            {
                tle++;
            }
            else
            {
                re++;
            }
            
        }
        cout<<"AC x "<<ac<<endl;
        cout<<"WA x "<<wa<<endl;
        cout<<"TLE x "<<tle<<endl;
        cout<<"RE x "<<re<<endl;
    }

}

Measured memory_bytes: 3636
N,Y=map(int,input().split())
a=-1
b=-1
c=-1
for i in range(0,N+1):
    for j in range(0,N-i+1):
        if 10000*i+5000*j+1000*(N-i-j) == Y:
                a=i
                b=j
                c=N-i-j
print(a,b,c)

Measured memory_bytes: 40812
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
    int n;
    double a,s,m,sum,A; 
    while(1){
        cin >> n;
        if(n==0)break;
        int s[1000]={};
        sum=0.0;
        for(int i=0;i<n;i++){
            cin>>s[i];
            sum +=s[i];
        }
        m=sum/n;
        A=0.0;
        for(int i=0;i<n;i++){
            A+=(s[i]-m)*(s[i]-m);
        }
        a=sqrt(A/n);
        printf("%lf\n",a);
    }
    return 0;
}


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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

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

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    ll n, m;
    cin >> n >> m;
    if (n < m)
    {
        ll tmp = m;
        m = n;
        n = tmp;
    }
    if (n == 1 && m == 1)
        cout << 1 << endl;
    else if (m == 1)
    {
        cout << n - 2 << endl;
    }
    else
    {
        cout << n * m - (2 * n + 2 * m - 4) << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=(ll)2e5+100;
vector<ll>vec[N];
ll dp[N];
ll dfs(ll v)
{
	if(dp[v]!=-1)
		return dp[v];
	ll c=0;
	for(ll i=0;i<vec[v].size();i++)
	{
		c=max(c,dfs(vec[v][i])+1);
	}
	dp[v]=c;
	return c;
}
int main()
{
	ll n,m;
	cin>>n>>m;
	ll x,y;
	for(ll i=0;i<n+2;i++)
	{
		dp[i]=-1;
	}
	for(ll i=0;i<m;i++)
	{
		cin>>x>>y;
		vec[x].push_back(y);
	}
	ll ans=0;
	for(ll i=1;i<=n;i++)
	{
			ans=max(ans,dfs(i));
	}
	cout<<ans<<endl;
}

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


int main(){
    string s; cin >> s;
    int n = s.size();
    ll ans = 0;
    vector<ll> a(n+1); rep(i,n+1) a[i] = -10000;
    if(s[0] == '<') a[0] = 0;
    if(s[n-1] == '>') a[n] = 0;
    rep(i,n-1) if(s[i] == '>' && s[i+1] == '<') a[i+1] = 0; // a < が同じインデックスのセット
    rep(i,n+1){
        if(a[i] == 0 && i > 0 && i < n){
            int cnt = 1;
            while(s[i-cnt] == '>'){ // to left
                a[i-cnt] = max(a[i-cnt+1]+1,a[i-cnt]);
                cnt++;
                if(i-cnt < 0) break;
            }
            cnt = 0;
            while(s[i+cnt] == '<'){ // to right
                a[i+cnt+1] = max(a[i+cnt]+1,a[i+cnt+1]);
                cnt++;
                if(i+cnt > n) break;
            }
        }else if(i == 0 && a[i] == 0){
            int cnt = 0;
            while(s[i+cnt] == '<'){ // to right
                a[i+cnt+1] = max(a[i+cnt]+1,a[i+cnt+1]);
                cnt++;
                if(i+cnt > n) break;
            }
        }else if(i == n && a[i] == 0){
            int cnt = 1;
            while(s[i-cnt] == '>'){ // to left
                a[i-cnt] = max(a[i-cnt+1]+1,a[i-cnt]);
                cnt++;
                if(i-cnt < 0) break;
            }
        }
    }
    rep(i,n+1) ans += a[i];
    cout << ans << endl;
}

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

int main(){
	std::vector<int> height;
	for (int i = 0; i < 10; i++)
	{
		int scan_num;
		std::cin >> scan_num;
		height.push_back(scan_num);
	}
	std::sort(height.begin(), height.end());
	for (int i = 10; i > 10 - 3; i--)
	{
		std::cout << height[i-1] << '\n';
	}
	return 0;

}


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

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

int main() {
    vector<int> A(3);
    cin >> A[0] >> A[1] >> A[2];
    sort(ALL(A));
    int cnt = 0;
    while(A[1] < A[2]) {
        cnt++;
        A[0]++;
        A[1]++;
    }
    while(A[0] < A[1]) {
        cnt++;
        A[0] = A[0] + 2;
    }
    while(A[1] < A[0]) {
        cnt++;
        A[1]++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
    int a, b, cost;
    cin >> a;
    cin >> b;
    if (a >= 13)
    {
        cost = b;
    }
    else if (a < 13 & a >= 6)
    {
        cost = b / 2;
    }
    else if (a <= 5)
    {
        cost = 0;
    }
    cout << cost << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) ((int)x.size())
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
const ll linf=1e18;
const int inf=1001001001;
const ll mod=1e9+7; // 998244353 = (119<<23)+1
// head

int x,y;
ll a=0,b=0;
const int N = 2e6;
 
vector<int> facs(N);
vector<int> invfacs(N);
 
int p = 1e9+7;
 
 
int mul(int a, int b) {
    return (1LL * a * b) % p;
}
int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}
 
int inv(int n)
{
    return po(n, p-2);
}
void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int main() {
	  ios::sync_with_stdio(false);
  	cin.tie(0);
		cin>>x>>y;
		init();
		while(x!=y) {
			if(x>y) {
				x-=2;
				y-=1;
				a++;
			} else {
				y-=2;
				x-=1;
				b++;
			}
		}
		if(x<0||y<0||x%3) {
			cout<<0;
			return 0;
		}
		a+=(ll)(x/3);
		b+=(ll)(y/3);
		cout<<mul(facs[a+b], mul(invfacs[a], invfacs[b]));
		return 0;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  ll A,B,K; cin >>A>>B>>K;
  if (A>K) {
    A-=K;
    printf("%lld %lld\n", A, B);
    return 0;
  } else {
    B -= (K-A);
    if (B<0) B =0;
    A=0;
  }
  printf("%lld %lld\n", A, B);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N, A, B, i, sum1, sum2 = 0, p;
  
  scanf("%d %d %d", &N, &A, &B);
  
  for (i = 1; i <= N; i++){
    sum1 = 0;
    p = i;
    while(1){
      sum1 += p%10;
      p /= 10;
      if(p == 0){
        break;
      }
    }
    if(sum1 >= A && sum1 <= B){
      sum2 += i;
    }
  }
  
  printf("%d\n", sum2);
  
  return 0;
}

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

int cp[10], P[10][10];

int search(int i, int j){
    cp[i]=0;
    int S=0;
    bool all=true;
    for(int k=1; k<=j; ++k){
        if(cp[k]){
            all=false;
            if(P[i][k]) S += search(k, j);
        }
    }
    if(all) ++S;
    cp[i]=1;
    return S;
}

int main() {
	int N, M; cin >> N >> M;
	for(int i=0; i<=N; ++i) for(int j=1; j<=N; ++j) P[i][j]=0;
	int a, b;
	for(int i=0; i<M; ++i){
	    cin >> a >> b;
	    ++P[a][b];
	    ++P[b][a];
	}
	for(int i=1; i<=N; ++i) cp[i]=1;
	cout << search(1, N) << endl;
	return 0;
}


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

int main(){
	long long a,b,v,w,t;
	cin >> a >> v >> b >> w >> t;
	if (a==b) {cout << "YES"; return 0;}
	if(b<a) { 
		if(b-w*t < a-v*t) {
			cout << "NO";
			return 0;
		}
		else{
			cout << "YES";
			return 0;
		}
	}
	if(b>a){
		if(b+w*t > a + v*t){
			cout << "NO";
			return 0;
		}
		else{
			cout << "YES";
			return 0;
		}
	}
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
//Zachary_260325の代码起手式 (可能借鉴了yyf巨佬的) 
//#define int long long
#define rint register int
#define pqueue priority_queue
#define ll long long
#define ull unsigned long long
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define file(); freopen("test.in","r",stdin);freopen("test.out","w",stdout);
#define endl() putchar('\n')
int read()
{
    int k=0,flag=1;
    char tmp=getchar();
    while('0'>tmp||'9'<tmp)
    {
        if(tmp=='-')
            flag=-1;
        tmp=getchar();
    }
    while('0'<=tmp&&'9'>=tmp)
    {
        k=10*k+tmp-'0';
        tmp=getchar();
    }
    return flag*k;
}
int a[101],sum,n; 
signed main()
{
	//核心代码只有6行 
    n=read();
	for(rint i=1;i<=n;++i)
		sum+=(a[i]=read());
	rint m=read(),t,id;
	while(m--)
		printf("%d\n",sum-a[read()]+read());
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = []
for i in range(n):
    s.append(int(input()))

s.sort()
ans = sum(s)
i = 0

if ans%10 == 0:
    for i in range(n):
        if (ans - s[i])%10 != 0:
            ans -= s[i] 
            print(ans)
            exit()
    print(0)
else:
    print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
      	
        // スタート
        long x = sc.nextLong();
      	x=Math.abs(x);//面倒なので絶対値を取ってしまう
      	//移動回数
      	long k = sc.nextLong();
      	//移動距離
      	long d = sc.nextLong();

      if(k<=x/d){
        System.out.println(x-k*d);
      }else{
        if((k-x/d)%2==0){
          System.out.println(x-d*(x/d));
        }else{
          System.out.println(Math.abs(x-d*(x/d+1)));
        }
      }
      
    }
}

Measured memory_bytes: 35680
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define pi 3.14159265358979323846
#define ll long long
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  int c = 0;
  rep(i, 0, 3){
    char a;
    cin >> a;
    if(a == '1'){
      c++;
    }
  }
  cout << c << "\n";
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i = 0; i < N; i++) cin >> d.at(i);
  
  sort(d.begin(), d.end());
  int cnt = 1;
  
  for(int i = 1; i < N; i++) {
    if(d.at(i) != d.at(i - 1)) cnt++;
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int a;
	scanf("%d",&a);
	int flag = 0;
	int dig;
	while(a>0){
		dig = a%10;
		if(dig == 9)flag=1;
		a /=10;
	}
	if(flag==1)printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val buttons: Array[Int] = sc.nextLine().split(" ").map(k => k.toInt)

    @annotation.tailrec
    def go(button1:Int, button2: Int, n: Int, acc: Int): Int ={
      if (n==0)
        acc
      else{
        if (button1 >= button2) {
          val outcome = getNumberFromBotton(button1)
          go(outcome._2, button2, n -1, acc + outcome._1)
        }
        else {
          val outcome = getNumberFromBotton(button2)
          go(button1, outcome._2, n -1, acc + outcome._1)
        }
      }
    }
    println(go(buttons(0), buttons(1), 2, 0))


  }

  def getNumberFromBotton(button: Int): Tuple2[Int, Int] = {
    Tuple2(button, button - 1)
  }
}

Measured memory_bytes: 25528
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> A(n, 0);
	int max = 0;
	for (int i = 0; i < n; ++i) {
		int temp;
		scanf("%d", &temp);
		A[i] = temp;
		if (max < temp) {
			max = temp;
		}
	}

	sort(A.begin(), A.end());

	vector<int> vb_dp(max+1, 0);

	for (int ia = 0; ia < A.size(); ++ia) {
		int i = 1;
		while (vb_dp.size() > i*A[ia]) {
			vb_dp[i * A[ia]]++;
			++i;
		}
	}

	int score = 0;
	for (int i = 0; i < A.size(); ++i) {
		if (vb_dp[A[i]]==1)
			score++;
	}

	cout << score << endl;

	return 0;
}

Measured memory_bytes: 7580
n=int(input())
l=list(map(int, input().split()))
l[0] -= 1
ans="Yes"
for i in range(1, n):
  if l[i] > l[i-1]:
    l[i] -= 1
  if l[i] < l[i-1]:
    print("No")
    exit()
print(ans)

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC153B()
{
	int H, N;
	cin >> H >> N;
	vl A(N);
	for (auto& x : A)
		cin >> x;
	ll x = accumulate(A.begin(), A.end(), 0ll);
	if (H <= x)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}


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


Measured memory_bytes: 1024
n, m= map(int, input().split())

p_y_li = [list(map(int, (input() + " {}".format(i)).split())) for i in range(m)]

p_y_li.sort(key = lambda x : x[1])

li = [0 for _ in range(n)]
for i in range(m):
    ans = ""
    p = p_y_li[i][0]
    li[p-1] += 1
    x = li[p-1]
    ans = str(p).zfill(6) + str(x).zfill(6)
    p_y_li[i].append(ans)

p_y_li.sort(key = lambda x : x[2])
for i in p_y_li:
    print(i[3])

Measured memory_bytes: 39300
def main(s,end,start,perse):
    start.reverse()
    start.append(''.join(s))
    start.append(''.join(end))
    if perse == -1:
        start.reverse()
    print(''.join(start))
def conv(s):
    a = []
    for i in range(len(s)):
        a.append(s[i])
    return a
perse = 1
start = []
end = []
  
s = input()
q = int(input())
for i in range(q):
    query = input().split()
    query[0] = int(query[0])
    if query[0] == 1:
        perse = -perse
    else:
        query[1] = int(query[1])
        if (int(query[1])*2-3)*perse == 1:
            end.append(query[2])
        else:
            start.append(query[2])
s =  conv(s)
if perse == -1:
    s.reverse()
    end.reverse()
main(s,end,start,perse)

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

Measured memory_bytes: 592
{-# LANGUAGE OverloadedStrings #-}
import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe
import Data.String
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as BS
---------------------------------------------------------------------------------
main = do
  [a,b,x] <- map (read::String->Integer) .words <$> getLine
  print $ check a b x

check a b x
  | a==b = if mod a x==0 then 1 else 0
  | otherwise = if mod a x==0 then (div b x) - (div a x) + 1 else (div b x) - (div a x)
  
---------------------------------------------------------------------------------

{-ByteString関連-}
--IO
getLine' = BS.getLine
getContents' = BS.getContents
getInt' = fst . fromJust . BS.readInt <$> getLine'
getIntListw' = map (fst . fromJust. BS.readInt) .words' <$> getContents'
getIntListl' = map (fst . fromJust. BS.readInt) .lines' <$> getContents'
getInteger' = fst . fromJust. BS.readInteger <$> getLine'
putStr' = BS.putStr
putStrLn' = BS.putStrLn
--演算子
bs1 |++| bs2 = BS.append bs1 bs2
chr |:+| bs2 = BS.cons chr bs2
bs1 |+:| chr = BS.snoc bs1 chr
--部分文字列操作
head' bs = BS.head bs
last' bs = BS.last bs
init' bs = BS.init bs
tail' bs = BS.tail bs
take' n bs = BS.take n bs
drop' n bs = BS.drop n bs
takeWhile' f bs = BS.takeWhile f bs
dropWhile' f bs = BS.dropWhile f bs
--リスト操作
length' bs = BS.length bs
reverse' bs = BS.reverse bs
transpose' bs = BS.transpose bs
sort' bs = BS.sort bs
group' bs = BS.group bs
lines' bs = BS.lines bs
words' bs = BS.words bs
unlines' bs = BS.unlines bs
unwords' bs = BS.unwords bs
--要素の有無
elem' chr bs = BS.elem chr bs
notElem' chr bs = BS.notElem chr bs
elemIndex' chr bs = BS.elemIndex chr bs
elemIndices' chr bs = BS.elemIndices chr bs
count' chr bs = BS.count chr bs
--整形
--justifyRight'::Char -> ByteString -> ByteString
--justifyRight' chr bs = convertString $ T.justifyRight chr (convertString bs)

{-elem関連-}
--elemの第一引数をリストにしたもの。
--elemList "abc" "atcoder" -> [True,False,True]
elemList [] _ = []
elemList (x:xs) list  = elem x list : elemList xs list

--elemIndexの第一引数をリストにしたもの。
elemIndexList [] list = []
elemIndexList (x:xs) list  = elemIndex x list : elemIndexList xs list

--elemIndicesの第一引数をリストにしたもの。
elemIndicesList [] list = []
elemIndicesList (x:xs) list  = elemIndices x list : elemIndicesList xs list

Measured memory_bytes: 3972
#include<bits/stdc++.h>
#define FORD(i,a,b) for(int i=(a);i>=b;i--)
#define FOR(i,a,b) for(int i=(a);(i)<(b);(i)++)
#define ll long long
using namespace std;
int main() {
	int n;
	cin>>n;
	vector<string> s(n);
	ll ans=0,cnt=0;
	FOR(i,0,n) {
		cin>>s[i];
		sort(s[i].begin(),s[i].end());
	}
	sort(s.begin(),s.end());
	FOR(i,1,n) {
		if(s[i]==s[i-1]) cnt++,ans+=cnt;
		else cnt=0;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 7296
import sys
N,M = map(int,input().split())
L,R = sorted(map(int, input().split()))
range_min = L
range_max = R

def end_checker(L,R,range_min,range_max):
  if  L > range_max or R < range_min:
    return True
  return False

while M > 1:
  L,R = sorted(map(int, input().split()))
  if end_checker(L,R,range_min,range_max):
    print(0)
    sys.exit()
  
  range_min = L if L > range_min else range_min
  range_max = R if R < range_max else range_max
  M -= 1

ans = range_max - range_min + 1  
print(ans)

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

#define rad M_PI/3

typedef struct{
  double x,y;
}Point;

void koch(int n,Point a,Point b){
  if(n==0)return;
  Point s,t,u;

  s.x=(2.0*a.x+1.0*b.x)/3.0;
  s.y=(2.0*a.y+1.0*b.y)/3.0;
  t.x=(1.0*a.x+2.0*b.x)/3.0;
  t.y=(1.0*a.y+2.0*b.y)/3.0;
  u.x=(t.x-s.x)*cos(rad)-(t.y-s.y)*sin(rad)+s.x;
  u.y=(t.x-s.x)*sin(rad)+(t.y-s.y)*cos(rad)+s.y;

  koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,b);
}

int main(){
  Point a,b;
  int n;

  scanf("%d",&n);

  a.x=0;
  a.y=0;
  b.x=100;
  b.y=0;

  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);

  return 0;
}



Measured memory_bytes: 1996
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
//using namespace __gnu_pbds;
const double PI=acos(-1.0);
const double eps=1e-6;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
	int k=read(),a=read(),b=read();
    bool flag=0;
    for(int i=1;i<=100000;i++){
        if(i*k<a);
        else if(i*k>=a && i*k<=b){
            flag=1;
            printf("OK\n");
            return 0;
        }
        else flag=0;
    }
    printf("NG\n");
	return 0;
}


Measured memory_bytes: 3632
n=int(input())
for i in range(n):
    count=0
    c,a,n=map(int,input().split())
    while n>0 and a>0 and c>0:
        n-=1
        a-=1
        c-=1
        count+=1
    while a>0 and c>1:
        a-=1
        c-=2
        count+=1
    while c>2:
        c-=3
        count+=1
    print(count)


Measured memory_bytes: 5592
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

bool isPrime(ll x){
	bool ok = true;
	for(ll i = 2; i*i <= x; i++){
		if(x % i == 0) ok = false;
	}
	return ok;
}
int main(){
	ll A,B; cin >> A >> B;
	set<ll> s;
	for(ll i = 1; i*i <= A; i++){
		if(A % i == 0){
			if(B % i == 0) s.insert(i);
			if(B % (A/i) == 0) s.insert(A/i);
		}
	}
	for(ll i = 1; i*i <= B; i++){
		if(B % i == 0){
			if(A % i == 0) s.insert(i);
			if(A % (B/i) == 0) s.insert(B/i);
		}
	}
	ll ans = 0;
	for(ll u : s){
		if(u == 1 || isPrime(u)) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 512