akhauriyash/Code-Regression huggingface dataset:
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var s = nextCharArray();
  var output = 0;
  for(var i = 0; i < 1000; i++){
    var check = ("000" + i).slice(-3);
    var first = false;
    var second = false;
    var third = false;
    for(var j = 0; j < N; j++){

      if(!first && check[0] == s[j]){
        first = true;
        continue;
      }
      if(first && !second && check[1] == s[j]){
        second = true;
        continue;
      }
      if(first && second && check[2] == s[j]){
        output++;
        break;
      }
    }
  }
  myout(output);
}


Measured memory_bytes: 34780
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	int n, t = 1;
	cin >> n;
	while (t * 2 <= n)
		t *= 2;
	cout << t << endl;

	return 0;
}

Measured memory_bytes: 256
s=input()
n=len(s)
a=-1
b=-1
for i in range(n-1):
    if s[i+1]==s[i]:
        a=i+1
        b=i+2
        break

for i in range(n-2):
    if s[i+2]==s[i]:
        a=i+1
        b=i+3
        break
print(a,b)

Measured memory_bytes: 3188
import Control.Applicative
import Control.Monad

cal :: [String] -> Int
cal (a:(op:(b:_)))
	| op == "+" = read a + read b
	| op == "-" = read a - read b
	| op == "*" = read a * read b
	| op == "/" = read a `div` read b

main = do
	ss <- (map words . lines) <$> getContents
	mapM putStrLn  $ map show $ map cal $ takeWhile (\(_:(op:_)) -> op /= "?") ss

Measured memory_bytes: 4080
using System;

namespace AOJ.Volume5
{
    public class JOIAndIOI
    {
        public static int Main()
        {
            while (true)
            {
                string input = Console.ReadLine();
                if (string.IsNullOrEmpty(input)) { break; }
                int len = input.Length;
                int joi = 0;
                int ioi = 0;
                string tmp;
                for(int i = 0; i < len - 2; i++)
                {
                    tmp = input.Substring(i, 3);
                    if(tmp == "JOI") { joi++; }
                    else if(tmp == "IOI") { ioi++; }
                }
                Console.WriteLine(joi);
                Console.WriteLine(ioi);
            }
            return 0;
        }
    }
}

Measured memory_bytes: 9180
from math import sqrt 

def count_divisor(n):
  count = 0
  for d in range(1, int(sqrt(n+1))):
    if n%d == 0:
      count+=1  
  return count*2      

n = int(input())
count = 0
for i in range(1,n+1,2):
  if count_divisor(i)==8:
    count+=1
print(count)    

Measured memory_bytes: 3060
import java.io.*;
import java.util.*;
public class Main {
    static long mod;
    static long modpow(int a,int b){
        if(b == 0)return 1;
        long temp = modpow(a,b/2);
        temp = temp*1L*temp % mod;
        if((b & 1) == 1)
            temp = temp*a % mod;
        return temp;
    }
    public static void main(String[] args)throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine());
        int array[] = new int[n + 1];
        mod = (long)1E9 + 7;
        int cnt[] = new int[n];
        for(int i = 1;i <= n;i++) {
            array[i] = Integer.parseInt(st.nextToken());
            cnt[array[i]]++;
        }
        if((n & 1) == 1){
            for(int i = 2;i < array.length;i+=2){
                if(cnt[i] != 2 || cnt[0] != 1){
                    System.out.println("0");
                    return;
                }
            }
            long ways = modpow(2,n/2);
            System.out.println(ways);
        }
        if((n & 1) == 0){
            //System.out.println((n & 1) == 0);
            for(int i = 1;i < array.length;i+=2){
                if(cnt[i] != 2){
                    System.out.print("0");
                    return;
                }
            }
            long ways = modpow(2,n/2);
            System.out.print(ways);
        }
    }
    }

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

struct node{
    unsigned int key;
    struct node *next;
    struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
    NodePointer ser = nil->next;
    while (ser != nil && ser->key != key) {
       ser = ser->next;
    }
    return ser;
}

void init(){
    nil = malloc(sizeof(struct node));
    nil->next = nil;
    nil->prev = nil;
}

void printList(){
    NodePointer cur = nil->next;
    int isf = 1;
    while(1){
        if ( cur == nil ) break;
        if ( isf == 0)  printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
        isf = 0;
    }
    printf("\n");
}

void deleteNode(NodePointer kesu){
    if(kesu == nil) {
        return;
    }
    (kesu->prev) -> next = (kesu->next);
    (kesu->next) -> prev = (kesu->prev);
    free(kesu);
}

void deleteFirst(){
    deleteNode(nil->next);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void delete(int key){
    deleteNode(listSearch(key));
}


void insert(int key){
    NodePointer x;
    x = malloc(sizeof(struct node));
    x->key = key;
    x->next = nil->next;
    (nil->next)->prev = x;
    nil->next = x;
    x->prev = nil;
}

int main(){
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for ( i = 0; i < n; i++ ){
        scanf("%s%d", com, &key);
        if ( com[0] == 'i' ) {
            insert(key);
            np++;
            size++;
        }
        else if ( com[0] == 'd' ) {
            if (strlen(com) > 6){
                if ( com[6] == 'F' ) deleteFirst();
                else if ( com[6] == 'L' ) deleteLast();
            } else {
                delete(key); nd++;
            }
            size--;
        }
    }
    printList();
    return 0;
}


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

using namespace std;
using ll=long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (n); i < (a); i++)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;cin>>n;
  vector<int> hoge(n),huga,list;
  rep(i,n) cin>>hoge[i];
  int k=0;
  rep(i,n)if(hoge[i]!=i+1)k++;
  cout<<(k<=2?"YES":"NO")<<endl;
}


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] p = new int[n];
        int ans = 0;

        for(int i=0;i<n;i++) {
        	p[i] = sc.nextInt();
        }
        Arrays.sort(p);

        for(int i=0;i<k;i++) {
        	ans += p[i];
        }
        System.out.println(ans);


    }
}

Measured memory_bytes: 38760
h,w=map(int,input().split())
board=[""]*h
for i in range(h):
    board[i]=input()
boolx=[0]*h
booly=[0]*w
for i in range(h):
    for j in range(w):
        if board[i][j]=="#":
            boolx[i]=1
            booly[j]=1
for i in range(h):
    if boolx[i]:
        for j in range(w):
            if booly[j]:
                print(board[i][j],end="")
        print()


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

using namespace std;
typedef long long ll;
typedef pair<int ,int> P;

vector<vector<ll> > b(4, vector<ll>(1, 0));

bool comp(const P& a, const P& b) {
  if (a.first == b.first) return a.second > b.second;
  return a.first < b.first;
}

ll calc(int c[4]) {
  ll res = 0;
  for (int i = 0; i < 4; i++) {
    if (c[i] >= b[i].size()) c[i] = b[i].size() - 1;
    for (int j = 1; j <= c[i]; j++) {
      res += b[i][j];
    }
  }
  return res;
}

int main(void) {
  int n, W;
  cin >> n >> W;

  vector<P> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a.begin(), a.end(), comp);

  ll w0 = a[0].first;
  for (int i = 0; i < n; i++) {
    b[a[i].first - w0].push_back(a[i].second);
  }

  ll ans = 0;
  for (ll i = 0; i < b[0].size(); i++) {
    for (ll j = 0; j < b[1].size(); j++) {
      for (ll k = 0; k < b[2].size(); k++) {
        ll sumw = i * w0 + j * (w0 + 1) + k * (w0 + 2);
        if (sumw > W) continue;
        int c[4] = {i, j, k, (W - sumw) / (w0 + 3)};
        ans = max(ans, calc(c));
      }
    }
  }
  cout << ans << endl;

  return 0;
}

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

int main(){

  string S,T;
  
  cin >> S;
  cin >> T;
  
  if(1 <= S.size() && S.size() <= 10)
    if(T.compare(0,S.size(),S) == 0 && S.size()+1 == T.size())
      cout << "Yes" << endl;
  	else
      cout << "No" << endl;
  else
    cout << "No" << endl;
  

}

Measured memory_bytes: 3624
def func(x):
    n = x
    cnt = 0
    while n % 2 == 0:
        n = n // 2
        cnt += 1
    return cnt


def main():
    n = int(input())
    l = [int(i) for i in input().split()]

    l2 = [func(i) for i in l]
    print(min(l2))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
using System;
using System.Linq;
using static System.Console;

class class_A
{
    static int calc(int n)
    {
        var result = 0;
        while (n != 0)
        {
            result += n % 10;
            n /= 10;
        }
        return result;
    }

    static void Main()
    {
        var tmp = ReadLine().Split(' ').Select(int.Parse).ToArray();
        var N = tmp[0];
        var A = tmp[1];
        var B = tmp[2];

        var ans = 0;

        for (var n = 0; n <= N; n++)
        {
            var calc_n = calc(n);
            if (A <= calc_n && calc_n <= B)
            {
                ans += n;
            }
        }
        WriteLine(ans);
    }
}


Measured memory_bytes: 13396
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Map<String, Integer> map = new HashMap<>();
        for(int i = 0; i < N; i++){
            String tmp = sc.next();
            if(map.containsKey(tmp)){
                map.put(tmp, map.get(tmp) + 1);
            }else{
                map.put(tmp, 1);
            }
        }
        int M = sc.nextInt();
        for(int i = 0; i < M; i++){
            String tmp = sc.next();
            if(map.containsKey(tmp)){
                map.put(tmp, map.get(tmp) - 1);
            }
        }
        int ans = 0;
        for(Integer num : map.values()){
            ans = Math.max(ans, num);
        }
        System.out.println(ans);
    }
}

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

int main() {
	int x1, x2, x3, x4,x5;
  	cin >> x1 >> x2 >> x3 >> x4 >> x5;
  	int result;
  	if(!x1) result =1;
  	else if (!x2) result=2;
  	else if(!x3) result =3;
  	else if(!x4) result =4;
  	else result = 5;
  	cout << result << endl;
  	return 0;
}



Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
const std::string yes = "Yes";
const std::string no  = "No";


template<long long mod> struct modint {
    long long x;
    modint(long long x=0) : x((x%mod+mod)%mod) {}
    static int get_mod() { return mod; }
    modint &operator+=(const modint &a) {
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    modint &operator-=(const modint &a) {
        if((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    modint &operator*=(const modint &a) {
        x = (int) (1LL * x * a.x % mod);
        return *this;
    }
    modint &operator/=(const modint &a) {
        *this *= a.inv();
        return *this;
    }
    modint operator-() const { return modint(-x); }
    modint operator+(const modint &a) const { return modint(*this) += a; }
    modint operator-(const modint &a) const { return modint(*this) -= a; }
    modint operator*(const modint &a) const { return modint(*this) *= a; }
    modint operator/(const modint &a) const { return modint(*this) /= a; }
    bool operator==(const modint &a) const { return x == a.x; }
    bool operator!=(const modint &a) const { return x != a.x; }
    modint pow(long long t) const {
        if (!t) return 1;
        modint<mod> a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    modint inv() const {
        return pow(mod-2);
    }
    friend std::ostream &operator<<(std::ostream &os, const modint &a) { return os << a.x; }
    friend std::istream &operator>>(std::istream &is, modint &a) {
        long long t;
        is >> t;
        a = modint<mod>(t);
        return (is);
    }
};
//const long long mod = 998244353;
const long long mod = 1000000007;
using mint = modint<mod>;

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 (a>b) { a=b; return 1; } return 0; }

std::vector<mint> solve(int d){
    std::vector<mint> memo(d+3,0);
    memo[0] = 0;
    memo[1] = 1;
    for(int i=0; i<d+1; i++){
        memo[i+2] = memo[i+1] + memo[i];
    }
    return memo;
}

int main(){
    int n,m;
    std::cin >> n >> m;
    std::vector<int> a(n),v(n+1,1);
    rep(i,m){
        std::cin >> a[i];
        v[a[i]] = 0;
    }

    std::vector<mint> memo(n+3,0);
    memo[0] = 1;
    for(int now=0; now<n; now++){
        for(int next=now+1; next<=std::min(n,now+2); next++){
            if(v[next]){
                memo[next] += memo[now];
            }
        }
    }

    std::cout << memo[n] << "\n";
    return 0;
}


Measured memory_bytes: 4732
#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
  
#define DIV 1000000007
typedef vector<ll> Array;
typedef vector<Array> matrix;
typedef tuple<int,int,int> tiii;
#define mt make_tuple

int main(){
  string s; cin >> s;
  
  cout << s.substr(0,4) << " " << s.substr(4)<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.000001
#define pi 3.141592653589793
#define pii pair<int , int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti set <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(20)//use fixed before stp
#define endl '\n'
int main()
{  
    FAST
    ll n,w;
    cin>>n>>w;
    pll p[n];
    for(ll i=0;i<n;i++)
    {
        cin>>p[i].ff>>p[i].ss;
    }
    ll dp[100001];
    for(ll i=1;i<=100000;i++)
    {
        dp[i]=inf;
    }
    dp[0]=0;
    for(ll i=0;i<n;i++)
    {
        for(ll j=(100000-p[i].ss);j>=0;j--)
        {
            if((dp[j]+p[i].ff)<dp[j+p[i].ss])
            {
                dp[j+p[i].ss]=(dp[j]+p[i].ff);
            }
        }
    }
    ll ans=0;
    for(ll i=100000;i>0;i--)
    {
        if(dp[i]<=w)
        { 
           ans=i;
           break;
       }
    }
    cout<<ans;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};

using ll = long long;
using namespace std;
using P = pair<int,int>;
ll mod=1e9+7;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

int main(){
  string s;
  cin>>s;
  if (s[0] == s[2]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

typedef long long ll;
typedef pair<int,int> pint;
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) 
#define repi(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,v.size()) {cin >> v[i];}
//最終奥義
//#define int 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 gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());
signed main(void){
  string s;cin >> s;
  if(s=="Sunny")
    cout << "Cloudy" << endl;
  else if(s=="Rainy")
    cout << "Sunny" << endl;
  else cout << "Rainy" << endl;

}


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



char s[1000003];

int main(){
	int m,n;
	int i,c,r;

	while(true){

		scanf("%d",&n);
		if(n==0) break;

		scanf("%d",&m);
		scanf("%s",s);
		s[m]='O';
		s[m+1]='O';
		n--;
		r=0;
		for(i=0;i<m;i++){
			if(s[i]=='I'){
				c=0;
				while(true){
					i++;
					if(s[i]!='O'){
						if(c>n)r+=c-n;
						i--;
						break;
						}
					i++;
					if(s[i]!='I'){
						if(c>n)r+=c-n;
						i-=2;
						break;
						}
					c++;
					}
				}
			}
		printf("%d\n",r);
	}

	//scanf("%s",s);
	}
	

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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 100000000000000;
double PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    int N,A;cin >> N >> A;
    vector<int> X(N);
    for(int i = 0;i < N;i++){
        cin >> X[i];
    }
    vector<vector<vector<ll>>> dp(N+1,vector<vector<ll>>((N+1),vector<ll>(2510)));
    for(int i = 0;i < N;i++){
        dp[i][0][0] = 1;
    }
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N;j++){
            for(int k = 0;k < 2510;k++){
                if(k >= X[i]){
                    dp[i+1][j+1][k] += dp[i][j+1][k] + dp[i][j][k-X[i]];
                }else{
                    dp[i+1][j+1][k] += dp[i][j+1][k];
                }
            }
        }
    }
    /*for(int i = 1;i <= N;i++){
        for(int j = 0;j < 40;j++){
            cout << dp[N][i][j] << ' ';
        }
        cout << endl;
    }*/
    ll ans = 0;
    for(int i = 1;i <= N;i++){
        for(int j = 1;j < 2510;j++){
            if(j % i == 0 && j / i == A){
                ans += dp[N][i][j];
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 52352
#include<bits/stdc++.h>
using namespace std;
#define LEN 100005

class Process {
    public:
        string name;
        int time;
        Process(){};
        Process(string s, int t){
            name = s;
            time = t;
        };
};

Process Q[LEN + 1];
int n, head, tail;

void enqueue (Process x, Process Q[LEN + 1]){
    Q[tail] = x;
    tail++;
    if(tail == LEN) tail = 0;
}

Process dequeue(Process Q[LEN + 1]){
    Process tmp = Q[head];
    head++;
    if(head == LEN) head = 0;
    return tmp;
}

int main(){
    int q; cin >> n >> q;
    int total_time = 0;
    head =0, tail = n;
    string tmps;
    int tmpi;
    for(int i = 0; i < n; ++i){
        cin >> Q[i].name >> Q[i].time;
    }
    while(n){
        if(Q[head].time <= q){
            total_time += Q[head].time;
            cout << Q[head].name << " " << total_time << endl;
            dequeue(Q);
            n--;
        } else {
            total_time += q;
            Q[head].time -= q;
            enqueue(Q[head], Q);
            dequeue(Q);
        }
    }
    
    
    return 0;
}


Measured memory_bytes: 7120
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long 
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
//#include "debug.cpp"


int32_t main() 
{ 
    boost;
    int n,a,b;
    cin>>n>>a>>b;
    if(a==0){
        cout<<0<<endl;
        return 0;
    }
    int k=n/(a+b);
    n%=(a+b);
    int ans=k*a+min(n,a);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    set<string> S;
    if(N == 1) {
        cout << 1 << endl;
        cout << 0 << endl;
    } else if(N == 2) {
        cout << 2 << endl;
        cout << 0 << endl;
        cout << 11 << endl;
    } else {
        cout << N - 1 << endl;
        cout << 11 << endl;
        string s = "1";
        rep(i, N - 2) {
            s = s + '0';
            cout << s + '1' << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3204
program atcoder_contest_scheduling
  implicit none
  integer :: d, c(26) = 0, s(26, 365) = 0, t(365) = 0, u(365)
  integer :: m, n, x = 0, p, q, i
  real(8) :: t1, t2
  call cpu_time(t1)
  call random_seed_clock()
  read(*,*) d
  read(*,*) c
  read(*,*) (s(:, i), i = 1, d)
  t = [(maxloc(s(:, i), 1), i = 1, d)]
  do i = 1, d
    x = x + s(t(i), i)
  end do
  m = score(x, 1)
  u = t
  do
    p = next_int(365)
    q = next_int(26)
    t(p) = q
    n = score(x - s(u(p), p) + s(q, p), p)
    if (m < n) then
      x = x - s(u(p), p) + s(q, p)
      m = n
      u(p) = q
    else
      t(p) = u(p)
    end if
    call cpu_time(t2)
    if (t2 - t1 > 1.975d0) exit
  end do
  write(*,'(i0)') (u(i), i = 1, d)
contains
  integer function score(x, p) result(res)
    integer, intent(in) :: x, p
    integer, save :: mem(0:365) = 0, diff(26, 0:365) = 0
    integer :: i
    do i = p, d
      diff(:, i) = diff(:, i - 1) + c
      diff(t(i), i) = 0
      mem(i) = mem(i - 1) - sum(diff(:, i))
    end do
    res = x + mem(d)
  end
  subroutine random_seed_clock()
    integer :: nseed, clock
    integer, allocatable :: seed(:)
    call system_clock(clock)
    call random_seed(size = nseed)
    allocate(seed(nseed))
    seed = clock
    call random_seed(put = seed)
    deallocate(seed)
  end
  integer function next_int(m) result(res)
    integer, intent(in)  :: m
    real(8) :: r
    call random_number(r)
    res = int(m * r) + 1
  end
end program atcoder_contest_scheduling

Measured memory_bytes: 3068
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        a: [usize;n]
    }

    let mut child: Vec<(i64, i64)> = Vec::new();
    for i in 0..n {
        child.push((a[i] as i64, i as i64 + 1));
    }

    child.sort();
    child.reverse();

    let mut ans = 0;
    let mut dp: Vec<Vec<i64>> = vec![vec![-9_999_999_999; n + 1]; n + 1];

    dp[1][0] = child[0].0 * (child[0].1 - 1);
    dp[0][1] = child[0].0 * (n as i64 - child[0].1);

    for i in 2..n + 1 {
        for x in 0..i + 1 {
            let y = i - x;

            let head = if x >= 1 {
                dp[x - 1][y] + child[i - 1].0 * (child[i - 1].1 - x as i64)
            } else {
                0
            };
            let tail = if y >= 1 {
                dp[x][y - 1] + child[i - 1].0 * ((n as i64 + 1 - y as i64) - child[i - 1].1)
            } else {
                0
            };
            dp[x][y] = cmp::max(head, tail);
            //println!("{} {} {} {}", x, y, dp[x][y], child[i - 1].0);
            ans = cmp::max(dp[x][y], ans);
        }
    }

    println!("{}", ans);
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 33632
import sys,heapq

def cmb(n, r, mod):#コンビネーションの高速計算　
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


input=sys.stdin.readline

N=int(input())
hen={i:[] for i in range(1,N+1)}
for i in range(0,N-1):
    a,b=map(int,input().split())
    hen[a].append(b)
    hen[b].append(a)

parent={i:-1 for i in range(1,N+1)}
parent[1]=0
q=[]
q.append(1)
heapq.heapify(q)
sub=[]
heapq.heapify(sub)
while q!=[]:
    while q!=[]:
        x=heapq.heappop(q)
        for p in hen[x]:
            if parent[p]==-1:
                parent[p]=x
                heapq.heappush(sub,p)
        #何らかの操作
        #ここでsubキューに次に使うものを格納
        if q==[]:
            q=sub
            sub=[]
            heapq.heapify(sub)
            break

ans={i:1 for i in range(1,N+1)}
subtreesize={i:1 for i in range(1,N+1)}
flag={i:0 for i in range(0,N+1)}
q=[]
for i in range(1,N+1):
    if i!=1 and len(hen[i])==1:
        q.append(i)

heapq.heapify(q)
sub=[]
heapq.heapify(sub)
while q!=[]:
    while q!=[]:
        x=heapq.heappop(q)
        p=parent[x]
        if p!=1:
            ans[p]=(ans[p]*ans[x]*g2[subtreesize[x]])%mod
            subtreesize[p]+=subtreesize[x]
            flag[p]+=1
            if flag[p]==len(hen[p])-1:
                ans[p]=(ans[p]*g1[subtreesize[p]-1])%mod
                heapq.heappush(sub,p)
        else:
            subtreesize[1]+=subtreesize[x]
            ans[1]=(ans[1]*ans[x]*g2[subtreesize[x]])%mod
            flag[1]+=1
            if flag[1]==len(hen[1]):
                ans[1]=(ans[1]*g1[subtreesize[1]-1])%mod
        #何らかの操作
        #ここでsubキューに次に使うものを格納
        if q==[]:
            q=sub
            sub=[]
            heapq.heapify(sub)
            break

q=[1]
flag2={i:0 for i in range(1,N+1)}
flag2[1]=1
heapq.heapify(q)
sub=[]
heapq.heapify(sub)
while q!=[]:
    while q!=[]:
        x=heapq.heappop(q)
        for p in hen[x]:
            if flag2[p]==0:
                if len(hen[p])!=1:
                    ans[p]=(ans[x]*pow(N-subtreesize[p],mod-2,mod)*g1[subtreesize[p]]*g2[subtreesize[p]-1])%mod
                    flag2[p]=1
                    heapq.heappush(sub,p)
                else:
                    ans[p]=(ans[x]*pow(N-1,mod-2,mod))%mod

        #何らかの操作
        #ここでsubキューに次に使うものを格納
        if q==[]:
            q=sub
            sub=[]
            heapq.heapify(sub)
            break

for i in range(1,N+1):
    print(ans[i])

Measured memory_bytes: 178864
def main():
    S = input()
    count = 1
    if 'R' in S:
        for i in range(len(S)-1):
            if S[i] == S[i+1] == 'R':
                count += 1
        print(count)

    else:
        print(0)


if __name__ == '__main__':
    main()

Measured memory_bytes: 8956
//
// Created by kuroneko on 2019-07-06.
//

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>

typedef long long ll;
using namespace std;


int d[100000];
int N;

struct edge {
    int to;
    int cost;
};

void dfs(int node, const vector<vector<edge>>& v, int p_color) {
    d[node] = p_color;
    for (int i = 0; i < v[node].size(); i++) {
        int next_node = v[node][i].to;
        if (d[next_node] == -1) {
            int color = p_color;
            if (v[node][i].cost % 2 == 1) color = 1 - color;
            dfs(next_node, v, color);
        }
    }
}

int main() {
    cin >> N;
    vector<vector<edge> > tree(N);
    for (int i = 0; i < N; i++) d[i] = -1;
    for (int i = 0; i < N-1; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        edge e = {v-1, w};
        edge re = {u-1, w};
        tree[u-1].emplace_back(e);
        tree[v-1].emplace_back(re);
    }

    dfs(0, tree, 0);

    for (int i = 0; i < N; i++) {
        cout << d[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 8192
class Queue():
    def __init__(self):
        self.data = []
        self.idx = 0
        self.size = 0

    def get(self):
        self.idx += 1
        self.size -= 1
        return self.data[self.idx-1]

    def put(self, item):
        self.size += 1
        self.data.append(item)

    def qsize(self):
        return self.size

        # input
H, W = map(int, input().split())
A = [list(input()) for i in range(H)]

# bfs
bfs = [[-1 for j in range(W)] for i in range(H)]
que = Queue()
for i in range(H):
    for j in range(W):
        if(A[i][j] == '#'):
            que.put((i, j))
            bfs[i][j] = 0
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]

while(que.qsize()):
    p = que.get()
    for i in range(4):
        if(0 <= p[0]+dx[i] < H and 0 <= p[1]+dy[i] < W):
            if(bfs[p[0]+dx[i]][p[1]+dy[i]] == -1):
                que.put((p[0]+dx[i], p[1]+dy[i]))
                bfs[p[0]+dx[i]][p[1]+dy[i]] = bfs[p[0]][p[1]] + 1

# print ans
print(max([max(l) for l in bfs]))


Measured memory_bytes: 149736
#include<iostream>
using namespace std;
int main()
{
	int a[11]={0};
	long long int n,b;
	int sum;
	int i=0;
	cin>>n;
	b=n;
	while(n)
	{
	
		a[i]=n%10;
		n=n/10;
		i++;	

	}
	for(int i=0;i<11;i++)
		sum=sum+a[i];
		if(b%sum==0)
	{
		cout<<"Yes"<<endl;	}
		else
	{
		cout<<"No"<<endl;}
	return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  double ret;
  for (int i=1; i<=N; i++) {
    int d = i;
    int cnt = 0;
    while (d < K) {
      d *= 2;
      cnt++;
    }
    ret += pow(2.0, -cnt);
  }
  ret /= N;
  printf("%.12f\n", ret);
}

Measured memory_bytes: 512
num = [int(n) for n in input().split(" ")]
A, B, M = num[0], num[1], num[2]

a = [int(n) for n in input().split(" ")]
b = [int(n) for n in input().split(" ")]

data = []
for i in range(M):
    data.append([int(n) for n in input().split(" ")])


temp_min = min(a) + min(b)

for d in data:
    total = a[d[0]-1] + b[d[1]-1] - d[2]
    if temp_min > total:
        temp_min = total

print(temp_min)




Measured memory_bytes: 32496
// In the name of ALLAH
#include <bits/stdc++.h>
using namespace std;

#define PB push_back
#define PF push_front
#define MP make_pair
#define FF first
#define SS second
#define _sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;

int const N = 100 + 20;
int a, b, c;
bool mark[N];

int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> a >> b >> c;
	mark[a] = mark[b] = mark[c] = 1;
	
	int cnt = 0;
	for (int i = 0; i < N; i ++) cnt += mark[i];

	cout << cnt << '\n';
}


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

template<typename T_char>
T_char ToUpper(T_char cX){return toupper(cX);}

int main(){
  int x[5];
  int num=0, sum = 0;
  for(int i=0; i<5; ++i) cin >> x[i];

  for(int i=0; i<5; ++i){
    if((10-(x[i]%10))>num){
      if(x[i]%10==0) continue;
      num = max(num, (10-(x[i]%10)));
    }
  }

  for(int i=0; i<5; ++i){
    if(x[i]%10==0) sum += x[i];
    else sum+= x[i] + (10-(x[i]%10));
  }

  cout << sum - num;
  return 0;
}

Measured memory_bytes: 3628
import collections

N = 3
SRR = [
    "cbaa",
    "daacc",
    "acacac"
]

N = 3
SRR = [
    "a",
    "aa",
    "b",
]

N = 3
SRR = [
    "addc",
    "dda",
    "da",
]

N = int(input())
SRR = []

for i in range(N):
    SRR.append(input())

def calculate(n, srr):
    # res = {"a": 0, "b": 0, "c": 0, "d": 0, "e": 0, "f": 0, "g": 0, "h": 0, "i": 0, "j": 0, "k": 0, "l": 0, "m": 0,
    #        "n": 0, "o": 0, "p": 0, "q": 0, "r": 0, "s": 0, "t": 0, "u": 0, "v": 0, "w": 0, "x": 0, "y": 0, "z": 0}

    # for l in srr[0]:
    #     res.add(l)

    res = collections.Counter(srr[0])


    for sr in srr:
        sr = collections.Counter(sr)
        res = sr & res

    # print(res)
    result = ""
    for key in sorted(res.keys()):
        result += key * res.get(key)

    print(result)

calculate(N, SRR)


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const int MAX_N = 999999;
bool p[MAX_N+1];
int sum[MAX_N+1];

void make_prime (void )
{
	fill (p, p+MAX_N+1, true );
	memset (sum, 0, sizeof (sum ) );
	p[0] = false;
	p[1] = false;
	for (int i = 2; i <= MAX_N; i++ ){
		if (p[i] ){
			for (int j = 2*i; j <= MAX_N; j += i ){
				p[j] = false;
			} // end for
		} // end if
	} // end for

	for (int i = 1; i <= MAX_N; i++ ){
		sum[i] = sum[i-1] + (p[i] ? 1 : 0 );
	} // end for
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.PN", "r", stdin );
	make_prime ();

	string str = "";
	while (getline (cin, str ) ){
		stringstream ss (str );
		int n;
		ss >> n;
		printf ("%d\n", sum[n] );
	} // end while

	return 0;
}

Measured memory_bytes: 6128
#include <stdio.h>
int main(void){
  char s[16]={"CODEFESTIVAL2016"};
  char t[16];
  int count=0;
  scanf("%s",t);
  for(int i=0;i<16;i++){
    if(s[i]!=t[i]) count++;
  }
  printf("%d",count);
  return 0;
}

Measured memory_bytes: 128
#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;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long 
#define int ll
//#define slld(t) scanf("%lld",&t)
// #define sd(t) scanf("%d",&t)
// #define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define pdd pair<double , double>
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N    105
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcountll
#define PI acos(-1)
#define s3   1.73205080757          // square root 3
const  int inf = (int)1e18+10 ;
const int MAX= 100;

 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set S;

int powmod(int x , int y){
	int res = 1;
	while(y > 0){
		if(y%2==1)
			res = (res*x)%mod;
		x = (x*x)%mod;
		y/=2;
	}
	return res;
}
int mul(int x , int y){
	return (x*y)%mod;
}



signed main(){
  fast;
  
 
	 int n,  x , d;
	 cin >> n >> x >> d;
	 if(d == 0){
	 	    if(x  == 0)
	 	    	cout << 1 << endl;
	 	    else
	 	    	cout << n + 1 << endl;
	 	    return 0;
	 }
	 if(d < 0) x = -x , d = -d;
	 int mn  = 0 , mx = 0 , l , r;
	 map<int , set<pii> > m;
	 for(int i = 0 ; i <= n ; i++){
	 	     int val = i*x;
	 	     int c = val/d;
	 	     int rem = val%d;
	 	     mn = i*(i-1)/2;
	 	     mx = (n-1)*i - mn;
	 	     m[rem].insert({mn + c , mx + c});
	 }
	 int ans = 0;
	 for(auto &it : m){
          r = -1e+18;
          for(auto k : it.second){
          	     if(r  < k.ff)
          	     	r = k.ff - 1;
          	     ans += max(0ll , k.ss - r);
          	     r = max(r , k.ss);
               
               
          }
	 }
	 cout << ans << endl;

 



 }

Measured memory_bytes: 31488
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
	long long a, b, c, d;
	cin >> a >> b >> c >> d;

	long long max1, max2;

	max1 = max(a*c, b*c);
	max2 = max(a*d, b*d);

	cout << max(max1, max2) << endl;


	return (0);
}


Measured memory_bytes: 3192
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;

constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define ALL(x)    (x).begin(),(x).end()
#define UNIQ(c)   (c).erase(unique(ALL((c))), end((c)))
#define mp        make_pair
#define eb        emplace_back
#define REP(i, a) for (int i = 0; i < (a); i++)

int d[100];

int main() {
	int n;
	cin >> n;
	vector<int>time(13);
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	for (int i = 0; i < n; i++) {
		time[d[i]]++;
		if (time[d[i]]==3) {
			cout << 0 << endl;
			return 0;
		}
	}
	if (time[0]>=1) {
		cout << 0 << endl;
		return 0;
	}
	if (time[12] == 2) {
		cout << 0 << endl;
		return 0;
	}
	if (n > 13) {
		cout << 1 << endl;
		return 0;
	}
	int ans = 0;
	for (int i = 0; i < (1 << n); i++) {
		vector<int>v;
		v.emplace_back(0);
		for (int j = 0; j < n; j++) {
			if (i >> j & 1) {
				v.emplace_back(d[j]);
			}
			else {
				v.emplace_back(-d[j]);
			}
		}
		sort(ALL(v));
		int num = INF;
		for (int j = 0; j < n; j++) {
			num = min(num, v[j + 1] - v[j]);
		}
		num = min(num, v[0] + 24 - v[n]);
		ans = max(ans, num);
	}
	cout << ans << endl;
	
}

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

int main() {
  string s = "abcdefghijklmnopqrstuvwxyz";
  string a;
  cin >> a;
  for(int i = 0;i < a.size();i++){
    for(int j = 0;j < s.size();j++){
      if(a.at(i) == s.at(j)){
        s.at(j) = '0';
        break;
      }
    }
  }
  for(int i = 0;i < s.size();i++){
    if(s.at(i) != '0'){
      cout << s.at(i) << endl;
      return 0;
    }
    else if(i == s.size()-1){
      cout << "None" << endl;
    }
  }
}


Measured memory_bytes: 512
a=[0,0,0]
b=[0,0,0]
c=[0,0,0]
a[0],a[1],a[2]=map(int,input().split())
b[0],b[1],b[2]=map(int,input().split())
c[0],c[1],c[2]=map(int,input().split())
flag=0
flag_2=0
if((a[0]-b[0])==(a[1]-b[1])) and ((a[0]-b[0])==(a[2]-b[2])):
  if((a[0]-c[0])==(a[1]-c[1])) and ((a[0]-c[0])==(a[2]-c[2])):
    flag=1
if((a[1]-a[0])==(b[1]-b[0])) and ((a[2]-a[0])==(b[2]-b[0])):
  if((a[1]-a[0])==(c[1]-c[0])) and ((a[2]-a[0])==(c[2]-c[0])):
    flag_2=1
if flag==1 and flag_2==1:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios()                \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1LL << 60;
constexpr int Inf = 1e9;
inline int in()
{
	int x;
	cin >> x;
	return x;
}
template <typename T>
inline void out(const T &x) { cout << x << endl; }
template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
	if (a < b)
		gcd(b, a);
	int r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}
void eratos(bool *isPrime, int max)
{
	fill(isPrime, isPrime + max, true);
	isPrime[0] = false;
	isPrime[1] = false;
	for (int i = 2; i <= max / i; ++i)
		if (isPrime[i])
			for (int j = 2; j <= max / i; ++j)
				isPrime[i * j] = false;
}
//

vector<int> divisor(int n)
{
	vector<int> ret;
	for (int i = 0; i * i <= n; i++)
	{
		ret.push_back(i);
		if (i * i != n)
			ret.push_back(i);
	}
	sort(ALL(ret));
	return ret;
}

char m[51][51];
int w, h;

void dfs(int x, int y, vector<vector<bool>> &cmap, char color, vector<vector<bool>> &checked)
{
	if (x >= w || y >= h || y < 0 || x < 0) return;
	if (checked[x][y]) return;
	checked[x][y] = true;
	if (m[x][y] != '.') return;

	cmap[x][y] = true;
	for (int di = 0; di < 4; di++)
	{
		dfs(x + dx[di], y + dy[di], cmap,color,checked);
	}
}


signed main()
{
	ios();
	int W,H,x,y;
	cin >> W >> H >> x >> y;
	if (x == (double)W/2 && y == (double)H/2) {
		printf("%.10f %d\n",(double)W * H/2,1);
	} else {
		printf("%.10f %d\n",(double)W * H/2,0);
	}
	
}


Measured memory_bytes: 256
import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
	 int n=sc.nextInt();
	 int k=sc.nextInt();
	 HashSet<Integer> set=new HashSet<>();
	 for(int i=0;i<k;i++)
	 set.add(sc.nextInt());
	 int ans=0;
	 for(int i=n;i<=100000;i++)
	 {
		 String s=""+i;
		 char ar[]=s.toCharArray();
		 int m=0;
		 for(char c:ar)
		 {
			 if(set.contains(Integer.parseInt(""+c)))
			 m++;
		 }
		 if(m==0)
		 {
			 ans=i;
			 break;
		 }
	 }
	 System.out.println(ans);
	}
}


Measured memory_bytes: 41608
#include <stdio.h>

int main()
{
    int c[3][3];
    int i,j,g1,g2;

    for(i=0;i<3;i++){
        for(j=0;j<3;j++){
            scanf("%d",&c[i][j]);
        }
    }
    g1=c[0][0]-c[0][1];
    g2=c[0][1]-c[0][2];
    if((g1==c[1][0]-c[1][1]&&g1==c[2][0]-c[2][1])&&(g2==c[1][1]-c[1][2]&&g2==c[2][1]-c[2][2])){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

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

using namespace std;

typedef long long ll;

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

const int MAXN = 200031;

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

    ll n, p;
    int a, b, c;
    cin >> a >> b >> c;

    cout << b + min(b + a + 1, c);

    return 0;
}


Measured memory_bytes: 256
public class Main{

	public static void main(String args[])
	{
		int min = 1;
		int max = 9;

		for (int x=min;x<=max;x++)
		{
			for (int y=min;y<=max;y++)
			{
				System.out.println(x + "x" + y + "=" + x*y );
			}
		}
	}
}

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

using namespace std;

using ll = long long;

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

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

    vector<vector<int>> dp(s.size() + 1, vector<int>(t.size() + 1));
    for (size_t i = 1; i <= s.size(); ++i) {
        for (size_t j = 1; j <= t.size(); ++j) {
            if (s[i - 1] == t[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1;
            else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
        }
    }

    string ans;
    for (size_t i = s.size(), j = t.size(); 1 <= i && 1 <= j; ) {
        if (s[i - 1] == t[j - 1]) { ans = s[i - 1] + ans; --i; --j; }
        else if (dp[i - 1][j] < dp[i][j - 1]) --j;
        else --i;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 35584