akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#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(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(RALL(x))
#define SUM(x) accumulate(ALL(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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 () {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];

  vi ans(n);
  rep(i,n) {
    ans[a[i]-1] = i+1;
  }

  rep(i,n) cout << ans[i] << "\n";
}

Measured memory_bytes: 1536
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    vector <ll> h(n);
    for (int i = 0; i< n; i++) cin >> h[i];
    vector < pair <int, int> > v(m);
    for (int i = 0; i < m; i++) {
        int a , b;
        cin >> a >> b;
        v[i] = mp(a, b);
    }
    vector <bool> ans(n, true);
    for (int i = 0; i < m; i++) {
        if (h[v[i].F-1] > h[v[i].S-1]) {
            ans[v[i].S-1] = false;
        }
        else if (h[v[i].F-1] < h[v[i].S -1]){
            ans[v[i].F-1] = false;
        }
        else {
            ans[v[i].F-1] = false;
            ans[v[i].S-1] = false;
        }
    }
    int count = 0;
    for (int i = 0; i < n; i++) {
        if (ans[i] == true) count++;
    }
    cout << count << endl;
    return 0;
}




Measured memory_bytes: 4764
# -*- coding: utf-8 -*-
#ARC069C
import sys

#n=int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
m=hoge[1]

ans=0
if(2*n<=m):
	ans+=n
	ans+=(m-2*n)//4
else:
	ans+=m//2
print(ans)

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

int main()
{
    int N, Y;
    int array[] = {0, 7, 5, 3, 1, 8, 6, 4, 2};
    cin >> N >> Y; Y /= 1000;
    Y -= N;
    if(Y < 0 || Y / 9 > N) {
        cout << "-1 -1 -1" << endl;
    } else {
        int b = array[Y % 9], a = (Y - b * 4) / 9;
        if(a + b > N || a < 0) cout << "-1 -1 -1" << endl;
        else cout << a << " " << b << " " << N - a - b << endl;
        return (0);
    }
    return (0);
}

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

using namespace std;

int main(void){
	int a, b;

	cin >> a >> b;

	if ((a + b)% 2 == 0){
		cout << (a + b)/2 << endl;
	}
	else {
		cout << (a + b)/2 + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int digit(ll number, int digit_n){
    for(int i = 0; i < digit_n; i++){
        number /= 10;
    }
    return number % 10;
}

int main(){
    ll n;
    scanf("%lld", &n);
    int sum=0;
    int num[20];
    int keta = 0;

    for(int i = 0; i < 18; i++){
        num[i] = digit(n, i);
    }
    for(int i = 17; i >= 1; i--){
        if(num[i] > 0){
            keta = i;
            break;
        }
    }
    bool all9 = true;
    for(int i = 0; i < keta; i++){
        if(num[i] != 9) all9 = false;
    }
    if(all9){
        sum = keta * 9+num[keta];
    }else
        sum = keta * 9+num[keta]-1;
    printf("%d\n", sum);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define freinput "input.txt","r",stdin
#define freoutput "output.txt","w",stdout
#define mp make_pair
#define fi first
#define sc second
#define pb push_back
#define ellapse printf("Time : %0.3lf\n",clock()*1.0/CLOCKS_PER_SEC);
typedef long long ll;
typedef unsigned long int uld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
struct comp {
       bool operator() (int a,int b) {
            return a>b;
       }
};

int main(){
//    #ifdef chris
//    freopen(freinput);
//    freopen(freoutput);
//    #endif // chris
//    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int arr[n];
    int k = 1;
    int res = 0;
    for (int i = 0;i<n;i++){
        cin>>arr[i];
        if(arr[i]!=k){
            res++;
        }else{
            k++;
        }
    }
    if(res==n){
        cout<<-1<<endl;
    }else{
        cout<<res<<endl;
    }
}


Measured memory_bytes: 1024
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
//const ll MOD=998244353LL;
//const ll MAX_V=114514LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};


int main(){
  ll n;cin>>n;
  if(n%2==1){
    cout<<0<<endl;
    return 0;
  }
  ll ans=0;
  ll count=0;
  n/=2;
    while(n>0){
      //count++;
      ans+=n/5;
      n/=5;
    }
  
  cout<<ans<<endl;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,k,h,ans;

signed main() {
    cin >> n >> k;
    rep(i,n) {
        cin >> h;
        if (h >= k) ans++;
    }
    cout << ans << endl;
}


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

typedef long long s64;
#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=2e5+5;
int a[N],st[N],top;s64 dp[N];

int main()
{
	//freopen("1.in","r",stdin);
	int n;
	cin>>n;
	rep(i,1,n)scanf("%d",a+i);
	s64 ans=0;
	rep(i,1,n)
	{
		while(a[st[top]]>a[i])--top;
		dp[i]=dp[st[top]]+(s64)a[i]*(i-st[top]);
		st[++top]=i;
		ans+=dp[i];
	}
	cout<<ans;
}

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

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

    int64_t n, m, x;
    static int64_t c[12], a[12][12];
    cin >> n >> m >> x;
    for(int i=0;i<n;++i){
        cin >> c[i];
        for(int j=0;j<m;++j) cin >> a[i][j];
    }
    int64_t ans = INT64_MAX;
    for(int ptn=0;ptn<(1<<n);++ptn){
        int64_t b[12];
        for(int i=0;i<m;++i) b[i] = 0;
        int64_t cost = 0;
        for(int i=0;i<n;++i){
            if((ptn>>i&1) == 0) continue;
            cost += c[i];
            for(int j=0;j<m;++j) b[j] += a[i][j];
        }
        if(*min_element(b, b+m) >= x) ans = min(ans, cost);
    }
    if(ans == INT64_MAX) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
//Fast io
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
//Class shorthands
#define ll long long
#define db long double
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
//Function Shorthands
#define fi first
#define se second
#define mem1(a) memset(a,-1,sizeof(a))
#define mem0(a) memset(a,0,sizeof(a))
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mp make_pair
#define po pop_back
#define eb emplace_back
//Code Shorthands
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
//Constants
#define hell 1000000007
#define PI acos(-1.0)
using namespace std;
ll binexpo(ll a, ll b, ll c){
    //if(b<0) return 0;
    if(!b) return 1;
    if(b&1) return (binexpo((a*a)%c, b>>1,c)*a)%c;
    return binexpo((a*a)%c, b>>1,c)%c;
}
void solve(){
	ll n;
	cin>>n;
	cout<<(binexpo(10, n, hell) - (2*binexpo(9, n, hell))%hell + binexpo( 8, n, hell) + hell ) % hell <<endl;;
}

int main(){
	io;
	int t = 1;
	//cin>>t;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3608
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  while(n--) {
    string MSer, MS; cin >> MSer >> MS;
    int len = MS.length();
    for(int i = (int)MSer.length() - 1; i >= 0; i--) {
      if(MSer[i] == 'J') {
        for(int i = len - 1; i > 0; i--) {
          swap(MS[i-1], MS[i]);
        }
      }
      if(MSer[i] == 'C') {
        FOR(i,1,len) {
          swap(MS[i-1], MS[i]);
        }
      }
      if(MSer[i] == 'E') {
        string ms1 = "", ms2 = "";
        FOR(i,0,len) {
          if(i < len / 2) {
            ms1 += MS[i];
          } else if(len % 2 == 1 && i == len / 2) {
            ms1 = MS[i] + ms1;
          } else {
            ms2 += MS[i];
          }
        }
        MS = ms2 + ms1;
      }
      if(MSer[i] == 'A') {
        reverse(MS.begin(), MS.end());
      }
      if(MSer[i] == 'P') {
        FOR(i,0,len) {
          if(isdigit(MS[i])){
            int x = MS[i] - '0';
            x = (x - 1 + 10) % 10;
            char y = x + '0';
            MS[i] = y;
          }
        }
      }
      if(MSer[i] == 'M') {
        FOR(i,0,len) {
          if(isdigit(MS[i])){
            int x = MS[i] - '0';
            x = (x + 1) % 10;
            char y = x + '0';
            MS[i] = y;
          }
        }
      }
    }
    cout << MS << endl;
  }
  return 0;
}

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

#define F first
#define S second
#define pb push_back 
#define mp make_pair

#define ll long long 
#define ld long double 

#define vi vector <int>
#define vb vector <bool>
#define vc vector <char>
#define vll vector <ll>
#define vs vector <string>

#define pll pair < ll , ll >
#define pld pair < ld , ld >
#define pii pair < int , int >

#define vpld vector < pld >
#define vpii vector < pii >
#define vpll vector < pll >

#define vvi vector < vector < int > >
#define vvll vector < vector < ll > >
#define vvld vector < vector < ld > >
#define vvb vector < vector < bool > >
#define vvpii vector < vector < pii > >

#define all(v) (v).begin() , (v).end()
#define allrev(v) (v).rbegin() , (v).rend()

#define dist(x1 , y1 , x2 , y2) sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))

const int MOD = 1e9 + 7 ;

bool isprime (ll num) {
    for (ll i = 2 ; i * i <= num ; ++i) {
		if (num % i == 0) return false ;
	}
    return true;
}
 
ll gcd (ll a, ll b) {
    if (b == 0) return a ;
	else return gcd (b , a % b) ;
}
 
ll lcm (ll a, ll b) {
    return ((a / gcd(a , b)) * b) ;
}
 
ll cel (ll x1, ll y1) {
    if ((x1) <= 0) return (x1) / (y1) ;
    return (((x1) / (y1)) + (((x1) % (y1)) != 0)) ;
}

int power(int x, unsigned int y) 
{ 
    if (y == 0) 
        return 1; 
    else if (y%2 == 0) 
        return power(x, y/2)*power(x, y/2); 
    else
        return x*power(x, y/2)*power(x, y/2); 
} 

void solve (int test_case) {
	int n ;
	cin>>n;
	if(n==1) cout<<0;
	else  cout<<1;
}

int main() {
	ios_base :: sync_with_stdio (false) ;
	cin.tie(0) ;
	cout.tie(0) ;
	int tc = 1 ;
	//cin >> tc ;
	while (tc--) {
		solve (tc) ;
	}
	return 0 ;
}


Measured memory_bytes: 3644
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
#include<ctype.h>
using namespace std;


int main() {
	int h, a;
	cin >> h >> a;
	if (h%a==0) {
		cout << h / a << endl;
	}
	else {
		cout << h / a +1<< endl;
	}
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define clr(arr, x) memset(arr, x, sizeof arr)
#define endl "\n"
#define Accepted 0
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N = 1e5 + 5;
ll dp[N];
int main()
{
	memset(dp, 0x3f, sizeof(dp));
	int n, W;
	scanf("%d%d", &n, &W);
	vi val(n + 1), cap(n + 1);
	for (int i = 1; i <= n; i++)
		scanf("%d%d", &cap[i], &val[i]);
	dp[0] = 0;
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = N-1; j>=val[i]; j--) {
			dp[j] = min(dp[j], dp[j - val[i]]+cap[i]);
			if (dp[j] <= W)ans = max(ans, (ll)j);
		}
	}
	
	printf("%lld", ans);

	return Accepted;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main()
{
	int i,t,n,m=0,g,h,k,q,c[50]={},d[50]={};
	
	char s[200],p[200];
	
	scanf("%s %s",s,p);
	
	for(i=0;s[i]!='\0';i++)n=i+1;
	//printf("%d\n",n);
	
	for(t=0;t<i;t++){
		
		s[t+i]=s[t];
	}
	s[t+i]='\0';
	//printf("%s\n",s);//???????????§??§n???s[]???????????°
	
	for(i=0;p[i]!='\0';i++);
	
	for(t=0;t<n;t++){
		
		//printf("%c %c %d\n",s[t],p[0],m);
		if(s[t]==p[0]){
			c[m]=t;
			m++;
		}//???????????§??§c[m]??????????\´??????????????§?????????????????????????????????????????°
	}
	//printf("\n");
	
	for(g=0;g<m;g++){
		h=0;
		q=c[g];
		d[g]=1;
		for(k=0;k<i;k++){
			
			if(s[q+k]!=p[k]){
				h=h+1;
			}
			//printf("%c %c %d\n",s[q+k],p[k],h);
			if(d[g]!=0||h!=0){
				
				d[g]=h;
			}
		}
		//printf("\n");
		
	}
	i=0;
	for(g=0;g<m;g++){
		
		//printf("%d\n",d[g]);
		if(d[g]==0){
			
			printf("Yes\n");
			i=1;
			break;
		}
	}
	if(i!=1){
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 2600
import java.util.*;
public class Main{
	public static int[] S;
	public static boolean bi(int num,int x,int y){
		int z=(x+y)/2;
		if(num==S[z]){
			return true;
		}
		if(z==x||z==y){
			return false;
		}
		else if(num>S[z]){
			return bi(num,z,y);
		}
		else{
			return bi(num,x,z);
		}
	}
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		S=new int[n];
		for(int i=0;i<n;i++){
			S[i]=sc.nextInt();
		}
		int q=sc.nextInt();
		int T,ans=0;
		for(int i=0;i<q;i++){
			T=sc.nextInt();
			if(bi(T,0,n)==true){
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 68488
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"regexp"
)

func main() {
	sc := newScanner()
	sc.Scan()
	s := sc.Text()
	sc.Scan()
	t := sc.Text()
	ans := solve(s, t)
	if ans {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func solve(s, t string) bool {
	r := regexp.MustCompile(`^` + s + `[a-z]$`)
	return r.MatchString(t)
}

func newScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
	return sc
}


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

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

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

    reverse(ALL(s));
    
    int i=0;
    while (i < SIZE(s)){
        if (i + 5 <= SIZE(s) && s.substr(i, 5) == "maerd") i+=5;
        else if (i + 7 <= SIZE(s) && s.substr(i, 7) == "remaerd") i+=7;
        else if (i + 5 <= SIZE(s) && s.substr(i, 5) == "esare") i+=5;
        else if (i + 6 <= SIZE(s) && s.substr(i, 6) == "resare") i+=6;
        else break;
    }

    if (i == SIZE(s)) cout << "YES" << "\n";
    else cout << "NO" << "\n";

    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

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

    		int result = (int)Math.ceil((double)n / 2);
    		System.out.println(result);

    	} finally {
    		sc.close();
    	}
    }
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
ll a[1005605]={0};
int main()
{
    string s;
    while(cin>>s)
    {
        set<char> ss;
        for(int i=0;i<26;i++) ss.insert(char('a'+i));
        rep(i,s.size())
        {
            if(ss.count(s[i])) ss.erase(s[i]);
        }
        if(ss.size()==0) cout<<"None\n";
        else cout<<*ss.begin()<<"\n";
    }
}


Measured memory_bytes: 512
import java.util.*;
import static java.lang.Math.*;

public class Main {

	int[][] sea;
	int[][] land;
	static final int INF = 1<<27;
	int N, R;
	int[] tar;

	void run(){
		Scanner in = new Scanner(System.in);
		for(;;){
			N = in.nextInt();
			int M = in.nextInt();
			if(N==0) return ;
			sea = new int[N][N];
			land = new int[N][N];
			for(int i=0; i<N; i++){
				for(int j=0; j<N; j++){
					sea[i][j] = INF;
					land[i][j] = INF;
				}
			}
			for(int i=0; i<M; i++){
				int x = in.nextInt()-1,
					y = in.nextInt()-1,
					t = in.nextInt();
				String wh = in.next();
				if(wh.equals("S")){
					sea[x][y] = min(sea[x][y], t);
					sea[y][x] = sea[x][y];
				}
				else{
					land[x][y] = min(land[x][y], t);
					land[y][x] = land[x][y];
				}
			}
			R = in.nextInt();
			tar = new int[R];
			for(int i=0; i<R; i++){
				tar[i] = in.nextInt() - 1;
			}
			System.out.println(solve());
		}
	}

	int solve(){
		for(int i=0; i<N; i++){
			sea[i][i] = land[i][i] = 0;
		}
		for(int k=0; k<N; k++){
			for(int i=0; i<N; i++){
				for(int j=0; j<N; j++){
					sea[i][j] = min(sea[i][j], sea[i][k]+sea[k][j]);
					land[i][j] = min(land[i][j], land[i][k]+land[k][j]);
				}
			}
		}
		int[][] dp = new int[R][N];
		for(int i=0; i<R; i++){
			for(int j=0; j<N; j++){
				dp[i][j] = INF;
			}
		}
		dp[0][tar[0]] = 0;
		for(int k=0; k<R-1; k++){
			for(int i=0; i<N; i++)if(dp[k][i] != INF){
				for(int j=0; j<N; j++){
					dp[k+1][j] = min(dp[k+1][j], dp[k][i]+land[tar[k]][i]+sea[i][j]+land[j][tar[k+1]]);
				}
				dp[k+1][i] = min(dp[k+1][i], dp[k][i] + land[tar[k]][tar[k+1]]);
			}
		}
		int ret = INF;
		for(int i=0; i<N; i++){
			ret = min(ret, dp[R-1][i]);
		}
		return ret;
	}

	public static void main(String args[]){
		new Main().run();
	}
}

Measured memory_bytes: 16000
#include <iostream>
#include <vector>
using namespace std;
void A(void);
void B(void);
void C(void);
void D(void);

int main(void){
    A();
}

void B(void){
    long long int x,sum;
    cin>>x;
    int i;
    sum=100;
    for(i=0;sum<x;++i){
        sum+=sum/100;
    }
    cout<<i<<endl;
}

void A(void){
    int a,b,k;
    cin>>k>>a>>b;
    cerr<<(a+(k-a%k))<<endl;
    if(k==1){cout<<"OK"<<endl;}
    else if((a+(k-a%k))<=b)cout<<"OK"<<endl;
    else if(a%k==0||b%k==0)cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    string s;cin >> s;
    bitset<6> bit(s);
    cout << bit.count() << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int tarou[101],hanako[101];
int main() {
    int n,m;
    while(scanf("%d %d",&n,&m),n) {
        memset(tarou,0,sizeof(tarou));
        memset(hanako,0,sizeof(hanako));
        int s;
        int t_sum=0,h_sum=0;
        for(int i=0;i<n;i++) {scanf("%d",&s);tarou[s]++;t_sum+=s;}
        for(int i=0;i<m;i++) {scanf("%d",&s);hanako[s]++;h_sum+=s;}
         if(abs(t_sum-h_sum)%2) {printf("-1\n");continue;}
         int d=(t_sum-h_sum)/2;
         bool OK=0;
         for(int i=0;i<=100;i++) {
            int j=i-d;
            if(0<=j&&j<=100&&tarou[i]>0&&hanako[j]>0) {
                printf("%d %d\n",i,j);
                OK=1;
                break;
            }
         }
         if(!OK) printf("-1\n");
    }
}

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

#define rep(i,l,n) for(int (i)=(l);(i)<(n);(i)++)
#define min(a,b) (a)<(b)?(a):(b)
#define max(a,b) (a)>(b)?(a):(b)
#define abs(a) (a)>0?(a):-(a)
#define ll long long

int main(){
	int X,Y,Z; scanf("%d %d %d",&X,&Y,&Z);
	printf("%d %d %d",Z,X,Y);
	return 0;
}


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

const long long INF = 1000000000;

typedef long long ll;

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

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


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

	int n;cin>>n;
	
	for(int i=1; i<=9; i++){
		if(n % i ==0 && n/i <=9){
			writeln("Yes");
			return 0;
		}
	}
	writeln("No");

}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s,t;
int main(){
    cin>>s;
    cin>>t;
    int n=s.length(), m=t.length();
    int dp[n+1][m+1],str_dp[n][m];
    for(int i=0;i<n+1;i++)dp[i][0]=0;
    for(int i=0;i<m+1;i++)dp[0][i]=0;
    string ans;
    for(int i=1;i<n+1;i++){
        for(int j=1;j<m+1;j++){
            if(s[i-1]==t[j-1]){
                dp[i][j]=1+dp[i-1][j-1];
                str_dp[i-1][j-1]=2;
            }
            else{
                if(dp[i-1][j]<dp[i][j-1])str_dp[i-1][j-1]=1;
                else str_dp[i-1][j-1]=0;
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    int i=n-1,j=m-1;
    while(i>=0 && j>=0){
        if(s[i]==t[j])ans+=s[i];
        if(str_dp[i][j]==2){
            i--;j--;
        }
        else if(str_dp[i][j]==1)j--;
        else i--;
    }
    int l=ans.length();
    char c;
    for(i=0;i<l/2;i++){
        c = ans[i];
        ans[i]=ans[l-1-i];
        ans[l-i-1]=c;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 73948
#include<stdio.h>
int main(){
  int N,i,j,sum,k;
  while(1){
 sum=0;
  k=0;
    scanf("%d",&N);
    if(N==0) break;
    for(i=1;i<=N;i++){
      sum=0;
      for(j=i;j<=N;j++){
	sum=sum+j;
	if(sum==N&&j!=N)k=k+1;
	else if(sum>N)break;

      }
    }
    printf("%d\n",k);
  }
  return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
int main (void)
{
   
	int x = 1,i;

	for(i=1; i>0 ; i++)
	{
		scanf("%d",&x);
		
		if(x<=0)
		{
			i = -1 ;
		}

		else
		{
		
		printf("Case %d: ",i);
		printf("%d\n",x);
		
		}
	}
     return 0;
}

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

const int NMAX = 200000;
int a[NMAX] = {};
//int b[NMAX] = {};
using namespace std;

int main(){
    int n;
    cin >> n;
    for (int i =0; i <n; ++i) {
        cin >> a[i];
    }
    if (n%2 == 0) {
        for (int i =n-1; i >0 ; i -=2) {
            cout << a[i] << " ";
        }
        for (int i =0; i <n-1; i +=2) {
            cout << a[i] << " ";
        } cout << endl;
    } else {
        for (int i =n-1; i >-1 ; i -=2) {
            cout << a[i] << " ";
        }
        for (int i =1; i <n-1; i +=2) {
            cout << a[i] << " ";
        } cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2944
c = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

a=input()

for i in range(52):
    if c[i]== a:
        if i > 25:
            print("A")
        else:
            print("a")
        exit(0)

Measured memory_bytes: 8920
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  ll N;
  cin >> N;
  vll A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  sort(ALL(A));

  vll S(N+1, 0);
  for(int i = 0; i < N; i++){
    S.at(i+1) = S.at(i) + A.at(i);
  }

  int counter = 0;

  for(int i = 0; i < N; i++){
    ll size = A.at(i);
    while(1){
      auto ite = upper_bound(ALL(A), 2*size);
      if(ite == A.end()){
        counter++;
        break;
      }
      if(size == S.at(distance(A.begin(), ite))) break;
      size = S.at(distance(A.begin(), ite));
    }
  }
  cout << counter << endl;
}

Measured memory_bytes: 1792
N,K = list(map(int,input().split(" ")))
x = list(map(int,input().split(" ")))

dis_list = []

for i in range(N-K+1):
    dis_list.append(x[i+K-1] -x[i] + min(abs(x[i]),abs(x[i+K-1])))
print(min(dis_list))

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

using namespace std;

void Main() {
    int N, K;
    cin >> N;
    cin >> K;
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        int x;
        cin >> x;
        ans += 2 * min(abs(K - x), abs(0 - x));
    }
    cout << ans << endl;
}

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


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

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

int main()
{
    int a,b,c;
    while(1)
    {
	a=getchar();
	if (a == EOF)break;
	if (a=='@')
	{
	    b = getchar()-'0';
	    c = getchar();
	    rep(i,b)putchar(c);
	} else {
	    putchar(a);
	}
    }
    return 0;
}

Measured memory_bytes: 0
import itertools
import math

N=int(input())
POS=[]
for i in range(N):
    x,y=map(int,input().split())
    POS.append([x,y])

town=[]
for i in range(N):
    town.append(i)

distance=[[0]*N for i in range(N)]
for i in range(N):
    for j in range(N):
        distance[i][j]=math.sqrt((POS[i][0]-POS[j][0])**2+(POS[i][1]-POS[j][1])**2)
        distance[j][i]=distance[i][j]
# print(POS)
# print(distance)

ans=0
for v in itertools.permutations(town):
    # print(v)
    sum=0
    for i in range(len(v)-1):
        sum+=distance[v[i]][v[i+1]]
    ans+=(sum)
    # print(sum)
print(ans/(math.factorial(N)))


Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<math.h>
#include<string.h>
#define rep(i,l,r) for(ll i=l;i<r;i++)

typedef long long ll;

ll max(ll x, ll y) { return (x > y) ? x : y; }


int main() {
    double w,h,x,y;
    scanf("%lf%lf%lf%lf", &w,&h,&x,&y);
    printf("%f\n", w * h / 2);
    if (w / 2 == x && h / 2 == y) printf("1");
    else printf("0");

    return 0;
}

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

using namespace std;

const int N = 123456;

int n, a[N], b[N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b + 1, b + 1 + n);
  for (int i = 1; i <= n; ++i) {
    a[i] = lower_bound(b + 1, b + 1 + n, a[i]) - b;
  }
  int answer = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] - i & 1) {
      ++answer;
    }
  }
  answer >>= 1;
  cout << answer << '\n';
  return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3
from collections import deque
import sys
try:
    from typing import Deque, Dict, List, Tuple
except ImportError:
    pass
 
 
YESS = "Yes"  # type: str
NO = "No"  # type: str
 
 
def solve(N: int, M: int, L: "List[int]", R: "List[int]", D: "List[int]"):
    G = [[] for _ in range(N)]  # type: List[List[Tuple[int, int]]]
    for Li, Ri, Di in zip(L, R, D):
        Li -= 1
        Ri -= 1
        G[Li].append((Ri, Di))
        G[Ri].append((Li, -Di))
    pos = {}  # type: Dict[int, int]
    for i in range(N):
        if i in pos:
            continue
        q = deque()  # type: Deque[int]
        pos[i] = 0
        q.append(i)
        while q:
            s = q.popleft()
            for t, dst in G[s]:
                if t in pos:
                    if pos[t] != pos[s] + dst:
                        print(NO)
                        return
                    continue
                pos[t] = pos[s] + dst
                q.append(t)
    print(YESS)
 
 
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    L = [int()] * (M)  # type: "List[int]"
    R = [int()] * (M)  # type: "List[int]"
    D = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        L[i] = int(next(tokens))
        R[i] = int(next(tokens))
        D[i] = int(next(tokens))
    solve(N, M, L, R, D)
 
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 90428
n, m = map(int,input().split())
h_list = list(map(int,input().split()))
ten = [[] for i in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    ten[a-1].append(b-1)
    ten[b-1].append(a-1)

#print(ten)

kotae = 0

for i in range(n):
    ans = 1
    if len(ten[i]) == 0:
        pass
    else:
        for j in ten[i]:
            if h_list[i] > h_list[j]:
                pass
            else:
                ans = 0
    kotae += ans
    #print(i, kotae,ans)

print(kotae)

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


int main() {
	string s, t;
	cin >> s >> t;
	t.pop_back();
	if (s == t)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}






Measured memory_bytes: 3636
n = int(input())
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))

sum_a = sum(a)
for i in range(n):
    if a[i] <= b[i]:
        b[i] -= a[i]
        a[i] = 0
        if a[i+1] <= b[i]:
            a[i+1] = 0
        else:
            a[i+1] -= b[i]
    else:
        a[i] -= b[i]
print(sum_a-sum(a))

Measured memory_bytes: 18440
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype (i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype (i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype (i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,
mod=1000000007;
const double pi=3.1415926535897932,
eps=1e-6;
int n,m,p,a[100005];pii t[100005];ll ans;
bool cmp(pii a,pii b){return a>b;}
int main()
{
    scanf("%d%d",&n,&m);
    rep(i,1,n) scanf("%d",a+i);
    sort(a+1,a+n+1);
    rep(i,1,m) scanf("%d%d",&t[i].se,&t[i].fi);
    sort(t+1,t+m+1,cmp);
    p=1;
    rep(i,1,m){
        while(p<=n&&t[i].se){
            t[i].se--;
            if(a[p]>t[i].fi) break;
            a[p]=t[i].fi;
            p++;
        }
    }
    rep(i,1,n) ans+=a[i];
    printf("%lld",ans);
    return 0;
}

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

int main(){
  int A1,A2,Ncoupon;
  cin >> A1 >> A2 >> Ncoupon;

  vector<int> items1(A1);
  vector<int> items2(A2);
  int buf;
  int min1= INT_MAX;
  int min2= INT_MAX;
  for(int i1=0; i1<A1; i1++){
    cin >> buf;
    items1.at(i1)= buf;
    min1= min(min1, buf);
  }
  for(int i2=0; i2<A2; i2++){
    cin >> buf;
    items2.at(i2)= buf;
    min2= min(min2, buf);
  }

  int ans= min1+ min2;
  int buf1,buf2,buf_cashback;
  for(int i=0; i<Ncoupon; i++){
    cin >> buf1 >> buf2 >> buf_cashback;
    buf1--; buf2--; // 1-indexed -> 0-indexed
    ans= min(ans, items1.at(buf1)+ items2.at(buf2)- buf_cashback);
  }

  cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int len = s.length();
        int ans = 999;
        int end = len - 2;
        for (int i = 0; i < end; i++) {
            ans = Math.min(ans, Math.abs(Integer.parseInt(s.substring(i, i + 3)) - 753));
        }
        System.out.println(ans);
        sc.close();
    }
}


Measured memory_bytes: 21716
S = input()
T = input()
count = 0
if T in S:
    print(0)
else:
    #SのなかでTを動かしていき最大マッチ数を考える
    for i in range(len(S)-len(T)+1):
        check = S[i:len(T)+i-1]
        point = 0
        for w1, w2 in zip(T, check):
            if w1 == w2:
                point += 1
        if point > count:
            count = point
    print(len(T)-count)


Measured memory_bytes: 9040
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  int count = 0;
   for (int i = 0; i < N ;i++){
     int h;
     cin >> h;
     if (h >= K){
       count++;
     }
   }
  cout << count << endl;
       
}

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

#define int long long
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
//const int MOD = 10000;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))
int gcd(int x,int y){if(y==0) return x; return gcd(y, x%y);}
int lcm(int x,int y){return x/gcd(x,y)*y;}

signed main() {
    int l; cin >> l;
    printf("%.10f\n",l*l*l/27.0);
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    if(a==b) cout << "Draw";
    else
    {
        if(a==1) cout << "Alice";
        else if(b==1) cout << "Bob";
        else if(a<b) cout << "Bob";
        else cout << "Alice";
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
typedef long long ll;
const int MAX=1e5+10;
int main()
{
	ll a,b,x;
	cin>>a>>b>>x;
	ll A,B;
	if(a%x==0)A=a/x;
	else A=a/x+1;
	B=b/x;
	ll sum;
	if(A<B)sum=0;
	 sum=B-A+1;
	cout<<sum;
}

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

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var A = new int[3, 3];
            var used = new bool[3, 3];
            for (int i = 0; i < 3; i++)
            {
                var input = ReadArrayInt();
                for (int j = 0; j < 3; j++)
                {
                    A[i, j] = input[j];
                }
            }
            var N = ReadInt();
            for (int i = 0; i < N; i++)
            {
                var b = ReadInt();
                for (int j = 0; j < 3; j++)
                {
                    for (int k = 0; k < 3; k++)
                    {
                        if (A[j, k] == b) used[j, k] = true;
                    }
                }
            }
            var suc = false;
            for (int i = 0; i < 3; i++)
            {
                if (used[i, 0] && used[i, 1] && used[i, 2])
                {
                    suc = true;
                    break;
                }
            }
            for (int i = 0; i < 3; i++)
            {
                if (used[0, i] && used[1, i] && used[2, i])
                {
                    suc = true;
                    break;
                }
            }
            if (used[0, 0] && used[1, 1] && used[2, 2]) suc = true;
            if (used[0, 2] && used[1, 1] && used[2, 0]) suc = true;

            Console.WriteLine(suc ? "Yes" : "No");
            Console.ReadKey();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

void solve ( int test_case )
{
    int n ; cin >> n;

    vll on_bit_count ( 62 ) ;

    for ( int i=0 ; i < n ; i ++ )
    {
        ll val ; cin >> val ;
        for ( int j = 0 ; j < 62 ; j ++ )
        {
            int bit = (val&1) ;
            val >>= 1 ;

            if ( bit )
                on_bit_count[j] ++ ;
        }
    }

    ll f = 1 ;
    ll ans = 0 ;

    for ( int i=0 ; i < 62 ; i ++ )
    {
        ll one = on_bit_count[i] ;
        ll zero = n - one ;

        ll temp = one * zero ;
        temp %= mod ;

        temp *= f ;
        temp %= mod ;

        f <<= 1 ;
        f %= mod ;

        ans += temp ;
        ans %= mod ;
    }

    cout << ans << "\n" ;
}

int main()
{fast
    int t = 1;
    // cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    char s[n];
    rep(i,n)cin >> s[i];
    int ans = 0;
    rep(i,n-2){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
            ans +=1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n = input()
X = []
  
def matrix(n):
   x = [[0 for i in range(len(n))] for j in range(len(n))]
  
   for l in range(2, len(n)+1):
      for i in range(0, len(n)-l+1):
         j = i + l - 1
         x[i][j] = min(x[i][k] + x[k+1][j] + X[i][0]*X[k][1]*X[j][1] for k in range(i, j))
  
   print x[0][len(n)-1]
  
for i in range(n):
   X.append(map(int, raw_input().split()))

matrix(X)

Measured memory_bytes: 6568
// lcm、__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define ll long long
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll i,j,k,l,m,n,maxi=0,f=0,mini=1e10,sum=0;
    string str;
    ll cnt=0;
    //ll a,b,s;
    ll bsum=0;
    ll c;
    cin>>n>>m>>c;
    vector<int> b(m);
    vector<vector<ll>> a(n,vector<ll> (m));
    rep(i,m) cin>>b[i];
    rep(i,n) rep(j,m) cin>>a[i][j];
    rep(i,n){
        sum=0;
        rep(j,m){
            sum+=a[i][j]*b[j];
        }
        if(sum+c>0) cnt++;
        
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second

constexpr int mod = 1000000007;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;

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

// value


void solve() {

	int r;
	cin >> r;

	cout << 3 * r * r << endl;

	return;

}

int main() {

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

	solve();

	return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 100000

typedef struct List{
  int key;
  struct List *next;
  struct List *prev;
}LIST;

LIST *list;

LIST* search(int key){
  LIST *x = list->next;
  while(x != list && x->key != key)
    x = x->next;
  return x;
}

void init(){
  list = (LIST *)malloc(sizeof(LIST));
  list->next = list;
  list->prev = list;
}

void print(){
  LIST *x = list->next;
  int i = 0;
  while(1){
    if(x == list) break;
    if(i++ > 0) printf(" ");
    printf("%d", x->key);
    x = x->next;
  }
  printf("\n");
}

void insert(int key){
  LIST *x = (LIST *)malloc(sizeof(LIST));
  x->key = key;
  x->next = list->next;
  list->next->prev = x;
  list->next = x;
  x->prev = list;
}

void deletenode(LIST *x){
  if(x == list) return;
  x->prev->next = x->next;
  x->next->prev = x->prev;
  free(x);
}

void deletekey(int key){
  deletenode(search(key));
}

void deleteFirst(){
  deletenode(list->next);
}

void deleteLast(){
  deletenode(list->prev);
}

int main()
{
  int key, n, i, size = 0, np = 0, nd = 0;
  char com[20];
  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 {
	deletekey(key);
	nd++;
      }
      size--;
    }
  }

  print();
  return 0;
}

Measured memory_bytes: 31788
#include <iostream>
using namespace std;
int main(void){
    int n, s[100010], q, t[50010];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> s[i];
    cin >> q;
    for (int i = 0; i < q; i++) cin >> t[i];
    
    int ans = 0, a, b, c;
    for (int i = 0; i < q; i++) {
        a = 0;  b = n - 1;
        while (a + 1 != b) {
            c = (a + b) / 2;
            if (s[c] > t[i]) b = c;
            else a = c;
        }
        if (t[i] == s[a]) ans++;
        else if (t[i] == s[b]) ans++;
    }
    
    cout << ans << endl;
}



Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

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

    int N, K;
    scan(N, K);
    vector<int> d(K);
    scan(d);

    auto ch = [&](int a) {
        while (a != 0) {
            int x = a % 10;
            if (binary_search(ALL(d), x))
                return false;
            a /= 10;
        }
        return true;
    };

    FOR(i, N, INF32) {
        if (ch(i)) {
            print(i);
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> ans(N,0);
  int a, b;
  for(int i = 0; i < M; ++i){
    cin >> a >> b;
    --a;--b;
    ++ans[a];
    ++ans[b];
  }
  for(int i = 0; i < N; ++i){
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(final String[] args) {
        try (final Scanner sc = new Scanner(System.in)) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int result = 0;
            for (int i = 0; i < 2; i++) {
                if (a > b) {
                    result += a;
                    a--;
                } else {
                    result += b;
                    b--;
                }
            }
            System.out.println(result);
        }
    }
}


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

int main() {
    int N, X, T;
	cin >> N >> X >> T;
	if (N%X==0){
	    cout << T*(N/X) << endl;
	    return 0;
	}
	else cout << T*(N/X)+T << endl;
	return 0;
}

Measured memory_bytes: 3632