akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define EPS 1e-9
#define ll long long
#define Pll pair<ll, ll>
#define Pii pair<int, int>
 
using namespace std;
struct edge{int from, to; ll cost;};

int N;
int bit[1000001];

void clear(){
    rep(N+1) bit[i] = 0;
}

void update(int index, int value){
    for(int i=index; i <= N; i += i & -i){
        bit[i] += value;
    }
}

//sum bit[1]~bit[back_index]
int calc_sum(int back_index){
    int sum = 0;
    for(int i=back_index; i >= 1; i -= i & -i){
        sum += bit[i];
    }
    return sum;
}

// count swaps
ll calc_swap(vector<int> v){
    ll ret = 0;
    reppp(i, 1, N){
        update(v[i], 1);
        ret += (ll)(i - calc_sum(v[i]));
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    ll ans = 0;
    string s;
    cin >> s;
    N = (int)s.length();
    map<char, int> mp;
    rep(N) mp[s[i]]++;

    int odd = 0;
    for(auto itr=mp.begin();itr!=mp.end();++itr){
        if(itr->second % 2){
            odd++;
            if(odd > 1){
                cout << -1 << endl;
                return 0;
            }
        }
    }

    // 左右に分けるのに必要な交換回数
    vector<int> index(N+1);
    map<char, int> mp_dec(mp);
    int front_idx = 1, back_idx = (N+1)/2 + 1;
    int center_idx = (N+1)/2;
    rep(N){
        if(mp[s[i]] % 2  == 1 && (mp[s[i]]+1)/2 == mp_dec[s[i]]){
            index[i+1] = center_idx;
        }else{
            if(mp_dec[s[i]] > mp[s[i]]/2){
                index[i+1] = front_idx;
                front_idx++;
            }else{
                index[i+1] = back_idx;
                back_idx++;
            }
        }
        mp_dec[s[i]]--;
    }
    ans += calc_swap(index);
    clear();
    // cout << ans << endl;
    vector<char> ss(N+1);
    rep(N) ss[index[i+1]] = s[i];

    // 右半分を並べ替えるのに必要な交換回数
    map<char, vector<int>> mp_right_idx;
    for(int i=center_idx-((N%2==1)?1:0);i>=1;i--){
        mp_right_idx[ss[i]].push_back(center_idx-((N%2==1)?1:0) + 1 - i);
    }
    vector<int> right_idx(N/2+1);
    reppp(i, (N+1)/2+1, N){
        right_idx[i - (N+1)/2] = mp_right_idx[ss[i]][0];
        mp_right_idx[ss[i]].erase(mp_right_idx[ss[i]].begin());
    }
    N = N/2;
    ans += calc_swap(right_idx);
    cout << ans << endl;
}


Measured memory_bytes: 3844
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999

int n,k,m;


int main(){
    while(cin>>n>>k>>m&&(n||k||m)){
        vector<int> data(n);
        rep(i,n)data[i]=i;
        int now = m-1;
        rep(loop,n-1){
            data.erase(data.begin()+now);
            now = (now-1+k)%data.size();
        }
        cout<<data[0]+1<<endl;
    }
}

Measured memory_bytes: 1252
l = list(map(int,input().split()))
if max(l)==l[1]:
    print(l[1]+l[2])
elif max(l)==l[0]:
    print(l[1]+l[2])
else:
    if l[2]>l[0]+l[1]:
        print(2*l[1]+l[0]+1)
    else:
        print(l[1]+l[2])
        
        

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int gcd(int a,int b)
{
  if(b==0) return a;
  else gcd(b,a%b);
}
int main()
{
  int a,b;
  cin>>a>>b;
  long long int s=(long long)a*b;
  int l;
  if(a<b) l=gcd(b,a);
  else l=gcd(a,b);
  s/=l;
  cout<<s;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9
	final int _intMin = Integer.MIN_VALUE;
	final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18
	final long _longMin = Long.MIN_VALUE;
	static boolean bElapsed = false;

	void solve() {
		String line = readLine();
		p(line.charAt(0));
		p(line.length() - 2);
		p(line.charAt(line.length() - 1));
		pln("");
	}

	int abs(int a) {
		return (a >= 0) ? a : -a;
	}

	int max(int a, int b) {
		return (a > b) ? a : b;
	}

	int min(int a, int b) {
		return (a < b) ? a : b;
	}

	int pint(String s) {
		return Integer.parseInt(s);
	}

	long plong(String s) {
		return Long.parseLong(s);
	}

	String readLine() {
		try {
			return _in.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int readNum() {
		String line = readLine();
		return pint(line);
	}

	String[] readFlds() {
		String line = readLine();
		return line.split(" ");
	}

	int[] readNums() {
		String[] flds = readFlds();
		int[] nums = new int[flds.length];
		for (int i = 0; i < flds.length; i++) {
			nums[i] = pint(flds[i]);
		}
		return nums;
	}

	void p(char c) {
		_out.print(c);
	}

	void pln(char c) {
		_out.println(c);
	}

	void p(double d) {
		_out.print(d);
	}

	void pln(double d) {
		_out.println(d);
	}

	void p(long l) {
		_out.print(l);
	}

	void pln(long l) {
		_out.println(l);
	}

	void p(String s) {
		_out.print(s);
	}

	void pln(String s) {
		_out.println(s);
	}

	static BufferedReader _in;
	static PrintWriter _out;

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		_in = new BufferedReader(new InputStreamReader(System.in));
		_out = new PrintWriter(System.out);
		new Main().solve();
		_out.flush();
		long end = System.currentTimeMillis();
		if (bElapsed) {
			System.err.println((end - start) + "ms");
		}
	}
}


Measured memory_bytes: 23124
import sys
from heapq import heapify, heappop

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    S = input()
    k = int(input())
    n = len(S)

    SS = set()
    for i in range(n):
        ss = S[i]
        SS.add(ss)
        for j in range(i + 1, min(n, i + k)):
            ss += S[j]
            SS.add(ss)

    SS = list(SS)
    heapify(SS)
    for _ in range(k):
        res = heappop(SS)
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10556
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<climits>
#include<bitset>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define int long long
using namespace std;
inline int read(){
    int f=1,ans=0;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
    return f*ans;
}
const int MAXN=1e5+11;
vector<int> vec[MAXN],vec1[MAXN];
int N,M,f[MAXN],vis[MAXN],A[MAXN],B[MAXN],C[MAXN],S[MAXN],p[MAXN];
struct Union{
    int f[MAXN];void init(){for(int i=1;i<=N;i++) f[i]=i;return;}
    int find(int x){return f[x]==x?x:f[x]=find(f[x]);}
}SS;
bool cmp(int x,int y){return C[x]<C[y];}
void dfs(int u){
    S[u]=B[u];for(auto v:vec[u]){dfs(v),S[u]+=S[v];}
    f[u]=S[u]+C[u];for(auto v:vec[u]) f[u]=min(f[u],S[u]-S[v]+max(f[v],C[u]));
    return;
}
signed main(){
    N=read(),M=read();for(int i=1;i<=N;i++) A[i]=read(),B[i]=read(),C[i]=max(A[i]-B[i],0ll),p[i]=i;
    for(int i=1;i<=M;i++){int u=read(),v=read();vec1[u].pb(v),vec1[v].pb(u);}SS.init();
    sort(p+1,p+N+1,cmp);
    for(int i=1;i<=N;i++){
        int u=p[i];
        for(auto v:vec1[u]) if(vis[v]&&SS.find(v)!=u) {vec[u].pb(SS.find(v)),SS.f[SS.find(v)]=u;}vis[u]=1;
    }dfs(p[N]);printf("%lld\n",f[p[N]]);return 0;
}



Measured memory_bytes: 22608
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int i = n;
        int fx = 0;
        while (true) {
            if (i / 10 != 0) {
                fx += i % 10;
                i /= 10;
            } else {
                fx += i;
                break;
            }
        }
        if (n % fx == 0)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 22868
import scala.io.StdIn

object Main{
  def main(args: Array[String]){
    var list = List[Int]()

    for(in <- StdIn.readLine.split(" ").map(_.toInt)){
      list = in :: list
    }

    boc(list.reverse)
  }

  def boc(a: List[Int])={
    if(a(0) - a(1) == 0) println("a == b")
    else if(a(0) - a(1) > 0) println("a > b")
    else if(a(0) - a(1) < 0) println("a < b")
    else println()
  }
}

Measured memory_bytes: 43944
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


class Main{
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int number[] = new int[3];
        int count = 0;

        String word = br.readLine();
        String strArray[] = word.split(" ");

        try{
            for(int i=0;i<strArray.length;i++){
                if(strArray[i] != " ");
                number[count] = Integer.parseInt(strArray[i]);
                count++;
            }

            if(number[0] < number[1] && number[1] < number[2]){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }

        }catch(ArrayIndexOutOfBoundsException e){

        }
    }
}

Measured memory_bytes: 16896
#include <iostream>
#include <array>

int main(){
    int N;
    std::cin >> N;
    std::array<int, 13> S,H,C,D;
    for(int& x : S){x = 0;}
    for(int& x : H){x = 0;}
    for(int& x : C){x = 0;}
    for(int& x : D){x = 0;}
    
    char s;
    while(std::cin >> s){
        int tmp = 0;
        std::cin >> tmp;
        if(s == 'S'){
            S[tmp-1] = 1;
        }else if(s == 'H'){
            H[tmp-1] = 1;
        }else if(s == 'C'){
            C[tmp-1] = 1;
        }else if(s == 'D'){
            D[tmp-1] = 1;
        }else{
            return -1;
        }
    }
    
    for(int i=0; i<13; i++){if(S[i]==0){std::cout << "S" << " " << i+1 << std::endl;}}
    for(int i=0; i<13; i++){if(H[i]==0){std::cout << "H" << " " << i+1 << std::endl;}}
    for(int i=0; i<13; i++){if(C[i]==0){std::cout << "C" << " " << i+1 << std::endl;}}
    for(int i=0; i<13; i++){if(D[i]==0){std::cout << "D" << " " << i+1 << std::endl;}}
    
    return 0;
}



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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int count = 0;
    for(int i = a; i <= b; i++){
        if(c%i == 0) count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3108
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in

    let judge1 d = d = n - 1 || d <= n / 2 in

    let judge2 d1 c1 d2 c2 =
        let d1, c1, d2, c2 = if d1 < d2 then d1, c1, d2, c2
                                        else d2, c2, d1, c1
        in
        d1 + 1 = d2 && d2 * 2 - n <= c1 && c1 <= d2 - 1
    in

    let rec loop2 i d1 c1 d2 c2 =
        if i = n then judge2 d1 c1 d2 c2 else
            if a.(i) = d1 then loop2 (i + 1) d1 (c1 + 1) d2 c2 else
            if a.(i) = d2 then loop2 (i + 1) d1 c1 d2 (c2 + 1) else false
    in

    let rec loop i d1 c1 =
        if i = n then judge1 d1 else
            if a.(i) = d1 then loop (i + 1) d1 (c1 + 1)
                         else loop2 (i + 1) d1 c1 a.(i) 1
    in
    loop 1 a.(0) 1 |> (fun k -> print_endline @@  if k then "Yes" else "No")
)

Measured memory_bytes: 5376
#include<iostream>

using namespace std;
const int n = 123456 * 2 + 1;
bool sieve[n] = {false};
int cnt[n] = {0};

int main() {
    for (int i = 2; i < n; ++i) {
        if (!sieve[i])
            for (int k = i + i; k < n; k += i) sieve[k] = true;
    }

    int c = 0;
    for (int i = 0; i < n; ++i) {
        if (!sieve[i]) c++;
        cnt[i] = c;
        //cout << c << " ";
    }

    while (1) {
        int i;
        cin >> i;
        if (i == 0) break;

        cout << cnt[i * 2] - cnt[i] << endl;
    }
}

Measured memory_bytes: 4296
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main() {
    ll N;
    cin >> N;
    string s,sub;
    cin >> s >> sub;
    ll ans=3;
    bool ht=false,jg=false;
    for(int i=0;i<N-1;i++){
        if(s[i]==s[i+1]){
            if(jg)ans=(ans*3)%MOD;
            else ans=(ans*2)%MOD;
            i++;
            ht=false;
            jg=true;
        }
        else{
            if(ht)ans=(ans*2)%MOD;
            ht=true;
            jg=false;
        }
    }
    if(ht)ans=(ans*2)%MOD;
    cout << ans << endl;
}

Measured memory_bytes: 256
let split_string s = Str.split (Str.regexp "") s
let () =
  let res = ref "No" in
  let f lst =
    match lst with
    | x :: xs -> xs @ [x] in
  let s = split_string @@ Scanf.scanf "%s\n" (fun x -> x) in
  let t = split_string @@ Scanf.scanf "%s\n" (fun x -> x) in
  let x = ref t in
  for i = 0 to List.length s do
    (x := f (!x);
     if compare s !x = 0 then res := "Yes"
     else ()
    )
  done;
  
  Printf.printf "%s\n" !res



Measured memory_bytes: 640
(let ((a (read)) (b (read)) (c (read)) (d (read))
      train bus)
  (if (< a b)
      (setf train a)
      (setf train b))
  (if (< c d)
      (setf bus c)
      (setf bus d))
  (format t "~a~%" (+ train bus)))


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

int main() {
  int N;
  cin >> N;
  int COUNT = 0;
  vector<int> A(N);
    for (int i = 0; i < N; i++) 
    cin >> A.at(i);
  vector<int> B(N);
    for (int i = 0; i < N; i++) {
    cin >> B.at(i);
  COUNT += B.at(i);
    }
  vector<int> C(N);
    for (int i = 0; i < N-1; i++) 
    cin >> C.at(i);
  for (int i = 0; i < N-1; i++){ 
    if ( A.at(i)+1 == A.at(i+1) )
      COUNT += C.at(A.at(i)-1);
    }
  cout << COUNT << endl; 
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush


def solve():
    n = II()

    fact = []
    for i in range(1, int(pow(n, 0.5))+1):
        if n % i == 0:
            fact.append((i, n//i))
    # print(fact)

    def f(a, b):
        def keta(c):
            return len(list(str(c)))
        return max(keta(a), keta(b))

    ans = INF
    for (x, y) in fact:
        ans = min(ans, f(x, y))
    print(ans)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 3520
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main(){
    FAST
    int n;
    cin>>n;
    double ans=(ceil(n/2.0))/(double)n;
    cout<<fixed<<setprecision(10);
    cout<<ans;
    return 0;
}

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

vector<bool> sf(11);
int main(void){
	int N,M,ans = 0;
	cin >> N >> M;
	int k[15],s[M][10],p[15];
	for(int i=0;i<M;i++){
		cin >> k[i];
		for(int j=0;j<k[i];j++){
			cin >> s[i][j];
			s[i][j]--;
		}
	}
	for(int i=0;i<M;i++)cin>>p[i];
	
	for(int i=0;i< 1<<N;i++){
		for(int j=0;j<N;j++){
			if((i>>j)&1){
				sf[j] = true;
			}else{
				sf[j] = false;
			}
		}
		bool flag = true;
		for(int j=0;j<M;j++){
			int cnt = 0;
			for(int a=0;a<k[j];a++){
				if(sf[s[j][a]]==true)cnt++;
			}
			if(cnt%2 == p[j]){
			}else{
				flag = false;
				break;
			}
		}
		if(flag)ans++;
	}
	cout << ans << endl;
}

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int dp[101000];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  string s;
  ll k;
  cin>>s>>k;
  int n=s.size();
  ll ans=0;
  int cnt=0;
  rep(i,n-1){
    if(s[i]==s[i+1]) cnt++;
    else{
      ans+=(cnt+1)/2;
      cnt=0;
    }
  }
  ans+=(cnt+1)/2;
  ans*=k;
  
  if(s[0]==s[n-1]){
    int head=0, tail=0;
    rep(i,n-1){
      if(s[i]==s[i+1]) head++;
      else break;
    }
    for(int i=n-1; i>=1; i--){
      if(s[i]==s[i-1]) tail++;
      else break;
    }
    head++; tail++;
    if(head%2==1&&tail%2==1){
      if(head==n) ans=(n*k)/2;
      else ans+=k-1;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n;
    cin >> n;
    vector<int> A(n), B(n), C(n);
    rep(i, n) cin >> A[i];
    rep(i, n) cin >> B[i];
    rep(i, n) cin >> C[i];
    sort(ALL(A));
    sort(ALL(B));
    sort(ALL(C));

    ll ans = 0;
    rep(i, n) {
        ll a = lower_bound(ALL(A), B[i]) - A.begin();
        ll c = n - (upper_bound(ALL(C), B[i]) - C.begin());
        ans += a * c;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <cstdio>
#include <cstring>

using namespace std;

char s[109];

int main() {
  scanf("%s", s);
  int n = (int)strlen(s);
  int ans = 0;
  for (int i = 0; i < n / 2; ++i) {
    if (s[i] != s[n - 1 - i]) {
      ++ans;
    }
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define fixed thgrerde
#define f(i,f, t)  for(int i = f; i <  t; i++)
#define fr(i,f, t) for(int i = f; i >= t; i--)

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

const int infint = INT_MAX;
const ll infll   = LLONG_MAX;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int k; cin >> k;
    vector<ll> arr(k);
    for(int i = 0; i < k; i++){
        cin >> arr[i];
    }
    ll mn= -1, mx = -1;
    if(arr[k - 1] != 2){
        cout << -1;
        return 0;
    }
    ll lstmx = 3, lstmn = 2;
    for(int i = k - 2; i >= 0; i--){
        ll takeThisMx = (ll)ceil(((double)(lstmx + 1LL) / arr[i]));
        lstmx = takeThisMx * arr[i] - 1LL;
        ll takeThisMn = (ll)ceil(((double)(lstmn) / arr[i]));
        lstmn = takeThisMn * arr[i];
    }
    if(lstmn > lstmx){
        cout << -1;
        return 0;
    }
    cout << lstmn << " " << lstmx;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
long long n,m,a,b;
int main()
{
    cin>>n>>m;
    for (int i=1;i<=n;i++)
        a=a*10+m;
    for (int i=1;i<=m;i++)
        b=b*10+n;
    cout<<max(a,b);
    return 0;
}


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

int main(){

int n,m;
cin>>n>>m;

int a[m];
for(int i = 0; i < m ; i++ ){
    cin>>a[i];
    n = n - a[i];
}

if(n>=0) cout<<n<<endl;
else cout<<"-1"<<endl;

}


Measured memory_bytes: 3608
import java.util.*;
public class Main{
  private static String strs;
  static char []a;
public static void main(String [] args){
    Scanner sc = new Scanner(System.in);
    strs=sc.next();
    char[]a = strs.toCharArray();
    for (int i=a.length-1;i>=0;i--){
    	System.out.print(a[i]);
    }
    System.out.println();
  }
}

Measured memory_bytes: 17124
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

from itertools import product
D=sorted([a+b for a,b in product(A,B)],reverse=True)
D=D[:K]
E=sorted([d+c for d,c in product(D,C)],reverse=True)
for i in range(K):
    print(E[i])


Measured memory_bytes: 149616
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int N, X;
    cin >> N >> X;
    vector<int> dist(N, 0);
    for (int i = 0; i < N; ++i) {
        int x;
        cin >> x;
        dist[i] = abs(X - x);
    }

    int ans = dist[0];
    for (int i = 1; i < N; ++i) {
        ans = __gcd(ans, dist[i]);
    }

    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define ff first
#define ss second
#define vi vector<int>
#define pb emplace_back
#define ll long long int
#define vll vector<long long int>
#define vpi vector<pair<ll,ll>>
#define bit(x) __builtin_popcount(x)
#define all(x) (x).begin(), (x).end()
#define mem(a) memset(a , 0 ,sizeof a)
#define rep(i,n) for(int i=0 ; i<n ; ++i)
#define deb(x) cout << #x << " - " << x << endl;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll MOD = 1e9 + 7;
const ll INF = 10000000000000000;
const ll MAX_N = 1e5 + 7;
 
using namespace std;

int main(){
    IOS;
    int k,a,b; cin>>k>>a>>b;
    bool flag=0;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            flag=1; 
            break;
        }
    }
    if(flag) cout<<"OK";
    else cout<<"NG";
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cmath>
int main()
{
   int n,d;
   std::cin >> n >> d;
   int **x = new int*[n];
   for (int i=0; i<n; i++) {
      x[i] = new int[d];
      for (int j=0; j<d; j++) {
         std::cin >> x[i][j];
      }
   }
 
   int cnt(0);
   float err(1e-4);
   for (int i=0; i<n; i++) {
      for (int j=i+1; j<n; j++) {
         float distance(0);
         for (int iDim=0; iDim<d; iDim++) {
            distance += (x[i][iDim]-x[j][iDim]) * (x[i][iDim]-x[j][iDim]);
         }
         distance = std::sqrt(distance);
         if (std::abs(distance-(int)distance) < err) cnt++;
      }
   }
   std::cout << cnt << std::endl;
   return 0;
}


Measured memory_bytes: 256
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

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

signed main()
{
    int N;
    cin >> N;
    int A[N];
    int sum = 0;
    rep(i, N)
    {
        cin >> A[i];
        sum += A[i];
    }

    int ans = INF;
    int tmp_sum = 0;
    for (int i = 0; i < N - 1; i++)
    {
        tmp_sum += A[i];
        sum -= A[i];
        ans = min(ans, abs(tmp_sum - sum));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,i,j,k,l;
    cin>>n>>m;
    map<long long int , long long int> mp;
    for(i=1;i<=m;i++)
    {
        cin>>k>>l;
        mp[k]++;
        mp[l]++;
    }
    for(i=1;i<=n;i++)
        cout<<mp[i]<<endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll n,count=0,s,k=1;
	cin >> n;
	vector<ll>a(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll flag = 0;
	for (ll i = 0; i < n; i++) {
		if (a[i] != 1) {
			flag++;
		}
	}
	if (flag == n) {
		cout << -1 << endl;
		exit(0);
	}

	for (ll i = n - 1; i >= 0; i--) {
		if (a[i] == 1) {
			count += i;
			s = i;
			k++;
			break;
		}
	}
	for (ll i = s; i<n; i++) {
		if (a[i] == k) {
			count += i-s-1;
			s = i;
			k++;
		}
		else if (i == n - 1) {
			count += n - 1 - s;
		}
	}
	cout << count << endl;


}



Measured memory_bytes: 1792
N, D = map(int, input().split())

listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;

idx1 = 0
cnt = 0
for idx1 in range(N):
  idx2 = idx1 + 1
  for idx2 in range(idx1 + 1 , N):
    idx3 = 0
    dis_sq = 0
    dis = 0
    for idx3 in range(D):
      dis_sq += ( listA[idx1][idx3] - listA[idx2][idx3] )** 2
    dis = float(dis_sq ** (1/2))
    if dis - int(dis) == 0:
      cnt += 1

print(cnt)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
#define pb push_back
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; }

ll dp[210000] = {};

int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> c(200010),c2;
    REP(i,N){
        cin >> c[i];
        if(i >= 1){
            if(c[i] != c[i-1]){
                c2.pb(c[i]);
            }
        }
        else c2.pb(c[i]);
    }
    dp[0] = 1;
    vector<int> used(200010,-1);
    used[c2[0]] = 0;
    REPP(i,1,c2.size()){
        if(used[c2[i]] == -1){
            dp[i] = dp[i-1];
        }
        else {
            dp[i] = (dp[i-1] + dp[used[c2[i]]]) % 1000000007;
        }
      used[c2[i]] = i;
    }
    cout << dp[c2.size()-1] << endl;
}

Measured memory_bytes: 4340
#include <stdio.h>
#include <stdlib.h>
//#define ll long long int
#define ll double

typedef struct tag_pair{
	int Pos;
	int Cost;
}Pair;	

Pair nP(int p,int c){Pair P;P.Pos=p;P.Cost=c;return P;}

int cmp(const void *a,const void *b);
int cmp0(const void *a,const void *b);
int WF[102][102];

Pair E[102][102];
int Ec[102];
int From[6000],To[6000],Cost[6000];

ll dp[102];
ll dp2[102];


int Min(int x,int y){return x>y?y:x;}

int main(){
	int N,M,P;
	int i,j,k;
	int c;
	int now;
	while(1){
		scanf("%d %d %d\n",&N,&M,&P);
		if(N==0&&M==0&&P==0)break;
		int Inf=(int)1e9;
		for(i=0;i<N;i++)for(j=0;j<N;j++)WF[i][j]=(i==j)?0:Inf;
		
		for(i=0;i<M;i++){
			scanf("%d %d %d\n",&From[i],&To[i],&Cost[i]);
			WF[From[i]][To[i]]=WF[To[i]][From[i]]=Cost[i];
		}
		
		for(k=0;k<N;k++){
			for(i=0;i<N;i++){
				for(j=0;j<N;j++){
					WF[i][j]=WF[j][i]=Min(WF[i][j],WF[i][k]+WF[k][j]);
				}
			}
		}
		
		//0->N-1????????????????????????edge????????????
		for(i=0;i<N;i++)Ec[i]=0;
		for(i=0;i<M;i++){
			if(WF[From[i]][N-1]==WF[To[i]][N-1]+Cost[i] && WF[From[i]][0]+Cost[i]==WF[To[i]][0] ){
				E[From[i]][Ec[From[i]]]=nP(To[i],Cost[i]);
				Ec[From[i]]++;
			}
			if(WF[To[i]][N-1]==WF[From[i]][N-1]+Cost[i] && WF[To[i]][0]+Cost[i]==WF[From[i]][0] ){
				E[To[i]][Ec[To[i]]]=nP(From[i],Cost[i]);
				Ec[To[i]]++;
			}
		}
		
		Pair tmp[N];
		for(i=0;i<N;i++){
			tmp[i]=nP(i,WF[i][0]);//???->N-1??????????????¢
		}
		qsort(tmp,N,sizeof(Pair),cmp0);
		
		for(i=0;i<N;i++)dp[i]=0;
		dp[0]=1;
		for(i=0;i<N;i++){
			now=tmp[i].Pos;
			for(j=0;j<Ec[now];j++){
				dp[E[now][j].Pos]+=dp[now];
			}
		}
		
		for(;P>0;P--){
			scanf("%d",&c);
			for(i=0;i<N;i++)dp2[i]=0;//dp2[i]:c??????i???????????????????????°
			dp2[c]=1;
			for(i=0;i<N;i++){
				now=tmp[i].Pos;
				for(j=0;j<Ec[now];j++){
					dp2[E[now][j].Pos]+=dp2[now];
				}
			}
			double prob=(double)dp[c];
			prob/=(double)dp[N-1];
			prob*=(double)dp2[N-1];
			printf("%.12f\n",prob);
		}
		puts("");
	}
	return 0;
}


int cmp(const void *x,const void *y){//???????????????
	Pair X=*(Pair *)x;
	Pair Y=*(Pair *)y;
	
	return X.Cost>Y.Cost?-1:X.Cost<Y.Cost?1:0;
}
int cmp0(const void *x,const void *y){//????????????
	Pair X=*(Pair *)x;
	Pair Y=*(Pair *)y;
	
	return X.Cost>Y.Cost?1:X.Cost<Y.Cost?-1:0;
}

Measured memory_bytes: 840
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    vector<ll> cnt(10,0);
    cnt[a]++; cnt[b]++; cnt[c]++;
    cout<<(cnt[a]*cnt[b]*cnt[c]==4?"Yes":"No")<<endl;
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
	string s; cin >> s;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] == ',') s[i] = ' ';
	}
	cout << s << endl;
	return 0;
}

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

vector<ll> divisor(ll n){
   vector<ll> ret;
   for(ll i=2;i*i<=n;i++){
      if(n%i==0){
        ret.push_back(i);
        if(i*i!=n) ret.push_back(n/i);
      }
   }
   sort(ret.begin(),ret.end());
   return ret;
}
int main(){
  ll n;
  cin>>n;
  vector<ll> n_div(divisor(n)),niti_div(divisor(n-1));
  n_div.push_back(n);
  niti_div.push_back(n-1);
  ll ans = (ll) niti_div.size();
  ll ro =(ll) n_div.size();
  for(ll i=0;i<ro;i++){
    ll nn=n;
    while(nn%n_div[i]==0&&nn!=0){
        nn=nn/n_div[i];
    }
    if(nn%n_div[i]==1){
        ans++;
    }
  }
  if(n==2){
    ans--;
  }
  cout<<ans<<'\n';
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

#define N 1000

int main(void) {
    int n;
    cin >> n;
    
    for(int k = 0; k < n; ++k) {
        string s1, s2; 
        int max = -1;
        int ans[N + 1][N + 1];
        
        cin >> s1 >> s2;
        
        for(int i = 0; i < s1.length(); ++i) {
            ans[i][0] = 0;
        }
        for(int j = 0; j < s2.length(); ++j) {
            ans[0][j] = 0;
        }
        
        for(int i = 0; i < s1.length(); ++i) {
            for(int j = 0; j < s2.length(); ++j) {
                if(s1[i] == s2[j]) {
                    ans[i + 1][j + 1] = ans[i][j] + 1;
                } else {
                    ans[i + 1][j + 1] = (ans[i][j + 1] > ans[i + 1][j]) ? ans[i][j + 1] : ans[i + 1][j];
                }
                max = (max > ans[i + 1][j + 1]) ? max : ans[i + 1][j + 1];
            }
        }
        
        cout << max << endl;
    }
}


Measured memory_bytes: 7004
using System;
using System.Linq;

namespace AtCoder.Abc
{
    class QuestionC
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var sp = Console.ReadLine().Split(' ');
            var x = int.Parse(sp[0]);
            var n = int.Parse(sp[1]);
            int[] p = new int[0];
            if (n > 0)
            {
                sp = Console.ReadLine().Split(' ');
                p = sp.Select(i => int.Parse(i)).ToArray();
            }
            var w = new int[202];
            foreach(var i in p)
            {
                w[i+100] = 1;
            }
            for (var i = 0; i < 101; i++)
            {
                if(w[x+100-i] == 0)
                {
                    Console.WriteLine(x - i);
                    break;
                }
                if(w[x+100+i] == 0)
                {
                    Console.WriteLine(x + i);
                    break;
                }
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28224
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define PI 3.14159265359

int calc(vector<string> blue, vector<string> red, string key){
    int ans = 0;
    rep(i, blue.size()){
        if(key == blue[i]) ans++;
    }

    rep(i, red.size()){
        if(key == red[i]) ans--;
    }

    return ans;
}

int main(){
    int n; cin >> n;
    vector<string> s(n);
    rep(i,n) cin >> s[i];

    int m; cin >> m;
    vector<string> t(m);
    rep(i,m) cin >> t[i];

    int ans = 0;
    rep(i, s.size()){
        ans = max(ans, calc(s, t, s[i]));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3504
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <queue>
#include <string.h>
#include <bitset>

#define ll long long int
#define ld long double
#define rep(i,n) for(int i = 0;i < n;i++)
#define rep1(i,n) for(int i = 1;i < n;i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define allr(x) x.begin(),x.end(),greater<int>()
#define P pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;

int main(){
	string s,t;
	cin >> s >> t;
	cout << t << s << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>


template <class T> void chmin(T&a, const T&b) { a = min(a,b); }
template <class T> void chmax(T&a, const T&b) { a = max(a,b); }

const double EPS =1e-9;
const long INF =2147483647;//32bit 2*1e+9
const long MOD =1e+9+7;
#define PI 3.14159265258979

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

int main(void){
	int K;
	string S;
	cin>>S>>K;

	REP(i,(int)S.length()){
		if(S[i]!='a'&&K>=('{'-S[i])){
			K-=('{'-S[i]);
			S[i]='a';
		}
	}
	
	REP(i,K%26){
		if(S[S.length()-1]=='z') S[S.length()-1]='a';
		else S[S.length()-1]++;
	}
	
	cout<<S<<endl;
	
	return 0;
}



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

int main(){
	int house[4][3][10];
	int n,b,f,v,r;

	for(int i=0;i<4;i++){
		for(int j=0;j<3;j++){
			for(int k=0;k<10;k++)
				house[i][j][k]=0;
		}
	}
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>b>>f>>r>>v;
		house[b-1][f-1][r-1]+=v;
	}
	for(int i=0;i<4;i++){
		for(int j=0;j<3;j++){
			for(int k=0;k<10;k++){
				cout<<" "<<house[i][j][k];
			}
			cout<<endl;
		}
		if(i<3)cout<<"####################"<<endl;
		
	}

	return 0;
}

Measured memory_bytes: 3100
#include<iostream>
using namespace std;
typedef long long ll;
struct node{

  ll x,y;

}a[1005];
int main()
{
    ll n,h,w,cnt=0;
    cin>>n>>h>>w;
    for(int i=0;i<n;++i){
        cin>>a[i].x>>a[i].y;
        if(a[i].x>=h&&a[i].y>=w){
            cnt++;
        }
    }
    cout<<cnt<<endl;


    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = null;
		try{
			scan = new Scanner(System.in);
			int[] dataset = new int[5];
			while((dataset[0] = scan.nextInt()) !=0){
				boolean[] janken = new boolean[3];
				for(int i = 0 ; i < janken.length;i++)janken[i] = false;
				janken[dataset[0] -1] = true;
				for(int i = 1; i < dataset.length;i++){
					dataset[i] = scan.nextInt();
					janken[dataset[i] -1] = true;
				}
				if(check(janken)){
					for(int i = 0; i < 5; i++){
						System.out.println("3");
					}
				}else{
					for(int i = 0 ; i < 5;i++){
						if(janken[point(dataset[i] + 1)] == true){
							System.out.println("2");
						}else{
							System.out.println("1");
						}
					}
				}
			}
		}finally{
			if(scan !=null)scan.close();
		}
	}
	public static boolean check(boolean[] janken){
		for(int i = 0 ; i < janken.length;i++){
			if(janken[point(i)] == true && janken[point(i+1)] == false && janken[point(i+2)] == false){
				return true;
			}
		}
		if( janken[0] == true && janken[1] == true && janken[2] == true)
			return true;
		return false;
	}
	public static int point(int i){
	return i%3;
	}
}

Measured memory_bytes: 20764
#include <iostream>

using namespace std;

int main()
{
	int x;
	cin>>x;
	int a = 0;
	while(a==0)
	{
		int b = 0;
		for(size_t i = 1; i<x-1; i++)
		{
			if(x%(i+1)==0)
			{
				b = 1;
			}
		}
		if(b==0)
		{
			cout<<x<<endl;
			a = 1;
		}
		else
		{
			x++;
		}
	}
	return 0;
}

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

using namespace std;

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define SQ(a) (a)*(a)

template <class T, class U> ostream& operator<< (ostream &out, pair<T,U> c) { out << "(" << c.first << " "; out << c.second << ")"; return out; }
template <class T> ostream& operator<< (ostream &out, vector<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
template <class T> ostream& operator<< (ostream &out, set<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
const double PI  = 3.141592653589793238463;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    set<char> l;
    FOR(i,0,s.size()){
        l.insert(s[i]);
    }
    if(s.size() == l.size()){
        cout << "yes";
    }
    else
    {
        cout << "no";
    }
    
    cout << endl;
}

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

using namespace std;

const int MAXN = 1E5;

int main()
{
    string s;
    cin >> s;
    int n = (int) s.length();
    s = " " + s;
    bool valid = s[1] == '1' && s[n] == '0';
    for (int i = 1; i <= n - 1; i++)
    {
        if (s[i] != s[n - i])
            valid = false;
    }
    if (valid)
    {
        int cur = 1;
        for (int i = 2; i <= n; i++)
        {
            cout << cur << " " << i << "\n";
            if (s[i - 1] == '1')
                cur = i;
        }
    }
    else
        cout << -1 << endl;
    return 0;
}


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

int main() {
  string N;
  cin >> N;
  if(N[0] == N[1] && N[1] == N[2] || N[1] == N[2] && N[2] == N[3])
    cout << "Yes";
  else
    cout<< "No";
}

Measured memory_bytes: 256
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    int N;
    cin>>N;
    int A=N;
    int B=0;
    while(A>0){
        B+=A%10;
        A/=10;
    }
    if(N%B==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }


}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>

using namespace std;

typedef pair<int, int> P;

bool comp(const P &f, const P &s) {
    return (f.first < s.first) || ((f.first == s.first) && (f.second < s.second));
}

int main()
{
    int n;

    while (cin >> n, n) {
        P m[25];
        bool flag = true;
        int amount = 0;

        for (int i = 0; i < n; i++) 
            cin >> m[i].second >> m[i].first;

        sort(m, m + n, comp);

        for (int i = 0; i < n; i++) {
            amount += m[i].second;

            if (amount > m[i].first) {
                flag = false;
                break;
            }
        }

        if (flag)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }

    return 0;
}

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

int main() {
    int N; cin >> N;
    vector<int> p(N+1);
    rep(i, N){
        cin >> p.at(i+1);
    }

    int cnt = 0;
    for(int i=1; i<N+1; i++){
        if(p.at(i) == i) {
            if(i==N){
            cnt++;
            p.at(N) = p.at(N-1);
            p.at(N-1) = N; 
            break;
            }

            cnt++;
            p.at(i) = p.at(i+1);
            p.at(i+1) = i;
        }
    }

    cout << cnt << endl;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <limits>
#include <math.h>
#include <cmath>
#include <cctype>
#include <cstdio>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll> ;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvll = vector<vector<long long >>;
#define PI  3.1415926535
#define rep(i, k, n) for(ll i = k; i < n; i++)

int main(){
  ll n, x, t;
  cin >> n >> x >> t;
  
  ll amari = n % x;
  ll kaisu = n / x;
  
  ll ans = kaisu * t;
  if(amari){ans += t;}
  
  cout << ans << endl;
  
}
      
    
  
  
    
    


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int n;
double a[3005],ans,dp[3005][3005];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			int x=j,y=i-j;
			if(x)dp[x][y]+=dp[x-1][y]*a[i];
			if(y)dp[x][y]+=dp[x][y-1]*(1-a[i]);
		}
	}
	int l=n,r=0;
	while(l>r){
		ans+=dp[l][r];
		l--;r++;
	}
	printf("%.10lf",ans);
	return 0;
}

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

string s,t;
string ans="";
int dp[3010][3010];
int b1[3010][3010],b2[3010][3010];

int main(){
	cin >> s >> t;
	
	memset(dp,0,sizeof(dp));
	
	for(int i=0;i<s.size();i++)for(int j=0;j<t.size();j++){
		if(s[i]==t[j]){
			dp[i+1][j+1]=dp[i][j]+1;
			b1[i+1][j+1]=i;
			b2[i+1][j+1]=j;
		} else{
			dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
			if(dp[i+1][j]>dp[i][j+1]){
				b1[i+1][j+1]=b1[i+1][j];
				b2[i+1][j+1]=b2[i+1][j];
			} else{
				b1[i+1][j+1]=b1[i][j+1];
				b2[i+1][j+1]=b2[i][j+1];
			}
		}
	}
	
	vector<int> v1,v2;
	int bb1=s.size(),bb2=t.size();
	int c=0;
	
	while(1){
		v1.push_back(b1[bb1][bb2]);
		v2.push_back(b2[bb1][bb2]);
		bb1=v1[c];
		bb2=v2[c];
		c++;
		if(bb1==0 || bb2==0)break;
	}
	
	for(int i=0;i<c;i++){
		if(s[v1[i]]==t[v2[i]])ans+=s[v1[i]];
	}
	
	reverse(ans.begin(),ans.end());
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 106496
#include <stdio.h>

int main(void) {
  
  int a , b, c;

  scanf("%d %d %d",&a,&b,&c);

  int temp = b;
  b = a;
  a = c;
  c = temp;
  

  printf("%d %d %d",a,b,c);

  return 0;

}


Measured memory_bytes: 128
S = input()
str_box = {}
jodge = 1
for ss in S:
    if ss in str_box:
        str_box[ss] += 1
    else:
        str_box[ss] = 1
for i in str_box.values():
    if i % 2 != 0:
        jodge = 0
if jodge:
    print('Yes')
else:
    print('No')

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

int main(){
    int n;
    cin >> n;
    int mat[n][n] = {};

    for(int i = 0; i < n; i++){
        int x, k, y;
        cin >> x >> k;
        while(k-- > 0){
            cin >> y;
            mat[x-1][y-1] = 1;
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(j) cout << " ";
            cout << mat[i][j];
        }
        cout << endl;
    }

    return 0;
}


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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In,' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var A = cin.ReadInt;
            var B = cin.ReadInt;

            WriteLine(A >= 13 ? B : A>= 6 ? B/2 : 0);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream,char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if(inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for(int i = 0;i < tmp.Length;i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }

}


Measured memory_bytes: 11220
#include <stdio.h>

main() {
	int a,b,n;
	while(scanf("%d",&a)!=EOF){
	 	scanf("%d",&b);
	 	for(n=1;(a+b)/(pow(10,n))>=1;){
	 		n++;
	 	}
	 	printf("%d\n",n);
	 }
	return 0;
}



Measured memory_bytes: 2032