akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int main(){
  int n,i;
  int a[200006];
  int cnt = 1;

  scanf("%d", &n);

  for(i = 1;i <= n;i++) scanf("%d", &a[i]);

  i = 1;
  while(i <= n){
    if(a[i] == cnt){
      cnt++;
    }

    i++;
  }

  if(cnt == 1) printf("-1\n");

  else printf("%d\n", n - cnt + 1);

  return 0;
}


Measured memory_bytes: 896
solver::[Int]->Int
solver = sum.(map (div2 0))

div2::Int->Int->Int
div2 store n = if mod n 2 == 0 then div2 (store+1) (div n 2) else store

main::IO()
main=do
  _<-getLine
  ss<-getLine
  let ls = map read (words ss)::[Int]
  print (solver ls)


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

int n;

int main() {
  cin >> n;
  vector<float> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  sort(v.begin(), v.end());
  
  float ans = 0;
  for (int i = 0; i < n; ++i) {
    if (ans == 0) ans += v[i];
    else ans = (ans + v[i]) / 2.0;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
x[37];main(a,b,c,d){for(a=0;a<=9;a++)for(b=0;b<=9;b++)for(c=0;c<=9;c++)for(d=0;d<=9;d++)x[a+b+c+d]++;for(;~scanf("%d",&a);printf("%d\n",x[a]));exit(0);}

Measured memory_bytes: 592
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;





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

	int N;
	cin >> N;
	vector<ll> sum(N + 1);
	sum[0] = 0;
	int nonpos_cnt = 0;
	int mn = 1000000000;
	REP(i, N) {
		int a;
		cin >> a;
		if (a <= 0) {
			nonpos_cnt++;
			a = -a;
		}
		mn = min(mn, a);
		sum[i + 1] = sum[i] + a;
	}
	ll res = sum[N];
	if (nonpos_cnt % 2) res -= 2 * mn;
	cout << res << "\n";
	
	return 0;
}

Measured memory_bytes: 1024
<?php

while ($n = trim(fgets(STDIN))) {
    $score = array('a' => 0, 'b' =>0);
    for ($i = 0; $i < $n; $i++) {
        list($a_cards[], $b_cards[]) = explode(' ', trim(fgets(STDIN)));
    }

    for ($i = 0; $i < $n; $i++) {
        $a_card = array_shift($a_cards);
        $b_card = array_shift($b_cards);
        if($a_card == $b_card) {
            $score['a'] += $a_card;
            $score['b'] += $b_card;
        } elseif($a_card > $b_card) {
            $score['a'] += $a_card + $b_card;
        } else {
            $score['b'] += $a_card + $b_card;
        }
    }
    echo implode(' ', $score).PHP_EOL;
}


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

int main()
{
  int N;
  cin >> N;
  vector<int> a(N);
  for (auto & _a : a)
    cin >> _a;
  sort(a.begin(), a.end());
  cout << a[N - 1] - a[0];
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b;
void solve()
{
    cin>>a>>b;
    cout<<a*b<<endl;
}

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

//    int t;
//    cin >> t;
//    for(int i=1; i<=t; ++i)
//    {
//        cout<< "Case #" << i << ":";
       solve();
//    }
}


Measured memory_bytes: 3656
using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();

            var strer = str.Split(' ');

            int x = int.Parse(strer[0]);
            int y = int.Parse(strer[1]);

            int result = 0;
           
            if (x < y)
            {
                int temp = x;
                x = y;
                y = temp;
            }


            for (int i = 1; i <= y; i++)
            {
                if ((y % i) == 0 && (x % i) == 0)
                {
                    result = i;
                }
            }

            Console.WriteLine(result);
                     
        }
    }
}



Measured memory_bytes: 17932
<?php
    $slideNum = trim(fgets(STDIN));
    $strArr = str_split(trim(fgets(STDIN)));
    $alph = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');

    $keyNumsArr = [];
    for($i=0; $i<count($strArr); $i++){
        foreach($alph as $keyNum => $text){
            if($strArr[$i] == $text){
                $keyNum += +$slideNum;
                if($keyNum > 25){
                    $keyNum -= 26;
                }
                $keyNumsArr[] = $keyNum;
            }
        }
    }

    $ansStr = '';
    for($j=0; $j<count($keyNumsArr); $j++){
        $ansStr .= $alph[$keyNumsArr[$j]];
    }
    echo $ansStr;
?>

Measured memory_bytes: 6900
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 5e5+5;
const int INF = 0x3f3f3f3f;

int a[N];
bool vis[N];

int main()
{
    int n,m,pos,val;
	scanf("%d%d",&n,&m);
	
	bool f = 0;
	for(int i = 1;i <= m;++i){
		scanf("%d%d",&pos,&val);
		if(vis[pos]){
			if(val != a[pos]) f = 1;
			continue;
		}
		vis[pos] = 1;
		a[pos] = val;
	}
	if(f) printf("-1\n");
	else{
		if(n == 1) printf("%d",a[1]);
		else{
			if(!vis[1]) a[1] = 1;
			if(!a[1]) printf("-1\n");
			else{
				for(int i = 1;i <= n;++i) printf("%d",a[i]);
			}
		}
	}
    return 0;
}


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

typedef long long ll;

int main(){
  int N;
  cin >> N;
  vector<long> candidate;
  map<long, int> m;
  // 同じ長さの棒が2本以上あるものをピックアップして、
  // 長い方から4本持ってくる
  for(int i = 0; i < N; i++){
    long tmp;
    cin >> tmp;
    
    if(m.count(tmp) == 0){
      m[tmp] = 1;
    } else {
      m[tmp] += 1;
      if(m[tmp] == 2 || m[tmp] == 4){
      	candidate.push_back(tmp);
      }
    }
  }
  sort(candidate.begin(), candidate.end());
  
  long ans;
  if(candidate.size() < 2){
    ans = 0;
  } else { 
    ans = candidate[candidate.size()-1] * candidate[candidate.size() -2];
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 1010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll dp[101010];
ll d[101];

//long longしか使わない
//素数は1より大きい
int main() {
	ll n;
	cin >> n;
	vector<ll>a(n);
	vector<vector<ll>>shogen(n);
	rep(i, n) {
		cin >> a[i];
		shogen[i].resize(n);
		rep(j, n) {
			shogen[i][j] = -1;
		}
		rep(j, a[i]) {
			ll x, y;
			cin >> x >> y;
			x--;
			shogen[i][x] = y;
		}
	}
	ll ans = 0;
	for (ll bit = 0;bit < (1 << n);++bit) {
		bool flag = true;
		ll res = 0;
		for (ll i = 0;i < n;++i) {
			if (bit & (1 << i)) {
				res++;
				rep(j, n) {
					if (shogen[i][j] == 0) {
						if (bit & (1 << j))flag = false;
					}
					else if (shogen[i][j] == 1) {
						if (bit & (1 << j))continue;
						flag = false;
					}
				}
			}
		}
		if (flag) {
			ans = max(ans, res);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
def main():
    N, A = map(int, input().split())
    *X, = map(int, input().split())

    ans = editorial_3d(N, A, X)
    # ans2 = editorial_2d(N, A, X)
    # assert ans == ans2
    if N <= 16:
        ans3 = part(N, A, X)
        assert ans == ans3

    print(ans)


def editorial_3d(N, A, X):
    """
    dp[N][N][sum]
    N枚の選択肢, N枚選ぶ, 合計値
    """
    max_sum = N * A
    dp = [[None] for _ in range(N+1)]
    for i in range(N+1):
        tmp = [[0] * (max_sum + 1) for _ in range(N+1)]
        dp[i] = tmp
    dp[0][0][0] = 1

    for i in range(1, N+1):
        for j in range(0, N+1):
            for k in range(max_sum + 1):
                v = dp[i-1][j][k]
                if k >= X[i-1] and j >= 1:
                    v += dp[i-1][j-1][k - X[i-1]]

                dp[i][j][k] = v

    ans = 0
    for j in range(1, N+1):
        if j * A <= max_sum:
            ans += dp[N][j][j * A]

    return ans


def editorial_2d(N, A, X):
    """TODO
    dp[N][sum]
    N枚の選択肢, 合計値
    """
    max_sum = N * A
    dp = [[0] * (2 * max_sum + 1) for _ in range(N+1)]
    dp[0][0] = 1

    for i in range(1, N+1):
        for k in range(max_sum, 2 * max_sum + 1):
            v = dp[i-1][k]
            if k >= X[i-1] - A:
                v += dp[i-1][k - X[i] - A]

            dp[i][k] = v

    ans = 0
    for j in range(1, N+1):
        ans += dp[j][0]

    return ans


def part(N, A, X):
    import sys
    sys.setrecursionlimit(10 ** 7)
    a = [0] * N

    def rec(i, n):
        ans = 0
        if i == n:
            s = 0
            c = 0
            # print(a)
            for j, b in enumerate(a):
                if b == 1:
                    s += X[j]
                    c += 1

            if c == 0:
                return 0
            if s / c == A:
                return 1
            else:
                return 0

        a[i] = 0
        ans += rec(i + 1, n)
        a[i] = 1
        ans += rec(i + 1, n)

        return ans

    ans = rec(0, N)
    return ans


if __name__ == '__main__':
    main()


Measured memory_bytes: 91868
foods = [int(input()) for i in range(5)]
time = 0
rest = list(map(lambda x: x % 10, foods))
for i in range(5):
    if rest[i] == 0:
        time += foods[i]
    else:
        time += foods[i] - rest[i] + 10

if any(rest):
    print(time - 10 + min([i for i in rest if i != 0]))
else:
    print(time)

Measured memory_bytes: 3060
package main

import "fmt"

func main() {
	var S string
	var cnt int
	fmt.Scan(&S)
	var w rune
	for _, v := range S {
		if w != v {
			cnt++
		}
		w = v
	}
	if cnt <= 1 {
		fmt.Println("0")
	} else {
		fmt.Println(cnt - 1)
	}
}

Measured memory_bytes: 1280
N,T = [int(x) for x in raw_input().split(" ")]

A = [int(x) for x in raw_input().split(" ")]

mx = -1e10
cnt = 0
X = []

for i in range(len(A)):
	mx = max(A[-i-1],mx)
	
	dif = mx - A[-i-1]
	
	X.append(dif)



mxx = max(X)

for i in X:
	if i == mxx:
		cnt += 1

print cnt

Measured memory_bytes: 12840
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define repd(i,a,b) for (ll i = (a); i < (b); i++)
#define INF LLONG_MAX
#define mod 1000000007
typedef long long ll;
int main(void)
{
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	rep(i,N) cin >> A.at(i);
	int goukei = accumulate(A.begin(), A.end(), 0);
	double judge = (double)goukei/(4*M);
	int count = 0;
	rep(i,N) if(A.at(i)>=judge) count++;
	if(count<M) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
long long a,b,pw,res,aa,bb;
bool x[50],y[50],ans[50],x1,x2,y11,y2;
int sz1,sz2;
int main(){
	cin>>a>>b;
	aa=a,bb=b;
	if(a==b)
	{
		cout<<a;
		return 0;
	}
	for(int i=1;aa;i++)
		x[i]=aa%2,aa>>=1,sz1++;
	for(int i=1;bb;i++)
		y[i]=bb%2,bb>>=1,sz2++;
	for(int i=1;i<=max(sz1,sz2);i++)
		ans[i]=x[i]^y[i];
	x1=x[2],x2=x[1],y11=y[2],y2=y[1];
	if(x1==0&&x2==0&&y11==0&&y2==0)
	{
		cout<<b;
		return 0;
	}
	if(x1==0&&x2==0&&y11==0&&y2==1)
	{
		cout<<1;
		return 0;
	}
	if(x1==0&&x2==0&&y11==1&&y2==0)
	{
		cout<<b+1; 
		return 0;
	}
	if(x1==0&&x2==0&&y11==1&&y2==1)
	{
		cout<<0;
		return 0;
	}
	if(x1==0&&x2==1&&y11==0&&y2==0)
	{
		ans[1]=ans[2]=0;
		pw=1;
		for(int i=1;i<=max(sz1,sz2);i++,pw*=2ll)
		{
			if(ans[i])
				res+=pw;
		}
		cout<<res;
		return 0;
	}
	if(x1==0&&x2==1&&y11==0&&y2==1)
	{
		cout<<a;
		return 0;
	}
	if(x1==0&&x2==1&&y11==1&&y2==0)
	{
		pw=1;
		for(int i=1;i<=max(sz1,sz2);i++,pw*=2ll)
		{
			if(ans[i])
				res+=pw;
		}
		cout<<res;
		return 0;
	}
	if(x1==0&&x2==1&&y11==1&&y2==1)
	{
		cout<<a-1;
		return 0;
	}
	if(x1==1&&x2==0&&y11==0&&y2==0) 
	{
		cout<<b+1;
		return 0;
	}
	if(x1==1&&x2==0&&y11==0&&y2==1)
	{
		cout<<0;
		return 0;
	}
	if(x1==1&&x2==0&&y11==1&&y2==0)
	{
		cout<<b;
		return 0;
	}
	if(x1==1&&x2==0&&y11==1&&y2==1)
	{
		cout<<1;
		return 0;
	}
	if(x1==1&&x2==1&&y11==0&&y2==0)
	{
		pw=1;
		for(int i=1;i<=max(sz1,sz2);i++,pw*=2ll)
		{
			if(ans[i])
				res+=pw;
		}
		cout<<res;
		return 0;
	}
	if(x1==1&&x2==1&&y11==0&&y2==1)
	{
		cout<<a-1;
		return 0;
	}
	if(x1==1&&x2==1&&y11==1&&y2==0)
	{
		ans[1]=ans[2]=0;
		pw=1;
		for(int i=1;i<=max(sz1,sz2);i++,pw*=2ll)
		{
			if(ans[i])
				res+=pw;
		}
		cout<<res;
		return 0;
	}
	if(x1==1&&x2==1&&y11==1&&y2==1)
	{
		cout<<a;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
int main()
{
    using namespace std;
    long long N, K;
    long long num(0);
    cin >> N >> K;
    if (K == N + 1)
        num = 1;
    else
    {
        for (long long i = K; i <= N + 1; i++)
        {
            num += ((i * (2 * N - i + 1) / 2) - (i * (i - 1) / 2) + 1);
        }
    }
    cout << num % 1000000007 << endl;
}

Measured memory_bytes: 3636
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for _ in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))


def solve(a):
    return a + pow(a, 2) + pow(a, 3)


if __name__ == "__main__":
     a = int_in()
     out(solve(a))

Measured memory_bytes: 61840
#include <stdio.h>

int main(void) {
 long int A, B, K;
  scanf("%ld", &A);
  scanf("%ld", &B);
  scanf("%ld", &K);
  if (A >= K)
    A -= K;
  else if (A + B >= K) {
    K -= A;
    A = 0;
    B -= K;
  } else
    A = B = 0;
  printf("%ld %ld\n", A, B);
  return 0;
}

Measured memory_bytes: 1712
#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() {
    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    int point = 0, ans = 1;
    rep(i, n) {
    	point += l[i];
    	if (point <= x) ++ans;
    	else break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import math

a, b = map(int, input().split())

for i in range(1, 1300):
    if math.floor(i * 0.08) > 100:
        break
    if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
        print(i)
        exit()

print(-1)

Measured memory_bytes: 3060
def readinput():
    n,m=map(int,input().split())
    x=list(map(int,input().split()))
    return n,m,x

def main(n,m,x):
    if m<=n:
        return 0
    xs=sorted(x)
    #print(xs)
    d=[]
    for i in range(m-1):
        d.append((xs[i+1]-xs[i],i+1))
    ds=sorted(d,reverse=True,key=lambda x:x[0])
    c=[0]*m
    for i in range(n-1):
        c[ds[i][1]]+=1
    #print(c)
    ans=0
    for i in range(1,m):
        if c[i]==0:
            ans+=xs[i]-xs[i-1]
    return ans

if __name__=='__main__':
    n,m,x=readinput()
    ans=main(n,m,x)
    print(ans)


Measured memory_bytes: 25864
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
#define PI 3.14159265359
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-------------------------------------------------
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	set<ll> st;
	ll i,j;
	for(i=1;i<=3;i++){
		cin>>j;
		st.insert(j);
	}
	if(st.size()==2){
		cout<<"Yes";
	}
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
N,X = map(int,input().split())
x = list(map(int,input().split()))

x.append(X)
x.sort()
ans = x[1]-x[0]
for i in range(1,N):
    ans = gcd(ans,x[i+1]-x[i])
print(ans)

Measured memory_bytes: 62576
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<math.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)

int main()
{
   
    string s;
    int k;
    cin >> k >> s;
    if (s.size() <= k)
    {
        cout << s << "\n";
    }
    else
    {
        rep(i, k) cout << s[i];
        cout << "..." << "\n";
    }


    return 0;
}

Measured memory_bytes: 3620
open System

let readInt () = stdin.ReadLine() |> int
let readIntArray () = stdin.ReadLine().Split(' ') |> Array.map int

let input = readIntArray ()
let a = input . [0]
let b = input . [1]

let solve () : unit = 
    printfn "%s" <| if (a * b) % 2 = 0 then "Even" else "Odd"

[<EntryPoint>]
let main argv = 
    solve()
    0


Measured memory_bytes: 11868
tmp = input().split()
a = int(tmp[0])
b = int(tmp[1])
c = int(tmp[2])
ans = 0
if a == b:
    if c % a == 0:
        ans += 1
else:
    for n in range(a,b + 1):
        if c % n == 0:
            ans +=1
        else:
            pass
print(ans)



Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;



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

	ll r,D,x;
	cin>>r>>D>>x;
	rep(i,0,10) {
		x=r*x-D;
		cout<<x<<"\n";
	}
}


Measured memory_bytes: 256
def examA():
    S = SI()
    if len(S)==3:
        ans = S[::-1]
    else:
        ans = S
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <cmath>
#include <cfloat>
#include <numeric>
 
//#include <bits/stdc++.h>

using namespace std;



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

 
    

       
   int n;
   cin >> n;
   int a,b;
   cin >> a >> b;
   
   for(int i=a; i<=b; i++){
       if(i%n==0){
           cout << "OK" << endl;
           return 0;
       }
           
   }

   cout << "NG";
   

    
    
    return 0;
}


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

const int NOT_VISITED = 1e9;
const int WALL = -1;

bool solve(vector<vector<int>>& m, queue<hw>& q, int H, int W, int gh, int gw) {
  array<int, 4> dh = {1, 0, -1, 0};
  array<int, 4> dw = {0, 1, 0, -1};

  while (!q.empty()) {
    int h = q.front().first, w = q.front().second;
    q.pop();
    rep(i, dh.size()) {
      int nh = h + dh[i], nw = w + dw[i];
      if (!(0 <= nh && nh < H && 0 <= nw && nw < W))
        continue;
      auto& next = m[nh][nw];
      if (next == WALL)
        continue;
      if (next == NOT_VISITED)
        q.emplace(nh, nw);
      next = min(next, m[h][w] + 1);
    }
  }

  return m[gh][gw] != NOT_VISITED;
}

int main() {
  int H, W;
  cin >> H >> W;

  vector<vector<int>> m(H, vector<int>(W, NOT_VISITED));
  int cnt = 0;
  rep(i, H) rep(j, W) {
    char c;
    cin >> c;
    if (c == '#')
      m[i][j] = WALL;
    else
      ++cnt;
  }

  int sh = 0, sw = 0, gh = H - 1, gw = W - 1;
  m[sh][sw] = 0;
  queue<hw> q;
  q.emplace(sh, sw);

  if (solve(m, q, H, W, gh, gw))
    cout << cnt - m[gh][gw] - 1 << endl;
  else
    cout << -1 << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, L int
	fmt.Scan(&n, &L)
	ar := make([]string, n)
	for i := range ar {
		fmt.Scan(&ar[i])
	}
	sort.Strings(ar)
	for _, v := range ar {
		fmt.Print(v)
	}
	fmt.Println()
}


Measured memory_bytes: 512
use std::io;
use std::io::Read;
fn main() {
    let mut buffer = String::new();
    io::stdin().read_to_string(&mut buffer).unwrap();
    let a = buffer.split_whitespace().map(|s| s.parse::<f64>().unwrap()).collect::<Vec<f64>>();
    println!("{}", (a[0] / a[1]).ceil());
}


Measured memory_bytes: 4352
#include <stdio.h>
#define min(a,b) a>b?b:a
int main()
{
    int n,k,ans=1,i;
    scanf("%d %d",&n,&k);
    for(i=0;i<n;i++)
        ans=min(ans*2,ans+k);
    printf("%d",ans);
}

Measured memory_bytes: 128
N = int(input())
P = [int(input()) for i in range(N)]


Q = sorted([(p, i) for i, p in enumerate(P, start=1)])
Q = [i for p, i in Q]

dp = [1] * (N + 1)
for i in range(1, N):
    if Q[i] > Q[i - 1]:
        dp[i] = dp[i - 1] + 1

print(N - max(dp))


Measured memory_bytes: 34012
#include<cstdio>
#include<vector>
using namespace std;
const int MAXN=2005;

int N,K;
vector<int> adj[MAXN];
int dep[MAXN],fa[MAXN],cnt;

void dfs(int u,int f,int lim)
{
    for(int i=0;i<(int)adj[u].size();i++)
    {
        int v=adj[u][i];
        if(v!=f)
        {
            dep[v]=dep[u]+1;
            if(dep[v]>lim)
                cnt++;
            dfs(v,u,lim);
        }
    }
}

int main()
{
    scanf("%d%d",&N,&K);
    for(int i=1;i<N;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    int ans=0x3F3F3F3F;
    if(K%2==0)
    {
        for(int i=1;i<=N;i++)
        {
            cnt=0;
            dep[i]=0;dfs(i,0,K/2);
            ans=min(ans,cnt);
        }
    }
    else
    {
        for(int i=1;i<=N;i++)
            for(int j=0;j<(int)adj[i].size();j++)
            {
                cnt=0;
                dep[i]=0;dfs(i,adj[i][j],K/2);
                dep[adj[i][j]]=0;dfs(adj[i][j],i,K/2);
                ans=min(ans,cnt);
            }
    }

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

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
inline char nchar() {
	static const int bufl=1<<20;
	static char buf[bufl],*a=NULL,*b=NULL;
	return a==b && (b=(a=buf)+fread(buf,1,bufl,stdin),a==b)?EOF:*a++;
}
inline int read() {
	int x=0,f=1;
	char c=nchar();
	for (;!isdigit(c);c=nchar()) if (c=='-') f=-1;
	for (;isdigit(c);c=nchar()) x=x*10+c-'0';
	return x*f;
}
const int maxn=2e3+10;
typedef vector<int> vec;
int n,a[maxn];
vec operator + (const vec &a,const vec &b) {
	vec ret(a.size()+b.size());
	copy(b.begin(),b.end(),copy(a.begin(),a.end(),ret.begin()));
	return ret;
}
vec operator ^ (const vec &a,const vec &b) {
	vec ret(a.size()+b.size());
	vec::const_iterator ai=a.begin(),bi=b.begin();
	vec::iterator ri=ret.begin();
	while (ai!=a.end() || bi!=b.end()) {
		if (ai==a.end()) *ri++=*bi++; else
		if (bi==b.end()) *ri++=*ai++; else
		*ri++=*(*ai>*bi?(ai++):(bi++));
	}
	return ret;
}
namespace graph {
	vec g[maxn],f[maxn];
	bool vis[maxn];
	inline void add(int x,int y) {
		g[x].push_back(y);
		g[y].push_back(x);
	}
	void dfs(int x) {
		vis[x]=true;
		vec &fx=f[x];
		sort(g[x].begin(),g[x].end(),[](int x,int y)->bool{return a[x]<a[y];});
		for (const int &v:g[x]) g[v].erase(find(g[v].begin(),g[v].end(),x));
		for (const int &v:g[x]) if (!vis[v]) {
			dfs(v);
			fx=fx^f[v];
		}
		fx=vec(1,a[x])+fx;
	}
	vec work() {
		dfs(0);
		return f[0];
	}
}
int main() {
	n=read(),generate_n(a+1,n,read);
	for (int i=1;i<=n;++i) graph::add(0,i);
	for (int i=1;i<=n;++i) for (int j=i+1;j<=n;++j) if (__gcd(a[i],a[j])>1) graph::add(i,j);
	vec ans(graph::work());
	for (int i=1;i<=n;++i) printf("%d%c",ans[i]," \n"[i==n]);
	return 0;
}


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

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector< vector<long long int> > dp(n+1, vector<long long int>(m+1, 0));
	vector<long long int> d(n);
	vector<long long int> c(m);
	dp[0][0] = 0;
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> c[i];
	}
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++) {
			if (dp[j][i-1] == 0) {
				if (dp[j-1][i-1] == 0) {
					if (j-1 == 0) {
						dp[j][i] = d[j-1]*c[i-1];
					}
				} else {
					dp[j][i] = dp[j-1][i-1] + d[j-1]*c[i-1];
				}
			} else {
				dp[j][i] = min(dp[j][i-1], dp[j-1][i-1] + d[j-1]*c[i-1]);
			}
		}
	}
	cout << dp[n][m] << endl;
	return 0;
}

Measured memory_bytes: 7572
#include <stdio.h>

int main(void)
{
	int a,b,c,flag=0,falg=0;
	scanf("%d",&a);
	
	b=a/100;
	c=a%100;
	if(b<=12&&b>0)flag=1;
	if(c<=12&&c>0)falg=1;
	
	if(flag==1&&falg==1)printf("AMBIGUOUS\n");
	else if(flag==1&&falg==0)printf("MMYY\n");
	else if(flag==0&&falg==1)printf("YYMM\n");
	else printf("NA\n");
	return 0;
}


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

int main()
{
loop:
  int e, x, y, z, m = 1 << 30;
  cin >> e;
  if(!e)
    return 0;
  for(int z = 0; pow(z, 3) <= e; z++)
  {
    y = (int)sqrt(e - pow(z, 3));
    m = min(z + y + (int)(e - pow(z, 3) - pow(y, 2)), m); 
  }
  cout << m << endl;
  goto loop;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    vector<ll> fac(2005);
    vector<ll> inv(2005); 
    vector<ll> invfact(2005);
    fac[0] = 1; fac[1] = 1;
    for (ll i = 2; i < 2005; i++) {
        fac[i] = fac[i-1] * i % MOD;
    }

    inv[1] = 1;
    for (int i = 2; i < 2005; i++) {
        inv[i] = MOD - (MOD / i) * inv[MOD % i] % MOD;
    }

    invfact[0] = 1; invfact[1] = 1;
    for (ll i = 2; i < 2005; i++) {
        invfact[i] = invfact[i-1] * inv[i] % MOD;
    }

    ll N, K; cin >> N >> K;

    ll tmp;
    for (ll i = 1; i <= K; i++) {
        if(N-K+1 < i){
            printf("0\n"); continue;
        }
        if(K < i){
            printf("0\n"); continue;
        }
        tmp = fac[N-K+1] * invfact[i] % MOD;
        tmp = tmp * invfact[N-K-i+1] % MOD;
        tmp = tmp * fac[K-1] % MOD;
        tmp = tmp * invfact[i-1] % MOD;
        tmp = tmp * invfact[K-i] % MOD;
        printf("%lld\n", tmp % MOD);
    }

}


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

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

	cin >> N;
	string ans = "No";
	for (int i = 0; i < 3; i++)
	{
		if(N%10==7) ans = "Yes";
		N /=10;
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		long k = sc.nextLong();
		long aSum[] = new long[n];
		long bSum[] = new long[m];
		aSum[0] = sc.nextLong();
		for(int i = 1 ; i < n ; i++) {
			aSum[i] = aSum[i - 1] + sc.nextLong();
		}
		int max = 0;

		if(k >= aSum[0]) {
			for(int i = 1 ; i < n ; i++) {
				if(k < aSum[i]) {
					max = i;
                  break;
				}
				if(i == n - 1) {
					max = n;
				}

			}

		}

		for(int i = 0 ; i < m ; i++) {
			if(i == 0)
				bSum[0] = sc.nextLong();
			else {
			bSum[i] = bSum[i - 1] + sc.nextLong();
			}
			long test = k - bSum[i];
			if(test >= 0) {
				max = Math.max(i + 1 , max);
			for(int j = max - i - 1 >= 0 && max - i - 1 < n ? max - i - 1: n ; j < n && test >= aSum[j] ; j++) {
				max = Math.max(j + 1 + i + 1 , max);
			}
			}
		}



		System.out.println(max);

	}
}



Measured memory_bytes: 64232
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
const int maxn=500010;
int q=0,n=0;
struct Query{
    int id, l, r;
    bool operator< (Query a) const{
        return r < a.r;
    }
}query[maxn];
int v[maxn], sum[maxn], ans[maxn];
int lowbit(int x){
    return x & (-x);
}
void change(int i, int a){
    while(i <= n){
        sum[i]+=a;
        i+=lowbit(i);
    }
}
int getsum(int i){
    int sum_t = 0;
    while(i > 0){
        sum_t += sum[i];
        i -= lowbit(i);
    }
    return sum_t;
}
int main() {    
    scanf("%d", &n);
        memset(v, 0, sizeof(v));
        memset(sum, 0, sizeof(sum));
        memset(ans, 0, sizeof(ans));        
        int t = 0;scanf("%d", &q);
        for(int i = 1; i <= n; i++){
            scanf("%d", &v[i]);
        }        
        for(int i = 1; i <= q; i++){
            scanf("%d%d", &query[i].l, &query[i].r);
            query[i].id = i;
        }
        sort(query + 1, query + q + 1);        
        int pre = 1;
        map<int, int> mymap;
        for(int i = 1; i <= q; i++){
            for(int j=pre;j<=query[i].r;j++){
                if(mymap[v[j]]){
                    change(mymap[v[j]], -1);
                }
                mymap[v[j]]=j;
                change(j, 1);
            }
            pre=query[i].r+1;
            ans[query[i].id]=getsum(query[i].r) - getsum(query[i].l - 1);
        }    
        for(int i=1;i<=q;i++){
            cout<<ans[i]<<endl;
        }
    return 0;
}

Measured memory_bytes: 38960
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)
typedef long long ll;

// 配列初期化テンプレ
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}


int main() {

	int N, K;
	cin >> N >> K;

	vector<int> p(N);

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

	sort(p.begin(), p.end());

	int sum = 0;
	for (int i = 0; i < K; i++) {
		sum += p[i];
	}

	cout << sum << endl;

	return 0;

}


Measured memory_bytes: 3600
#include <iostream>
#include <math.h>
using namespace std;

int main(){
	double glam;
	while(cin>>glam){
		if(glam<=48.0)cout<<"light fly"<<endl;
		else if(glam>48.0&&glam<=51.0)cout<<"fly"<<endl;
		else if(glam>51.0&&glam<=54.0)cout<<"bantam"<<endl;
		else if(glam>54.0&&glam<=57.0)cout<<"feather"<<endl;
		else if(glam>57.0&&glam<=60.0)cout<<"light"<<endl;
		else if(glam>60.0&&glam<=64.0)cout<<"light welter"<<endl;
		else if(glam>64.0&&glam<=69.0)cout<<"welter"<<endl;
		else if(glam>69.0&&glam<=75.0)cout<<"light middle"<<endl;
		else if(glam>75.0&&glam<=81.0)cout<<"middle"<<endl;
		else if(glam>81.0&&glam<=91.0)cout<<"light heavy"<<endl;
		else cout<<"heavy"<<endl;
	}
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,i;cin>>n;vector<int>v;
  	for(i=1;i<=n;i++){
    	cin>>x;
    	if(x>i) {cout<<-1<<endl;return 0;}
    	v.insert(v.begin()+x-1,x);
  	}
  	for(auto it:v)cout<<it<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    for(int i = 1; i <= 9; ++i){
        if(N % i != 0) continue;
        int tmp = N / i;
        if(tmp <= 9){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-



def main():
  N = int(input())
  An = list(map(int, input().split()))

  Bn = [0 for _ in range(N)]
  while(True):
    for i in range(1,N):
      Bn[i] = (An[i-1]-Bn[i-1]//2)*2
    if (Bn[-1]+Bn[0])//2 == An[-1]:
      return Bn
    else:
      Bn[0] = An[-1]-Bn[-1]//2

if __name__ == "__main__":
  Bn = main()
  for b in Bn:
    print(b)

Measured memory_bytes: 65380
import java.util.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        double A = sc.nextDouble();
        double B = sc.nextDouble();
        
        BigDecimal C = new BigDecimal(String.valueOf(A));
        BigDecimal D = new BigDecimal(String.valueOf(B));
		BigDecimal F = new BigDecimal(String.valueOf(C.multiply(D)));

		BigDecimal G = F.setScale(0, RoundingMode.DOWN);
        System.out.println(G);
    }
}


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


int main(void)
{
	int n, m;

cin >> n >> m;
	
		int arr[m+100];
		int counter = 0;

		memset(arr, 0, sizeof(arr));

		for(int i = 0; i < n; i++)
		{
			int num;	cin >> num;

			for(int j = 0; j < num; j++)
			{
				int tmp;	cin >> tmp;
				arr[tmp]++;

				if(arr[tmp] == n)
					counter++;
			}
		}

		cout << counter << '\n';
	
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    long long r, d, x;
    cin >> r >> d >> x;

    int n = 10;
    for (int i = 0; i < n; ++i) {
        x = x * r - d;
        cout << x << "\n";
    }


    return 0;
}

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<vector<int>> dp(n+1, vector<int>(n+1,0));
    for(int i = n-1; i >= 0; i--){
        for(int j = n-1; j >= i; j--){
            if(s[i] == s[j]) dp[i][j] = min(dp[i+1][j+1]+1,j-i);
        }
    }
    int ans = 0;
    rep(i,n){
        rep(j,n) ans = max(ans,dp[i][j]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 98176
#include<stdio.h>

int main(void){
    int i=0;
    int x=0;
    
  do{
      scanf("%d",&x);
      i++;
      if(x==0){
          break;
      }else{
        printf("Case %d: %d\n",i,x);
      }
  }while(x!=0);
    
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

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


long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz");
char s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>s;
      if(s=='a' or s=='e' or s=='i' or s=='o' or s=='u')Cout("vowel");
      else Cout("consonant");
     

       
return 0;
}


Measured memory_bytes: 256
int_n = int(input())
li_s = list()
result = list()

for i in range(int_n):
    li_s.append(input())

min_word = sorted(li_s, key=lambda x: len(x))[0]

for w in sorted(set(min_word)):
    result += w * min([l.count(w) for l in li_s])

print("".join(result))


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <set>

using namespace std;

int bfs(int n, vector<set<int> > vs, vector<int> val,  set<int> s, int sum, int node) {
    set<int> a, b;
    int ret = sum;
    for (int i = node; i < n; i++) {
        a = s;
        b = vs[i];
        a.insert(b.begin(), b.end());
        if (a.size() == s.size() + b.size()) {
            ret = max(ret, bfs(n, vs, val, a, sum+val[i], i+1) );
        }
    }
    return ret;
}

int main(void){
    int n;
    while (cin>>n && n) {
        vector<set<int> > vs(n);
        vector<int> val(n);
        for (int i = 0; i < n; i++) {
            int m;
            cin >> m >> val[i];
            for (int j = 0; j < m; j++) {
                int a, b;
                cin >> a >> b;
                for (int k = a; k < b; k++) vs[i].insert(k);
            }
        }
        set<int> s;
        int ans = bfs(n, vs, val, s, 0, 0);
        cout << ans << endl;
    }
}

Measured memory_bytes: 3388
n = int(input())
h = list(map(int,input().split()))
count = [0]*n
i = 0
while i < n:
    j = i
    while j < n -1 and h[j] >= h[j+1]:
        count[i] += 1
        j += 1
    i += count[i] + 1
print(max(count))


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

int main()
{
	int A[4][4], N=0, b[101];
	cin >> A[1][1] >> A[1][2] >> A[1][3];
	cin >> A[2][1] >> A[2][2] >> A[2][3];
	cin >> A[3][1] >> A[3][2] >> A[3][3];
	cin >> N;

	for (int i = 1;i < N + 1;i++) {
		cin >> b[i];
		for (int j = 1; j <3 + 1; j++) {
			for (int k = 1; k <3 + 1; k++) {
				if (b[i] == A[j][k]) {
					A[j][k] = 0;
				}
			}
		}
	}

	bool result = false;

	if (A[1][1] == 0 && A[1][2] == 0 && A[1][3]==0) {
		result = true;
	}
	if (A[2][1] == 0 && A[2][2] == 0 && A[2][3]==0) {
		result = true;
	}
	if (A[3][1] == 0 && A[3][2] == 0 && A[3][3]==0) {
		result = true;
	}
	if (A[1][1] == 0 && A[2][1] == 0 && A[3][1]==0) {
		result = true;
	}
	if (A[1][2] == 0 && A[2][2] == 0 && A[3][2]==0) {
		result = true;
	}
	if (A[1][3] == 0 && A[2][3] == 0 && A[3][3]==0) {
		result = true;
	}

	if (A[1][1] == 0 && A[2][2] == 0 && A[3][3]==0) {
		result = true;
	}
	if (A[1][3] == 0 && A[2][2] == 0 && A[3][1]==0) {
		result = true;
	}

	// 出力
	if (result) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

typedef pair<int, int> P;
typedef long long ll;

int main()
{
	ll n, k;

	cin >> n >> k;

	ll mod = n % k;

	mod = min(mod, k - mod);

	cout << mod << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,a) REP(i,0,a)
#define REV(i,a,b) for(i=a;i>b;i--)
#define rev(s) reverse(s.begin(),s.end())
#define pb push_back
#define mp make_pair
#define ord(v) sort(v.begin(),v.end());
const ll MAXN=1e5+10;
#define MAX 2*1e9;
#define fi first
#define se second
int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	ll a,b,c,k;
	ll sum=0;
	cin>>a>>b>>c>>k;
	if(k<=(a+b)&&k>=a)
	{
		sum=a;
	}
	else 
		if(k<a)
		sum=k;
	else 
		sum=2*a-k+b;
	cout<<sum<<endl;



	
	return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    ll N,T; cin >> N >> T;
    vector<ll> t(N+1);
    REP(i,N){
        cin >> t[i];
    }
    t[N] = LINF;

    ll ans = 0;

    REP(i,N){
        ans += min(T,t[i+1]-t[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4680
#include <bits/stdc++.h>
using namespace std; 
typedef long long ll;
#pragma GCC optimize("O3")
#define pb push_back
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int cost[n+1];
    for (int i = 1 ; i<=n; ++i) {
		cin >> cost[i];
	}
    int dp[n+1];
    for (int  i = 1;i <=n ; ++i) {
		dp[i]=INT_MAX;
	}
	dp[1]=0;
    for (int i =1 ; i <=n ; ++i) {
		for ( int  j = 1 ; j <= k ;++j) {
			if ( i+j <= n) {
				dp[i+j]= min(dp[i+j],dp[i]+abs(cost[i+j]-cost[i])); 
			} 
		}
	}
	cout << dp[n];
}
// notes:
//1. Look for overflows ll vs int


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


const ll INF = 1e18;


int main() {
  ll n, m,l;
  cin >> n >> m>>l;
  vector<vector<ll>> dist(n,vector<ll>(n,INF));
  vector<vector<ll>> dist2(n,vector<ll>(n,INF));

  rep(i,m){
    ll a1,b1,c1;
    cin>>a1>>b1>>c1;
    a1--;b1--;
    dist[a1][b1]=c1;
    dist[b1][a1]=c1;
  }
  rep(k,n)rep(i,n)rep(j,n){
    dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
    if (dist[i][j]<=l)dist2[i][j]=1;
  }
  rep(k,n)rep(i,n)rep(j,n){
    dist2[i][j]=min(dist2[i][j],dist2[i][k]+dist2[k][j]);
  }
  ll q;cin>>q;
  rep(i,q){
    ll s1,t1;
    cin>>s1>>t1;
    s1--;t1--;
    if (dist2[s1][t1]==INF)cout<<-1<<endl;
    else cout<<(dist2[s1][t1]-1)<<endl;
  }

}


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

int main() {
  double a, b,c,d;
  cin >> a >> b >> c>>d;
 
  cout << fixed << setprecision(10);
  if(c == a/2 && d == b/2){
   cout << a*b/2 <<" " << "1" << endl;
  }
  else{
    cout << a*b/2 << " " << "0" << endl;
  }
}

Measured memory_bytes: 256
n, m, x = gets.split.map(&:to_i)

arr = []
n.times do |_|
  arr << gets.split.map(&:to_i)
end

ans = -1
(1..n).each do |i|
  arr.combination(i).each do |a|
    h = Array.new(m+1, 0)
    a.each do |b|
      b.each.with_index do |c, i|
        h[i] += c
      end
    end
    if h[1, m].min >= x && (h[0] < ans || ans == -1)
      ans = h[0]
    end
  end
end

p ans

Measured memory_bytes: 14420
#include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define sc(x) cin >> x
#define sc2(x, y) cin >> x >> y
#define sc3(x, y, z) cin >> x >> y >> z
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define debugn(i, n, a) rep(i, n)cout << " --- " << a[i] << "\n";
#define debugin(i, n, a) rep(i, n)printf(" --- %10d\n", a[i])
#define debugi2n(i, n, a, b) rep(i, n)printf(" --- %10d %10d\n", a[i], b[i])
#define debugiin(i, n, a) rep(i, n)printf(" --- %10d %10d\n", a[i].first, a[i].second)
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j;
  for(int testcase = 0;;testcase++){
    int2(h, w);
    string s;
    int res[w + 1];

    rep(i, h){
      res[0] = -1;
      sc(s);
      rep(j, w){
        if(s[j] == 'c')res[j + 1] = 0;
        else{
          if(res[j] == -1)res[j + 1] = -1;
          else res[j + 1] = res[j] + 1;
        }
      }

      rep1(j, w)printf("%d ", res[j]);
      printf("%d\n", res[j]);
    }


/*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 1228
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

n=int(input())
a=list(map(int,input().split()))
lst=[0]*n
for i in range(n):
    lst[a[i]]+=1

for i in range(n):
    if n%2==0:
        if i%2==0 and lst[i]!=0:
            break
        elif i%2==1 and lst[i]!=2:
            break
    else:
        if i%2==1 and lst[i]!=0:
            break
        elif i%2==0:
            if i==0:
                if lst[i]!=1:
                    break
            elif lst[i]!=2:
                break
else:
    print(pow(2,n//2,mod))
    exit()
print(0)

Measured memory_bytes: 78568
#include<cstdio>
#define reg register
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
static char buf[100000],*p1=buf,*p2=buf;
inline int read(void){
	reg bool f=false;
	reg char ch=getchar();
	reg int res=0;
	while(ch<'0'||'9'<ch)f|=(ch=='-'),ch=getchar();
	while('0'<=ch&&ch<='9')res=10*res+ch-'0',ch=getchar();
	return f?-res:res;
}

int n;

int main(void){
	reg int i;
	n=read();
	for(i=1;i<=9;++i)
		if(n%i==0&&1<=n/i&&n/i<=9)
			return puts("Yes"),0;
	puts("No");
	return 0;
}

Measured memory_bytes: 128