akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()

int main() {
	int n;
	string s;
	cin >> n >> s;
	if (n % 2 != 0) {
		ps(No);
	}
	else {
		string sfor = s.substr(0, n / 2);
		string slat = s.substr(n / 2, n/2);
		if (sfor == slat) {
			ps(Yes);
		}
		else {
			ps(No)
		}
	}
	return(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n;
int a[5]={0};
long double dp[305][305][305];

long double solve(int n1,int n2,int n3)
{
    if( (n1<0) || (n2<0) || (n3<0))
        return 0;
    if(n1==0 && n2==0 && n3==0)
        return 0;
    if(dp[n1][n2][n3]!=0)
        return dp[n1][n2][n3];
    long double &ans=dp[n1][n2][n3];
    int cnt=0;
    int x=n-n1-n2-n3;
    long double nn=n1+n2+n3;
    long double nn1=(long double)n1/nn;
    long double nn2=(long double)n2/nn;
    long double nn3=(long double)n3/nn;
    long double c=solve(n1-1,n2,n3);
    if(c>0)
    {
        long double xx= (long double)(((long double)n1+(long double)x*nn1)/((long double)n1));
        //cout<<xx<<" "<<c<<"\n";
        xx+=c;
        xx*=nn1;
        ans+=xx;
    }
     c=solve(n1+1,n2-1,n3);
    if(c>0)
    {
        long double xx= (long double)(((long double)n2+(long double)x*nn2)/((long double)n2));
        //cout<<xx<<" ";
        xx+=c;
        xx*=nn2;
        ans+=xx;
        //cnt++;
    }
    c=solve(n1,n2+1,n3-1);
    if(c>0)
    {
        long double xx= (long double)(((long double)n3+(long double)x*nn3)/((long double)n3));
        //cout<<xx<<" ";
        xx+=c;
        xx*=nn3;
        ans+=xx;
        //cnt++;
    }
    //ans=ans/cnt;
    //cout<<n1<<" "<<n2<<" "<<n3<<" "<<ans<<" "<<cnt<<"\n";
    return ans;

}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    memset(dp,0,sizeof(dp));
    cin>>n;
    dp[1][0][0]=n;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        a[x]++;
    }
    //cout<<a[1]<<" "<<a[2]<<" "<<a[3]<<"\n";
    std::cout << std::setprecision(15) << solve(a[1],a[2],a[3]) << '\n';
}


Measured memory_bytes: 447180
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <algorithm>
#define brijesh ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
#define popb pop_back
#define l1 long long
#define vi vector<int>
#define vl vector<l1>
#define vs vector<string>
using namespace std;
int main() {
    brijesh;
    int a,b,n,temp;
    cin>>n;
    vi v1,v2,v3;
    for(int i=0;i<n;i++)
    {
        cin>>temp;
        v1.pb(temp);
        v3.pb(temp);
    }
    sort(v3.begin(),v3.end());
    for(int i=0;i<n;i++)
    {
        cin>>temp;
        v2.pb(temp);
    }
    int count=1,flag=0;
    do{
        if(v3==v1){
            a=count;
            flag++;
        }
        if(v3==v2) {
            b=count;
            flag++;
        }
        count++;
        if(flag==2)
            break;
    }while(next_permutation(v3.begin(),v3.end()));
    cout<<abs(a-b);
}

Measured memory_bytes: 3660
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld N = 200043;
const lld MOD = 1000000007;

lld add(lld x, lld y)
{
    x =((x%MOD)+(y%MOD))%MOD;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

lld mul(lld x, lld y)
{
    return ((x%MOD)*(y%MOD))% MOD;
}

lld binpow(lld x, lld y)
{
    lld z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

lld inv(lld x)
{
    return binpow(x, MOD - 2);
}

lld divide(lld x, lld y)
{
    return mul(x, inv(y));
}

// Combinations

/*
lld fact[N];

void precalc()
{
    fact[0] = 1;
    for(lld i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
}

lld C(lld n, lld k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t,i,j;
    //cin>>t;
    t=1;
    while(t--)
    {
        string str;
        cin>>str;
        if(str=="RRR")
            cout<<3<<endl;
        else
            if(str=="RRS" || str=="SRR")
            cout<<2<<endl;
        else
            if(str=="SSS")
            cout<<0<<endl;
        else
            cout<<1<<endl;
    }
}





Measured memory_bytes: 3616
package main

import (
	"fmt"
	"sort"
)

func min(a,b int) int {
	if a<b {
		return a
	}
	return b
}

func sum(a []int) int {
	s := 0
	for _,e := range a {
		s += e
	}
	return s
}

func main() {
	var n,k int
	fmt.Scan(&n,&k)
	
	v := make([]int,n)
	for i:=0; i<n; i++ {
		fmt.Scan(&v[i])
	}

	var l,r int
	ans := make([]int,0)

	l = min(n,k)
	for i:=0; i<l+1; i++ {
		r = l-i
		lsum := sum(v[:i])
		d := append([]int{}, v[:i]...)

		for j:=0; j<r+1; j++ {
			ab := lsum + sum(v[len(v)-j:])
			cd := append([]int{}, d...)
			cd = append(cd, v[len(v)-j:]...)
			sort.Ints(cd)
			op := k-i-j

			// fmt.Println(cd , op)
			for _,e := range cd {
				if op == 0 {
					break
				}

				if e < 0 {
					ab -= e
					op--
				} else {
					break
				}
			}
			ans = append(ans,ab)
		}
	}
	sort.Ints(ans)
	fmt.Println(ans[len(ans)-1])
}


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

using namespace std;
#define ll long long

int main (void) {
    int n, r;

    scanf("%d%d", &n, &r);

    if(n >= 10){
        printf("%d\n", r);
    } else{
        printf("%d\n", 100 * (10 - n) + r);
    }
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
# stdin = open("sample.txt")

MOD = 1000000007

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def combination(m,n):
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def main():
    s_1 = stdin.readline().rstrip()
    s_2 = stdin.readline().rstrip()
    s_check = s_2[0:-1]
    if s_1 == s_check:
        print("Yes")
    else:
        print("No")

main()

Measured memory_bytes: 9904
#include <cstdio>
int v[100010], d[100010], c[100010];
int x[100010], y[100010];
int ti[100010][11];
void upd(int &z, int t) {
	if (z < t) z = t;
}
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &x[i], &y[i]);
		--x[i]; --y[i];
	}
	int q;
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		scanf("%d%d%d", &v[i], &d[i], &c[i+1]);
		--v[i];
		upd(ti[v[i]][d[i]], i+1);
	}
	for (int i = 10; i > 0; i--) {
		for (int j = 0; j < m; j++) {
			upd(ti[x[j]][i-1], ti[y[j]][i]);
			upd(ti[y[j]][i-1], ti[x[j]][i]);
		}
	}
	for (int i = 0; i < n; i++) {
		int z = 0;
		for (int j = 0; j <= 10; j++) {
			upd(z, ti[i][j]);
		}
		printf("%d\n", c[z]);
	}
	return 0;
}


Measured memory_bytes: 6784
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

type Res struct {
	by, bx, y, x int
}

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	H, W := sc.nextInt(), sc.nextInt()
	G := make([][]int, H)
	for i := 0; i < H; i++ {
		G[i] = make([]int, W)
	}
	for i := 0; i < H; i++ {
		G[i] = sc.nextIntSlice(W)
	}
	changed := 0
	res := []Res{}
	for i := 0; i < H; i++ {
		if i%2 == 0 {
			for j := 0; j < W; j++ {
				if G[i][j]%2 == 0 {
					continue
				}
				ny, nx := i, j
				if j+1 < W {
					nx++
				} else if i+1 < H {
					ny++
				} else {
					continue
				}
				changed++
				res = append(res, Res{i, j, ny, nx})
				G[ny][nx]++
			}
		} else {
			for j := W - 1; j >= 0; j-- {
				if G[i][j]%2 == 0 {
					continue
				}
				ny, nx := i, j
				if j-1 >= 0 {
					nx--
				} else if i+1 < H {
					ny++
				} else {
					continue
				}
				changed++
				res = append(res, Res{i, j, ny, nx})
				G[ny][nx]++
			}
		}
	}
	fmt.Fprintln(wtr, changed)
	for i := 0; i < changed; i++ {
		r := res[i]
		fmt.Fprintln(wtr, r.by+1, r.bx+1, r.y+1, r.x+1)
	}
}


Measured memory_bytes: 19584
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

void isprime(int x){
  int t = sqrt(x) + 1;
  bool prime = true;
  for(int i = 2; i <= min(t, x - 1); i++){
    if(x % i == 0) prime = false;
  }
  if(prime == true);
}

unsigned long long func(unsigned long long x, unsigned long long n){
  if(n == 0) return 1;
  if(n % 2 == 0) return func(x * x % 1000000007, n / 2) % 1000000007;
  return func(x * x % 1000000007, n / 2) * x % 1000000007;
}

void solve(){
  unsigned long long int m, n; cin >> m >> n;
  cout << func(m, n) << endl;
  return;
}
int main(){
  solve();
  return 0;
}



Measured memory_bytes: 3108
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define ll unsigned long long
#define F(i,a,b) for(int i=(a);i<=(b);i++)
#define mst(a,b) memset((a),(b),sizeof(a))
#define PII pair<int,int>
using namespace std;
template<class T>inline void read(T &x) {
    x=0; int ch=getchar(),f=0;
    while(ch<'0'||ch>'9'){if (ch=='-') f=1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
    if(f)x=-x;
}
const int inf=0x3f3f3f3f;
const int maxn=100050;
ll n,m;
ll a[maxn];
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++) read(a[i]),a[i]/=2;
	int t=0;
	while(a[1]%2==0) a[1]/=2,t++;
	for(int i=2;i<=n;i++)
	{
		if((a[i]%(1<<t))!=0)
		{
			puts("0");
			return 0;
		}
		a[i]/=(1<<t);
		if(a[i]%2==0)
		{
			puts("0");
			return 0;
		}
	}
	m/=(1<<t);
	ll res=a[1];
	for(int i=2;i<=n;i++)
	{
		ll temp=gcd(res,a[i]);
		res=(res*a[i])/temp;
	}
	ll ans=m/res;
	cout<<(ans+1)/2<<endl;
	return 0;
}

Measured memory_bytes: 1024
#
# abc178 a
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """1"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """0"""
        output = """1"""
        self.assertIO(input, output)


def resolve():
    x = int(input())
    if x == 0:
        print(1)
    else:
        print(0)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16240
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int n, m, a[50], b[50], c[50], d[50];
    scanf("%d%d", &n, &m);
    for(int i=0; i<n; i++) scanf("%d%d", &a[i], &b[i]);
    for(int i=0; i<m; i++) scanf("%d%d", &c[i], &d[i]);

    for(int i=0; i<n; i++){
        int check=1, judge;
        int ans = abs(a[i]-c[0])+abs(b[i]-d[0]);
        for(int j=1; j<m; j++){
            judge = abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(ans>judge){
                ans = judge;
                check = j+1;
            }
        }
        printf("%d\n", check);
    }
    return 0;
}

Measured memory_bytes: 1728
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int n, A[200];

int solve(int i, int m)
{
  int res;

  if(m == 0) return 1;
  if(i >= n) return 0;

  res = solve(i + 1, m) || solve(i + 1, m - A[i]);

  return res;
}

int main(void)
{
  int i, j, k, m;

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%d", &A[i]);
  }

  scanf("%d", &k);

  for(j = 0; j < k; j++){
    scanf("%d", &m);
    if(solve(0, m)){
      printf("yes\n");
    }
    else{
      printf("no\n");
    }
  }
  return 0;
}



Measured memory_bytes: 2036
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n>>m;
	vector<int> v1;
	for(i=0;i<n;i++){
		cin>>a;
		v1.push_back(a);
	}
	sort(v1.begin(),v1.end());
	a=0;
	for(i=0;i<m;i++){
		a+=v1[i];
	}
	cout<<a<<endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<int> A(n), B(n), C(n-1);
  rep(i, n) cin >> A[i], A[i]--;
  rep(i, n) cin >> B[i];
  rep(i, n-1) cin >> C[i];
  ll ans = accumulate(all(B), 0LL);
  rep(i, n) {
    if(i && A[i-1]+1 == A[i]) ans += C[A[i-1]];
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 3600
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>()>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}
int main(){
    int n=in();
    int sb=0,ta=0,w=0;
    vector<string> s(n);
    ll ans=0;
    rep(i,n){
        s[i]=stin();
        rep(j,s[i].length()-1){
            if(s[i][j]=='A'&&s[i][j+1]=='B')ans++;
        }
        if(s[i][0]=='B'&s[i][s[i].length()-1]=='A')w++;
        else if(s[i][0]=='B')sb++;
        else if(s[i][s[i].length()-1]=='A')ta++;
    }
    if(w>0){
        ans+=w-1;
        if(sb>0){
            sb--;
            ans++;
        }
        if(ta>0){
            ta--;
            ans++;
        }
    }
    ans+=min(ta,sb);
    cout<<ans<<endl;
}

Measured memory_bytes: 768
// g++ -std=c++11 temp.cpp
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3

#define MAX_N 1000

int a,b,h;

int main(){
	cin.sync_with_stdio(false);
	cin>>a>>b>>h;
	cout<<(a+b)*h/2<<endl;
	return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define MOD 1000000007
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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 Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

class SumSegTree {
private:

	int _sum(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l)return 0;    // 交差しない
		if (a <= l && r <= b)return dat[k];   // a,l,r,bの順で完全に含まれる
		else {
			int s1 = _sum(a, b, 2 * k + 1, l, (l + r) / 2); // 左の子
			int s2 = _sum(a, b, 2 * k + 2, (l + r) / 2, r); // 右の子
			return s1 + s2;
		}
	}
public:
	int n, height;
	vector<int> dat;

	// 初期化（_nは最大要素数）
	SumSegTree(int _n) {
		n = 1;
		height = 1;
		while (n < _n) {
			n *= 2;
			height++;
		}
		dat = vector<int>(2 * n - 1, 0);
	}

	// 場所i(0-indexed)にxを足す
	void add(int i, int x) {
		i += n - 1; // i番目の葉ノードへ
		dat[i] += x;
		while (i > 0) { // 下から上がっていく
			i = (i - 1) / 2;
			dat[i] += x;
		}
	}

	// 区間[a,b)の総和。ノードk=[l,r)に着目している。
	int sum(int a, int b) {
		return _sum(a, b, 0, 0, n);
	}
};

void Dijkstra(Graph& G, ll s, Array& d) {//O(|E|log|V|)
	d.resize(G.size());
	REP(i, d.size())d[i] = INF;
	d[s] = 0;
	priority_queue<P, vector<P>, greater<P>> q;
	q.push(make_pair(0, s));
	while (!q.empty()) {
		P a = q.top();
		q.pop();
		if (d[a.second] < a.first)continue;
		REP(i, G[a.second].size()) {
			Edge e = G[a.second][i];
			if (d[e.to] > d[a.second] + e.cap) {
				d[e.to] = d[a.second] + e.cap;
				q.push(make_pair(d[e.to], e.to));
			}
		}
	}
}

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

	ll n, m;
	cin >> n >> m;
	Graph g(n);
	REP(i, m) {
		ll a,b;
		cin >> a >> b;
		a--; b--;
		add_edge(g, a, b, 1, true, 1);
	}

	Array d;
	Dijkstra(g, 0, d);
	if (d[n - 1] == 2) {
		cout << "POSSIBLE" << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}


	return 0;
}

Measured memory_bytes: 21728
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main() {
    cout << fixed << setprecision(10);
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    REP(i, n) {
        cin >> p[i];
        p[i]++;
    }

    vector<int> s(n + 1, 0);
    REP(i, n + 1) {
        s[i + 1] += s[i] + p[i];
    }

    double m = 0;
    REP(i, n + 1 - k) {
        chmax(m, (s[i + k] - s[i]) * 0.5);
    }
    cout << m;
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        System.out.println(a + b >= 10 ? "error" : a + b);
    }
}

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

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

    int num2 = 0, num4 = 0, a;
    rep(i, N) {
        cin >> a;
        if (a % 2 == 0 & a % 4 != 0) num2++;
        if (a % 4 == 0) num4++;
    }

    string ans = "No";
    if (num4 >= N/2) ans = "Yes";
    else if ((num2 / 2) * 2 >= N - (2 * num4 + 1)) ans = "Yes";

    cout << ans << endl;    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define rep(i,a,b) for(int i=int(a); i<int(b); i++)
#define rip(i,a,b) for(int i=(int)a; i>=(int)b; i--)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define sz(x) int(x.size())
#define all(v) (v).begin(), (v).end()
#define trace(x) cerr << #x << ": " << x <<endl;
 
using namespace std;
 
typedef long long int lli;
typedef pair<lli, lli> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

vi V;
int n, k;
int dp[100005];

int go(int cur){
	if(dp[cur]) return dp[cur];
	int ans=2;
	rep(i, 0, n) if(V[i]<=cur){
		if(go(cur-V[i])==2){
			ans=1;
			break;
		}
	}else break;
	return dp[cur]=ans;
}

int main(){
    fastio;
    cin>>n>>k;
    int x;
	rep(i, 0, n){
		cin>>x;
		V.pb(x);
	} 
	sort(all(V));
	cout<< (go(k)==1 ? "First":"Second" ) << endl;
    return 0;
}

Measured memory_bytes: 3840
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N;
  cin >> N;

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  int x = 0;
  REP(i, N){
    x ^= A[i];
  }

  REP(i, N){
    cout << (A[i]^x); SPBR(i, N);
  }

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A (N);
  
  for (int i = 0; i<N; i++) {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  
  int TF = 0;
  int i = 0;
  while (TF == 0) {
    for (int j = 0; j<N; j++) {
      if (A.at(j)%2 == 1) {
        TF = 1;
        break;
      }
      else 
        A.at(j) = A.at(j)/2;
    }
    i++;
  }
  
  cout << i-1 << endl;
  
}

Measured memory_bytes: 256
s = int(input())

arr = [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]

print(arr[s-1])

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <cstdint>
#include <vector>

using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if ( b < a ) swap( a, b );
	cout << ( a <= c && c <= b ? "Yes" : "No" ) << endl;
	return 0;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[1].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var a = parseInt(input[0], 10);
	var b = parseInt(tmp[0], 10);
	var c = parseInt(tmp[1], 10);
    var result =''
    for (i=b;i<=c; i++){
      if(i%a===0){
        result='OK';
        break;
      }else{
        result='NG'
      }
    }
  
	//出力
	console.log(result);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29628
function bomb(y,x){
   var v=yx[y][x];
   yx[y][x]="#";
   if(v=="#"){result="LOOP";return;}
   if(v=="."){result=x+" "+y;return;}
   if(v==">")x++;
   if(v=="<")x--;
   if(v=="^")y--;
   if(v=="v")y++;
   bomb(y,x);
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var n=Arr.shift().split(" ").map(Number);
   if(n[0]==0 && n[1]==0)break;
   var yx=[];
   for(var i=0;i<n[0];i++){
      var arr=(Arr.shift()).split("");
      yx.push(arr);
   }
   var result="";
   bomb(0,0);
   console.log(result);
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, M;
    ll ans = 0;
    map<ll, ll> m;
    cin >> N >> M;
    rep(i, N) {
        ll K;
        cin >> K;
        rep(i, K) {
            ll temp;
            cin >> temp;
            m[temp]++;
        }
    }
    iter(i, m) {
        if(i.second == N) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int k,n;
	cin>>k>>n;
	int mx=0,first,last,tmp;
	cin>>tmp;
	first=tmp;
	for(int i=0,tmp2;i<n-1;++i){
		cin>>tmp2;
		mx=max(mx,tmp2-tmp);
		tmp=tmp2;
	}
	last=tmp;
	mx=max(mx,k-last+first);
	cout<<k-mx<<"\n"s;
}

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

template<typename T, typename U> bool chmin(T &a, const U &b) {
	return (a > b ? a = b, true : false);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
	return (a < b ? a = b, true : false);
}

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;

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

	int n;
	cin >> n;
	vector<int> vc;

	int mx1 = 0;
	int mx1_index = -1;
	int mx2 = 0;
	int mx2_index = -1;

	for (int i = 0; i < n; i++) {
		int tmp;
		cin >> tmp;
		vc.push_back(tmp);

		if (mx1 < tmp){
			mx2 = mx1;
			mx1 = tmp;
			mx1_index = i ;
			continue;
		}
		if(mx2 <tmp){
			mx2 =tmp;
		}
	}

	for(int i=0; i<n; i++){
		if(i != mx1_index){
			writeln(mx1);
		}else{
			writeln(mx2);
		}
	}

}



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

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define debug(x) cout << #x <<" = " << x << endl
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define printvpair(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i].first  <<" " << v[i].second << endl;
#define printv(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i] << " "; cout << endl;

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = 1000000000;

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

const int N = 100000;
string words[] = {"dream", "dreamer", "erase", "eraser"};
string s;
int l1;
bool yes;
bool compare(int pos,string x){
	if (pos + x.length() > l1)
		return false;
	for(int i = 0; i < x.length(); i++)
		if (s[pos + i] != x[i])
			return false;
	return true;
}
void solve(int pos){
	if (pos == l1){
		yes = 1;
		return;
	}
	for(int i = 0; i < 4; i++) {
		int l = words[i].length();
		if (compare(pos,words[i])){
			solve(pos + l);
		}
	}
}
int main() {
	ios_base::sync_with_stdio(0);
	cin >> s;
	l1 = s.length();
	solve(0);
	if (yes)
		cout << "YES\n";
	else
		cout << "NO\n";
  	return 0;
}


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

#define all(v)   v.begin(), v.end()
#define endl "\n";
#define pb push_back
#define F first
#define S second
#define JULEE_DO_THE_THING fast()
#define to_str to_string
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMIN INT_MIN
#define IMAX INT_MAX
#define pow POW

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double dd;
typedef string str;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef pair<int, int> pii;

void fast() {
	cin.tie(0);
	cout.tie(0);
	cin.sync_with_stdio(0);
}

bool compare(int &a, int &b) {
	return a > b;
}

ll numOfDigits(ll n) {
	if (!n)
		return 1;
	return (ll) (log10(n)) + 1;
}

ull POW(ll a, ll b);

/*

 */

ll BN();
int main() {
	JULEE_DO_THE_THING;
	//freopen("test cases\\Handstand.txt", "r", stdin) ;
    int n, k; cin>>n>>k;
    str s; cin>>s;
    int cnt = 0, p1 = 0, p2 = 0, mx = 0;
    while(p1<n && p2<n){
        while(p2<n && (s[p2]=='1' || cnt<k)){
            if(s[p2]=='0'){
                while(p2<n && s[p2]=='0') p2++;
                cnt++;
            }else p2++;
        }
        mx = max(mx, p2-p1);
        while(cnt==k){
            if(s[p1]=='0'){
                while(p1<n && s[p1]=='0')p1++;
                cnt--;
            }else while(p1<n && s[p1]=='1')p1++;
        }
        if(p1>p2)p2=p1;
    }
    cout<<mx;
	return 0;
}

ll BN() {
	ll low = 0;
	ll up = 0;
	ll ans = 0;
	while (low <= up) {
		ll mid = ((low + up) / 2);
		if (mid) {
			ans = mid;
			low = mid + 1;
		} else
			up = mid - 1;
	}
	return ans;
}

ull POW(ll a, ll b) {
	ull res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a;
		a = a * a;
		b >>= 1;
	}
	return res;
}


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

int main()
{
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  double hh = (h * 60 + m) / 720.0 * 2 * M_PI;
  double mm = m / 60.0 * 2 * M_PI;
  double hx = cos(hh) * a;
  double hy = sin(hh) * a;
  double mx = cos(mm) * b;
  double my = sin(mm) * b;
  double dx = hx - mx;
  double dy = hy - my;
  double ans = sqrt(dx * dx + dy * dy);
  cout << setprecision(12) << ans << endl;
}


Measured memory_bytes: 4104
import sys

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if V <= W:
    print('NO')
    sys.exit()

d = abs(A-B)
v = V - W
if d/v <= T:
    print('YES')
else:
    print('NO')



Measured memory_bytes: 9180
#include <iostream>
#include <vector>

using namespace std;

int getMax(int a, int b, int c){
	int maximum = max(a,b);
	maximum = max(maximum,c);
	return maximum;
}

int main(){

	int days;
	cin >> days;

	vector<int> dp(3);
	//array points for each task
	int points[3];

	for (int d=0;d<days;d++){
		//Another dp array to compare
		//Set all tasks to zero points to get max
		vector<int> aux_dp(3,0);

		cin >> points[0] >> points[1] >> points[2];

		//iterate throght two consecutive tasks
		for (int i=0;i<3;i++){

			for(int j=0;j<3;j++){
				//If they are different
				if (i != j){
					//Get max from current value or the sum of dp current value plus this task points
					aux_dp[j] = max(aux_dp[j], dp[i] + points[j]);
				}
			}
		}

		//Store result in dp, to reset aux_dp to zero
		dp = aux_dp;
	}

	//Print the best solution if is either a, b or c
	cout << getMax(dp[0],dp[1],dp[2]) << endl;

}

Measured memory_bytes: 3620
<?php
 
$nr = str_split(trim(fgets(STDIN)));

$c = 0;
for($i=0; $i<count($nr)-1; $i++){
  if ($nr[$i+1] == $nr[$i]) {
    $nr[$i+1] = ($nr[$i+1]+1)%2;
    $c++;
  }
}

echo $c;

?>

Measured memory_bytes: 10744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ge(a, b) get<(b)>((a))
#define SZ(x) (x).size()
#define ft front()
#define bk back()
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define CEIL(a, b) ((a) + (b)-1) / (b)
#define SET(a, b) memset((a), (b), sizeof(a))
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
    if (DEBUG) std::cerr
const int xd[4] = {0, 1, 0, -1}, yd[4] = {1, 0, -1, 0};
template <typename t>
bool ckmin(t& a, const t& b) {
    return a > b ? a = b, true : false;
}
template <typename t>
bool ckmax(t& a, const t& b) {
    return a < b ? a = b, true : false;
}

int main() {
    ios_base::sync_with_stdio(0);
    cout.tie(0);

    int n;
    string s;
    cin >> n >> s;
    vi sR(n + 1, 0), sG(n + 1, 0), sB(n + 1, 0);
    R0F (i, n - 1) {
        sR[i] = sR[i + 1] + (s[i] == 'R');
        sG[i] = sG[i + 1] + (s[i] == 'G');
        sB[i] = sB[i + 1] + (s[i] == 'B');
    }
    ll sum = 0;
    F0R (m, n) {
        F0R (f, m) {
            if (s[f] == s[m]) continue;
            char l = '?';
            for (char c : {'R', 'G', 'B'}) {
                if (c != s[f] && c != s[m]) {
                    l = c;
                    break;
                }
            }
            dout << "  " << f << ": " << l << endl;
            auto suf = ref(sR);
            if (l == 'G') suf = ref(sG);
            if (l == 'B') suf = ref(sB);
            assert(l != '?');
            sum += suf.get()[m + 1];
            if (m + (m - f) < n) sum -= s[m + (m - f)] == l;
        }
    }
    cout << sum << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;

ll MOD = 1000000007;

int main(int, char**) {
	ll h, n;
	cin >> h >> n;
	ll p = 0;
	for (int i=0; i<n; i++) {
		int a; cin >> a;
		p += a;
	}
	if (h > p) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ul unsigned long long
#define ll long long
#define ld long double

int main() {
  int n;
  cin>>n;
  string s;
  int c[4]={0,0,0,0};
  for (int i = 0; i < n; i++)
  {
    cin>>s;
    switch (s[0])
    {
    case 'A':
      c[0]++;
      break;
    case 'W':
      c[1]++;
      break;
    case 'T':
      c[2]++;
      break;
    case 'R':
      c[3]++;
      break;

    default:
      break;
    }
  }

  cout << "AC x " + to_string(c[0]) << endl;
  cout << "WA x " + to_string(c[1]) << endl;
  cout << "TLE x " + to_string(c[2]) << endl;
  cout << "RE x " + to_string(c[3]) << endl;

  return 0;
}

Measured memory_bytes: 3664
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        h: i64,
        w: i64,
        s: [String; h],
    }
    for i in 0..h {
        println!("{}", s[i as usize]);
        println!("{}", s[i as usize]);
    }
}


Measured memory_bytes: 4352
//cod2017_qualA_c.cpp
//Sat Aug 10 10:56:45 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	string s[h];
	int letter[26];
	fill(letter, letter+26,0);
	for (int i=0;i<h;i++){
		cin >> s[i];
		for (int j=0;j<w;j++){
			char temp = s[i][j];
			int count = (int)temp-'a';
			letter[count]++;
		}
	}

	int four = 0;
	int two = 0;
	int odd = 0;
	for (int i=0;i<26;i++){
//		cout << letter[i] << " ";
		four = four + letter[i]/4;
		if (letter[i]%4==1){
			odd++;
		}else if (letter[i]%4==2){
			two++;
		}else if (letter[i]%4==3){
			odd++;
			two++;
		}
	}

	if (h%2==0 && w%2==0){
		if (four==h*w/4 && two == 0 && odd == 0){
			cout << "Yes" << endl;
		}else {
			cout << "No" << endl;
		}
	}else if (h%2==1 && w%2==1){
		if (four >= (h*w-h-w+1)/4 && odd == 1){
			cout << "Yes" << endl;
		}else {
			cout << "No" << endl;
		}
	}else {
		int evenline = 0;
		if (h%2==1){
			evenline = w;
		}else {
			evenline = h;
		}
		if (four >= (h*w-evenline)/4 && odd==0){
			cout << "Yes" << endl;
		}else {
			cout << "No" << endl;
		}
	}
//	printf("%.4f\n",ans);
}

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

int main(){
    string s, t;
    cin >> s >> t;
    int size = s.size();
    bool match = 1;
    rep(i, 0, size){
        if (s[i] != t[i]) match = 0;
    }
    if (match) cout << "Yes" << endl;
    else cout << "No" << endl;
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using llint = long long;
using vint = vector<int>;

int main () {
    int n, count = 0; cin >> n;
    for (int i = 1; i <= n; i++) {
        if (1<=i&&i<=9 || 100<=i&&i<=999 || 10000<=i&&i<=99999) {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

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

int main(){
   int N, K;
  cin >> N >> K;
  int j = 1;
  rep(i, N){
    if(j+K < j*2){
      j += K;
    }
    else {
      j *= 2;
    }
  }
  cout << j << endl;
}

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

using namespace std;
 
#define int long long
 
bool codejam = 0;
 
typedef long long li;
typedef long double ld;
 
void solve();

int32_t main () {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(20);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int t = 1; 
	// cin >> t;
	int tt = t;
	while (t--) { 
		if (codejam) cout << "Case #" << tt - t << ": ";
		solve();
	}
	return 0;
}
const int N = 2005;
int arr[N];
const int M = 1e9 + 7;
void solve() {
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; i += 1) {
		cin >> arr[i];
	}
	int ans = 0;
	for (int i = 1; i <= n; i += 1) {
		for (int j = i + 1; j <= n; j += 1) {
			if (arr[i] < arr[j]) {
				ans += (k * (k - 1)) / 2;
				ans %= M;
			}
			else if (arr[i] > arr[j]) {
				ans += (k * (k + 1)) / 2;
				ans %= M;	
			}
		}
	}
	cout << ans;
}		


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

int main() {
  string s;
  cin>>s;
  int front=(s[1]-'0')+(s[0]-'0')*10;
  int back=(s[3]-'0')+(s[2]-'0')*10;
  if(1<=front && front<=12){
    if(1<=back && back<=12) cout<<"AMBIGUOUS"<<endl;
    else cout<<"MMYY"<<endl;
  }
  else{
    if(1<=back && back<=12) cout<<"YYMM"<<endl;
    else cout<<"NA"<<endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>


int main(void){
    int n;
    int a[100000];
    int b[100000];//既に配列を使ったかどうかを記録する

    int i, j, k;
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }

    b[0] = a[n-1];
    int cnt = 1;
    int mid;
    for(i = n - 2; i >= 0; i--){
        int tmp = 0;//塗る事の出来る色をカウント
        //a[i]を何かの色で塗りたい
        //bはソートされているため，b[j] > a[i]を満たす最小のb[j]をとるjの値を二分探索で求める
        //ない場合はflag=0
        if(b[cnt - 1] <= a[i]){
            b[cnt] = a[i];
            j = cnt;
            cnt++;
        }else if(b[0] > a[i]){
            j = 0;
            b[j] = a[i];
        }else{
            int r = cnt;
            int l = 0;
            while(r - l != 1){
                mid = (r + l) / 2;
                if(b[mid] < a[i]){
                    l = mid;
                }else if(b[mid] > a[i]){
                    r = mid;
                }else{
                    l = mid;
                }
            }
            j = r;
            b[j] = a[i];
        }
    }


    printf("%d\n", cnt);

    return 0;    
}


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

class Program
{
    static void Main(string[] args)
    {
        int num = int.Parse(Console.ReadLine());
        int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        int count = 0;

        for (; ; count++)
        {
            bool finFLG = false;

            for (int i = 0; i < num; i++)
            {
                if (input[i]%2 == 0)
                {
                    input[i] /= 2;
                }
                else
                {
                    finFLG = true;
                    break;
                }
            }

            if (finFLG)
            {
                break;
            }

        }

        Console.WriteLine(count.ToString());
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)
const ll INF = 1LL << 60;

int main(){
    string s;
    cin >> s;
    bool c = false,f =false; 
    for (int i= 0;i < s.size();i++){
        if (s[i] == 'C' ) c = true;
        else if (s[i] == 'F' && c == true) f = true;
    }
    if (c && f) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define TAPE_VOLUME (120*60)	/* seconds */

int main(void){
	while(1){
		int left=0,left_tpl;
		int h,m,s;

		scanf("%d%d%d",&h,&m,&s);

		if(h==-1&&m==-1&&s==-1) break;

		left = TAPE_VOLUME - (h*3600+m*60+s);
		left_tpl = left * 3;

		h=left/3600;left-=3600*h;
		m=left/60;left-=60*m;
		s=left;
		printf("%02d:%02d:%02d\n",h,m,s);

		h=left_tpl/3600;left_tpl-=3600*h;
		m=left_tpl/60;left_tpl-=60*m;
		s=left_tpl;
		printf("%02d:%02d:%02d\n",h,m,s);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if((a*100+b*10+c)%4==0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

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

int main(){
	int n;
    cin>>n;
    vector<int> a(n+1);
  	vector<int> b(n);
  	for(int i=0;i<n+1;i++){
    	cin>>a[i];
    }
  	for(int i=0;i<n;i++){
    	cin>>b[i];
    }
    ll ans=0;
    for(int i=0;i<n;i++){
       int rest=0;
       if(b[i]>a[i]){
           rest=b[i]-a[i];
           ans+=a[i];
       }
       else{
       	   ans+=b[i];
       }
       if(rest>a[i+1]){
           ans+=a[i+1];
           a[i+1]=0;
       }
       else{
       		ans+=rest;
            a[i+1]-=rest;
       }
    }
  	cout<<ans<<endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug == false) {
            return;
        }
        System.out.println(str);
    }

    //木構造
    public static void main(String[] args) {

        int N;
        int A;
        int B;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            A = sc.nextInt();
            B = sc.nextInt();
        }
        int res = N * A < B ?N*A:B;
        System.out.println(res);


    }

}


Measured memory_bytes: 23764