akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000;

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

    ll left = 4 * a * b;
    ll sqrt_right = c - a - b;
    if (sqrt_right > 0 && left < sqrt_right * sqrt_right) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    char a, b;
    cin >> a >> b;

    if(a=='H'&&b=='H') cout << 'H' << endl;
    else if(a=='H'&&b=='D') cout << 'D' << endl;
    else if(a=='D'&&b=='H') cout << 'D' << endl;
    else cout << 'H' << endl;
    return 0;
}


Measured memory_bytes: 3536
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  int ans = 0, bef = -1, c = 0;
  a.push_back(1000);
  for (int i = 0; i <= n; i++) {
    if (bef == a[i]) {
      c++;
    } else {
      ans += c / 2;
      c = 1;
      bef = a[i];
    }
  }
  cout << ans << endl;
  return 0;
}


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    int A, B;
    cin >> A >> B;
    A = (A + 12) % 14;
    B = (B + 12) % 14;
    if (A > B)
    {
        cout << "Alice";
    }
    else if (A < B)
    {
        cout << "Bob";
    }
    else
    {
        cout << "Draw";
    }
    cout << endl;
    return 0;
}

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

int main()
{
  int N, A;
  cin >> N;
  vector<int> color_list(0);
  color_list.push_back(2);
  for (int i = 0; i < N; ++i)
  {
    cin >> A;
    A = -A;
    int index = lower_bound(color_list.begin(), color_list.end(), A + 1) - color_list.begin();
    if (index == color_list.size())
    {
      color_list.push_back(A);
    }
    color_list.at(index) = A;
  }
  cout << color_list.size() << endl;
}


Measured memory_bytes: 892
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int [] a = new int[n];
        for(int i=0; i<a.length;i++){
            a[i] = sc.nextInt();
        }
        for(int j=a.length; j>0;j--){
            if(j != 1) System.out.printf("%d ",a[j-1]);
            else System.out.printf("%d",a[j-1]);
        }
        System.out.println();
        sc.close();
    }
}


Measured memory_bytes: 26432
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>
#include <stack>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using Graph = std::vector<std::vector<int> >;
const int INF = 1e17;
/* libraries */

struct S
{
	int a,b;
	S(int a, int b) : a(a),b(b) {}
	bool operator<(const S rhs) const {
		if(b>=0 && rhs.b<0) return true;
		if(b<0 && rhs.b>=0) return false;
		if(b>=0 && rhs.b>=0) {
			return a<rhs.a;
		}
		if(b<0 && rhs.b<0) {
			return a+b>rhs.a+rhs.b;
		}
	}
};

signed main() {
	int n;
	std::cin >> n;
	std::vector<std::string> s(n);
	rep(i,n) std::cin >> s[i];
	std::vector<int> a(n,0),b(n,0);
	int A=0,B=0;
	rep(i,n) {
		debug(i);
		std::stack<char> stack;
		for(auto c:s[i]) {
			if(stack.empty()) {
				stack.emplace(c);
				continue;
			}
			char x = stack.top();
			if(x==')' || x==c) stack.emplace(c);
			else {
				stack.pop();
			}
		}
		while(!stack.empty()) {
			char x = stack.top();
			stack.pop();
			if(x=='(') a[i]++;
			else b[i]++;
		}
		A+=a[i];
		B+=b[i];
	}
	// need start and end, everything needs to add up
	if(A!=B) {
		print("No");
		return 0;
	}
	std::vector<S> v;
	rep(i,n) {
		v.emplace_back(b[i],a[i]-b[i]);
	}
	std::sort(all(v));
	debug(a,b);
	int curr = 0;
	rep(i,n) {
		if(v[i].a>curr) {
			print("No");
			return 0;
		}
		curr+=v[i].b;
	}
	if(curr==0) print("Yes");
	else print("No");

	return 0;
}


Measured memory_bytes: 66576
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    int sum[10];
    memset(sum,0,sizeof(sum));
    cin>>a>>b>>c;
    sum[a]++;
    sum[b]++;
    sum[c]++;
    if(sum[a]==2||sum[b]==2||sum[c]==2)
        cout<<"Yes";
    else    cout<<"No";
}


Measured memory_bytes: 256
import sys

p = [0] * 51
for i in range(10):
    p[i] = p[36-i] = (i+3)*(i+2)*(i+1)//6

for i in range(10,19):
    p[i] = p[36-i] = (i+1)*(i+2)*(i+3)//6 - 2*(i-9)*(i-8)*(i-7)//3

for i in sys.stdin:
    print(p[int(i)])

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

int solve(int p,int q,int a,int n,int cur,int mult){
	if(n >= 0 && p == 0) return 1;
	if(n <= 0 || p <= 0) return 0;

	int res = 0;
	for(int i=cur;mult*i<=a;i++){
		res += solve(p*i-q,q*i,a,n-1,i,mult*i);
	}
	return res;
}

int main(void){
	int p,q,a,n;

	while(cin>>p>>q>>a>>n && p){
		cout<<solve(p,q,a,n,1,1)<<endl;
	}

	return 0;
}

Measured memory_bytes: 868
package main
 
import(
  "fmt"
  "bufio"
  "os"
  "strings"
  "strconv"
  "log"
)
 

func main(){
    a,b := 0,0
    fmt.Scan(&a)
    fmt.Scan(&b)
    if a > b{
    	fmt.Println("a > b")
    }else if a < b{
    	fmt.Println("a < b")
    }else{
    	fmt.Println("a == b")
    }
}


var sc = bufio.NewScanner(os.Stdin)

func Rr() []string {
  sc.Scan()
  slice := strings.Split(sc.Text(), " ")
  return slice
}



//入力関係ライブラリ(Atcoder:yamanobori_oldさんのもの)
func make_liner(maxByte int) *bufio.Scanner {
  liner := bufio.NewScanner(os.Stdin)
  liner.Buffer(make([]uint8, 0, 8192), maxByte)
  return liner
}
func word_spliter() *bufio.Scanner {
  words := make_liner(8192) 
  words.Split(bufio.ScanWords)
  return words
}

func eGetLine(r *bufio.Scanner) string {
  if r.Scan() {
    return r.Text()
  }
  err := r.Err()
  if err != nil {
    log.Fatal(err)
  }
  // EOF
  return ""
}

func eGetInt(r *bufio.Scanner) int {
  line := eGetLine(r)
  return eAtoi(line)
}

func eAtoi(s string) int {
  n, err := strconv.Atoi(s)
  if err != nil {
    log.Fatal(err)
  }
  return n
}


Measured memory_bytes: 1120
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, Y = list(map(int, sys.stdin.readline().split()))

# 1万円だけ全パターン決めちゃう
ans = -1, -1, -1
for c10 in range(N + 1):
    rn = N - c10
    ry = Y - c10 * 10000
    if (ry - rn * 1000) % 4000 == 0:
        y = (ry - rn * 1000) / 4000
        x = rn - y
        if 0 <= x <= N and 0 <= y <= N:
            ans = c10, y, x
            break
print(' '.join(map(str, map(int, ans))))


Measured memory_bytes: 20036
#include <bits/stdc++.h>
using namespace std;
#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++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main() {
	int N, A, B; cin >> N >> A >> B;
	string S; cin >> S;
	set<pair<int, char>> cs; // contestants
	rep(i, N) {
		pair<int, char> p(i + 1, S.at(i));
		cs.insert(p);
	}
	int q = 0; // 通過確定者数
	int qf = 0; // 海外の学生の数
	for (auto p : cs) {
		char c = p.second;
		if (c == 'a') {
			if (q < A + B) {
				cout << "Yes" << endl;
				q++;
			} else {
				cout << "No" << endl;
			}
		} else if (c == 'b') {
			if (q < A + B && qf < B) {
				cout << "Yes" << endl;
				q++;
			} else {
				cout << "No" << endl;
			}
			qf++;
		} else {
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
int two(int &a){
  int count=0;
  while(a%2 == 0){ 
    a /= 2;
    count++;
  }
  return count;
}
int main(){
  int n;
  cin >> n;
  vector<int> number(n);
  int ans=0;
  for(int i=0; i<n; i++){
    cin >> number.at(i);
    ans += two(number.at(i));
     }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int a,b,c,d;

    cin>>a>>b>>c>>d;

    int x=(a-1)/d+1,y=(c-1)/b+1;
    bool bo=1;
    if (x<y)
        bo=0;


    bo?cout<<"Yes":cout<<"No";
}


Measured memory_bytes: 3616
#include <stdio.h>

int main(void){
    char sign[256];
    int i;
    int j,takahashi=0;
    
    for(i=1;i<=4;i++){
        scanf("%s",sign);
    }
    
    for(j=1;j<=4;j++){
        if(sign[j-1]=='+'){
            takahashi++;
        }else{
            takahashi--;
        }
    }
    
    printf("%d\n",takahashi);
    
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
/*int main(){
    
    ll n;
    while (cin>>n) {
        vector<ll> v;
        for(int i=0;i<n+1;i++){
            v.push_back(i);
        }
        ll b=v[v.size()-1];
        for(int i=2;i<=n;i++){
            ll j=2;
            while(i*j<=b){
                v[i*j]=0;
                j++;
            }
        }
        ll ans=0;
        for(int i=0;i<v.size();i++){
           // cout<<v[i]<<endl;
            if(v[i]!=0)ans++;
        }
        cout<<ans-1<<endl;
    }
    
    
    return 0;
}*/
int main(){
    
    ll n;
    while(cin>>n){
       /* ll ans=0;
        for(int i=3;i<=n;i+=2){
            int flag=0;
        for(int j=3;j<=sqrt(i);j+=2){
            if(i%j==0){
                flag=1;
                break;
            }
        }
            if(flag==0){
                ans++;
            }
    }
        cout<<ans+1<<endl;*/
        
        vector<bool> IsPrime;
        if(n+1>IsPrime.size()){
            IsPrime.resize(n+1,true);
        }
        IsPrime[0]=false;
        IsPrime[1]=false;
        for(int i=2;i<=sqrt(n);i++){
            if(IsPrime[i])
                for(ll j=2;i*j<=n;++j){
                    IsPrime[i*j]=false;
        }
        
        }
        ll ans=0;
        for(int i=0;i<IsPrime.size();i++){
            if(IsPrime[i])ans++;
        }
        cout<<ans<<endl;
        }
    
    return 0;
}



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

namespace AtTest.ABC_141
{
    class B
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            string s = Read();
            for(int i = 0; i < s.Length; i++)
            {
                if (i % 2 == 0)
                {
                    if(s[i]=='L')
                    {
                        WriteLine("No");
                        return;
                    }
                }
                else
                {
                    if (s[i] == 'R')
                    {
                        WriteLine("No");
                        return;
                    }
                }
            }
            WriteLine("Yes");
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

// 内部定数
#define D_CARD_MAX		2000									// 最大カード枚数

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

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i;
	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

	// カード枚数・初期値取得
	int liCCnt, liZ, liW;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d%d%d", &liCCnt, &liZ, &liW);

	// カード取得
	int li1Card[D_CARD_MAX];
	for (i = 0; i < liCCnt; i++) {
#ifdef D_TEST
		fscanf(szpFpT, "%d", &li1Card[i]);
#else
		fscanf(stdin, "%d", &li1Card[i]);
#endif
	}
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif

	// スコア取得
	int liScore;
	if (liCCnt == 1) {						// １枚
		liScore = abs(li1Card[0] - liW);
	}
	else {									// ２枚以上

		// 全部引く場合
		liScore = abs(li1Card[liCCnt - 1] - liW);

		// １枚残す場合
		int liVal = abs(li1Card[liCCnt - 2] - li1Card[liCCnt - 1]);
		if (liScore < liVal) {
			liScore = liVal;
		}
	}

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

	// 結果表示
#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
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1193&lang=jp

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

int H;
vector<vector<int>> field;

int erase(int cnt, int h, int st, int ed)
{
	int res=0;
	if(cnt>=3){
		for( int i=st; i<=ed; ++i ){
			res += field[h][i];
			field[h][i] = 0;
		}
	}

	return res;
}

int chain()
{
	int res=0;
	int prev=0,cnt=0,st=0;
	rep(h,H){
		rep(w,5){
			if( w>0 && prev==field[h][w] && field[h][w] ){ 
				cnt++;
				if(w==4){ res += erase(cnt,h,st,w); }
			}else{
				res += erase(cnt,h,st,w-1);
				st=w; 
				cnt=1;
				prev=field[h][w];
			}
		}
	}
	return res;
}

void fall()
{
	int cnt=0;
	while(true)
	{
		for( int h=H-1; h>0; --h ){
			for( int w=5-1; w>=0; --w){
				if(field[h][w]==0 && field[h-1][w]){
					swap(field[h][w],field[h-1][w]);
					cnt++;
				}
			}
		}
		if(cnt==0) break;
		cnt=0;
	}
	return;
}

int main()
{
	while( cin>>H && H )
	{
		field.assign( H, vector<int>(5,0) );
		rep(h,H){
			rep(w,5){
				cin >> field[h][w];
			}
		}
		
		int score=0,ans=0;
		while(true)
		{
			score = chain();
			if(score==0){ break; }
			ans += score;
			fall();
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
from sys import stdin
input = stdin.readline
n = input()
list1 = [2,4,5,7,9]
list2 = [0,1,6,8]
list3 = [3]
if int(n[int(len(n)-2)]) in list1:
  print("hon")
elif int(n[int(len(n)-2)]) in list2:
  print("pon")
elif int(n[int(len(n)-2)]) in list3:
  print("bon")

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int cnt;
string s,ans[2] = {"Second", "First"};

signed main() {
    cin >> s;
    cout << ans[(s[0] == s[s.size()-1]) ^ (s.size()%2)] << endl;
}


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

#define MAX 1000000

int main(){
	bool p[MAX+1];
	int n, sum;

	p[0] = false;
	p[1] = false;
	for(int i=2 ; i<=MAX ; i++){
		p[i] = true;
	}
	for(int i=2 ; i<=sqrt(MAX)+1 ; i++){
		if(p[i]==1){
			for(int j=i*2; j<=MAX; j=j+i){
				p[j] = false;
			}
		}
	}
	
	while( scanf("%d" , &n) != EOF , n){			
		sum = 0;
		for(int i=0; n>0; i++){
			if(p[i]){
				sum += i;
				n--;
			}
		}
		printf("%d\n", sum);
	}
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main(void){
  int a, b, c;
  cin >> a >> b >>c;
  if(a == b + c) cout <<"Yes"<< endl;
  else if(b == a + c) cout <<"Yes"<< endl;
  else if(c == a + b) cout <<"Yes"<< endl;
  else cout << "No" << endl;
  return 0;
}

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

int main(){
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> money(n+1);
    rep(i,m){
        int a;
        cin >> a;
        money[a]++;
    }
    int ans = 1e5;
    int sum = 0;
    for(int i = x; i <= n; i++) sum += money[i];
    ans = min(ans, sum);
    sum = 0;
    for(int i = 0; i <= x; i++) sum += money[i];
    ans = min(ans, sum);
    cout << ans << endl;
}

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

int main() {
	int n;
	cin >> n;
	int a[n + 1], b[n + 1];
	for(int i = 1; i <= n; i++) {
        cin >> a[i];
        b[i] = a[i];
	}
	sort(b + 1, b + 1 + n);
	unordered_map<int, int> index;
	for(int i = 1; i <= n; i++) {
        index[b[i]] = i;
	}
	int cnt = 0;
	for(int i = 1; i <= n; i++) {
        if(i % 2 != index[a[i]] % 2) {
            cnt++;
        }
	}
	cout << cnt / 2 << endl;
	return 0;
}


Measured memory_bytes: 8128
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator sl
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define U (LL)0
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
map<LL,LL>v,u;
V<LL>w;
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,t,z;
    cin>>n;
    k=0;
   for(i=0;i<n;i++)
   {
       cin>>o;
       k+=o;
   }
   cout<<k-n<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

vector<pair<ll, ll>> factorize(ll n) {
    vector<pair<ll, ll>> res;
    for (ll i = 2; (i * i) <= n; i++) {
        if (n % i) continue;
        res.emplace_back(i, 0);
        while((n % i) == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1);
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    ll suma = accumulate(all(a), 0LL);
    auto fac = factorize(suma);
    set<ll> div;
    div.insert(1);
    rep(i, sz(fac)) {
        rep(j, fac[i].second) {
            set<ll> add;
            for(auto x : div) add.insert(x * fac[i].first);
            for(auto x : add) div.insert(x);
        }
    }
    ll ans = a[0];
    rep(i, n) ans = __gcd(ans, a[i]);
    for(auto x : div) {
        vector<ll> moda(n);
        rep(i, n) moda[i] = a[i] % x;
        sort(all(moda));
        vector<ll> ldp(n + 1, 0), rdp(n + 1, 0);
        rep(i, n) ldp[i + 1] = ldp[i] + moda[i];
        rep(i, n) rdp[i + 1] = rdp[i] + (x - moda[i]) % x;
        bool f = false;
        reps(i, 1, n) {
            ll left = ldp[i];
            ll right = rdp[n] - rdp[i];
            if ((abs(left - right) % x == 0) && (max(left, right) <= k)) {
                f = true;
                break;
            }
        }
        if (f) ans = max(ans, x);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define pf push_front
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int f[50]={};

int fib(int n){
  if(n==0||n==1)return f[n]=1;
  if(f[n]!=0)return f[n];
  return f[n]=fib(n-1)+fib(n-2);
}

signed main(){
  int n;
  cin>>n;
  cout<<fib(n)<<endl;

  return 0;
}

Measured memory_bytes: 3080
a, b, c, d = [int(item) for item in input().split()]
path = ""
path += "R" * (c-a) + "U" * (d-b) + "L" * (c-a) + "D" * (d-b)
path += "D" + "R" * (c-a+1) + "U" * (d-b+1) + "L"
path += "U" + "L" * (c-a+1) + "D" * (d-b+1) + "R"
print(path)

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

int main(){
	int N;
	cin>>N;
	int h[N];
	for(int i=0;i<N;++i)cin>>h[i];
	int ans=0;
	while(true){
		/*
		for(int i=0;i<N;++i){
			cout<<h[i]<<" ";
		}
		cout<<endl;
		*/
		int r=-1;
		int l=-1;
		for(int i=0;i<N;++i){
			if(h[i]>0 && r==-1)r=i;
			if(h[i]==0 && r!=-1 && l==-1)l=i-1;
		}
		if(r!=-1 && l==-1)l=N-1;
		//cout<<r<<" "<<l<<endl;
		for(int i=r;i<=l;++i)h[i]--;
		if(r==-1)break;
		ans++;
	}
	cout<<ans<<endl;
}


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

ST = [[int(x) for x in input().split()] for y in range(n)]
CH = [[int(x) for x in input().split()] for y in range(m)]

for a, b in ST:
    manhat = [abs(a - c) + abs(b - d) for c, d in CH]
    print(manhat.index(min(manhat)) + 1)


Measured memory_bytes: 3060
gets.to_i.times{
y,m,d = gets.split(" ")
y = y.to_i
m = m.to_i
d = d.to_i
c=0
while y!=1000
  d+=1
  if y%3==0
    if d==21
      d=1
      m+=1
    end
  else
    if m%2==0
      if d==20
        m+=1
        d=1
      end
    else
      if d==21
        m+=1
        d=1
      end
    end
  end
  
  if m==11
    m=1
    y+=1
  end
  c+=1  
end
puts c
}

Measured memory_bytes: 2312
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			int[] s = new int[N];
			int sum = 0;
			for (int i = 0; i < N; ++i) {
				s[i] = sc.nextInt();
				sum += s[i];
			}
			Arrays.sort(s);
			sum -= s[0] + s[N - 1];
			System.out.println(sum / (N - 2));
		}
	}
}

Measured memory_bytes: 21028
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, _) = (v[0], v[1]);
    let v = read_vec::<usize>();
    let mut residual = v.into_iter().skip(1).collect::<HashSet<_>>();
    for _ in 1..n {
        let v = read_vec::<usize>();
        let tmp_residual = v.into_iter().skip(1).collect::<HashSet<_>>();
        let mut not_founds = vec![];
        for i in residual.iter().cloned() {
            if !tmp_residual.contains(&i) {
                not_founds.push(i);
            }
        }
        for i in not_founds {
            residual.remove(&i);
        }
    }
    println!("{}", residual.len());
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
# 余剰と不足に分ける 余剰の多いやつから使って不足の多いやつに振る

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) < sum(b):
    print(-1)
    exit()

surplus = []
lack = []
for i in range(n):
    if a[i] > b[i]:
        surplus.append(a[i] - b[i])
    elif a[i] < b[i]:
        # 同値は含まない
        lack.append(b[i] - a[i])
if len(lack) == 0:
    print(0)
    exit()

surplus = sorted(surplus, reverse=True)
lack = sorted(lack, reverse=True)

# print(surplus, lack)

right = 0
ans = 1
for left in range(len(surplus)):
    while right < len(lack) and surplus[left] - lack[right] >= 0:
        surplus[left] -= lack[right]
        ans += 1
        right += 1
    if right == len(lack):
        break
    # ここまではギリギリ条件を満たしている
    if right < len(lack):
        # 次にleftを使わなきゃいけない
        ans += 1
        # あまったぶんを回す
        lack[right] -= surplus[left]
print(ans),

Measured memory_bytes: 24288
S = input()

d = [0] * (len(S) + 1)
for i in range(len(S)):
    if (S[i] == '<'):
        d[i + 1] = max(d[i + 1], d[i] + 1)
for i in range(len(S))[::-1]:
    if (S[i] == '>'):
        d[i] = max(d[i], d[i + 1] + 1)

print(sum(d))


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

using namespace std;


#define PI 3.14159265
#define int long long



main(){

	int n, a, b; cin >> n >> a >> b;

	cout << (n / (a + b)) * a + min(n % (a + b), a) << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
h,w,k=gets.split.map &:to_i
s=[]
h.times{s[_1]=gets.chomp}
ans = 0
[0,1].repeated_permutation(h+w) do |z|
  m=s.dup
  cnt=0
  h.times do |i|
    w.times do |j|
      cnt+=1 if m[i][j]=='#' && z[i]==0 && z[h+j]==0
    end
  end
  ans+=1 if cnt==k
end

puts ans


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

string s;
int n;
ll ans = 0;
void dfs(int i, ll value, ll sum, bool p) {
    value = value * 10 + (s[i] - '0');
    if (i >= n-2) {
        if (p) sum += value + (s[i+1] - '0');
        else sum += value * 10 + (s[i+1] - '0');
        ans += sum;
        return;
    }
    if (p) {
        sum += value;
        value = 0LL;
    }
    dfs(i+1, value, sum, true);
    dfs(i+1, value, sum, false);
}

int main(){
    cin >> s;
    n = s.size();
    if (n > 1) {
        dfs(0, 0LL, 0LL, true);
        dfs(0, 0LL, 0LL, false);
    }
    else ans = s[0] - '0';
    cout << ans << endl;
    return 0;
}


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

using namespace std;

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

	int ans = 0;

	for(int i = 1; i <= n; i++){
		int temp = i;
		int sum = 0;

		while(temp / 10 != 0){
			sum += temp % 10;
			temp /= 10;
		}

		sum += temp % 10;
		if(sum >= a && sum <= b){
			ans += i;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	char moji;
	cin >> moji;
	if (moji == 'A')
	{
		cout << 'T';
	}
	else if (moji == 'C')
	{
		cout << 'G';
	}
	else if (moji == 'G')
	{
		cout << 'C';
	}
	else
	{
		cout << 'A';
	}
	return 0;
}

Measured memory_bytes: 256
#F sugoroku
#貪欲にNからM以下の範囲で戻れるだけ戻ることにする
safe=[]
n,m=map(int,input().split())
field=list(input())
for i in range(n+1):
    if field[i]=="0":
        safe.append(i)
start=n

import bisect

deque=[]
flag=True
while start>0:
    if start>=m:
        index=bisect.bisect_left(safe,start-m)
        if safe[index]!=start:
            deque.append(start-safe[index])
            start=safe[index]           

        elif safe[index]==start:
            flag=False
            start=0              
    else:
        deque.append(start)
        start=0
if flag:
    deque=deque[::-1]
    print(*deque)
else:
    print(-1)        

Measured memory_bytes: 11028
const fs = require('fs');
const input: string[] = fs.readFileSync('/dev/stdin', 'utf-8').split('\n');
const n: number = parseInt(input[0]);
const D: number[] = input[1].split(' ').map(v => parseInt(v));

let sum = 0;
// i > j
for (let i = 1; i < n; ++i) {
  for (let j = 0; j < i; ++j) {
    sum += D[i] * D[j];
  }
} 

console.log(sum);

Measured memory_bytes: 7372
// AtCoder.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <string>

using namespace std;

int sumDigit(int i) {
	int sum = 0;
	while (i != 0) {
		sum += i % 10;
		i /= 10;
	}
	return sum;
}

int main()
{
	int N, A, B;
	cin >> N >> A >> B;
	int sum = 0;

	for (int i = 1; i <= N; i++) {
		int digit_sum = sumDigit(i);
		if (digit_sum >= A && digit_sum <= B) {
			sum += i;
		}
	}
	cout << sum << endl;
	return 0;
}



Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;



int main () {
	SpeedForce;
	cin >> k >> s;
	k = min(k, sz(s));

	for(int i = 0; i < k; ++i) cout << s[i];
	if (sz(s) > k) {
		cout << "...";
	}

	return Accepted;
}

// B...a

Measured memory_bytes: 17732
#include<stdio.h>

int GCD(int,int);
int main(){
  int x,y;
  int gcd;


  scanf("%d %d",&x,&y);
  gcd = GCD(x,y);

  printf("%d\n",gcd);
}

int GCD(int x,int y){
  int z;

  if(y>x){
    z = y;
    y = x;
    x = z;
  }
  while(1){
    z = x%y;
    if(z==0)break;
    x = y;
    y = z;
  }
  return y;
}



Measured memory_bytes: 2140
# coding:utf-8

INF = float('inf')


def inpl(): return list(map(int, input().split()))


N = int(input())
seat = [False] * 100000
for i in range(N):
    l, r = inpl()
    for j in range(l - 1, r):
        seat[j] = True

ans = 0
for s in seat:
    if s: ans += 1

print(ans)

Measured memory_bytes: 3828
#include<stdio.h>

int n,S[100000];
int search(int T){
  int left=0;
  int right=n;
  int mid;
  while(left < right){
    mid=(left + right)/2;
    if(T == S[mid])
      return 1;
    if(T > S[mid])
      left=mid+1;
    else if(T < S[mid])
      right=mid;
  }
  return 0;
}

int main(){
  int q,T,i,count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&T);
    if(search(T)){
      count++;
    }
  }
  printf("%d\n",count);
  return 0;
}


      



Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> a(n), b(n), ord(n);
  REP(i, n) { cin >> a[i] >> b[i]; }
  iota(ALL(ord), 0);
  sort(ALL(ord), [&](ll x, ll y) { return a[x] < a[y]; });

  ll ans = 0, now = 0;
  REP(i, n) {
    ll j = ord[i];
    ll c = min(b[j], m - now);
    ans += a[j] * c;
    now += c;
    if (now >= m) {
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
def LCS(S, T):
    LS = len(S); LT = len(T)
    if LT > LS:
        S, T = T, S
        LS, LT = LT, LS
    dp = [0] * (LT + 1)
    for s in S:
        dp_pre=dp[:]
        for j, t in enumerate(T):
            if s == t:
                dp[j + 1] = dp_pre[j] + 1
            elif dp[j + 1] < dp[j]:
                dp[j + 1] = dp[j]
    return dp[-1]

for _ in range(int(input())):
    print(LCS(input(), input()))



Measured memory_bytes: 5632
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n;
int cnt[6];
int tikan[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};

int main() {
	int i, j;
	
	cin >> n;
	rep(i, n) {
		int w, a;
		int num[3] = {0, 1, 2};
		cin >> w;
		rep(j, w) {
			cin >> a;
			swap(num[a], num[a + 1]);
		}
		int pos[3];
		rep(j, 3) { pos[num[j]] = j; }
		
		int type;
		if (pos[0] == 0 && pos[1] == 1 && pos[2] == 2) type = 0;
		if (pos[0] == 0 && pos[1] == 2 && pos[2] == 1) type = 1;
		if (pos[0] == 1 && pos[1] == 0 && pos[2] == 2) type = 2;
		if (pos[0] == 1 && pos[1] == 2 && pos[2] == 0) type = 3;
		if (pos[0] == 2 && pos[1] == 0 && pos[2] == 1) type = 4;
		if (pos[0] == 2 && pos[1] == 1 && pos[2] == 0) type = 5;
		cnt[type]++;
	}
	
	if (cnt[0] >= 1) { cout << "yes" << endl; return 0; }
	if (cnt[1] >= 2 || cnt[5] >= 2 || cnt[2] >= 2) { cout << "yes" << endl; return 0; }
	if (cnt[3] >= 1 && cnt[4] >= 1) { cout << "yes" << endl; return 0; }
	if (cnt[3] >= 3 || cnt[4] >= 3) { cout << "yes" << endl; return 0; }
	
	//高々5個になったので全探索できる
	vector<int> types;
	rep(i, 6) {
		rep(j, cnt[i]) { types.push_back(i); }
	}
	
	vector<int> perm;
	rep(i, types.size()) perm.push_back(i);
	
	do {
		int pos[3] = {0, 1, 2};
		rep(i, types.size()) {
			int type = types[perm[i]];
			rep(j, 3) {
				pos[j] = tikan[type][pos[j]];
			}
		}
		
		if (pos[0] == 0 && pos[1] == 1 && pos[2] == 2) {
			cout << "yes" << endl;
			return 0;
		}
	} while (next_permutation(perm.begin(), perm.end()));
	
	cout << "no" << endl;
	return 0;
}


Measured memory_bytes: 3156
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define sz(x) (int)(x).size();
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
int32_t main()
{
	
	map<string,int> mp;
	int n=in();
	string s;
	while(n--)
	{
		cin>>s;
		mp[s]++;
	}
	
	cout<<"AC x "<<mp["AC"]<<"\n";
	cout<<"WA x "<<mp["WA"]<<"\n";
	cout<<"TLE x "<<mp["TLE"]<<"\n";
	cout<<"RE x "<<mp["RE"]<<"\n";
	
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
typedef long long ll;
#define mod 1000000007
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; }

int main() {
  string s;
  cin >> s;
  int ans = 1000;
  rep(i, 0, 26) {
    int mx = 0;
    int cnt = 0;
    rep(j, 0, s.size()) {
      if(s[j] == 'a' + i) {
        mx = max(mx, cnt);
        cnt = 0;
      } else {
        cnt++;
      }
    }
    mx = max(mx, cnt);
    ans = min(ans, mx);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N, M;
    cin >> N >> M;
    vector<vi> g(N);
    REP(i, M) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].pb(b);
        g[b].pb(a);
    }

    vi col(N, -1);
    bool is_bipartite = true;
    function<void(int)> dfs = [&](int v) {
        FORE(w, g[v]) {
            if (col[w] != -1) {
                if (col[w] == col[v]) {
                    is_bipartite = false;
                }
                continue;
            }
            col[w] = col[v] ^ 1;
            dfs(w);
        }
    };
    col[0] = 0; dfs(0);

    if (is_bipartite) {
        int one = 0;
        REP(i, N) if (col[i]) one++;
        int another = N - one;
        dump(one, another);
        cout << (one * another - M) << endl;
    } else {
        cout << (N * (N - 1) / 2 - M) << endl;
    }
    return (0^_^0);
}



Measured memory_bytes: 8064
(let* ((x (read))
       (x (if (minusp x) (- x) x))
       (k (read))
       (d (read))
       (f (floor (/ x d))))
  (format t "~A~%"
          (if (>= f k)
              (- x (* d k))
              (abs (- x (* d f) (if (evenp (- k f)) 0 d))))))

Measured memory_bytes: 24160
while true
    n = gets.to_i
    break if n == 0

    arr, arr2 = [], Array.new(31, 0)
    n.times{
        line = gets.chomp.split
        arr << [line[0], line[2..-1].map(&:to_i), 0]
        arr.last[1].each{|t| arr2[t] += 1}
    }
    arr.each{|character| character[1].each{|t| character[2] += (n - arr2[t] + 1)}}
    arr.sort_by!{|name, ar, p| [p, name]}
    puts "#{arr[0][2]} #{arr[0][0]}"
end


Measured memory_bytes: 8924
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main() 
{
  string s; cin >> s;
  string m = " ";
  rep(i, s.size()){
    if(s[i] == ',')cout << m;
    else cout << s[i];
  }
  cout << endl;
  system("pause");
}

Measured memory_bytes: 504
#include<stdio.h>

int main(void)
{
	int h,w,i,j;
	while(1){
		scanf("%d %d",&h, &w);
                if(h == 0 && w == 0)break;
	        for(i = 0;i < h;i++){
		       	for(j = 0;j < w;j++){
		       		printf("#");
		       	}
		       	printf("\n");
	        }
		printf("\n");
        }
	return 0;
}

Measured memory_bytes: 572
import java.util.*;
public class Main {
	public static void main(String[] args){
	    Scanner sc = new Scanner(System.in);
        String value = sc.next();
        int charValue = value.charAt(0);
        if((charValue >= 65 && charValue < 90) || (charValue >= 97 && charValue < 122)){
            String next = String.valueOf( (char) (charValue + 1));
            System.out.println(next);
        }
        else if(charValue == 90 || charValue == 122) {
            System.out.println(String.valueOf( (char) (charValue)));
        }
        else {
            System.out.println("Please input Character");
        }
        
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
int main()
{
  char card[20001];
  int maze,i,mvc,j,fc,cm,end=0;
  while(1){
    cm=0;
    while(1){
      scanf("%c",&card[cm]);
      if(card[0]=='\n'){
	continue;
      }
      if(card[0]=='-'){
	goto theend;
      }
      if(card[cm]=='\n'&&cm!=0){
	break;
      }  
      cm++;
    }
    //printf("%s",card);//
    scanf("%d",&maze);
    fc=0;
    for(i=0;i<maze;i++){
      scanf("%d",&mvc);
      for(j=0;j<mvc;j++){
	card[fc+cm]=card[fc];
	fc++;
      }
    }
    for(i=0;i<cm;i++){
      printf("%c",card[fc]);
      fc++;
    }
    printf("%c",'\n');
  }
 theend:
  return 0;
}

Measured memory_bytes: 996
#include<iostream>
#include<string>
using namespace std;
int main(){
  string d[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  string s;
  cin >> s;
  for(int i = 0; i < 7; i++){
    if(s == d[i]){
      cout << 7 - i << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int n, m;
bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int x, y, z;
    cin >> x >> y >> z;
    cout << (int)((x - z) / (z + y)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

int main() {
    int n, s; cin >> n >> s;
    vector<int> a(n);
    REP(i, n) {
        scanf("%d", &a[i]);
    }
    int sum = a[0];
    int l = 0, r = 0;
    int ans = INF;
    while (r < n) {
        while (l <= r && sum >= s) {
            ans = min(ans, r - l + 1);
            sum -= a[l];
            l++;
        }
        r++;
        if (r == n) break;
        sum += a[r];
    }
    cout << ans % INF << endl;
    return 0;
}


Measured memory_bytes: 3488
/*
 ID: bradyawn
 PROG: contest
 LANG: C++11
 */

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <deque>
#include <string>
#include <cmath>
#include <map>
#include <unordered_map>
#include <utility>
#include <set>
#include <unordered_set>
#include <ctime>
#include <queue>
#include <stack>
#include <bitset>
#include <random>
#include <cstring>
#include <complex>
#include <cassert>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> i2;
typedef pair<ll,ll> ll2;

int S(ll x)
{
    int ret = 0;
    while (x != 0)
    {
        ret += x%10;
        x /= 10;
    }
    return ret;
}

int32_t main()
{
    //ifstream inf("");
    //ofstream outf("");
    //cout << setprecision(10);
    ios::sync_with_stdio(0); cin.tie(0);
    
    int k; cin >> k;
    
    ll x = 1;
    ll add = 1;
    while (k--)
    {
        cout << x << endl;
        if ((x+10*add)*S(x+add) < (x+add)*S(x+10*add)) add *= 10;
        x += add;
    }
    
    return 0;
    
}




Measured memory_bytes: 256