akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

import java.math.BigInteger;
import java.util.*;

import java.util.ArrayList;

import java.util.Scanner;


public class Main {

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static final int mod = 1000000007;

    public static int gcd(int a, int b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s=sc.nextLine();
        if(s.charAt(1)=='B')
            System.out.println("ARC");
        else
            System.out.println("ABC");

    }
}









Measured memory_bytes: 35552
<?php
fscanf(STDIN, "%d", $N);

$a = [0, 1, 2, 2, 3, 3, 3,  4,  5,  5,  5,  6,  6,  7,  8];
$b = [0, 1, 3, 3, 7, 7, 7, 14, 22, 22, 22, 33, 33, 46, 60];

$h = intdiv($N, 15);
$d = $N % 15;
$ans = $h * $h * 60 + $b[$d] + $a[$d] * $h * 15;

printf("%d", $ans);


Measured memory_bytes: 16216
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;


int main() {
int64_t A,B;
int K;
cin >> A >> B >> K;
for (int i = A;i <=B;i++) {
    if (i < A+K || i >= B-K+1) cout << i << endl; 
}


return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int palindrome (int n)
{
	int a [5], i = 0;

	while (n > 0) {
		a [i] = n % 10;
		i ++;
		n /= 10;
	}

	if (a [0] == a [4] && a [1] == a [3]) return 1;

	return 0;
}

int main ()
{
	int a, b, i, cnt = 0;

	scanf ("%d%d", &a, &b);

	for (i = a; i <= b; i ++) {
		if (palindrome (i) == 1) cnt ++;
	}

	printf ("%d", cnt);

	return 0;
}


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


int main(){
	long n;
	long long data[100000];
	long long limit = 1000000000000000000;
	cin >> n;
	
	bool zero = false;
	
	for(int i=0;i<n;i++){
		cin >> data[i];
		if(data[i]==0){
			zero = true;
		}
	}
	
	if(zero){
		cout << 0;
	}else{
		long long result = 1;
		for(int i=0;i<n && result!=-1;i++){
			if(((long double)result  * data[i] / limit) > 1){
				result = -1;
			}else{
				result*= data[i];
			}
		}
		cout << result;
	}
}


Measured memory_bytes: 4420
# coding: utf-8
import sys


def main(argv=sys.argv):

    weekdays = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']

    today = input()

    days = weekdays.index('SUN') - weekdays.index(today)

    if days == 0:
        
        days = 7

    print(days)

    return 0


if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};




int main(int argc, const char * argv[]) {
    double A,B,H,M;
    cin >> A >> B >> H >> M;
    double p = 3.141592653589793;

    
    
    double A_cos = cos((2.0*p*(H+M/60.0))/12.0);
    double A_sin = sin((2.0*p*(H+M/60.0))/12.0);
    double B_cos = cos((2.0*p*M)/60.0);
    double B_sin = sin((2.0*p*M)/60.0);
    
    double X_A = -A*A_sin;
    double Y_A = A*A_cos;
    double X_B = -B*B_sin;
    double Y_B = B*B_cos;
    
    double dist = abs(X_B - X_A)*abs(X_B - X_A) + abs(Y_B - Y_A)*abs(Y_B - Y_A);
    dist = sqrt(dist);
    
    cout << fixed << setprecision(20) << dist << endl;

    
   return 0;
}




Measured memory_bytes: 4204
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == 1)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(vector<int>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

//CODE
void solve(void)
{
  int X,A,B;
  cin>>X>>A>>B;
  X -= A;
  cout<< X - (X/B)*B<<endl;
  
  
  
  return;
}


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

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

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

using namespace std;

int main(){
  int n,i,j,c[3][3];
  for(i=0;i<3;i++){
    for(j=0;j<3;j++)cin >> c[i][j];
  }
  int sub;
    sub=c[1][0]-c[0][0];
    for(i=0;i<3;i++)c[1][i]-=sub;
    sub=c[2][0]-c[0][0];
    for(i=0;i<3;i++)c[2][i]-=sub;
    /*for(i=0;i<3;i++){
      for(j=0;j<3;j++)cout << c[i][j] << " ";
      cout << endl;
    }*/
    for(i=0;i<3;i++){
      if(c[0][i]==c[1][i] && c[0][i]==c[2][i]){}
      else{
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  return 0;
}


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

int main() {
    int N, K, tmp, ans;
    cin >> N >> K;
    vector<int> vec(N);
    for(int i = 0;i < N;i++){
        cin >> vec.at(i);
    }
    
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(vec.at(i) > vec.at(j)){
                tmp = vec.at(i);
                vec.at(i) = vec.at(j);
                vec.at(j) = tmp;
            }
        }
    }
    
    int fuck;
    fuck = N - K;
    
    ans = 0;
    for(int k=(N-1);k>(fuck-1);k--){
        ans = ans + vec.at(k);
    }
    
    cout << ans << endl;
}


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

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

int main()
{
    /*A
    int a,b;
    cin>>a>>b;
    if(a+b==3)
    {
        cout<<3<<endl;
    }
    else if(a+b==4)
    {
        cout<<2<<endl;
    }
    else
    {
        cout<<1<<endl;
    }
    */
   /*B
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    string s_t;
    for(int i=0;i<n;i++)
    {   
        s_t.push_back(s[i]);
        s_t.push_back(t[i]);
    }   
    cout<<s_t<<endl;
    */

    ll a,b;
    cin>>a>>b;
    cout<<lcm(a,b)<<endl;
    return 0;
}

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

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

	if(-1000000 <= x-k+1 && x+k-1 <= 1000000)
	for (int i = x - k + 1; i <= x + k - 1; ++i)
		cout << i << " " << flush;
	else if(-1000000 <= x-k+1)
		for(int i = x-k+1; i <= 1000000; ++i)
			cout << i << " " << flush;
	else
		for(int i = -1000000; i <= x+k-1; ++i)
			cout << i << " " << flush;
	return 0;
}

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

int main() {
    int H, N;
    cin >> H >> N;

    int sum=0;
    for(int i = 0; i < N; i++){
        int A;
        cin >> A;

        sum += A;
    }

    if(H <= sum) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
 
using namespace std;
 
priority_queue<int>q;
 
int power(int a,int b){
  int r=1,base=a;
  while(b){
    if(b&1) r*=base;
    base*=base;
    b>>=1;
  }
  return r;
}
 
int main() {
    int x;
    cin>>x;
    for(int i=2;i<=10;++i)
        for(int j=1;power(j,i)<=x;++j)
            q.push(power(j,i));
    cout<<q.top()<<endl;
}

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


int main(){

  double x1,x2,y1,y2,r1,r2;
  
  cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;

  double dist = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));

  if      ( r1+r2  < dist ) cout << 4 << endl;
  else if ( r1+r2 == dist ) cout << 3 << endl;
  else if ( fabs(r1-r2)  < dist ) cout << 2 << endl;
  else if ( fabs(r1-r2) == dist ) cout << 1 << endl;
  else                      cout << 0 << endl;
  return 0;
}



Measured memory_bytes: 3224
#import <iostream>
using namespace std;
int main(){
    int a, b;
    cin >> a >> b;
    if(a < b)
        cout << "a < b" << endl;
    else if (a > b)
        cout << "a > b" << endl;
    else
        cout << "a == b" << endl;
    return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

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

int main(){

	ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
	ll x , y , ans = 0;
	cin >> x >> y;
	
	while(x <= y){
	   ans++;
	   x*= 2;
	}
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin >> s ;
    int check =0;
    for(int i=0;i<2;i++){
        if(s[i] != s[i+1]){
            cout << "Yes" << endl;
            check = 1;
            break;
        
        }
    }
    if(check == 0){
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int n, a, b;
    
    scanf("%d %d %d", &n, &a, &b);
    
    if(n * a > b){
        printf("%d\n", b);
    }else{
        printf("%d\n", n * a);
    }
    
    return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  string s; cin >> s;
  cout << (s[2] == s[3] && s[4] == s[5] ? "Yes\n" : "No\n");
  return 0;
}


Measured memory_bytes: 256
lst = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
n = int(input())
for i in range(n):
    b,f,r,v = map(int,raw_input().split())
    lst[b-1][f-1][r-1] += v
for i in range(4):
    if i != 0:
        print "#"*20
    for j in range(3):
        pri = ""
        for k in range(10):
            pri += " "+ str(lst[i][j][k])
        print pri

Measured memory_bytes: 6476
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<String> A = new ArrayList<>();
        List<Integer> B = new ArrayList<>();
        int sum = 0;
        while (true) {
            String s = sc.nextLine();
            if (s.equals("0"))
                break;
            A.add(s);
        }
        for (int i = 0; i < A.size(); i++) {
            String s = A.get(i);
            for (int j = 0; j < s.length(); j++) {
                sum += Character.getNumericValue(s.charAt(j));
            }
            B.add(sum);
            sum = 0;
        }
        for (int n = 0; n < B.size(); n++) {
            System.out.println(B.get(n));
        }
        sc.close();
    }
}


Measured memory_bytes: 26476
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string>
#include <map>
#include <utility>
#include <set>
#include <queue>
#include <unordered_set>

using namespace std;
#define rep(i, n) for(int i = 0; i < signed(n); i++)
#define rrep(i, n) for(int i = signed(n) - 1; i >= 0; i--)
#define all(co) co.begin(), co.end()

//using LL = long long;
//using P = pair < int, int > ;
//using PI = pair < P, int > ;
typedef pair<int, int> P;
typedef long long LL;
typedef pair<P, int> PI;
const int INF = 1 << 29;
const LL LINF = 1ll << 62ll;

struct edge{ int to, cost; };

int dr[] = { -1, 0, 1, 0 };
int dc[] = { 0, 1, 0, -1 };
vector<P> visitable(vector<vector<int>>& stage, P start)
{
	int h = stage.size(), w = stage[0].size();
	vector<vector<int>> ns(h, vector<int>(w, INF));
	set<P> visited;
	queue<P> que;
	que.push(start);
	visited.insert(start);
	ns[start.first][start.second] = 1;
	while (!que.empty())
	{
		P p = que.front(); que.pop();
		rep(i, 4)
		{
			int nr = dr[i] + p.first, nc = dc[i] + p.second;
			if (nr < 0 || nr >= h || nc < 0 || nc >= w) continue;

			int next = max(stage[nr][nc], min(ns[nr][nc], ns[p.first][p.second]));

			if (next >= ns[nr][nc]) continue;

			ns[nr][nc] = next;
			P np = P(nr, nc);
			//if (visited.count(np)) continue;
			//visited.insert(np);
			que.push(np);
		}
	}

	map<int, int> mp;
	rep(i, h) rep(j, w) mp[ns[i][j]]++;
	vector<P> ret;
	for (P p : mp) ret.push_back(p);
	for (int i = 0; i + 1 < ret.size(); i++) ret[i + 1].second += ret[i].second;
	return move(ret);
}

//x個を満たす最小の添字
int lower(vector<int>& sums, vector<int>& data, int x)
{
	if (sums[sums.size() - 1] < x) return -1;
	if (x <= 0) return -2;

	int idx = lower_bound(all(sums), x) - sums.begin();
	return idx;
}

signed main()
{
	int R;
	while (cin >> R && R)
	{
		int w1, h1, c1, r1; cin >> w1 >> h1 >> c1 >> r1;
		r1--; c1--;
		vector<vector<int>> stage1(h1, vector<int>(w1));
		rep(i, h1) rep(j, w1) cin >> stage1[i][j];

		vector<P> ps1 = visitable(stage1, P(r1, c1));
		vector<int> sums1, data1;
		for (P p : ps1)
		{
			sums1.push_back(p.second);
			data1.push_back(p.first);
		}

		int w2, h2, c2, r2; cin >> w2 >> h2 >> c2 >> r2;
		r2--; c2--;
		vector<vector<int>> stage2(h2, vector<int>(w2));
		rep(i, h2) rep(j, w2) cin >> stage2[i][j];

		vector<P> ps2 = visitable(stage2, P(r2, c2));
		vector<int> sums2, data2;
		for (P p : ps2)
		{
			sums2.push_back(p.second);
			data2.push_back(p.first);
		}

		int ans = INF;
		rep(x, R + 1)
		{
			int l1 = lower(sums1, data1, x);
			if (l1 == -1) continue;
			int s1 = l1 == -2 ? 0 : sums1[l1];
			int a1 = l1 == -2 ? 0 : data1[l1];

			int y = R - s1;
			int l2 = lower(sums2, data2, y);
			if (l2 == -1) continue;
			int s2 = l2 == -2 ? 0 : sums2[l2];
			int a2 = l2 == -2 ? 0 : data2[l2];

			ans = min(ans, a1 + a2);
		}

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

Measured memory_bytes: 12472
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
	int h, w, n, a;
	cin >> h >> w >> n;

	VI nums;
	for (int i = 0; i < n; i++) {
		cin >> a;

		for (int j = 0; j < a; j++) {
			nums.emplace_back(i+1);
		}
	}

	VVI board(h, VI(w, -1));

	int x = 0;
	int y = 0;
	int dx = 1;

	for (int i = 0; i < h*w; i++) {
		board[y][x] = nums[i];

		if (x == 0 && dx == -1) {
			y++;
			dx = 1;
		} else if (x == w - 1 && dx == 1) {
			y++;
			dx = -1;
		} else {
			x += dx;
		}

	}

	for (auto v : board) {
		cout << v[0];
		for (int i = 1; i < v.size(); i++) {
			cout << " " << v[i];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 384
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(lo i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

lo n,m,b[li],k,flag,t,mx;
lo cev;
double a[li],dp[3005][3005];
string s;
vector<lo> v;

inline double f(lo sira,lo ph){
	double cevv=0;
	if(sira>n){
		if(ph*2>n)return 1;
		return 0;
	}
	if(dp[sira][ph]!=2.0)return dp[sira][ph];
	cevv+=f(sira+1,ph+1)*a[sira];
	cevv+=f(sira+1,ph)*((double)(1-a[sira]));
	return dp[sira][ph]=cevv;
}

int main(void){
	for(lo i=0;i<=3000;i++){
		for(lo j=0;j<=3000;j++){
			dp[i][j]=2.0;
		}
	}
	scanf("%lld",&n);
	FOR{
		scanf("%lf",&a[i]);
	}
	printf("%.15lf\n",f(1,0));
	return 0;
}


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

int main(void){
  string S; cin>>S;
  int jud,min = 1000,a;
  for(int i = 0;i <= S.length()-2;i++){
    a = stoi(S.substr(i,3));
    if(753 - a >= 0)jud = 753 - a;
    else jud = a - 753;
    if(jud <= min)min = jud;
  }
  cout<<min;
}


Measured memory_bytes: 256
gets.to_i.times {
  xa, ya, ra, xb, yb, rb = gets.split.map(&:to_f)
  d = Math::sqrt( (xa - xb)**2 + (ya - yb)**2 )
  if d + rb < ra
    puts 2
  elsif d + ra < rb
    puts -2
  elsif ra + rb < d 
    puts 0
  else
    puts 1
  end 
}

Measured memory_bytes: 5224
#![allow(unused_imports)]
use std::io;
use std::cmp::*;
use std::collections::*;
#[allow(dead_code)]
const M: i64 = 1e9 as i64 + 7;

fn read_line() -> String {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    buf
}
#[allow(dead_code)]
fn read<T>() -> T where T: std::str::FromStr, T::Err : std::fmt::Debug {
    read_line().trim().parse().unwrap()
}
#[allow(dead_code)]
fn readv<T>() -> Vec<T> where T: std::str::FromStr, T::Err : std::fmt::Debug {
    read_line().split(' ').map(|a| a.trim().parse().unwrap()).collect()
}

fn main() {
    let _ = read::<usize>();
    let aa = readv::<usize>();
    let bb = readv::<usize>();
    let x = aa.iter().fold(0, |acc, &a| acc ^ a);
    let (mut aa, bb): (Vec<_>, Vec<_>) = aa.iter().zip(bb.iter()).filter(|&(&a, &b)| a != b).unzip();
    let n = aa.len();
    aa.push(x);
    let mut nums: HashMap<_, i32> = aa.iter()
        .fold(HashMap::new(), |mut acc, &a| { *acc.entry(a).or_insert(0) += 1; acc });
    for &b in &bb {
        *nums.entry(b).or_insert(0) -= 1;
        if nums[&b] < 0 {
            println!("{}", -1);
            return;
        }
    }

    let mp = aa.iter().collect::<BTreeSet<_>>().into_iter().enumerate()
        .map(|(a, b)| (b, a)).collect::<HashMap<_, _>>();
    let ref a2: Vec<_> = aa; //.iter().map(|a| mp[a]).collect();
    let ref b2: Vec<_> = bb; //.iter().map(|b| mp[b]).collect();
    let mut dests = b2.iter().enumerate()
        .fold(HashMap::new(), |mut acc, (a, b)| { (acc.entry(b).or_insert(Vec::new())).push(a); acc });
    // let mut dests: Vec<Vec<_>> = b2.iter().enumerate()
    //     .fold(vec![Vec::new(); n + 1], |mut acc, (a, &b)| { acc[b].push(a); acc });
    let mut q: VecDeque<_> = std::iter::once(n).collect();
    let mut rems: HashSet<_> = (0..n + 1).collect();
    let mut ans = n;
    #[cfg(local)] println!("{}: {:?}", "(mp, dests)", (mp, &dests));
    #[cfg(local)] println!("{}: {:?}", "(a2, b2)", (&a2, &b2));
    while !rems.is_empty() {
        while let Some(s_idx) = q.pop_front() {
            if !rems.remove(&s_idx) { continue; }
            let s_num = a2[s_idx];
            // for &dest in &dests[s_num] {
            //     q.push_back(dest);
            // }
            // dests[s_num].clear();
            if let Some(destv) = dests.remove(&s_num) {
                for dest in destv {
                    q.push_back(dest);
                }
            }
        }
        if let Some(&rem) = rems.iter().next() {
            q.push_back(rem);
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 30396
X=int(input())
A=0
while 1:
    B=0
    while pow(A,5)-pow(B,5)>X:
      B+=1
    while pow(A,5)-pow(B,5)<X:
      B-=1
    if pow(A,5)-pow(B,5)==X:
      print('{} {}'.format(A,B))
      exit()
    A+=1


Measured memory_bytes: 9088
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int cnt1 = 0, cnt2 = 0, cnt4 = 0;
    rep(i, n) {
        int a;
        cin >> a;
        if(a%4 == 0) {
            cnt4++;
        }
        else if(a%2 == 0) {
            cnt2++;
        }
        else {
            cnt1++;
        }
    }

    string ans;
    if(cnt2 == 0) {
        if(cnt1 <= cnt4 + 1) {
            ans = "Yes";
        }
        else {
            ans = "No";
        }
    }
    else {
        if(cnt1 <= cnt4) {
            ans = "Yes";
        }
        else {
            ans = "No";
        }
    }
    
    cout << ans;

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define endl '\n'

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

	string s, t;
	cin >> s >> t;
	int dp[s.size()+1][t.size()+1] = {};
	for(int i=0; i<s.size(); i++)
	{
		for(int j=0; j<t.size(); j++)
		{
			dp[i+1][j+1] = max( dp[i+1][j] , dp[i][j+1] );
			if( s[i] == t[j] )
				dp[i+1][j+1] =  max( 1 + dp[i][j] , dp[i+1][j+1] );
		}
	}
	string res = "";
	for(int i=s.size()-1, j=t.size()-1; i>=0 && j>=0; )
	{
		if( s[i] == t[j] )
		{
			res += s[i];
			j--;
			i--;
		}
		else if( dp[i+1][j+1] == dp[i][j+1] )
			i--;
		else
			j--;
	}
	for(int i=res.size()-1; i>=0; i--)
		cout << res[i];
	cout << endl;

//	for(int i=0; i<=s.size(); i++)
//	{
//		for(int j=0; j<=t.size(); j++)
//			cout << dp[i][j];
//		cout << endl;
//	}
	return 0;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<string> N(n), M(m);
    rep(i, n) cin >> N[i];
    rep(i, m) cin >> M[i];

    //nから切り出し→比較まで
    for (int i = 0; i <= n - m; i++)
    {
        for (int j = 0; j <= n - m; j++)
        {
            //以降のforで比較フェイズ
            int ok = 1;
            rep(k, m)
            {
                string tmp = N[i + k].substr(j, m);
                if (tmp != M[k])
                    ok = 0;
            }
            if (ok)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
using namespace std;
typedef long long li;
#define f(n) ((n)*((n)-1)/2)
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }


int main(){
  int n; cin >>n;
  vector<int> v;
  map<int,li> mp;
  rep(i,n){
    int a; cin >>a;
    v.push_back(a);
    mp[a]++;
  }
  li s=0;
  for(auto x: mp){
    li a=x.second;
    s+=f(a);
  }
  rep(i,n){
    //    print(s,f(mp[v[i]]),f(mp[v[i]]-1),s-f(mp[v[i]])+f(mp[v[i]]-1));
    print(s-f(mp[v[i]])+f(mp[v[i]]-1));
  }
}


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

int main()
{
    ll n, m;
    cin >> n >> m;
    ll rem = n%m;
    ll Min = rem;
    rem = abs(rem-m);
    Min = min(Min, rem);
    cout << Min << endl;
    return 0;
}


Measured memory_bytes: 256
using namespace std;
 
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <numeric>
#include <map>
using namespace std;
 
 
int main(void){
	int N,M;
 
	cin >> N >> M;
  
  vector<int> a(M), dp(N+1, 0);
  
  for (auto& i : a)
    cin >> i;
  
  dp[N] = 1;
  if (a.empty() || a.back() != N - 1)
    dp[N - 1] = 1;
  for (int n = N - 2; n >= 0; n--) {
    if (!binary_search(a.begin(),a.end(), n)) {
      dp[n] = (dp[n+1] + dp[n+2]) % 1000000007;
    }
  }
 
	cout << dp[0] << endl;
 
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const int MAX_N = 1e+5 + 5;

ll A[MAX_N], B[MAX_N];
vector<pair<ll, int> > takahashi, aoki;
bool is_exist[MAX_N];

int main() {
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
        takahashi.push_back(MP(A[i] + B[i], i));
        aoki.push_back(MP(A[i] + B[i], i));
        is_exist[i] = true;
    }
    sort(takahashi.begin(), takahashi.end());
    reverse(takahashi.begin(), takahashi.end());
    sort(aoki.begin(), aoki.end());
    reverse(aoki.begin(), aoki.end());
    ll t_sum = 0, a_sum = 0, t_idx = 0, a_idx = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            while (!is_exist[takahashi[t_idx].second]) t_idx++;
            t_sum += A[takahashi[t_idx].second];
            is_exist[takahashi[t_idx].second] = false;
        }
        else {
            while (!is_exist[aoki[a_idx].second]) a_idx++;
            a_sum += B[aoki[a_idx].second];
            is_exist[aoki[a_idx].second] = false;
        }
    }
    cout << t_sum - a_sum << endl;
    return 0;
}

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

bool cmp(pair <ll,ll> p1, pair <ll,ll> p2)
{
	if(p1.first + p1.second == p2.first + p2.second)
	return(p1.first < p2.first);
	return(p1.first + p1.second < p2.first + p2.second);
}
int main()
{
    ll n;
    cin>>n;
    vector<pair<ll,ll> > pos(n);
    for(ll i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        pos[i]={x,y};
    }
    sort(pos.begin(),pos.end(), cmp);
    ll last=0,ans=0;
    for(ll i=1;i<n;i++)
    {
        if(pos[last].first+pos[last].second>pos[i].first-pos[i].second)
        ans++;
        else
        last = i;
    }
    cout<<(n-ans)<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
  int N;
  int D;
  cin >> N >> D;
  int count=0;
  while(N>0){
    N=N-(1+2*D);
    count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
from sys import stdin
import math
def input():
	return stdin.readline()[:-1]

def intput():
	return int(input().rstrip())

def sinput():
	return input().rstrip().split()

def intsput():
	return map(int, sinput())

def main():
	str = input()
	if str == "AAA" or str == "BBB":
		print("No")
	else:
		print("Yes")


if __name__ == '__main__':
	main()


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#define maju 1919114514
using namespace std;

int main() {
	int n, l;
	int abmin=maju;
	int ans = 0;
	cin >> n >> l;
	for (int i = 0; i < n; i++) {
		if (abs(i + l) < abs(abmin)) {
			abmin = i + l;
		}
	}
	for (int i = 0; i < n; i++) {
		ans += (l + i);
	}
	cout << ans-abmin << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define scd second
#define fst first
#define pb push_back
#define mkp make_pair
#define all(x) x.begin(), x.end()
#define VT(T) vector<T>
 
using namespace std;
 
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
typedef vector<ll> vlong;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vint> vvint;
typedef vector<vlong> vvlong;
typedef list<int> lint;
typedef list<ll> llong;
typedef list<pii> lpii;
typedef list<pll> lpll;
typedef list<lint> llint;
typedef list<llong> lllong;
typedef unsigned long long int ull;

ll const LINF=numeric_limits<long long int>::max();
int const INF=numeric_limits<int>::max();
 
ll gcd(ll a, ll b){
	return b ? gcd(b,a%b) : a;
}
 
ll pow_mod(ll a, ll e, ll m){
	ll res=1;
	while(e){
		if(e&1) res=res*a%m;
		a=a*a%m;
		e>>=1;
	}
	return res;
}
 
ll inv_mod(ll b, ll m){
	b%=m;
	ll x=0, y=1, r, q, a=m;
	while(b){
		q=a/b;
		r=a%b;
		a=b;
		b=r;
		r=x;
		x=y;
		y=r-q*y;
	}
	x+=m;
	return x%m;
}

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

	int n;
	cin>>n;
	vint cnt[100];
	for(int i=1; i<=n; i++){
		string str=to_string(i);
		cnt[(str[0]-'0')*10+i%10].pb(i);
	}

	ll ans=0;
	for(int i=1; i<100; i++){
		ll tmp=0;
		for(int j=i+1; j<100; j++){
			if(i%10==j/10 && j%10==i/10){
				tmp+=cnt[j].size();
			}
		}
		ans+=tmp*cnt[i].size()*2;

		if(i%10==i/10){
			tmp=cnt[i].size();
			ans+=tmp*tmp;
		}
	}

	cout<<ans<<endl;
}

Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
	int a,b,c;
	cin>>a>>b>>c;
	int A=a,B=b,C=c;
	int d,e,f;
	int i=0;
	while(a%2==0&&b%2==0&&c%2==0){
		d=a/2+b/2;
		f=b/2+c/2;
		e=c/2+a/2;
		if(A==d&&B==e&&C==f){
			cout<<-1<<endl;
			return 0;
		}
		a=d; b=e; c=f;
		i++;
	}
	cout<<i<<endl;
    
}


Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<bits/stdc++.h>
#define inf 1e9
using namespace std;
int solve(int n,vector<int> ar){
  int dp[n+1];
  dp[1]=0;
  for(int i=2;i<=n;i++){
  	int op1=abs(ar[i]-ar[i-1])+dp[i-1];
    int op2=(i==2)?inf:abs(ar[i]-ar[i-2])+dp[i-2];
      dp[i]=min(op1,op2);
  }
   return dp[n];
}
  int main(){
  int n;
  cin>>n;
  vector<int> ar(n+1);
  for(int i=1;i<=n;i++){
    cin>>ar[i];
  }
  cout<<solve(n,ar)<<endl;
}

Measured memory_bytes: 1408
#include<cstdio>
#include<vector>
using namespace std;
const int maxn=100000;
int n,f[maxn+10];
vector<int> g[maxn+10];
void dfs(int x,int fa){
	bool isb=0;
	for(int i=0;i<g[x].size();++i){
		int e=g[x][i]; if(e!=fa){
			dfs(e,x); f[x]+=f[e];
			if(!f[e]) if(!isb) isb=1; else ++f[x];
		}
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<n;++i){
		int l,r; scanf("%d%d",&l,&r); ++l; ++r;
		g[l].push_back(r); g[r].push_back(l);
	}
	for(int i=1;i<=n;++i) if(g[i].size()>2){
		dfs(i,0); printf("%d",f[i]); return 0;
	}
	printf("1");
}

Measured memory_bytes: 10368
n = gets.to_i
s = gets.chomp

c = 0
result = Array.new
n.times do |i|
    result.push(s[i])
    if s[i] == "("
        c += 1
    else #s[i] == ")"
        if c > 0
            c -= 1
        else
            result.unshift("(")
        end
    end
end
c.times do |i|
    result.push(")")
end

puts result.join

Measured memory_bytes: 1788
// Math = ♥
// Sometimes it is people that no one imagines anything of who do things that no one can imagine
// After all this time? Always

#include <bits/stdc++.h>                        // uncomment before submission
//#include <ext/pb_ds/assoc_container.hpp>		// uncomment before submission
//#include <ext/pb_ds/tree_policy.hpp>			// uncomment before submission
//using namespace __gnu_pbds;					// uncomment before submission
using namespace std;
//<---------------------------------------------------Template----------------------------------------------------------->
#define int long long
#define ll long long
#define ld long double
const int INF = 1e15 + 7;
const int MAX = 1e5 + 7;
const int MOD = 1e9 + 7;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;                  // Vector of long long
typedef vector<vi> vvi;                 // Vector of vi
typedef vector<ii> vii;                 // Vector of pairs
typedef vector<vii> vvii;               // Vector of Vector of pairs
typedef vector<bool> vb;                // Vector of bool
#define pq priority_queue               // Max heap (To convert to min heap, use negative sign before every value)
#define ff first                        // For pairs
#define ss second                       // For pairs
#define pb push_back                    // Pushback to vector
#define mp make_pair                    // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end()   // Mainly used by me in sorting
// ordered_set adds two new functions to set - (set).find_by_order([kth element based on zero indexing]) and order_of_key()
// order_of_key returns number of elements less that parameter. If element exists, that order is its index
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//<----------------------------------------------------------------------------------------------------------------------->

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

    vi a(n);
    map<int, int> m;
    map<int, int> dp;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        m[a[i]]++;
        dp[a[i]] = -1;
    }

    int count = 0;
    for (auto x: m)
    {
        int ans = 0;
        ans = ((x.ss) * (x.ss - 1)) / 2;
        count += max(ans, 0ll);
    }

    for (int i = 0; i < n; i++)
    {
        int x = m[a[i]];
        int ans = count - (x * (x - 1)) / 2;
        ans = ans + ((x - 1) * (x - 2)) / 2;
        cout << ans << endl;
    }
    return 0;
}


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

typedef long long ll;

int main(int argc, char* argv[])
{
  int a, b, c;
  std::cin >> a >> b >> c;

  std::vector< int > va(3, 0);
  va[0] = a + b;
  va[1] = b + c;
  va[2] = c + a;  

  ll ans = *std::min_element(va.begin(), va.end());
  std::cout << ans << std::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 R=sc.nextInt();
      	if(N>=10){
         	System.out.print(R);
     	}else{
         	System.out.print(R+100*(10-N));
      	}
   }
}

Measured memory_bytes: 35624
n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))

import bisect
ans = 0

for i in T:
    ok = bisect.bisect(S,i) - 1
    if S[max(ok,0)] == i:
        ans += 1

print(ans)



Measured memory_bytes: 16712
import java.util.*;
import java.lang.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int count = 1;
        
        while(true) {
            int n = sc.nextInt();
            if (n != 0) {
                System.out.println("Case " + count + ": " + n);
            } else {
                break;
            }
            count ++;
        }
    }
}


Measured memory_bytes: 41392
#include <iostream>

using namespace std;
int main(void) {
  int y, m, d;
  scanf("%d/%d/%d", &y, &m, &d);
  bool is_heisei = y * 10000 + m * 100 + d <= 20190430;
  cout << (is_heisei ? "Heisei" : "TBD") << endl;
}


Measured memory_bytes: 256
#import<atcoder/all>
using namespace std;int n,m,i,k;int main(){cin>>n>>m;vector<int>a(n),b;for(;i<n;a[i++]=k)cin>>k;for(;cin>>i;)b.push_back(i);for(int i:atcoder::convolution(a,b))cout<<i<<' ';}

Measured memory_bytes: 19004
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int64_t n,k;
  cin>>n>>k;
  vector<int64_t> h(n);
  for(auto&& e: h) 
  {
    cin>>e;
  }
  if(k>=n)
  {
    cout<<0;
    return 0;
  }
  sort(h.begin(), h.end());
  int64_t ans=0;
  for (int i = 0; i < n-k; ++i)
  {
    ans+=h[i];
  }
  cout<<ans;
}

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

int main(){
    int X, N;
    cin >> X >> N;
    vector<int> P(N);
    for(auto& p : P) cin >> p;
    int dx = 0;
    int ans = X;
    while(true){
        if(find(P.begin(), P.end(), X-dx) == P.end()){
            ans -= dx;
            break;
        }
        else if(find(P.begin(), P.end(), X+dx) == P.end()){
            ans += dx;
            break;
        }
        ++dx;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3556
#include <iostream>

int main() {
  int a, b, c;
  std::cin >> a >> b >> c;

  if (a == b && b == c && a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
    printf("-1\n");
    return 0;
  }
  int res{0};

  if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1){
    printf("%d\n", res);
    return 0;
  }

  int na{(b + c) / 2}, nb{(c + a) / 2}, nc{(a + b) / 2};
  ++res;
  while (na % 2 == 0 && nb % 2 == 0 && nc % 2 == 0) {
    int ta{(a + na) / 2};
    int tb{(b + nb) / 2};
    int tc{(c + nc) / 2};
    a = na;
    b = nb;
    c = nc;
    na = ta;
    nb = tb;
    nc = tc;
    ++res;
  }
  printf("%d", res);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <queue>
#include <map>
using namespace std;

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

typedef pair< int, int > iP;
typedef pair< int, iP > iiP;

int bfs(int t, int sx, int sy) {
    int ret = 0;
    int used[300][300] = {{0}};
    queue< iiP > q;
    q.push(iiP(t, iP(sx, sy)));
    while(!q.empty()) {
        iiP p = q.front(); q.pop();
        if(p.first < 0 || used[p.second.first][p.second.second]++) continue;
        ret++;
        int x = p.second.first, y = p.second.second;
        for(int i = 0; i < 6; i++) {
            int nx = x + dx[i], ny = y + dy[i];
            if(!mas[ny][nx]) {
                q.push(iiP(p.first - 1, iP(nx, ny)));
            }
        }
    }
    return ret;
}

int main() {
    int n, t;
    while(cin >> t >> n, t) {
        memset(mas, 0, sizeof(mas));
        for(int i = 0; i < n; i++) {
            int x, y; cin >> x >> y;
            mas[y + 150][x + 150] = 1;
        }
        int sx, sy; cin >> sx >> sy;
        cout << bfs(t, sx + 150, sy + 150) << endl;
    }
}



Measured memory_bytes: 3820
A,B,H,M = list(map(int,input().split()))

import math

l = H*360/12 + M*30/60
s = M*360/60
ang = abs(l-s)
c = A**2 + B**2 -2*B*A*math.cos(math.radians(ang))
print(math.sqrt(c))

Measured memory_bytes: 9484
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}
//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

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

    a = a + b;
    double y = atoi(a.c_str());
    int x = sqrt(atoi(a.c_str()));
    if(x*x==y){
        puts("Yes");
    }else{
        puts("No");
    }

    
    return 0;
}

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

int main()
{    long long n,D,X,Y,c,e,count=0;
 
    cin>>n>>D;
    
    for(long long i=0;i<n;i++)
    {
        cin>>X>>Y;
    
        if(X * X + Y * Y <= D * D)
        {
            count++;
        }
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const int N_MAX = 41;
const int AS_MAX = 401;
const int BS_MAX = 401;
const int INF = 1001001001;
int dp[N_MAX][AS_MAX][BS_MAX];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m_a, m_b;
    cin >> n >> m_a >> m_b;
    VI a(n), b(n), c(n);
    REP(i, n) cin >> a[i] >> b[i] >> c[i];
    fill_n((int*)dp, N_MAX * AS_MAX * BS_MAX, INF);
    dp[0][0][0] = 0;
    REP(i, n)REP(as, AS_MAX)REP(bs, BS_MAX){
        if(dp[i][as][bs] == INF) continue;
        dp[i + 1][as][bs] = min(dp[i + 1][as][bs], dp[i][as][bs]);
        dp[i + 1][as + a[i]][bs + b[i]]
            = min(dp[i + 1][as + a[i]][bs + b[i]], dp[i][as][bs] + c[i]);
    }

    int ans = INF;
    REP(as, AS_MAX)REP(bs, BS_MAX){
        if((as * m_b != bs * m_a) || (as * bs == 0)) continue;
        ans = min(ans, dp[n][as][bs]);
    }

    if(ans == INF) ans = -1;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 25984
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rlcfpoj(x) scanf("%I64d",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define plcfpoj(x) printf("%I64d",x)
#define lfd() printf("\n")
#define sp() printf(" ")
#define inrep(x) int x;scanf("%d",&x);while(x--)
#define testbit(mask,i) (((mask)>>(i))&1)
#define setbit(mask,i) ((mask)|(1<<i))
#define delbit(mask,i) ((mask)^(1<<i))
int n;
string s;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>s;
	int i=0,j=-1;//begin,end
	string t=s.substr(0,1);
	int len=0;
	for(int i=0;i<s.size();i++){//i:start
		t.erase(t.begin());
		if(j==i-1){
			j=i;
			t=s[j];
		}
		int tmp=t.size()-1;
		while(s.find(t,j+1)!=-1){
			tmp++;
			j++;
			t+=s[j];
		}
		len=max(len,tmp);
	}
	cout<<len<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int n, k;
    scanf("%d %d", &n, &k);

    int num = 1;
    for (int i = 0; i < n; ++i) {
        if (num < k) {
            num *= 2;
        } else {
            num += k;
        }
    }
    printf("%d\n", num);
    return 0;
}

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

int main()
{
    long long n;
    cin >> n;
    
    long long arr[n];
    for(long long i=0;i<n;i++)
    {
        cin >> arr[i];
    }
    
    long long  cnt=0;
	long long sub[n],add[n];
    for(long long i=0;i<n;i++)
    {
        sub[i]=arr[i]-i-1;
        add[i]=-(arr[i]+i+1);
    }
   // for(int i=0;i<n;i++)
   // {
    //    cout << sub[i] << " ";
    //}
    //cout << endl;
    
    //for(int i=0;i<n;i++)
    //{
    //    cout << add[i] << " ";
    //}
    //cout << endl;
    
    
    unordered_map<long long,long long> mp;
    for(long long i=0;i<n;i++)
    {
        mp[add[i]]++;
    }
    
    for(long long i=0;i<n;i++)
    {
        if(mp.find(sub[i])!=mp.end())
        {
            cnt+=mp[sub[i]];
           // cout << "i :" << i << endl;
        }
        	
    }
    
    cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 15980
N=int(input())
*A,=map(int,input().split())
B=[0]*N
k=A[0]

for i in range(N):
    if A[i]>k:#大きいとき
        k=A[i]
    else:#小さいとき
        B[i]=k-A[i]
        

print(sum(B))

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

using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    s = s.substr(0,3);
    cout << s << "\n";
    return 0;
}

Measured memory_bytes: 3640