akhauriyash/Code-Regression huggingface dataset:
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
for i in range(d):
  s.append(list(map(int,input().split())))
last=[0]*26
score=0
solution=[]
for day in range(1,d+1):
  co=[]
  dla=[]
  down=0
  for (i,j) in zip(last,c):
    down+=(day-i)*j
  for (i,j) in zip(last,c):
    dla.append(down-(j*(day-i)))
  for con in range(26):
    co.append(s[day-1][con]-dla[con])
  choice=co.index(max(co))
  score+=co[choice]
  last[choice]=day
  #print(choice+1)
  #print(score)
  solution.append(choice)
#print(score)
stemp=2500
etemp=100
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.95:
  
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(1)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[day-i][j]
  try:
    prob = math.exp((sc-score)/tem())
  except:
    prob=0
  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    score=sc
    #print(score)
for i in solution:
  print(i+1)
#print(sco)


Measured memory_bytes: 10500
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000;

using ll = long long;
using namespace std;

int main(){
    int n, x;
    cin >> n >> x;

    int a[n];
    rep(i, n) cin >> a[i];

    sort(a, a+n);
    int max_child=0;
    rep(i, n){
        if (i==n-1){
            if (x==a[i])max_child++;
            else break;
        }
        else if (x<=0) break;
        else if(x-a[i] < 0) break;
        else{
            x -= a[i];
            max_child++;
        }
    }
    cout << max_child << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ajaychutiya ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

ll frog(ll arr[],ll i,ll n,ll dp[])
{
    if(i>=n-1)
    {dp[i]=0;
    return dp[i];}
    
    if(dp[i]!=-1)
    return dp[i];
    
    dp[i]=min(abs(arr[i+1]-arr[i])+frog(arr,i+1,n,dp),abs(arr[i+2]-arr[i])+frog(arr,i+2,n,dp));
    return dp[i];
}

int main()
{
    ajaychutiya
    
     ll n;
     cin>>n;
     
     ll arr[n];
     ll dp[n];
     
     memset(dp,-1,sizeof(dp));

     for(ll i=0;i<n;i++)
     cin>>arr[i];
     
     ll ans=frog(arr,0,n,dp);
     cout<<ans;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> T(N),C(N-1),S(N-1),F(N-1);
  vector<vector<int>> Tij(N,vector<int>(N,0));
  T.at(N-1) = 0;
  for(int i = 0; i < N-1; ++i){
    cin >> C.at(i) >> S.at(i) >> F.at(i);
  }
  
  int t;
  for(int i = 0; i < N; ++i){
    for(int j = i; j < N-1; ++j){
      Tij.at(i).at(j+1) = ((max(Tij.at(i).at(j),S.at(j))+F.at(j)-1)/F.at(j))*F.at(j)+C.at(j);
    }
  }
  for(int i = 0; i < N; ++i){
    cout << Tij.at(i).at(N-1) << endl;
  }
}

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

// 
int main() {
    long long X, K, D;
    cin >> X >> K >> D;

    X = abs(X);
    long long result = X / D;
    if (result >= K) {
        cout << X - (K * D);
        return 0;
    }

    K -= result;
    long long mod = X % D;
    if (K % 2 == 0) {
        cout << mod;
    } else {
        cout << abs(mod - D);
    }
}


Measured memory_bytes: 3620
#include<stdio.h>

  
main(){
    int n,m,i,j,count=0;
    int h[100001];
    int a[100001];
    int b[100001];
    int flag[100001] = {0};
    
    scanf("%d %d",&n,&m);
    for(i = 1; i <= n; i++)
    {
		 scanf("%d",&h[i]);
	}
	
    for(i = 1; i <= m; i++)
    {
		 scanf("%d %d",&a[i],&b[i]);
	}
    
    for(i = 1; i <= m; i++)
    {
        if(h[a[i]] > h[b[i]])
        {
            flag[b[i]]--;
        }
        else if(h[a[i]] == h[b[i]])
        {
            flag[a[i]]--;
            flag[b[i]]--;
        }else
        {
            flag[a[i]]--;
        }
    }
    for(i = 1; i <= n; i++)
    {
        if(flag[i] == 0)
        {
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 3292
#include <iostream>
using namespace std;
int main(void){
    
    int N;
    cin >> N;
    int a[1000];
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    
    for(int i = N-1; i >= 0; i--){
        cout << a[i] << (i != 0 ? " " : "\n");
    }
    
    return 0;
}



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

using namespace std;
using ll = long long;
vector<ll> ch[26];

int main () {
	int n, r;	
	cin >> n >> r;
	if (n >= 10) {
		cout << r <<"\n";
	}
	else {
		cout << r + 100 * (10 - n) << "\n";
	}
}


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

using namespace std;

int main() {
	int R;
	cin >> R;
	string ans;
	if (R < 1200) ans = "ABC";
	else if (R < 2800) ans = "ARC";
	else ans = "AGC";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3612
#include <iostream>

void solve() {
    int t = 0;
    for (int i = 0; i < 4; ++i) {
        int x;
        std::cin >> x;
        t += x;
    }

    std::cout << t / 60 << "\n"
              << t % 60 << "\n";
}

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

    solve();

    return 0;
}



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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

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

    if (s[0] == s[1] && s[1] == s[2] || s[1] == s[2] && s[2] == s[3])
        OP("Yes");
    else
        OP("No");

    return 0;
}

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

public class MainClass
{
	public const long Giri = 1000000007;

	
	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		
		Console.WriteLine(p[0] == p[1] ? "Yes" : "No");
		
	}


	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}


Measured memory_bytes: 13140
#include<stdio.h>
#include<string.h>

typedef struct{
  int top,front,right,left,back,bottom;
}dice;

void diceroll(dice* d, char c);

int main(void){
  dice d;
  int i;
  char act[101];

  scanf("%d %d %d %d %d %d", &d.top, &d.front, &d.right, &d.left, &d.back,&d.bottom);
  scanf("%s", act);

  for(i=0;act[i] !='\0';i++)
    diceroll(&d,act[i]);

  printf("%d\n", d.top);

  return 0;
}


void diceroll(dice* d, char c){
  int temp;

  switch(c){
  case 'E':
  temp=d->top;
  d->top=d->left;
  d->left=d->bottom;
  d->bottom=d->right;
  d->right=temp;
  break;
  case 'N':
  temp=d->top;
  d->top=d->front;
  d->front=d->bottom;
  d->bottom=d->back;
  d->back=temp;
  break;
  case 'S':
  temp=d->top;
  d->top=d->back;
  d->back=d->bottom;
  d->bottom=d->front;
  d->front=temp;
  break;
  case 'W':
  temp=d->top;
  d->top=d->right;
  d->right=d->bottom;
  d->bottom=d->left;
  d->left=temp;
  break;
  case 'R':
  temp=d->front;
  d->front=d->left;
  d->left=d->back;
  d->back=d->right;
  d->right=temp;
  break;
  case 'L':
  temp=d->front;
  d->front=d->right;
  d->right=d->back;
  d->back=d->left;
  d->left=temp;
  break;
  default:
    break;
  }


}

Measured memory_bytes: 1832
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 26 21:11:25 2019

@author: Yamazaki Kenichi
"""

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

print(' '.join(map(str,A)))
for i in range(1,N):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j+1]=A[j]
        j -= 1
    A[j+1] = v
    print(' '.join(map(str,A)))
    


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll x, y;
  cin >> x >> y;
  ll ans = 0;
  while(x <= y) {
    ans++;
    x *= 2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std ;                       
int dp[410][410] ; 
int inf = 1e18 ; 
signed main()
{
	ios_base::sync_with_stdio(false) ; 
	cin.tie(NULL) ; 	
	
	int n ; 
	cin >> n ;
	
	vector<int> a(n+1) ;
	vector<int> pref(n+1) ; 	
	for(int i = 1;  i<= n ; ++i)
	{
		cin >> a[i] ;
		pref[i]= a[i] + pref[i-1] ; 
	//	dp[i][i] = a[i] ;  
	}		
	for(int d = 1 ; d< n ; ++d)
	{
		for(int i = 1 ; i <= n-d ; ++i)
		{
			int j = i + d ;	
			dp[i][j] = inf ; 
			for(int k = i ; k < j ; ++k )
				dp[i][j] = min(dp[i][j] , dp[i][k] + dp[k+1][j] + pref[k] -pref[i-1] + pref[j] - pref[k]) ; 
		}
	}	
//	for(int i =0 ; i <= n ; ++i )
//	{
//	        for(int j = 1 ; j<= n ; ++j)
//		   	cout << dp[i][j] << " " ; 
//		cout << endl ;
//	}
	cout << dp[1][n] << endl; 
	                    	                                                                                		
}



















Measured memory_bytes: 4920
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
#include<vector>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int cmp(int a,int b){
	return a>b;
}
ll read(){
	ll x=0,w=1;
	char ch=0;
	while(ch<'0'||ch>'9'){
		if(ch=='-')
			w=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return w*x;
}//快读算法
ll gcd(ll a, ll b)
{
    return b? gcd(b, a % b): a;
}

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
int main(){
    int n;
    cin>>n;
    int num[n+10];
    for(int i=0;i<n;i++){
        cin>>num[i];
    }
    int sum=0;
    int f=1;
    for(int i=0;i<n;i++){
        if(num[i]==f){
            f++;
        }else{
            sum++;
        }
    }
    if(sum==n){
        cout<<-1<<endl;
    }else{
        cout<<sum<<endl;
    }

    return 0;
}




//humuhumunukunuku
//humuhumunukunuku



Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int n,m,sum='0';
char a[101][101];
void dfs(int x,int y)
{
	int dx[8]={0,1,1,1,0,-1,-1,-1};
	int dy[8]={1,1,0,-1,-1,-1,0,1};
	int tx,ty;
	for(int i=0;i<8;i++)
	{	
		tx=x+dx[i];ty=y+dy[i];
		if(a[tx][ty]=='#')
			sum++;
	}
	a[x][y]=sum;
	sum='0';
	return;	
}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		{
			if(a[i][j]!='#')
				dfs(i,j);
		}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
				cout<<a[i][j];
		cout<<endl;
	}		
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7;
const ll LINF=1e18;
using namespace std;
#define int long long

signed main(){
  int N,M,C;cin>>N>>M>>C;int ans=0;
  std::vector<int> B(M);
  for(int i=0;i<M;i++)cin>>B[i];
  for(int i=0;i<N;i++){
    std::vector<int> A(M);
    for(int j=0;j<M;j++)cin>>A[j];
    int k=0;
    for(int j=0;j<M;j++)k+=A[j]*B[j];
    if(k+C>0)ans++;
  }
  cout<<ans<<endl;
}


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

using namespace std;

const int max_n = 5055;

int n, mod, dp[max_n];

int mul(int x, int y) {
    return 1LL * x * y % mod;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n >> mod;
    dp[0] = 1;
    int coef = 1;
    int cnt = n / 2;
    for (int i = 1; i < n; ++i) {
        for (int cur = n; cur >= 0; --cur) {
            int c = dp[cur];
            for (int x = 0; cur + x * coef <= n; ++x) {
                dp[cur + x * coef] += c;
                dp[cur + x * coef] %= mod;
            }
            dp[cur] += mod - c;
            dp[cur] %= mod;
        }
        if (cnt) {
            --cnt;
            ++coef;
            if (!cnt && n % 2 == 0) {
                --coef;
            }
        } else {
            --coef;
        }
    }
    int ans = 0;
    for (int x = 0; x <= n; ++x) {
        ans += mul(n - x, dp[x]);
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	
	int temp;
	temp = a-b + c - a;
	
	if(temp<=0) printf("delicious\n");
	else{
		if(temp>a) printf("dangerous\n");
		else printf("safe\n");
	} 
	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);

		int x = sc.nextInt();
		int y = sc.nextInt();

		System.out.println(gcd(x, y));

		sc.close();
	}

	public static int gcd (int x, int y) {
		if (y==0) {
			return x;
		} else {
			return gcd(y, x%y);
		}
	}

}

Measured memory_bytes: 26160
#include<stdio.h>

void trace(int A[],int N){
int i;
for(i=0;i<N;i++){
if(i>0){
printf(" ");
}
printf("%d",A[i]);
}
printf("\n");
}
void insertionSort(int A[],int N){
int j,i,v;
for(i=1;i<N;i++){
v=A[i];
j=i-1;
while(j>=0&&A[j]>v){
A[j+1]=A[j];
j--;
}
A[j+1]=v;
trace(A,N);
}
}
int main(){
int N,i,j;
int A[100];

scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&A[i]);
}
trace(A,N);
insertionSort(A,N);
return 0;
}


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

int main()
{
	int n,k;
    long long answer=0;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<k;i++)
    {
        answer+=a[i];
    }
    cout<<answer<<endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
int main(void){
	int i;
 	for(i=1;i<=9;i++){
  		printf("%dx1=%d\n", i, i*1);
  		printf("%dx2=%d\n", i, i*2);
  		printf("%dx3=%d\n", i, i*3);
  		printf("%dx4=%d\n", i, i*4);
  		printf("%dx5=%d\n", i, i*5);
  		printf("%dx6=%d\n", i, i*6);
  		printf("%dx7=%d\n", i, i*7);
  		printf("%dx8=%d\n", i, i*8);
  		printf("%dx9=%d\n", i, i*9);
	}
return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b,c;
   cin>>a>>b>>c;
   if(a!=b && a!=c && b!=c)
    cout<<3<<endl;
   else if((a!=b && (a==c || b==c)) || (a!=c && (a==b ||b==c)) || (b!=c &&(a==c || a==b)))
     cout<<2<<endl;
      else
         cout<<1<<endl;

}



Measured memory_bytes: 256
#include <stdio.h>

int main(){;
    long long a,b,k;
    scanf("%lld%lld%lld",&a,&b,&k);
    if(a>=k){
        a-=k;
        k=0;
    }else{
        k-=a;
        a=0;
    }
    b-=k;
    if(b<0)b=0;
    printf("%lld %lld",a,b);
    return 0;
}


Measured memory_bytes: 128
#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;
int mod = 998244353;
#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; }
ll pow(ll 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 a, p;
  cin >> a >> p;
  p += a * 3;
  cout << p / 2 << endl;
}


Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val (x, y, z) = readListOfInt()
    var n = 0
    while(x > y * n + z * (n+1)) {
        n++
    }
    if(x < y * n + z * (n+1)) n--
    println(n)
    pw.flush()
}

/****** Decrared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
    }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j] % MOD)
        }
    }
    return v.map { it.toList() }.toList()
}

fun gcd(a: Long, b: Long): Long = 
    if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
    if(b==0L) a else gcd(b, a % b)

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 37932
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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 h, w;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
int fld[1001][1001];
int cnt[1001][1001];

bool isOK(int x, int y) {
	if(0 <= x && x < w && 0 <= y && y < h) return 1;
	return 0;
}

bool isvalley(int x, int y) {
	rep(i, 4) {
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(isOK(nx, ny)) {
			if(fld[ny][nx] < fld[y][x]) return 0;
		}
	}
	return 1;
}

void bfs(int sx, int sy) {
	if(!isvalley(sx, sy)) return ;
	cnt[sy][sx]++;

	queue<P> que;
	vector<vector<int>> came(h, vector<int>(w, 0));
	que.push(P(sx, sy));
	while(!que.empty()) {
		P p = que.front();
		que.pop();
		rep(i, 4) {
			int nx = p.first + dx[i];
			int ny = p.second + dy[i];
			if(!isOK(nx, ny)) continue;
			if(!came[ny][nx] && fld[p.second][p.first] < fld[ny][nx]) {
				came[ny][nx] = 1;
				que.push(P(nx, ny));
				cnt[ny][nx]++;
			}
		}
	}
}

signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	cin >> h >> w;
	rep(i, h) rep(j, w) cin >> fld[i][j];

	rep(i, h) {
		rep(j, w) {
			bfs(j, i);
		}
	}
	// rep(i, h) {
	// 	rep(j, w) cout << cnt[i][j] << " ";
	// 	cout << endl;
	// }
	int ans = 0;
	rep(i, h) {
		rep(j, w) {
			if(cnt[i][j] != 1) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 26200
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define repbit(bit, n)  for(int bit = 0; (bit) < (1 << (n)); ++(bit))
#define ifbit(bit, i)   if((bit) & (1 << (i)))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int a, b; cin >> a >> b;
    cout << (a <= 2 * b ? 0 : a - 2 * b) << endl;

return 0;
}

Measured memory_bytes: 3648
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	private static List<String> getStrings(Scanner sc, int num) {
		List<String> stringList = new ArrayList<>();
		while(num>0) {
			String nextInt = sc.next();
			stringList.add(nextInt);
			num--;
		}
		return stringList;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<String> array = getStrings(sc, n);
		int ac = 0;
		int wa = 0;
		int tle = 0;
		int re = 0;
		for (String a :array) {
			if (a.equals("AC")) {
				ac++;
				continue;
			}
			if (a.equals("WA")) {
				wa++;
				continue;
			}
			if (a.equals("RE")) {
				re++;
				continue;
			}
			if (a.equals("TLE")) {
				tle++;
				continue;
			}
		}
		System.out.println("AC x " + ac);
		System.out.println("WA x " + wa);
		System.out.println("TLE x " + tle);
		System.out.println("RE x " + re);
	}

}


Measured memory_bytes: 63720
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <math.h>
#include <numeric>
using namespace std;
int main(){
  int K;
  cin >> K;
  int A,B;
  cin >> A >> B;
  int tmp=B/K;
  if(K*tmp>=A&&K*tmp<=B)cout << "OK" << endl;
  else cout << "NG" << endl;
}

Measured memory_bytes: 3596
#include <stdio.h>

#define MAX 2000000

int n, A[MAX+1];

void maxHeapify(int);

int main() {

  int i;

  scanf("%d", &n);

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

  for( i=n/2; i>=1; i-- ) {
    maxHeapify(i);
  }

  for( i=1; i<=n; i++) {
    printf(" %d", A[i]);
  }
  printf("\n");
  return 0;
}

void maxHeapify(int i) {

  int l;
  int r;
  int largest;
  int tmp;

  l = 2 * i;
  r = 2 * i + 1;

  if( l<=n && A[l]>A[i] ) {
    largest = l;
  } else {
    largest = i;
  }
  
  if( r <= n && A[r]>A[largest] ) {
    largest = r;
  }

  if( largest != i ) {
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(largest);
  }

  return ;
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N,X;
    cin >> N >> X;
    int ans = 0;
    int d = 0;
    vector<int> L(N);
    REP( i,N) cin >>L[i];
    REP(i,N) {
        if (d <= X) ans++;
        d = d + L[i];
    }
    if (d <= X) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=1000000000000000000;
int main(){
	ll n,m;cin>>n>>m;
	ll ans=1;
	for(ll i=1;i<=sqrt(m);i++){
		if(m%i==0){
			if(i*n<=m){
				ans=max(ans,i);
			}
			if((m/i)*n<=m){
				ans=max(ans,m/i);
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 200000000000
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()

bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}
// 入力



int main() {
    ll N,M;
    cin >>N>>M;
    map<ll,ll> A;
    map<ll,ll> W;
    ll ac = 0,wa = 0;
    rep(i,M){
        ll a;
        string b;
        cin >>a>>b;
        if(b == "AC"){
            if(A[a] == 0 ){
                ac++;
                A[a] = 1;
                wa += W[a];
            }
        }else{
            if(A[a] == 0 ){
                W[a]++;
                
            }
        }

    }
    cout << ac<<" "<<wa << endl;


    return 0;
    

}

Measured memory_bytes: 15940
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] numbers = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            numbers[i] = sc.nextInt();
        }
        
        int count = 0;
        
        for (int i = 1; i <= n; i++) {
            if (numbers[i] == i) {
                count++;
                
                if (i == n) break;
                if (numbers[i + 1] == i + 1) {
                    i++;
                }
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 51068
x, y, z, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()

A = A[::-1]
B = B[::-1]
C = C[::-1]

anslist = []

for i in range(len(A)):
    if (i + 1) > k:
        break
    for j in range(len(B)):
        if (i + 1)  * (j + 1) > k:
            break
        for l in range(len(C)):
            if (i + 1) * (j + 1) * (l + 1) > k:
                break
            anslist.append(A[i] + B[j] + C[l])

anslist.sort()

anslist = anslist[::-1]

for i in range(k):
    print(anslist[i])


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
	
		int A[] = new int [N];
		int B[] = new int [N];
		for (int i = 0; i<N; i++){
			A[i]=sc.nextInt();
			B[i]=A[i];
		}
		
		Arrays.sort(A);
		int left = A[(N)/2-1];
		int right = A[N/2];
		
		for (int i=0; i<N; i++){
			if (B[i]<=left)
				System.out.println(right);
			else
				System.out.println(left);
				
		}
		sc.close();

	}

}

Measured memory_bytes: 89260
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007
int acs(const void* a, const void* b) { return *(int*)a - *(int*)b; } // 1,2,3,4
int des(const void* a, const void* b) { return *(int*)b - *(int*)a; } // 8,7,6,5
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
//snippet
#define N 200009

int acsLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }

int main() {
	LL n, k, p[N], m[N], pl = 0, mn = 0, ans = 1, t;
	scanf("%lld%lld", &n, &k);
	rep(i, n) {
		scanf("%lld", &t);
		if (t >= 0)p[pl++] = t;
		else m[mn++] = -t;
	}
	qsort(p, pl, sizeof(LL), acsLL);
	qsort(m, mn, sizeof(LL), acsLL);


	if (n == k) {//all
		rep(i, mn)ans = ans * (MOD - m[i]) % MOD;
		rep(i, pl)ans = ans * p[i] % MOD;
	}
	else if (mn == n && k % 2) {//-
		rep(i, k)ans = ans * (MOD - m[i]) % MOD;
	}
	else {//normal
		while (k) {
			if (k >= 2 && mn >= 2 && (pl <= 1 || (pl >= 2 && m[mn - 1] * m[mn - 2] >= p[pl - 1] * p[pl - 2]))) {
				ans = ans * m[--mn] % MOD;
				ans = ans * m[--mn] % MOD;
				k = k - 2;
			}
			else {
				ans = ans * p[--pl] % MOD;
				k--;
			}
		}
	}
	printf("%lld", ans);
}

Measured memory_bytes: 4132
n=int(input())
A=list(map(int,input().split()))
mod=10**9+7
B=[0]*n
for i in range(n):
  B[A[i]]+=1
a=0
if B[0]==1:
  for i in range(1,n):
    if i%2==0:
      if B[i]!=2:
        a=1
    else:
      if B[i]!=0:
        a=1
  if a==0:
    print(pow(2,(n-1)//2,mod))
  else:
    print(0)
elif B[0]==0:
  for i in range(1,n):
    if i%2==0:
      if B[i]!=0:
        a=1
    else:
      if B[i]!=2:
        a=1
  if a==0:
    print(pow(2,n//2,mod))
  else:
    print(0)
else:
  print(0)

Measured memory_bytes: 14008
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


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

    ll n;
    cin >> n;

    ll A,B;
    vector<pair<ll,ll> > ab;

    for(ll i = 1; i < sqrt(n)+1;i++){
        if(n%i == 0){
            ab.push_back(make_pair(i,n/i));
        }
    }
    int Min = MOD;


    for(int i = 0; i < ab.size();i++){
        
        int Max = max(ab[i].first,ab[i].second);
        int count = 0;
        while(Max != 0){
            Max/=10;
            count++;
        }
        Min = min(Min,count);
    }

    cout << Min << endl;
    

    return 0;
}

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

using namespace std;

double eulidDist(pair<int, int> a, pair<int, int> b) {
   int dx = abs(a.first - b.first);
   int dy = abs(a.second - b.second);
   
   return sqrt(dx * dx + dy * dy);
}

long long fact(int n) {
   long long res = 1;
   
   for (int i = 2; i <= n; i++) {
      res *= i;
   }
   return res;
}

int main() {
   int n;
   cin >> n;
   
   vector<pair<int, int>> town(n);
   for (int i = 0; i < n; i++) {
      int x, y;
      cin >> x >> y;
      
      town[i] = make_pair(x, y);
   }
   
   int factor = fact(n);
   vector<int> temp;
   for (int i = 0; i < n; i++) {
      temp.emplace_back(i + 1);
   }
   
   vector<vector<int>> permute;
   do {
      permute.emplace_back(temp);
   } while (next_permutation(temp.begin(), temp.end()));
   
   double sum = 0;
   for (int i = 0; i < factor; i++) {
      for (int j = 0; j < n - 1; j++) {
         sum += eulidDist(town[permute[i][j] - 1], town[permute[i][j + 1] - 1]);
      }
   }
   printf("%.6f\n", (double) sum / factor);
   
   return 0;
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, a[N];
int main()
{
	cin >> n;
	for(int i = 0; i < n; i++)
		scanf("%d", a + i);
	int gcd = a[0];
	for(int i = 1; i < n; i++)
		gcd = __gcd(gcd, a[i]);
	cout << gcd << endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)

int p[501][501];

void dfs(int id,vector<int>&a){
    int n = a.size();
    if(n<=1)return;
    vector<int>s,t;
    for(int i=0;i<n;i++){
        if(i%2==0){
            s.push_back(a[i]);
        }else{
            t.push_back(a[i]);
        }
    }
    for(auto x:s){
        for(auto y:t){
            p[x][y] = id;
            p[y][x] = id;
        }
    }
    dfs(id+1,s);
    dfs(id+1,t);
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n){
        a[i] = i;
    }
    dfs(1,a);
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            cout << p[i][j] << " ";
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1536
def solve(n, m, x):
    if n >= m:
        return 0

    y = [x[i + 1] - x[i] for i in range(m - 1)]
    y.sort(reverse=True)

    return x[-1] - x[0] - sum(y[:n-1])

def main():
    n, m = map(int, input().split())
    x = [int(s) for s in input().split()]
    x.sort()

    print(solve(n, m, x))

main()


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

ll solve1(ll K,ll A,ll B){
  if(1+K<=A)return 1+K;
  

  ll res=0;
  K-=(A-1);
  
  if(B-A>1){
    res=max(res, A+(K/2)*(B-A)+K%2);
  }
  
  res=max(res, A+K);
  return res;
}

int main(){
  ll K,A,B;
  cin>>K>>A>>B;

  cout<<max(K,solve1(K,A,B))<<endl;
  return 0;
}



Measured memory_bytes: 256
class dice:
    def __init__(self,dice):
        self.dice = dice

    def roll_n(self):
        d = self.dice
        self.dice = [d[1],d[5],d[2],d[3],d[0],d[4]]

    def roll_e(self):
        d = self.dice
        self.dice = [d[3],d[1],d[0],d[5],d[4],d[2]]

    def roll_s(self):
        d = self.dice
        self.dice = [d[4],d[0],d[2],d[3],d[5],d[1]]
    
    def roll_w(self):
        d = self.dice
        self.dice = [d[2],d[1],d[5],d[0],d[4],d[3]]

    def top(self):
        return self.dice[0]

def main():
    d = dice(list(map(int,input().split())))
    com = input()
    for c in com:
        if c == 'N':d.roll_n()
        if c == 'E':d.roll_e()
        if c == 'S':d.roll_s()
        if c == 'W':d.roll_w()
    print(d.top())

if __name__ == '__main__':
    main()




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

int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		char S;
		cin >> S;
		if (S == 'Y') {
			cout << "Four" << endl;
			break;
		}
		else if (i == (N - 1)) {
			cout << "Three" << endl;
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lowbit(a) ((a)&(-(a)))
using namespace std;

void file(bool opt)
{
	if (opt&&fopen("in.txt", "r"))
	{
		freopen("in.txt", "r", stdin);
		//freopen("out.txt", "w", stdout);
	}
}

long long L, A, B;
long long mod;
long long ans = 0;
long long powt[19];
struct mat {
	int val[3][3];
	mat() { memset(val, 0, sizeof val); }
	void init(int i)
	{
		memset(val, 0, sizeof val);
		val[0][0] = powt[i] % mod, val[1][0] = val[1][1] = val[2][1] = val[2][2] = 1;
	}
}a,res;

mat operator*(mat a, mat b)
{
	mat c;
	for (int i = 0; i<3; i++)
		for (int j = 0; j<3; j++)
			for (int k = 0; k<3; k++)
				c.val[i][j] = (c.val[i][j] + 1ll * a.val[i][k] * b.val[k][j]) % mod;
	return c;
}

void poww(long long L,long long R,int d)
{
	long long n = (R - L) / B + 1;
	for (int i = 0; i < 3; i++)
		for (int j = 0; j < 3; j++)
			res.val[i][j] = (i == j);

	a.init(d);

	while (n)
	{
		if (n & 1)res = res * a;
		n >>= 1;
		a = a*a;
	}
	ans = (1ll * ans*res.val[0][0]%mod + L % mod*res.val[1][0] % mod + B % mod*res.val[2][0]) % mod;
}

int main()
{
	cin >> L >> A >> B >> mod;
	powt[0] = 1;
	for (int i = 1; i <= 18; i++)
		powt[i] = powt[i - 1] * 10ll;

	long long ed = A + B * (L - 1);

	for (int d = 1; d <= 18; d++)
	{
		if (A < powt[d])
		{
			long long R = (powt[d] - 1 - A) / B * B + A;
			R = min(R, ed);
			poww(A, R, d);
			if (R == ed)break;
			A = R + B;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  int n, k; cin >> n >> k;
  int cnt = 0;
  while(n > 0) {
    n /= k;
    cnt++;
  }
  cout << cnt << endl;

  return 0;
}

// EOF


Measured memory_bytes: 256
import sys
import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
#import heapq
import math
start=time.time()
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
x,n = rl()
p=rl()
p.sort()
for i in range(100):
    if x-i not in p:
        print(x-i)
        sys.exit()
    
    if x+i not in p:
        print(x+i)
        sys.exit()
    

Measured memory_bytes: 62180
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <utility>

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

signed main()
{
    string s;
    cin >> s;
    
    int ans = 0;
    int tmp = 0;
    rep(i, s.size()){
        if(s[i] == 'S') --tmp;
        else ++tmp;
        ans = max(ans, tmp);
    }
    
    cout << ans*2 << endl;
}


Measured memory_bytes: 1152
import std.stdio, std.conv, std.string, std.range, std.algorithm, std.range;

void main()
{
  auto N = readln.split[0].to!int;
  auto H = readln.split.to!(int[]);

  for(int i = N - 1; i > 0; i--) {
    if(H[i-1] > H[i]) H[i-1]--;
  }

  for (int i = 1; i < N; i++)
  {
    if (H[i - 1] > H[i])
    {
      writeln("No");
      return;
    }
  }
  writeln("Yes");
}


Measured memory_bytes: 3856
# abc123 B
a = []
5.times do
  a << gets.to_i
end


as = a.sort_by{|aa|i = aa.to_s[-1].to_i; i == 0 ? 9 : i }
min  = as[0]
maxs = as[1..-1]

a2 = maxs.map {|aa|
  x = aa / 10
  aa % 10 == 0 ? aa : (x+1)*10
}
# p a2
p a2.inject(:+) + min


Measured memory_bytes: 1788
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Mon Jan 28 14:21:15 2019
//
package main

import (
	"fmt"
	"math"
)

func main() {
	var Q int
	fmt.Scan(&Q)
	for i := 0; i < Q; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		if a > b {
			a, b = b, a
		}

		if a == b {
			fmt.Println(2 * (a - 1))
		} else if a+1 == b {
			fmt.Println(2 * (a - 1))
		} else {
			c := int(math.Sqrt(float64(a * b)))
			if a*b == c*c {
				c--
			}
			if c*(c+1) >= a*b {
				fmt.Println(2 * (c - 1))
			} else {
				fmt.Println(2*c - 1)
			}
		}
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int h, w, c, ans;
using board = vector<vector<int>>;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
board b[4];
bool used[10][10];

void paint(board &a, int x, int y, int px, int py, int before, int after){
    used[x][y] = true;
    a[x][y] = after;
    rep(i, 4){
        int nx = x + dx[i], ny = y + dy[i];
        if(nx == px && ny == py) continue;
        if(0<=nx && nx<h && 0<=ny && ny<w && a[nx][ny] == before && !used[nx][ny]){
            paint(a, nx, ny, x, y, before, after);
        }
    }
}

int cnt(board &a, int x, int y, int px, int py, int col){
    used[x][y] = true;
    int ret = 1;
    rep(i, 4){
        int nx = x + dx[i], ny = y + dy[i];
        if(nx == px && ny == py) continue;
        if(0<=nx && nx<h && 0<=ny && ny<w && a[nx][ny] == col && !used[nx][ny]){
            ret += cnt(a, nx, ny, x, y, col);
        }
    }
    return ret;
}

void dfs(int cur, board &a){
    if(cur == 4){
        rep(i, h)rep(j, w) used[i][j] = false;
        paint(a, 0, 0, -1, -1, a[0][0], c);
        rep(i, h)rep(j, w) used[i][j] = false;
        chmax(ans, cnt(a, 0, 0, -1, -1, c));
        return;
    }
    rep(i, h)rep(j, w) b[cur][i][j] = a[i][j];
    For(col, 1, 7){
        rep(i, h)rep(j, w) used[i][j] = false;
        rep(i, h)rep(j, w) a[i][j] = b[cur][i][j];
        paint(a, 0, 0, -1, -1, a[0][0], col);
        dfs(cur + 1, a);
    }
}

void solve(){
    board a(h, vector<int>(w));
    rep(i, h)rep(j, w) scanf("%d", &a[i][j]);
    rep(i, 4){
        b[i].resize(h);
        rep(x, h) b[i][x].resize(w);
    }
    ans = 0;
    dfs(0, a);
    printf("%d\n", ans);
}

int main(){
    while(scanf("%d%d%d", &h, &w, &c) && h){
        solve();
    }
}


Measured memory_bytes: 3272
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int n;
  string s;
  cin>>n>>s;
  int x=0,m=0;
  for(auto c:s){
    if(c=='I') x++;
    if(c=='D') x--;
    m=max(m,x);
  }
  cout<<m<<endl;
  return 0;
}


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

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define ll long long
#define dl double long

using namespace std;

const ll NN = 1e10 + 7;
const int N = 1e5 + 7;
const int M = 11;
const ll mod = 1e9 + 7;
const ll inf = 1e18 + 7;
const dl rf = 1e-14;
const int B = sqrt(N);



void solve1()
{
    ll n,k;
    cin >> n >> k;
    cout << max(100 * (10 - n) + k , k);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


Measured memory_bytes: 256