akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=200005;
//i_am_noob
int a,b;
string str1,str2,str3;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> str1 >> str2 >> a >> b >> str3;
	print2(str1==str3?a-1:a,str2==str3?b-1:b);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    string S, T;
    cin >> S >> T;
    cout << T << S << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
    const long double PI=3.14159265358979323846264338327950;
    int a,b,h,m;
    double k;
    cin>>a>>b>>h>>m;
    k=abs(h*PI/6.0+m*PI/360.0-m*PI/30.0);
    if(k>PI)
        k=2*PI-k;
    cout<<setprecision(20)<<sqrtl(a*a+b*b-2*a*b*cos(k))<<endl;
}

Measured memory_bytes: 4176
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <cstdlib>
#include <climits>
#include <ctype.h>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int INF=0x3f3f3f3f;
const LL mod=1e9+7;
const int MAXN=1e6+5;
const int MAXM=1e6+5;
struct A
{
    LL num;
    int t;
    bool operator <(A b)const
    {
        return num<b.num;
    }
}a[100005];
map<LL,int> mp;
int n;
int main()
{

    while(~scanf("%d",&n))
    {
    mp.clear();
    LL s;
    int id=0;
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&s);
        if(mp.count(s))
        {
            (a[mp[s]].t)++;
        }
        else
        {
            mp[s]=id;
            a[id].num=s;
            a[id].t=1;
            id++;
        }
    }
    sort(a,a+id);
    int f=0;
    LL temp;
    LL ans=0;
    for(int i=id-1;i>=0;i--)
    {
        if(f==0&&a[i].t>=4)
        {
            ans=(a[i].num)*(a[i].num);
            break;
        }
        else if(f==1&&a[i].t>=2)
        {
            ans=temp*(a[i].num);
            break;
        }
        else if(f==0&&a[i].t>=2)
        {
            temp=(a[i].num);
            f=1;
        }
    }
    printf("%lld\n",ans);
    }




    return 0;
}


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

using namespace std;

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

    if (s == "SUN") {
        cout << "7" << endl;
    } else if (s == "MON") {
        cout << "6" << endl;
    } else if (s == "TUE") {
        cout << "5" << endl;
    } else if (s == "WED") {
        cout << "4" << endl;
    } else if (s == "THU") {
        cout << "3" << endl;
    } else if (s == "FRI") {
        cout << "2" << endl;
    } else if (s == "SAT") {
        cout << "1" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int start = 0;
  int end = s.size();
  for (int i = 0; i < end; i++) {
    if (s[i] == 'A') {
      start = i;
      break;
    }
  }
  for (int i = end - 1; i >= 0; i--) {
    if (s[i] == 'Z') {
      end = i;
      break;
    }
  }
  int ans = end - start + 1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
//#include<>

int main(void){
    int N;
    int C[100]={}, V[100]={};

    scanf("%d", &N);
    for(int i=0; i<N; i++){
        scanf("%d", &V[i]);
    }
    for(int j=0; j<N; j++){
        scanf("%d", &C[j]);
    }
    int ans, Fans=0, Sans=0, all=0;
    for(int n=0; n<N; n++){
        ans = V[n] - C[n];
        if(ans > 0){
           /* Sans = Fans;
            Fans = ans;*/
            all = all + ans;
        }
    }
    printf("%d\n", all);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define rep(i, n) for(int i=0;i<(int)n;++i)
using P = pair<int, int>;
const int INF = 1001001001;

int binary_brute_force(const vector<P>& vec, int G)
{
    int n = vec.size(), ans = INF, num_p, point;
    for(int i=0;i<(1 << n);++i)
    {
        num_p = 0;
        point = 0;
        for(int j=0;j<n;++j)
        {
            if((i >> j) & 1)
            {
                num_p += vec[j].first;
                point += vec[j].first * 100 * (n-j) + vec[j].second;
            }
        }

        for(int j=0;j<n;++j)
        {
            if(G <= point) break;
            if(!((i >> j) & 1))
            {
                if(G <= point + vec[j].first * 100 * (n-j)){
                    num_p += (G - point - 1) / (100 * (n-j)) + 1;
                    break;
                }
                else{
                    num_p += vec[j].first;
                    point += vec[j].first * 100 * (n-j);
                }
            }
        }
        ans = min(ans, num_p);
    }
    return ans;
}


int main()
{
    int D, G;
    cin >> D >> G;
    vector<P> vec(D);
    rep(i, D) cin >> vec[i].first >> vec[i].second;
    reverse(vec.begin(), vec.end());
    cout << binary_brute_force(vec, G) << endl;
}


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

#ifndef DUMP
#define DUMP(...) (void)0
#endif

using namespace std;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (auto&& e : a) cin >> e;
  auto chk = [&](int m) {
    int64_t need = 0;
    for (int e : a) {
      need += max((e + m - 1) / m - 1, 0);
    }
    return need <= k;
  };
  int ng = 0, ok = 1e9;
  while (ok - ng > 1) {
    int mid = (ng + ok) / 2;
    (chk(mid) ? ok : ng) = mid;
  }
  cout << ok << '\n';
}


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

class A
{
	static void Main()
	{
		var t = 0L;
		Console.WriteLine(Console.ReadLine().GroupBySeq(x => x).Select(g => new { g.Key, c = g.LongCount() }).Sum(g => g.Key == '<' ? (t = g.c) * (t + 1) / 2 : Math.Max(0, g.c - t) + g.c * (g.c - 1) / 2));
	}
}

static class GE
{
	public static IEnumerable<IGrouping<TK, TS>> GroupBySeq<TS, TK>(this IEnumerable<TS> source, Func<TS, TK> toKey)
	{
		var c = EqualityComparer<TK>.Default;
		var k = default(TK);
		var l = new List<TS>();

		foreach (var o in source)
		{
			var kt = toKey(o);
			if (!c.Equals(kt, k))
			{
				if (l.Count > 0) yield return new G<TK, TS>(k, l.ToArray());
				k = kt;
				l.Clear();
			}
			l.Add(o);
		}
		if (l.Count > 0) yield return new G<TK, TS>(k, l.ToArray());
	}

	class G<TK, TE> : IGrouping<TK, TE>
	{
		public TK Key { get; }
		IEnumerable<TE> Values;
		public G(TK key, TE[] values) { Key = key; Values = values; }

		public IEnumerator<TE> GetEnumerator() => Values.GetEnumerator();
		IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
	}
}


Measured memory_bytes: 18400
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(long long i=x;i<y;i++)
typedef long long ll;
using namespace std;
int main()
{
	int A,B;
	cin >> A >> B;
	if(A==1)A=14;
	if(B==1)B=14;
	if(A>B){
		cout << "Alice" << endl;
	}
	else if(A<B){
		cout << "Bob" << endl;
	}
	else{
		cout << "Draw" << endl;
	}
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   string s, t;
   cin >> s >> t;
   cout << t + s << endl;
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
int main(void){
    int cnt;
    int n;
    std::cin>>n;

    for(int k=0;k<n;k++){
        std::string str1;
        std::string str2;
        std::cin>>str1;
        std::cin>>str2;
        int l1=str1.size();
        int l2=str2.size();
        int A[l1][l2]={};

        for(int i=0;i<l1;i++){
            for(int j=0;j<l2;j++){
                if(i==0 or j==0){
                    if(str1[i]==str2[j]){
                        A[i][j]=1;
                    }else if(i==0){
                        if(A[i][j-1]==1){
                            A[i][j]=1;
                        }
                    }else if(j==0){
                        if(A[i-1][j]==1){
                            A[i][j]=1;
                        }
                    }
                }else if(str1[i]==str2[j]){
                    A[i][j]=A[i-1][j-1]+1;
                }else{
                    A[i][j]=std::max(A[i][j-1],A[i-1][j]);
                }
                //std::cout<<A[i][j]<<" ";
            }
            //std::cout<<"\n";
        }
        std::cout<<A[l1-1][l2-1]<<"\n";
    }
    return 0;
}


Measured memory_bytes: 7128
package main

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

var nextString func() string

func init() {
	nextString = newReadString(os.Stdin)
}

func main() {
	s := nextString()
	for i := 'a'; i <= 'z'; i++ {
		if !strings.Contains(s, string(i)) {
			fmt.Println(string(i))
			return
		}
	}
	fmt.Println("None")
}

func nextInt() (result int) {
	result, _ = strconv.Atoi(nextString())
	return
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
		}
		return r.Text()
	}
}


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

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

    pair<ll, ll> p[n];
    ll ans = 0;
    for(int i = 0; i < n; i++){
        cin >> p[i].first >> p[i].second;
        ans += 0 - p[i].second;
    }

    ll q[n];
    for(int i = 0; i < n; i++){
        q[i] = p[i].first + p[i].second;
    }

    sort(q, q + n, greater<ll>());

    for(int i = 0; i < n; i++){
        if(i % 2 == 0){
            ans += q[i];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 5980
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols
    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])
    return ret


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_map_as_int(H):
    '''
    #→1,.→0として読み込む
    '''
    ret = []
    for _ in range(H):
        ret.append([1 if s == '#' else 0 for s in read()[:-1]])
        # 内包表記はpypyでは若干遅いことに注意
        # #numpy使うだろうからこれを残しておくけど
    return ret


MOD = 10**9 + 7
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

X = read_a_int()
# なるべく500つぎに5
ans = (X // 500) * 1000
X = X % 500
ans += (X // 5) * 5
print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;

ll inv[MAX],fac[MAX],finv[MAX];

void make(){
    
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    
    for(int i=2;i<MAX;i++){
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        fac[i]=fac[i-1]*(ll)i%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
    
}

ll comb(ll a,ll b){
    if(a<b) return 0;
    return fac[a]*(finv[b]*finv[a-b]%mod)%mod;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    make();
    
    int N,X,Y;cin>>N>>X>>Y;
    vector<int> A(N),B(N),mini(N,INF),okcolor(N),can(N);
    for(int i=0;i<N;i++){
        cin>>A[i]>>B[i];
        A[i]--;
        chmin(mini[A[i]],B[i]);
    }
    
    pair<int,int> mi1={INF,INF},mi2={INF,INF};
    
    for(int i=0;i<N;i++){
        if(mi1>mp(mini[i],i)){
            chmin(mi2,mi1);
            chmin(mi1,{mini[i],i});
        }else if(mi2>mp(mini[i],i)){
            chmin(mi2,{mini[i],i});
        }
    }
    
    for(int i=0;i<N;i++){
        if(A[i]==mi1.se){
            if(B[i]+mi2.fi<=Y){
                okcolor[A[i]]=1;
                can[i]=1;
            }
        }else{
            if(B[i]+mi1.fi<=Y){
                okcolor[A[i]]=1;
                can[i]=1;
            }
        }
    }
    
    for(int i=0;i<N;i++){
        if(can[i]) continue;
        if(mini[A[i]]+B[i]<=X&&okcolor[A[i]]) can[i]=1;
    }
    
    vector<int> cnt(N);
    int sum=0;
    
    for(int i=0;i<N;i++){
        if(can[i]){
            cnt[A[i]]++;
            sum++;
        }
    }
    
    sort(all(cnt));
    reverse(all(cnt));
    
    ll ans=1;
    
    for(int i=0;i<N;i++){
        if(cnt[i]==0) break;
        
        ans*=comb(sum,cnt[i]);
        ans%=mod;
        
        sum-=cnt[i];
    }
    
    cout<<ans<<endl;
    
}


Measured memory_bytes: 9600
q = int(input())

for i in range(q):
    x = input()
    y = input()
 
    l = []
    for j, s in enumerate(x):
        l.append([])
        l[j].append(-1)
        if j == 0:
            endPos = y.find(s)
            if endPos != -1: 
                l[j].append(endPos)
        else:
            for k, t in enumerate(l[j - 1][:-1]):
                endPos = y.find(s, t + 1)
                if endPos != -1:
                    l[j].append(min(endPos, l[j - 1][k + 1]))
                else:
                    l[j].append(l[j - 1][k + 1])
            endPos = y.find(s, l[j - 1][-1] + 1)
            if endPos != -1:
                l[j].append(endPos)

    print(len(l[-1]) - 1)


Measured memory_bytes: 20568
import java.util.Scanner

var map: Array<CharArray>? = null
val sides = arrayOf(Pair(-1,0), Pair(0,-1), Pair(0,1), Pair(1,0))
fun main(args: Array<String>) {
	val scanner = Scanner(System.`in`)
	while(true){
		val w = scanner.nextInt()
		val h = scanner.nextInt()
		if (w==0 && h==0) break
		var xbeg: Int = -1
		var ybeg: Int = -1
		map = Array(h){
			val cs = scanner.next().toCharArray()
			val x = cs.indexOf('@')
			if (x!=-1) {
				xbeg=x
				ybeg=it
			}
			return@Array cs
		}
		println(rec(xbeg, ybeg, w, h))
	}

}

fun rec(x: Int, y: Int, w: Int, h: Int): Int{
	var ans = 1
	for (side in sides){
		val nx = x+side.first
		val ny = y+side.second
		if (nx !in 0 until w) continue
		if (ny !in 0 until h) continue
		if  (map!![ny][nx]=='.') {
			map!![ny][nx]='@'
			ans += rec(nx, ny, w, h)
		}
	}
	return ans
}


Measured memory_bytes: 39608
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
string lie;
int zhong[1000005];
bool zhao(int a){
    for(int i=2;i<a;i++){
        if(lie[i-1]=='o'){
            if(zhong[i-1]==0)zhong[i]=zhong[i-2];
            else zhong[i]=(zhong[i-2]+1)%2;
        }
        else{
            if(zhong[i-1]==1)zhong[i]=zhong[i-2];
            else zhong[i]=(zhong[i-2]+1)%2;
        }
    }
    int s,s1;
    if(lie[a-1]=='o'){
        if(zhong[a-1]==0)s=zhong[a-2];
        else s=(zhong[a-2]+1)%2;
    }
    else{
        if(zhong[a-1]==1)s=zhong[a-2];
        else s=(zhong[a-2]+1)%2;
    }
    if(lie[0]=='o'){
        if(zhong[0]==0)s1=zhong[1];
        else s1=(zhong[1]+1)%2;
    }
    else{
        if(zhong[0]==1)s1=zhong[1];
        else s1=(zhong[1]+1)%2;
    }
    if(s==zhong[0]&&s1==zhong[a-1]){
        for(int i=0;i<a;i++){
            if(zhong[i]==0)printf("S");
            else printf("W");
        }puts("");return 1;
    }
    else return 0;
}
int main(){
    int n;
    cin>>n>>lie;
    zhong[0]=0;zhong[1]=0;
    if(zhao(n)==1)return 0;
    zhong[0]=1;zhong[1]=0;
    if(zhao(n)==1)return 0;
    zhong[0]=0;zhong[1]=1;
    if(zhao(n)==1)return 0;
    zhong[0]=1;zhong[1]=1;
    if(zhao(n)==1)return 0;
    printf("-1\n");return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
// const ll MOD=998244353;

int main(){
  int A,P; cin>>A>>P;
  P+=A*3;
  cout<<P/2<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b, menseki, shu;

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

	menseki = a * b;
	shu = (a + b) * 2;

	printf("%d %d\n", menseki, shu);

	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n, m);
    Cins(int, n, a);
    
    vector<int> dp(n+1, 0);
    dp[0] = 1;
    dp[1] = ((a[0] == 1) ? 0 : 1);
    int k = ((a[0] == 1) ? 1 : 0);
    
    For(i, n-1){
        if(k < m && a[k] == i+2){
            k ++;
            continue;
        }
        dp[i+2] = (dp[i+1] + dp[i]) % MOD;
    }
    Cout(dp[n]);
}


Measured memory_bytes: 1152
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<math.h>
using namespace std;
#define dint __int128
#define gc getchar()
#define fup(i,a,b) for(int i=a;i<b;++i)
#define upf(i,a,b) for(int i=a;i<=b;++i)
#define dnf(i,a,b) for(int i=a;i>=b;--i)
#define mem(a,b) memset(a,b,sizeof(a))
#define hh putchar(10)
#define ll long long
inline ll read(){ll x,f=1;char a;while((a=gc)<48||a>57)if(a==45)f=-1;
for(x=a^48;(a=gc)>47&&a<58;x=(x<<3)+(x<<1)+(a^48));return f*x;}
struct node{int x,y,z;};
void Main();

void Main()
{
    int n;
    cin>>n;
    int a[n];
    fup(i,0,n)cin>>a[i];
    ll ans=0;
    fup(i,0,n)fup(j,i+1,n)
        ans+=a[i]*a[j];
    cout<<ans;
}
int main()
{
    Main();
    return 0;
}

Measured memory_bytes: 256
# ENV[Z = 'RUBY_THREAD_VM_STACK_SIZE'] || exec( { Z => '50000000' },'ruby',$0)
# readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }
# gets.split.map(&:to_i)
#


x = gets.to_i

money = 100.000

year = 0

while money < x
  year += 1
  money = money + (money * 0.01).floor
end

puts year


Measured memory_bytes: 14404
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int l[100005];
int r[100005];
int main(){
	int n,m,k;
	cin>>n>>m;
	int t=k;
	int ll,rr;
	cin>>ll>>rr;
	for(int i=1;i<m;i++){
		int x,y;
		cin>>x>>y;
		ll = max(x,ll);
		rr = min(y,rr);
	}
	if(ll<=rr)
		cout<<rr-ll+1<<endl;
	else 
		cout<<0<<endl;
	
} 

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

int main(int argc, const char * argv[]) {



    cin.tie(0);
    ios::sync_with_stdio(false);

    /////////////////////
    // Write code below /
    /////////////////////
    int A,B,C,D;

    cin>>A>>B>>C>>D;

    if(A*B<C*D){
        cout<<C*D<<endl;
    }
    else{
        cout<<A*B<<endl;
    }
}

Measured memory_bytes: 256
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using graph = vector<vector<long long int>>;
using wgraph = vector<vector<pair<long long int, long long int>>>;
long long int INF = 1001001001001001LL;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;
long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define rep(i,n) for(long long int i = 0; i < (n); i++)
#define rrep(i,n) for(long long int i = 1; i <= (n); i++)
#define drep(i,n) for(long long int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for(long long int i = s; i < t; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/

int main(){
  
  int a, b; cin >> a >> b;
  int ans = 0;

  int cur = 1;

  while(cur < b){
    ans++;
    cur += (a - 1);
  }

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


Measured memory_bytes: 888
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + n + 1);
	cout << a[n / 2 + 1] - a[n / 2] << endl;
	return 0;
}

Measured memory_bytes: 640
P32 = 3.times.to_a.permutation(2) # no dup

n = gets.to_i
# [a, b, c][]
ts = Array.new(n) { gets.split.map(&:to_i) }

dp = [[0] * 3]
n.times do |i|
  dp << [0] * 3
  P32.each do |(j, k)|
    # change max
    score = dp[i][j] + ts[i][k]
    dp[i + 1][k] = score if dp[i + 1][k] < score
  end
end

p dp.last.max


Measured memory_bytes: 16124
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}

void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};

void solve(){
  string s;
  cin>>s;
  int cnt=0;
  rep(i,0,3) if(s[i]=='1') cnt++;
  cout<<cnt<<endl;
}

int main(){
    optimizeIO();
    int r=1;
    {solve();}
}


Measured memory_bytes: 7024
# coding=utf-8

if __name__ == "__main__":
    N = int(input())
    B = list(map(int, input().split()))
    A = [B[0]]

    for i in range(N-2):
        A.append(min(B[i], B[i+1]))
    else:
        A.append(B[-1])
    print(sum(A))


Measured memory_bytes: 3064
n, a, b = map(int, input().split())
S = input()
cnt = 0
cnt2 = 0
for s in S:
    if s == 'a' and cnt < (a + b):
        print('Yes')
        cnt += 1
    elif s == 'b' and cnt < (a + b)and cnt2 < b:
        print('Yes')
        cnt += 1
        cnt2 += 1
    else:
        print('No')


Measured memory_bytes: 4016
from __future__ import division, print_function
from sys import stdin, maxint
 
 
def main():
    num = int(stdin.readline())
 
    y = []
    for _ in xrange(num):
        it = iter(int(s) for s in stdin.readline().split()[1:])
        y.append([(next(it), next(it)) for _ in xrange(next(it))])
 
    weight = [maxint] * num
    weight[0] = 0
    t = set(xrange(1, num))
    index = 0
 
    while t:
        for v, cost in y[index]:
            if v not in t:
                continue
            weight[v] = min(weight[v], cost + weight[index])
 
        index = min(t, key=lambda i: weight[i])
        t.remove(index)
 
    for i, d in enumerate(weight):
        print(i, d)
 
 
main()

Measured memory_bytes: 6664
///supercalifragilisticexpialidocious.
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <cctype>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <utility>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <list>
#include <bitset>
#include <complex>
using namespace std;
#define f first
#define s second
#define PB pop_back 
#define pb push_back
#define mp make_pair
#define int long long
#define y1 y_golabi
#define sz(s) (int)s.size()
#define seper(n) setprecision(n)
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a,b,sizeof a)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;
typedef map<int , int> mii;
typedef pair<int , int> pii;
typedef map<string , int> msi;
typedef pair<int , string> pis;
typedef pair<int , pair<int , int> > piii;
const int MAXN = 2e3 + 10;
int n , k , u , v , mn , h[MAXN];
pii edge[MAXN];
vector<int> adj[MAXN];
int dfs(int u)
{
	int ans = (k / 2 < h[u]);
	for(auto v : adj[u])
		if(h[v] == -1)
			h[v] = h[u] + 1 , ans += dfs(v);
	return ans;
}
void input()
{
	cin >> n >> k;
	for(int i = 0 ; i < n - 1 ; i ++)
		cin >> u >> v , u -- , v -- , adj[u].pb(v) , adj[v].pb(u) , edge[i] = mp(u , v);
	return;
}
int32_t main()
{
	input() , mn = 1e9;
	/*for(int i = 0 ; i < n - 1 ; i ++)
		cout << edge[i].f << " " << edge[i].s << "       ";
	cout << endl;*/
	/*for(int i = 0 ; i < n ; i ++)
	{
		for(auto j : adj[i])
			cout << "adj[i][j]: " << j << " "; 
		cout << endl;
	}*/
	if(!(k % 2))
		for(int i = 0 ; i < n ; i ++)
			mem(h , -1) , h[i] = 0 , mn = min(mn , dfs(i));
	else
		for(int i = 0 ; i < n - 1 ; i ++)
			mem(h , -1) , h[edge[i].f] = h[edge[i].s] = 0 , mn = min(mn , dfs(edge[i].f) + dfs(edge[i].s));
	return cout << mn << endl , 0;
}		


Measured memory_bytes: 512
// Author: Zark84010 (Aditya Ranjan)

#include <bits/stdc++.h>
 
using namespace std;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"
 
#define sz(a) ((int)(a).size())
#define all(v) (v).begin(), (v).end()
#define tr(c, it) for (auto(it) = (c).begin(); (it) != (c).end(); it++)
#define pres(c, val) ((c).find(val) != (c).end())      //
#define cpres(c, val) (find(all(c), val) != (c).end()) //

#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define forf(i, a, b) for (int i = (a); i < (b); i++)
#define forb(i, a, b) for (int i = (b); i >= (a); i--)
#define fo(i, n) forf(i, 0, n)
#define fob(i, n) forb(i, 0, n - 1)
 
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
 
const int INF = 9e18;
const int N = 1e9 + 7;
// const int N = 998244353;
const double eps = 1e-9;
 
const auto start_time = std::chrono::high_resolution_clock::now();
 
void zark() {
  #ifdef ZARK
  	auto end_time = std::chrono::high_resolution_clock::now();
  	std::chrono::duration<double> diff = end_time - start_time;
  	cerr << "Time Taken : " << diff.count() << "s\n";
  #endif
}
 
#ifdef ZARK
	#include "/home/aranjan/Desktop/CP/header.h"
	#else
	#define dbg(args...)
#endif

/* ------------------ Actual Coding Starts ------------------ */

void solve() {
	string s, t;
	cin >> s >> t;
	if(sz(t) == sz(s) + 1 && t.substr(0, sz(s)) == s) cout <<"Yes\n";
	else cout << "No\n";
}

int32_t main() {
  fastio;
  #ifdef ZARK
  freopen("input.in", "r", stdin);
  #endif
 
  // freopen("txt.in", "r", stdin);
  // freopen("txt.out", "w", stdout);
  // cout << fixed << setprecision(35);
 
 	solve();
  zark();
  return 0;
}

Measured memory_bytes: 3612
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():
    N = in_n()
    xy_diff = [0] * N
    xy_plus = [0] * N

    for i in range(N):
        x, y = in_nn()
        xy_diff[i] = x - y
        xy_plus[i] = x + y

    d1 = max(xy_diff) - min(xy_diff)
    d2 = max(xy_plus) - min(xy_plus)

    print(max(d1, d2))


if __name__ == '__main__':
    main()


Measured memory_bytes: 71544
mod=10**9+7
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
ansx=0
cum=x[0]
for i in range(1,n):
    ansx+=(i*x[i]-cum+mod)%mod
    ansx%=mod
    cum+=x[i]
ansy=0
cum=y[0]
for i in range(1,m):
    ansy+=(i*y[i]-cum+mod)%mod
    ansy%=mod
    cum+=y[i]
#print(ansx,ansy)
print((ansx*ansy)%mod)


Measured memory_bytes: 18624
n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort_by{|e| -e}

b = []
m.times do
    if a == []
        a = b
        b = [a.shift / 2]
    elsif b.empty? || a[0] > b[0]
        b << a.shift / 2
    else
        b << b.shift / 2
    end
end

puts a.inject(0, :+) + b.inject(0, :+)

Measured memory_bytes: 13016
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++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 ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int N; cin >> N;
    vector<int> L(N);
    rep (i, N) { cin >> L[i]; }
    std::sort(ALL(L));

    int s = 0;
    rep (i, N - 1)
    {
        s += L[i];
    }
    if (L[N - 1] < s)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }


    return 0;
}


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

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

  ll N; cin >> N;
  ll K; cin >> K;
  vector<ll> A(N); for (ll i = 0; i < N; i++) cin >> A[i];

  ll MOD = 1e9 + 7;
  vector<ll> dp(K + 2, 0);
  dp[0] = 1;

  for (ll i = 0; i < N; i++) {
    vector<ll> S(K + 2, 0), dpN(K + 2, 0);
    for (ll j = 0; j <= K; j++) {
      S[j + 1] = (S[j] + dp[j]) % MOD;
    }

    for (ll j = 0; j <= K; j++) {
      ll l = max(0ll, j - A[i]);
      ll r = j + 1;
      dpN[j] += (S[r] - S[l]);
      dpN[j] = (dpN[j] + MOD) % MOD;
    }
    dp = dpN;
  }

  cout << dp[K] << '\n';
  return 0;
}

Measured memory_bytes: 2668
#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int unsigned long long
#define endl "\n"
using namespace std;

int32_t main() {
  ios;
  int t = 1;
  // cin>>t;
  while(t--) {
    char c;
    cin>>c;
    if(isupper(c))
      cout<<'A';
    else
      cout<<'a';
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3604
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class Program
{
    public static void Main()
    {

        long[] result = { 0, 0, 0, 0 };
        string readLine = string.Empty;
        List<long> line = new List<long>();

        while ((readLine = Console.ReadLine()) != null)
        {
            line = Array.ConvertAll(readLine.Split(' '), long.Parse).ToList();
            line.Sort();
            if (line[0] + line[1] <= line[2])
            {
                break;
            }
            else
            {

                result[0]++;
                if (Math.Pow(line[0], 2) + Math.Pow(line[1], 2) == Math.Pow(line[2], 2))
                { result[1]++; }
                else if (Math.Pow(line[0], 2) + Math.Pow(line[1], 2) > Math.Pow(line[2], 2))
                { result[2]++; }
                else
                { result[3]++; }
            }
        }
        Console.WriteLine("{0} {1} {2} {3}", result[0], result[1], result[2], result[3]);
    }
}




Measured memory_bytes: 18400
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    int x;
    cin>>x;
    int y=(x%500)/5;
    cout<<1000*(x/500)+5*y<<endl;
    return 0;
}

Measured memory_bytes: 256
from math import sqrt
Q = int(input())
que = []
for i in range(Q):
    que.append(tuple(map(int, input().split())))
for q in que:
    if q[0] == q[1]:
        print(2*q[0]-2)
    else:
        a = q[0]*q[1]
        p = int(sqrt(a))
        if p*p == a:
            p -= 1
        if a > p*(p+1):
            print(2*p-1)
        else:
            print(2*p-2)

Measured memory_bytes: 3192
// #Sazaの1日1AC
#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
const int INF=mod;
const double PI=3.14159265358979323846;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<int, int>;
using vl=vector<long long>;
using vvl=vector<vector<long long>>;
using vP=vector<pair<long long, long long>>;
//ショートカット
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,k,n) for(int i = k; i < n; i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define mkp make_pair
//入力
#define vin(v,N) for(long long id=0;id<N;id++) cin>>v.at(id)
#define lin(n) long long n;cin>>n
#define chin(x) char x;cin>>x;
#define sin(s) string s;cin>>s;
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)


//関数
//最大公約数
long long gcd(long long m, long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m, long long n){
  return m*n/gcd(m,n);
}
//繰り返し二乗法
long long repeat_squaring(long long x, long long n){
  if(n==0) return 1;
  else if(n%2==0){
    long long t=repeat_squaring(x,n/2);
    return t*t%mod;
  }
  else
    return x*repeat_squaring(x,n-1)%mod;
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//構造体

/////////////////⊂('ω'⊂ )))Σ≡GO!/////////////////





int main(){

  ll N; cin >> N;
  ll max_d = 0;
  vector<ll> a(1e5 + 10);
  bool NG = false;
  rep(i, N){
    ll d; cin >> d;
    max_d = max(d, max_d);
    a[d]++;
    if((i == 0 && d != 0) || (i != 0 && d == 0)) NG = true;
  }


  ll res = 1;
  rep(i, max_d+1){
    for(int j = 0; j < a[i+1]; j++){
      res *= a[i];
      res %= mod;
    }
  }
  if(NG){
    cout << 0 << endl;
    return 0;
  }
  cout << res << endl;

  
}



Measured memory_bytes: 1024
program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,ans,l,r
    integer(int32), allocatable:: h(:)

    read*, n
    allocate(h(n))
    read*, h(:)
    ans=0
    do while(sum(h) > 0)
        call search_lr(l,r)
        h(l:r)=h(l:r)-1
        ans=ans+1
    end do
    print'(i0)', ans

contains
    subroutine search_lr(l,r)
        integer(int32):: l,r,i
        i=1
        l=0
        r=0
        do i=1,n
            if (h(i) /= 0) then
                l=i
                exit
            end if
        end do

        do i=l,n
            if(h(i) == 0) exit
            r=i
        end do
    end subroutine
end program name

Measured memory_bytes: 512
import collections

def main():
    n = int(input())
    s_list = []
    for _ in range(n):
        s_list.append(input())
    c = collections.Counter(s_list)

    for result in ["AC", "WA", "TLE", "RE"]:
        print("{0} x {1}".format(result, c[result]))

if __name__ == "__main__":
    main()


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

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

  scanf("%d%d",&x,&y);
  if( ( x < 1 || 1000000000 < x ) || ( y < 1 || 1000000000 < y )) exit(2);

      while(( z = x % y ) != 0 ){
	x = y;
	y = z;
      }
      printf("%d\n",y);
	return 0;
}

Measured memory_bytes: 592
n, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(n)]
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
ans =  10**6
for i in range(4**n):
  s = Base_10_to_n(i, 4)
  s = s.zfill(n)
  l_temp = [0, 0, 0]
  cnt = [0, 0, 0]
  for num, j in enumerate(s):
    if int(j):
      l_temp[int(j)-1] += l[num]
      cnt[int(j)-1] += 1
  if 0 in cnt:
    continue
  else:
    ans_temp = 10*(sum(cnt)-3) +abs(A-l_temp[0]) + abs(B-l_temp[1]) + abs(C-l_temp[2])
    ans = min(ans, ans_temp) 
print(ans)

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

int main(){//main_program
  int N,X,Y,count;
  cin >> N;
  X = 1;
  Y = N;
  count =0;
  vector<int> C(N+1);
  
  for(int i = 1;i<N+1;i++){
    char A;
    cin >> A;
    if(A == 'W'){
      C.at(i) = 0;
    }else{
      C.at(i) = 1;
    }
    //cout << C.at(i);
  }
 // cout<< endl;
  
  while(C.at(X) == 1 && X <N){
    //cout << "A:"<< C.at(X)<< endl;
      X++;
    
    }
    while(C.at(Y) == 0 && Y >1){
      Y--;
      //cout << "B" << endl;
    }
  
  while(X<Y){
    count++;
    C.at(X) = 1;
    C.at(Y) = 0;
    //cout << "C" << endl;
    while(C.at(X) == 1&& X <N){
      X++;
      //cout << "D" << endl;
    }
    while(C.at(Y) == 0 && Y >1){
      Y--;
     // cout << "E" << endl;
    }
  }
  cout << count << endl;

  
}

Measured memory_bytes: 4044
#include<iostream>

using namespace std;

int main()
{
    int l;
    int x[10000];
    for( l = 0; ; l++ )
    {
        cin >> x[l];
	if( x[l] == 0)
            break;
    }

    for( int i = 0; i < l; i++)
        cout << "Case " << i + 1 << ": " << x[i] << endl;

    return 0;
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define ll long long
#define INF 999999999

const ll mod = 1e9+7;

unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

ll Pow(ll a, ll b){
	ll dst = 1;
	REP(i, b){
		dst *= a;
	}
	return dst;
}

int main(){
	ll n;
	cin >> n;
	ll temp = n;
	ll sum = 0;
	int d = GetDigit(n);
	for (int i = d-1; i>=0; i--){
		sum += n/Pow(10, i);
		n %= Pow(10, i);
	}
	if (temp%sum == 0){cout << "Yes" << endl;}
	else {cout << "No" << endl;}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main() {
   int N, P;
   int x,even=0;
   ll ans=0;
   cin >> N >> P;
   for (int i=1; i<=N; i++) {
      cin >> x;
      if(x%2==0) even++;
   }
   if(even==N){
       if(P==1) ans=0;
       else ans=pow(2,N);
   }else ans=pow(2,N-1);
   cout << ans;
}

Measured memory_bytes: 256
S = input()

temp = ''
result = ''
for i in range(len(S)):
    for n in range(len(S)):
        if temp + S[n:] == 'keyence':
            result = temp + S[n:]
            break
    temp += S[i]

if result == 'keyence':
    print('YES')
else:
    print('NO')


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

#define     MX        (1<<18)
#define     mod       998244353
#define     ll        long long
#define     ld        long double
#define     mem(a,b)  memset(a,b,sizeof(a))
#define     fast()    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     F         first
#define     S         second
#define     mp        make_pair
#define     inf       2e18
#define     PI        acos(-1)

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

int n,q;
int V[MX],W[MX];
const int BIG=100005;
ll dp[(1<<9)][BIG];

int h;

ll query(int v,int L){
    int lvl = log2(v);
    if(lvl<=h) return dp[v][L];
    vector<int>up;
    while(lvl>h) {
        up.push_back(v);
        v/=2;
        --lvl;
    }
    ll res=0;
    for(int mask=0;mask<(1<<up.size());mask++){
        ll nW=0,nV=0;
        for(int i=0;i<up.size();i++){
            if(mask&(1<<i)) nV+=V[up[i]],nW+=W[up[i]];
        }
        if(nW<=L) res=max(res,nV+dp[v][L-nW]);
    }
    return res;
}

void makeChild(int now){
    vector<int>up;
    int par=now;
    while(par){
        up.push_back(par);
        par/=2;
    }
    for(int mask=0;mask<(1<<up.size());mask++){
        ll nW=0,nV=0;
        for(int i=0;i<up.size();i++){
            if(mask&(1<<i)) nV+=V[up[i]],nW+=W[up[i]];
        }
        if(nW<BIG) dp[now][nW]=max(dp[now][nW],nV);
    }
    for(int i=1;i<BIG;i++) dp[now][i]=max(dp[now][i],dp[now][i-1]);
}
void make(int now){
    int lvl=log2(now);
    if(lvl>h || now>n) return;
    makeChild(now);
    make(now*2);
    make(now*2+1);
}

int main(){
    //fast();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    scanf("%d",&n);
    h=log2(n);
    h=h/2;
    for(int i=1;i<=n;i++) {
        scanf("%d%d",&V[i],&W[i]);
    }
    make(1);
    scanf("%d",&q);
    for(int i=1;i<=q;i++){
        int v,L;
        scanf("%d%d",&v,&L);
        printf("%lld\n",query(v,L));
    }

    return 0;
}


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

//??????????????????????????????
void show_array(int a[],int n){
  for(int i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%d",a[i]);
  }
  printf("\n");
}

int BubbleSort(int a[],int n){
  int count=0;
  for(int i=0;i<n;i++){
    for(int j=n-1;j>i;j--){
      if(a[j]<a[j-1]){
        int temp=a[j];
        a[j]=a[j-1];
        a[j-1]=temp;
        count++;
      }
    }
  }
  return count;
}

int main(){
  int n;
  scanf("%d",&n);
  int num_list[n];
  for(int i=0;i<n;i++) scanf("%d",&num_list[i]);
  int count = BubbleSort(num_list,n);
  show_array(num_list,n);
  cout << count <<endl;
}

Measured memory_bytes: 1244