akhauriyash/Code-Regression huggingface dataset:
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

char stribuf[4194304];
uint32_t stribufs;

uint32_t nextpint(void){ char c=getchar_unlocked(); while(c<'0'||'9'<c) c=getchar_unlocked(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return x; }
void printpint(uint32_t x){ int d=0; char s[10]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) stribuf[stribufs++]=s[i]; }
int main(void){
	nextpint();
	uint32_t m=nextpint();
	{
		uint32_t a=m+1;
		for(uint32_t i=m/2; i>0; i--){
			printpint(i);
			stribuf[stribufs++]=32;
			printpint(a-i);
			stribuf[stribufs++]=10;
		}
	}
	{
		uint32_t a=(m+1)*2;
		for(uint32_t i=(m+1)/2; i>0; i--){
			printpint(m+i);
			stribuf[stribufs++]=32;
			printpint(a-i);
			stribuf[stribufs++]=10;
		}
	}
	write(1, stribuf, stribufs);
}




Measured memory_bytes: 2512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int a;
    set<int> ans, s;
    rep(i,4) {
        cin >> a;
        s.insert(a);
    }
    ans.insert(1);
    ans.insert(9);
    ans.insert(7);
    ans.insert(4);
    if(s == ans) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

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


void solve(long long N, long long K, std::vector<long long> P, std::vector<long long> C){
    for (int i = 0; i < N; i++) {
        P[i]--;
    }
    vector<long long> anss;
    for (int start = 0; start < N; start++) {
        unordered_set<int> seen;
        int now = start;
        
        long long score = 0;
        long long max_score = 0;
        if (C[now] < 0) {
            max_score = C[now];
        }
        vector<long long> max_scores = {0};
        while (!seen.count(now)) {
            seen.insert(now);
            score += C[now];
            max_score = max(max_score, score);
            max_scores.push_back(max_score);
            if (seen.size() == K) {
                break;
            }
            now = P[now];
        }
        if (seen.size() == K) {
            anss.push_back(max_score);
            continue;
        }
        if (score <= 0) {
            anss.push_back(max_score);
            continue;
        }
        long long ans = -1e18;
        for (int i = 0; i < seen.size(); i++) {
            long long tmp_score = max_scores[i+1];
            if (score > 0) {
                tmp_score += ((K - i - 1) / seen.size()) * score;
            }
            ans = max(ans, tmp_score);
        }
        anss.push_back(ans);
    }
    cout << *max_element(anss.begin(), anss.end()) << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    std::vector<long long> C(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&C[i]);
    }
    solve(N, K, std::move(P), std::move(C));
    return 0;
}


Measured memory_bytes: 3992
N = int(input())
xyhs = [tuple(map(int,input().split())) for _ in range(N)]

lower_h = max([xyh[2] for xyh in xyhs])

def func():
    for ch in range(lower_h,lower_h+201,1):
#         print(ch)
        for cx in range(101):
            for cy in range(101):
#                 print(ch,cx,cy)
                if all([xyh[2] == max(ch - abs(xyh[0]-cx) - abs(xyh[1]-cy),0) for xyh in xyhs]):
#                     print(cx,cy,ch)
                    return cx,cy,ch

cx,cy,ch = func()

print(" ".join(list(map(str,[cx,cy,ch]))))

Measured memory_bytes: 50908
#include<stdio.h>
int main(void){
    int N;
    char s[101];
    char t[101];
    scanf("%d",&N);
    scanf("%s %s",s,t);
    for(int i=0;i<N;i++){
        printf("%c%c",s[i],t[i]);
    }
    printf("\n");
  
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#define MAXN 100005
using namespace std;
int dis1[MAXN], disn[MAXN];
bool vst1[MAXN], vst2[MAXN];
vector<int> g[MAXN];

int n, fennec, snuke;

void bfs() {
	queue<int> que1, que2;
	que1.push(1);
	que2.push(n);
	vst1[1] = 1, vst2[n] = 1;
	while(!que1.empty()) {
		int t = que1.front();
		que1.pop();
		for(int i = 0; i < g[t].size(); i++) {
			if(!vst1[g[t][i]]) {
				que1.push(g[t][i]);
				vst1[g[t][i]] = 1;
				dis1[g[t][i]] = dis1[t] + 1;
			}
		}
	}
	while(!que2.empty()) {
		int t = que2.front();
		que2.pop();
		for(int i = 0; i < g[t].size(); i++) {
			if(!vst2[g[t][i]]) {
				que2.push(g[t][i]);
				vst2[g[t][i]] = 1;
				disn[g[t][i]] = disn[t] + 1;
			}
		}
	}
}
int main () {
	int u, v;
	scanf("%d", &n);
	for(int i = 1; i < n; i++) {
		scanf("%d %d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	bfs();

	for(int i = 1; i <= n; i++) {
		if(dis1[i] <= disn[i]) fennec++;
		else snuke++;
	}
	if(fennec > snuke) printf("Fennec\n");
	else printf("Snuke\n");
	return 0;
}

Measured memory_bytes: 6784
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(obj) (obj).begin(),(obj).end()

using namespace std;


int main() {
	speed;
	int n;
	cin >> n;
	vector<int>a;
	rep(i, n) {
		int b;
		cin >> b;
		a.push_back(b);
	}
	sort(All(a));
	int& last = a.back();
	int sum = 0;
	rep(i, n - 1) {
		sum += a[i];
	}
	if (last < sum)cout << "Yes";
	else cout << "No";
	return 0;
}


Measured memory_bytes: 256
import javax.net.ssl.SSLContext;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        int N = Integer.parseInt(reader.readLine());

        String s = reader.readLine();
        String t = reader.readLine();

        int len = s.length();
        for (int i = 0; i < t.length(); i++) {
            String tt = t.substring(0, t.length() - i);
            int pos = s.indexOf(tt);
            if (pos >= 0) {
                len += pos;
                if (len < N)
                    System.out.println(N);
                else
                    System.out.println(len);
                return;
            }
        }

        len += t.length();

        if (len < N)
            System.out.println(N);
        else
            System.out.println(len);

//        PrintWriter writer = new PrintWriter(System.out);
//
//        writer.close();


    }
}


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

using namespace std;

int
main(void){
	int n; cin >> n;
	vector<int> h(n);
	for(int i = 0; i < n; i++) cin >> h[i];
	vector<int> dp(n, INT_MAX);
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = 1; j <= 2; j++){
			if(i + j < n){
				dp[i + j] = min(dp[i + j], dp[i] + (int)fabs(h[i + j] - h[i]));
			}
		}
	}
	
	cout << dp[n - 1];
}

Measured memory_bytes: 1024
use std::process;
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}
fn main() {
    let a = get!(i32);
    let s = get!(String);

    println!("{}" , if a >= 3200 {&s as &str} else {"red"})
}


Measured memory_bytes: 4352
N=int(input())
A=list(map(int,input().split()))
UV=[list(map(int,input().split())) for i in range(N-1)]
c=[[] for i in range(N)]
for i,j in UV:
    c[i-1].append(j-1)
    c[j-1].append(i-1)
v=[0]*N
d=[10**9+1]*N
stk=[]
ans=[0]*N
from bisect import bisect_left
import sys
sys.setrecursionlimit(10**9)
def dfs(p,l):
    i=bisect_left(d,A[p])
    stk.append((i,d[i]))
    d[i]=A[p]
    if i==l:
        l+=1
    ans[p]=l
    for n in c[p]:
        if v[n]==0:
            v[n]=1
            dfs(n,l)
    i,x=stk.pop()
    d[i]=x
v[0]=1
dfs(0,0)
print(*ans,sep='\n')

Measured memory_bytes: 270848
#include<bits/stdc++.h>
using namespace std;
int n;
int data[100005]={};

int main(){
  ios_base::sync_with_stdio(false);
  int a;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a;
    data[a]++;
  }

  int max=0;
  for(int i=0;i<100000;i++){
    if(data[i]+data[i+1]+data[i+2] > max){
      max = data[i]+data[i+1]+data[i+2];
    }
  }
  
  cout << max << endl;

  return 0;
}

Measured memory_bytes: 640
def dfs(v, path):
    path.append(v)
    if len(path) == n:
        path.pop()
        return 1
    ans = 0
    for u in links[v]:
        if u in path:
            continue
        ans += dfs(u, path)
    path.pop()
    return ans


n, m = map(int, input().split())
links = [set() for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    links[a].add(b)
    links[b].add(a)
print(dfs(0, []))


Measured memory_bytes: 3064
//https://atcoder.jp/contests/abc084/tasks/abc084_d
//D - 2017-like Number
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}

//エラトステネスの篩
//n以下の素数のリストを返す
auto Eratosthenes(const int n)
{
    vector<ll> result;
    vector<bool> is_prime(n+1,true); //trueで初期化
    for(ll i = 2; i <= n; ++i){
        if (is_prime.at(i)) {
            for(ll j = 2 * i; j <= n; j += i){
                is_prime[ j ] = false;
            }
            result.emplace_back( i );
        }
    }
    return result;
}

int main() {
  ll Q; cin>>Q;
  auto pnums = Eratosthenes(1e+5+1);
  vector<ll> like2017s;
  for(const auto& n:pnums){
    ll n2=(n+1)/2;
    bool exist=binary_search(pnums.begin(), pnums.end(),n2);
    if(exist) like2017s.push_back(n);
  }
  vector<ll> ans;
  REP(i,Q){
    ll l,r; cin>>l>>r;
    auto itl = lower_bound(like2017s.begin(), like2017s.end(), l);
    auto itr = upper_bound(like2017s.begin(), like2017s.end(), r);
    ans.push_back(itr-itl);
  }
  for(auto&& a:ans){
    cout<<a<<endl;
  }

  return 0;
}

Measured memory_bytes: 1652
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 1000
#define MAX_S 305
map<string,int> mp;
string A,B;
int si,ti;
int n;
bool used[MAX_N];
vector<int> x[MAX_N],y[MAX_N];
vector<int> G[MAX_S][MAX_S];
int t[MAX_S][MAX_S];
 
bool solve(){
  for(int i=0;i<MAX_N;i++)used[i]=false;
  for(int i=0;i<MAX_S;i++)
    for(int j=0;j<MAX_S;j++)
      t[i][j]=(i==j?0:1e7);
   
  queue<int> qa,qb;
  qa.push(si);
  qb.push(ti);
  while(!qa.empty()){
    int a=qa.front();qa.pop();
    int b=qb.front();qb.pop();
    if(t[a][b]==-1)continue;
    t[a][b]=-1;
    for(int i=0;i<(int)G[a][b].size();i++){
      int id=G[a][b][i];
      if(used[id])continue;
      used[id]=true;
      for(int j=0;j<(int)x[id].size();j++){
        qa.push( x[id][j] );
        qb.push( y[id][j] );
      }
    }
    for(int i=0;i<MAX_S;i++){
      if(t[b][i]==-1){
        qa.push(a);
        qb.push(i);
      }
      if(t[i][a]==-1){
        qa.push(i);
        qb.push(b);
      }
    }
  }
 
  for(int k=0;k<MAX_S;k++)
    for(int i=0;i<MAX_S;i++)
      for(int j=0;j<MAX_S;j++)
        t[i][j]=min(t[i][j],t[i][k]+t[k][j]);
  for(int i=0;i<MAX_S;i++)
    if(t[i][i]<0)return false;
  return true;
}
 
int input(string &s){
  cin>>s;
  if(mp.count(s)==0){
    int res=mp.size();
    mp[s]=res;
    return res;
  }else{
    return mp[s];
  }
}
 
int main(){
  si=input(A);
  ti=input(B);
  cin>>n;
  for(int i=0;i<n;i++){
    int q;
    cin>>q;
    for(int j=0;j<q;j++){
      string str;
      int L=input(str);
      int R=input(str);
      x[i].push_back(L);
      y[i].push_back(R);
      G[L][R].push_back(i);
    }
  }
  cout<< (solve()?"Yes":"No") <<endl;
  return 0;
}

Measured memory_bytes: 224988
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  string s;
  cin >> s;
  char acgt[] = {'A', 'C', 'G', 'T'};
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    int tmp = 0;
    bool flag = false;
    for (int j = i; j < s.size(); j++) {
      for (int k = 0; k < 4; k++) {
        if (s[j] == acgt[k]) {
          flag = true;
          break;
        }
      }
      if (flag) {
        tmp++;
        flag = false;
      } else {
        break;
      }
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long knapSack(int W, int wt[], int val[], int n) 
{ 
   int i, w; 
   long K[n+1][W+1]; 
  
   // Build table K[][] in bottom up manner 
   for (i = 0; i <= n; i++) 
   { 
       for (w = 0; w <= W; w++) 
       { 
           if (i==0 || w==0) 
               K[i][w] = 0; 
           else if (wt[i-1] <= w) 
                 K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]],  K[i-1][w]); 
           else
                 K[i][w] = K[i-1][w]; 
       } 
   } 
  
   return K[n][W]; 
} 

int main(){
  int N=0;
  int W=0;
  cin>>N;
  cin>>W;
  int weight[N];
  int value[W];
 
  
  for(int i=0;i<N;i++){
    cin>>weight[i];
    cin>>value[i];
  }
  cout<<knapSack(W,weight,value,N);
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 998244353
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
int main() {
  ll a, b;
  cin >> a;
  cout << (a + 1) / 2 * ((a) / 2) << endl;
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();


    int a[4][4];

    for(int i=1; i<=3; i++)
    {
        for(int j=1; j<=3; j++)
            cin >> a[i][j];
    }

    int n;

    cin>> n;

    int t, k;

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

        for(int j=1; j<= 3; j++)
        {
            for( k=1; k<=3; k++)
            {
                if(t== a[j][k])
                {
                    a[j][k]= -1;
                    break;
                }
            }
            if(a[j][k] == -1)
                break;
        }
    }

    if ( (a[1][1] == -1 && a[2][2]== -1 &&  a[3][3]== -1) || (a[1][3]== -1 && a[2][2]== -1 && a[3][1]== -1) )
    {
        cout<< "Yes\n";
        return 0;
    }

    for(int i=1; i<=3; i++)
    {
        if( (a[i][1] ==a[i][2] && a[i][3] == a[i][2]) || ((a[1][i] ==a[2][i] && a[3][i] == a[2][i])) )
        {
            cout<< "Yes\n";
            return 0;

        }
    }

    cout<< "No\n";

    return 0;
}




Measured memory_bytes: 3616
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = []
for i in range(N):
  b.append(int(input()))
pin = 0
for i in range(3):
  if (A[0][i] in b) and (A[1][i] in b) and (A[2][i] in b):
    print('Yes')
    pin = 1
    break
  elif (A[i][0] in b) and (A[i][1] in b) and (A[i][2] in b):
    print('Yes')
    pin = 1
    break
if pin == 0:
  if ((A[0][0] in b) and (A[1][1] in b) and (A[2][2] in b)) or ((A[0][2] in b) and (A[1][1] in b) and (A[2][0] in b)):
    print('Yes')
    pin = 1
if pin == 0:
  print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DOWN(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) std::cin>>(P)
#define IN2(P1,P2) std::cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) std::cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) UP(I,0,N) std::cin>>V[I]
#define OUT(P) std::cout<<P<<std::endl
#define OUT2(P1,P2) std::cout<<P1<<" "<<P2<<std::endl
#define OUT3(P1,P2,P3) std::cout<<P1<<" "<<P2<<" "<<P3<<std::endl
#define OUTS(I,N,V) UP(I,0,N) std::cout<<V[i]<<std::endl
#define ALL(C) (C).begin(),(C).end()
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using namespace std;
using namespace __gnu_pbds;
long i,j,k;
string S;
long K;
long N;
inline void solve(){
  IN2(S,K);
  N=S.size();
  UP(i,0,K-1){
    if(S[i]!='1'){
      OUT(S[i]);
      return;
    }
    if(i>=N)break;
  }
  OUT(1);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
($n,$m)=glob<>;$"for@a=<>;for$i(0..$n-1){($a,$b)=glob$a[$i];$d=1e9;for$j(0..$m-1){$a[$n+$j++]=~$",$d>($k=abs($a-$`)+abs($b-$'))&&($d=$k,$p=$j)}print$p,$/}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
  
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 1005;
int x[N], y[N];

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

    int n;
    cin >> n;

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

    for (int i = 1; i < n; i++) {
    	if (abs(x[i] + y[i]) % 2 != 
    		abs(x[i - 1] + y[i - 1]) % 2) {
    		cout << -1;
    		return 0;
    	}
    }

    vector<ll> v;

    for (int i = 33; i >= 0; i--) {
    	v.push_back(1ll << i);
    }

    if ((x[0] + y[0]) % 2 == 0) {	
    	v.push_back(1);
    }

    cout << v.size() << "\n";
    for (ll x : v)
    	cout << x << " ";
    cout << "\n";

    for (int j = 0; j < n; j++) {
    	string s;

    	ll a = x[j], b = y[j];

		for (int i = 0; i < v.size(); i++) {
			if (abs(a) > abs(b)) {
				if (a < 0) {
					a += v[i];
					s.push_back('L');
				}
				else {
					a -= v[i];
					s.push_back('R');
				}
			}
			else {
				if (b < 0) {
					b += v[i];
					s.push_back('D');
				}
				else {
					b -= v[i];
					s.push_back('U');
				}
			}
		}

		cout << s << "\n";
	}

    return 0;   
}

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

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

	vector<int> p(n);
	for (int i = 0; i< n; i++) {
		cin >> p.at(i);
	}

	int lowest = p.at(0), ans = 1;
	for (int i = 1; i < n; i++) {
		if (lowest > p.at(i)) {
			lowest = p.at(i);
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int a[N];
int main()
{
    int n,x,ans=1,ma;
    cin>>n;
    for(int i=0;i<n;i++) scanf("%d",a+i);
    ma=a[0];
    for(int i=1;i<n;i++){
        ma=min(ma,a[i]);
        if(a[i]<=ma) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main()
{
	char s1[1001], s2[1001];
	int c = 0, c1 = 0,i,j;
	scanf("%s",s1);
	scanf("%s",s2);
	c1 = strlen(s2);
	for (i = 0; i <= strlen(s1)-strlen(s2); i++)
	{
		
		c = 0;
		for (j = 0; j < strlen(s2); j++)
		{
			if (s1[i+j] != s2[j])
				c++;
			
				
		}
		if (c1 > c)

			c1 = c;
	}
	printf("%d",c1);
	return 0;

}


Measured memory_bytes: 1700
#include <stdio.h>

void bsort(int *n1, int *n2, int *n3)
{
	if(*n1 > *n2) {
		int tmp = *n1;
		*n1 = *n2;
		*n2 = tmp;
	}
	if(*n1 > *n3){
		int tmp = *n1;
		*n1 = *n3;
		*n3 = tmp;
	}
	if(*n2 > *n3){
		int tmp = *n2;
		*n2 = *n3;
		*n3 = tmp;
	}
}

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

	bsort(&a, &b, &c);
	printf("%d %d %d\n", a, b, c);

	return (0);
}



Measured memory_bytes: 2060
a, b = input().split()
a = int(a+b)

def try_square_root_naive(n):
    m = int(n**.5)
    return m if abs(m*m - n) < 1e-6 else None

if try_square_root_naive(a) is not None:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9248
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int H, W, K;
	cin >> H >> W >> K;
	char c[400][400];
	int ans[400][400] = { 0 };
	int cnt = 1;
	REP(i, H) {
		REP(j, W) {
			cin >> c[i][j];
			if (c[i][j] == '#') {
				ans[i][j] = cnt;
				cnt++;
			}
		}
	}
	REP(i, H) {
		int tmp = ans[i][0];
		REP(j, W) {
			if (ans[i][j] != 0) {
				tmp = ans[i][j];
			}
			else {
				ans[i][j] = tmp;
			}
		}
	}

	REP(i, H) {
		int tmp = ans[i][W-1];
		for (int j = W - 1; j >= 0; j--) {
			if (ans[i][j] != 0) {
				tmp = ans[i][j];
			}
			else {
				ans[i][j] = tmp;
			}
		}
	}

	FOR(i,1, H) {
		FOR(j,0, W) {
			if (ans[i][j] == 0) {
				ans[i][j] = ans[i-1][j];
			}
		}
	}
	for(int i=H-2;i>=0;i--){
		FOR(j, 0, W) {
			if (ans[i][j] == 0) {
				ans[i][j] = ans[i + 1][j];
			}
		}
	}



	REP(i, H) {
		REP(j, W) {
			cout << ans[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 2176
#include <stdio.h>
#include <iostream>
using namespace std;


void solve(long long A, long long B, long long C){
  cout << max(C - (A - B), 0ll) << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case, unused_imports)]

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

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,VecDeque,BinaryHeap};

// Functions

// Main
fn main(){

    input!{
        N: usize,
        S: [String; N]
    }

    let mut ans = "Three";
    for s in S{
        if s=="Y"{
            ans = "Four";
            break;
        }
    }

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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  ll a,b,x;
  ll res=0;
  cin >> a>>b>>x;

  res+=b/x-a/x;
  if(a%x==0) res++;

  cout << res << endl;
}


Measured memory_bytes: 256
'use strict'

const main = input => {
	const args = input.trim().split('\n')
	const n = parseInt(args[0], 10)
	const d = args[1].split(' ').map(Number).sort((a, b) => a - b)
	console.log(d[n / 2] - d[n / 2 - 1])
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 28488
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
int dx[4]={ 0, 1,  0, -1};
int dy[4]={ 1, 0, -1,  0};
using P = pair<int,int>;
int h, w, n;
int sx, sy, gx, gy;
int ans=0, cnt=0;
char c[50][50];
queue<P> que;

int main(){
  cin >> h >> w;
  sx = 0, sy = 0, gx = w-1, gy = h-1;
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      cin >> c[j][i];
      if(c[j][i] == '.') cnt++;
    }
  }
  queue<P> que;
  vector<vector<int>> d(w, vector(h, -1));
  d[sx][sy] = 1;
  que.push(P(sx, sy));
  while(!que.empty()){
    P p = que.front();
    que.pop();
    int px = p.first, py = p.second;
    if(px==gx && py==gy){
      ans += d[px][py];
      sx = px, sy = py;
      break;
    }
    for(int i=0; i<4; i++){
      int nx = px+dx[i], ny = py+dy[i];
      if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
      if(c[nx][ny] == '#' || d[nx][ny] != -1) continue;
      d[nx][ny] = d[px][py] + 1;
      que.push(P(nx, ny));
    }
  }
  if(d[gx][gy] == -1) cout << -1 << endl;
  else cout << cnt-ans << endl; 
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)

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

#define int long long

using namespace std;

signed main()
{

int a=0,b=0,i,x,y,z=0,j;
std::cin >> a>>b;
std::vector<int> v(b);
rep(i,b){
  v[i]=0;
}

rep(i,a){
  std::cin >> x;
  Rep(j,x){
    std::cin >> y;
    v[y-1]++;
  }
}
rep(i,b){
if(v[i]==a){
z++;
}
}
std::cout << z << '\n';
    return 0;
}


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

const int MOD = 1e9 + 7;
const int N = 1e5 + 10;
vector<int> g[N];
int dp[N][2], n; // 0 -> white, 1 -> black

inline int mul(int a, int b) { return (long long)a * b % MOD; }
inline int add(int a, int b) { if ((a += b) >= MOD) a -= MOD; return a; }

int solve(int u, int c, int p) {
   int &dp = ::dp[u][c];
   if (dp != -1)
      return dp;
   if (c == 0) {
      dp = 1;
      for (auto &v : g[u]) {
         if (v == p)
            continue;
         dp = mul(dp, add(solve(v, 0, u), solve(v, 1, u)));
      }
   }
   else {
      dp = 1;
      for (auto &v : g[u]) {
         if (v == p)
            continue;
         dp = mul(dp, solve(v, 0, u));
      }
   }
   return dp;
}

int main() {
   scanf("%d", &n);
   for (int i = 0; i < n - 1; ++i) {
      int x, y;
      scanf("%d%d", &x, &y);
      g[x].push_back(y);
      g[y].push_back(x);
   }
   memset(dp, -1, sizeof(dp));
   g[0].push_back(1);
   g[1].push_back(0);
   printf("%d\n", solve(0, 0, -1));
   return 0;
}

Measured memory_bytes: 13440
import java.util.Scanner;


public class Main {
	static Scanner sc = new Scanner(System.in);
	static int num;
	
	public static void main(String[] args) {
		while(read()){
			solve();
		}
	}
	
	//read Function
	static boolean read(){
		if(sc.hasNextInt()) num = sc.nextInt();	
		if(num == 0) return false;
		
		return true;
	}
	
	//solve Function
	static void solve(){
		int table[] = {0, 1, 2, 3, 5, 7, 8, 9};
		
		String s = Integer.toOctalString(num); //8ツ進ツ青板づ可陛渉環キ
		
		for(int i=0; i<s.length(); i++){// ツ各ツ個づ可妥篠つオツづ陛渉環キ
			int num2 = Integer.parseInt(""+s.charAt(i), 8);
			System.out.print(table[num2]);
		}
		System.out.println();
	}
	
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sf scanf
#define pf printf
int main()
{
    int a[3],k;
    cin>>a[0]>>a[1]>>a[2]>>k;
    sort(a,a+3);

    int x = a[2];
    int ans = x;
    while(k--){
        ans *= 2;
    }
    cout<<ans+a[0]+a[1]<<endl;

    //main();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

const int mod = 1e9 + 7;
inline ll inv(ll a){
	ll b = mod, x = 1, y = 0;
	while(b){
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		x -= t * y;
		swap(x, y);
	}
	return (mod + x % mod) % mod;
}
ll f(int x){
	ll res = 1;
	rep(i, x) res *= i + 1, res %= mod;
	return res;
}
ll C(int p, int q){
	return f(p) * inv(f(q)) % mod * inv(f(p - q)) % mod;
}

int solve(){
	int x, y; cin >> x >> y;
	//p + 2q = x
	//2p + q = y
	if((x + y) % 3) return 0;
	int p = y - (x + y) / 3;
	int q = x - (x + y) / 3;
	if(p < 0 || q < 0) return 0;
	return C(p + q, q);
}
	

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	cout << solve() << endl;
	
	return 0;
}

Measured memory_bytes: 256
// ProblemURL : https://atcoder.jp/contests/abc071/tasks/arc081_a
// ---------------------------------------------
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}

	sort.Sort(sort.Reverse(sort.IntSlice(as)))

	bs := make([]int, 0, n)
	for i := 0; i < n; i++ {
		if i+1 < n && as[i] == as[i+1] {
			bs = append(bs, as[i])
			i++
		}
	}

	if len(bs) < 2 {
		fmt.Println(0)
	} else {
		fmt.Println(bs[0] * bs[1])
	}
}


Measured memory_bytes: 5504
#include<stdio.h>

int main()
{
  int i,n,q,S[10000],T[500],j=0,k=0,a;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&S[i]);
    }
  scanf("%d",&q);
  for(i=0;i<q;i++)
    {
      scanf("%d",&T[i]);
    }

  for(i=0;i<q;i++)
    {
      S[n]=T[i];
      j=0;
      while( S[j]!=T[i])
	{
	  j++;
	  if(j==n){k++; break;}
	}
    }
  a=q-k;
  printf("%d\n",a);

  return 0;
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll n, m;
    cin >> n >> m;
    vector<ll> ret;
    for(int i = 1; i * i <= m; i++){
        if(m % i == 0){
            ret.push_back(i);
            if(i * i != m)ret.push_back(m/i);
        }
    }
    ll g = 0;
    sort(all(ret));
    rep(i, ret.size()){
        if(n * ret[i] <= m)g = ret[i]; 
    }
    cout << g << endl;
}


Measured memory_bytes: 256
import std.container;
import std.range;
import std.algorithm;
import std.array;
import std.string;
import std.conv;
import std.stdio;
import std.container;

void main() {
	enum Inf = int.max / 2 - 1;

	int h, w;
	readf(" %s %s\n", &h, &w);

	int cy, cx;
	readf(" %s %s\n", &cy, &cx);
	--cy;
	--cx;

	int goalY, goalX;
	readf(" %s %s\n", &goalY, &goalX);
	--goalY;
	--goalX;

	auto maze = new string[h];
	foreach (i;0..h) {
		maze[i] = readln.chomp;
		assert(maze[i].length == w);
	}


	auto warpTable = new int[][](h, w);
	foreach (line;warpTable) {
		line[] = Inf;
	}

	bool isValid(int y, int x) {
		return y >= 0 && y < h && x >= 0 && x < w;
	}

	struct Position {
		int warpCount, y, x;
	}

	auto queue = heapify!"a.warpCount > b.warpCount"(new Position[0]);
	void insert(int warpCount, int y, int x) {
		if (!isValid(y, x)) {
			return;
		}
		if (maze[y][x] != '.') {
			return;
		}
		if (warpTable[y][x] <= warpCount) {
			return;
		}

		queue.insert(Position(warpCount, y, x));
	}

	insert(0, cy, cx);

	while (!queue.empty) {
		auto pos = queue.front;
		queue.removeFront;

		if (warpTable[pos.y][pos.x] <= pos.warpCount) {
			continue;
		}
		warpTable[pos.y][pos.x] = pos.warpCount;

		insert(pos.warpCount, pos.y - 1, pos.x);
		insert(pos.warpCount, pos.y + 1, pos.x);
		insert(pos.warpCount, pos.y, pos.x - 1);
		insert(pos.warpCount, pos.y, pos.x + 1);

		for (int i = pos.y - 2;i <= pos.y + 2;++i) {
			for (int j = pos.x - 2;j <= pos.x + 2;++j) {
				insert(pos.warpCount + 1, i, j);
			}
		}
	}

	if (warpTable[goalY][goalX] == Inf) {
		writeln(-1);
	} else {
		writeln(warpTable[goalY][goalX]);
	}
}


Measured memory_bytes: 9104
<?php
while (!feof(STDIN) ) {
    $inArray[] = trim(fgets(STDIN));
}
$index = 0;
foreach ($inArray as $inValue) {
    if($inValue == 0){
        break;
    }
    echo "Case ".($index + 1).": ".$inValue.PHP_EOL;
    ++$index;
}
?>


Measured memory_bytes: 10960
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  ll x;
  cin >> x;
  ll now=100;
  ll cnt=0;
  while(now<x){
    now=now+now*0.01;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


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

ll n, a, b, c, d;
map<ll, ll> memo; 

ll solve(ll x) {
    if (!x) return 0;
    if (x == 1) return d;

    if (memo.count(x)) return memo[x];
    
    ll l2 = (x / 2) * 2;
    ll r2 = ((x + 1) / 2) * 2;
    ll l3 = (x / 3) * 3;
    ll r3 = ((x + 2) / 3) * 3;
    ll l5 = (x / 5) * 5;
    ll r5 = ((x + 4) / 5) * 5;

    ll res = 1e18;
    if (x < res / d) res = x * d;
    
    res = min(res, llabs(x - l2) * d + a + solve(l2 / 2));
    res = min(res, llabs(x - r2) * d + a + solve(r2 / 2));

    res = min(res, llabs(x - l3) * d + b + solve(l3 / 3));
    res = min(res, llabs(x - r3) * d + b + solve(r3 / 3));

    res = min(res, llabs(x - l5) * d + c + solve(l5 / 5));
    res = min(res, llabs(x - r5) * d + c + solve(r5 / 5));

    memo[x] = res;
    return res;
}

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    int t; cin >> t;
    while (t--) {
        memo.clear();
        cin >> n >> a >> b >> c >> d;
        cout << solve(n) << '\n';
    }
}


Measured memory_bytes: 4448
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
typedef long long ll;
typedef long double ld;
#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;


bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int change(int& a){
    if(IsPrime(a)){
    }
    else{
        a++;
        change(a);
    }
    return a;
}

int main(){
    int X;
    cin >>X;
    X = change(X);
    cout <<X<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back

signed main(){
    int n;
    cin>>n;
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    
    auto solve = [&](int mid){
        rep(i,n){
            mid = mid/v[i]*v[i];
        }
        return mid;
    };
    
    int l,r;
    {
        ll left=0, right=int(1e17), mid=(left+right)/2LL;
        while(left+1<right){
            int res = solve(mid);
            
            if(res<=2) left = mid;
            else    right= mid;
            
            mid = (left+right)/2LL;
        }
        r = mid;
    }
    
    {
        ll left=0, right=int(1e17), mid=(left+right)/2LL;
        while(left+1<right){
            int res = solve(mid);
            
            if(res<2) left = mid;
            else    right= mid;
            
            mid = (left+right)/2LL;
        }
        l = mid+1;
    }
    if(r<l)cout<<-1<<endl;
    else cout<<l<<" "<<r<<endl;
}


Measured memory_bytes: 1024
N, K = map(int, input().split())
A = [int(s) for s in input().split()]

a = [0] * N
for k in range(K):
    for i in range(N):
        a[max(0, i - A[i])] += 1
        if N - 1 >= (A[i] + i + 1):
            a[A[i] + i + 1] -= 1

    if a[0] == N:
        A = [N] * N
        break
    for j in range(N):
        A[j] = A[j - 1] if j > 0 else 0
        A[j] += a[j]
        a[j] = 0
    # print("k=", k, A)


for i in range(N):
    print(A[i], end="")
    if i < N - 1:
        print(" ", end="")
print()


Measured memory_bytes: 109660
n = int(input())
ls = list(map(int, input().split()))

yen = abs(ls[0])

for i in range(n - 1):
    yen += abs(ls[i + 1] - ls[i])

yen += abs(ls[n - 1])

for j in range(n):
    if j == 0:
        print(yen - abs(ls[0]) - abs(ls[1] - ls[0]) + abs(ls[1]))
    elif j == n - 1:
        print(yen - abs(ls[n - 1]) - abs(ls[n - 1] - ls[n - 2]) + abs(ls[n - 2]))
    else:
        print(yen - abs(ls[j + 1] - ls[j]) - abs(ls[j] - ls[j - 1]) + abs(ls[j + 1] - ls[j - 1]))

Measured memory_bytes: 14048
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

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


Measured memory_bytes: 3624
fun main(args: Array<String>) {
    val numbers = readLine()
        ?.split(" ")
        ?.map { it.toInt() }
        ?: return
    val totalCount = numbers[0]
    val expectedAmount = numbers[1]

    for (i in 0..totalCount) {
        for (j in 0..totalCount) {
            val k = totalCount - (i + j)
            if (k < 0) {
                continue
            }
            val amount = 10000 * i + 5000 * j + 1000 * k
            if (amount == expectedAmount) {
                println("$i $j $k")
                return
            }
        }
    }
    println("-1 -1 -1")
}

Measured memory_bytes: 37928
S = input()
T = input()
ans = 0
for i in range(len(S) - len(T) + 1):
  part = S[i:i+len(T)]
  cnt = 0
  for p, t in zip(part, T):
    if p == t:
      cnt = cnt + 1
  if ans < cnt:
    ans = cnt
print(len(T) - ans)

Measured memory_bytes: 67760
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <iomanip>
#include <string>
#include <math.h>
#include<set>
#include<stdio.h>
#include <bitset>
#include<string.h>
#include <unordered_map>
#define ii int64_t
#define PI 3.14
#define lli long long int
#define li long int
#define deb(x) cout<<"\nhi"<<x<<"\n"
#define mod 1000000007
#define f(x,n) for(int x=0;x<n;++x)
#define ff(x,y,z) for(x=y;x<=z;++x)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// while(scanf("%d",&n)!=EOF)

using namespace std;
int n,m,i,j,k,dp[1002][1002];
char a[1003][1003];


li travel(int i,int j)
{
    if(j>m||i>n || a[i][j]=='#') return 0;
    
    if(dp[i][j]>=0)return dp[i][j];
    
    return dp[i][j] = (travel(i+1,j)%mod+travel(i,j+1)%mod)%mod;

    return 0;

}

int main()
 
{
    fio
    memset(dp, -1, sizeof(dp));
    for(i=0;i<1003;i++)for(j=0;j<1003;j++)a[i][j]='.';
    cin>>n>>m;
    
    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++)
            cin>>a[i][j];
    
    dp[n-1][m]=1;dp[n][m-1]=1;
    
    cout<<travel(1,1);

}





Measured memory_bytes: 5248
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    double targetPrice = scanner.nextDouble();
    
    int year = 0;
    double result = 100.0;
    
    while(result < targetPrice){
      result = result + Math.floor(result * 0.01);
      year++;
    }
    
    System.out.println(year);
    
  }
}

Measured memory_bytes: 37420
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define N 13
#define pi M_PI
int top=0;
char s[200];
int S[101];

void push(int x){
    top++;
    S[top]=x;
}
int pop(){
    top--;
    return S[top+1];
}
int main(){
    int a,b;
    int result;
    while(scanf("%s",s)!=EOF){
        if(s[0]=='+'){
            push(pop()+pop());
        }else if(s[0]=='-'){
            a=pop();
            b=pop();
            push(b-a);
        }else if(s[0]=='*'){
            push(pop()*pop());
        }else if(s[0]=='/'){
            a=pop();
            b=pop();
            push(b/a);
        }else{
            push(atoi(s));
        }
    }
    printf("%d\n",pop());
    return 0;

}


Measured memory_bytes: 2104
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int n;
pair<ll, ll> a[100005];

bool cmp(pair<ll, ll> b, pair<ll, ll> c){
	return ((b.fi - b.se) < (c.fi - c.se));
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	cin >> n;
	ll sum = 0, sum1 = 0;
	rep(i, n) cin >> a[i].fi, sum += a[i].fi;
	rep(i, n) cin >> a[i].se, sum1 += a[i].se;
	if(sum < sum1){
		cout << -1 << endl;
		return 0;
	}
	ll tot = sum - sum1;
	int ans = 0;
	sort(a, a + n, cmp);
	rep(i, n){
		if(a[i].fi - a[i].se >= 0){
			if(tot < (a[i].fi - a[i].se)) break;
			else{
				ans++;
				tot -= a[i].fi - a[i].se;
			}
		}
	}
	cout << n - ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int A, B;
	cin >> A >> B;
	
	FOR(i, 1, 100000) {
		int a = i * 8 / 100;
		int b = i * 10 / 100;
		if (a == A && b == B) {
			cout << i << endl;
			return 0;
		}
	}
	puts("-1");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main(){
    FAST
    ll n,k;
    cin>>n>>k;
    cout<<min(n%k,abs(k-n%k));
}

Measured memory_bytes: 256
/// Kazuki Hoshino


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define endl '\n'

int n, m , q, l[201010], r[202020], ans[555][555], x, y;
vpi v;

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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);


cin >> n >> m >> q;

rep(i, 1, m){

cin >> l[i] >> r[i];
v.pb({l[i],r[i]});

}

sort(all(v));

rep(i, 1, n){
    pi p = {i,0};
    int x = lower_bound(all(v), p )- v.begin() ;
    p = {i,inf};
    int y = upper_bound(all(v), p )- v.begin() ;

    rep(j, x, y-1){
        pi t = v[j];
        ans[t.f][t.ss]++;
    }

}

rep(i, 1, n){

    rep(j, i+1, n){
    ans[i][j]+=ans[i][j-1];
    }
//cout << ans[i][n] << endl;
}

rep1(i, n, 1){

    rep1(j, i-1, 1 ){
    ans[j][i]+=ans[j+1][i];
    //cout << i << " " << j << " " << ans[i][j] << endl;
    }

}

rep(i, 1, q){

cin >> x >> y;
cout << ans[x][y] << endl;

}

return 0;}
///....


Measured memory_bytes: 5360
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
long long int x,y;
bool flag;
int main()
{
	cin>>x>>y;
	if(x%y!=0)
	  cout<<x<<endl;
	else
	  cout<<-1<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256