akhauriyash/Code-Regression huggingface dataset:
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    int cost = INT_MAX;
    for(auto &x : a){
        cin >> x;
        int ct = 0;
        while(x % 2 == 0){
            x /= 2;
            ct++;
        }
        cost = min(cost, ct);
    }
    cout << cost;
    return 0;
}


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

#define PI 3.14159265359	

using namespace std;

int main(){
	string s;
	map<char, int> mp;
	while (cin >> s){
		for (int i = 0; i < s.size(); i++){
			if (65 <= s[i] && s[i] <= 90) mp[s[i] + 32]++;
			else mp[s[i]]++;
		}
	}
	for (int i = 97; i <= 122; i++){
		cout << (char)i << " : " << mp[(char)i] << endl;;
	}
}

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

int main () {
  int N , M ; 
  cin >> N >> M ; 
  vector<int> s(M) , c(M) ; 
  bool ans = false ; 
  map<int , int> MAP ; 
  
  for(int i = 0 ; i < M ; i++ ){
    cin >> s.at(i) ;
    cin >> c.at(i) ; 
    MAP[s.at(i)] = c.at(i) ; 
    if(s.at(0) == 1 && c.at(0) == 0 && N != 1 ) {
      cout << "-1" << endl ;
      ans = true ; 
      if(ans) return 0 ;   
    }
  }


  for(int i = 0 ; i < M ; i++){
    for(int j = 0 ; j < M ; j++){
        if(s.at(i) == s.at(j) && c.at(i) != c.at(j)) {
          cout << "-1" << endl ;
          return 0 ; 
        }
    }
  }
  
  for(int i =1 ; i <= N ; i++){
    int A = MAP[i] ;
    //if(M == 0 && i == 1 && N > 1){
    //  A = 1 ; 
    //}
    if(i == 1 && A == 0 && N > 1){
      A = 1 ; 
    }
      
    cout << A ;
    
  }
  
}



Measured memory_bytes: 3608
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] s = new int[M];
        char[] c = new char[M];
        for (int i = 0; i < M; i++) {
            s[i] = sc.nextInt() - 1;
            c[i] = sc.next().charAt(0);
        }
        for (int i = 0; i <= 999; i++) {
            String nums = String.valueOf(i);
            if (nums.length() != N)
                continue;
            char[] foo = nums.toCharArray();
            int k;
            for (k = 0; k < M; k++) {
                if (foo[s[k]] != c[k]) {
                    break;
                }
            }
            if (k == M) {
                System.out.println(i);
                return;
            }
        }
        System.err.println("no");
        System.out.println(-1);
    }

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


Measured memory_bytes: 21844
#define ll long long
#include<bits/stdc++.h>
using namespace std;
int main()
{
   ll n,i,cnt=2,c=0,j;
   cin>>n;
   for(i=1;i<=n;i+=2)
   {
       cnt=2;
    //   cout<<"F: "<<i<<endl;
       for(j=3;j*j<=i;j+=2)
       {
           if(i%j==0){
            cnt++;
           // cout<<j<<endl;
           if((i/j)!=j)
           {
               cnt++;
              // cout<<(i/j)<<endl;
           }
           }
       }
       if(cnt==8)c++;
   }
   cout<<c<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll n,k;

int main(){
    cin >> n >> k;
    mint ans = 0;
    vector<mint>g(k+1,0);
    for(int j=k;j>=1;j--){
        ll p = k/j;
        mint now = modpow(p,n);
        for(ll q=2;q*j<=k;q++){
            now -= g[q*j];
        }
        g[j] = now;
        ans += now * j;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4064
N, M, X, Y = [int(i) for i in input().split()]
x_list = [int(i) for i in input().split()]
y_list = [int(i) for i in input().split()]

x_max = max(x_list)
y_min = min(y_list)

ans = "War"
for Z in range(X+1, Y+1):

    if x_max < Z <= y_min:
        ans = "No War"
        break

print(ans)


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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll n,h,w; cin>>n>>h>>w;
    ll a,b;
    a=b=1;
    a+=n-h,b+=n-w;
    cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 3580
M, D = map(int,input().split())
ans = 0
for m in range(1,M+1):
    for d in range(1,D+1):
        d1 = d % 10
        d10 = d // 10
        if d1 >= 2 and d10 >= 2 and d1 * d10 == m:
            ans += 1

print(ans)

Measured memory_bytes: 3060
using System;
using System.IO;
using System.Linq;
using System.Runtime;
using System.Reflection;
using System.Diagnostics;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;


class P
{
    static void Main()
    {
        int[] sg = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = int.Parse(Console.ReadLine());
        long[][] pos = new long[n + 2][];
        pos[0] = new long[] { sg[0], sg[1], 0 };
        pos[pos.Length - 1] = new long[] { sg[2], sg[3], 0 };
        for (int i = 1; i < pos.Length - 1; i++)
        {
            pos[i] = Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        double[][] dist = Enumerable.Repeat(0, pos.Length).Select(_ => new double[pos.Length]).ToArray();
        for (int i = 0; i < dist.Length; i++)
        {
            for (int j = 0; j < dist.Length; j++)
            {
                var distx = Abs(pos[i][0] - pos[j][0]);
                var disty = Abs(pos[i][1] - pos[j][1]);
                dist[i][j] = Max(0, Sqrt(distx * distx + disty * disty) - (pos[i][2] + pos[j][2]));
            }
        }

        double[] currentMin = Enumerable.Repeat((double)long.MaxValue, pos.Length).ToArray();
        bool[] isFixed = new bool[pos.Length];
        currentMin[0] = 0;
        while (true)
        {
            int minInd = -1;
            double min = int.MaxValue;
            for (int i = 0; i < currentMin.Length; i++)
            {
                if (isFixed[i]) continue;
                if (currentMin[i] < min)
                {
                    min = currentMin[i];
                    minInd = i;
                }
            }
            if (minInd < 0) break;
            isFixed[minInd] = true;
            for (int i = 0; i < dist.Length; i++)
            {
                if(currentMin[minInd] + dist[i][minInd] < currentMin[i])
                {
                    currentMin[i] = currentMin[minInd] + dist[i][minInd];
                }
            }
        }
        Console.WriteLine(currentMin.Last());
    }
}

Measured memory_bytes: 25644
import java.io.*
import java.util.*

fun solve(M: Long){
    println(48L -M)
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val M = sc.next().toLong()
    solve(M)
}



Measured memory_bytes: 29728
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

map<vector<int>, int>init(vector<int>ds, vector<int>as) {
	vector<int>perms(ds.size());
	iota(perms.begin(),perms.end(),0);

	map<vector<int>,int>mp;
	do {
		int nans=0;
		vector<int>dels(ds.size());
		for (auto eat : perms) {
			nans+=dels[eat];
			for (int x = eat - ds[eat]; x <= eat + ds[eat];++x) {
				if (x >= 0 && x < ds.size()) {
					dels[x]+=as[eat];
				}
			}
			
		}
		mp[perms]=nans;
	}while(next_permutation(perms.begin(),perms.end()));
	return mp;
}

map<vector<int>, int>comp_memo(map<vector<int>, int>pr_memo) {
	map<vector<int>,int>ne_memo;
	for (auto pm : pr_memo) {
		auto v(pm.first);
		int f_num = v[0];
		v.erase(find(v.begin(),v.end(),0));
		for (auto&c : v) {
			c--;
		}
		ne_memo[v]=max(ne_memo[v],pm.second);
	}
	return ne_memo;
}

map<vector<int>, int>update(vector<int>ds, vector<int>as,map<vector<int>,int>pr_memo) {
	pr_memo=comp_memo(pr_memo);
	vector<int>perms(ds.size());
	iota(perms.begin(), perms.end(), 0);

	map<vector<int>, int>mp;
	do {
		int nans = 0;
		vector<int>dels(ds.size());
		for (auto eat : perms) {
			nans += dels[eat];

			for (int x = eat - ds[eat]; x <= eat + ds[eat];++x) {
				if (x >= 0 && x < ds.size()) {
					if (eat == ds.size() - 1 || x == ds.size() - 1) {
						dels[x] += as[eat];
					}
				}
			}
		}
		vector<int>v(perms.begin(),perms.end());
		v.erase(find(v.begin(),v.end(),ds.size()-1));
		assert(pr_memo.find(v)!=pr_memo.end());
		nans+=pr_memo[v];
		mp[perms] = max(nans,mp[perms]);
	} while (next_permutation(perms.begin(), perms.end()));
	return mp;
}

int main() {
	int N;cin>>N;
	vector<int>ds(N),as(N);
	for (int i = 0; i < N; ++i) {
		cin>>ds[i];
	}
	for (int i = 0; i < N; ++i) {
		cin>>as[i];
	}

	if (N <= 8) {
		auto ans_mp(init(ds,as));

		int ans=0;
		for (auto am : ans_mp) {
			ans=max(am.second,ans);
		}
		cout<<ans<<endl;
	}
	else {
		auto memo(init(vector<int>(ds.begin(),ds.begin()+8),vector<int>(as.begin(),as.begin()+8)));
		for (int i = 8; i < N; ++i) {
			memo=update(vector<int>(ds.begin()+i-7,ds.begin()+i+1)
				,vector<int>(as.begin()+i-7,as.begin()+i+1),memo);
		}
		int ans=0;
		for (auto am : memo) {
			ans=max(am.second,ans);
			//cout<<ans<<endl;
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 18892
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#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;

int main() {

    ll N;
    string S;

    cin >> N >> S;

    vector<ll>D(N), L(N), R(N);

    rep(i, N) {
        if (S[i] == 'E') {
            D[i] = 1;
        }
        else {
            D[i] = 0;
        }
    }
    
    L[0] = 0;
    R[N - 1] = 0;

    ll tmp = 0;
    repl(i, 1, N) {
        if (D[i - 1] == 0) {
            tmp++;
        }
        L[i] = tmp;
    }

    tmp = 0;
    for (ll i = N - 2; i >= 0; i--) {
        tmp += D[i + 1];
        R[i] = tmp;
    }

    ll ans = N;

    rep(i, N) {
        ans = min(ans, L[i] + R[i]);
    }
    
    cout << ans;

    return 0;
}

Measured memory_bytes: 10644
n,a,b=gets.split.map(&:to_i)
h=(1..n).map{gets.to_i}
r=1000000000
l=1
while l<r
  c=(l+r)/2
  if h.map{|i|[(i-c*b+a-b-1)/(a-b),0].max}.inject(:+) <= c
    r=c
  else
    l=c+1
  end
end
p l


Measured memory_bytes: 20020
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

#define ll long long
const int maxN = 100005;
const ll INF = 1000000000000000000LL;

class TaskA {
private:
	Debugger debugger;

public:
	void solveOne(int it){
		int n, x, t;
		cin >> n >> x >> t;
		cout << ((n+x-1)/x) * t << endl;
	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskA solver;
	solver.solve();
	return 0;
}


Measured memory_bytes: 3656
s = input()

j1 = s[0] == 'A'
j2 = s[2:-1].count('C') == 1
j3 = True

s3 = set(s) - set('AC')
for i in s3:
    if i != i.lower():
        j3 = False
        break

print('AC') if j1 and j2 and j3 else print('WA')

Measured memory_bytes: 3060
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

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

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


N , t = list(map(int, sys.stdin.buffer.readline().split()))
C, T  = list(zip(*[map(int, sys.stdin.buffer.readline().split()) for _ in range(N)]))

C = np.array(C, dtype=int)
T = np.array(T, dtype=int)

if np.any(T <= t):
    ans = C[T <= t].min()
    print(ans)
else:
    print('TLE')


Measured memory_bytes: 13680
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int h[] = new int[n];
            boolean is = true;
            for (int i = 0; i < n; i++) {
                h[i] = Integer.parseInt(in.next());
            }
            int diff = 0;
            for (int i = 0; i < n; i++) {
                if (diff < h[i]) {
                    h[i]--;
                    diff = h[i];
                } else if (diff > h[i]) {
                    is = false;
                    break;
                }
            }

            // 出力
            if (is) out.println("Yes");
            else out.println("No");

        }

    }
}



Measured memory_bytes: 48828
using System;

class OddsofOddness
{
	public static void Main(string[] args)
    { 
        int N = int.Parse(Console.ReadLine());

        int i = 1;
        int count = 0;

         while(i <= N)
        {
            if (i % 2 != 0) count++;
            i++;
        }

        Console.WriteLine((double)count/N);
    }
}

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

int main() {
    int N; cin >> N;
    vector<long long> A(N);
    for(int i=0; i<N; i++){
        cin >> A.at(i);
    }
    long long w=1000000007;
    long long ans=0;
    vector<long long> sum(N+1);
    for(int i=0; i<N; i++){
       sum.at(i+1)=(sum.at(i)+A.at(i))%w;
    }
    for(int i=0; i<N-1; i++){
        ans=ans+(A.at(i+1)*sum.at(i+1))%w;
        ans=ans%w;
    }
    cout << ans << endl;
}


Measured memory_bytes: 6420
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=2e5+10;
int d[maxn],f[maxn];
int main(){
	int n,a,b;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		f[i]=a+b;
		d[i]=a-b;
	}
	sort(f+1,f+1+n);
	sort(d+1,d+1+n);
	ll x=max(f[n]-f[1],d[n]-d[1]);
	cout<<x<<endl;
} 

Measured memory_bytes: 5128
let q = Scanf.scanf " %d" @@ (+) 0
let rmax = ref 0
let lrs = Array.init q @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b ->
  rmax := max !rmax b; a, b
let primes n =
  if n <= 1 then [|false; false|]
  else
    let flags = Array.make (n + 1) true in
    flags.(0) <- false; flags.(1) <- false;
    let i = ref 2 in
    while !i * !i <= n do
      if flags.(!i) then
        (let j = ref @@ !i + !i in
        while !j <= n do flags.(!j) <- false; j := !j + !i done);
      incr i
    done;
    flags
let sums = Array.make (!rmax + 1) 0
let ps = primes !rmax
let f n = if n mod 2 = 1 && ps.(n) && ps.((n + 1) / 2) then 1 else 0
let _ =
  for i = 0 to !rmax - 1 do sums.(i + 1) <- sums.(i) + f (i + 1) done;
  let g (l, r) = Printf.printf "%d\n" @@ sums.(r) - sums.(l - 1) in
  Array.iter g lrs

Measured memory_bytes: 8960
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define maxn 200005
 
int n;
int c[maxn];
int cnt[30],fuck[30],nxt[maxn],fir[maxn],p[30];
char s[maxn],t[maxn];
long long ans;
 
inline int read(){
    int x=0,f=1; char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}
 
void clear(){
    memset(cnt,0,sizeof(cnt)),memset(fuck,0,sizeof(fuck));
    memset(fir,0,sizeof(fir)),memset(c,0,sizeof(c));
}
 
void change(int i,int v){for (;i<=n;i+=i&(-i)) c[i]+=v;}
int query(int i){int ret=0; for (;i;i-=i&(-i)) ret+=c[i]; return ret;}
 
int main(){
    scanf("%s",s+1); n=strlen(s+1);
    for (int i=1;i<=n;i++) cnt[s[i]-'a']++;
    int pps=0,fuckpps=0;
    for (int i=0;i<26;i++) if (cnt[i]&1) pps++,fuckpps=i;
    if (!(n&1)&&pps){puts("-1"); return 0;}
    if ((n&1)&&pps!=1){puts("-1"); return 0;}
    int top=0;
    for (int i=1;i<=n;i++)
        if (++fuck[s[i]-'a']<=(cnt[s[i]-'a']>>1)) t[++top]=s[i];
    if (n&1) t[++top]=fuckpps+'a';
    for (int i=(n>>1);i;i--) t[++top]=t[i];
    for (int i=n;i;i--) nxt[i]=fir[t[i]-'a'],fir[t[i]-'a']=i;
    for (int i=0;i<26;i++) p[i]=fir[i];
    ans=0;
    for (int i=1;i<=n;i++){
        ans+=i-1-query(p[s[i]-'a']),change(p[s[i]-'a'],1);
        p[s[i]-'a']=nxt[p[s[i]-'a']];
    }
    printf("%lld\n",ans);
    return 0;
}

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

int main(){
  ll s;
  cin >> s;
  
  if(s==1 || s==2){
    cout << 4 << endl;
    return 0;
  }
  
  ll cntr = 0;
  while(s != 1){
    ++cntr;
    if(s % 2 == 0)
      s /= 2;
    else
      s = s * 3 + 1;
  }
  cout <<cntr+2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using std::cin;
using std::cout;
using std::endl;

int main()
{
    int A, B, result;
    cin >> A >> B;
    result = A - 2 * B;
    result = (result < 0) ? 0 : result;
    cout << result << endl;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
#include <stdio.h>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
    int H, W;
    while(true){
    scanf("%d %d", &H, &W);
    if(H == 0) break;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(i==0 || i==H-1 || j ==0 || j==W-1)
                printf("#");
            else
                printf(".");
        }
        printf("\n");
    }
    printf("\n");
    }
    return 0;
}

Measured memory_bytes: 2612
#include <stdio.h>
int main(void) {
	int lane[30] = {0};
	int i, n, m, use, Yoko, tmp;
	for(i = 0; i < 30; i++ ) {
		lane[i] = i+1;
	}
	scanf("%d %d",&use, &Yoko);
	for(i = 0; i < Yoko; i++ ) {
		scanf("%d,%d",&n, &m);
		tmp = lane[n-1];
		lane[n-1] = lane[m-1];
		lane[m-1] = tmp;
	}
	for(i = 0; i < use; i++ ) {
		printf("%d\n",lane[i]);
	}
	return 0;
}

Measured memory_bytes: 596
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define coyes cout << "Yes" << endl;
#define cono cout << "No" << endl;
#define coYes cout << "YES" << endl;
#define coNo cout << "NO" << endl;
using namespace std;
using ll = long long int;
string large_al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string small_al = "abcdefghijklmnopqrstuvwxyz";
using Graph = vector<vector<int>>;
using i64 = int64_t;


int main() {
  int k;
  cin >> k;
  vector<int> s = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << s.at(k-1) << endl;
}
 



Measured memory_bytes: 256
class UnionFindNode(object):
    def __init__(self, group_id, parent=None, value=None):
        self.group_id = group_id
        self.parent_ = parent
        self.value = value
        self.size_ = 1

    def __str__(self):
        return "UnionFindNode(group_id: {}, \n\tparent: {}, value: {}, size: {})".format(self.group_id, self.parent_,
                                                                                         self.value, self.size_)

    def is_root(self):
        return not self.parent_

    def parent(self):
        parent = self
        while parent.parent_:
            parent = parent.parent_
        if not self.is_root():
            self.parent_ = parent
        return parent

    def find(self):
        parent = self.parent()
        return parent.group_id

    def size(self):
        parent = self.parent()
        return parent.size_

    def unite(self, unite_node):
        parent = self.parent()
        unite_parent = unite_node.parent()
        if parent.group_id != unite_parent.group_id:
            if parent.size() > unite_parent.size():
                unite_parent.parent_ = parent
                parent.size_ = parent.size_ + unite_parent.size_
            else:
                parent.parent_ = unite_parent
                unite_parent.size_ = parent.size_ + unite_parent.size_


[N, M] = list(map(int, input().split(' ')))
bridge_list = []

for _ in range(M):
    [a, b] = list(map(int, input().split(' ')))
    bridge_list.append((a - 1, b - 1))

node_list = [UnionFindNode(i) for i in range(N)]
combination_num = N * (N - 1) // 2
combination_list = [combination_num]

for bridge in bridge_list[:0:-1]:
    # print(bridge)
    if node_list[bridge[0]].find() != node_list[bridge[1]].find():
        combination_num = combination_num - node_list[bridge[0]].size() * node_list[bridge[1]].size()
        node_list[bridge[0]].unite(node_list[bridge[1]])
    combination_list.append(combination_num)
    # print(combination_num)

for value in combination_list[::-1]:
    print(value)


Measured memory_bytes: 52412
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll gcd(ll a,ll b){
  ll r = a%b;
  while(r > 0){
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,k;cin>>n>>k;
  vi A(n);
  ll now = -1;
  ll ma = 0;
  for(auto &a:A){
    cin>>a;
    ma = max(ma,a);
    if(now < 0)now = a;
    else now = gcd(now,a);
  }
  if(ma < k){cout<<"IMPOSSIBLE"<<endl;return 0;}
  for(int i=0;i<n;i++){
    if(abs(A[i]-k)%now == 0){
      cout<<"POSSIBLE"<<endl;
      return 0;
    }
  }
  cout<<"IMPOSSIBLE"<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define pb push_back

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	char b; cin >> b;
	if(b=='A') cout << 'T';
	else if(b=='T') cout << 'A';
	else if(b=='G') cout << 'C';
	else cout << 'G';
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define gcd(a,b)   __gcd(a,b)
#define lcm(a,b)   (a*b)/gcd
//std::vector<int>v;
//std::vector<int>even;

int main()
{ 
   
    
    #ifndef ONLINE_JUDGE
    freopen("input.txt",   "r",  stdin);
    freopen("output.txt",  "w",  stdout);
    freopen("error.txt",   "w",  stderr);
    #endif
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 3636
<>=~$";
@HW=($`+1,$'+1);
@p=map[<>+0,0],1..$`;
@q=map[<>+0,1],1..$';
for(sort{@$a[0]-@$b[0]}@p,@q){
	$\+=@$_[0]*$HW[!@$_[1]];
	--$HW[@$_[1]]
}
print


Measured memory_bytes: 44800
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

class Color{
public:
  double L,a,b;
  Color(double _L,double _a,double _b) : L(_L),a(_a),b(_b){}
};

int main(){
  int color_num,student_num;
  while(~scanf("%d %d",&color_num,&student_num)){
    vector<Color> colors;
    for(int i=0;i<color_num;i++){
      double L,a,b;
      scanf("%lf %lf %lf",&L,&a,&b);
      colors.push_back(Color(L,a,b));
    }

    bool* flag = new bool[color_num];
    for(int i=0,j=0;i<color_num;i++,j++){
      flag[i] = false;
      if(j<student_num) flag[i] = true;
    }
    
    sort(flag,flag+color_num);
    
    double res = 0;
    do{
      vector<int> nodes;
      for(int i=0;i<color_num;i++){
	if(flag[i]) nodes.push_back(i);
      }
      double sum = 0;
      for(int i=0;i<nodes.size();i++){
	for(int j=i+1;j<nodes.size();j++){
	  int idx1 = nodes[i];
	  int idx2 = nodes[j];
	  sum += (colors[idx1].L - colors[idx2].L) * (colors[idx1].L - colors[idx2].L)
	    + (colors[idx1].a - colors[idx2].a) * (colors[idx1].a - colors[idx2].a)
	    + (colors[idx1].b - colors[idx2].b) * (colors[idx1].b - colors[idx2].b);
	}
      }
      res = max(sum,res);
    }while(next_permutation(flag,flag+color_num));

    printf("%.6lf\n",res);
  }
}

Measured memory_bytes: 1272
#include<stdio.h>
#include<string.h>
int main() 
{
	int N;
	scanf("%d", &N);
	char Str[100];
	scanf("%s", Str);
	if(N%2 != 0)
	{
		printf("No\n");
		return 0;
	}
	int N2 = N/2;
	int a1 = 0;
	int a2 = 0;
	char C1[50];
	char C2[50];
	for(int i = 0;i < N2; i++)
	{
		C1[i]=Str[i];
		a1 += C1[i];
	}
	for(int j = N2;j < N; j++)
	{
		C2[j-N2]=Str[j];
		a2 += C2[j-N2];
	}
	if(a1 == a2 &&(a1 != 0 && a2 != 0))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

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

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            string[] line = Console.ReadLine().Trim().Split(' ');
            var vote = new List<string>();
            var dict = new Dictionary<string,int>();
            for (int i = 0; i < n; i++)
            {
                vote.Add(line[i]);
                if (dict.ContainsKey(line[i])) dict[line[i]] += 1;
                else  dict[line[i]] = 1;
            }
            var winner = "";
            var winnercount = 0;  var nextwinner = 0; var nokori = 0;
            var votemax = dict.Max(x => x.Value);
            var votemaxcount = dict.Count(x => x.Value == votemax);
            if (votemaxcount >= 2) { Console.WriteLine("TIE"); continue; }
            else winner = dict.First(x => x.Value == votemax).Key;
            var dict2 = new Dictionary<string, int>();
            dict2[winner] = 0;
            for (int i = 1; i <= n; i++)
            {
                nokori = n - i;
                if (vote[i - 1] == winner) winnercount += 1;
                else
                {
                    if (dict2.ContainsKey(vote[i - 1])) dict2[vote[i - 1]] += 1;
                    else dict2[vote[i - 1]] = 1;
                }
                nextwinner = dict2.Max(x => x.Value);
                if (winnercount> nextwinner+nokori)
                {
                    Console.WriteLine("{0} {1}", winner, i);
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 9972
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
//#include<string.h>
//#include<time.h>
//#define pi acos(-1.0)
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
int main() {
	int n, m, target[100], i, score[101] = {}, j, p;
	fscanf(stdin, "%d%d", &n, &m);
	for (i = 0; i < m; i++) fscanf(stdin, "%d", &target[i]);
	for (i = 0; i < m; i++)
		for (j = 1; j <= n; j++) {
			fscanf(stdin, "%d", &p);
			if (p == target[i]) score[j]++;
			else score[target[i]]++;
		}
	for (i = 1; i <= n; i++) P(d, score[i]);
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e9;

int main(){
	int x;
	cin>>x;
	int ans;
	rep1(i,100000)if(x<=i*(i+1)/2){ans=i;break;}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;

fun main(args: Array<String>) = with(Scanner(System.`in`)) {
	var s = next();
  	var t = next();
  	var ans = 0;
    for (i in 0..2) {
     if (s[i] == t[i]) ans++; 
    }
  	println(ans);
}

Measured memory_bytes: 31260
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int A;
  int B;
  int C;
  cin >> A >> B >> C;
  
  vector<int> T = {A,B,C};
  
  sort(T.begin(),T.end());
  
  
  int num;
  
  int num2;
  
  if((T[1] - T[0]) % 2 == 0){
    num = T[2] - T[1];
    T[0] = T[0] + num;
    num2 = (T[2] - T[0]) / 2;
    num = num + num2;
    cout << num << endl;
  }
  else{
    T[1] = T[1] + 1;
    T[2] = T[2] + 1;
    num = T[2] - T[1];
    T[0] = T[0] + num;
    num2 = (T[2] - T[0]) / 2;
    num = num + num2 + 1;
    cout << num << endl;
  }
    
}


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

#define F first
#define S second
typedef double db;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll INF=1e17;


ll gcd(ll x,ll y){
return y? gcd(y,x%y):x;
}


int main(){
  ll n,a=0;
  cin>>n;
  for(int i=pow(n,0.5);i>0;i--){
  if(n%i==0){a=i;break;}
  }
  cout<<to_string(n/a).length()<<endl;
return 0;}

Measured memory_bytes: 4024
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
#define ALL(a) a.begin(), a.end()
#define RSORT(a) sort(ALL(a),greater<>())
#define SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) cout << (x) << endl;
#define ENDL cout << endl;
using namespace std;
typedef long long int i64;
typedef unsigned long long u64;
template<class T> using V = vector<T>;
using VI = V<int>;
const int INF = 2e9;
const i64 MOD = 1e9 + 7;

template <class T> inline bool chmin(T& a, T b){if(a>b){a=b; return true;} return false;}
template <class T> inline bool chmax(T& a, T b){if(a<b){a=b; return true;} return false;}
struct Init_On{
    Init_On(){
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(16);
    }
};

signed main(){
    string s , t; cin >> s >> t;
    cout << ( s == t.erase(s.size()) ? "Yes" : "No") << endl; 
}

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

int64_t Q=1000000007;
int64_t ni(int64_t h){
  int64_t N=h; //ここから
       int64_t a=1,b=0,c=1;
       while(N>0){
         a*=2;
         if(N%a!=0){
           N-=a/2;
           int64_t d=2;
           for(int j=0;j<b;j++){
            d=d*d;
             d=d%Q;
          }
           c=c*d;
          c=c%Q;
         }
        b++;
      } //ここまで
  return c;
}

int main() {
  int64_t M,Z=1,z=0,y=0,f=0;
  cin>>M;
  

  map<pair<int64_t,int64_t>,int64_t> m;
  for(int i=0;i<M;i++){
    int64_t a,b;
    cin>>a>>b;
    if(a==0&&b==0){
      f++;
    }
    else if(a==0){
      z++;
    }
    else if(b==0){
      y++;
    }
    else{
      int64_t p=gcd(abs(a),abs(b));
      a/=p;b/=p;
      if(b<0){
        a*=-1,b*=-1;
      }
      m[make_pair(a,b)]++;
    }  
  }
  
  
            
  for(auto x:m){
    int64_t a,b;
    tie(a,b)=x.first;
    if(a<0){
      continue;
    }
    else if(m.count(make_pair(-1*b,a))){
      Z=(Z*(ni(x.second)+ni(m.at(make_pair(-1*b,a)))-1))%Q;
      M-=(x.second+m.at(make_pair(-1*b,a)));
    }
  }
  Z=(Z*(ni(y)+ni(z)-1))%Q;
  M-=(y+z+f);
  Z=(Z*ni(M))%Q;
  cout<<(Z+f-1+Q)%Q<<endl;
      
      
  
}


Measured memory_bytes: 15948
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
using Graphl = vector<vector<ll>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define FOR(itr, v) for (auto itr = (v).begin(); itr != (v).end(); ++itr)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const long long minusINF = -(1LL << 40);
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

string binary(ll bina)
{
    string ans = "";
    while(bina != 0)
    {
        ll a = bina % 2;
        if (a < 0) a += 2;

        bina = (bina - a) / (-2);

        char c = a + '0';
        ans += c;
    }
    reverse(ALL(ans));
    return ans;
}

int main()
{
    ll n; cin >> n;
    cout << (binary(n) == "" ? "0" : binary(n)) << endl;
}

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

int main()
{
	std::string S;
	std::cin >> S;

	if ( S.at( 0 ) == 'A' )
	{
		int counter = 0;
		int index = 0;
		for ( int i = 2; i <= S.length() - 2; i++ )
		{
			if ( S.at( i ) == 'C' )
			{
				counter++;
				index = i;	//	Cが出てきた位置を覚えておく
			}
		}

		if ( counter == 1 )
		{
			// 先頭とCが出てきた位置以外が英小文字かどうかをチェック
			for ( int i = 1; i < S.length(); i++ )
			{
				if ( i != index )
				{
					char tmp = S.at( i );

					if ( tmp >= 'a' && tmp <= 'z' )
					{
						// OK
					}
					else
					{
						// 英小文字以外を含んでいるのでNG
						std::cout << "WA" << std::endl;
						return ( 0 );
					}
				}
			}

			// for文を回りきったらOKなので、ACを出力
			std::cout << "AC" << std::endl;
		}
		else
		{
			// Cを2回以上もしくは一つも含まないのでダメ
			std::cout << "WA" << std::endl;
		}
	}
	else
	{
		// 先頭はAでなければダメ
		std::cout << "WA" << std::endl;
	}

	return ( 0 );
}


Measured memory_bytes: 632
#include<stdio.h>

int main(){
	int yyyy, mm, dd;
	
	scanf("%d%*c%d%*c%d", &yyyy, &mm, &dd);
	
	if(dd<10)
		printf("2018/01/0%d", dd);
	else
		printf("2018/01/%d", dd);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define eps 0.000000001
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int INF=0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
const int maxn=2e5+5;
int n,k,a[maxn];
bool check(int x){
	int ok=0;
	rep(i,1,n){
		ok+=(a[i]-1)/x;
	}
	return ok<=k;
}
int main(){
	cin>>n>>k;
	rep(i,1,n) cin>>a[i];
	int l=1,r=1e9;
	while(l<r){
		int mid=(l+r)>>1;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	cout<<l<<endl;
}


Measured memory_bytes: 4388
import sys
input = sys.stdin.readline
n = int(input())
num = list(map(int, input().split()))
mod = 10**9+7

# 高速素因数分解(√n)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

lcd = dict()
for i in num:
  j = dict(factorization(i))
  for x,y in j.items():
    if not x in lcd.keys():
      lcd[x] = y
    else:
      lcd[x] = max(lcd[x],y)

lc = 1
for i,j in lcd.items():
  lc *= pow(i,j,mod)
  
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

ans =0
for i in range(n):
  ans += lc*modinv(num[i],mod)
  ans %= mod
print(ans)

Measured memory_bytes: 4596
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

printList [a] = print a
printList (a:as) = putStr ( show a ) >> putChar ' ' >> printList as

main = do
	[ d, t, s ] <- readInts
	putStrLn $ which "Yes" "No" $ d <= t * s

Measured memory_bytes: 3776
#include<stdio.h>
int main()
{
	int a,b,c=0;
	char op;
	scanf("%d %c %d",&a,&op,&b);
	if(op=='-') 
	{
		c = (a - b);}
	else if(op=='+') 
	{c = (a + b);}
	printf ("%d\n",c);
	return 0;
}

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

typedef char String[1024];

int main(void)
{
    String str_a, str_b, str_c;
    scanf("%s %s %s", str_a, str_b, str_c);
    
    int a = atoi(str_a);
    int b = atoi(str_b);
    int c = atoi(str_c);
    
    if (a < b && a < c)
    {
        if (b < c)
            printf("%d %d %d\n", a, b, c);
        else
            printf("%d %d %d\n", a, c, b);
    }
    else if (b < a && b < c)
    {
        if (a < c)
            printf("%d %d %d\n", b, a, c);
        else
            printf("%d %d %d\n", b, c, a);
    }
    else
    {
        if (a < b)
            printf("%d %d %d\n", c, a, b);
        else
            printf("%d %d %d\n", c, b, a);
    }
    return (0);
}


Measured memory_bytes: 1996
#include<bits/stdc++.h>
using namespace std;
string w[100];
int main(){
	int n;
	string a,b;
	cin>>n;
	int o=0;
	cin>>w[0];
	for(int i=1;i<n;i++){
		cin>>w[i];
		for(int k=0;k<i;k++){
			if(w[i]==w[k]){
				o++;
			}
		}
		a=w[i];
		b=w[i-1];
		if(a[0]!=b[b.size()-1]){
			o++;
		}
	}
	if(o==0){
	cout<<"Yes"<<endl;
}
else cout<<"No"<<endl;
}
//伊勢田=sanadayukimura"73"
//伊勢田=48
//73=48
//両方から23を引いて
//50=25
//2=1
//伊勢田＝４８かつ伊勢田＝７３
//よって１＝２
//多田語録
//いっフェラ
//うる精子
//


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

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned long long ull;

#define Max_effort ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define debug(x) cerr<<#x<<" = "<<(x)<< nl
#define nl "\n"
#define sp " "

ll k ,x;

int main() {
	Max_effort
	cin >> k >> x;
	k *=500ll;
	cout<<((k<x)?"No":"Yes");
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func countMod(str string) map[int]int {
	const div = 2019
	prev := 0
	l := len(str)
	digit := 1
	count := make(map[int]int)
	count[0] = 1
	for i := l - 1; i >= 0; i-- {
		n := int(rune(str[i]) - '0')
		mod := (n*digit + prev) % div
		count[mod]++
		prev = mod
		digit *= 10
		digit %= div
	}
	return count
}

func solve(str string) int {
	count := countMod(str)
	ans := 0
	for _, v := range count {
		ans += v * (v - 1) / 2
	}
	return ans
}

func main() {
	var str string
	fmt.Scan(&str)

	ans := solve(str)
	fmt.Println(ans)
}


Measured memory_bytes: 3468
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;

typedef pair<long,long> P;
long  d[55][55];

int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);
    
    vector<long> a(n), as(n+1);
    vector<long> b(n), bs(n+1);
    long i;
    as[0]=0;
    for(i=0; i<n; i++) {
        scanf("%ld", &a[i]);
        as[i+1]=as[i]+a[i];
    }
    bs[0]=0;
    for(i=0; i<n; i++) {
        scanf("%ld", &b[i]);
        bs[i+1]=bs[i]+b[i];
    }

    long max=0;
    for(i=0; i<n; i++) {
        long tmp = as[i+1] + bs[n]-bs[i];
        if(max <tmp) max=tmp;
    }
    printf("%ld\n", max);

    return 0;
}


Measured memory_bytes: 256
n,A,B,C=map(int,input().split())
L=[]
r=10000
for i in range(n):
	l=int(input())
	L.append(l)
def k(i,a,b,c,s):
	global r
	if i==n:
		if a!=A and b!=B and c!=C:
			s+=abs(a)+abs(b)+abs(c)-30
			r=min(r,s)
	else:
		k(i+1,a-L[i],b,c,s+10)
		k(i+1,a,b-L[i],c,s+10)
		k(i+1,a,b,c-L[i],s+10)
		k(i+1,a,b,c,s)
a=A
b=B
c=C
k(0,a,b,c,0)
print(r)

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

int main(void){
	char s[128];
	int c=0,i,len,y=1;
	scanf("%s",s);
	len = strlen(s);
	for(i=0;i<len;i++){
		if(s[i] == 'C'){c++;}
		if(s[i] == 'F' && c){printf("Yes\n");y=0;break;}
	}
if(y){printf("No\n");}
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <complex>
#include <vector>
using namespace std;
const double eps = 1e-10;
#define EQ(a, b) (abs((a) - (b)) < eps)
using P = complex<double>;      // position
double dot(const P &a, const P &b) { return real(conj(a) * b); }
double cross(const P &a, const P &b) { return imag(conj(a) * b); }

bool is_orthogonal(P a1, P a2, P b1, P b2) {
    return EQ(dot(a1 - a2, b1 - b2), 0);
}
bool is_parallel(P a1, P a2, P b1, P b2) {
    return EQ(cross(a1 - a2, b1 - b2), 0);
}

#include <iostream>
int main() {
    int q; cin >> q;
    while (q--) {
        vector<P> ps;
        for (int i = 0; i < 4; i++) {
            int x, y; cin >> x >> y;
            ps.emplace_back(x, y);
        }
        if (is_parallel(ps[0], ps[1], ps[2], ps[3])) {
            cout << 2 << endl;
        } else if (is_orthogonal(ps[0], ps[1], ps[2], ps[3])) {
            cout << 1 << endl;
        } else {
            cout << 0 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3100