akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')

N=INT()
nodes=[[] for i in range(N)]
for i in range(N):
    l=LIST()
    u=l[0]
    l=l[2:]
    for v in l:
        nodes[u-1].append(v-1)
    nodes[u-1].sort()

ans=[[0]*2 for i in range(N)]
visited=[False]*N
time=0
def rec(u):
    if visited[u]:
        return
    visited[u]=True
    global time
    time+=1
    ans[u][0]=time
    for v in nodes[u]:
        rec(v)
    time+=1
    ans[u][1]=time

for i in range(N):
    rec(i)
for i in range(N):
    d,f=ans[i]
    print(i+1, d, f)



Measured memory_bytes: 5684
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
using PS = pair<string,P>;
const int INF = 1e9+7;

int main() {
  int n; cin >> n;
  vector<PS> v(n);
  rep(i,n) {
    int p;
    string s;
    cin >> s >> p;
    v[i] = PS(s, P(100-p, i));
  }

  sort(all(v));

  rep(i,n) {
    cout << v[i].second.second+1 << endl;
  }
}


Measured memory_bytes: 3512
arr = []
10.times { arr << 10.times.map{ 0 } }

while gets do
  x, y, size = $_.split(/,/).map(&:to_i)

  if size >= 1
    arr[x + 1][y] += 1 if x + 1 <= 9
    arr[x - 1][y] += 1 if x - 1 >= 0
    arr[x][y]     += 1
    arr[x][y + 1] += 1 if y + 1 <= 9
    arr[x][y - 1] += 1 if y - 1 >= 0
  end

  if size >= 2
    arr[x + 1][y + 1] += 1 if x + 1 <= 9 && y + 1 <= 9
    arr[x + 1][y - 1] += 1 if x + 1 <= 9 && y - 1 >= 0
    arr[x - 1][y + 1] += 1 if x - 1 >= 0 && y + 1 <= 9
    arr[x - 1][y - 1] += 1 if x - 1 >= 0 && y - 1 >= 0
  end

  if size == 3
    arr[x + 2][y] += 1 if x + 2 <= 9
    arr[x - 2][y] += 1 if x - 2 >= 0
    arr[x][y + 2] += 1 if y + 2 <= 9
    arr[x][y - 2] += 1 if y - 2 >= 0
  end
end

sum = 0
max = 0
arr.each do |in_arr|
  in_arr.each{ |v|
    sum += 1 if v == 0
    max = v  if v > max
  }
end
puts sum, max

Measured memory_bytes: 6152
#include <iostream>

int main(){
  int a,b;
  std::cin >> a >> b;
  int val=0;
  for(int i=0;i<2;i++){
    if(a>=b){
      val+=a;
      a--;
    }else{
      val+=b;
      b--;
    }
  }
  std::cout << val << std::endl;
  return 0;
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
 string s  ,  t ; 
 cin >> s >> t ;
 int ans = 0 ;

 rep(i,s.size()){
  if(s.at(i) !=t.at(i)) ans++;
}

cout << ans ; 

}


Measured memory_bytes: 3872
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#include<tuple>
#include<stdio.h>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n, d;
	cin>>n>>d;
	double x[n][d];
	rep(i, n){
		rep(j, d){
			cin>>x[i][j];
		}
	}
	int a=0;
	double b;
	rep(i, n){
		rep(i2, n){
			b=0;
			rep(j, d){
				b+=pow(abs(x[i][j]-x[i2][j]), 2);
			}
			b=sqrt(b);
			if(fmod(b, 1)==0.0 && b!=0.0){
				a++;
			}
		}
	}
	cout<<a/2<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
#define int long long int
#define pp pair<int,int>
#define endl "\n"
#define PI 3.14159265
int MAXN = 5000001;
const int mod=1000000007;
const int INF =INT_MAX;
inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int pow(int a,int n,int mod){if(n==0)return 1;int p=pow(a,n/2,mod);p=(p%mod*p%mod)%mod;if(n%2) return (p%mod*a%mod)%mod;else return p;}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      vector<int>v(n);
      for(int i=0;i<n;i++)cin>>v[i];
       vector<int>pre(n+1,0);
       pre[n-1]=v[n-1];
       for(int i=n-2;i>=0;i--)pre[i]=(pre[i+1]%mod+v[i]%mod)%mod;
       int ans=0;
       for(int i=0;i<n;i++)
       {
          ans+=(v[i]%mod*pre[i+1]%mod)%mod;
          ans%=mod;
       }
      cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 6360
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define mp(a, b) make_pair(a, b)
const int maxn = 2e5 + 10; 
int x[2], n;
ll Max[4], ans;
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) 
	{
		scanf("%d%d", &x[0], &x[1]);
		for(int j = 0; j < 4; ++j)
		{
			ll tmp = 0;
			for(int k = 0; k < 2; ++k)
				if(j & (1 << k))
					tmp += x[k];
				else
					tmp -= x[k];
			if(i > 1) 
			{
				ans = max(ans, Max[3 - j] + tmp);
				Max[j] = max(Max[j], tmp);
			}
			else
				Max[j] = tmp;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int ans=0;
    cin >> n;
    vector<long long>l(n);
    for(int i=0;i<n;i++)cin >> l[i];

    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int q=j+1;q<n;q++){
                long long a=l[i];
                long long b=l[j];
                long long c=l[q];
                    if(l[i]==l[j]||l[i]==l[q]||l[j]==l[q]){}
                    else if(c<a+b&&b<a+c&&a<b+c)ans++;
            }
        }
    }
    cout << ans;
}

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


#define mod                1000000000000000007
#define pi                 3.1415926535897932384626433832795
#define ll                 long long
#define pb                 push_back
#define pii                pair < int , int >
#define vecsort(v)         sort(v.begin(),v.end())
#define lcm(x,y)           (x/__gcd(x,y))*y
#define forn(i,n)          for(i = 0 ; i < n ; i++)
#define deb(x)             cout << #x << " " << x << endl;
#define vecsum(v)          accumulate(v.begin(), v.end(), 0)
#define T(t)               cout << "Case " << t <<": ";
#define fast_cin           ios_base::sync_with_stdio(false);cin.tie(NULL)


string s , t;

void solve( ){
      cin >> s >> t;

      int cnt = 0 ;
      for( int i = 0 ; s[i] ; i++ ){

          if( s[i] != t[i] ){
              cnt++;
          }
      }
      cout << cnt << endl;


}





int main() {

    solve();



    return 0;
}

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

void sousa(char* out,char* in) {
	int i;
	int nowkazu=0;
	char now=in[0];
	char temp[30];
	for(i=0;out[i];i++)out[i]=0;
	for(i=0;in[i];i++) {
		if(in[i]==now)nowkazu++;
		else {
			sprintf(temp,"%d%c",nowkazu,now);
			strcat(out,temp);
			nowkazu=1;
		}
		now=in[i];
	}
	sprintf(temp,"%d%c",nowkazu,now);
	strcat(out,temp);
}

int main(void) {
	char* buf1;
	char* buf2;
	int i,n;
	buf1=calloc(32768*1024/2,sizeof(char));
	buf2=calloc(32768*1024/2,sizeof(char));
	if(buf1==NULL || buf2==NULL) {
		if(buf1)free(buf1);
		if(buf2)free(buf2);
		return 1;
	}
	while(1) {
		scanf("%d",&n);
		if(n==0)break;
		scanf("%s",buf1);
		for(i=0;i<n;i++) {
			if(i%2==0)sousa(buf2,buf1); else sousa(buf1,buf2);
		}
		if(n%2==0)puts(buf1); else puts(buf2);
	}
	free(buf1);
	free(buf2);
	return 0;
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
#define fi first 
#define se second
#define forn(i, n)for(int i=0;i<int__(n);i++) 
#define sz(a)int__(a.size())
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a){return out << "(" << a.first << ", " << a.second << ")";}
template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int Mod(int x){const int mm=1e9 + 7;x%=mm;if(x<0)x+=mm;return x;}
int Pow(int x,int n){if(n<0)return 0;if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
#define all(x) x.begin(),x.end()
#define Return(x) {cout << x << endl; return 0;}

vvi mult(vvi a,vvi b,int n) {
    vvi c(n, vi (n, 0));

    for(int i=0;i<n;i++) {
        for(int j=0;j<n;j++) {
            for(int k=0;k<n;k++) c[i][j] = Mod(c[i][j] + Mod(a[i][k] * b[k][j]));
        }
    }

    return c;
}

vvi iden(int n) {
    vvi a(n, vi (n , 0));
    for(int i=0;i<n;i++) a[i][i] = 1;
    return a;
}

vvi Pow_mat(vvi a,int n) {
    if(n == 0) return iden(a.size());
    vvi c = Pow_mat(a,n/2);
    c = mult(c,c,a.size());
    if(n%2) c = mult(a,c,a.size());
    return c;
}


int__ main() {
    fast;
    int n,k; cin >> n >> k;
    vvi a(n, vi(n, 0));
    for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin >> a[i][j];

    a = Pow_mat(a,k);
    int ans = 0;

    for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(a[i][j]) ans = Mod(ans + a[i][j]);

    cout << ans << endl; 
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,m;
  cin>>n>>m;
  vvll t(n,vll(0));
  rep(i,m){
    ll a,b;
    cin>>a>>b;
    a--;b--;
    t[a].pb(b);
    t[b].pb(a);
  }
  vll ans(n,-1);
  ans[0]=0;
  queue<ll> que;
  que.pu(0);
  while(sz(que)){
    ll s=que.front();
    que.pop();
    for(auto p:t[s]){
      if(ans[p]!=-1) continue;
      ans[p]=s+1;
      que.pu(p);
    }
  }
  COUT("Yes");
  rep(i,n){
    if(i==0)continue;
    COUT(ans[i]);
  }
}

Measured memory_bytes: 12904
#include<stdio.h>
#include<stdlib.h>
int main(void){
  long a,b,c,n,i;
  int ans=0;
  
  scanf("%d",&n);
  
  for(a=1;a<n;a++){
   for(b=a+1;a*b<n;b++){
     if(1){
    ans = ans + 2;
     }
   }
  }
  for(a=1;a*a<n;a++){
   ans++; 
  }
  
  
  printf("%d",ans);
  return 0;
}




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

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(cin.hasNext()){
			boolean able[] = new boolean[11];
			int c1 = cin.nextInt();
			int c2 = cin.nextInt();
			int c3 = cin.nextInt();
			Arrays.fill(able, true);
			able[c1]=false;
			able[c2]=false;
			able[c3]=false;
			int count=0;
			for(int i = 1; i < 11;i++){
				if(able[i]){
					if(c1+c2+i <= 20){
						count++;
					}
				}
			}
			if(count <= 3){
				System.out.println("NO");
			}
			else if(count >=4){
				System.out.println("YES");
			}
		}
	}

}

Measured memory_bytes: 11000
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	fmt.Println(dfs(0, nextInt()))
}

func dfs(x, n int) int {
	if x > n {
		return 0
	}
	ret := 0
	if is753(x) {
		ret = 1
	}
	for i := 3; i <= 7; i += 2 {
		ret += dfs(x*10+i, n)
	}
	return ret
}

func is753(x int) bool {
	m := map[int]int{7: 0, 5: 0, 3: 0}
	for x > 0 {
		m[x%10]++
		x /= 10
	}
	for _, v := range m {
		if v == 0 {
			return false
		}
	}
	return true
}

func lcm(a, b int64) int64 {
	return (a / gcd(a, b)) * b
}

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

const size = 1000000

var reader = bufio.NewReaderSize(os.Stdin, size)

func nextLine() string {
	var line, buffer []byte
	isPrefix := true
	var err error
	for isPrefix {
		line, isPrefix, err = reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
	}
	return string(buffer)
}
func nextStringArray() []string {
	return strings.Split(nextLine(), " ")
}
func nextInt() int {
	n, _ := strconv.Atoi(nextLine())
	return n
}

func nextIntArray() []int {
	s := strings.Split(nextLine(), " ")
	n := len(s)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i], _ = strconv.Atoi(s[i])
	}
	return a
}

func min(i, j int) int {
	if i > j {
		return j
	}
	return i
}

func max(i, j int) int {
	if i < j {
		return j
	}
	return i
}


Measured memory_bytes: 3840
/*
 * ----------------------------------------------------------------------------
 (: Bismillahir Rahmanir Rahim :) 
 * File: /root/Programming/Atcoder/A_ABC_Swap.cpp
 * Project: /root/Programming/Atcoder
 * Created Date: Saturday, April 4th 2020, 6:01:18 pm
 * Author: Grim Firefly :)
 * Author Mail : GrimFirefly1@gmail.com
 * -----
 * Last Modified: Sat Apr 04 2020
 * Modified By: Grim Firefly :)
 * -----
 * ----------------------------------------------------------------------------
 */

//Code Start
#include <bits/stdc++.h>
using namespace std;

//constant
#define PI acos(-1.0)

//typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned un;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef map<int, int> mii;
typedef map<char, char> mcc;
typedef map<char, int> mci;
typedef map<string, int> msi;
typedef map<ll, ll> mll;

//defined for loop

// defined for taking input
#define gl(x) getline(cin, x)
#define sf scanf
#define sfi(x) sf("%d", &x)
#define sfc(x) sf("%c", &x)
#define sfl(x) sf("%lld", &x)
#define sflu(x) sf("%llu", &x)
#define sfii(x, y) sf("%d %d", &x, &y)
#define sfll(x, y) sf("%lld %lld", &x, &y)
#define sfiii(x, y, z) sf("%d %d %d", &x, &y, &z)
#define sflll(x, y, z) sf("%lld %lld %lld", &x, &y, &z)

//defined for printing
#define pf printf
#define pfn pf("\n")
#define pfcas pf("Case %d: ", cas)
#define pfyes pf("YES")
#define pfno pf("NO")
#define pfi(x) pf("%d", x)
#define pfl(x) pf("%lld", x)

//Defined for loop
//increament
#define loopi(i, j, k) for (int i = j; i < k; i++)
#define loopl(i, j, k) for (ll i = j; i < k; i++)
#define loopc(i, j, k) for (char i = j; i < k; i++)
#define looplu(i, j, k) for (ull i = j; i < k; i++)
//decreament
#define loopri(i, j, k) for (int i = j; i > k; i--)
#define looprl(i, j, k) for (ll i = j; i > k; i--)
#define looprlu(i, j, k) for (ull i = j; i > k; i--)
#define looprc(i, j, k) for (char i = j; i > k; i--)
#define wa(t) while (t--)

//testcases
#define testc(t) for (char cas = 1; cas <= t; cas++)
#define testi(t) for (int cas = 1; cas <= t; cas++)
#define testl(t) for (ll cas = 1; cas <= t; cas++)

//some cmd
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define SZ 10000

//Main Function Start

int main()
{
    int x, y, z;
    sfiii(x, y, z);
    swap(x, y);
    swap(x, z);
    cout<<x<<" "<<y<<" "<<z<<endl;;
    return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

class UnionFind{
private:
	std::vector<int_fast32_t> par, sz2;
	size_t n;

public:
	UnionFind(){}
	UnionFind(size_t n):n(n){
		par.resize(n, -1);
		sz2.resize(n, 0);
	}

	void set_sz(vector<int32>& v){
		REP(i, sz2.size())
			sz2[i] = v[i];
	}

	uint_fast32_t find(uint_fast32_t x){
		return par[x] < 0 ? x : par[x] = find(par[x]);
	}

	size_t size(uint_fast32_t x){
		return -par[find(x)];
	}

	size_t size2(uint_fast32_t x){
		return sz2[x];
	}

	void unite(uint_fast32_t x, uint_fast32_t y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		if(size(x) < size(y)) std::swap(x, y);
		par[x] += par[y];
		sz2[x] += sz2[y];
		par[y] = x;
	}

	bool same(uint_fast32_t x, uint_fast32_t y){
		return find(x) == find(y);
	}
};


int64 H, W, N, M;
vector<int64> v;

int32 to_idx(int64 y, int64 x){
	return y*W+x;
}

int main(void){
	cin >> H >> W;
	vector<string> s(H);
	UnionFind uf(H*W);
	vector<int32> cost(H*W, 0);
	REP(i, H){
		cin >> s[i];
		REP(j, W){
			if(s[i][j] == '#')
				cost[to_idx(i, j)]=1;
		}
	}
	uf.set_sz(cost);
	auto in = [&](int32 y, int32 x){
		return 0<=y&&y<H&&0<=x&&x<W;
	};
	int32 dx[4] = {-1, 0, 1, 0};
	int32 dy[4] = {0, -1, 0, 1};
	REP(i, H){
		REP(j, W){
			REP(k, 4){
				int32 yy = i+dy[k], xx = j+dx[k];
				if(!in(yy, xx)) continue;
				if(s[yy][xx] != s[i][j])
					uf.unite(to_idx(yy, xx), to_idx(i, j));
			}
		}
	}
	int64 res = 0;
	REP(i, H*W){
		if(i == uf.find(i)){
			res += (uf.size(i)-uf.size2(i))*uf.size2(i);
		}
	}
	cout << res << endl;

}


Measured memory_bytes: 4224
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<climits> //INT_MIN/MAX


using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(e);(i)++)
#define FORR(i,s,e) for(int (i)=(s);(i)>(e);(i)--)
#define MOD 1000000007
#define llong long long
#define debug(x) cout<<#x<<": "<<x<<endl


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

    char c[] = "CODEFESTIVAL2016";
    char a[20];

    int ans = 0;

    for (int i = 0; i < 16; i++) {
        cin>> a[i]  ;
        if (a[i] != c[i])
            ans++;

    }


    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
typedef long long ll;
#define mp make_pair
int n;
int main(){
	cin>>n;
	cout<<(1000-n%1000)%1000;
	return 0;
}


Measured memory_bytes: 3616
#import collections
#import itertools as it
#import math
#import numpy as np
#import sys 
#sys.exit()

#  = input()
#  = int(input())
h, a  = map(int, input().split())
'''
#  = list(map(int, input().split()))
'''
'''
n = input()
a = [int(input()) for i in range(n)]
'''
'''
n,m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
'''
# c = collections.Counter()
#-------------------------------#

if h%a==0:
	print(int(h/a))
else:
  	print(h//a+1)

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

vector<ll> pw27(10,1);
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll myceil(ll x,ll y){if(x<=y) return 1;else if(x%y==0) return x/y;else return x/y+1;}

//a,b x
int main(){
	rep1(i,9) pw27[i]=27*pw27[i-1];
	ll N; cin>>N;
	vector<ll> NN(N,0);
	rep(i,N){
		string t; cin>>t;
		vector<ll> tmp(10);
		rep(j,10){
			tmp[j]=t[j]-'a'+1;
		}
		sort(tmp.bg,tmp.ed);
		rep(j,10) NN[i]+=pw27[j]*tmp[j];
	}
	sort(NN.bg,NN.ed);
	ll mem=0,cnt=0,ans=0;
	rep(i,N){
		if(mem!=NN[i]){
			mem=NN[i];
			ans+=cnt*(cnt-1)/2;
			cnt=1;
		}
		else cnt++;

		if(i==N-1) ans+=cnt*(cnt-1)/2;
	}
	cout<<ans;
}

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

using namespace std;

typedef long long ll;

const int N = 1e5 + 5;
int arr[N];
int freq[N];
int fact[N];
int inv[N];

const int mod = 1e9 + 7;

int add(int a, int b)
{
    a = (a + mod) % mod;
    b = (b + mod) % mod;
    return (a + b) % mod;
}

int mul(int a, int b)
{
    a = (a + mod) % mod;
    b = (b + mod) % mod;
    return ((ll)a * b) % mod;
}

int fastpow(int b, int p)
{
    if(!p)
        return 1;
    int ret = fastpow(b, p / 2);
    ret = mul(ret, ret);
    if(p & 1)
        ret = mul(ret, b);
    return ret;
}

void pre()
{
    fact[0] = fact[1] = 1;
    for(int i = 2; i < N; i++)
        fact[i] = mul(i, fact[i - 1]);
    for(int i = 0; i < N; i++)
        inv[i] = fastpow(fact[i], mod - 2);
}

int ncr(int n, int r)
{
    if(r > n)
        return 0;
    return mul(fact[n], mul(inv[r], inv[n - r]));
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    pre();
    int n;
    cin >> n;
    for(int i = 0; i < n + 1; i++)
    {
        cin >> arr[i];
        freq[arr[i]]++;
    }
    int before = 0, after = 0;
    for(int i = 1; i <= n; i++)
    {
        if(freq[i] == 2)
        {
            for(int j = 0; j <= n; j++)
            {
                if(arr[j] == i)
                    break;
                before++;
            }
            for(int j = n; j >= 0; j--)
            {
                if(arr[j] == i)
                    break;
                after++;
            }
        }
    }
    for(int i = 1; i <= n + 1; i++)
    {
        int cur = ncr(before + after, i - 1);
        cout << add(ncr(n + 1, i), -cur) << '\n';
    }
    return 0;
}


Measured memory_bytes: 2816
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> ans(200000);
    while(N--) {
        int a;
        cin >> a;
        ans[a]++;
        ans[a+1]++;
        ans[a+2]++;
    }

    cout << *max_element(ans.begin(), ans.end()) << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#define ALL(a)  (a).begin(),(a).end()
#define MOD 1000000007
//REPEAT
//------------------------------------------
#define FOR(i,m,n) for(int (i)=(m);(i)<(n); i++)
#define REP(i, n) for(int (i)=0;(i)<(n);(i)++)
#define REPS(i,x) for(int (i)=1;i<=(int)(x);(i)++)
#define RREP(i,x) for(int (i)=((int)(x)-1);(i)>=0;(i)--)
#define RREPS(i,x) for(int (i)=((int)(x));(i)>0;(i)--)
//-------------------------------------------
using namespace std;

int main(void){
	string S; cin>>S;
	const int LENGTH=S.size();
	int count=0;
	REP(i,LENGTH/2){
		if( S[i]!=S[LENGTH-1-i] )count++;
	}
	cout<<count<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int n, f;
char s[100001];
int x[100001];
int a[100002];
int main() {
	scanf("%d", &n);
	scanf(" %s", s);
	for (int i = 0; i < n; i++) {
		if (s[i] == 'o')x[i] = 0;
		if (s[i] == 'x')x[i] = 1;
	}
	x[n] = x[0];
	for (int e = 0; e < 4; e++) {
		a[0] = e / 2; a[1] = e % 2;
		for (int i = 1; i <= n; i++) {
			a[i + 1] = (a[i] + a[i - 1] + x[i]) % 2;
		}
		if (a[0] == a[n] && a[1] == a[n + 1]) {
			f = 1;
			for (int i = 0; i < n; i++) {
				if (a[i])s[i] = 'W';
				else s[i] = 'S';
			}
			break;
		}
	}
	if (f)printf("%s\n", s);
	else printf("-1\n");
}

Measured memory_bytes: 2468
import math

N = int(input())
n = math.sqrt(N)
ans = 10 ** 12

for i in range(1 , math.ceil(n) + 1):
  if i * (N // i) == N:
    count = (i - 1) + ((N // i) - 1)
    ans = min(ans , count)
    
print(ans)

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

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

const ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// head

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

    ll x, k, d;
    cin >> x >> k >> d;

    // get as close to 0 as possible, then just walk back and forth? (if positive, go back, if negative go forward etc)

    if(x == 0) {
        if(k % 2 == 0) {
            cout << 0 << endl;
            return 0;
        } else {
            cout << d << endl;
            return 0;
        }
    }
    ll coord = x;
    
    if(x < 0) {
        ll p = min(-coord / d + 1, k);
        k -= p;
        // what is the play here
        // coord + k * d < 0
        // and go one forward from here
        // coord / d = k
        coord += p * d;
    } else {
        ll p = min(coord / d + 1, k);
        k -= p;
        coord -= p * d;
    }

    if(k % 2 == 0) {
        cout << abs(coord) << endl;
    } else {
        ll z = d;
        if(coord > 0) z = -z;
        cout << abs(coord + z) << endl;
    }
    return 0;
}


Measured memory_bytes: 3612
#include<stdio.h>
#include<string.h>
int main(void){
	int a,b,ans;
	char op;
	while(1){
		scanf("%d %c %d",&a,&op,&b);
		switch ( op ){
			case '?' : return 0;
			case '+' : ans = a + b;
			break;
			case '-' : ans = a - b;
			break;
			case '*' : ans = a * b;
			break;
			case '/' : ans = a / b;
			break;
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 600
//IOI 2021
//labriz kon code ra, ham paye ie AC manam, AC age yari kone ta sob man code miznm :)
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define ff first
#define ss second

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

const int MAXN = 100 * 1000 + 17;

int n, a[MAXN], cnt[MAXN];
set<int> s;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i], cnt[a[i]]++, s.insert(a[i]);
	if (s.size() == 1) {
		int t = *s.begin();
		if (t <= n / 2 || t == n - 1)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	else if (s.size() == 2) {
		int t1 = *s.begin();
		s.erase(s.begin());
		int t2 = *s.begin();
		if (t2 - t1 == 1 && t2 <= cnt[t1] + (cnt[t2] / 2) && cnt[t1] + 1 <= t2)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 5760
#include<iostream>
using namespace std;
int maxnum(int x,int y);
int main(){
    int vad,Jp,Js,Jd,Mp,Ms,Md,Hf;
    cin >> vad;
    cin >> Jp;
    cin >> Mp;
    cin >> Js;
    cin >> Ms;
    Jd = Jp / Js + 1;
    if(Jp % Js == 0){
        Jd--;
    }
    Md = Mp / Ms + 1;
    if(Mp % Ms == 0){
        Md--;
    }
    Hf = maxnum(Jd,Md);
    cout << vad - Hf << endl;
    return 0;
}

int maxnum(int x,int y){
    if(x < y){
        return y;
    }
    else if(x > y){
        return x;
    }
    return x;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define ll long long
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
#define PI 3.141592653589793
using namespace std;


int main()
{
    FAST
    int x[5];
    f(i,0,5) cin>>x[i];
    f(i,0,5) 
    {
        if(!x[i]) 
        {
            cout<<i+1;
            return 0;
        }
    }
}


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

#define Mset(s, n)      memset(s, n, sizeof(s))
#define Rp0(i, m)       for(int i = 0; i < m; ++i)
#define Rpd(i, m, l)    for(int i = l; i >= m; --i)
#define Rp1(i ,m)       for(int i = 1; i <= m; i++)
#define All(a)          (a).begin(), (a).end()
#define Lwb             lower_bound
#define Upb             upper_bound
#define Sz(a)           int((a).size())
#define u_map           unordered_map
#define fi              first
#define se              second
#define pb              push_back
#define pf              push_front
#define is              insert
#define ooi             INT_MAX
#define ool             LLONG_MAX
#define ll              long long
#define ull             unsigned ll
#define ld              long double
#define pii             pair<int, int>
#define vi              vector<int>
#define vpii            vector<pii>

const ll MOD = (ll) 1e9 + 7;
const ld PI = acos((ld) -1);
inline int Get_bit(int x, int k){return (x >> (k - 1)) & 1;}
inline ll Gcd(ll a, ll b) {ll r; while(b){ r = a % b; a = b; b = r;} return a;}
inline ll Lcm(ll a, ll b) {return a / Gcd(a, b) * b;}
inline ll Pow(ll n, ll k) {ll r = 1; for(; k; k >>= 1, n = n * n % MOD){if(k & 1) r = r * n % MOD;} return r;}
const int base = 311;


const int N = 2e5 + 10;


int n, k;

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

void Solve(){
    cin >> n >> k;
    string s;
    cin >> s;
    s = ' ' + s;
    s += ' ';
    int x = 1, y = n, ans = 0;
    for(int i = 1; i <= n; i++){
        if(s[i] == s[i - 1] && s[i] == 'L') ans++;
        if(s[i] == s[i + 1] && s[i] == 'R') ans++;
    }
    while(x < y && k){
        while(s[x] == s[x + 1]) x++;
        while(s[y] == s[y - 1]) y--;
        if(x <= y) ans += 2;
        if(x == y - 1) ans--;
        k--;
        x++;
        y--;
    }
    cout << ans;
}


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


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	char a;
	cin>>a;
	cout<<char(a+1);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int n;
    scanf("%d", &n);
    int cur = 100000;
    rep (i, n) {
        cur += cur / 100 * 5;
        cur = (cur+999)/1000*1000;
    }
    printf("%d\n", cur);
    return 0;
}

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

using namespace std;
#ifdef ONLINE_JUDGE
#define cerr if(false)cerr
#endif

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define int long long
#define ld1 long double
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL),cout<<setprecision(14);
#define vint vector<int>
#define all(v) (v).begin(), (v).end()
#define pii pair<int,int>
#define pb push_back
#define mm0(X) memset((X), 0, sizeof((X)))
#define mm1(X) memset((X), -1, sizeof((X)))
#define INF (int)1e9
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define endl '\n'
#define vcc vector<char>
#define rep(i,a,b) for(int i=a;i<b;i++)

// if you have no idea just guess the appropriate well-known algo instead of doing nothing -- Benq inspiration
const int mod=998244353;
//inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int powmod(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return powmod(a,mod-2);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

const int N=(int)2e5+6;
int h,w,kr;
int x[2]; int y[2];
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};

int check(int i,int j){
    if(i<h and j<w and i>=0 and j>=0) return 1;
    return 0;
}
void solve(){
    cin >> h >> w >> kr;
    cin >> x[0] >> y[0];
    cin >> x[1] >> y[1];

    for(int i=0;i<2;i++){
        x[i]--,y[i]--;
    }

    char c[h][w];
    for(int i=0;i<h;i++) for(int j=0;j<w;j++) cin >> c[i][j] ;

    set<pair<int,pii>> s;
    s.insert({0,{x[0],y[0]}});

    int vis[h][w];
    mm0(vis);
    int dis[h][w];
    mm1(dis);
    int final=-1;

    while(!s.empty()){
        auto k = *(s.begin());
        s.erase(s.begin());

        for(int kk=0;kk<4;kk++){
            for(int i=1;i<=kr;i++) {
                int movx=0;

                int xx = k.second.first + dx[kk]*i;
                int xy = k.second.second + dy[kk]*i;

                if(xx==x[1] and xy==y[1]){
                    cout<<k.first+1<<endl;
                    return;
                }

                if (!check(xx, xy)) break;
                if (c[xx][xy] == '@') break;
                if(vis[xx][xy] and dis[xx][xy]<k.first+1) break;
//                if (vis[xx][xy]) continue;

                vis[xx][xy] = 1;
                dis[xx][xy] = k.first+1;
                s.insert({k.first+1,{xx,xy}});
            }

        }
    }
    cout<<final<<endl;
}

int32_t main() {
    faster;

#ifndef ONLINE_JUDGE
    READ("input.txt");
    WRITE("output.txt");
    double beg=clock();
#endif

    int t=1;
//    cin>>t;

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

#ifndef ONLINE_JUDGE
    double endd=clock();
    cout<<endl;
    cerr<<"*** Total time = "<<(endd-beg)/CLOCKS_PER_SEC;
#endif
}


Measured memory_bytes: 27604
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

int N;
std::unordered_map<std::string,int> dict;
std::string name[100];
std::vector<std::string> groups[100];
std::vector<int> graph[100];
bool visited[100];

template <int n>
class UnionFind{
public:
    UnionFind(){
        for(int i=0;i<n;i++){
            par[i] = i;
            rank[i] = 0;
        }
    }
    int find(int x){
        if(x == par[x])return x;
        return par[x] = find(par[x]);
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y){return;}
        
        if(rank[x] > rank[y]){
            par[y] = x;
        }else{
            par[x] = y;
            if(rank[x] == rank[y]){rank[y]++;}
        }
    }
    int rank[n], par[n];
};

UnionFind<100> uf;

void dfs(int u){
    visited[u] = true;
    for(int v : graph[u]){
        if(visited[v]){continue;}
        
        uf.unite(u, v);
        // printf("%d -> %d\n", u, v);
        dfs(v);
    }
}

int main(){
    while(std::cin >> N, N){
        dict.clear();
        for(int i=0;i<100;i++){
            groups[i].clear();
            graph[i].clear();
            visited[i] = false;
        }
        uf = UnionFind<100>();

        for(int i=0;i<N;i++){
            std::string S;
            std::cin >> S;

            int pos = S.find(":");
            name[i] = S.substr(0, pos);
            dict[name[i]] = i;

            int prev = pos + 1;
            while((pos = S.find(",", pos)) != std::string::npos){
                groups[i].push_back(S.substr(prev, pos-prev));
                prev = pos + 1;
                pos += 1;
            }

            groups[i].push_back(S.substr(prev, S.size() - prev - 1));
        }

        for(int i=0;i<N;i++){
            for(const auto& member : groups[i]){
                if(dict.count(member) > 0){
                    graph[i].push_back(dict[member]);
                }
            }
        }

        dfs(0);
        
        // for(int i=0;i<N;i++){
        //     std::cout << "(" << i << ")" << std::endl;
        //     std::cout << name[i];
        //     std::cout << ": ";
        //     for(auto &member : groups[i]){
        //         std::cout << member << " ";
        //     }
        //     std::cout << std::endl;
        // }

        std::vector<std::string> members;

        for(int i=0;i<N;i++){
            if(!uf.same(0, i)){continue;}

            for(auto& member : groups[i]){
                if(dict.count(member) > 0){continue;}
                members.push_back(member);
            }
        }
        
        std::sort(members.begin(), members.end());
        members.erase(std::unique(members.begin(), members.end()), members.end());

        // for(auto& s : members){
        //     std::cout << s << std::endl;
        // }

        std::cout << members.size() << std::endl;
    }
}

Measured memory_bytes: 1356
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n, base = 1531, mod = 1e9 + 7;
vector <int> a, b;

int powlog(int a, int b){
    if(b == 0) return 1;
    int ret = powlog(a, b / 2);
    if(b % 2) return 1LL * ret * ret % mod * a % mod;
    return 1LL * ret * ret % mod;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    a.resize(n);
    for(auto &i : a) cin >> i;
    b.resize(n);
    for(auto &i : b) cin >> i;
    vector <int> c(n), d(n);
    for(int i = 0 ; i < n ; i++){
        c[i] = a[i] ^ a[(i + 1) % n];
        d[i] = b[i] ^ b[(i + 1) % n];
    }
    for(int i = 0 ; i < n ; i++){
        c.push_back(c[i]);
    }
    int h = 0;
    for(int i = 0 ; i < n - 1 ; i++){
        h = (1LL * h * base + d[i]) % mod;
    }
    int g = 0;
    for(int i = 0 ; i + 2 < 2 * n ; i++){
        g = (1LL * g * base + c[i]) % mod;
        if(i >= n - 1){
            g = (g - 1LL * c[i - (n - 1)] * powlog(base, n - 1) % mod + mod) % mod;
        }
        if(i >= n - 2 && g == h){
            int j = (i - (n - 2)) % n;
            cout << j << " " << (a[j] ^ b[0]) << "\n";
        }
    }
}


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

void solve(){
  int H, W; cin >> H >> W;
  string s[2*H];
  for(int i = 0; i < H; ++i) {
    cin >> s[i];
	cout << s[i] << endl;
    cout << s[i] << endl;
  }
}

int main(){
  solve();
  return 0; 
}

Measured memory_bytes: 3644
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define inf INT_MAX/3
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 3.141592653589793
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define FOR(i,a,b) for( int i=(a),_b=(b);i<=_b;i++)
#define DOW(i,b,a) for( int i=(b),_a=(a);i>=_a;i--)
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
#define N 20000009
bool prime[N];
vector<ll> prm;
void seive ()
{

    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {
        if (prime[i] == true)
        {
            prm.pb(i);
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
}
void pr (int f)
{
    if(f==1)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}
int main()
{
    fast;
    ll n;
    cin>>n;
    ll tmp=n,sum=0,f=1;
    while(n)
    {
        ll r= n%10;
        sum+=r;
        n/=10;
    }
    if(tmp%sum) f=0;
    pr(f);
    return 0;
}





Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
	int n, y, m, d;
	cin >> n;
	REP(i, n){
		cin >> y >> m >> d;
		int cnt = 0;
		while(y < 1000){
			while(m <= 10){
				int DM = 19;
				if(m % 2 == 1 || y % 3 == 0) DM = 20;
				while(d <= DM){
					cnt ++;
					d++;
				}
				m++;
				d = 1;
			}
			y++;
			m = 1;
		}

		cout << cnt << endl;

	}
}

Measured memory_bytes: 1160
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b=MI()
for i in range(1,2000):
    x=(i*8)//100
    y=(i*10)//100
    #print(x,y)
    if x==a and y==b:
        print(i)
        sys.exit()
print(-1)

    
            
        
        
    
    
    
    

    
    


    
    

        
        
    


    

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

int main(){
  double l;
  cin >> l;
  double mv = (l/3)*(l/3)*(l/3);
  cout << fixed << setprecision(10);
  cout << mv << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    long long n, k, res;
    cin >> n >> k;

    res = n % k;
    res = min(res, k - res);
    cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
#include<string.h>
using namespace std;
typedef long long int llint;
int main(){
	int n, m;
	cin >> n >> m;
	vector<pair<int,int>>a(m);
	for (int i = 0; i < m; i++){
		cin >> a[i].first >> a[i].second;
	}
	vector<int>ans(n, 0);
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (a[j].first == i + 1 || a[j].second == i + 1){
				ans[i]++;
			}
		}
	}
	for (int i = 0; i < n; i++){
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		ArrayList<Integer> value  = new ArrayList<>();
		ArrayList<Integer> cost = new ArrayList<>();
		ArrayList<Integer> array = new ArrayList<>();
		int ans = 0;
		for(int i=0;i<N;i++)
			value.add(sc.nextInt());
		for(int i=0;i<N;i++)
			cost.add(sc.nextInt());
		for(int i=0;i<N;i++) {
			array.add(value.get(i) - cost.get(i));
		}
		for(int i=0;i<N;i++) {
			int t = array.get(i);
			if(t > 0)
				ans += t;
		}
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  int ans = 0;
  int tmp, num, reverse;
  
  for(int i = A; i < B+1; i++){
    tmp = i;
    reverse = 0;
    //cout << "tmp: " << tmp << endl;
    while(tmp != 0){
        // 下1桁を取り出す
      num = tmp % 10; 
        // もともとあった数字を一桁あげて、下1桁をたす
      reverse = 10*reverse + num;
        // tmpを一桁下げる
      tmp /= 10;
    }
    if (reverse == i){
      //cout << "reverse: " << reverse << endl;
      ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(max(a * c, a * d), max(b * c, b * d)) << endl;
  return 0;
}


Measured memory_bytes: 3584
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (ll)1e9+7
#define LLINF (ll)1e30
// #define int ll
using namespace std;
const int MOD = 1e9 +7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    vector<ll> x(n),y(n);
    vector<ll> xary,yary;
    rep(i,n){
        cin>>x[i]>>y[i];
        xary.pb(x[i]);
        yary.pb(y[i]);
    }
    sort(all(xary));
    sort(all(yary));
    ll ans=(xary[n-1]-xary[0])*(yary[n-1]-yary[0]);
    rep(xi,n) rep(xj,n) rep(yi,n) rep(yj,n){
        int num = 0;
        ll lx = xary[xi],rx = xary[xj];
        ll by = yary[yi],uy = yary[yj];
        rep(i,n){
            if(lx <= x[i] and x[i] <= rx and by <= y[i] and y[i] <= uy){
                num++;
            }
        }
        if(num >= k) ans = min(ans,1LL * (rx - lx) * (uy - by));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
x =raw_input()
b = raw_input()

num = int(b)

y = list(x)

z=[]

if (len(y)%num) ==0:
    numy = len(y)/num
else:
    numy = len(y)/num+1

moji = ""
for i in range(numy):
    z.append( y[i*num])
    moji = moji + z[i]

print moji    



Measured memory_bytes: 2692