akhauriyash/Code-Regression huggingface dataset:
from bisect import bisect
D = [0.2,0.6,1.1]
L = [0,0,0,0]
R = [0,0,0,0]
while True:
    try:
        left,right = map(float,raw_input().split())
    except:
        break
    L[bisect(D,left)] += 1
    R[bisect(D,right)] += 1
for left,right in zip(L,R)[::-1]:
    print left,right

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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (2000000000)
#define MOD (1000000007)
#define PI (acos(-1))

int main(){
  int n;
  cin >> n;
  int ans=0;
  if(n<=99){
    ans = min(n,9);
  }
  if(100<=n && n<=9999){
    ans = min(909,9+n-100+1);
  }
  if(10000<=n && n<=100000){
    ans = min(90909,909+n-10000+1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(){
	double a,b,h,m;
	scanf("%lf %lf %lf %lf",&a,&b,&h,&m);
	h = h*60 + m;
	double h_angle = (2.0*M_PI*h)/720.0;
	double m_angle = (2.0*M_PI*m)/60.0;
	double ang = fabs(h_angle-m_angle);
	double len = sqrt(a*a+b*b-2.0*a*b*cos(ang));
	printf("%.9f",len);
}


Measured memory_bytes: 2588
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s1,s2,s;
    cin>>s1>>s2;
    s=s1+s2;
    stringstream ss(s);
    int x=0;
    ss>>x;
    int k=sqrt(x);
    if(k*k==x){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> 
#include<ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define all(v) v.begin(),v.end() 
#define rev(v) v.rbegin(),v.rend()
#define ssd ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define inp 100005
#define en "\n"
using namespace std;
using namespace __gnu_pbds;

signed main() 
{
    ssd
    int i,j,n,k;
	cin>>n>>k;
	vector<int> v(n);
	for(int &i:v) cin>>i;

	vector<char> dp(k+5,'L');
	dp[k+1] = 'S';
	for(i=k+1;i>=2;i--)
	{
		for(j=0;j<n;j++)
		{
			if(dp[i]=='S')
			{
				if(i-v[j]>=1) dp[i-v[j]]='F'; 
			}
			else if(dp[i]=='F')
			{
				if(i-v[j]>=1 && dp[i-v[j]]!='F') dp[i-v[j]]='S'; 
			}
			else
			{
				dp[i] = 'S';
				if(i-v[j]>=1) dp[i-v[j]]='F'; 
			}
		}

	}
	if(dp[1]=='S' || dp[1]=='L') cout<<"Second";
	else cout<<"First";
    return 0;           
}

Measured memory_bytes: 3688
import math
a, b, x = map(int, input().split())
if a*a*b == x:
    print(0)
    exit()
if x <= (a*a*b)/2:
    n = (2*x)/(a*b)
    s = (n**2 + b**2)**0.5
    print(math.degrees(math.asin(b/s)))
else: 
    n = (2*x) / (a**2) - b
    a = (a*n) / (b-n) + a
    s = (a**2 + b**2)**0.5
    print(math.degrees(math.asin(b/s)))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include<vector>

using namespace std;
typedef long long ll;

ll ans,mx,sum,mn=1e18,cnt,flag;

ll b[100000],idx;
int main(){
	ll n;
	cin>>n;
	ll a[n];
	for(ll i=0; i<n; i++){
		cin>>a[i];
		if(a[i]<=0) b[idx++]=i;
	}
	for(ll i=0; i<n; i++){
		if(a[i]<0){
			bool ok=false;
			for(ll j=0; j<idx; j++){
				if(b[j]>i){
					a[i]=abs(a[i]);
					a[b[j]]=abs(a[b[j]]);
					ok=true;
					break;
				}
			}
			if(ok==false){
				for(ll j=0; j<n; j++){
					if(abs(a[j])<mn){
						flag=j;
						mn=abs(a[j]);
					}
				}
				a[i]=abs(a[i]);
				a[flag] *=-1;
			}
		}
	}
	for(ll i=0; i<n; i++){
		sum+=a[i];
	}
	cout<<sum;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	int A, B, X;
	cin >> A >> B >> X;

	if (X - A >= 0 && X - A <= B)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;

int main(void) {
	int pack[3];
	for (int i = 0; i < 3; i++) {
		scanf("%d", &pack[i]);
	}
	sort(pack, pack + 3);
	if (pack[2] == pack[0] + pack[1]) printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 3664
# include <bits/stdc++.h>
# define INF 1e9
using namespace std;

int main(){

  string s;
  cin >> s;
  if((s[0]==s[1] && s[1]==s[2]) || (s[1]==s[2] && s[2]==s[3])){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N=205;
int n,K,mo,i,j,k,l,f[N][N],ans,C[N][N],fac[N];
inline void add(int&a,const int&b){a+=b-mo;a+=a>>31&mo;}
inline int calc(int x,int y,int lim){
	for(k=0;k<=x;++k)for(l=0;l<=y;++l)f[k][l]=0;
	f[x-1][y]=1;
	for(k=x;k>=0;--k)for(l=y;l>=0;--l){
		if(k==0 && l==y)f[k][l]=0;
		if(k && k-1+y-l<=lim)add(f[k-1][l],f[k][l]);
		if(l && l-1+x-k<=lim)add(f[k][l-1],f[k][l]);
	}
	return f[0][0];
}
int main(){
	scanf("%d%d%d",&n,&K,&mo);
	for(i=**C=1;i<N;++i)for(j=*C[i]=1;j<=i;++j)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mo;
	for(i=*fac=1;i<N;++i)fac[i]=1ll*fac[i-1]*i%mo;if(K>=n-1)ans=fac[n];
	for(i=1;i<=n;++i)for(j=1;i+j<=n;++j)if(n-j-1<=K)
		ans=(ans+1ll*C[n][i+j]*C[i-1+j][j]%mo*fac[n-i-j]%mo*fac[i-1]%mo*fac[j]%mo*calc(i,j,K-(n-i-j)))%mo;
	printf("%d\n",ans);
}

Measured memory_bytes: 4088
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
//#include <list>
#include <iomanip>
//#include <stdlib.h>
//#include <cctype>

using namespace std;

const int MAX_N = 1000000;
#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
template <typename T>
void printV(const std::vector<T>& v, const char * const separator = " ")
{
    if(!v.empty())
    {
        std::copy(v.begin(),
                  --v.end(),
                  std::ostream_iterator<T>(std::cout, separator));
        std::cout << v.back() << "\n";
    }
}


Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

Int lcm(Int a, Int b) {
    return a / gcd(a, b) * b;
    //a*bは64bit integer overflow
}

int Max(int a, int b, int c) {
    int temp = max(a, b);
    return max(temp, c);
}

int Min(int a, int b, int c) {
    int temp = min(a, b);
    return min(temp, c);
}

bool integer(double num) {
    return floor(num) == num;
}

Int fact(int num) {
    if (num == 0)
        return 1;
    else
        return num * fact(num - 1);
}

void y() {
    cout << "Yes" << endl;
    exit(0);
}

void n() {
    cout << "No" << endl;
    exit(0);
}

void Y() {
    cout << "YES" << endl;
    exit(0);
}

void N() {
    cout << "NO" << endl;
    exit(0);
}

Int yakusu(int n) {
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            cnt++;
            if (i * i != n) cnt++;
        }
    }
    return cnt;
}

/*   kokomade  */

int cnt = 0;
bool is_prime[ 50000 + 1 ];
vector<int> P;
void Eratosthenes( const int N )
{
    for( int i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;//初期化
    }
    for( int i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( int j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
}

int main() {
    IOS;
    int n,x;cin>>n;
    // int a,b,c;cin>>a>>b>>c;
    string str;cin>>str;

    // vector<int> l(n);
    // vector<string> s(n);
    if(n>=3200)cout<<str;
    else cout<<"red";
    // for(int i=0;i<n;i++){

    // }



    cout<<endl;
    return 0;
}

/*
テレビも無ェ ラジオも無ェ
自動車もそれほど走って無ェ
ピアノも無ェ バーも無ェ
巡査 毎日ぐーるぐる
朝起ぎで 牛連れで
二時間ちょっとの散歩道
電話も無ェ 瓦斯も無ェ
バスは一日一度来る
俺らこんな村いやだ 俺らこんな村いやだ
東京へ出るだ 東京へ出だなら
銭コァ貯めで 東京でベコ(牛)飼うだ
*/


Measured memory_bytes: 892
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main(){
	int a[N];
	int b[N];
	f(i, N){
		a[i] = 0;
		b[i] = 0;
	}
	int n, k;
	int x, y, z;
	int m1, m2, m3, m4, x1, x2, ans;
	bool v = true;
	ans = 0;
	scanf("%d", &n);
	f(i, n){
		scanf("%d", &x);
		if (i % 2 == 0)a[x]++;
		else b[x]++;
	}
	x1 = -1;
	m1 = 0;
	m2 = 0;
	f(i, N){
		if (a[i] > m1){
			m2 = m1;
			m1 = a[i];
			x1 = i;
		}
		else if (a[i] > m2){
			m2 = a[i];
		}
	}
	x2 = -1;
	m3 = 0;
	m4 = 0;
	f(i, N){
		if (b[i] > m3){
			m4 = m3;
			m3 = b[i];
			x2 = i;
		}
		else if (b[i] > m4){
			m4 = b[i];
		}
	}
	if (x1 != x2)ans = n - m1 - m3;
	else{
		ans = min(n - m1 - m4, n - m2 - m3);
	}

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


	return 0;
}


Measured memory_bytes: 1664
import Control.Applicative ((<|>))

calc :: Int -> Int -> Int -> Maybe Int
calc mT c t
  | mT < t = Nothing
  | otherwise = Just c

choose :: Maybe Int -> Maybe Int -> Maybe Int
choose (Just a) (Just b) = Just $ min a b
choose a b = a <|> b

parse :: IO (Int, Int)
parse = do
  [c, t] <- words <$> getLine
  return (read c, read t)

main = do
  (n, mt) <- parse
  paths <- sequence $ replicate n parse
  let a  = foldr1 choose $ map (uncurry (calc mt)) paths
  case a of
    Nothing -> putStrLn "TLE"
    Just c -> print c



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

#define ll long long

ll G;
int D, P[11] = {0}, C[11] = {0};

long long res = 1<<29;

void solve(){
  for(int bit = 0; bit < (1<<D); ++bit){
    long long sum = 0;
    long long num = 0;
    for(int i = 0; i < D; ++i){
      if(bit & (1<<i)) sum += C[i] + P[i]*100*(i+1), num += P[i];
    }
    if(sum >= G) res = min(res, num);
    else{
      for(int i = D-1; i >= 0; --i){
        if (bit & (1<<i)) continue;
        for(int j = 0; j <= P[i]; ++j){
          if(sum >= G) break;
          sum += 100*(i+1);
          ++num;
        }
      }
      res = min(res, num);
    }
  }
  cout << res << endl;
}

int main(){
  cin >> D >> G;

  for(int i = 0; i < D; i++){
    cin >> P[i] >> C[i];
  }

  solve();
}

Measured memory_bytes: 256
n, x, y = map(int, input().split())
l = [0 for _ in range(n-1)]
for i in range(n):
    for k in range(n-i-1):
        j = i+k+1
        if (i<x-1 and j<x-1) or (i>=y and j>=y):
            l[j-i-1] +=1
        elif i<x-1 and j>=y:
            l[j-i-(y-x)+1-1]+=1
        elif x-1<=i<=y-1 and j>=y:
            l[min(j-i, i-(x-1)+1+(j-(y-1)))-1] += 1
        elif x-1<=j<=y-1 and i < x-1:
            l[min(j-i, (y-1)-j+1+(x-1-i))-1]+=1
        else:
            l[min(j-i, i-(x-1)+1+(y-1-j))-1]+=1

for i in l:
    print(i)
    

Measured memory_bytes: 47452
program sum_of_gcd_of_tuples_easy
  implicit none
  integer(8) :: k, a, b, c, s = 0_8
  read(*,*) k
  do a = 1_8, k
    do b = 1_8, k
      do c = 1_8, k
        s = s+gcd(gcd(a,b),c)
      end do
    end do
  end do
  write(*,'(i0)') s
contains
  integer(8) function gcd(a,b)
    integer(8), intent(in) :: a, b
    integer(8) :: x, y
    x = max(abs(a),abs(b))
    y = min(abs(a),abs(b))
    do while (y > 0)
      gcd = y
      y = mod(x,y)
      x = gcd
    end do
  end
end program sum_of_gcd_of_tuples_easy

Measured memory_bytes: 2868
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>


using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long ll;


int main() {

    ll N;
    cin >> N;

    ll c_x,c_y,c_z;

    ll x[N];
    ll y[N];
    ll z[N];

    REP(i,N)
    {
        cin >> x[i] >> y[i] >> z[i];
    }
    bool isOK = true;
    for(ll i = 0; i <= 100; ++i)
    {
        for(ll j = 0; j<= 100; ++j)
        {
            isOK = true;
            c_x = i;
            c_y = j;
            c_z = 0;

            //高度0以外で、c_zを決定
            REP(k,N)
            {
                if(z[k] != 0)
                {
                    c_z = abs(c_x - x[k]) + abs(c_y - y[k]) + z[k];
                    break;
                }
            }


            //(i,j)が中心として、成立するか
            REP(k,N)
            {
                ll tmp = max(c_z - abs(c_x - x[k]) - abs(c_y - y[k]), (ll)0);
                if(tmp != z[k])
                {
                    isOK = false;
                    break;
                }
            }
            if(isOK)break;
        }
        if(isOK)break;
    }

    //中心座標と高度を出力
    cout << c_x << " " << c_y << " " << c_z << endl;

    return 0;

}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

int n;
ll a[2000];
int id[2000];
ll dp[2001][2001];

ll rec(int i, int j)
{
    if (dp[i][j] != -1) return dp[i][j];

    ll res = 0;
    if (i - 1 >= 0) res = max(res, rec(i - 1, j) + a[id[n - j + i - 1]] * abs(id[n - j + i - 1] - (i - 1)));
    if (j + 1 <= n) res = max(res, rec(i, j + 1) + a[id[n - j + i - 1]] * abs(id[n - j + i - 1] - j));
    return dp[i][j] = res;
}

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

    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    
    iota(id, id + n, 0);
    sort(id, id + n, [&](int i, int j) { return a[i] > a[j]; });

    memset(dp, 0xff, sizeof(dp));
    dp[0][n] = 0;
    ll ans = 0;
    for (int i = 0; i <= n; i++) ans = max(ans, rec(i, i));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 35020
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>

using namespace std;

int main(void) {
	
	int n;
	cin >>n;
	
	string a,b,c;
	cin >>a >>b >>c;
	
	int i,kaisu=0,same;
	for (i=0 ; i<n ; i++) {
		same=0;
		
		if (a[i]==b[i]) same++;
		if (a[i]==c[i]) same++;
		if (b[i]==c[i]) same++;
		
		if (same==0) kaisu+=2;
		if (same==1) kaisu+=1;
		
	}
	
	cout <<kaisu <<endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  int M = sc.nextInt();
  String[] a = new String[N];
  String[] b = new String[M];
  boolean exist = false;
  for(int i = 0;i < N;i++)a[i] = sc.next();
  for(int i = 0;i < M;i++)b[i] = sc.next();
  out:
  for(int i = 0;i < N-M+1;i++) {
    for(int j = 0;j < N-M+1;j++) {
      for(int k = 0;k<M;k++) {
        if(!(a[j+k].substring(i,i+M).equals(b[k]))) break;
        if(k == M - 1) {
          exist = true;
          break out;
        }
      }
    }
  }
  if(exist) System.out.println("Yes");
  else System.out.println("No");
}}

Measured memory_bytes: 21712
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC113
{
    class Program
    {
        static void Main(string[] args)
        {

            string line = Console.ReadLine();
            string[] input = line.Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);

            SortedDictionary<int, Prefecture> dic = new SortedDictionary<int, Prefecture>();

            for (int i = 0; i < m; i++)
            {
                string[] c = Console.ReadLine().Split(' ');
                int p = int.Parse(c[0]);
                int year = int.Parse(c[1]);
                City city = new City(p, year);
                city.I = i + 1;
                if (!dic.ContainsKey(p))
                {
                    Prefecture pr = new Prefecture(p);
                    dic.Add(p, pr);
                }

                dic[p].AddCity(year,city);
            }



            SortedDictionary<int, string> cdic = new SortedDictionary<int, string>();
            foreach (Prefecture pr in dic.Values)
            {
                pr.SetCityIndex();
                var d=pr.WriteCities();
                foreach(var pair in d)
                {
                    cdic.Add(pair.Key,pair.Value);
                }                
            }

            foreach(var pair in cdic)
            {
                Console.WriteLine(pair.Value);
            }

        }
    }

    class Prefecture
    {
        public int Number;
        SortedDictionary<int, City> cities = new SortedDictionary<int, City>();

        public Prefecture(int number)
        {
            Number = number;
        }

        public void AddCity(int year, City c)
        {
            cities.Add(year, c);
        }

        public void SetCityIndex()
        {
            int index = 1;
            foreach (City c in cities.Values)
            {
                c.Index = index;
                index++;
            }
        }

        public SortedDictionary<int,string> WriteCities()
        {
            SortedDictionary<int, string> dic = new SortedDictionary<int, string>();
            foreach (City c in cities.Values)
            {
                dic.Add(c.I, c.GetID());
            }
            return dic;
        }
    }

    class City
    {
        public int P { get; }
        public int Year { get; }
        public int Index { get; set; }
        public int I { get; set; }

        public City(int p, int year) {
            this.P = p;
            this.Year = year;
        }

        public string GetID()
        {
            return P.ToString("D6") + Index.ToString("D6");
        }
    }
}


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

int main() {
    const vector<char> vowels = {'a', 'i', 'u', 'e', 'o'};
    char in('\0');
    cin >> in;

    bool flag(false);
    for(int i(0); i < vowels.size(); ++i) {
        if(in == vowels.at(i)) {
            flag = true;
            break;
        }
    }

    if(flag) cout << "vowel" << endl;
    else cout << "consonant" << endl;

    return 0;
}

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

int main() {
  int N;
  cin>>N;
  vector<int> rates(9);
  for(int i=0;i<N;i++){
    int rate;
    cin>>rate;
    if(rate<400){rates.at(0)++;}
    else if(rate<800){rates.at(1)++;}
    else if(rate<1200){rates.at(2)++;}
    else if(rate<1600){rates.at(3)++;}
    else if(rate<2000){rates.at(4)++;}
    else if(rate<2400){rates.at(5)++;}
    else if(rate<2800){rates.at(6)++;}
    else if(rate<3200){rates.at(7)++;}
    else{rates.at(8)++;}
  }
  int cnt=0;
  for(int i=0;i<8;i++){if(rates.at(i)>0){cnt++;}}
  if(cnt==0){cnt=1;rates.at(8)--;}
  cout<<cnt<<' '<<cnt+rates.at(8)<<endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    if(n - k > 0)
        cout << k * x + (n - k) * y << endl;
    else
        cout << n * x << endl;
    // end

    return 0;
}


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

using namespace std;

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

#define int ll

const ll mod = 1e9 + 7;


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



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

	return 0;
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	string s;
	cin>>s;
	int k;
	cin>>k;
	int n=s.size();
	set<string> Set;
	for(int len=1;len<=k;++len){
		for(int i=0;i+len-1<n;++i){
			Set.insert(s.substr(i,len));
		}
	}
	auto it=Set.begin();
	while(--k) it++;
	cout<<*it<<'\n';
}



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

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

	string s = to_string(n);
	bool isnine = false;

	for (int i = 0; i < s.size(); i++)
	{
		if (s.at(i) == '9')
		{
			isnine = true;
		}
	}

	if (isnine)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}


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

int main() {
    long long N;
    cin >> N;
    long long ans = 0;
    for (int i = 1; i <= N; ++i) ans += i;
    for (int i = 3; i <= N; i += 3) ans -= i;
    for (int i = 5; i <= N; i += 5) ans -= i;
    for (int i = 15; i <= N; i += 15) ans += i;
    cout << ans << endl;
}


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

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n;
    cin >> n;

    vector<int> cnts(n + 1, 0);

    long long res = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = i; j <= n; j += i) {
            cnts[j] += 1;
        }
        res += i * 1LL * cnts[i];
    }

    cout << res << '\n';


    return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main() {
    int n;cin >>n;
    n-=2;
    cout <<n*180<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define nl ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()

using namespace std;

int main() {
    nl // Chordyceps - Bittersweet Memories
    string s, t;
    cin >> s >> t;

    int ans = 0;

    for(int i=0; i<s.size(); ++i) {
        if(s[i] != t[i]) ans++;
    }
    
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 3812
if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    A = [i-1 for i in A]
    ans = 0
    before = -10
    for a in A:
        ans += B[a]
        if a-1 == before:
            ans += C[a-1]
        before = a
    print(ans)




Measured memory_bytes: 3064
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 


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

    vector< vector<int> > chIndex(26);  //! ch[c-'a'] gives a list of index of c in string ss (two repetition of s)
    for (int i = 0; i < s.length(); ++i) {
        chIndex[s[i]-'a'].push_back(i);
    }
    for (int i = 0; i < 26; ++i) {
        int len = chIndex[i].size();
        for (int j = 0; j < len; ++j) {
            chIndex[i].push_back(s.length() + chIndex[i][j]);
        }
    }

    int sCount = 0;
    int si = -1;
    for (int ti = 0; ti < t.length(); ++ti) {
        ++si;
        if (s.length() <= si) {
            ++sCount;
            si -= s.length();
        }
        vector<int>& index = chIndex[t[ti]-'a'];
        if (index.empty()) {
            cout << -1 << endl;
            return 0;
        }
        si = *lower_bound(index.begin(), index.end(), si);
    }

    LL ans = (LL) sCount * s.length() + si + 1;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1724
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define f(i,l,h) for(ll i=l;i<h;i++)
#define fr(i,h,l) for(ll i=h;i>=l;i--)

using namespace std;

typedef pair<ll,ll> pll;
const ll INF=(ll)(1e9+7);
typedef vector<ll> vll;

int main()
{
    ll n;
    cin>>n;
    ll h[n+1];
    f(i,1,n+1) cin>>h[i];
    map<ll,ll>diff;
    map<ll,ll>sum;

    for(ll i=1;i<=n;i++){
        diff[i-h[i]]++;
        sum[i+h[i]]++;
    }
    ll ans=0;
    for(ll i=1;i<=n;i++){
        ans+=sum[i-h[i]];
        ans+=diff[i+h[i]];
    }
    ans>>=1;
    cout<<ans<<endl;
}


Measured memory_bytes: 50680
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	string s; cin >> s;
	a--; b--; c--; d--;
	rep(i, b, d) {
		if (s[i] == '#' && s[i + 1] == '#') {
			printf("No"); return 0;
		}
	}
	if (b < c&&d<c) {
		rep(i, a, c) {
			if (s[i] == '#' && s[i + 1] == '#') {
				printf("No");
				return 0;
			}
		}
		int cnt = 0, sub = 0;
		rep(i, b-1, d + 2) {
			if (s[i] == '.') sub++;
			else {
				cnt = max(cnt, sub);
				sub = 0;
			}
		}
		cnt = max(cnt, sub);
		if (cnt >= 3) printf("Yes"); else printf("No");
	}
	else {
		rep(i, a, c) {
			if (s[i] == '#' && s[i + 1] == '#') {
				printf("No"); 
				return 0;
			}
		}
		printf("Yes");
	}
	return 0;
}


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

int main()
{
    int N, T;
    cin >> N >> T;
    int ans = 0;
    vector<int> t(N);
    rep(i, N) cin >> t[i];
    rep(i, N - 1)
    {
        ans += min(t[i + 1] - t[i], T);
    }
    ans += T;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
N=int(input())
A=list(map(int,input().split()))
A=[0]+A+[0]
cost=sum([abs(A[k]-A[k+1]) for k in range(N+1)])
for i in range(1,N+1):
    if A[i-1]<=A[i]<=A[i+1] or A[i-1]>=A[i]>=A[i+1]:
        print(cost)
    else:
        print(cost-abs(A[i-1]-A[i])-abs(A[i]-A[i+1])+abs(A[i-1]-A[i+1]))

Measured memory_bytes: 14172
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int[] w;
		
		int m = scan.nextInt();		
		int n = scan.nextInt();
		
		String str;
		
		int a, b;
		int swap;
		
		w = new int[m];
		for(int i = 0; i < m; i++){
			w[i] = i + 1;
		}

		for(int i = 0; i < n; i++){
			str = scan.next();
			String[] num = str.split(",", 0);
			a = Integer.parseInt(num[0]);
			b = Integer.parseInt(num[1]);
			
			swap = w[a-1];
			w[a-1] = w[b-1];
			w[b-1] = swap;
		}
		
		for(int i = 0; i < m; i++){
			System.out.println(w[i]);
		}
	}
}

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

using namespace std;
#define ll long long int

int main(){
    ll n;
    cin >> n;
    ll happiness[n][3];
    for(int i =0 ; i < n ; i ++)
    {
        cin >> happiness[i][0] >>  happiness[i][1] >> happiness[i][2];
    }
    ll dp[n][3];
    dp[0][0] = happiness[0][0];
    dp[0][1] = happiness[0][1];
    dp[0][2] = happiness[0][2];
    for(int i = 1 ; i < n; i++){
        dp[i][0] = happiness[i][0] + max(dp[i - 1][1] , dp[i - 1][2]);
        dp[i][2] = happiness[i][2] + max(dp[i - 1][1] , dp[i - 1][0]);
        dp[i][1] = happiness[i][1] + max(dp[i - 1][0] , dp[i - 1][2]); 
    }
    cout << max(dp[n- 1][0] , max(dp[n - 1][1] , dp[ n - 1][2]));
}

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

const int N = 505;

int n, m;
char a[N][N];

int main(){
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; i++) scanf("%s", a[i]);
    for(int i = 0; i < m; i++) putchar('#'); puts("");
    for(int i = 1; i < n - 1; i++){
        for(int j = 0; j < m; j++) putchar(".#"[(j & 1) || (a[i][j] == '#')]);
        puts("");
    }
    for(int i = 0; i < m; i++) putchar('.'); puts("");
    puts("");
    for(int i = 0; i < m; i++) putchar('.'); puts("");
    for(int i = 1; i < n - 1; i++){
        for(int j = 0; j < m; j++) putchar(".#"[(~j & 1) || (a[i][j] == '#')]);
        puts("");
    }
    for(int i = 0; i < m; i++) putchar('#'); puts("");    
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr double EPS = 1e-9;



int main() {
    int a,b;
    cin>>a>>b;
    for(double i=1;i<10000;i++){
        if((int)(i*0.08)==a&&(int)(i*0.1)==b){
            cout<<(int)i<<endl;
            return 0;
        }
    }
    fin(-1);
}








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

int main(){
	int hand[3];
	string player[3];
	for(int i=0;i<3;i++){
		cin >> player[i];
		hand[i] = 0;
	}

	int turn = player[0][hand[0]++] - 'a';
	while(1){
		if(hand[turn] == player[turn].size()){
			cout << (char)(turn + 'A') << endl;
			return 0;
		}
		turn = player[turn][hand[turn]++] - 'a';
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

// "Yes"しか出ないのはなぜ？

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

  // solve
  bool OK = false;
  for (int i=0; i<n; i++){
    for (int j=0; j<n; j++){
      int total = 4*i + 7*j;
      if (total == n){
        OK = true;
        break;
      }
    }
  }

  // output
  if (OK){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }


  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;


const int SZ = 101;

const int INF = 1e9;
int d[SZ][SZ][2*SZ];
int used[SZ][SZ][2*SZ];
void init(){
    for(int i=0;i<SZ;i++){
        for(int j=0;j<SZ;j++){
            for(int k=0;k<2*SZ;k++){
                d[i][j][k] = INF;
            }
        }
    }
}
int dx[]={1,0};
int dy[]={0,1};
int main(){
    init();
    int h,w;
    cin>>h>>w;
    vector<string> f(h);
    for(int i=0;i<h;i++) cin>>f[i];
    int x = (int)(f[0][0]=='#');
    d[0][0][x] = x;
    using T =tuple<int,int,int>;
    deque<T> deq;
    deq.push_back(T{0,0,x});
    auto isRange=[&](int x,int y){
        return 0<=x && x<h && 0<=y && y<w;
    };
    while(!deq.empty()){
        auto tmp = deq.front(); deq.pop_front();
        int x= get<0>(tmp),y=get<1>(tmp),z=get<2>(tmp);
        if(used[x][y][z]) continue;
        used[x][y][z]=true;
        
        if(x==h-1 && y==w-1){
            cout<<d[x][y][z]<<endl;
            return 0;
        }
        for(int i=0;i<2;i++){
            int tox = x+dx[i];
            int toy = y+dy[i];
            if(!isRange(tox,toy)) continue;
            if(f[x][y]==f[tox][toy]){
                deq.push_front(T{tox,toy,z});
                d[tox][toy][z] = min(d[tox][toy][z],d[x][y][z]);
            }
            else{
                if(z){
                    deq.push_front(T{tox,toy,z-1});
                    d[tox][toy][z-1] = min(d[tox][toy][z-1],d[x][y][z]);
                }
                deq.push_back(T{tox,toy,z+1});
                d[tox][toy][z+1] = min(d[tox][toy][z+1],d[x][y][z]+1);
            }

        }
    }

    
    
    
    return 0;
}


Measured memory_bytes: 16512
def warshall_floyd(G):
    inf = 10**18
    # 重みつきグラフGに対してすべての頂点対の距離を求める
    n = len(G)
    d = [[inf for i in range(n)] for j in range(n)]
    for i in range(n):
        d[i][i] = 0
        for j in G[i].keys():
            d[i][j] = G[i][j]
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])
    return d


n, m, l = map(int, input().split())
G = [{} for i in range(n)]
for j in range(m):
    a, b, c = map(int, input().split())
    G[a-1][b-1] = c
    G[b-1][a-1] = c
D = warshall_floyd(G)
G = [{} for i in range(n)]
for i in range(n):
    for j in range(n):
        if D[i][j] <= l:
            G[i][j] = 1
D = warshall_floyd(G)
for k in range(int(input())):
    s, t = map(int, input().split())
    if D[s-1][t-1] > 10**10:
        print(-1)
    else:
        print(D[s-1][t-1]-1)


Measured memory_bytes: 69464
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int n,k;
vector<int> val[10];
int dp[2001];
int main() {
    scanf("%d%d",&n,&k);
    for (int i=0; i<n; i++) {
        int c, g; scanf("%d%d",&c,&g);
        val[g-1].push_back(c);
    }
    for (int i=0; i<10; i++) {
        sort(val[i].rbegin(),val[i].rend());
        for (int j=1; j<val[i].size(); j++) {
            val[i][j]+=val[i][j-1]+j*2;
        }
    }
    for (int i=0; i<10; i++) {
        if (val[i].size()!=0) {
            for (int j=k; j>0; j--) {
                for (int l=1; l<=min(j,(int)val[i].size()); l++) {
                    dp[j]=max(dp[j], dp[j-l]+val[i][l-1]);
                }
            }
        }
    }
    printf("%d\n",dp[k]);
}

Measured memory_bytes: 0
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	Info(double arg_slope,int arg_value){
		slope = arg_slope;
		value = arg_value;
	}
	bool operator<(const struct Info &arg) const{
		if(fabs(slope-arg.slope) > EPS){
			return slope < arg.slope;
		}else{
			return value < arg.value;
		}
	}

	double slope;
	int value;
};

double getSlope(int y,int x){
	return double(y)/(double)x;
}

int H,W;
char input_map[600][601],calc_map[602][603];


int main(){

	scanf("%d %d",&H,&W);

	for(int row = 0; row < H; row++){
		scanf("%s",input_map[row]);
	}

	for(int row = 0; row <= H+1; row++){
		for(int col = 0; col <= W+1; col++)calc_map[row][col] = '.';
	}

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			calc_map[row+1][col+1] = input_map[row][col];
		}
	}

	vector<Info> V;

	for(int row = 0; row <= H; row++){
		for(int col = 1; col <= W; col++){

			if(calc_map[row][col] == '#' && calc_map[row][col+1] == '.' && calc_map[row+1][col] == '.' && calc_map[row+1][col+1] == '.'){
				V.push_back(Info(getSlope(H-row,col),1));
			}else if(calc_map[row][col] == '.' && calc_map[row][col+1] == '#' && calc_map[row+1][col] == '#' && calc_map[row+1][col+1] == '#'){
				V.push_back(Info(getSlope(H-row,col),1));
			}else if(calc_map[row][col] == '.' && calc_map[row][col+1] == '.' && calc_map[row+1][col] == '.' && calc_map[row+1][col+1] == '#'){
				V.push_back(Info(getSlope(H-row,col),-1));
			}else if(calc_map[row][col] == '#' && calc_map[row][col+1] == '#' && calc_map[row+1][col] == '#' && calc_map[row+1][col+1] == '.'){
				V.push_back(Info(getSlope(H-row,col),-1));
			}
		}
	}

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

	int tmp = 1,ans = 1;

	for(int i = 0; i < V.size(); i++){
		tmp += V[i].value;
		ans = max(ans,tmp);
	}

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

	return 0;
}



Measured memory_bytes: 5540
#include <bits/stdc++.h>
#define FOR(i,k,n) for(ll i=(k);i<(ll)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)
 
using namespace std;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin>>n;
  double dig = 0;
  ll ans = 1;
  bool ok = true;
  REP(i,n) {
    ll a;
    cin>>a;
    if (a == 0) {
      cout<<0<<endl;
      return 0;
    }
    dig += log(a);
    if (dig > 18.1 * log(10)) {
      ok = false;
    }
    ans *= a;
  }
  if (!ok || ans > 1'000'000'000'000'000'000) {
    cout<<-1<<endl;
  } else {
    cout<<ans<<endl;
  }
  return 0;
}


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

int main() {
  long long a,b,c;
  string ans = "No";

  cin >> a >> b >> c;

  if(a + 2*sqrtl(a)*sqrtl(b)+ b < c) ans = "Yes";
  else ans = "No";

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
// preparation for N log^2 N

import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		char[] cs = sc.next().toCharArray();
		int s = 0, t = cs.length - 1;
		int ans = 0;
		while (s < t) {
			if (cs[s] != cs[t])
				++ans;
			++s;
			--t;
		}
		System.out.println(ans);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 23764
#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,p,e=0;
	cin>>a>>b>>c>>d>>p;
	if(p>c){
		e=p-c;
		e=e*d;
	}
	a=a*p;
	b=b+e;
	if(a>b){
		a=b;
	}
	cout<<a<<endl;
}

Measured memory_bytes: 3084
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();

        if( x-r < 0 || x+r > W || y-r < 0 || y+r > H) System.out.println("No");
        else System.out.println("Yes");
        
    }
}



Measured memory_bytes: 26416
#include <iostream>
#include <cstdio>
#include <cctype>
#include <cstring>
using namespace std;

int main(){  
  int n,a;
  cin >> n >> a;
  if (n%500 <= a)
  {
    cout << "Yes" << endl;
  } else
  {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
char s[505][505];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%s",s[i]+1);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			if((s[i][j]=='#'||j==1||(i&1))&&j!=m)
				printf("#");
			else
				printf(".");
		printf("\n");
	}
	printf("\n");
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			if((s[i][j]=='#'||j==m||(!(i&1)))&&j!=1)
				printf("#");
			else
				printf(".");
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

std::vector<bool> IsPrime;

void sieve(size_t max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    }
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(IsPrime[i]) // iが素数ならば
            for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}



int main(){


    ll x;
    cin>>x;
    sieve(1000000);
    while(true){
        if(IsPrime[x]==true){
            cout<<x<<endl;
            break;
        }else{
            x++;
        }
    }




    
return 0;
}


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

int n, s[105];

int main() {
	cin >> n;
	for(int i = 0; i<n; i++) cin >> s[i];
	int min_no_multiplo = 200;
	int suma = 0;
	
	for (int i = 0; i < n ; i++) {
		suma += s[i];
		if (s[i] % 10 > 0)
			min_no_multiplo = min(min_no_multiplo, s[i]);
	}
	if (suma % 10 > 0) cout << suma;
	else if (min_no_multiplo < 200) cout << suma - min_no_multiplo;
	else cout << 0;
	cout << endl;
	return 0;
	
	
   return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
#define ll long long
#define pb push_back

int main()
{
    int be,af,value;
    vector<int> x;
    while (1)
    {
        cin >> be >> af >> value;
        if (be == 0)
        {
            break;
        }
        int maxvalue = 0;
        for(int i=1; i<=value/2;i++){
            int be1 = (i*100+99)/(be+100);
            int be2 = ((value - i)*100+99)/(be+100);
            int de = be1*(be+100)/100 + be2*(be+100)/100;
            // cout << be1 << " " << be2 <<" " << de<< endl;
            if( de != value){
                continue;
            }
            int af1 = be1*(100+af)/100;
            int af2 = be2*(100+af)/100;
            int total = af1 + af2;
            //  cout << af1 << " + " << af2 <<"="<< total << endl;
            if(total > maxvalue){
                maxvalue = total;
            }
        }
        x.push_back(maxvalue);
    }
    for (int i = 0; i < x.size(); i++)
    {
        cout << x[i] << endl;
    }
}



Measured memory_bytes: 3072
#include<stdio.h>
int main()
{
   int a,b,i,j;
   while(1){
   scanf("%d %d", &a, &b);
   if(a == 0 && b == 0)
    break;
   for(i = 0; i < a; i++){
       for(j = 0; j < b; j++)
       {

        printf("#");
       }
       printf("\n");
   }
   printf("\n");

   }
   return 0;
}


Measured memory_bytes: 2104
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

func readLine(r *bufio.Reader) []byte {
	buf := make([]byte, 0, 1024)
	for {
		l, p, e := r.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return buf
}

func main() {
	r := bufio.NewReaderSize(os.Stdin, 4096)

	var n int

	fmt.Scan(&n)
	var d [50][26]int

	for i := 0; i < n; i++ {
		str := readLine(r)
		for _, v := range str {
			d[i][v-'a']++
		}
	}
	var res [26]int
	for j := 0; j < 26; j++ {
		min := math.MaxInt32
		for i := 0; i < n; i++ {
			if min > d[i][j] {
				min = d[i][j]
			}
		}
		res[j] = min
	}

	for i := 0; i < 26; i++ {
		for j := 0; j < res[i]; j++ {
			fmt.Printf("%c", i+'a')
		}
	}
	fmt.Println("")

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastIO;
    int a, b;
    cin >> a >> b;
    if (a + b == 15)
        cout << "+";
    else if (a * b == 15)
        cout << "*";
    else
        cout << "x";
}


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

#define st first
#define nd second
#define all(x) (x).begin(), (x).end()

using namespace std;
using namespace placeholders;

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

template <class T> void mini(T &l, T r){l = min(l, r);}
template <class T> void maxi(T &l, T r){l = max(l, r);}

template <class TH> void _dbg(const char *sdbg, TH h){cerr << sdbg << "=" << h << "\n";}
template <class TH, class ...TA> void _dbg(const char *sdbg, TH h, TA... a){
	while (*sdbg != ',') cerr << *sdbg++; cerr << "=" << h << ","; _dbg(sdbg + 1, a...);
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
	os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}
template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
	return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef SFIC
	#define eput(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
	#define eput(...) 218
#endif

int main(){
	ll a[4];
	for (int i = 0; i < 4; ++i){
		scanf("%lld", a + i);
		if (i > 0)
			mini(a[i], a[i - 1] * 2);
	}
	ll n;
	scanf("%lld", &n);
	printf("%lld\n", (n & 1) * a[2] + (n >> 1) * a[3]);
	return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <cmath>
#define rep(i, a, n) for(int i = a;i < n;i++)
using namespace std;
 
 
double dp[100010][50]; //DPテーブル(dp[日数][確率の指数]) 多分指数は100も必要ない
double ans[100010]; //n日間の間に弁当を獲得できる回数の期待値
 
 
double pow2(int i){ //2^(-i)
    return pow(2, -i);
}
 
 
void makeDP(){ //DPテーブルを作成しansへ期待値を書き込む
    dp[1][1] = 1;
    ans[1] = 1;
 
    rep(i, 1, 100005){
        rep(j, 0, 49){
            dp[i+1][j+1] = dp[i][j]*pow2(j);
            ans[i+1] += dp[i+1][j+1]; //i+1日目に獲得できる期待値を足しておく
            dp[i+1][0] += dp[i][j]-dp[i+1][j+1];
        }
        ans[i+1] += ans[i]; //前日の期待値を足す
    }
}
 
 
int main(){
    int n;
 
    makeDP();
     
    while(cin >> n, n) cout << fixed << ans[n] << endl;
 
    return 0;
}


Measured memory_bytes: 43084
N, x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
for i in range(len(a)):
    sum_a = sum(a[:i+1])
    if sum_a > x: #何人目までには配れるかの条件式、i人目までの合計を足していく
        print(i)
        break
if sum(a) == x: #全員に配れる場合
    print(N)
elif sum(a) < x: #全員には配れない(一番要求数が多いやつだけにはあげられない)
    print(N-1)


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector> 
using namespace std;
int main() {
    int n,cnt=0;
    cin >> n;
    int p[n];
    for (int i=0; i<n; i++)
        cin >> p[i];
    for (int i=0; i<n-2; i++) {
        if (( p[i] > p[i+1] && p[i+2] < p[i+1] ) ||
            ( p[i] < p[i+1] && p[i+2] > p[i+1] ))
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256