akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
	cout << fixed << setprecision(10);
	vector<int> a(3);
	cin >> a[0] >> a[1] >> a[2];
	sort(a.begin(),a.end());
	int cnt = 0;
	while(a[0]<a[1]){
		a[0]+=2;
		cnt++;
	}
	sort(a.begin(),a.end());
 	if(a[0]==a[1]){
		cout << a[2] - a[0] + cnt << endl;
	}else{
		while(a[1]<a[2]){
			cnt++;
			a[0]++;
			a[1]++;
		}
		if((a[2]-a[0])%2==0) cout << cnt + (a[2]-a[0])/2 << endl;
		else cout << cnt+1+(a[2]+1-a[0])/2 << endl;
	}
 	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3") 
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx") 
#define __USE_MINGW_ANSI_STDIO 0
#include<bits/stdc++.h>                               
using namespace std;

#define PI acos(-1)
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(c) (c).begin(), (c).end()
#define TIMESTAMP fprintf(stderr, "Execution time: %.3lf s.\n", (double)clock()/CLOCKS_PER_SEC)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair <int, int> pii;
typedef vector <vi> vvi;
typedef vector <pii> vpii;
typedef vector<string> vs;

const int MAXN = 1e5 + 9;
const int MOD = (int)(1e9 + 7);
const int INF = 100500;

void input() {
	int n;
	cin >> n;
	vi aa(n + 1);
	for(int i = 1; i <= n; i++) cin >> aa[i];
	int pos = sz(aa) - 1;
	while(pos >= 1) {
		cout << aa[pos] << ' ';
		if(pos - 2 < 1) break;
		pos -= 2;
	}
	if(pos == 1) pos++;
	else pos--;
	while(pos < sz(aa)) {
		cout << aa[pos] << ' ';
		if(pos + 2 >= sz(aa)) break;
		pos += 2;
	}	
}

void solve() {

}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#ifdef LOCAL
	freopen("xxx.in", "r", stdin);
	freopen("xxx.out", "w", stdout);
#else
	//freopen("xxx.in", "r", stdin);
	//freopen("xxx.out", "w", stdout);
#endif	
	input();
	solve();
	return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
long long n,a[100001],x,ans,s;
int main()
{
    cin>>n>>x;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]+a[i-1]>x)
        {
            s=a[i]+a[i-1]-x;
            a[i]-=s;
            ans+=s;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class C
{
	public static void Main()
	{			
		string[] args = Console.ReadLine().Split(' ');
		int A = Int32.Parse(args[0]);
		int B = Int32.Parse(args[1]);
		int C = Int32.Parse(args[2]);
		int X = Int32.Parse(args[3]);
		int Y = Int32.Parse(args[4]);

		if(X < Y)
		{
			swap(ref A, ref B);
			swap(ref X, ref Y);
		}

		int ans = 0;
		ans += Y * ((A + B < 2 * C) ? (A + B) : 2 * C);
		ans += (X - Y) * ((A < 2 * C) ? A : 2 * C);

		Console.WriteLine(ans);
	}

	private static void swap(ref int x, ref int y)
	{
		int tmp = x;
		x = y;
		y = tmp;
	}
}





Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int count = 0;
        String ans = "No";
        for (int i = 0; i < n; i++) {
            count = sc.next().equals(sc.next()) ? count + 1 : 0;
            if(count == 3) {
                ans = "Yes";
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 35564
import sys

def get_left(i):
    return 2 * i + 1

def get_right(i):
    return 2 * i + 2

def get_parent(i):
    return int((i - 1) / 2)

def make_heap_tree(array, i, item_num):
    left = get_left(i)
    right = get_right(i)
    largest = i
    if (left < item_num) and (array[left] > array[largest]):
        largest = left
    if (right < item_num) and (array[right] > array[largest]):
        largest = right
    if largest != i:
        tmp = array[i]
        array[i] = array[largest]
        array[largest] = tmp
        make_heap_tree(array, largest, item_num)

def main():
    size = int(sys.stdin.readline().strip())
    array = map(lambda x: int(x), sys.stdin.readline().strip().split(" "))
    for i in reversed(range(0, get_parent(size) + 1)):
        make_heap_tree(array, i, size)
    print " " + " ".join(map(lambda x: str(x), array))

if __name__ == "__main__":
    main()

Measured memory_bytes: 61100
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
int mod = (int) 1e9 + 7;
 
int main(){
    
    int x, n;
    cin >> x >> n;
    
    if(n == 0){
        cout << x << "\n";
        return 0;
    }
    
    set<int> s;
      
    rep(i, n){
        int a;
        cin >> a;
        s.insert(a);
    }
    
    rep(i, 100){
        int a = x - i;
        int b = x + i;
        if(s.count(a) == 1 && s.count(b) == 1) continue;
        
        if(s.count(a) == 0){
            cout << a << "\n";
            return 0;
        } else {
            cout << b << "\n";
            return 0;
        }
        
    }
 
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=1000010;
const ll mod=1e9+7;

int main(){  
  int a,b,c;
  cin >> a >> b >> c;
  if(a==b+c||b==a+c||c==a+b){cout << "Yes" << endl;}else{cout << "No" << endl;}
  return 0;
}

Measured memory_bytes: 256
A, B, C = map(int, input().split())
K = int(input())

import itertools
import collections

l = [1, 2, 3]
h = itertools.combinations_with_replacement(l, 2)

for i in range(0, K + 1):
    h = itertools.combinations_with_replacement(l, i)
    for v in h:
        c = collections.Counter(v)
        n_a = A * (2**c[1])
        n_b = B * (2**c[2])
        n_c = C * (2**c[3])
        if n_c > n_b and n_b > n_a:
            print("Yes")
            exit()
print("No")


Measured memory_bytes: 9448
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func gets() string {
	sc.Scan()
	return sc.Text()
}

func toInt(value string) int {
	num, _ := strconv.Atoi(value)
	return num
}

func splitWithInt(value string) []int {
	vals := strings.Split(value, " ")
	nums := make([]int, len(vals))
	for index, elem := range vals {
		nums[index] = toInt(elem)
	}
	return nums
}

// A
func main() {
	inputs := splitWithInt(gets())
	A, B := inputs[0], inputs[1]
	if B % A == 0 {
		fmt.Println(A + B)
	} else {
		fmt.Println(B - A)
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>

using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio{
  int it,len;
  char s[LEN + 5];
  fastio(){
    it = len = 0;
  }
  char get(){
    if(it < len) return s[it++];
    it = 0, len = fread(s,1,LEN,stdin);
    return len ? s[it++] : EOF;
  }
  bool notend(){
    char c;
    for(c = get();c == ' ' || c == '\n';c = get());
    if(it) it--;
    return c != EOF;
  }
  void put(char c){
    if(it == LEN) fwrite(s,1,LEN,stdout), it = 0;
    s[it++] = c;
  }
  void flush(){
    fwrite(s,1,it,stdout);
  }
}buff,bufo;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline ll getll(){
  char c; ll res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline void putint(int x){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[15];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
}
inline void putll(ll x){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[25];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
}
inline char get_char(){
  char c;
  for(c = buff.get();c == ' ' || c == '\n';c = buff.get());
  return c;
}

int main(){
  int a = getint(), b = getint(), c = getint();
  printf("%d\n",max(0,c - a + b));
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

ll gcd(ll x, ll y){
    if(y == 0) return x;
    return gcd(y, x%y); 
}
int main(){
    ll a, b;
    ll ans = 1;
    cin >> a >> b;
    ll x = gcd(a,b);
    ll y = sqrt(x);
    for(int i = 2; i <= y; i++){
        if(x%i == 0){
            while(x%i == 0){
                x = x/i;
            }
            ans++;
        }
        if(x == 1) break;
    }
    if(x != 1) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

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

  // [0, i) [i, n)
  
  lint ans = 0;
  for (int i = 1; i < n - 1; i++) {
    lint tmp = 0;
    string t = s.substr(0, i);
    string u = s.substr(i, n - i);
      
    set<char> a;
    set<char> b;
    for (auto c : t) {
      a.insert(c);
    }
    for (auto c : u) {
      b.insert(c);
    }

    for (char c = 'a'; c <= 'z'; c++) {
      if (a.count(c) and b.count(c)) tmp++;
    }
    ans = max(ans, tmp);
  }

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


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

using namespace std;

long long int convert(long long int n) {
  long long int res = 0;
  long long int mult = 1;
  while (n > 0) {
    if (n % 4 == 1) {
      res += mult * 3;
    } else if (n % 4 == 2) {
      res += mult * 5;
    } else if (n % 4 == 3) {
      res += mult * 7;
    } else {
      res += mult * 1;
    }
    
    n /= 4;
    mult *= 10;
  }
  
  return res;
}

int main() {
  long long int N;
  cin >> N;
  
  int ct = 0;
  int ans = 0;
  while (true) {
    long long int n = convert(ct);
    if (n > N) {
      break;
    }
    
    map<int, bool> added;
    while (n > 0) {
      added[n % 10] = true;
      n /= 10;
    }
    
    if (added[3] && added[5] && added[7] && !added[1]) {
      ans++;
    }
    
    ct++;
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define maxn 200010
char s[maxn],t[maxn];
int main(){
	int i,n,cnt=0;
	scanf("%s%s",s,t);
	n=strlen(s);
	for(i=0;i<n;i++)
		if(s[i]!=t[i])cnt++;
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 2116
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
int a,b,c;
int main(){
    in(a);in(b);in(c);
    if(a-b<0)printf("%d\n",c);
    else printf("%d\n",max(0,c-(a-b)));
    return 0;
}
/*
19 171
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
2 3
2 4
2 5
2 6
2 7
2 8
2 9
2 10
2 11
2 12
2 13
2 14
2 15
2 16
2 17
2 18
2 19
3 4
3 5
3 6
3 7
3 8
3 9
3 10
3 11
3 12
3 13
3 14
3 15
3 16
3 17
3 18
3 19
4 5
4 6
4 7
4 8
4 9
4 10
4 11
4 12
4 13
4 14
4 15
4 16
4 17
4 18
4 19
5 6
5 7
5 8
5 9
5 10
5 11
5 12
5 13
5 14
5 15
5 16
5 17
5 18
5 19
6 7
6 8
6 9
6 10
6 11
6 12
6 13
6 14
6 15
6 16
6 17
6 18
6 19
7 8
7 9
7 10
7 11
7 12
7 13
7 14
7 15
7 16
7 17
7 18
7 19
8 9
8 10
8 11
8 12
8 13
8 14
8 15
8 16
8 17
8 18
8 19
9 10
9 11
9 12
9 13
9 14
9 15
9 16
9 17
9 18
9 19
10 11
10 12
10 13
10 14
10 15
10 16
10 17
10 18
10 19
11 12
11 13
11 14
11 15
11 16
11 17
11 18
11 19
12 13
12 14
12 15
12 16
12 17
12 18
12 19
13 14
13 15
13 16
13 17
13 18
13 19
14 15
14 16
14 17
14 18
14 19
15 16
15 17
15 18
15 19
16 17
16 18
16 19
17 18
17 19
18 19
*/


Measured memory_bytes: 256
n,k = map(int,input().split())
"""
BBBBRBBBRBBRB
など.
Rで区切ればよい.
すなわち, R := 区切り棒, B := 自由
として, 自由の島が何個あるかを調べる.
"""
def cmb(n, r, mod):
	if (r < 0) or (n < r):
		return 0
	r = min(r, n-r)
	return fact[n]*factinv[r]*factinv[n-r]%mod


mod = 10**9+7
N = 10**4  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N+1):
	fact.append((fact[-1]*i)%mod)
	inv.append((-inv[mod%i]*(mod//i))%mod)
	factinv.append((factinv[-1]*inv[-1])%mod)

"""
わかった！！
N-K個の赤いボールに、「島」i個をならべて、
島の作り方でまた数え上げればいいんだ！
n-k個, i個, なので, cmb(n-k+i, i)でできそう.
そして島の作り方は, iは1個消費するので, 「区別ない」k-i個のボールを「区別ある」i個の島に分ける.
すなわち, cmb(k-i+i-1, k-i) = cmb(k-1, k-i)

よって cmb(n-k+1, i) * cmb(k-1, k-i)
"""

for i in range(1, k+1):
	print((cmb(n-k+1, i, mod)*cmb(k-1, k-i, mod))%mod)

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

using namespace std;

int main(void) {
  string S, T;
  cin >> S >> T;

  vector <int> R(26), Rdash(26);
  for(int i = 0; i < 26; i++) {
    R[i] = -1;
    Rdash[i] = -1;
  }

  for(int i = 0; i < S.length(); i++) {
    int Si = S[i] - 'a';
    int Ti = T[i] - 'a';
    if(R[Si] < 0) {
      R[Si] = Ti;
    }
    else if(R[Si] != Ti) {
      cout << "No" << endl;
      return 0;
    }
    if(Rdash[Ti] < 0) {
      Rdash[Ti] = Si;
    }
    else if(Rdash[Ti] != Si) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  
}

Measured memory_bytes: 776
//ABC049 B問題

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
	int h=0,w=0;
	cin >> h >> w;

	string line;
	vector<string> strlist;

	for(int i=0;i<h;i++){
		cin >> line;
		strlist.push_back(line);
	}

	for(string s : strlist){
		cout << s << endl;
		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int N,K,x[101],dist;
int main (){
	scanf("%d",&N);
	scanf("%d",&K);
	for(int i=1;i<=100;i++){
	scanf("%d ",&x[i]);
	if(x[i]>K-x[i]){
				dist+=2*(K-x[i]);
			}else{
				dist+=2*x[i];
			}
	}
	
	printf("%d",dist);

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
char t[1000], p[1000];
int n1, n2;
int flag;

int main(void) {
  int i, j;
  
  scanf("%s", t);
  scanf(" %s", p);
  n1 = strlen(t);
  n2 = strlen(p);
  
  for (i = 0; i <= n1 - n2; i++) {
    flag = 0;
    for (j = 0; j < n2; j++) {
      if (t[i + j] != p[j]) {
	flag = 1;
	break;
      }
    }
    if (flag == 0) 
      printf("%d\n", i);
  }
  
  return 0;
}



Measured memory_bytes: 2120
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  string t = s.substr(0, n / 2);
  string y = s.substr(n / 2, n);
  if (t == y)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
def main():
    n = int(input())
    array = [int(x) for x in input().split()]

    sum1 = sum(array)
    sum2 = 0

    for num in array:
        diff_b = abs(sum1 - sum2)
        sum1 -= num
        sum2 += num
        diff_a = abs(sum1 - sum2)
        if diff_a <= diff_b:
            continue
        else:
            print(diff_b)
            return


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<int, ull> piu;
typedef vector<vector<int>> matrix;

const ll INF = 1e18 + 123;
const ld EPS = 1e-9;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 5e5 + 123;
const int M = 1e6 + 123;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};

void solve(){
    double n;
    cin >> n;
    cout <<fixed<<setprecision(6)<< (n*n*n)/27;
}

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
   // cin >> t;
    for (int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}


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

int main(){
    int N, Q;
    cin>>N>>Q;

    string S;
    vector<int> ac_cnt(N, 0);
    int cnt = 0;
    cin>>S;
    for(int i=0; i<N-1; i++){
        if(S[i]=='A' && S[i+1]=='C'){
            S[i]='a';
            cnt++;
        }
        ac_cnt[i+1] = cnt;
    }

    vector<int> ans;
    for(int i=0; i<Q; i++){
        int l, r;
        cin>>l>>r;

        if(l == 1){
            ans.push_back(ac_cnt[r-1]);
        }else{
            ans.push_back(ac_cnt[r-1] - ac_cnt[l-1]);
        }

    }

    // for(int a : ac_cnt){
    //     cout<<a<<endl;
    // }
    // cout<<"-------"<<endl;
    for(int a : ans){
        cout<<a<<endl;
    }
    return 0;
}

Measured memory_bytes: 4488
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    ret = 1
    cluester_volume = A[0]
    for a in A[1:]:
        if a <= cluester_volume*2:
            ret += 1
        else:
            ret = 1
            
        cluester_volume += a
            
    print(ret)
    
solve()

Measured memory_bytes: 20380
ans' x =
  let a = (sum x) `div` (length x)
  in
    length $ filter (<= a) x

ans ([0]:_) = []
ans (x0:x1:xs) = 
  let a = ans' x1
  in
    a:(ans xs)

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = ans i
  mapM_ print o



Measured memory_bytes: 9236
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k,i;
  cin >> n >> k;
  vector<char> p(n);
  
  for(i=0;i<n;++i)
  {
  cin >> p.at(i);
    if(i==k-1) p.at(i)=p.at(i)+'a'-'A';
   cout << p.at(i);
  }


return 0;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int n;
    cin>>n;
    n%=1000;
    n=1000-n;
    if(n==1000) n=0;
    cout<<n<<endl;
    
    return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

/**
 * https://abc055.contest.atcoder.jp/tasks/arc069_a
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long M = sc.nextLong();
		sc.close();
		
		long ans = 0;
		if(N*2>=M){
			ans = M/2;
		}else{
			ans = N + (M-N*2)/4;
		}
		System.out.println(ans);

	}

}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007; // 998244353

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

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int N,L; cin >> N >> L;
    VI a(N); REP(i,N) cin >> a[i];
    int t = 0;
    while(t<N-1 && a[t]+a[t+1]<L) t++;
    if(t == N-1){
        cout << "Impossible" << endl;
        return 0;
    }

    VI ans;
    RREP(i,t+1) ans.push_back(i+1);
    FOR(i,t,N-2) ans.push_back(i+2);
    REVERSE(ans);
    cout << "Possible" << endl;
    REP(i,ans.size()) cout << ans[i] << en;
    return 0;
}

Measured memory_bytes: 1784
//左手拈着花，右手舞着剑 
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#define ll long long
#define pi pair<int,int>
#define mp(a,b) make_pair(a,b)
using namespace std;
const int N=100005;priority_queue
<pi,vector<pi>,greater<pi> >q[N];
int val[N],fa[N],rk[N],n,m,k;vector<pi>v;
void take(){
	for(int i=0;i<=n;i++)
	fa[i]=i,rk[i]=0;
} int get(int x){
	return fa[x]==x?x:fa[x]=get(fa[x]);
} void merge(int x,int y){
	x=get(x);y=get(y);
	if(x==y) return ;
	if(rk[x]<rk[y]) fa[x]=y;
	else{
		fa[y]=x;if(rk[x]==rk[y]) rk[x]++;
	}
} int main(){
	ll ans=0;scanf("%d%d",&n,&m);take();
	for(int i=0;i<n;i++) scanf("%d",&val[i]);
	for(int i=0,x,y;i<m;i++){
		scanf("%d%d",&x,&y);
		int fx=get(x),fy=get(y);
		if(fx!=fy) merge(fx,fy);
	} for(int i=0;i<n;i++)
	q[get(i)].push(mp(val[i],i));
	for(int i=0;i<n;i++)
	if(!q[i].empty()) v.push_back(q[i].top()),
	val[q[i].top().second]=2e9,
	ans+=q[i].top().first;
	if(v.size()==1) puts("0");
	else if(n<(v.size()-1)*2)
	puts("Impossible");else{
		sort(val,val+n);
		n=(v.size()-1)*2-v.size();
		for(int i=0;i<n;i++) ans+=val[i];
		cout<<ans<<endl; 
	} return 0;
}

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

long long D, G, ans=0;
vector<vector<long long>>V;

int main() {
  cin >> D >> G;
  vector<vector<long long>>V(D,vector<long long>(5,0));
  for(int i=0; i<D; i++){
    V[i][0] = (i+1)*100;
    cin >> V[i][1] >> V[i][2];
    V[i][3] = V[i][0]*V[i][1] + V[i][2]; 
    V[i][4] = V[i][0]*(V[i][1]-1);
    ans += V[i][1];
  }
  for(int i=0; i<D; i++){
    vector<vector<long long>>V2=V;
    V2.erase(V2.begin()+i);
    for(int bit=0; bit<(1<<D); bit++){
      long long anstmp=0, Gtmp=G;
      for(int j=0; j<D-1; j++){
        anstmp+=V2[j][1]*(1&(bit>>j));
        Gtmp-=V2[j][3]*(1&(bit>>j));
      }
      if(Gtmp<=0) ans=min(ans, anstmp);
      else if(Gtmp>0&&Gtmp<=V[i][4]) ans = min(ans, anstmp+(Gtmp-1)/V[i][0]+1);
    }
  }
  cout << ans << "\n";
//  for(int i=0; i<D; i++) cout << V[i][0] << " " << V[i][1] << " " << V[i][2] << " " << V[i][3] << " " << V[i][4] << "\n";
  return 0;
}

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

using namespace std;

int main() {
    string n;
    cin >> n;
    int tot = 0;
    for (char c : n) tot += (c - '0');
    if (tot % 9 == 0) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 3656
def main():
    x = int(input())
    ok = False
    for b in range(-200, 201):
        for a in range(b + 1, 201):
            if a ** 5 - b ** 5 == x:
                print(a, b)
                ok = True
                break
        if ok:
            break


if __name__ == "__main__":
    main()


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

int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    vector<bool> x(n);
    rep(i, n) x[i] = false;
    rep(i, n) {
        cin >> p[i];
        p[i]--;
        if(p[i] == i) x[i] = true;
    }
    int ans = 0;
    rep(i, n - 1) {
        if(x[i]) {
            swap(p[i], p[i + 1]);
            ans++;
            if(p[i + 1] == i + 1) x[i + 1] = true;
            else x[i + 1] = false;
        }
    }
    if(x[n - 1]) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3796
// This template is based on Mr. tonymontaro's template (https://atcoder.jp/users/tonymontaro).
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;
    static CF_Reader in;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        in = new CF_Reader();
        StringBuilder result = new StringBuilder();

        // Start: int型の整数n mを取得する
        // int n = in.intNext();
        // int m = in.intNext();
        // End: int型の整数n mを取得する

        // Start: Char型の文字をInt型に変換する
        // Integer.parseInt(String.valueOf(charText))
        // End: Char型の文字をInt型に変換する

        int sum = 0;
        // Start: 文字列を1文字ずつ出力する
        String text = in.next();
        char[] work = new char[text.length()];
        for(int i = 0; i < text.length(); i++){
          work[i] = text.charAt(i); // Char型の文字
          if (Integer.parseInt(String.valueOf(work[i])) == 1) {
            sum++;
            // out.println(work[i]);
          }
        }
        result.append(sum);
        // End: 文字列を1文字ずつ出力する

        out.println(result);

        out.close();
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}

Measured memory_bytes: 20692
#include <vector>
#include <map>
#include <iostream>
#include <algorithm>

using namespace std;

int N;

int algo(int n)
{
    vector<int> v;
    for (int iter = 2;; ++iter)
    {
        bool flag = true;
        for (int a : v)
        {
            if (iter % a == 0)
            {
                flag = false;
                break;
            }
        }

        if (!flag)
            continue;

        if (iter >= n)
            return iter;

        v.push_back(iter);
        ++iter;
    }
}

int main()
{
    cin >> N;
    cout << algo(N) << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    static final long MOD = 1_000_000_007;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();

        if (Math.abs(n - m) >= 2) {
            System.out.println(0);
            return;
        }

        long ans = 1;
        for (int i = n; i >= 2; i--) {
            ans = modmul(ans, i, MOD);
        }
        for (int i = m; i >= 2; i--) {
            ans = modmul(ans, i, MOD);
        }

        if (Math.abs(n - m) == 0) {
            System.out.println(modmul(ans, 2, MOD));
        } else if (Math.abs(n - m) == 1) {
            System.out.println(ans);
        }

    }

    static long modadd(long a, long b, long mod) {
        return (a + b) % mod;
    }

    static long modmul(long a, long b, long mod) {
        return (a * b) % mod;
    }
}

Measured memory_bytes: 23124
readint()=parse(Int,readline())
readints()=parse.(Int,split(readline()))

function main()
    N=readint()
    A=readints()
    s=1
    node=1
    maxA=maximum(A)
    sumA=sum(A)
    nokori=sumA
    for i in A
        nextnode=(node-i)*2
        nokori-=i
        nextnode>nokori &&      (  nextnode=nokori)
        s+=nextnode
        node=nextnode
        if node < 0
            s=-1
            break
        end
    end
    s
end
    
print(main())

Measured memory_bytes: 184200
#pragma Grem optimize ("O3")
#include <bits/stdc++.h>

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

int dx[ ] = { 1, -1, 0, 0, 1, -1, -1, 1 } ;
int dy[ ] = { 0, 0, -1, 1, 1, -1, 1, -1 } ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}


void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int n ;
int sum = 0 ;
int tmp ;

int main(){
   cin >> n ;
   tmp = n ;
   while( tmp ){
     sum += tmp % 10 ;
     tmp /= 10 ;
   }
   cout << ( n % sum ? "No" : "Yes" ) ;
   return 0 ;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

cat mod = 998244353;
cat C[11][11];

void count(int h, int w, char f_e, char f_h, char f_w, int & out, cat cur = 1) {
	if(h+w == 0) {
		out += cur;
		if(out >= mod) out -= mod;
		return;
	}
	if(!(f_e&1) && h*w == 0) return;
	for(int c = 0; c < 2; c++) for(int i = 0; i <= h; i++) for(int j = 0; j <= w; j++) if(i+j) {
		if((f_h>>c)&1 && i) continue;
		if((f_w>>c)&1 && j) continue;
		if(j && f_e&2 && c) continue;
		if(i && f_e&4 && c) continue;
		cat x = C[h][i] * C[w][j] % mod;
		int n_h = f_h, n_w = f_w;
		if(i) n_w ^= n_w&(1<<(1-c));
		if(j) n_h ^= n_h&(1<<(1-c));
		n_h |= 1<<c;
		n_w |= 1<<c;
		int n_e = f_e&1;
		if(!i) n_e |= 2;
		if(!j) n_e |= 4;
		count(h-i, w-j, n_e, n_h, n_w, out, cur*x%mod);
	}
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int H, W;
	cin >> H >> W;
	vector<int> V(H, 0);
	for(int i = 0; i < H; i++) {
		string s;
		cin >> s;
		for(int j = 0; j < W; j++)
			if(s[j] == '#') V[i] |= 1<<j;
	}
	memset(C, 0, sizeof(C));
	for(int i = 0; i <= 10; i++) {
		C[i][0] = 1;
		for(int j = 1; j <= i; j++)
			C[i][j] = (C[i-1][j]+C[i-1][j-1])%mod;
	}
	int cnt[11][11];
	memset(cnt, 0, sizeof(cnt));
	for(int i = 0; i <= H; i++) for(int j = 0; j <= W; j++)
		count(i, j, (H-i) || (W-j), 0, 0, cnt[i][j]);
	cat ans = cnt[H][W];
	for(int i = 0; i < (1<<H)-1; i++) {
		vector<int> Vr, Vc(W, 0);
		for(int j = 0; j < H; j++)
			if(!((i>>j)&1)) Vr.push_back(V[j]);
		for(int j = 0; j < W; j++) {
			for(int k = 0; k < H; k++)
				if(!((i>>k)&1)) Vc[j] += ((V[k]>>j)&1)<<k;
			Vc[j] = (!Vc[j]) || (Vc[j] == (1<<H)-1-i);
		}
		int n = H-Vr.size();
		for(int j = 0; j < (1<<W)-1; j++) {
			int m = (1<<W)-1-j;
			bool ok = true;
			for(int k = 0; k < H-n; k++) if(!(Vr[k]&m) || (Vr[k]&m) == m) {
				ok = false;
				break;
			}
			if(!ok) continue;
			for(int k = 0; k < W; k++) if(!((j>>k)&1) && Vc[k]) {
				ok = false;
				break;
			}
			if(!ok) continue;
			ans += cnt[n][__builtin_popcount(j)];
			if(ans >= mod) ans -= mod;
		}
	}
	cout << ans << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i, j, k, tmp;
  int wa = 0;
  int N, K;
  scanf("%d %d", &N, &K);
  
  int p[N];
  for(i = 0; i < N; i++){
    scanf("%d", &p[i]);
  }
  
  for (i = 0; i < N-1; i++) {
    j = i;
    for (k = i+1; k < N; k++) {
      if (p[j] > p[k]) { j = k; }
    }
    
    tmp = p[j];
    p[j] = p[i];
    p[i] = tmp;
  }
  
  for(i = 0; i < K; i++){
    wa += p[i];
  }
  printf("%d", wa);
  
  return 0;
}

Measured memory_bytes: 1712
import java.io.InputStream;
import java.io.PrintStream;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String s = sc.next();
		int K = sc.nextInt();

		List<String> ans = new LinkedList<>();
		for (int i = 0; i < K; i++) {
			ans.add("~" + i);
		}

		NEXTST: for (int st = 0; st < s.length(); st++) {
			NEXTED: for (int ed = st + 1; ed <= s.length(); ed++) {
				String a = s.substring(st, ed);
				for (int i = 0; i < K; i++) {
					int c = a.compareTo(ans.get(i));
					if (c < 0) {
						//小さい
						ans.add(i, a);
						ans.remove(ans.size() - 1);
						continue NEXTED;
					} else if (c > 0) {
						//おおきい
					} else { // c==0
						//次のedを調べる
						continue NEXTED;
					}
				}
				//これ以上このstを調べる必要ない
				continue NEXTST;
			}
		}

		out.println(ans.get(ans.size() - 1));

		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}


Measured memory_bytes: 24148
s=str(input())
flag=True
while len(s)>0 :
  if s[-7:] == 'dreamer':
    s=s[:-7]
    continue
  elif s[-6:] == 'eraser':
    s=s[:-6]
    continue
  elif s[-5:] == 'dream':
    s=s[:-5]
    continue
  elif s[-5:] == 'erase':
    s=s[:-5]
    continue
  else:
    flag=False
    break
if flag:
  print('YES')
else:
  print('NO')

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

int main() {
    //行列計算
    //初期化
    int n, m, l;
    cin >> n >> m >> l;
    vector<vector<int>> matrixA(n, vector<int>(m, 0));
    vector<vector<int>> matrixB(m, vector<int>(l, 0));
    vector<vector<ll>>  matrixC(n, vector<ll>(l, 0));

    //入力
    rep(i, n) {
        rep(j, m) { cin >> matrixA[i][j]; }
    }
    rep(i, m) {
        rep(j, l) { cin >> matrixB[i][j]; }
    }

    // 処理
    rep(i, n) {
        rep(j, l) {
            rep(k, m) { matrixC[i][j] += matrixA[i][k] * matrixB[k][j]; }
        }
    }

    //出力
    // cout << "A#############"
    //      << "\n";
    // rep(i, n) {
    //     rep(j, m) { cout << matrixA[i][j] << " "; }
    //     cout << "\n";
    // }
    // cout << "B#############"
    //      << "\n";

    // rep(i, m) {
    //     rep(j, l) { cout << matrixB[i][j] << " "; }
    //     cout << "\n";
    // }

    rep(i, n) {
        rep(j, l) {
            // cout << matrixC[i][j];
            // (j == l - 1) ? cout << "" : cout << " ";
            cout << (j == 0 ? "" : " ") << matrixC[i][j];
        }
        cout << "\n";
    }
    return 0;
}



Measured memory_bytes: 3184
#include<iostream>
using namespace std;
int d[105];
int l[105];
int main(void)
{
  	int n,x;
  	cin >> n >> x;
  	for(int i=1;i<=n;i++)
      	cin >> l[i];
  	d[1]=0;
  	for(int i=2;i<=n+1;i++)
      	d[i]=d[i-1]+l[i-1];
  	int cnt=0;
  	for(int i=1;i<=n+1;i++)
    {
      	if(x>=d[i])
          	cnt++;
      	else
          	break;
    }
  	cout << cnt;
  	return 0;
}

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

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}
 
void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

const int maxn = 1e5+10;
const int inf = 1e9;
const lf eps = 1e-8;

int n,a[maxn],ans;

int main() {
    read(n);for(int i=1;i<=n;i++) read(a[i]);
    sort(a+1,a+n+1),reverse(a+1,a+n+1);a[0]=a[1];
    for(int i=0;i<=n;i++)
        if(a[i+1]<=i) {
            ans=(a[i]-i)&1;
            int j=i+1;while(a[j]==i&&j<=n) j++;
            ans|=(j-i+1)&1;break;
        }puts(ans?"First":"Second");
    return 0;
}


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

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

    int n; cin >> n;
    int a[n]; rep(i,n) cin >> a[i];
    unordered_map<int,int> st; rep(i,n) st[a[i]]++;
    int ans = 0;
    int cnt = 0;
    rep(i,n) if(a[i] == 1){
        cnt++;
    }
    if(cnt == 1){
        cout << 1 << endl;
        return 0;
    }else if(cnt >= 2){
        cout << 0 << endl;
        return 0;
    }

    rep(i,n){
        bool flag = true;
        if(st[a[i]] >= 2) continue;
        for(int j = 2; j*j <= a[i]; ++j){
            if(a[i] % j != 0) continue;
            if(st[j] >= 1 || st[a[i]/j] >= 1){
                flag = false;
                break;
            }
        }
        if(flag) ans++;
    }

    cout << ans << endl;

}

Measured memory_bytes: 32484
C = input().split()

A = int(C[0])
B = int(float(C[1])*100+0.1)



E = A*B



if E < 100:
    print(0)
elif E < 200:
    print(1)
elif E < 300:
    print(2)
else:
    F = str(E)
    print(F[0:len(F)-2])

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<ll,ll>;


ll m=1000000007;

ll mod=1e9+7;
ll dp[2000+4];


int main()
{
 ll n;
 cin>>n;
 ll sum=0;
 Rep(i,n+1){
     ll e=n/i;
     sum+=(i+e*i)*e/2;
 }
 cout<<sum<<endl;
}
 


 

 




Measured memory_bytes: 3628
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <string>
using namespace std;
long long _753_to_i(vector<int>& a) {
	long long retnum=0;
	for (auto itr = a.rbegin(); itr != a.rend();++itr) {
		retnum *= 10;
		if (*itr == 0)retnum += 3;
		else if (*itr == 1)retnum += 5;
		else if (*itr == 2)retnum += 7;
	}
	return retnum;
}
bool is_753(vector<int>& a) {
	bool flag3 = false;
	bool flag5 = false;
	bool flag7 = false;
	for (int i : a) {
		if (i == 0)flag3 = true;
		else if (i == 1)flag5 = true;
		else if (i == 2)flag7 = true;
	}
	return(flag3 == true && flag5 == true && flag7 == true);
}
int main() {
	//0->3 1->5 2->7
	long long N;
	cin >> N;
	vector<int>a{ 0 };
	int num = 0;
	while (_753_to_i(a) <= N) {
		//cout << _753_to_i(a)<<endl;
		if(is_753(a))num++;
		bool flag = false;
		for (auto itr = a.begin(); itr != a.end(); ++itr) {
			if (*itr != 2) {
				(*itr)++;
				flag = true;
				break;
			}
			else {
				*itr = 0;
			}
		}
		if (flag == false) {
			for (auto i : a) {
				i = 0;
			}
			a.push_back(0);
		}
	}
	cout << num << endl;
	cin >> N;
	return 0;
}



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

int main() {
    long N;
    long A;
    long B;
    std::cin >> N >> A >> B;

    if (A == 0) {
        std::cout << 0 << std::endl;
        return 0;
    }
    long x = N / (A + B);
    long y = N % (A + B);
    std::cout << x * A + std::min(y, A) << std::endl;
    return 0;
}

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

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	int n = rint;
	long[] as = rlong(n);

	as.sort();

	bool f = 0;
	foreach(i; 0 .. n - 1) if(as[i] == as[i + 1]) f = 1;

	if(f) writeln("NO");
	else writeln("YES");
}

Measured memory_bytes: 8824
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int a[26];
	memset(a,0,sizeof(a));
	for(int i=0;i<s.size();i++)
	{
		char c=s[i];
		a[c-'a']++;
	}
	bool f=true;
	for(int i=0;i<26;i++)
	{
		if(a[i]&1)
		{
			f=false;
			break;
		}
	}
	if(f)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl ;
	return 0;
}


Measured memory_bytes: 256
S = input()

y = int(S[:4])
m = int(S[5:7])
d = int(S[8:])

str = "TBD"

if y < 2019:
  str = "Heisei"
elif y == 2019:
  if m <= 4:
    str = "Heisei"

print(str)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define F            first
#define S            second
#define pb(x)        push_back(x)
#define mp(a,b)      make_pair(a,b)
#define mt(a,b,c)    make_tuple(a,b,c)
#define sz           size()
#define all(A)       A.begin(), A.end()
#define mem(a, b)    memset(a, b, sizeof(a))   // all elements of A are b=0 or b=-1 else don't work
#define f0(i,b)      for(ll i=0;i<(b);i++)
#define f1(i,b)      for(ll i=1;i<=(b);i++)
#define f2(i,a,b)    for(ll i=(a);i<=(b);i++)
#define f3(i,b,a)    for(ll i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(ll i=(a);i!=(b);i+=(c))

#define MOD          1000000007 //10^9 + 7
#define PI           acos(-1.0)
#define MAX3(a,b,c)  max(a,max(b,c))

/*------------------------Bitmask-------------------------------*/
#define bitOn(N,pos)      (N | (1LL<<(pos)))
#define bitOff(N,pos)     (N & (~(1LL<<(pos))))
#define bitCheck(N,pos)   ((bool)(N & (1LL<<(pos))))
#define bitFlip(a,k)      (a^(1LL<<(k)))

#define whilee(i,t)  while(i!=t)
#define  sl(a)       scanf("%lld",&a)
#define  pl(a)       printf("%lld\n",a)

//x = 1e18 means 10^18
//for(auto it =A.begin(); it!=A.end(); it++)
//sort(A.begin(),A.end()); //sort(A, +n, greater<int>());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end()); //will have index if A.begin() is minus from it
//cout << *min_element(A.begin(), A.end());
//count(A.begin(), A.end(), X); //counts the occurrences of X
//distance(A.begin(),A.end());  //distance between first to last element
//accumulate(A.begin(), A.end(), 0); //add
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());
//swap(S[0], T[0]);

//scanf("%lld",&x);
//printf("%lld\n",x);
//printf("%I64d\n", a);
//while (scanf("%lld %lld", &a, &b) == 2)
//printf("Case %lld: %lld\n", t++, a);

/*----------------------- Graph Moves---------------------------*/
// int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1};  // 4 Direction
// int dx[] = {0,0,1,-1,-1,1,-1,1} , dy[] = {-1,1,0,0,1,1-1,-1};  // 8 Direction // Kings Move
// int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1};  // Knight Direction
// int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1};  // Hexagonal Direction

//vector <ll> A;
//deque <ll> A;
//queue <ll> A;
//stack <ll> A;
//list <int> A;
//set <ll> A;
//map <ll,ll> A;
//unordered_map <ll, ll> A;
//pair <ll,ll> A ;
//tuple <ll, ll, ll> A;
//vector <pair <ll,ll>> A;
//bitset<32> bset1;
//bool ok = true;
//char ch;
//string S, T, U;

ll i=0, j=0, k=0, a, b, c, d, e, f, g, h, l, m, n, o, p, q, r, s, t=1, u, v, w, x, y, z, maxx=INT_MIN, minn=INT_MAX, ans=0, sum=0, flag=0, cnt=0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);//NULL
    cout.tie(nullptr);//NULL

    // while(cin>>n){}
    cin>>x;
    ans=(x/11)*2;
    y = x%11;
    ans+=(ceil(y/6.0));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
# https://atcoder.jp/contests/abc144/tasks/abc144_c
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
import math
from heapq import heappush, heappop, heapify


def main():
    n = int(input())

    v = 1
    while v * v <= n:
        v += 1

    for i in range(v, 0, -1):
        if n % i == 0:
            j = n // i
            print(i + j - 2)
            return


if __name__ == '__main__':
    main()


Measured memory_bytes: 38860