akhauriyash/Code-Regression huggingface dataset:
#import <Foundation/Foundation.h>
#include <stdio.h>

NSString* input(void){
    NSData *stdinData = [[NSFileHandle fileHandleWithStandardInput] availableData];
    return [[NSString alloc] initWithData:stdinData encoding:NSUTF8StringEncoding];
}
void output(NSString *s,NSString *sep){
    NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
    [fileHandle writeData:[s dataUsingEncoding:NSUTF8StringEncoding]];
    [fileHandle writeData:[sep dataUsingEncoding:NSUTF8StringEncoding]];
    [fileHandle closeFile];
}

NSMutableArray* to_numarray(NSString *s){
    NSMutableArray *l = [NSMutableArray arrayWithArray:[s componentsSeparatedByString:@" "]];
    NSInteger buf = 0;
    for(int i=0;i<[l count];i++){
        buf = [[l objectAtIndex:i] integerValue];
        [l replaceObjectAtIndex:i withObject:[NSNumber numberWithInteger:buf]];
    }
    return l;
}

int main(int argc, const char * argv[]) {
    NSArray *l = [input() componentsSeparatedByString:@" "];
    NSMutableString *s = [NSMutableString stringWithString:[[l objectAtIndex:0] substringWithRange:NSMakeRange(0,1)]];
    [s appendString:[[l objectAtIndex:1] substringWithRange:NSMakeRange(0,1)]];
    [s appendString:[[l objectAtIndex:2] substringWithRange:NSMakeRange(0,1)]];
    output(s,@"\n");
    return 0;
}


Measured memory_bytes: 11356
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define test        int t;cin>>t;while(t--)
#define REP(i,a,b)  for(int i=a,i<=b;i++)
#define MAXN        200001

void solve(vi v,int n){

    int a=0,b=n-2,c;
    int ans=0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            c=(v[i]+v[j]);
            auto idx=lower_bound(all(v),c)-(v.begin()+j+1);
            ans+=idx;
        }
    }

    cout<<ans<<endl;
}

int32_t main()
{
    int n;cin>>n;
    vi v(n);

    for(int i=0;i<n;i++){
        cin>>v[i];
    }

    sort(all(v));

    solve(v,n);
    return 0;
}

Measured memory_bytes: 3536
#include<bits/stdc++.h>
//#include <time.h>
// #include<set>
// #include<vector>
// #include<algorithm>
// #include<iostream>
using namespace std;
#include <math.h>
// to increase precision
// std::cout<<std::fixed;
// 	std::cout<<std::setprecision(6)<<z;
//clock_t tStart = clock();
//printf("Time taken: %.9fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define maxn 50001
 
#define ll long long int


 
int main(){
	string s;
	cin>>s;
	if(s=="RRR"){
		cout<<3<<endl;
	}
	else if(s=="RRS" || s== "SRR"){
		cout<<2<<endl;
	}
	else if(s=="SSS"){
		cout<<0<<endl;
	}
	else{
		cout<<1<<endl;
	}	
 
 
}

Measured memory_bytes: 3620
import numpy as np

D = int(input())
c = np.array(list(map(int, input().split())))
s = np.array([list(map(int, input().split())) for _ in range(D)])


def s9(c, s, last_date, di, i, mul):
    score = s[di - 1][i]
    score += 0.2 * mul * c[i] * (di - last_date[i])
    return score


def f10(D, c, s):
    last_date = np.zeros(26)

    t = []
    for di in range(1, D + 1):
        mul = np.median(s[di - 1]) / np.median(c)
        score_list = []
        for i in range(26):
            score_list.append(s9(c, s, last_date, di, i, mul))

        select_index = score_list.index(max(score_list))
        t.append(select_index)
        last_date[select_index] = di

    return t


for ti in f10(D, c, s):
    print(ti + 1)

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

int main(){
  int64_t N;
  cin >> N;
  int64_t X = 0;
  vector<int> vec(0);
  int64_t x = 2;
  int64_t y = 1;
  int64_t z = 1;
  for(int i=0; i<100; i++){
    if(abs(N-X) %x >= y){
      vec.push_back(1);
      X += z;
    }
    else{
      vec.push_back(0);
    }
    if(X == N){
      break;
    }
    x *= 2;
    y *= 2;
    z *= -2;
  }
  
  for(int i=vec.size()-1; i>=0; i--){
    cout << vec.at(i);
  }
  cout << endl;
}

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

int main(void){
    int a;
    char s[10];
    scanf("%d", &a);
    scanf("%s", s);
    if(a>=3200){
        printf("%s", s);
    }else{
        printf("red");
    }

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n;
	while(cin >> n){
		if(n==-1) break;
		vector<int> ans;
		while(n >= 4){
			ans.push_back(n%4);
			n/=4;
		}
		ans.push_back(n);
		vector<int>::reverse_iterator it=ans.rbegin();
		while(it != ans.rend()){
			cout << *it;
			it++;
		}
		cout << endl;
	}
	return 0;
}

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

int main() {
  ll N; cin >> N;
  ll d = 0;
  ll i = 1;
  while (N > 1) {
    N /= 2;
    d += i;
    i *= 2;
  }
  cout << d + i << endl;
}

Measured memory_bytes: 256
(let* ((h (read))
       (w (read))
       (center (loop repeat h
                     collect (concatenate 'list "#" (read-line) "#")))
       (edge (loop repeat (+ w 2)
                   collect #\#)))

  (defun f (l)
    (concatenate 'string l))

  (format t "~A~%" (f edge))
  (format t "~{~A~%~}" (mapcar #'f center))
  (format t "~A~%" (f edge)))


Measured memory_bytes: 24648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;

public class Main {

    private final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    private final PrintWriter out = new PrintWriter(System.out);

    public void solve() throws IOException {
        BigInteger max = new BigInteger("1000000000000000000");
        int n = Integer.parseInt(in.readLine());
        String[] ints = in.readLine().split(" ");
        for (String i : ints) {
            if ("0".equals(i)) {
                out.println(0);
                return;
            }
        }
        BigInteger ans = BigInteger.valueOf(1);
        for (String i : ints) {
            ans = ans.multiply(new BigInteger(i));
            if (ans.compareTo(max) == 1) {
                out.println(-1);
                return;
            }
        }
        out.println(ans);
    }

    private void go() throws IOException {
        solve();
        in.close();
        out.close();
    }

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

Measured memory_bytes: 58508
#include <bits/stdc++.h>
using namespace std;
long long m=1e9+7;

long long power(long long x, long long y, long long p)
{
    long long res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

long long modInverse(long long n, long long p)
{
    return power(n, p-2, p);
}

long long nCrModPFermat(long long n, long long r, long long p)
{
   if (r==0)
      return 1;
    long long fac[n+1];
    fac[0] = 1;
    for (long long i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;
    return (fac[n]* modInverse(fac[r], p) % p * modInverse(fac[n-r], p) % p) % p;
}

int main()
{
	long long a,b,k;
    cin>>a>>b>>k;
    if(a>=k) cout<<a-k<<" "<<b<<endl;
    else cout<<0<<" "<<max(0LL,b-(k-a))<<endl;
}


Measured memory_bytes: 256
import collections
n = int(input())
a = list(map(int,input().split()))

sub = collections.Counter(a)
ans = 0
for i in sub:
    ans += sub[i] * (sub[i] - 1) // 2
for i in range(n):
    ad = sub[a[i]] * (sub[a[i]] - 1) // 2 - ((sub[a[i]] - 1) * (sub[a[i]] - 2) // 2)
    print(ans - ad)

Measured memory_bytes: 26772
class UnionFind:
    def __init__(self, size):
        self.data = [-1 for _ in range(size)]
    def find(self, x):
        if self.data[x] < 0:
            return x
        else:
            self.data[x] = self.find(self.data[x])
            return self.data[x]
    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x != y:
            if self.data[y] < self.data[x]:
                x, y = y, x
            self.data[x] += self.data[y]
            self.data[y] = x
        return (x != y)
    def same(self, x, y):
        return (self.find(x) == self.find(y))
    def size(self, x):
        return -self.data[self.find(x)]

N, M = [int(i) for i in input().split()]

A = [0] * M
B = [0] * M
for i in range(M):
    A[M - i - 1], B[M - i - 1] = [int(i) - 1 for i in input().split()]

uf = UnionFind(N)

result = N * (N - 1) // 2
lst = [result]
for i in range(M - 1):
    if not uf.same(A[i], B[i]):
        result -= uf.size(A[i]) * uf.size(B[i])
    lst.append(result)
    uf.union(A[i], B[i])

for i in range(M - 1, -1, -1):
    print(lst[i])


Measured memory_bytes: 16900
#include <iostream>
#include <vector>
#include<algorithm>
#include<set>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i =0;i < n;i++)
int main() {
	string s;int n,q,r,l;
	cin >> n >> q >> s;int st[100001];
	st[0] = 0;
	rep(i, n + 1) {
		if (i != 0) {
			st[i] = st[i - 1];
			if (s[i] == 'C' && s[i - 1] == 'A') {
				st[i]++;
			}
		}
	}
	rep(i, q) {
		cin >> l >> r;
		cout << st[r - 1] - st[l -1] << endl;
	}
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#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 debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N   200005
#define MAX 300005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcountll
#define PI acos(-1)
//#define endl "\n"
#define inf 1e+15

signed main(){
  fast;
  int n , d; cin >> n >> d;
  d = 2*d+1;
  int x = n/d;
  if(n%d > 0) x++;
  cout << x << endl;

}
  


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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 1000000000000000000LL
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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;
}

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

const int inf=100000000;



int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
    if(e-a<=k) cout<<"Yay!"<<endl;
    else cout<<":("<<endl;
}

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

typedef long long ll;
typedef pair<int,int>P;
#define INF 99999999
#define MOD (ll)(1e9+7)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

/*--------------------------------------------*/

ll n;
ll crr;
ll prime[1000+100];
ll factorial(ll);
void list_Prime(ll);
ll divisor(ll);
int main(){
    cin>>n;
    cout<<divisor(n)<<endl;
    
}

ll factorial(ll n){
    if(n==1)return 1;
    return n*factorial(n-1);
}


void list_Prime(ll n){//n以下の素数を全て見つける
    ll Limit=(int)sqrt((double)n);
    for(ll i=2;i<=n;i++)prime[i]=1;//最初はみんな素数かも
    //素数の整数倍を消していく(ルートnまで)
    for(ll i=2;i<=Limit;i++){
        if(prime[i]){
            for(ll j=2*i;j<=n;j++){
                if(j%i==0){
                    prime[j]=0;                
                }
            }
        }
    }
}

ll divisor(ll n){
    for(ll i=2;i<=n;i++){
        ll d=1;
        ll tmp=i;
        while(tmp>1){
            d++;
            while(tmp%d==0){
                prime[d]++;
                tmp/=d;
            }
        }
    }
    ll sum=1;
    for(ll i=2;i<=n;i++){
        sum*=(prime[i]+1);
      	sum%=MOD;
    }    
    //cout<<"sum="<<sum<<endl;

    return sum%MOD;
}



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

void swap(int& a, int& b) {
    int temp = a;
    a = b;
    b = temp;
}

int gcd(int a, int b) {
    if (a < b) {
        swap(a, b);
    }
    while (b > 0) {
        int temp = a % b;
        a = b;
        b = temp;
    }
    return a;
}

int main() {
    while (true) {
        int a, b, c;
        cin >> a >> b >> c;
        if ((a | b | c) == 0) {
            break;
        }
        bool isPossible = false;
        int d = b * b - 4 * a * c;
        double sqrtD, decimal = modf(sqrt(d), &sqrtD);
        if (d >= 0 && fabs(decimal) < 0.00001) {
            isPossible = true;
        }
        if (isPossible) {
            int p = 2 * a, q = b - sqrtD, r = 2 * a, s = b + sqrtD,
                gcdPQ = gcd(p, abs(q)), gcdRS = gcd(r, abs(s));
            if (gcdPQ > 1) {
                p /= gcdPQ;
                q /= gcdPQ;
            }
            if (gcdRS > 1) {
                r /= gcdRS;
                s /= gcdRS;
            }
            if (p < r || (p == r && q < s)) {
                swap(p, r);
                swap(q, s);
            }
            printf("%d %d %d %d\n", p, q, r, s);
        } else {
            cout << "Impossible" << endl;
        }
    }
}

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

int main()
{
  int n, k; cin >> n >> k;
  vector<int> sum(n+1); sum[0] = 0;
  for (int i = 0; i < n; ++i)
  {
    int p; cin >> p;
    sum[i+1] = sum[i] + p+1;
  }
  
  int ma = 0;
  for (int i = 0; i + k < n+1; ++i)
    ma = max(ma, sum[i+k] - sum[i]);
  
  printf("%.15f\n", ma / 2.0);
}

Measured memory_bytes: 1024
#include <stdio.h>
int main(void){
    int a,b,c,d;
    d=0;
    scanf("%d %d %d",&a,&b,&c);
    for(int x=a;x<=b;x++){
        if(c%x==0){
            d=d+1;
        }
    }
    printf("%d\n",d);
    return 0;
}


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

using namespace std;

typedef long long ll;

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
	int x,res = 0;
	cin >> x;
	for(int i=1;;i++){
		res += i;
		if(res>=x){
			cout << i << "\n";
			return 0;
		}
	} 
    
	return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

using ll = long long int;
using P = pair<int,int>;

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; }

const ll INF=(ll)1e19;
//const int INF=(1<<30);

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

  VI l(n);
  REP(i,n)cin >> l[i];

  int ans=(1<<30);
  REP(i,(1<<(2*n))){
    VI cnt(3,0);
    VI sum(3,0);

    REP(j,n){
      int k = ((i>>(2*j)) & 3);
      cnt[k]++;
      sum[k]+=l[j];
    }

    if(cnt[0]==0 || cnt[1]==0 || cnt[2] ==0)continue;

    int mp= abs(a-sum[0]) + (cnt[0]-1)*10 + abs(b-sum[1]) + (cnt[1]-1)*10 +abs(c-sum[2]) + (cnt[2]-1)*10;
    chmin(ans, mp);
  }

  cout << ans << endl;


}



Measured memory_bytes: 256
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
# import statistics
import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)


x, y, z = MI()
print((x-z)//(y+z))



Measured memory_bytes: 65260
N = int(input())
SP = []
for i in range(1, N + 1):
    s, p = input().split()
    SP.append((s, int(p), i))
sp = sorted(SP, key=lambda x: x[1], reverse=True)
for i in sorted(sp, key=lambda x: x[0]):
    print(i[2])


Measured memory_bytes: 3060
/* template.cpp [[[ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)s)
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)s)
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
/* ]]] */

int main(){
  string s;
  cin >> s;
  int a[256]{};
  each(c, s) a[c]++;
  int b = 0;
  each(x, a) b |= x;
  cout << (b & 1 ? "No\n" : "Yes\n");
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int find_max(vector<int> v)
{
	int max=0;
	for(vector<int>::size_type i=0;i!=v.size();i++)
	{
		if(v[i]>max)
		max=v[i];
	}
	return max;
}
int main()
{
	int n,i=0;
	cin>>n;
	vector<int> body;
	int m;
	while(i<n&&cin>>m)
	{
	body.push_back(m);
	i++;
}
int sum=0;
for(vector<int>::size_type i=0;i!=body.size();i++)
sum+=body[i];
if((sum-find_max(body))>find_max(body))
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int fib[45] = {0};

int f(int n)
{
	if (n == 0 || n == 1)
	{
		fib[n] = 1;
		return fib[n];
	}else
	{
		if (fib[n] != 0)
		{
			return fib[n];
		}
		fib[n] = f(n-1) + f(n-2);
		return fib[n];
	}
}

int main()
{
	int n;
	cin >> n;
	cout << f(n) << endl;

	return 0;
}

Measured memory_bytes: 3092
#include <stdio.h>
#include <string.h>
void LCS_Length(char* ,char*);
int main()
{
	char A[1001],B[1001];
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++) 
	{
		scanf("%s",A);
		scanf("%s",B);
		LCS_Length(A,B);
	}
	return 0;
}

void LCS_Length(char *X,char *Y)
{
	int m,n;
	int i,j;
	int c[1001][1001];
	m = strlen(X)+1;
	n = strlen(Y)+1;

	for(i=0;i<m;i++) c[i][0] = 0;
	for(j=0;j<n;j++) c[0][j] = 0;

	for(i=1;i<m;i++)
	{
		for(j=1;j<n;j++) 
		{
			if (X[i-1] == Y[j-1]) c[i][j] = c[i-1][j-1] +1;
			else if (c[i-1][j] >= c[i][j-1]) c[i][j] = c[i-1][j];
			else c[i][j] = c[i][j-1];
			//printf("ans %d %d   %d\n",i,j,c[i][j]);
		}
	}
	printf("%d\n",c[i-1][j-1]);
}

Measured memory_bytes: 4520
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstring>
#include<string>
#include<iomanip>
#include<map>
#include<fstream>
#include<queue>
#include<set>

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	if (a * b % 2 == 1)
		cout << "Odd" << endl;
	else
		cout << "Even" << endl;
}

Measured memory_bytes: 256
n=int(input())
l=[]
for i in range(n-1):
  l1=list(map(int,input().split()))
  l.append(l1)
for i in range(n-1):
  t=0
  t+=l[i][1]+l[i][0]
  for j in range(i+1,n-1):
    if t<l[j][1]:
      t=l[j][1]
      t+=l[j][0]
    else:
      t+=(l[j][2]-t%l[j][2])%l[j][2]
      t+=l[j][0]
  print(t)
print(0)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define loop(i, a, b) for(int i = a; i < b; i++) 
#define rep(i, a) loop(i, 0, a)
using namespace std;
const int MOD = 1000000007;
const int inf = 1e8;
using vi = vector <int>;
using vvi = vector <vi>;
using vc = vector <char>;
using vvc = vector <vc>;
using vs = vector <string>;
using vvs = vector <vs>;
//g++ -std==c++14
//setprecision(10)
int n, m, ans;
vvi G;

int main(){
    cin >> n >> m;
    G = vvi (n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    bool judge = true;
    while(judge){
        judge = false;
        rep(i, n){
            if(G[i].size() == 1){
                int va = G[i][0];
                rep(j, G[va].size())
                    if(G[va][j] == i)
                        G[va].erase(G[va].begin() + j);
                G[i].clear();
                ans++;
                judge = true;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
//
//  main.cpp
//  B - TAKOYAKI FESTIVAL 2019
//
//  Created by Hashizo on 2019/10/19.
//  Copyright © 2019 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>
#include <cmath>

using namespace std;
 
#undef LONG_MAX
#undef LONG_MIN
 
#define LONG_MAX    9223372036854775807
#define LONG_MIN    (-LONG_MAX  -1)
 
#define ll long long
 
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
 
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

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

	ll ans = 0;
	ll n;
	cin >> n;

	vector<ll> tako(n);
	REP(i, n) {
		cin >> tako[i];
	}
	
	
	REP(i, n) {
		FOR(j, i+1, n) {
			ans += (tako[i]*tako[j]);
		}
	}
	
	
	
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		System.out.println(s.contains("a") && s.contains("b") && s.contains("c") ? "Yes" : "No");

		sc.close();
	}

}




Measured memory_bytes: 21844
#pragma region

#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (register int i = (begin); i < (end); i++)
#define IFOR(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define MOD 1000000007
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  REP(i, vec.size())
  i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &deq) {
  os << "deq[ ";
  REP(i, deq.size())
  i == 0 ? os << deq[i] : os << ", " << deq[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}

#pragma endregion
#pragma region

#define out(x) cout << (x) << '\n';

ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(a - b, b);
}

#pragma endregion
#define INF 2147483647

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);

  int X, Y;
  cin >> X >>Y;
  out(gcd(X, Y));
}



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

using namespace std;

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

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

  rep(i, S.length()){
    if (S[i] == 'A'){
      if (S[i+1] == 'C'){
        printf("Yes\n");
        return 0;
      }
    }
  }
  printf("No\n");
}

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

using namespace std;

int main(void) {
	int d;
	cin >> d;
	if (d == 25) {
		cout << "Christmas";
	}
	else if (d == 24) {
		cout << "Christmas Eve";
	}
	else if (d == 23) {
		cout << "Christmas Eve Eve";
	}
	else if (d == 22) {
		cout<< "Christmas Eve Eve Eve";
	}
	return 0;
}

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

int a, b, c, x, y;

int ans;

int main(void){
  scanf("%d %d %d %d %d", &a, &b, &c, &x, &y);

  int ab = min(a + b, c * 2);

  if (x == y) {
    ans = x * ab;
  }
  else if (x > y) {
    ans = y * ab;
    int na = min(a, c * 2);
    ans += na * (x - y);
  }
  else if (x < y) {
    ans = x * ab;
    int nb = min(b, c * 2);
    ans += nb * (y - x);
  }

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

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ans = 1
if n%2 == 1:
    for i in range(n):
        if a[i] != ((i+1)//2)*2:
            ans = 0
            break
        elif i %2 == 0 and i != 0:
            ans = (ans * 2)%(10**9+7)
else:
    for i in range(n):
        if a[i] != (i//2)*2+1:
            ans = 0
            break
        elif i %2 == 1:
            ans = (ans * 2)%(10**9+7)

print(ans)

Measured memory_bytes: 13880
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;
list<long long int> Prime(int M) {
	list<long long int>P;
	P.push_back(2);
	P.push_back(3);
	for (int i = 5; i <= M; i += 6) {
		bool flag = true;
		for (auto j : P) {
			if (i%j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i);
		flag = true;
		for (auto j : P) {
			if ((i + 2) % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i + 2);
	}
	return P;
}

long long int N, M, K, Q, W, H;
long long int ans;

int main() {
	ios::sync_with_stdio(false);
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> M;
		ans = max(ans, M);
	}
	cout << max((long long int)0, ans - (N - ans) - 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;

typedef long long int llint;

int main(){
	int N;
	cin >> N;
	llint A[N+1+1];
	llint B[N+1];
	for(int i=1;i<=N+1;i++){
		cin >> A[i];
	}
	for(int i=1;i<=N;i++){
		cin >> B[i];
	}

	llint cnt=0;
	for(int i=1;i<=N;i++){
		if(A[i]>B[i]){
			cnt+=B[i];
			A[i]-=B[i];
			B[i]=0;
		}else{
			cnt+=A[i];
			B[i]-=A[i];
			A[i]=0;
			if(A[i+1]>B[i]){
				cnt+=B[i];
				A[i+1]-=B[i];
				B[i]=0;
			}else{
				cnt+=A[i+1];
				B[i]-=A[i+1];
				A[i+1]=0;
			}
		}
	}

	cout << cnt << endl;
	return 0;
}


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

typedef struct node{
  struct node *left;
  struct node *right;
  struct node *parent;
  int key;
}Node;
typedef Node *NodePointer;

NodePointer createNode(void);
void inorder(NodePointer);
void preorder(NodePointer);
void insert(int);
NodePointer find(int, NodePointer);
void delete(NodePointer);
NodePointer minimum(NodePointer);
NodePointer successor(NodePointer);
NodePointer root = NULL;

int main(){

  int i, n, x;
  char str[10];

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%s", str);
    if(str[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    }else if(str[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }else if(str[0] == 'f'){
      scanf("%d", &x);
      if(find( x, root) == NULL){
	printf("no\n");
      }else{
	printf("yes\n");
      }
    }else if(str[0] == 'd'){
      scanf("%d", &x);
      delete(find(x, root));
    }else{
      continue;
    }
  }
  return 0;
}

NodePointer createNode(void){

  NodePointer tree = malloc(sizeof(Node));
  tree->left = NULL;
  tree->right = NULL;
  tree->parent = NULL;
  tree->key = 0;

  return tree;
}

void insert(int key){

  NodePointer z = createNode();
  NodePointer x = root;
  NodePointer y = NULL;
  z->key = key;
  while(x != NULL){
    y = x;

    if(z->key < x->key){
      x = x->left;
    }else{
      x = x->right;
    }
  }

  z->parent = y;

  if(y == NULL){
    root = z;
  }else if(z->key < y->key){
    y->left = z;
  }else{
    y->right = z;
  }
}

void inorder(NodePointer T){

  if(T != NULL){
    inorder(T->left);
    printf(" %d",T->key);
    inorder(T->right);
  }
}

void preorder(NodePointer T){

  if(T != NULL){
  printf(" %d", T->key);
    preorder(T->left);
    preorder(T->right);
  }
}

NodePointer find(int k, NodePointer T){

  while(T != NULL && T->key != k){
    if(T->key > k){
      T = T->left;
    }else{
      T = T->right;
    }
  }
  return T;
}

void  delete(NodePointer T){

  NodePointer x;
  NodePointer y;

  if(T->left == NULL || T->right == NULL){ // 子がいる時
    x = T;
  }else{ // 子がいない時
    x = successor(T);
  }
  if(x->left != NULL){
    y = x->left;
  }else{
    y = x->right;
  }

  if(y != NULL){ // 子の子があるとき
    y->parent = x->parent;
  }

  if(x->parent == NULL){
    root = y;
  }else if(x == x->parent->left){
    x->parent->left = y;
  }else{
    x->parent->right = y;
  }
  if(x != T){
    T->key = x->key;
  }
}

NodePointer minimum(NodePointer T){
  while(T->left != NULL){
    T = T->left;
  }
  return T;
}

NodePointer successor(NodePointer T){
  NodePointer x;
  if(T->right != NULL){
    return minimum(T->right);
  }
  x = T->parent;

  while(x != NULL && T == x->right){
    T = x;
    x = x->parent;
  }
  return x;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int l,r; cin>>l>>r;
	int limit=min(r,l+2019);
	uint64_t ans=UINT64_MAX;
	for(int i=l;i<=limit;++i){
		for(int j=i+1;j<=limit;++j){
			ans=min(ans,(uint64_t)i*j%2019);
		}
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define gt(n) scanf("%d", &n)
#define gtll(n) scanf("%ld", &n)
#define out(n) printf("%d", n)
#define outll(n) printf("%ld", n)
#define loop(n) for(int i=0; i<n; i++)
#define MAXX 1001
#define mem(x, y) memset(x, y, sizeof(x))
#define loop1(n) for(int i=1; i<=n; i++)
#define ll long long
#define pb push_back
#define pi acos(-1)
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
//(only in c)char[33];itoa(n,buffer,base);printf("%s",buffer);
#define dec_to_bin(n) std::string binary = std::bitset<64>(n).to_string();
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int con(char a)
{
    return a-'0';
}
int main()
{
    fast;
    string s;
    cin>>s;
    int fi=(con(s[0])*10+con(s[1]));
    int last=(con(s[2])*10+con(s[3]));
    if((fi>=1&&fi<=12)&&(last>=1&&last<=12))
    {
        cout<<"AMBIGUOUS"<<endl;
    }
    else if((fi>=1&&fi<=12)&&(last<1||last>12))
    {
        cout<<"MMYY"<<endl;
    }
    else if((fi<1||fi>12)&&(last>=1&&last<=12))
    {
        cout<<"YYMM"<<endl;
    }
    else cout<<"NA"<<endl;

    return 0;
}


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

int main() {
	int a,b;
	int S=0,T=0;
	for (int i = 1; i <= 4; i++){
		cin>>a;
		S=S+a;
		
	}

	for (int i = 1; i <= 4; i++){
		cin>>b;
		T=T+b;
	}
	
	if(S>T){
		cout<<S<<endl;
	} else if(S<=T){
		cout<<T<<endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int n, m; double l[20], a[20], b[20];
int popcount(int x) {
	int ret = 0;
	for (int i = 0; i < 20; i++) {
		if (x & (1 << i)) ret++;
	}
	return ret;
}
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) scanf("%lf%lf%lf", &l[i], &a[i], &b[i]);
	double ret = 0.0;
	for (int i = 0; i < (1 << n); i++) {
		if (popcount(i) == m) {
			double res = 0.0;
			for (int j = 0; j < n; j++) {
				for (int k = j + 1; k < n; k++) {
					if ((i & (1 << j)) && (i & (1 << k))) {
						res += (l[j] - l[k]) * (l[j] - l[k]) + (a[j] - a[k]) * (a[j] - a[k]) + (b[j] - b[k]) * (b[j] - b[k]);
					}
				}
			}
			ret = max(ret, res);
		}
	}
	printf("%.9f\n", ret);
	return 0;
}

Measured memory_bytes: 2748
N = int(input())
A = list(map(int, input().split()))

num_1=0
num_2=0
num_4=0

for i in range(N):
        if A[i] % 4 == 0:
                num_4+=1
        elif A[i] %2 == 0:
                num_2+=1
        else:
                num_1+=1

if num_2 == 0:
        if num_1 <= num_4+1:
                print("Yes")
        else:
                print("No")

else:
        if num_1 <= num_4:
                print("Yes")
        else:
                print("No")

Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
struct node
{
    double w , v , u ;
};
vector <node> list ;
bool cmp(node A,node B)
{
    return A.v / A.w > B.v / B.w ;
}
int main()
{
    //freopen("input.txt","r",stdin);
    int N ;
    double W ;
    while(scanf("%d%lf",&N,&W)==2)
    {
        list.clear();
        double ans = 0.0 ;
        for(int i=0;i<N;i++)
        {
            node obj ;
            scanf("%lf%lf",&obj.w,&obj.v);
            obj.u = obj.v / obj.w ;
            if(obj.w<=0&&obj.v>=0) { W-=obj.w; ans+=obj.v; continue ; }
            if(obj.w>=0&&obj.v<=0) continue ;
            if(obj.w<=0&&obj.v<=0) { W-=obj.w; ans+=obj.v; obj.w*=-1.0; obj.v*=-1.0; }
            list.push_back(obj);
        }
        sort(list.begin(),list.end(),cmp);
        for(int i=0;i<list.size();i++)
        {
            if(list[i].w<=W)
            {
                W-=list[i].w;
                ans+=list[i].v;
            }
            else
            {
                ans+=list[i].u*W;
                W=0.0;
            }
        }
        printf("%.8lf\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1416
s = gets.chomp
until s.empty?
  if s.end_with?("dream") || s.end_with?("erase")
    s.slice!(-5..-1)
  elsif s.end_with?("eraser")
    s.slice!(-6..-1)
  elsif s.end_with?("dreamer")
    s.slice!(-7..-1)
  else
    puts "NO"
    exit
  end
end
puts "YES"

Measured memory_bytes: 1916
import sys
input = sys.stdin.readline

mod = 10**9+7

N = int(input())
C = list(map(int, input().split()))

C.sort(reverse=True)

A = [1]
for _ in range(N):
    A.append(A[-1]*2%mod)

t = C[0]*A[N-1] % mod
for k in range(1, N):
    t = (t + C[k]*(A[N-1]+k*A[N-2])%mod) % mod
print(t*A[N]%mod)

Measured memory_bytes: 27116
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

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


signed main(void) {
    int n;
    cin >> n;
    vi a(n,0);
    vi in(n);
    rep(i,n){
        cin >> in[i];
        in[i]--;
        a[in[i]]++;
    }
    //rep(i,n)cout << " " << a[i];cout << endl;
    vi ans(n,0);
    rep(i,n)ans[i] = a[i]*(a[i]-1)/2;
    //rep(i,n)cout << " " << ans[i];cout << endl;
    int sum = 0;
    rep(i,n)sum += ans[i];
    rep(i,n){
        int t = in[i];
        cout << sum - ans[t] + (a[t]-1)*(a[t]-2)/2 << endl;;
    }
}


Measured memory_bytes: 7296
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int isConsist(char* str, char* key, int keyLen){
    int flag = 1;
    for(int i = 0; i < 80 - keyLen; i++){
        flag = 1;
        for(int j = 0; j < keyLen; j++){
            if(str[i+j] != key[j]){
                flag = 0;
                break;
            }
        }
        if(flag)
            return 1;
    }
    return 0;
}
 
 
int main(int argc, char **argv){
    char strIn[81] = {};
    while(scanf("%[^\n]%*c", strIn) != EOF){
        for(int offset = 0; offset < 26; offset++){
            for(int i = 0; i < 80; i++){
                if('a' <= strIn[i] && strIn[i] <= 'z'){
                    strIn[i]++;
                    if(strIn[i] > 'z')
                        strIn[i] -= 26;
                }
            }
            if(isConsist(strIn, "the", 3) || isConsist(strIn, "this", 4) || isConsist(strIn, "that", 4)){
                printf("%s\n", strIn);
                break;
            }
        }
    }
    return 0;
}  


Measured memory_bytes: 2032
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

void solve(ll a, string s) {
  cout << (a>=3200 ? s : "red") << endl;
}

int main() {
  ll a;
  cin >> a;
  string s;
  cin >> s;
  solve(a, s);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
 
        int n = in.nextInt();
        int[] p = new int[n];
        for(int i = 0; i < n; i++) {
            p[i] = in.nextInt();
        }
        int ans = 0;
        for(int i = 0; i < n; i++) {
            if(p[i] == i + 1) {
                ans++;
                i++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 51316
#include<iostream>
using namespace std;
 
int main(){
  char c[3][3];
 
  for(int i=0; i< 3; i++){
	  cin >> c[i][0] >> c[i][1] >> c[i][2];
  }

  cout << c[0][0] << c[1][1] << c[2][2] << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<cmath>
using namespace std;
char a[101],b[101];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
	}
	for(int i=1;i<=n;i++)
	{
		cout<<a[i];
		cout<<b[i];
	}
	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.List
main :: IO ()
main = readLn >>= main'
    where
        main' n = readLn >>= print . solve n

solve :: Int -> Int -> Int
solve n k = foldl' ff 1 $ replicate n 0
    where
        ff acc _
            | acc > k = acc + k
            | otherwise = acc * 2


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

int main() {
  string N;

  cin >> N;

  if(N.at(0)==N.at(1)&&N.at(1)==N.at(2) || N.at(1)== N.at(2)&&N.at(2)==N.at(3)) cout << "Yes" << endl;
  else cout << "No" << endl;
}





Measured memory_bytes: 256
#include <stdio.h>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
using namespace std;

int main(){
    long long a,b,n;
    cin>>a>>b>>n;
    long long x;
    long long pre, las;
    if(b>n){
        x = n;
    }else{
        x = b-1;
    }
    pre = a*x/b;
    las = x/b;
    cout<<pre - a*las<<endl;
    return 0;
}


Measured memory_bytes: 3588
# N人の生徒を分けて 3 人以上のグループの数を最大化
# 3人以上のグループを最大で x 個作れるとき x を出力

# 入力値を数値に変換
N = int(input())

# 3で割った時の整数の商をxとして出力
x = N // 3
print(x)

Measured memory_bytes: 9000
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

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

  vector<int> a(n);
  cin >> a;
  sort(all(a));

  vector<int> b(n);
  cin >> b;

  vector<int> c(n);
  cin >> c;
  sort(all(c));
  // cout << endl << a << endl << b << endl << c << endl;

  ll ans = 0;
  rep(i, n) {
    int it = lb(a, b[i]);
    it--;
    int tmp = (it == -1 ? -1 : it + 1);

    it = ub(c, b[i]);
    int tmp2 = (it == n ? -1 : (n - it));

    // cout << tmp << " " << tmp2 << endl;
    if (tmp != -1 && tmp2 != -1) ans += 1LL * tmp * tmp2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  a, b = map(int, readline().split())
  if a<=8 and b<=8:
    print('Yay!')
  else:
    print(':(')
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5248
//Red and Black
#include<iostream>
#include<stdlib.h>
#include<queue>
using namespace std;
const int MAX_M = 100;
int W, H;
char rect[MAX_M][MAX_M];
int res[10000];
int counts = 0;
int dx[4] = { 0,1,0,-1 };
int dy[4] = { -1,0,1,0 };
void solve(int sx, int sy,char vp) {
	rect[sx][sy] = 'X';
	
	for (int i = 0; i<4; i++) {

		int nx = sx + dx[i];
		int ny = sy + dy[i];
		if (nx >= 0 && nx < W&&ny >= 0 && ny < H&&rect[nx][ny] == vp)
			solve(nx, ny,rect[nx][ny]);
	}

}
int main() {
	while (true) {
		cin >> W >> H;
		if (W == 0 || H == 0)
			break;
		for (int i = 0; i < W; i++)
			for (int j = 0; j < H; j++)
				cin >> rect[i][j];
		for(int i=0;i<W;i++)
			for (int j = 0; j < H; j++) {
				if (rect[i][j] != 'X') {
					solve(i, j, rect[i][j]);
					res[counts]++;
				}
			}
		for (int i = 0; i < W; i++)
			for (int j = 0; j < H; j++)
				rect[i][j] = '\0';
		counts++;
	}
	for (int i = 0; i < counts; i++) {
		cout << res[i] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3480
import java.util.*;

public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        // 整数の入力
        // final int a = sc.nextInt();
        // 文字列の入力
        // final String s1 = sc.next();
        final int d = sc.nextInt();
        final int n = sc.nextInt();
        sc.close();
        double result = 0;
        int nn = n;
        if (nn == 100) {
            nn = 101;
        }
        if (d == 0) {
            result = nn;
        } else {
            result = nn * Math.pow(100, d);
        }

        System.out.println((int) result);
    }
}


Measured memory_bytes: 23764