akhauriyash/Code-Regression huggingface dataset:
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_POINT_MAX		100										// 点の数最大

// 内部構造体 - 点情報
typedef struct Point {
	int miX, miY;												// 座標
} Point;

// 内部変数
static Point sz1Red[D_POINT_MAX];								// 赤い点
static Point sz1Blue[D_POINT_MAX];								// 青い点
static int siPCnt;												// 点の数

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

// ソート関数 - X降順
int
fSortFncXD(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	Point *lzpVal1 = (Point *)pzpVal1;
	Point *lzpVal2 = (Point *)pzpVal2;

	// X降順
	if (lzpVal1->miX > lzpVal2->miX) {
		return(-1);
	}
	else if (lzpVal1->miX < lzpVal2->miX) {
		return(1);
	}

	return 0;
}

// ソート関数 - Y昇順
int
fSortFncYU(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	Point *lzpVal1 = (Point *)pzpVal1;
	Point *lzpVal2 = (Point *)pzpVal2;

	// Y昇順
	if (lzpVal1->miY > lzpVal2->miY) {
		return(1);
	}
	else if (lzpVal1->miY < lzpVal2->miY) {
		return(-1);
	}

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i, j;
	char lc1Buf[1024], lc1Out[1024];

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 点の数取得
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d", &siPCnt);

	// 赤い点取得
	for (i = 0; i < siPCnt; i++) {
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
		sscanf(lc1Buf, "%d%d", &sz1Red[i].miX, &sz1Red[i].miY);
	}

	// 青い点取得
	for (i = 0; i < siPCnt; i++) {
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
		sscanf(lc1Buf, "%d%d", &sz1Blue[i].miX, &sz1Blue[i].miY);
	}

	// ソート
	qsort(sz1Red, siPCnt, sizeof(Point), fSortFncXD);		// X降順
	qsort(sz1Blue, siPCnt, sizeof(Point), fSortFncYU);		// Y昇順

	// ペア数取得
	int liPCnt = 0;
	for (i = 0; i < siPCnt; i++) {

		// 条件を満たす青い点を検索
		for (j = 0; j < siPCnt; j++) {

			// X座標チェック
			if (sz1Red[i].miX > sz1Blue[j].miX) {
				continue;
			}

			// Y座標チェック
			if (sz1Red[i].miY > sz1Blue[j].miY) {
				continue;
			}

			// ペア
			liPCnt++;
			sz1Blue[j].miX = -1;									// 使用済
			break;
		}
	}

	// 結果セット
	sprintf(lc1Out, "%d\n", liPCnt);

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

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

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

	return 0;
}

int
main()
{

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

	return 0;
}



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

int main()
{
	int arr[10][10] = { 0 }, search = 0, status = 0;
	for (int i = 1; i < 10; i++)
	{
		for (int j = 1; j < 10; j++)
			arr[i][j] = i*j;
	}
	scanf("%d", &search);
	for (int i = 1; i < 10; i++)
	{
		for (int j = 1; j < 10; j++)
		{
			if (arr[i][j] == search)
			{
				status = 1;
				break;
			}
		}
		if (status == 1)  break;
	}
	if (status == 1)  printf("Yes");
	else  printf("No");

	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int maxm = 1000000000 + 7;


using namespace std;


int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int N, K; cin >> N >> K;

  string S; cin >> S; 
  int a = 0;

  loop(i, N - 1) if(S[i] != S[i + 1]) a++;

  cout << N - 1 - max(a - 2 * K, 0) << endl;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int h, w; cin >> h >> w;
    vector<string> field(h); for(auto& e : field) cin >> e;

    for(auto& e : field){
        cout << e << endl;
        cout << e << endl;
    }

    return 0;
}


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

/* 繰り返し自乗法. */
int modPow(long long a, long long n, long long p) {
	if (n == 0) return 1; // 0乗にも対応する場合.
	if (n == 1) return a % p;
	if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
	long long t = modPow(a, n / 2, p);
	return (t * t) % p;
}

signed main() {
	int K, X;
	cin >> K >> X;
	if ((K * 500) >= X) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 3596
N, M = list(map(int, input().split()))
edge = {i:[] for i in range(1,N+1)}
for _ in range(M):
    A, B = list(map(int, input().split()))
    edge[A].append(B)
    edge[B].append(A)

remain = [1 for _ in range(N)]
remain[0] = 0
ans = [0 for _ in range(N-1)]
before = 1
cand = [(before,edge[before])]
while len(cand)!=0:
    tmp = []
    for one in cand:
        before, can = one
        for on in can:
            tm = []
            if ans[on-2]==0:
                ans[on-2] = before
            remain[on-1] = 0
            for o in edge[on]:
                if remain[o-1]==1:
                    tm.append(o)
                    remain[o-1] = 0
            tmp.append((on, tm))
    cand = tmp
flag = True
for one in ans:
    if one==0:
        flag=False
        break
if not flag:
    print('No')
else:
    print('Yes')
    for one in ans:
        print(one)

Measured memory_bytes: 114392
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << "-1" << endl;return 0
#define MM <<" "<<
#define Endl endl

signed main(){
    int N,A[104];
    cin >> N;
    REP(i,N){
        cin >> A[i];
    }
    double Ans=0;
    REP(i,N){
        Ans+=(double)1.0/(double)A[i];
    }
    Ans=1.0/Ans;
    printf("%.8f\n",Ans);
    return 0;
}   


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(abs(a-c)<=d){
		printf("Yes");
    }else if(abs(a-b)<=d && abs(b-c)<=d){
		printf("Yes");
    }else{
		printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
def gcd(a,b):
    return a if b == 0 else gcd(b, a%b)

def lcm(a, b):
    return a * b // gcd(a, b)

def lcm_multiple(*args):
    return reduce(lcm, args)

times = [int(raw_input()) for i in xrange(int(raw_input()))]
print lcm_multiple(*times)
    


Measured memory_bytes: 28396
#include <iostream>
#include <string>


using namespace std;

string S;

bool kaibun(string s);

int main()
{

	cin >> S;


	bool ans = true;

	ans = kaibun(S);
	
	if (ans) {
		ans = kaibun(S.substr(0,(S.size()-1)/2));
	}
	if (ans) {
		ans = kaibun(S.substr((S.size() + 3) / 2 - 1));
	}

	cout << (ans?"Yes":"No") << endl;


	return 0;
}

bool kaibun(string s)
{
	bool ret = true;

	for (unsigned i = 0; i < s.length() / 2 && ret; i++) {
		if (s[i] != s[s.length() - 1 - i]) {
			ret = false;
		}

	}


	return ret;
}

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

int main() {
	int i, re = 0;
	char c = '+';
	
	while(1) {
		cin >> i;
		
		if (c == '+') {
			re += i;
		}
		else if (c == '-') {
			re -= i;
		}
		else if (c == '*') {
			re *= i;
		}
		else if (c == '/') {
			re /= i;
		}
		cin >> c;
		if (c == '=') break;
	}
	
	cout << re << "\n";
	
}


Measured memory_bytes: 3116
s=input()
a=[1 if x=="A" or x=="C" or x=="G" or x=="T" else 0 for x in s]
b=[0]*len(s)
c=0
for i in range(len(a)-1):
    if a[i]==1 and a[i+1]==1:
        c+=1
        b[i]=c
    else:
        c=0
print(max(b)+1 if 1 in a else 0)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Long x = scanner.nextLong();
		Long y = scanner.nextLong();
		int count = 0;
		while(x <= y){
			x *= 2;
			count++;
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 21716
n = int(input())
A = list(map(int, input().split()))
f = True
for i in range(len(A)):
    if A[i]%2 == 0:
        if A[i]%3 == 0 or A[i]%5 == 0:
            continue
        else:
            f = False

if f:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
n, a, b = map(int, input().split())
MOD = 10**9+7

len_inv = 2*(10**5) + 10
inv = [1]*(len_inv)

for i in range(2, len_inv):
    inv[i] = inv[MOD%i] * (MOD - MOD//i) % MOD

def comb(n, k, MOD):
    x = 1
    for i in range(k):
        x *= (n-i)
        x *= inv[i+1]
        x %= MOD
    return x

ans = pow(2, n, MOD) - 1 - comb(n, a, MOD) - comb(n, b, MOD)
ans += MOD
ans %= MOD
print(ans)

Measured memory_bytes: 16956
#include <bits/stdc++.h>
using namespace std;;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x;cin >> x;
  FOR(i,1,1005){
    ll tmp = x - i*100;
    if(tmp<0){
      cout << 0 << endl;
      break;
    }
    if(tmp<=i*5){
      cout << 1 << endl;;
      break;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 10000
#define NIL -1

typedef struct node{
  int p;
  int l;
  int r;
} Node;

Node no[N];
int n;
int d[N], h[N];

void Depth(int node, int depth){
  if(node == NIL) return;
  d[node] = depth;
  Depth(no[node].l, depth+1);
  Depth(no[node].r, depth+1);
}

int Height(int node){
  int he1 = 0, he2 = 0;
  if(no[node].l != NIL){
    he1 = Height(no[node].l) + 1;
  }
  if(no[node].r != NIL){
    he2 = Height(no[node].r) + 1;
  }
  return h[node] = (he1 > he2 ? he1 : he2);
}

int Sibling(int node){
  if(no[node].p == NIL) return NIL;
  if(no[no[node].p].l != node && no[no[node].p].l != NIL){
    return no[no[node].p].l;
  }
  if(no[no[node].p].r != node && no[no[node].p].r != NIL){
    return no[no[node].p].r;
  }
  return NIL;
}

void output(int node){
  printf("node %d: parent = %d, sibling = %d, ", node, no[node].p, Sibling(node));
  int de = 0;
  if(no[node].l != NIL){
    de++;
  }
  if(no[node].r != NIL){
    de++;
  }
  printf("degree = %d, depth = %d, height = %d, ", de, d[node], h[node]);

  if(no[node].p == NIL){
    printf("root\n");
  }else if(no[node].l == NIL && no[node].r == NIL){
    printf("leaf\n");
  }else {
    printf("internal node\n");
  }
}

int main(){
  int i;
  int id, left, right, root = 0;

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    no[i].p = NIL;
  }

  for(i = 0; i < n; i++){
    scanf("%d%d%d", &id, &left, &right);
    no[id].l = left;
    no[id].r = right;
    if(left != NIL){
      no[left].p = id;
    }
    if(right != NIL){
      no[right].p = id;
    }
  }

  for(i = 0; i < n; i++){
    if(no[i].p == NIL){
      root = i;
    }
  }

  Depth(root, 0);
  Height(root);

  for(i = 0; i < n; i++){
    output(i);
  }

  return 0;
}



Measured memory_bytes: 2128
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define SZ(x) ((ll)(x).size())
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int n;

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    REP(i,n){
        cin >> s[i];
    }
    vector<vector<int>> c(26,vector<int>(n,0));
    REP(i,n){
        REP(j,s[i].size()){
            int temp = s[i][j]-'a';
            c[temp][i]++;
        }
    }
    vector<int> cnt(26);
    REP(i,26){
        cnt[i] = *min_element(all(c[i]));
    }
    string res = "";
    REP(i,26){
        REP(j,cnt[i])res.push_back((char)i+'a');
    }
    put(res);
    return 0;
}


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

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int a[m],sum=0;
    for(int i=0;i<m;i++){
        cin>>a[i];
        sum += a[i];
    }
    if(sum > n){
            cout<<"-1"<<endl;
        }
        else{
            cout<<n-sum<<endl;
        }

    return 0;
}


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

namespace Codeforces
{
	internal class Template
	{
		private void Solve()
		{
			var s = cin.NextString();
			var best = int.MaxValue;
			for (var c = 'a'; c <= 'z'; c++)
			{
				if (s.Contains(c))
				{
					var len = s.Split(new[] {c}, StringSplitOptions.RemoveEmptyEntries).DefaultIfEmpty(string.Empty).Select(x => x.Length).Max();
					best = Math.Min(best, len);
				}
			}
			Console.WriteLine(best);
		}

		private static readonly Scanner cin = new Scanner();

		private static void Main()
		{
			new Template().Solve();
			Console.ReadLine();
		}
	}

	internal class Scanner
	{
		private string[] s = new string[0];
		private int i;
		private readonly char[] cs = { ' ' };

		public string NextString()
		{
			if (i < s.Length) return s[i++];
			var line = Console.ReadLine() ?? string.Empty;
			s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			i = 1;
			return s.First();
		}

		public double NextDouble()
		{
			return double.Parse(NextString());
		}

		public int NextInt()
		{
			return int.Parse(NextString());
		}

		public long NextLong()
		{
			return long.Parse(NextString());
		}
	}
}

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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

void run(void){
  int n,k;
  scanf("%d%d",&n,&k);
  int a[15];
  int i;
  for(i=0;i<n;i++) scanf("%d",a+i);
  int64 ans=1000000000LL*n;
  for(i=1;i<(1<<n);i++){
    int cnt=0;
    int t=i;
    while(t){
      cnt+=t&1;
      t>>=1;
    }
    if(cnt!=k) continue;
    int64 local=0;
    int max=0;
    for(int j=0;j<n;j++){
      if((i>>j)&1){
	int t=MAX(max+1,a[j]);
	local+=t-a[j];
	max=MAX(max,t);
      } else {
	max=MAX(max,a[j]);
      }
    }
    ans=MIN(ans,local);
  }
  printf("%lld\n",ans);
}

int main(void){
  run();
  return 0;
}


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

// マクロ
// forループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair

const ll MAX_ANS = (ll)pow(10, 18);

int main() {
    int N; cin >> N;
    bool is_zero = false;
    vector<ll> A(N);
    REP(i, N) {
        cin >> A[i];
        if (A[i] == 0) is_zero = true;
    }
    ll ans = 1;
    
    REP(i, N) {
        if (MAX_ANS / ans < A[i]) {
            ans = -1;
            break;
        }
        ans *= A[i];
        if (ans > MAX_ANS) {
            ans = -1;
            break;
        }
    }
    if (is_zero) ans = 0;
    PRINT(ans);
    return 0;
}

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

int main()
{
	while (true)
	{
		string text;
		int tryno;

		cin >> text;
		if (text == "-") break;

		cin >> tryno;

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

			string the_text = text;

			for (int j = 0; j < n; j++)
			{
				string new_text = "";
				for (int k = 1; k < text.length(); k++)
				{
					new_text += the_text[k];
				}
				new_text += the_text[0];
				the_text = new_text;
			}

			text = the_text;			
		}

		cout << text << endl;
	}
}


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

int main(){
    int N;
    cin >> N;
    vector<ll> A(N),A_sorted(N);
    rep(i,N) cin >> A[i];
    rep(i,N) A_sorted[i]=A[i];
    sort(A_sorted.begin(),A_sorted.end());
    vector<ll> cnt(N+1);
    rep(i,N) cnt[A_sorted[i]]++;
    ll sum=0;
    rep2(i,1,N+1){
        sum+=cnt[i]*(cnt[i]-1)/2;
    }

    rep(k,N){
        ll num = A[k];
        ll ans=sum;
        if(cnt[num]>=2){
            ans=ans - (cnt[num]*(cnt[num]-1))/2+((cnt[num]-1)*(cnt[num]-2))/2;
        }
        
        cout << ans << endl;        
    }
}

Measured memory_bytes: 7296
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	/** 時間帯の数 */
	private static final Integer TIME = 10;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			scanner.nextLine();
			// 各店舗の営業時間帯の配列
			int[] f = new int[n];
			IntStream.range(0, n).forEach(i -> f[i] = Integer.parseInt(scanner.nextLine().replaceAll(" ", ""), 2));
			// 利益の配列
			int[][] p = new int[n][TIME + 1];
			IntStream.range(0, n)
					.forEach(i -> IntStream.rangeClosed(0, TIME).forEach(j -> p[i][j] = scanner.nextInt()));
			System.out.println(IntStream.range(1, 1 << TIME).map(i -> calcResult(i, n, f, p)).max().getAsInt());
		}
	}

	/**
	 * 現在の営業時間帯で得られる利益を計算する
	 * 
	 * @param t 現在の営業時間帯
	 * @param n 店舗の数
	 * @param f 各店舗の営業時間帯
	 * @param p 利益の配列
	 * @return 現在の営業時間帯で得られる利益
	 */
	private static int calcResult(int t, int n, int[] f, int[][] p) {
		return IntStream.range(0, n).map(i -> p[i][sameCount(t, f[i])]).sum();
	}

	/**
	 * 2つの店舗の営業時間帯が同じものカウントを計算する
	 * 
	 * @param t1 営業時間帯1
	 * @param t2 営業時間帯2
	 * @return 2つの店舗の営業時間帯が同じものカウント
	 */
	private static int sameCount(int t1, int t2) {
		return Integer.bitCount(t1 & t2);
	}
}


Measured memory_bytes: 40756
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
const int MOD = 1e9 + 7;
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((ll)((a) + (b) - 1)/(ll)(b))

class fraction {
public:
    ll first, second;
    fraction(ll N, ll D){
        if(N==0 && D==0){
            first = second = 0;
            return;
        }else if(N == -1 && D == 0){
            first = 1;
            second = 0;
            return;
        }
        ll g = gcd(abs(N),abs(D));
        if(D < 0) g = -g;
        first = N / g; second = D / g;
    }
    
    string to_string() const{
        return std::to_string(this->first)+"/"+std::to_string(this->second);
    }
    
    bool operator <(const fraction other) const {
        if(this->first == other.first){
            return this->second < other.second;
        }else{
            return this->first < other.first;
        }
        //return this->r * other.d < this->d * other.r;
    }
    
    bool operator >(const fraction other) const {
        if(this->first == other.first){
            return this->second > other.second;
        }else{
            return this->first > other.first;
        }
        //return this->r * other.d > this->d * other.r;
    }
    
    bool operator ==(const fraction other) const {
        return this->first == other.first && this->second == other.second;
    }
};

int modpow(int a, int n){
    int ret = 1;
    while(n>0){
        if(n&1) ret = (ret*a) % MOD;
        a = (a*a) % MOD;
        n >>= 1;
    }
    return ret;
}

signed main() {
    int n; cin >> n;
    int zero_iwashi = 0;
    vector<intpair> iwashi;
    rep(i,n){
        int A, B;
        cin >> A >> B;
        if(A==0 && B==0){
            zero_iwashi++;
            continue;
        }
        iwashi.push_back({A,B});
    }
    map<fraction,int> adb;
    
    for(auto [A,B] : iwashi){
        adb[fraction(A,B)]++;
    }
    
    ll ans = 1;
    for(auto [p,cnt] : adb){
        if(cnt == 0) continue;
        ll tmp = 1;
        auto [A,B] = p;
        int dnt = adb[fraction(-B,A)];
        adb[fraction(-B,A)] = 0;
        adb[p] = 0;
        tmp += modpow(2, cnt)-1;
        tmp += modpow(2, dnt)-1;
        ans = mod(ans * tmp);
    }
    ans = mod(ans -1 + zero_iwashi);
    
    cout << ans << endl;
}

Measured memory_bytes: 31224
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long d = sc.nextLong();
		long max = a * c;
		long tmp = a * d;
		if (max < tmp)
			max = tmp;
		tmp = b * c;
		if (max < tmp)
			max = tmp;
		tmp = b * d;
		if (max < tmp)
			max = tmp;
		System.out.println(max);
		sc.close();
	}
}


Measured memory_bytes: 35652
def test():

	while True:
	
		i = input().split()

		a = int(i[0])
		b = int(i[2])

		if i[1] == '?':
			break

		if i[1] == '+':
			print(a + b)
		elif i[1] == '-':
			print(a - b)
		elif i[1] == '*':
			print(a * b)
		elif i[1] == '/':
			print(a // b)

if __name__ == "__main__":
	test()



Measured memory_bytes: 5600
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string S, T;
    cin >> S >> T;
    REP(i, N) cout << S[i] << T[i];
    cout << endl;
}

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

int main(){
    int64_t n,a,b; cin >> n >> a >> b;
    int64_t ans = 0;
    ans += n/(a+b);
    ans *= a;
    int64_t x = n%(a+b);
    if(x < a){
        ans += x;
    }else{
        ans += a;
    }

    cout << ans << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
using G=vector<vector<int>>;

int main(){
    int n;
    cin >> n;
    vector<string> strs(n);
    rp(i,n){
        cin >> strs[i];
        sort(strs[i].begin(),strs[i].end());
    }
    sort(strs.begin(),strs.end());
    int ctr=1;
    ll ans=0ll;
    rp(i,n-1){
        if(strs[i]==strs[i+1]){
            ctr++;
        }
        else{
            ans+=(ll)ctr*(ll)(ctr-1)/2ll;
            ctr=1;
        }
    }
    ans+=(ll)ctr*(ll)(ctr-1)/2ll;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7296
let uppercase_p c = c >= 'A' && c <= 'Z'

let lowercase_p c = c >= 'a' && c <= 'z'

let uppercase c = Char.chr ((Char.code c) - (Char.code 'a') + (Char.code 'A'))

let lowercase c = Char.chr ((Char.code c) - (Char.code 'A') + (Char.code 'a'))

let rec repl () =
  let c = input_char stdin in
  if uppercase_p c then print_char (lowercase c)
  else if lowercase_p c then print_char (uppercase c)
  else print_char c;
  repl ()

let () =
  try repl () with End_of_file -> ()

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

int main() {
  int n;
  cin >> n;
  int l[n+1];
  
  for(int i = 1;i<n+1;i++){
    cin >> l[i];
    //cout << l[i] << endl;;
  }
  
  int c = 0;
  for(int i = 1; i < n+1;i++){
    for(int j = i+1; j <n+1 ;j++){
      for(int k = j+1; k<n+1 ;k++){
        //cout << i << " " << j << " " << k<< endl;
        //cout << l[i] << " " << l[j] << " " << l[k]<< endl;
        if(l[i] != l[j] && l[j] != l[k] && l[k] != l[i]){
          if(l[i] < l[j]+l[k] && l[j] < l[k]+l[i] && l[k] < l[i]+l[j]){
            c++;
          }
        }
      }
    }
  }
  cout << c << endl;
}


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

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

  string ans = "";
  for (auto c : s) {
    if (c == s[k - 1])
      ans.push_back(c);
    else
      ans.push_back('*');
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

map<pair<int, int>, bool> zahyo;
vector<pair<int, int> > vec;

int main()
{
	/*
	zahyo.insert(make_pair(make_pair(1, 2), true));
	cout << (zahyo.count(make_pair(1, 3)) ? "true" : "false") << endl;
	*/

	int m;
	int x, y;
	int fx, fy;
	int nx, ny;

	while (true)
	{
		zahyo.clear();
		vec.clear();

		cin >> m;

		if (m == 0) break;

		cin >> x >> y;

		fx = x;
		fy = y;

		rep(i, m - 1)
		{
			cin >> nx >> ny;
			vec.push_back(make_pair(nx - x, ny - y));
			x = nx;
			y = ny;
		}

		int n;
		cin >> n;

		rep(i, n)
		{
			cin >> x >> y;
			zahyo.insert(make_pair(make_pair(x, y), true));
		}

		for (map<pair<int, int>, bool>::iterator it = zahyo.begin(); it != zahyo.end(); it++)
		{
			int xx = (*it).first.first;
			int yy = (*it).first.second;

			int i;

			for (i = 0; i < vec.size(); i++)
			{
				xx += vec[i].first;
				yy += vec[i].second;

				if (zahyo.count(make_pair(xx, yy)) != 1) break;
			}

			if (i == vec.size())
			{
				cout << (*it).first.first - fx << " " << (*it).first.second - fy << endl;
				break;
			}
		}
	}

}

Measured memory_bytes: 1268
#include <stdio.h>
int main() {
  int N, i, j, tmp, idx=0, cnt=1;
  scanf("%d", &N);
  int arr[N];
  for (i=0; i<N; i++) {
    scanf("%d", &arr[i]);
  }

  for (i=0; i<N; i++) {
		idx=i;
		for (j=i+1; j<N; j++) {
			if (arr[idx]<arr[j]) {
				idx=j;
			}
		}
		tmp=arr[i];
		arr[i]=arr[idx];
		arr[idx]=tmp;
	}

  for (i=1; i<N; i++) {
    if (arr[i]!=arr[i-1]) cnt++;
  }

  printf("%d\n", cnt);
  return 0;
}

Measured memory_bytes: 128
n, m = map(int, input().split())
x = list(map(int, input().split())) # n
y = list(map(int, input().split())) # m

x.sort(reverse=True)
y.sort(reverse=True)

s = sum(x[i] * (n - 1 - 2 * i) for i in range(n))
t = sum(y[i] * (m - 1 - 2 * i) for i in range(m))
print((s * t) % (10 ** 9 + 7))

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;(int64)i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    vector<vector<int32>> cindex(26);
    REP(i,s.size()){
        cindex[s[i] - 'a'].pb(i);
        cindex[s[i] - 'a'].pb(i+s.size());
    }
    REP(i,26)sort(ALL(cindex[i]));
    int64 ans = 0;
    REP(i,t.size()){
        if(cindex[t[i] - 'a'].empty()){
            cout << -1 << endl;
            return 0;
        }
        ans = (ans / s.size()) * s.size() + *lower_bound(ALL(cindex[t[i] - 'a']), ans % s.size()) + 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2756
#include<bits/stdc++.h>
using namespace std;
#define lli long long
#define llmax LLONG_MAX   //ranges are defined in climits
#define llmin LLONG_MIN
#define imax INT_MAX
#define imin INT_MIN
#define pb push_back
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
  int k,s;
  cin>>k>>s;
  lli ans=0;
  for(int x=0;x<=k;x++)
  {
    for(int y=0;y<=k;y++)
    {
      if(s-x-y>=0 && s-x-y<=k)
      {
        ++ans;
      }
    }
  }
  cout<<ans;
	return 0;
}

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

int main(){
  int N;
  int d[110];
  cin >> N;
  for(int i = 0;i < N;i++){
    cin >> d[i];
  }
  int num[110] = {0};
  for(int i = 0;i< N;i++){
    num[d[i]]++;
  }
  
  int res = 0;
  for(int i = 1;i <=100;i++){
    if(num[i]>0){
      res++;
    }
  }
  cout << res << endl;
}

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

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

  do {
    a -= d;
    c -= b;
  } while (a > 0 && c > 0);

  
  if (a <= 0 && c <= 0) {
    cout << "Yes" << endl;
  } else {
    if (a < c) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3628
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader bf = 
            new BufferedReader(new InputStreamReader(System.in));
        String[] str = bf.readLine().split("");
        int[] color = new int[str.length];
        for(int i = 0; i < color.length; i++){
            color[i] = Integer.parseInt(str[i]);
        }
        int num1 = 0,
            num2 = 0;
        for(int i = 0; i < color.length; i++){
            if(i%2 == color[i]){
                num1++;
            }
            else{
                num2++;
            }
        }        
        System.out.println(Math.min(num1, num2));
    }
}

Measured memory_bytes: 32340
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i < (n); ++i)  //0スタート
#define rep1(i,n) for (int i = 1; i < (n); ++i)  //1スタート
#define REP(i,a,b) for (int i = a; i < (b); ++i)  //aからbまで
#define mREP(i,a,b) for (int i = a; i > (b); --i)  //aからbまで
#define print(x) cout<<x<<endl  //xを改行付きで出力
#define scan(x) cin>>x //xを入力
const int INF = 1000000007;  //最大値兼MOD
//  cin.tie(0);
//  ios::sync_with_stdio(false);
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main(){
  int a = 10;
  int b = 10;
  int i = 0;
  while(1){
    cin>>a>>b;
    if(a == 0 && b == 0)return 0;
    cout<<min(a,b)<<" "<<max(a,b)<<endl;
  }

  return 0;
}


Measured memory_bytes: 3092
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int n,a,ans=1,minn;;
	scanf("%d",&n);
	scanf("%d",&minn);
	for(int i=2;i<=n;i++){
		scanf("%d",&a);
		if(a<=minn){
			ans++;
			minn=a;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    char s[10];
    scanf("%s", s);
    sort(s, s+4);
    printf((s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) ? "Yes\n" : "No\n");
}

Measured memory_bytes: 128
while True:
    hw = list(map(int, input().split()))
    if hw[0] == 0 and hw[1] == 0:
        break
    else:
        for i in range(hw[0]):
            if i > 0:
                print()
            if i % 2 == 0:
                for j in range(hw[1]):
                    if j % 2 == 0:
                        print("#", end="")
                    else:
                        print(".", end="")
            else:
                for j in range(hw[1]):
                    if j % 2 == 0:
                        print(".", end="")
                    else:
                        print("#", end="")
        print("\n")



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

int main()
{

	string InStr;
	char   *OutStr;

	cin >> InStr;

	OutStr = new char[ InStr.length() ];

	for( unsigned int i = 0; i < InStr.length(); i++ ) {
		
		if( InStr[i] - 3 > 64 ) {
			OutStr[i] = InStr[i] - 3;
		}
		else {
			OutStr[i] = InStr[i] + 23;
		}

	}

	for (unsigned int i = 0; i < InStr.length(); i++) {
		cout << OutStr[i];
	}

	cout << endl;

	delete []OutStr;

	return 0;

}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
using namespace std;
int a[100010];
int main(){
    string s;
    cin>>s;
    for(int i=0;s[i];){
        int tmp=0;
        if(s[i]=='R'){
            while(s[i]=='R'){
                i++;
                tmp++;
            }
            if(tmp&1){
                a[i-1]+=tmp/2+1;
                a[i]+=tmp/2;
            }
            else {
                a[i]+=tmp/2;
                a[i-1]+=tmp/2;
            }
        }
        else {
            int pos=i;
            while(s[i]=='L'){
                i++;
                tmp++;
            }
            if(tmp&1){
                a[pos]+=tmp/2+1;
                a[pos-1]+=tmp/2;
            }
            else {
                a[pos]+=tmp/2;
                a[pos-1]+=tmp/2;
            }
        }
    }
    for(int i=0;s[i];++i)
        cout<<a[i]<<" ";
    cout<<endl;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  
  bool flag = false;
  for (int i = 0; i < s.size() - 1; i++) {
    for (int j = i + 1; j < s.size(); j++) {
      if (s.at(i) == 'C' && s.at(j) == 'F') flag = true;
    }
  }
  
  if (flag) cout << "Yes\n";
  else cout << "No\n";
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[110],ans;
bool cmp(int a,int b)
    {
        return a>b;
    }
int main()
    {
        cin>>n;
        for(int i=1;i<=n;i++)
            {
                cin>>a[i];
            }
        sort(a+1,a+n+1,cmp);
        for(int i=1;i<=n;i++)
            {
                if(i%2!=0) ans+=a[i];
                else ans-=a[i];
            }
            cout<<ans<<endl;
    }


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner scanner = new Scanner(System.in);
		int num = scanner.nextInt();
		int[] array = new int[num];
		int count = 0;
		for (int i = 1; i < num + 1; i++) {
			if (scanner.hasNextInt()) {
				int a = scanner.nextInt();
				array[i - 1] = a;
				if (i > a) {
					if (array[a - 1] == i) count++;
				}
			}
		}
		scanner.close();
		System.out.println(count);
	}
}


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

int a,b,c,d;

int main(){
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a+b>c+d){printf("Left\n");}
    else if(a+b<c+d){printf("Right\n");}
    else{printf("Balanced\n");}
}


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

int main(){
  int n,m;
  cin>>n>>m;
  vector<vector<int>>jobs(m);
  rep(i,n){
    int a,b;
    cin>>a>>b;
    if(a>m)continue;
    jobs[m-a].push_back(b);
  }
  priority_queue<int>q;
  ll ans=0;
  for(int i=m-1;i>=0;--i){
    for(int b:jobs[i]){
      q.push(b);
    }
    if (!q.empty()){
      ans+=q.top();
      q.pop();
    }
  }  

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

Measured memory_bytes: 5504
X,N = map(int, input().split())
flg=False
i=1

if N==0:
  Ans=X
else:
  S=list(map(int, input().split()))
#  S.sort()
  if X not in S:
    Ans=X
    flg=True
    
  while not flg:
    if X-i not in S:
      Ans=X-i
      flg=True
      break
    elif X+i not in S:
      Ans=X+i
      flg=True
      break
    else:
      i+=1
      
print(Ans)


Measured memory_bytes: 9128
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, p; cin >> a >> p;
    int sum = a * 3 + p;
    cout << sum / 2 << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void open() {
	freopen("datain.txt","r",stdin);
}
int main() {
	//open();
	int n,pick,sum;
	cin>>n>>pick;
	int *stick;
	stick=new int [n];
	for (int i=0;i<n;++i) cin>>stick[i];
	sort(stick,stick+n);
	for (int i=n-1;pick--;--i) sum+=stick[i];
	cout<<sum<<endl;
	return 0;
}

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

int main (){
  int N;
  cin >> N;
  
  vector<int> d(N);
  for (int i=0;i<N;i++){
    cin >> d[i];
  }
  
  sort(d.begin(),d.end());
  
  cout << d[N/2]-d[N/2-1] << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

class Main{
  public static void main(String[] arg){
    Scanner scan=new Scanner(System.in);
    int num=scan.nextInt();
    int Ans=0;
    if(num<10){
      Ans+=num;
    }else{
      Ans+=9;
    }
    if(num>=100 && num<1000){
      Ans+=num-99;
    }else if(num>=1000){
      Ans+=900;
    }
    if(num>=10000 && num<100000){
      Ans+=num-9999;
    }else if(num>=100000){
      Ans+=90000;
    }
    System.out.println(Ans);
  }
}

Measured memory_bytes: 23892
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>

using namespace std;

#define ll long long
#define el '\n'
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repi(i, a, b) for (int i = a; i >= b; i--)
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define mp make_pair
#ifdef LOCAL
#define debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#define check(...) assert(__VA_ARGS__)
#else
#define debug(fmt, ...)
#define check(...)
#endif

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

    string s;
    cin >> s;
    deque<char> sq;
    for (auto x: s) {
        sq.push_back(x);
    }
    int q;
    cin >> q;
    bool reversed = false;
    while (q--) {
        int t, f;
        char c;
        cin >> t;
        if (t == 2) {
            cin >> f >> c;
        }
        if (t == 1) {
            reversed = !reversed;
        } else {
            if (reversed) {
                f = 3 - f;
            }
            if (f == 1) {
                sq.push_front(c);
            } else {
                sq.push_back(c);
            }
        }
    }
    if (reversed) {
        reverse(sq.begin(), sq.end());
    }
    for (auto x : sq) {
        cout << x;
    }
}


Measured memory_bytes: 960
#include<iostream>

int main(){
  int a=1;
  char s[4];
  std::cin >> s;
  for(int i=0;i<3;i++)
    switch(s[i]){
    case 'a':
      a*=2;
      break;
    case 'b':
      a*=3;
      break;
    case 'c':
      a*=5;
      break;
    }
  std::cout << ((a==30)?"Yes":"No");
  return 0;
}

Measured memory_bytes: 256
program shift_only
  implicit none
  integer :: n, a(200) = 0, i
  read(*,*) n
  read(*,*) a(1:n)
  do i = 0, 50
    if (any(mod(a(1:n),2) == 1)) then
      write(*,'(i0)') i
      stop
    end if
    a(1:n) = a(1:n)/2
  end do
end program shift_only

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
using ll = long long;
using pll = pair<ll,ll>;
const ll INF64 = 1LL << 60;
const int INF = (1 << 29);

int main(){
    int sx,sy,tx,ty; cin >> sx >> sy >> tx >> ty;
    int dx = tx - sx;
    int dy = ty - sy;
    string ans;
    rep(i,dx) ans.push_back('R');
    rep(i,dy) ans.push_back('U');
    rep(i,dx) ans.push_back('L');
    rep(i,dy) ans.push_back('D');
    ans.push_back('D');
    rep(i,dx+1) ans.push_back('R');
    rep(i,dy+1) ans.push_back('U');
    ans.push_back('L');
    ans.push_back('U');
    rep(i,dx+1) ans.push_back('L');
    rep(i,dy+1) ans.push_back('D');
    ans.push_back('R');

    cout << ans << endl;
}

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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()

using ll = std::int64_t;
using vint = std::vector<int>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    ll n;
    ll t[5];
    cin >> n;
    rep(i, 5) {
        cin >> t[i];
    }

    rep(i, 4) {
        if (t[i] < t[i + 1]) t[i + 1] = t[i];
    }
    ll ans = 4 + (n + (t[4] - 1)) / t[4];
    cout << ans << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static int[] dy = new int[4] { 0, 1, 0, -1 };
    static int[] dx = new int[4] { 1, 0, -1, 0 };
    static void Main()
    {
        var HW = ReadLine().Split().Select(int.Parse).ToArray();
        int H = HW[0], W = HW[1];
        var S = new bool[H, W];
        for (int i = 0; i < H; i++)
        {
            var line = ReadLine();
            for (int j = 0; j < W; j++)
            {
                S[i, j] = line[j] == '.';
            }
        }

        int ans = 0;
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                if (!S[i, j]) continue;

                var que = new Queue<(int y, int x, int c)>();
                que.Enqueue((i, j, 0));
                bool[,] frag = new bool[H, W];
                frag[i, j] = true;

                while (que.Count > 0)
                {
                    var p = que.Dequeue();

                    for (int k = 0; k < 4; k++)
                    {
                        int ny = p.y + dy[k];
                        int nx = p.x + dx[k];
                        int nc = p.c + 1;

                        if (0 <= ny && ny < H && 0 <= nx && nx < W)
                        {
                            if (S[ny, nx]&&!frag[ny,nx])
                            {
                                frag[ny, nx] = true;
                                que.Enqueue((ny, nx, nc));
                            }
                        }
                    }
                    if (que.Count == 0) ans = Max(ans, p.c);
                }
            }
        }
        WriteLine(ans);
    }
}


Measured memory_bytes: 28556
#include <math.h>
#include <string.h>
 
int main(){
    int dice[6];
    char p[101];
    int i;
     
    for(i = 0;i < 6;i++)
        scanf("%d",&dice[i]);
     
    scanf("%s",p);
     
    for(i = 0;i < strlen(p);i++){
        int tmp = dice[0];
        switch(p[i]){
            case 'W':
                dice[0] = dice[2];dice[2] = dice[5];dice[5] = dice[3];dice[3] = tmp;
            break;
            case 'E':
                dice[0] = dice[3];dice[3] = dice[5];dice[5] = dice[2];dice[2] = tmp;
            break;
            case 'S':
                dice[0] = dice[4];dice[4] = dice[5];dice[5] = dice[1];dice[1] = tmp;
            break;
            case 'N':
                dice[0] = dice[1];dice[1] = dice[5];dice[5] = dice[4];dice[4] = tmp;
            break;
        }
    }
     
    printf("%d\n",dice[0]);
    return 0;
}

Measured memory_bytes: 596
#include <math.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
using ll = long long;
const int INF = 1e8;

int main() {
  ll X, Y;
  cin >> X >> Y;
  ll ans = 1;
  ll A = X;
  while (1) {
    A = A * 2;
    if (A > Y) {
      break;
    }
    ans++;
  }
  cout << ans << endl;
  return 0;
}


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

#define rng(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define pb push_back
#define eb emplace_back
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed

int main() {
  int n, a, b, c, d, ans = 0;
  //string s;
  cin >> a >> b >> c >> d;
  //vector<int> v(n), c(n);
  //if(1) {}
  //for(int i = 0; i < n; i++){}
  cout << ((c / b + (c % b != 0) <= a / d + (a % d != 0))? "Yes" : "No") << endl;
}

Measured memory_bytes: 3636
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]

if M == 0:
    if N == 1:
        print(0)
    else:
        print(10 ** (N - 1))
    exit()

arr = [-1] * (N + 1)

for s, c in SC:
    if arr[s] != -1 and arr[s] != c:
        print(-1)
        exit()
    else:
        arr[s] = c
#print(arr)

answer = ""
for i in range(1, N + 1):
    if arr[i] != -1:
        answer += str(arr[i])
    else:
        if i == 1:
            answer += "1"
        else:
            answer += "0"
#print(answer)

if len(answer) == 1:
    print(answer)
else:
    if answer[0] == "0":
        print(-1)
    else:
        print(answer)

Measured memory_bytes: 3064