akhauriyash/Code-Regression huggingface dataset:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s,t,d = LI()
    w = LI()
    W = -sum(w)
    if W <= 0:
        for i in range(d):
            s += w[i]
            if s <= t:
                print(i+1)
                return
        print(-1)
    else:
        S = [s]
        for i in range(d):
            S.append(S[-1]+w[i])
            if S[-1] <= t:
                print(i+1)
                return
        m = min(S)
        for j in range(d+1):
            if S[j] == m:
                break
        s = S[j]
        w = w[j:]+w[:j]
        k = (s-t)//W
        s -= k*W
        if s <= t:
            print(k*d+j)
            return
        for i in range(d):
            s += w[i]
            if s <= t:
                print(k*d+i+1+j)
                return
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 18524
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

int main(void){
    Cin(int, a);
    Cin(int, b);
    Cout((a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0) ? "Possible" : "Impossible");
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main(void){
    int a,b;
    cin >> a >> b;

    int sum = a + b;
    int sub = a -b;
    int mul = a * b;

    cout << max(sum,max(sub,mul)) << endl;
    return 0;
}

Measured memory_bytes: 256
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

ll d[MAXn],v[MAXn];

int main()
{
    IOS();
    ll n,k;
    cin>>n>>k;
    REP(i,n)cin>>d[i]>>v[i];
    ll mx=0;

    REP(i,n)if((d[i]|k)==k)mx+=v[i];

    for(int i=0;(1LL<<i)<=k;i++)
    {
      ll tt=0;
      if(k&(1LL<<i))REP(j,n)
      {
        if(((d[j]>>i)|((k>>i)^1))==((k>>i)^1))tt+=v[j];
      }
      mx=max(mx,tt);
    }
    cout<<mx<<endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

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

		for (int i = 0; i < s.length(); i += 2) {
			System.out.print(s.charAt(i));
		}

		System.out.println();

		sc.close();

	}

}

Measured memory_bytes: 46820
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

vector<int> bfs(int s,vector< vector<int> > G){
  int n=G.size();
  vector<int> dp(n,-1);
  queue<int> que;
  dp[s]=0;
  que.emplace(s);
  while(!que.empty()){
    int v=que.front();que.pop();
    for(int u:G[v]){
      if(~dp[u]) continue;
      dp[u]=dp[v]+1;
      que.emplace(u);
    }
  }
  return dp;
}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n,m;
  cin>>n>>m;
  vector<vector<int>> G(n);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }

  auto dist=bfs(0,G);
  cout<<"Yes"<<newl;
  for(int i=1;i<n;i++){
    for(int v:G[i]){
      if(dist[v]+1==dist[i]){
        cout<<v+1<<newl;
        break;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 15820
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

ll gcd(ll a, ll b);
ll power(ll n, ll k);
ll inv(ll n);
ll genfact(ll n, ll k);
ll fact(ll n);
ll nck(ll n, ll k);

int main(void){
  int d, n;
  cin >> d >> n;
  if (n == 100)
    cout << power(100, d) * 101 << endl;
  else
    cout << pow(100, d) * n << endl;

  return 0;
}

ll gcd(ll a, ll b){
  if (a < b)
    return gcd(b, a);
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}

ll power(ll n, ll k){
  ll res = 1;
  while(k > 0){
    if (k & 1) 
      res = res * n % MOD;
    n = n * n % MOD;
    k >>= 1;
  }
  return res;
}

ll genfact(ll n, ll k){

  ll res = 1;
  while (k >= 0){
    res = (res * (n - k)) % MOD;
    k--;
  }

  return res;
}

ll inv(ll n){
  return power(n, MOD - 2);
}

ll fact(ll n){
  return genfact(n, n - 1);
}

ll nck(ll n, ll k){
  if (k == 0)
    return 1;
  if (n <= 0)
    return 0;

  return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
int main(){
  std::string s,t;
  char c;
  int a=0;
  std::cin>>s>>t;
  for(int i=0;i<s.size();++i){
    a=(s==t?1:a);
    c=s[0];
    for(int j=0;j<s.size()-1;++j)s[j]=s[j+1];
    s.back()=c;
  }
  std::cout << (a?"Yes":"No") << "\n";
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
//自作関数
template<class T> ll llpow(T x,T n){ll ans=1;while(n--){ans*=x;}return ans;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
    const long double PI = (acos(-1));
    const long double eps=1e-9;

long long INF = 1LL<<60;
void xlfp(double x){printf("%.10lf\n",x);}

long double f(long double a,long double b,long double theta){
if(theta>PI/2-eps){
        return 0.0;
    }
    long double ret;
    if(a*tan(theta)<=b){
        return a*a*b-a*a*a*tan(theta)/2;
    }
    else{
        return b*b/tan(theta)*a/2.0;
    }
}
int main(){
    long double a,b,x;
    cin>>a>>b>>x;
    long double ok=PI/2.0,ng=0;
    for(int i=1;i<=10000;i++){
        long double mid = (ok+ng)/2.0;
        if(f(a,b,mid)<x)ok=mid;
        else ng=mid;
    }
    xlfp(ok/PI*180);
    return 0;
}




Measured memory_bytes: 640
#参考 __author__ = CIMA
s=j=0  #sは面積の総和
a=[]
b=[]  #各水たまりのスタック
d=[]
for i,x in enumerate(input()):  #enumerate関数を用いることでインデックスと要素を取り出す
    if x == '\\':
        a+=[i]
    elif x == '/' and a:
        j = a.pop()
        c = i-j
        s += c
        while b and b[-1]>j:  #大きな水たまりで統合できるときはスタックから取り出して足す
            c+=d.pop()
            b.pop()

        b += [j]  #考察済みの左側の頂点
        d += [c]

print(s)
print(len(b), *(d))


Measured memory_bytes: 6248
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  if(a>0) cout << "Positive\n";
  else if(a<=0&& b>0) cout << "Zero\n";
  else{
    if(b==0) cout <<"Zero\n";
    else if((b-a)%2==0) cout<<"Negative\n";
    else cout << "Positive\n";
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

double n;

int main(){
	while(cin>>n){
		int ans;
		for(int i=2;;i++){
			ans=i;
			if(n<=9.8*sqrt((double)(5*i-5)/4.9)) break;
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1224
#include<iostream>
#include<cmath>
using namespace std;
const long long MAX=1e18;
long long a[100010];
int main()
{
int n;
long long  x;
long long sum=1;
cin>>n;
bool st=1;
for(int i=1;i<=n;i++)
{
	scanf("%lld",&a[i]);
	if(a[i]==0)
	{
		cout<<0;
		return 0;
	}
}
for(int i=1;i<=n;i++)
{
	if(MAX/a[i]<sum)
	{
		//cout<<i<<" ";
		cout<<-1;
		return 0;
	}
	sum*=a[i];
}
cout<<sum;
}

Measured memory_bytes: 4436
H,W = map(int,(input().split()))
c = [[] for _ in range(10)]
for i in range(10):
    c[i] = list(map(int,(input().split())))
a = [[] for _ in range(H)]
for i in range(H):
    a[i] = list(map(int,(input().split())))
        
dist = [[float("inf")]*10 for _ in range(10)]
for i in range(10):
    for j in range(10):
        dist[i][j] = c[i][j]

def warshall_floyd(d):
    for k in range(10):
        for i in range(10):
            for j in range(10):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])
    return d

dist = warshall_floyd(dist)

ans = 0
for i in range(H):
    for j in range(W):
        if a[i][j] != -1:
            ans += dist[a[i][j]][1]

print(ans)

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

int main(void) {
  int H, W, D;
  cin >> H >> W >> D;
  vector<vector<int>> A(H, vector<int>(W));
  vector<pair<int,int>> mp(H * W + 1);
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A[i][j];
      mp[A[i][j]] = pair<int,int>(j, i);
    }
  }

  vector<int> cost(H * W + 1);
  for (int i = 1; i <= H * W - D; i++) {
    cost[i + D] = cost[i] + abs(mp[i].first - mp[i + D].first) + abs(mp[i].second - mp[i + D].second);
  }

  int Q;
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    int L, R;
    cin >> L >> R;
    cout << cost[R] - cost[L] << endl;
  }

  return 0;
}

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

using namespace std;

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

	int num = 0;
	int minn = 1000;
	for (int i = 0; i < s.size()-2; i++) {
				num = (s[i] - '0') * 100 + (s[i+1]-'0')*10 +(s[i+2]-'0');
				if (abs(num-753) < minn) { minn = abs(num-753); }

	}

	cout << minn << endl;

}

Measured memory_bytes: 256
n, a, b, c, d = gets.split.map(&:to_i)
ss = gets.split('').map{|e| e=='#' ? true : false}
overlap = c > d
 
f_single = false
double_stone_flag = (ss[(a-1)..([c,d].max-1)].select{|e|
  f_double = f_single && e
  f_single = e
  f_double
}).size.positive?
f_single = false
f_double = false
triple_dots_flag = (ss[(b-2)..(d)].select{|e|
  f_triple = f_double && !e
  f_double = f_single && !e
  f_single = !e
  f_triple
}).size.positive?
 
if c < d
  puts double_stone_flag ? 'No' : 'Yes'
else
  puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No'
end

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

const int MAXN = 110;

int main()
{
	
	ll n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	if (a > b) swap(a, b);
	b -= a;
	n --;
	
	if (c == 0)
	{
		puts(b <= n*d ? "YES" : "NO");
		return 0;
	}
	
	for (ll x = 0; x <= n; ++ x)
	{
		ll y = n-x;
		ll q = y-x;
		ll r = b-c*q;
		if (-x*(d-c) <= r && r <= y*(d-c))
		{
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	
	
	return 0;
}
 


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

typedef long long ll;

ll N;
vector<vector<pair<ll, ll>>> Adj;
vector<ll> R;

void dfs(ll v, ll par, ll r) {
  R[v] = r;
  for (auto uwe : Adj[v]) {
    ll u = uwe.first, we = uwe.second;
    if (u == par) continue;
    dfs(u, v, (r + we) % 2);
  }
}
int main() {
  cin >> N;
  Adj.resize(N);
  for (ll i = 0; i < N - 1; ++i) {
    ll u, v, we;
    cin >> u >> v >> we;
    --u;
    --v;
    Adj[u].push_back(make_pair(v, we));
    Adj[v].push_back(make_pair(u, we));
  }
  R.resize(N);
  dfs(0, -1, 0);
  for (ll r : R) cout << r << endl;
  return 0;
}


Measured memory_bytes: 9984
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0; i<N; i+=1)
using namespace std;

int main() {
  string A;
  cin>>A;
  bool ans=true;
  rep(i,A.size( )) if(i%2==1) {
    if(A[i]!='L' && A[i]!='U' && A[i]!='D') {
      ans=false;
    }
  }
  rep(i,A.size( )) if(i%2==0) {
    if(A[i]!='R' && A[i]!='U' && A[i]!='D') {
      ans=false;
    }
  }
  if(ans)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}
      
      
    
  


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

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i+1;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}



int main() {
   ll N,K;
   cin >> N >> K;
   ll mod1 = N%K;
   ll mod2 = abs(mod1-K);
   cout << min(mod1,mod2) << endl;

}


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

int findsum(int n) {
	int sum=0;
	while(n>0) {
		sum += n%10;
		n /= 10;
	}
	return sum;
}

int main(){
	int n, a, b;
	cin >> n >> a >> b;
	int total=0;
	for (int i=1; i<=n; i++) {
		int sum = findsum(i);
		if(sum>=a && sum <=b) {
			total += i;
		}
	}
	cout << total << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

bool check(ll idx,vl A){
	ll SIZE = A[idx];
	FOR(i,0,A.size()){
		if(i==idx)continue;
		if(2*SIZE >= A[i]){
			SIZE += A[i];
		}
		else return 0;
	}
	return 1;
}

signed main(){
	ll N;
	cin >> N;
	vl A(N);
	FOR(i,0,N)cin >> A[i];
	sort(ALL(A));
	ll imax = N;
	ll imin = -1;
	while(imax-imin>1){
		ll imid = (imax+imin)/2;
		if(check(imid,A))imax = imid;
		else imin = imid;
	}
	cout << N - imax << endl;
}

Measured memory_bytes: 1792
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
ll A,B,ans;

ll read()
{
    ll x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}

int main()
{
    A=read(),B=read();
    if (A==B)
	{
	    puts("1");
	    return 0;
	}
    int k=0,m=0;
    while((A>>k)^(B>>k)) k++;
    A=A&((1ll<<k)-1),B=B&((1ll<<k)-1);
    ans=((1ll<<(k-1))-1)-A+1;
    ans+=((1ll<<k)-1)-((1ll<<(k-1))+A)+1;
    while((B&((1ll<<(k-1))-1))>>m) m++;
    ans+=min((1ll<<(k-1))+A-1,(1ll<<(k-1))+(1ll<<m)-1)-(1ll<<(k-1))+1;
    printf("%lld\n",ans);
    return 0;
}


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


int main() {
  int N, M;

  cin >> N >> M;

  int start = 1;
  int end = N;
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    if (start < a) start = a;
    if (b < end) end = b;
  }
    
  int num = end - (start - 1);
  if (num < 0) num = 0;
  cout << num << endl;
}
/* 2 10 20 */


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
using namespace std;
int solve(int x){
	int ret=0;
	for(int i=1;i*i<=x;i++){
		if(x%i==0){
			ret+=2;
		}
	}
	if(sqrt(x)==int(sqrt(x)))ret--;
	return ret;
}
int main(){
	int n;
	scanf("%d",&n);
	int ans=0;
	for(int i=1;i<=n;i+=2){
		if(solve(i)==8)ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
/* << IN THE NAME OF GOD >> */
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pob pop_back
#define ft first
#define sc second
#define err(x) cerr << #x  << " = "<<  x << '\n'
#define out(x) cout << x << '\n'
#define forp(i, r, l) for(int i = int(r); i < int(l); i++)
#define forn(i, r, l) for(int i = int(r); i > int(l); i--)
#define FAST ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 1e6;
 
		  
int main()
{FAST;
        int a ,b;
        cin >> a >> b;
 if(b  == 100)b++;
 	cout << b;
 forp(i ,0 ,a)cout << "00";

	return 0;
}
 












Measured memory_bytes: 256
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>

int main(){
  
  long long int N, K, tmp;
  char tmp_char;
  std::string initial_state;
  std::vector<long long int> boundary_index;
  
  scanf("%lld%lld", &N, &K);
  /*for(long long int i = 0; i < N+1; i++){
    scanf("%c", &tmp_char);
    initial_state.push_back(tmp_char);
  }*/
  std::cin >> initial_state;
  
  // solve problem
  
  /*for(long long int i = 0; i < N; i++){
    std::cerr << initial_state[i];
  }std::cerr << std::endl;*/
  long long int ans = 0;
  // count happy people in initial state and fill boundary index
  for(long long int i = 1; i < N; i++){
    if(initial_state[i] == initial_state[i-1]){
      //std::cerr << i << std::endl;
      ans++;
    }
    else{ //if(initial_state[i] != initial_state[i-1])
      boundary_index.push_back(i);
    }
  }
  if(initial_state[0] != initial_state[N-1]){
    boundary_index.push_back(N);
  }
  
  // count manipulation
  if(K < boundary_index.size()/2){
    ans += 2*K;
  }
  else{
    ans = N-1;
  }
  /*
  else if(initial_state[0] != initial_state[N-1]){
    ans += boundary_index.size()-1;
  }
  else{
    ans += boundary_index.size();
  }*/
  
  std::cout << ans << std::endl;
  
  return 0;
}


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

#define INF int(1e9)
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=5005;
int n,k;
char s[maxn*2];

int main(){
	scanf("%d%d%s",&n,&k,s);
	int mn=INF;
	rep(i,n)mn=min(mn,int(s[i]));
	rep(i,n)s[n+i]=s[n-1-i];
	if(k==1){
		int pos=0;
		REP(i,n-1){
			bool f=false;
			rep(j,n)if(s[pos+j]!=s[i+j]){
				f=(s[i+j]<s[pos+j]);
				break;
			}
			if(f)pos=i;
		}
		for(int i=pos;i<pos+n;i++)putchar(s[i]);
		return 0;
	}
	int pos=-1,len=0;
	rep(i,2*n){
		int j=i;
		while(j<2*n&&s[j]==s[i])j++;
		if(s[i]==mn&&j-n>=0){
			int cur=j-i;
			if(cur>=n){
				REP(i,n)putchar(mn);
				return 0;
			}
			if(cur>len)len=cur,pos=i-1;
			else if(cur==len){
				bool f=false;
				rep(k,n-len)if(s[pos-k]!=s[i-1-k]){
					f=(s[i-1-k]<s[pos-k]);
					break;
				}
				if(f)pos=i-1;
			}
		}
		i=j-1;
	}
	REP(i,k-1){
		len*=2;
		if(len>=n){
			REP(i,n)putchar(mn);
			return 0;
		}
	}
	REP(i,len)putchar(mn);
	rep(i,n-len)putchar(s[pos-i]);
	return 0;
}

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

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define mod 1000000007
#define endl "\n"
#define all(a) (a).begin(),(a).end()
#define lp(i,a,b) for(i=a;i<b;i++)
#define lpr(i,a,b) for(i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair

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

int main(){

  /*#ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif*/

  fast;
  int i,j,n,m,q=1,x,k,a,b,e,tc,ip;
  
  string s;
  cin>>s;
  lp(i,0,s.size()){
    if( s[i]=='7' ) q=0;
  }
  cout<<(q?"No":"Yes")<<endl;

  return 0;
}


Measured memory_bytes: 3608
n, m, p = map(int, input().split())
abc = [list(map(int, input().split())) for _ in range(m)]


def bellman_ford(s, g):
    # loop 0 - (n-1) : bellman ford
    # loop n - (2n-1): check g can be updated
    dist = [float("inf")] * n
    dist[s] = 0
    for i in range(2 * n):
        for a, b, c in abc:
            a -= 1
            b -= 1
            cost = -(c - p)

            if dist[b] > dist[a] + cost:
                dist[b] = dist[a] + cost
                if i >= n:
                    dist[b] = -float("inf")

    if dist[g] == -float("inf"):
        return -1

    else:
        return max(-dist[g], 0)


ans = bellman_ford(0, n - 1)
print(ans)


Measured memory_bytes: 49240
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main(){

    int n;
    double m;
    double a;
    while(1){
        cin >> n;
        if(n == 0){
            break;
        }
        a = 0;
        m = 0;
        double s[n];
        for(int i=0; i<n; i++){
            cin >> s[i];
            m += s[i];
        }
        m /= n; 
        for(int i=0; i<n; i++){
            a+= (s[i] - m)*(s[i] - m);
        }
        a /= n;
        a = sqrt(a);

        printf("%.8lf\n", a);
    }
    

    return 0;
}

Measured memory_bytes: 3272
import java.util.Scanner;
public class Main {
	  public static void main(String args[]){
	 Scanner scanner = new Scanner(System.in);

int a=scanner.nextInt();

if(a%10==3) {
	System.out.println("bon");
}
else if(a%10==0 || a%10==1 || a%10==6 || a%10==8 ) {
	System.out.println("pon");
}
else{
	System.out.println("hon");
	}
}
	  }

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

ll GCD(ll a, ll b) {
    if (a <= 0 || b <= 0) {
        return -1;
    }
    if (a > b) {
        if (a % b == 0) {
            return b;
        } else {
            GCD(b, a % b);
        }
    } else if (a < b) {
        if (b % a == 0) {
            return a;
        } else {
            GCD(a, b % a);
        }
    } else {
        return a;
    }
}

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

    ll N;
    cin >> N;

    vector<ll> A(N);
    rep (i, N) {
        cin >> A[i];
    }

    vector<ll> left(N, 0), right(N, 0);
    left[0] = A[0];
    right[N-1] = A[N-1];
    for (ll i = 1; i < N; i++) {
        left[i] = GCD(left[i-1], A[i]);
    }
    for (ll i = N-2; i >= 0; i--) {
        right[i] = GCD(right[i+1], A[i]);
    }

    vector<ll> ans(N, 0);
    ans[0] = right[1];
    ans[N-1] = left[N-2];
    for (ll i = 1; i < N-1; i++) {
        ans[i] = GCD(left[i-1], right[i+1]);
    }

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

Measured memory_bytes: 3456
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,b) for(int i=0;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;

int main() {
	int n, k;

	cin >> n >> k;

	ll cnt3 = 0;
	if (k % 2 == 1) {
		for (int i = 1; i <= n; i++) {
			if (i%k == 0) {
				cnt3++;
			}
		}

		ll buf = cnt3*cnt3*cnt3;

		cout << buf << endl;
		return 0;
	}

	
	ll d = k / 2;
	

	ll cnt = 0;
	ll cnt2 = 0;
	for (int i = 1; i <= n; i++) {
		if (i%k==d) {
			cnt++;
		}

		if (i%k == 0) {
			cnt2++;
		}
	}
	
	ll ans = cnt*cnt*cnt + cnt2*cnt2*cnt2;

	cout << ans << endl;

	return 0;
}


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

int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int N;
	cin>>N;
	int K;
	cin>>K;
	int arr[N];
	for(int i=0;i<=N-1;i++)
	{
		cin>>arr[i];
	}
	int dp[N];
	dp[0]=0;
	dp[1]=abs(arr[0]-arr[1]);
	for(int i=1;i<N;i++)
	{
		int a;
		int mini=INT_MAX;
		for(int j=1;j<=K;j++)
		{
			if(j>i)break;
			if((dp[i-j]+abs(arr[i]-arr[i-j]))<mini)
			mini=dp[i-j]+abs(arr[i]-arr[i-j]);
			
			
		}		dp[i]=mini;
	//	cout<<dp[i]<<endl;
	}
	cout<<dp[N-1];
	return 0;
}

Measured memory_bytes: 4364
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for

int main()
{
    string c;
    cin >> c;
    if (c[0] =='a'||c[0] =='i'||c[0] =='u'||c[0] =='e'||c[0] =='o') {
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
    return 0;
}

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

n=int(input())
uv=[list(map(int,input().split())) for i in range(n-1)]
nodenum=0
for i in range(n):
    nodenum+=(n-i)*(i+1)
# print(nodenum)
edgenum=0
for i in range(n-1):
    uv[i].sort()
    u,v=uv[i]
    edgenum+=u*(n-v+1)
# print(edgenum)
print(nodenum-edgenum)

Measured memory_bytes: 101264
//Hina Arare
//https://atcoder.jp/contests/abc089/tasks/abc089_b

#include <cstdio>
#include <string>
using namespace std;

int main()
{
  int N;
  int p = 0, w = 0, g = 0, y = 0;

  scanf("%d", &N);
  for (int i = 0; i < N; i++)
  {
    char tmp[1];
    scanf("%s", tmp);
    string S = tmp;
    if (S == "P")
    {
      p = 1;
    }
    if (S == "W")
    {
      w = 1;
    }
    if (S == "G")
    {
      g = 1;
    }
    if (S == "Y")
    {
      y = 1;
    }
  }

  if (p + w + g + y == 3)
  {
    printf("Three\n");
  }
  else
  {
    printf("Four\n");
  }
}


Measured memory_bytes: 256
def main():
  n, w = [int(e) for e in input().split()]
  t = [-1 for i in range(w + 1)]
  t[w] = 0
  for _ in range(n):
    nw, nv = [int(e) for e in input().split()]
    for i in range(nw, w + 1):
      if t[i] == -1:
        continue
      if t[i - nw] < t[i] + nv:
        t[i - nw] = t[i] + nv
  print(max(t))
main()

Measured memory_bytes: 7764
M = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().split()))
pow2 = [2 ** i % M for i in range(60)]
ans = 0
a1 = [(A[0] >> i) & 1 for i in range(60)]
a0 = [1 - x for x in a1]
for i in range(1, N):
    a = A[i]
    for j in range(60):
        b1 = a & 1
        a >>= 1
        if b1:
            ans += pow2[j] * a0[j] % M
            a1[j] += 1
        else:
            ans += pow2[j] * a1[j] % M
            a0[j] += 1
        ans %= M
print(ans)


Measured memory_bytes: 125624
import sys

E = list(input())

A,B,C,D = map(int, E)

sum = 0
for i in range(2**3):

    op_list = ['-', '-', '-']
    sum1 = 0
    for j in range(len(E)):
        if (i>>j) & 1:
            op_list[j]  = '+'
    sum = eval(E[0]+op_list[0]+E[1]+op_list[1]+E[2]+op_list[2]+E[3])

    if sum==7:
        print(A,op_list[0],B,op_list[1],C,op_list[2],D,"=7", sep="")
        sys.exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=INT_MAX;
struct segtree
{
    vector<ll> node;
    vector<ll> lazy;
    vector<bool> lflg;
    int n;
    segtree(int sz)
    {
        n=1;while(n<sz) n*=2;
        node.resize(2*n,0);
        lazy.resize(2*n,0);
        lflg.resize(2*n,false);
    }
    void lazyupdate(int k, int l, int r)
    {
        if(lflg[k])
        {
            node[k]+=(r-l+1)*lazy[k];
            push(lazy[k],k,l,r);
            lazy[k]=0;
            lflg[k]=false;
        }
    }
    void push(int v,int k,int l,int r)
    {
        if(r-l>0)
        {
            lazy[2*k]+=v;
            lazy[2*k+1]+=v;
            lflg[2*k]=lflg[2*k+1]=true;
        }
    }
    void update(int qa, int qb, int v, int k=1, int l=1,int r=-1)
    {
        if(r<0) r=n;
        lazyupdate(k, l, r);
        if(qb<l||r<qa) return;
        if(qa<=l&&r<=qb)
        {
            node[k]+=(r-l+1)*v;
            push(v,k,l,r);
        }
        else
        {
            int m=(l+r)/2;
            update(qa,qb,v,2*k,l,m);
            update(qa,qb,v,2*k+1,m+1,r);
            node[k]=node[2*k]+node[2*k+1];
        }
    }
    ll get(int qa, int qb, int k=1, int l=1, int r=-1)
    {
        if(r<0) r=n;
        lazyupdate(k ,l, r);
        if(qb<l||r<qa) return 0;
        if(qa<=l&&r<=qb) return node[k];
        else
        {
            int m=(l+r)/2;
            ll lv=get(qa, qb, 2*k, l, m);
            ll rv=get(qa, qb, 2*k+1, m+1, r);
            return lv+rv;
        }
    }
};

int main()
{
    int n,q;
    scanf("%d %d",&n,&q);
    segtree tree(n);
    for(int i=0;i<q;i++){
        int c;
        scanf("%d",&c);
        if(c){
            int x,y;
            scanf("%d %d",&x,&y);
            cout<<tree.get(x,y)<<endl;
        }else{
            int s,t,v;
            scanf("%d %d %d",&s,&t,&v);
            tree.update(s,t,v);
        }
    }
}


Measured memory_bytes: 7084
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,ans,t,max=0;
  int count[1000],a[1000],b[1000];
  cin >> n >> m;
  for(int i=0; i<n; i++) cin >> a[i];
  for(int j=0; j<m; j++) cin >> b[j];

  for(int j=0; j<m; j++){
    for(int i=0; i<n; i++){
	if(b[j] >= a[i]){
	  count[i]++; break;
	}
    }
  }
  for(int i=0; i<n; i++){
	if(count[i]>max){
	  max = count[i];
	  t = i;
	}
  }
  //for(int i=0; i<n; i++) cout << count[i] << endl;
  cout << t+1 << endl;
}


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

class Node {
public:
    int key, priority;
    Node *left, *right;
    Node(int key, int priority)
    {
        this->key = key;
        this->priority = priority;
        this->left = NULL;
        this->right = NULL;
    }
};

Node *leftRotate(Node *t)
{
    Node *s = t->right;
    t->right = s->left;
    s->left = t;
    return s;
}

Node *rightRotate(Node *t)
{
    Node *s = t->left;
    t->left = s->right;
    s->right = t;
    return s;
}

Node *insert(Node *t, int key, int priority)
{
    if (t == NULL)
        return new Node(key, priority);
    if (key == t->key)
        return t;
    if (key < t->key)
    {
        t->left = insert(t->left, key, priority);
        if (t->priority < t->left->priority)
            t = rightRotate(t);
    }
    else
    {
        t->right = insert(t->right, key, priority);
        if (t->priority < t->right->priority)
            t = leftRotate(t);
    }
    return t;
}

Node *deletHelper(Node *, int);

Node *delet(Node *t, int key)
{
    if (t == NULL)
        return NULL;
    if (key < t->key)
        t->left = delet(t->left, key);
    else if (key > t->key)
        t->right = delet(t->right, key);
    else
        return deletHelper(t, key);
    return t;
}

Node *deletHelper(Node *t, int key)
{
    if (t->left == NULL && t->right == NULL)
    {
        delete t;
        return NULL;
    }
    else if (t->left == NULL)
        t = leftRotate(t);
    else if (t->right == NULL)
        t = rightRotate(t);
    else
    {
        if (t->left->priority > t->right->priority)
            t = rightRotate(t);
        else
            t = leftRotate(t);
    }
    return delet(t, key);
}

void find(Node *t, int key)
{
    if (t == NULL)
    {
        cout << "no" << endl;
        return;
    }
    else if (key == t->key)
    {
        cout << "yes" << endl;
        return;
    }
    else if (key < t->key)
        find(t->left, key);
    else
        find(t->right, key);
    return;
}

void printInorder(Node *t)
{
    if (t == NULL)
        return;
    printInorder(t->left);
    cout << ' ' << t->key;
    printInorder(t->right);
    return;
}

void printPreorder(Node *t)
{
    if (t == NULL)
        return;
    cout << ' ' << t->key;
    printPreorder(t->left);
    printPreorder(t->right);
    return;
}

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    Node *root = NULL;
    for (int i = 0; i < n; i++)
    {
        string operation;
        cin >> operation;
        if (operation == "insert")
        {
            int k, p;
            cin >> k >> p;
            root = insert(root, k, p);
        }
        else if (operation == "find")
        {
            int k;
            cin >> k;
            find(root, k);
        }
        else if (operation == "delete")
        {
            int k;
            cin >> k;
            root = delet(root, k);
        }
        else
        {
            printInorder(root);
            cout << endl;
            printPreorder(root);
            cout << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 9416
// practice with Dukkha
#include <algorithm>
#include <iostream>

using namespace std;

int ii[60], jj[60], ww[60], m;

void add(int i, int j, int w) {
	ii[m] = i;
	jj[m] = j;
	ww[m] = w;
	m++;
}

int main() {
	int l; cin >> l;
	int k = 0;
	while (1 << k + 1 <= l)
		k++;
	for (int i = 0; i < k; i++) {
		int j = i + 1;
		add(i, j, 0);
		add(i, j, 1 << i);
	}
	for (int i = 0; i < k; i++)
		if (l & 1 << i)
			add(i, k, l ^= 1 << i);
	cout << k + 1 << ' ' << m << '\n';
	while (m--)
		cout << ii[m] + 1 << ' ' << jj[m] + 1 << ' ' << ww[m] << '\n';
	return 0;
}


Measured memory_bytes: 3544
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  string S;
  cin>>S;
  int ans = 0;
  int tmp;
  for(int i=0;i<N;++i){
    tmp = 0;
    for(int l=0;i+l<N;++l){
      if(S[l]==S[i+l]) tmp++;
      else {
        ans = max(ans, min(tmp, i));
        tmp = 0;
      }
    }
    ans = max(ans, min(tmp, i));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    cout << s[0] << s.length() - 2 << s[s.length()-1] << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] input = scanner.nextLine().split(" ");
        int age = Integer.valueOf(input[0]);
        int value = Integer.valueOf(input[1]);
        int cost = value;

        if (age <= 5) {
            cost = 0;
        } else if ( age >= 6 && age <= 12) {
            cost = value / 2;
        }

        System.out.println(cost);

    }
}

Measured memory_bytes: 21588
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
bool graph[51][51];
int a[2510], b[2510];
int visited[51][51];
bool used[51];
int N, M;
void dfs(int v)
{
    used[v] = true;
    for (int i = 0; i < N; ++i)
    {
        if (!graph[v][i])
            continue;
        if (used[i])
            continue;

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

    //cout << fixed << setprecision(15);

    cin >> N >> M;

    for (int i = 0; i < M; ++i)
    {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        graph[a[i]][b[i]] = true;
        graph[b[i]][a[i]] = true;
    }
    int ans = 0;

    for (int i = 0; i < M; ++i)
    {
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;

        for (int j = 0; j < N; ++j)
            used[j] = false;

        dfs(0);
        bool flag = false;

        for (int j = 0; j < N; ++j)
            if (!used[j])
                flag = true;
        if (flag)
            ans++;

        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/STACK:102400000,102400000")
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <sstream>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define lson root<<1,l,mid
#define rson root<<1|1,mid+1,r
#define Key_Value ch[ch[root][1]][0]
#define DBN1(a)           cerr<<#a<<"="<<(a)<<"\n"
#define DBN2(a,b)         cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBN3(a,b,c)       cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define DBN4(a,b,c,d)     cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e)   cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN6(a,b,c,d,e,f) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<", "<<#f<<"="<<(f)<<"\n"
#define clr(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
const int maxn=500000+5;
const int INF=0x3f3f3f3f;
const int P=1000000007;
const double PI=acos(-1.0);
template<typename T>
inline T read(T&x){
    x=0;int _f=0;char ch=getchar();
    while(ch<'0'||ch>'9')_f|=(ch=='-'),ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x=_f?-x:x;
}
string s;
int cnt;
int main(){
    cin>>s;
    for (int i=0;i<s.length();i++){
        if (s[i]=='1') cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


n, m = LI()
ab = [LI() for _ in range(n)]
cd = [LI() for _ in range(m)]

for a, b in ab:
    ans = -1
    dist = INF
    for i in range(m):
        c, d = cd[i]
        tmp = abs(c - a) + abs(d - b)
        if tmp < dist:
            dist = tmp
            ans = i + 1
    print(ans)


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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl "\n"

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

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int GCD(int x, int y)
{
  if (y != 0) return(GCD(y, x % y));
  return (x);
}

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

  int x, y;

 cin >> x >> y;
 cout << GCD(x, y) << endl;;
}

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

import numpy as np

n, k = map(int, input().split())
h = np.array([int(i) for i in input().split()])

dp = np.array([0]*n)
dp[0] = 0

for i in range(1,n):
    j = max(0,i-k)
    dp[i] = np.min(np.abs(h[i] - h[j:i]) + dp[j:i] )

print(dp[-1])

Measured memory_bytes: 23052
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

	int N=in(),M=in();
	priority_queue<ll,vector<ll>,greater<ll>> A;
	REP(i,N){
		ll a = in<ll>();
		A.push(a);
	}
	vector<pair<ll,ll>> BC(M);
	REP(i,M){
		BC[i].first = in<ll>();
		BC[i].second = in<ll>();
	}
	sort(ALL(BC),[](pair<ll,ll>& lhs,pair<ll,ll> &rhs){
		return lhs.second>rhs.second;
	});
	REP(i,M){
		bool finish = false;
		for(int j=0,ej=BC[i].first;j<ej;j++){
			auto v = A.top();
			if(v>=BC[i].second){
				finish = true;
				break;
			}
			A.pop();
			A.push(BC[i].second);
		}
		if(finish){
			break;
		}
	}
	ll sum = 0;
	while(!A.empty()){
		sum += A.top();
		A.pop();
	}

	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 2804
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int xs = sc.nextInt();
		int ys = sc.nextInt();
		int xt = sc.nextInt();
		int yt = sc.nextInt();
		int n = sc.nextInt();
		int[] xArr = new int[n + 2];
		int[] yArr = new int[n + 2];
		int[] rArr = new int[n + 2];
		for (int i = 0; i < n; i++) {
		    xArr[i] = sc.nextInt();
		    yArr[i] = sc.nextInt();
		    rArr[i] = sc.nextInt();
		}
		xArr[n] = xs;
		yArr[n] = ys;
		xArr[n + 1] = xt;
		yArr[n + 1] = yt;
		double[][] matrix = new double[n + 2][n + 2];
		for (int i = 0; i < n + 1; i++) {
		    for (int j = i + 1; j < n + 2; j++) {
		        double dist = getDist(xArr[i], yArr[i], rArr[i], xArr[j], yArr[j], rArr[j]);
		        matrix[i][j] = dist;
		        matrix[j][i] = dist;
		    }
		}
		PriorityQueue<Path> queue = new PriorityQueue<>();
		queue.add(new Path(n, 0));
		double[] costs = new double[n + 2];
		Arrays.fill(costs, Double.MAX_VALUE);
		while (queue.size() > 0) {
		    Path p = queue.poll();
		    if (costs[p.idx] <= p.value) {
		        continue;
		    }
		    costs[p.idx] = p.value;
		    for (int i = 0; i < n + 2; i++) {
		        if (costs[i] != Double.MAX_VALUE) {
		            continue;
		        }
		        queue.add(new Path(i, p.value + matrix[p.idx][i]));
		    }
		}

	    System.out.println(java.math.BigDecimal.valueOf(costs[n + 1]).toPlainString());
    }
    
    static double getDist(int x1, int y1, int r1, int x2, int y2, int r2) {
        return Math.max(Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)) - r1 - r2, 0);
    }
    
    static class Path implements Comparable<Path> {
        int idx;
        double value;

        public Path(int idx, double value) {
            this.idx = idx;
            this.value = value;
       }
        
        public int compareTo(Path another) {
            if (value == another.value) {
                return 0;
            } else if (value < another.value) {
                return -1;
            } else {
                return 1;
            }
        }
        
        public String toString() {
            return idx + ":" + value;
        }
    }
}



Measured memory_bytes: 55240