akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    int n, m;
    cin >> n >> m;
    cout << (1900*m + 100*(n-m))*pow(2,m) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;main(){long long n,t[1000],a[1000],j;cin>>n>>t[0]>>a[0];for(int i=1;i<n;i++){cin>>t[i]>>a[i];j=max((a[i-1]-1)/a[i],(t[i-1]-1)/t[i])+1;a[i]*=j;t[i]*=j;}cout<<a[n-1]+t[n-1]<<endl;}

Measured memory_bytes: 256
N,M=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(10)]
s=[list(map(int,input().split())) for i in range(N)]
from scipy.sparse.csgraph import floyd_warshall
l=floyd_warshall(l)
ans=0
for i in s:
   for j in i:
      ans+=0 if j == -1 else l[j][1]
print(int(ans))

Measured memory_bytes: 27716
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
	ll N;
	cin >> N;
	ll ans=0;
	for(ll i=1; i<=N; ++i){
		ll m=N/i;
		ans += i*m*(m+1)/2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
import java.util.Arrays;
import java.util.Scanner;

public class Main{

    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();

        int[] cardList = new int[n];
        int[] player = new int[2];
        for(int i=0;i<n;i++){
            cardList[i] = s.nextInt();
        }

        Arrays.sort(cardList);

        int switchPlayer = 0;

        for(int i=n-1;i>=0;i--){
            if(switchPlayer == 0){
                player[0] += cardList[i];
                switchPlayer = 1;
            } else {
                player[1] += cardList[i];
                switchPlayer = 0;
            }
        }

        System.out.println(player[0] - player[1]);


    }

}

Measured memory_bytes: 21716
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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

    N = ii()
    A = il()
    ret = collections.deque()

    for n in range(N):
        if N % 2 == (n+1) % 2:
            ret.appendleft(A[n])
        else:
            ret.append(A[n])
    print(*ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 24052
a,b=map(int,input().split())
s=[input().split() for i in range(b)]
c=0
d=100000
for j in s:
    j[0]=int(j[0])
    j[1]=int(j[1])
    if j[0]>c:
        c=j[0]
    if j[1]<d:
        d=j[1]
if d-c+1<0:
    ans=0
else:
    ans=d-c+1
print(ans)

Measured memory_bytes: 32152
#include<iostream>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>

using namespace std;

int main()
{
	int k, n;
	cin >> k >> n;
	int a[200000];
	int M=0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (i > 0) {
			M = max(M, a[i] - a[i - 1]);
		}
	}
	M = max(M, k - a[n - 1] + a[0]);
	cout << k - M << endl;
    return 0;
}

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

int main(){
  int n,l,i,a[200],b[200];
  int temp=0,min=100000,sum=0;
  scanf("%d %d",&n,&l);
  
  for(i=0;i<n;i++) a[i]=l+i;
  for(i=0;i<n;i++) b[i]= abs(a[i]);
  for(i=0;i<n;i++){
    if(b[i]<min){
      temp = i;
      min = b[i];
    }
  }
  
  a[temp]=0;
  for(i=0;i<n;i++) sum+=a[i];
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 128
n=int(input())
s=[59049, 46656, 7776, 6561, 1296, 729, 216, 81, 36, 9, 6]
best=float("inf")

for i0 in range(2):
  if i0*s[0]>n or i0>=best: continue
  for i1 in range(3):
    if i0*s[0]+i1*s[1]>n or i0+i1>=best: continue
    for i2 in range(6):
      if i0*s[0]+i1*s[1]+i2*s[2]>n or i0+i1+i2>=best: continue
      for i3 in range(6):
        if i0*s[0]+i1*s[1]+i2*s[2]+i3*s[3]>n or i0+i1+i2+i3>=best: continue
        for i4 in range(6):
          if i0*s[0]+i1*s[1]+i2*s[2]+i3*s[3]+i4*s[4]>n or i0+i1+i2+i3+i4>=best: continue
          for i5 in range(6):
            if i0*s[0]+i1*s[1]+i2*s[2]+i3*s[3]+i4*s[4]+i5*s[5]>n or i0+i1+i2+i3+i4+i5>=best: continue
            for i6 in range(6):
              if i0*s[0]+i1*s[1]+i2*s[2]+i3*s[3]+i4*s[4]+i5*s[5]+i6*s[6]>n or i0+i1+i2+i3+i4+i5+i6>=best: continue
              for i7 in range(6):
                if i0*s[0]+i1*s[1]+i2*s[2]+i3*s[3]+i4*s[4]+i5*s[5]+i6*s[6]+i7*s[7]>n or i0+i1+i2+i3+i4+i5+i6+i7>=best: continue
                for i8 in range(6):
                  if i0*s[0]+i1*s[1]+i2*s[2]+i3*s[3]+i4*s[4]+i5*s[5]+i6*s[6]+i7*s[7]+i8*s[8]>n or i0+i1+i2+i3+i4+i5+i6+i7+i8>=best: continue
                  for i9 in range(6):
                    if i0*s[0]+i1*s[1]+i2*s[2]+i3*s[3]+i4*s[4]+i5*s[5]+i6*s[6]+i7*s[7]+i8*s[8]+i9*s[9]>n or i0+i1+i2+i3+i4+i5+i6+i7+i8+i9>=best: continue
                    for i10 in range(6):
                      if i0*s[0]+i1*s[1]+i2*s[2]+i3*s[3]+i4*s[4]+i5*s[5]+i6*s[6]+i7*s[7]+i8*s[8]+i9*s[9]+i10*s[10]>n or i0+i1+i2+i3+i4+i5+i6+i7+i8+i9+i10>=best: continue
                      num= n - (i0*s[0]+i1*s[1]+i2*s[2]+i3*s[3]+i4*s[4]+i5*s[5]+i6*s[6]+i7*s[7]+i8*s[8]+i9*s[9]+i10*s[10])
                      best=min(best, i0+i1+i2+i3+i4+i5+i6+i7+i8+i9+i10+num)

print(best)
                      



Measured memory_bytes: 97496
#include <iostream>

using namespace std;

int main() {
    long long int n;
    cin >> n;
    long long int ans = 0;
    long long int ka, kb;
    ka = kb = 0;
    for (long long int i = 1; i*i <= n; i++) {
        if (i * i == n) {
            if (i > 2) {
                ka = n/(i-1);
                kb = n%(i-1);
                if (ka == kb) {
                    ans += (i-1);
                }
            }
        } else if (n % i == 0) {
            if (i > 2) {
                ka = n/(i-1);
                kb = n%(i-1);
                if (ka == kb) {
                    ans += (i-1);
                }
            }
            if ((n/i) > 2) {
                ka = n/((n/i)-1);
                kb = n%((n/i)-1);
                if (ka == kb) {
                    ans += (n/i)-1;
                }
            }
        }
    }

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

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

using namespace std;

int n, m, len, sx, sy;

char s[200010], t[200010];

int main () {
	scanf ("%d%d%d", &n, &m, &len);
	scanf ("%d%d", &sx, &sy);
	scanf ("%s", s + 1);
	scanf ("%s", t + 1);
	
	int l = 0, r = n + 1;
	
	for (int i = len; i >= 1; --i) {
		if (t[i] == 'U' && r <= n) ++r;
		if (t[i] == 'D' && l >= 1) --l;
		if (s[i] == 'U') ++l;
		if (s[i] == 'D') --r;
		if (l >= r - 1) { printf ("NO\n"); return 0; }
	}
	
	if (l >= sx || r <= sx) { printf ("NO\n"); return 0; }
	
	l = 0, r = m + 1;
	
	for (int i = len; i >= 1; --i) {
		if (t[i] == 'L' && r <= m) ++r;
		if (t[i] == 'R' && l >= 1) --l;
		if (s[i] == 'L') ++l;
		if (s[i] == 'R') --r;
		if (l >= r - 1) { printf ("NO\n"); return 0; }
	}
	
	if (l >= sy || r <= sy) { printf ("NO\n"); return 0; }
	
	printf ("YES\n");
	
	return 0;
}

Measured memory_bytes: 640
#解説pdfと考え方そのままに
#c(i,j)の部分を工夫(maspyさんに感謝)
from collections import defaultdict
n = int(input())


dic = defaultdict(int)

#for x in map(str,range(1,n+1))
for k in range(1,n+1):
    left = str(k)[0]
    right = str(k)[-1]
    dic[(left,right)] += 1
                
ans = 0
items = list(dic.items())
for (left,right),cnt in items:
    ans += cnt * dic[(right,left)]

print(ans)
    

Measured memory_bytes: 9416
#include "bits/stdc++.h"
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define LL long long
int n;
string s[50];
int t[50];
string x;
int main(){
  cin>>n;
  REP(i,n)cin>>s[i]>>t[i];
  cin>>x;
  int ret=0;
  bool bl=false;
  REP(i,n){
    if(bl)ret+=t[i];
    if(s[i]==x)bl=true;
  }
  cout<<ret<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		SC sc = new SC(System.in);
		int N=sc.nextInt();
		int M=sc.nextInt();
		int INF=1000000007;
		boolean[][] maps=new boolean[N+2][N+2];
		boolean[][] used=new boolean[N+2][N+2];
		int[][] cost=new int[N+1][N+1];
		int[][] moto=new int[N+1][N+1];
		for(int i=0; i<=N; i++) {
			for(int j=0; j<=N; j++) {
				cost[i][j]=INF;
				moto[i][j]=INF;
			}
		}
		for(int i=0; i<M; i++) {
			int from=sc.nextInt();
			int to=sc.nextInt();
			int cst=sc.nextInt();
			maps[from][to]=true;
			maps[to][from]=true;
			cost[from][to]=cst;
			cost[to][from]=cst;
			moto[from][to]=cst;
			moto[to][from]=cst;
		}
		for(int k=1; k<=N; k++) {
			for(int i=1; i<=N; i++) {
				for(int j=1; j<=N; j++) {
					if(cost[i][j]>cost[i][k]+cost[k][j]) {
						cost[i][j]=cost[i][k]+cost[k][j];
					}
				}
			}
		}
		for(int i=1; i<=N; i++) {
			for(int j=1; j<=N; j++) {
				if(maps[i][j]) {
					if(moto[i][j]<=cost[i][j]) {
						used[i][j]=true;
						used[j][i]=true;
					}
				}
			}
		}
		int sum=0;
		for(int i=1; i<=N; i++) {
			for(int j=1; j<=N; j++) {
				if(maps[i][j] && !used[i][j]) {
					sum++;
				}
			}
		}
		pl(sum/2);	//無向グラフなので
	}

	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
}


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

int main(){
  int n, w[100], s = 0, r = 0, m = 1000;
  cin >> n;
  rep(i, n) {
    cin >> w[i];
    s += w[i];
  }
  rep(i, n) {
    r += w[i];
    m = min(m, abs(s - 2 * r));
  }
  cout << m << endl;   
}

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

auto chmax = [](int &a, int b) { a = max(a, b); };

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.length();
  int m = t.length();
  vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      chmax(dp[i + 1][j + 1], dp[i][j + 1]);
      chmax(dp[i + 1][j + 1], dp[i + 1][j]);
      chmax(dp[i + 1][j + 1], dp[i][j] + (s[i] == t[j]));
    }
  }

  string ans = "";
  int cur = m;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = cur - 1; j >= 0; j--) {
      if (s[i] == t[j] && dp[i][j] + 1 == dp[i + 1][cur]) {
        ans = s[i] + ans;
        cur = j;
        break;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 35584
fn scan<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn scan_split<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|t| t.parse().ok().unwrap()).collect()
}

fn scan_split_with<T: std::str::FromStr>(ch: char) -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split(ch)
        .map(|t| t.parse().ok().unwrap()).collect()
}

fn scan_lines<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| scan::<T>()).collect()
}

fn main() {
    let mut abc = scan_split::<i32>();
    abc.sort();
    let a575 = vec![5, 5, 7];  // sorted [5, 7, 5]

    println!("{}", if abc == a575 { "YES" } else { "NO" });
}

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

int main()
{
    int a, b;
    scanf("%d %d", &a, &b);
    if ((a+b)%2==0)
    {
        printf("%d", (a+b)/2);
    }
    else
    {
        printf("%d", (a+b)/2+1);
    }
    return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn._
object Main extends App{
  val sc = new java.util.Scanner(System.in)
  val a = sc.nextInt
  val b = sc.nextInt
  if((a+b)%2==0){
    println((a+b)/2)
  }
  else{
    println((a+b)/2+1)
  }  
}

Measured memory_bytes: 25420
#include<bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pl;

#define sl(x) scanf("%lld",&x)
#define pl(x) printf("%lld\n",x)
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define F first
#define S second
#define f(i,n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)

const ll mod = 1000000007;
const ll inf = (ll)5e16;
const ld eps = 1e-12;
const ll N = 1000005;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}
string s;
int main()
{
    ios_base::sync_with_stdio(0);
    cin >> s;
    cout << "ABC";
    cout << s << "\n";
    return 0;
}


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

int main()
{
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int maxi = max(a, max(b, c));
  int i, addmaxi;
  addmaxi = maxi;
  for(i = 0; i < k; i++)
  {
    addmaxi *= 2;
  }
  addmaxi -= maxi;
  cout << addmaxi + a + b + c << endl;
}

Measured memory_bytes: 256
// ABC_167_A

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

int main()
{
	//cout << fixed << setprecision(15) << "\n";

	string s,t;
	cin >> s >> t;

	string t_sub = t.substr(0, t.size()-1);

	bool l = (1 <= t_sub.size()) && (10 >= t_sub.size());
	
	//cout << s << "\n";
	//cout << t << "\n";
	//cout << t_sub << "\n";

	if(l){
		if(s.compare(t_sub) == 0) cout << "Yes" << "\n";
		else cout << "No" << "\n";
	}
	else cout << "No" << "\n";

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    if(N==1)
        cout << "Hello World" << endl;
    if(N==2){
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  double b[11];
  double a,s;
  int i;

  while(scanf("%lf",&a)!=EOF){
    b[1]=a;
    b[2]=b[1]*2.0;
    for(i=3;i<=9;i=i+2){
      b[i]=b[i-1]/3.0;
      b[i+1]=b[i]*2.0;
    }
    s=0.0;
    for(i=1;i<=10;i++)
      s+=b[i];
    printf("%f\n",s);
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define B __int128
#define mod 998244353
using namespace std;
map<B,int>mp[111];
int dfs(int l,B S){
	if (!l) return 1;
	if (mp[l].count(S)) return mp[l][S];
	int sum=dfs(l-1,S/2)*(S%2+1)%mod;
	B x=0,y;
	for (int i=1;i<=l;i++){
		x=x<<1|1; y=S&x;
		for (int j=i+i;j<=l;j+=i)
			sum=(sum+1ll*dfs(i,y&=S>>j-i)*dfs(l-j,S>>j))%mod;
	}
	return mp[l][S]=sum;
}
char s[111]; int l;
int main(){
	cin>>s; l=strlen(s);
	B S=0; for (int i=l;i--;) S=S<<1|(s[i]=='1');
	printf("%d\n",dfs(l,S));
}

Measured memory_bytes: 3840
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



int b[200001];


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

	int n;
	string s;
	

	cin >> n >> s;
	rep(i, n) {
		if (s[i] == '.') {
			b[i + 1] = b[i];
		}
		else {
			b[i + 1] = b[i] + 1;
		}
	}

	int ans = min(b[n], n - b[n]);
	for (int i = 1; i <= n; i++) {
		int x = b[i] + (n - i - (b[n] - b[i]));
		ans = min(ans, x);
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 1300
# -*- coding: utf-8 -*-

def main():
	n, k = map(int, input().split())
	s = input()
	new_s = ""
	for i, s_char in enumerate(s):
		if i+1 == k:
			new_s += s_char.lower()
		else:
			new_s += s_char
	print(new_s)

if __name__ == "__main__":
	main()


Measured memory_bytes: 2940
main = do 
 n <- getLine
 as <-map (read::String -> Int) . words <$> getLine
 let c = (f as 1 399)+(f as 400 799)+(f as 800 1199)+(f as 1200 1599)+(f as 1600 1999)+(f as 2000 2399)+(f as 2400 2799)+(f as 2800 3199)
 let d = length $ filter (>=3200) as
 let maxc = c + d
 let minc = max 1 c
 putStr $ (show minc) ++ " " ++ (show maxc)
f as m n
    |null $ filter (\x -> (m<=x && x <=n)) as = 0
    |otherwise =1


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

using namespace std ;
#define rep(i,n) for(int i =0 ; i < int (n); i++)
typedef long long ll;
typedef pair <int , int >pi;
typedef vector <int> vi ;
typedef vector <string> si;



int main (){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n ;
	int c1 = 0, c2= 0 , c3= 0 , c4 = 0;
	cin >> n;
	string a[n];
	rep(i,n){
		cin >> a[i];
	}
	rep(i,n){
		if(a[i] == "AC"){
			c1++;
		}
		if(a[i] == "WA"){
			c2++;
		}
		if(a[i] == "TLE"){
			c3++;
		}
		if(a[i] == "RE"){
			c4++;
		}
	}


	cout << "AC " <<"x " <<c1<<endl ;
	cout << "WA " <<"x " <<c2<<endl ;
	cout << "TLE " <<"x " <<c3<<endl ;
	cout << "RE " <<"x " <<c4<<endl ;
	
	



	return 0 ;
}

Measured memory_bytes: 6732
#include <iostream>

using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  for (int i = 0, sz = (int) s.size(); i < sz; i++) {
    if (s.substr(i) + s.substr(0, i) == t) {
      cout << "Yes";
      return 0;
    }
  } 
  cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#define int long long
#define ll getchar();getchar();return 0;
using namespace std;
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n%i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x,int y) {
	int ans;
	for (int i = (min(x, y)); i >= 1; i--) {
		if (x%i == 0 && y%i == 0) {
			ans = i;
			break;
		}
	}
		return ans;
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
signed main() {
	int n;
	cin >> n;
	if (n % 111 == 0)cout << n << endl;
	else cout << 111 * (n / 111 + 1) << endl;
	ll
}

Measured memory_bytes: 256
#include<iostream> 
#include<cstring>
using namespace std;
int main()
{
    int i,j,k;
    string s;
    cin>>s;
    j=0;
    k=0;
    for(i=0;i<s.size();i++)
    {
        if(s[i]=='C')
        {
            j=1;
        }
        if(j==1&&s[i]=='F')
        {
            k=1;
        }
    }
    if(j==1&&k==1)
    {
        cout<<"Yes\n";	
    } 
    else
    {
        cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 256
// Problem : E - Bomber
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_e
// Memory Limit : 1024 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 300005

//Solution

int n,m,k;
set<int> X[N],Y[N];

vii best;

void solve(){
    cin>>n>>m>>k;
    for(int i=0;i<k;i++){
        int x,y; cin>>x>>y;
        Y[y].insert(x);
        X[x].insert(y);
    }
    for(int y=1;y<=300000;y++){
        best.pb({sz(Y[y]),y});
    }
    sort(all(best),greater<pii>());
    while(best.back().fi != best[0].fi) best.pop_back();
    int ans = 0;
    for(int x=1;x<=300000;x++){
        int cur = sz(X[x]);
        if(cur == 0) continue;
        int f = 0;
        for(auto [siz,y] : best){
            if(!Y[y].count(x)){
                ans = max(ans,cur+siz);
                f = 1;
                break;
            }
        }
        if(f) continue;
        ans = max(ans,cur+best[0].fi-1);
    }
    cout<<ans;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 67832
from collections import deque

h,w = list(map(int,input().split()))
black_num = 0
graph = []
for _ in range(h):
  tmp=input()
  black_num+=tmp.count("#")
  graph.append(list(tmp))
#graph=[list(input()) for _ in range(h)]#graph初期化

sx = 0
sy = 0
gx = h-1
gy = w-1

dist=[[-1 for j in range(w)] for i in range(h)]#distance設定
dist[sx][sy]=0#スタート地点は初期値0
 
que = deque([(sx,sy,0)])#スタート地点とdist初期値を入力
 
while que:
  u,v,z = que.popleft()
  for i,j in [(-1,0),(0,-1),(1,0),(0,1)]:
    if not (0<=u+i<h and 0<=v+j<w):#座標がh,w内でなければ探索しない
      continue
    elif graph[u+i][v+j]=="#":#壁なら探索しない
      continue
    elif dist[u+i][v+j]>0:#すでに訪れていたら探索しない
      continue

    dist[u+i][v+j]=z+1#距離を前回の＋1
    que.append([u+i,v+j,z+1])#訪れてないのでqueに今の地点を追加する

if dist[gx][gy]==-1: #ゴールまでたどり着けない場合
  print(-1)
else:
  print(h*w-(dist[gx][gy]+1)-black_num)

Measured memory_bytes: 9424
#include "bits/stdc++.h"
using namespace std;

const int N = 200005;
bitset< N> ok;
bitset< 10> chk;

bool f(int n) {
    while(n) {
        if(chk[n % 10]) return false;
        n /= 10;
    }
    return true;
}


int main() {
    int n, k;
    cin >> n >> k;
    while(k--) {
        int x;
        cin >> x;
        chk[x] = true;
    }

    vector< int> v;
    for(int i = n; ; ++i) {
        if(f(i)) return !printf("%d\n", i);
    }

}

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

typedef long long ll;
const int maxn=100010;
int n,e;
ll T;
int x[maxn];
ll f[maxn];

int main()
{
	scanf("%d%d",&n,&e);
	cin>>T;
	for (int i=1;i<=n;i++)
		scanf("%d",&x[i]);
	f[0]=0;
	f[1]=T;
	int la=0;
	ll minx=1LL<<60;
	for (int i=2;i<=n;i++)
	{
		while (2LL*(x[i]-x[la+1])>T)
		{
			ll tmp=f[la]-2LL*x[la+1];
			if (minx>tmp)	minx=tmp;
			la++;
		}
		f[i]=f[i-1]+T;
		if (la>0)
			f[i]=min(f[i],minx+2LL*x[i]);
		f[i]=min(f[i],f[la]+T);
	}
	cout<<f[n]+e<<endl;
	return 0;
}

Measured memory_bytes: 1408
object Main extends App {
  val src: Iterator[List[Int]] = io.Source.stdin.getLines.map(_.split("").map(_.toInt).toList)

  def bottomMost(li: List[Int]): Char = {
    if (li.length == 1) li.head.toString.last
    else bottomMost(bottomList(li))
  }

  def bottomList(li: List[Int]): List[Int] = li match {
    case h1 :: h2 :: tail => (h1+h2) :: bottomList(h2 :: tail)
    case _ => Nil
  }

  for (li <- src) println(bottomMost(li))
}

Measured memory_bytes: 44072
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	long long int a, b;
	cin >> a >> b;
	long long int ans = a*b;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
A,B,C,D = map(int,input().split())



#死ぬまでの攻撃回数を算出する
takahasi = -(-A // D)
aoki = -(-C // B)

#print(takahasi)
#print(aoki)


if takahasi >= aoki:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9164
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = 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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 20000;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<vector<ll>> dp(n+1,vector<ll>(k+2,0));
    cins(all(a));
    dp[0][0] = 1;
    rep(i,n){
        rep(j,k+1){
            dp[i+1][j] += dp[i][j];
            dp[i+1][min(j+a[i]+1,k+1)] -= dp[i][j]-MOD;
        }
        rep(j,k){
            dp[i+1][j] %= MOD;
            (dp[i+1][j+1] += dp[i+1][j])%=MOD;
        }
    }
    PRINT(dp[n][k]);
}


Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed
#define endl '\n'

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

struct mint {
  ll x;
  mint() : x(0) {
  }
  mint(ll x) : x((x % MOD + MOD) % MOD) {
  }
  mint& operator+=(const mint& r) {
    if ((x += r.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint& r) {
    if ((x -= r.x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint& operator*=(const mint& r) {
    if ((x *= r.x) > MOD) {
      x %= MOD;
    }
    return *this;
  }
  mint& operator++() {
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint operator++(int) {
    mint ret = x;
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return ret;
  }
  mint& operator--() {
    if ((--x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint operator--(int) {
    mint ret = x;
    if ((--x) < 0) {
      x += MOD;
    }
    return ret;
  }
  mint operator+(const mint& r) {
    mint ret;
    return ret = x + r.x;
  }
  mint operator-(const mint& r) {
    mint ret;
    return ret = x - r.x;
  }
  mint operator*(const mint& r) {
    mint ret;
    return ret = x * r.x;
  }
  mint operator-() {
    return mint() - *this;
  }
  bool operator<(const mint& a) {
    return x < a.x;
  }
  bool operator>(const mint& a) {
    return x > a.x;
  }
  bool operator<=(const mint& a) {
    return x <= a.x;
  }
  bool operator>=(const mint& a) {
    return x >= a.x;
  }
  bool operator==(const mint& a) {
    return x == a.x;
  }
  bool operator!=(const mint& a) {
    return x != a.x;
  }
};
ostream& operator<<(ostream& os, const mint& r) {
  os << r.x;
  return os;
}
ostream& operator>>(ostream& os, const mint& r) {
  os >> r.x;
  return os;
}


ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while(b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

ll combination(ll n, ll r){
  ll num = 1;
  for(int i = 1; i <= r; i++){
      num = num * (n - i + 1) % MOD;
      num = num * modinv(r - i + 1, MOD) % MOD;
  }
  return num;
}

void solve(istream& cin, ostream& cout) {
  int x, y;
  cin >> x >> y;
  if ((x + y) % 3 != 0) {
    cout << 0 << endl;
    return;
  }
  int n = (x + y) / 3;
  x -= n;
  y -= n;
  if (x < 0 || y < 0) {
    cout << 0 << endl;
    return;
  }
  mint ans = combination((x + y), x);
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


//#define int ll

class BBiteEating {
public:
    int N,L;
    int A[222];
void solve(std::istream& cin, std::ostream& cout) {
    cin >> N >> L;
    _for(i,N)A[i] = L + i;
   int sum = 0;
   int mi = 1e8,mii = 0;
    _for(i,N){
        sum += A[i];
        if(abs(A[i]) < mi)mi = abs(A[i]), mii = A[i];
    }
    cout << sum - mii << endl;

}
};


#undef int
int main() {
	BBiteEating solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(0); ios::sync_with_stdio(0); out<<fixed<<setprecision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
bool used[200005];
vector<ll> node[200005],cnt[200005];
const ll mod=1e9+7;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll res=pow(x,y/2);
  res*=res;
  res%=mod;
  if(y%2==1) res*=x;
  return res%mod;
}
ll gyaku(ll x){
  return pow(x,mod-2);
}
vector<ll> frac,gfrac,k2,gk2;
void set_frac(ll n){
  frac.push_back(1);
  gfrac.push_back(1);
  for(ll i=1;i<=n;i++){
    frac.push_back(frac[i-1]*i%mod);
    gfrac.push_back(gyaku(frac[i]));
  }
}
ll nCr(ll n,ll r){
  ll res=frac[n]*gfrac[r]%mod;
  res*=gfrac[n-r];
  return res%mod;
}
ll dp(ll pos,ll n){
  used[pos]=true;
  ll res=1;
  for(int i=0;i<node[pos].size();i++){
    ll to=node[pos][i];
    if(!used[to]){
      used[to]=true;
      ll dp_ans=dp(to,n);
      res+=dp_ans;
      cnt[pos].push_back(dp_ans);
      cnt[to].push_back(n-dp_ans);
    }
  }
  return res;
}
int main(){
  ll n;
  cin>>n;
  k2.push_back(1);
  for(int i=1;i<n+5;i++){
    k2.push_back(k2[i-1]*2%mod);
    used[i]=false;
  }
  for(int i=0;i<n+5;i++) gk2.push_back(gyaku(k2[i]));
  for(int i=1;i<n;i++){
    ll s,t;
    cin>>s>>t;
    node[s].push_back(t);
    node[t].push_back(s);
  }
  used[1]=true;
  dp(1,n);
  ll ans=0;
  for(int i=1;i<=n;i++){
    ll kans=mod+1-gk2[n-1];
    kans%=mod;

    for(int j=0;j<cnt[i].size();j++){
      ll kans2=mod+1-gk2[cnt[i][j]];
      kans2%=mod;

      kans2*=gk2[n-cnt[i][j]-1];
      kans2%=mod;
      kans+=mod;
      kans-=kans2;
      kans%=mod;
    }
    //cout<<i<<":"<<kans<<endl;
    ans+=kans*gk2[1];
    ans%=mod;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 39408
/*=============================================================================================================================/*
                                               Bismillahir Rahmanir Rahim

      _     ____  ___  ____   _   _  _         ___  ____   _         _     __  __
     / \   / ___||_ _|| __ ) | | | || |       |_ _|/ ___| | |       / \   |  \/  |
    / _ \  \___ \ | | |  _ \ | | | || |        | | \___ \ | |      / _ \  | |\/| |
   / ___ \  ___) || | | |_) || |_| || |___     | |  ___) || |___  / ___ \ | |  | |
  /_/   \_\|____/|___||____/  \___/ |_____|   |___||____/ |_____|/_/   \_\|_|  |_|

   _   __           __  __  __
  |_) (_  _  o__   /   (_  |_
  |_)o__)(_  || |  \__ __) |__

    ___                    _   _      _                _ _               __   ___                 _         _        _
   / __|_ _ ___ ___ _ _   | | | |_ _ (_)_ _____ _ _ __(_) |_ _  _   ___ / _| | _ ) __ _ _ _  __ _| |__ _ __| |___ __| |_
  | (_ | '_/ -_) -_) ' \  | |_| | ' \| \ V / -_) '_(_-< |  _| || | / _ \  _| | _ \/ _` | ' \/ _` | / _` / _` / -_|_-< ' \
   \___|_| \___\___|_||_|  \___/|_||_|_|\_/\___|_| /__/_|\__|\_, | \___/_|   |___/\__,_|_||_\__, |_\__,_\__,_\___/__/_||_|
                                                            |__/                           |___/


   FB: https://facebook.com/SIAsibul
   Gmail: asibulislam8@gmail.com

/*=============================================================================================================================*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vii;
typedef vector<pil> vil;
typedef vector<pli> vli;
typedef vector<pll> vll;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,n) for(int i=0;i<(n);i++)
#define f1(i,n) for(int i=1;i<=(n);i++)
#define f2(i,a,n) for(int i=(a);i<=(n);i++)
#define fr(i,n,a) for(int i=(n);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define nl "\n"


const int INF = 1e9 + 5;
const int MXN = 2e5 + 5;

int main(){
    int n; cin >> n;
    ll a[n];
    f0(i, n) cin >> a[i];
    sort(a, a+n, greater<ll>());
    ll t = 0, j = 0;
    f0(i, n-1){
        t += a[j];
        if(i%2 == 0) j++;
    }
    cout << t << nl;
    return 0;
}


Measured memory_bytes: 5188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int mod = 2019;

int main() {
  ll l, r;
  cin >> l >> r;
  ll m;
  if (l + mod <= r) {
    m = 0;
  } else {
    m = 4e18;
    for (ll i = l; i <= r; i++) {
      for (ll j = i + 1; j <= r; j++) {
        m = min(m, i * j % mod);
      }
    }
  }
  cout << m << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define inf 1000000000
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define meM(y,a) memset(y,a,sizeof y)
#define sC(a) scanf("%d",&a)
#define alL(a) a.begin(),a.end()
#define prinT(a,sz)  cout<<a[0];for(int i=1;i<sz;i++)cout<<" "<<a[i];cout<<endl
#define ranD srand(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int>pi;
typedef pair<ll,ll>pll;
//int fx[]={0,0,1,-1};
//int fy[]={1,-1,0,0};
//int gx[]={0,0,1,1,1,-1,-1,-1};
//int gy[]={1,-1,0,1,-1,0,1,-1};
const int N=100010;
int n;
int ara[]={3,5,7};
int dfs(ll num)
{
//    cout<<"num = "<<num<<endl;
    if(num>n)return 0;
    ll temp=num;
    int t=0,p=0,s=0;
    while(temp>0){
        int d=temp%10;
        temp/=10;
        if(d==3)t=1;
        else if(d==5)p=1;
        else if(d==7)s=1;
    }
    int res=0;
    if(t&p&s)res=1;
    for(int i=0;i<3;i++)
        res+=dfs(num*10+ara[i]);
    return res;
}
int main()
{
    IOS;
    cin>>n;
    cout<<dfs(0)<<endl;
}








Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define ull unsigned long long 
#define FF first
#define SS second
#define MOD 1000000007

using namespace std;

int gcd(int a, int b) {
  while (a > 0 && b > 0)
    if (a > b) a %= b;
    else b %= a;
  return a + b;
}

ll modpower(ll x, ll y, ll p) //x^y mod p
{
    ll res = 1;      // Initialize result
 
    x = x % p;  // Update x if it is more than or 
                // equal to p
 
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y %2!= 0)
            res = (res*x) % p;
 
        // y must be even now
        y = y/2;
        x = (x*x) % p;  
    }
    return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	vector<ll> v;
	v.pb(1);
	int n;
	cin>>n;	
	int k = 9;
	ll c = k;
	while(c<=n)
	{
		v.pb(c);
		c*=k;
	}
	k = 6;
	c = k;
	while(c<=n)
	{
		v.pb(c);
		c*=k;
	}
	sort(v.begin(),v.end());
	// ll arr[v.size()][2];
	// for(int j=0;j<=n;j++)
	// {
	// 	arr[0][j]=j;
	// }
	// for(int i=0;i<v.size();i++)
	// {
	// 	arr[i][0]=0;
	// }

	// for(int i=1;i<v.size();i++)
	// {
	// 	for(int j=1;j<=n;j++)
	// 	{
	// 		if(j-)
	// 		arr[i][j] = 1 + arr[i-1][j-]
	// 	}	
	// }
	//src: https://www.geeksforgeeks.org/find-minimum-number-of-coins-that-make-a-change/
	ll V = n;
	ll table[n+1];
    table[0] = 0;
 
    // Initialize all table values as Infinite
    for (int i=1; i<=V; i++)
        table[i] = INT_MAX;
 
    // Compute minimum coins required for all
    // values from 1 to V
    for (int i=1; i<=V; i++)
    {
        // Go through all coins smaller than i
        for (int j=0; j<v.size(); j++)
          if (v[j] <= i)
          {
              ll sub_res = table[i-v[j]];
              if (sub_res != INT_MAX && sub_res + 1 < table[i])
                  table[i] = sub_res + 1;
          }
    }
	cout<<table[V];

}


Measured memory_bytes: 1024
n = input()

a = n[0:2]
b = n[2:4]

a = int(a)
b = int(b)

if 0 < a <= 12 and 0 < b <= 12:
    print("AMBIGUOUS")

elif 0 < a <= 12 and (b > 12 or b == 0):
    print("MMYY")

elif 0 < b <= 12 and (a > 12 or a == 0):
    print("YYMM")

else:
    print("NA")


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

void solve(){

    int N, A, B;
    cin >> N >> A >> B;

    if ((abs(A-B) - 1) & 1) {
        cout << "Alice" << endl;
    }else{
        cout << "Borys" << endl;
    }

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

using namespace std;

template <typename T> void output(T, int);
int gcd(int a, int b);

ll solve(int n,int index,ll all){
    ll ret=0;
    ll p=1;
    while(index){
        ret+=n*p*all/2;

        all/=2;
        p*=10;
        index--;
    }

    ret+=n*p*all;
    
    return ret;
}

int main() {
    // source
    ll s;
    cin >>s;
    vector<int> num;
    while(s){
        int n=s%10;
        num.push_back(n);
        s-=n;
        s/=10;
    }

    ll ans=0;
    rep(i,num.size()){
        ans+=solve(num[i],i,pow(2,num.size()-1));
    }

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

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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


Measured memory_bytes: 512
# B
N = int(input())
s_list = list(input())
cnt_R = 0
cnt_B = 0
for s in s_list:
    if s == "R":
        cnt_R += 1
    else:
        cnt_B += 1
if cnt_R > cnt_B:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
from itertools import product
N=int(input())
F=[list(map(int, input().split())) for i in range(N)]
P=[list(map(int, input().split())) for i in range(N)]
l=list(product(range(2),repeat=10))
del l[0]
a=-10**9
for i in range(1023):
    t=0
    for j in range(N):
        c=0
        for k in range(10):
            c+=F[j][k] and l[i][k]
        t+=P[j][c]
    if t>a:
        a=t
print(a)

Measured memory_bytes: 42092
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <cstring>
#include <deque>
#include <set>
#include <sstream>
#include <map>
#include <iomanip>
using namespace std;

int p[26];

int main()
{
	long long ans = 1;
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
		p[s[i] - 'a']++;
	for (int i = 0; i < 26; i++)
		for (int j = i + 1; j < 26; j++)
			ans += 1LL*p[i] * p[j];
	cout << ans;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
long long a,b,c;
int main(){
	scanf("%lld %lld %lld",&a,&b,&c);
	if(a+b>=c){
		printf("%lld\n",b+c);
	}
	else{
		printf("%lld\n",a+2*b+1);
	}
	return 0;
}

Measured memory_bytes: 256
num_list = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000}
s_list = {'IV':4, 'IX':9, 'XL':40, 'XC':90, 'CD':400, 'CM':900}

while True:
	try:
		num = raw_input()
		ans = 0
		for n in s_list:
			if n in num:
				num = num.replace(n, '')
				ans += s_list[n]
		res = list(num)
		for n in res:
			ans += num_list[n]
		print ans
	except:
		break

Measured memory_bytes: 4228
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main(void) {
    int a, b;
    int n; scanf("%d", &n);
 
    a = 0, b = 0;
 
    while(n--) {
        int res;
        char s1[101];
        char s2[101];
        scanf(" %s", s1);
        scanf(" %s", s2);
 
        res = strcmp(s1, s2);
        if(res > 0) a += 3;
        else if(res < 0) b += 3;
        else a++, b++;
    }
 
    printf("%d %d\n", a, b);
 
    return EXIT_SUCCESS;
}


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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(long long i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const double EPS = 1e-9;
const ll powll = 1LL<<1;

int timeLimit = 1950;
/*
while(!frag && cin >> a >>b, a|b)
*/

int main(void){
    
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
    //d = 365
    int D; cin >> D;
    int N = 26;
    D++; N++;
    
    //しばらく特定のタイプのコンテストが開催されないと、満足度が下がってしまいます
    int c[N]; rep(i,1,N) cin >> c[i]; 
    
    //d日目にiタイプのコンテスト開催　＝＞　満足度 += s[d][i]
    int s[D][N];
    rep(d,1,D) rep(i,1,N) cin >> s[d][i];

    // タイプ i のコンテストを開催した最後の日
    int last[N] = {};

    int ans[D];

    //満足度の合計
    ll satisfaction = 0;
    rep(d,1,D){
        ll tmpSatisfaction = -1e15;
        int tmpAns = 1;

        rep(i,1,N){ // 日ごとに選ぶタイプの候補
            ll minus = 0;
            rep(j,1,N){
                if(i != j) minus += c[j]*(d-last[j]);
            }
            if(satisfaction + s[d][i] - minus > tmpSatisfaction){
                tmpAns = i;
                tmpSatisfaction = satisfaction + s[d][i] - minus;
            }
        }
        satisfaction = tmpSatisfaction;
        last[tmpAns] = d;
        ans[d] = tmpAns;
    }
    // cout << satisfaction << "\n";
    

    //満足度が　sum 1.to 26 ci * (d-last[i]) 低下する
    // つまり、個々のタイプに対しての和、満足度の下がりやすさ×空いた日数
    // 満足度の下がりやすさのほうが重みが大きい

    while(1){
        end = chrono::system_clock::now();
        int time = static_cast<int>(chrono::duration_cast<chrono::microseconds>(end - start).count()/1000);
        if(time > timeLimit){
            break;
        }
        
        //変えたい解
        int tryD = rand()%(D-1)+1;
        int tryI = rand()%(N-1)+1;

        //仮の場合の状態を作る
        int tryLast[N] = {};
        int tryAns[D]; rep(d,1,D) tryAns[d] = ans[d];
        tryAns[tryD] = tryI;

        ll trySatisfaction = 0;
        rep(d,1,D){
            trySatisfaction += s[d][tryAns[d]];
            tryLast[tryAns[d]] = d;
            rep(i,1,N){
                trySatisfaction -= c[i]*(d-tryLast[i]);
            }
        }

        
        if(trySatisfaction > satisfaction){
            satisfaction = trySatisfaction;
            ans[tryD] = tryI;
        }
        
    }

    // cout << satisfaction << "\n";

    rep(d,1,D){
        cout << ans[d] << "\n";
    }
}


Measured memory_bytes: 3712