akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

int main(){
  ll N, K;
  cin >> N >> K;
  vll a(N), aa(N);
  vll highest(N), highestt(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
    if(i == 0) highest.at(0) = a.at(0);
    else if(a.at(i) > highest.at(i-1)) highest.at(i) = a.at(i);
    else highest.at(i) = highest.at(i-1);
  }
  aa = a; highestt = highest;


  ll result = INF;
  for(int tmp = 0; tmp < (1 << (N-1)); tmp++){
    bitset<14> bit(tmp);
    if(bit.count() !=  K-1) continue;
    a = aa; highest = highestt;
    ll sum = 0;
    for(int i = 0; i < N-1; i++){
      if(bit.test(i)){ //i+1番目がみえる
        ll dh = max(0LL, highest.at(i) + 1LL - a.at(i+1));
        sum += dh;
        a.at(i+1) += dh;
      }
      highest.at(i+1) = max(a.at(i+1), highest.at(i));
    }
    chmin(result, sum);
  }
  cout << result << endl;
}


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

const int maxc = 105;

int Y, X, c[256];
char g[maxc][maxc], h[maxc][maxc];
std::vector<std::pair<int,int>> four, two, one;

int f(char c) {
    return int(c - 'a');
}

void fail() {
    printf("No\n");
    exit(0);
}

int main() {
    scanf("%d%d", &Y, &X);
    for (int y = 0; y < Y; y++) {
        scanf(" %s", g[y]);
        for (int x = 0; x < X; x++) {
            c[f(g[y][x])]++;
        }
    }
    for (int y = 0; y < Y; y++) {
        for (int x = 0; x < X; x++) {
            if (y > Y-1-y || x > X-1-x) {
                continue;
            }
            if (y < Y-1-y && x < X-1-x) {
                four.emplace_back(y, x);
                //printf("four %d %d\n", y, x);
            } else if (y < Y-1-y || x < X-1-x) {
                two.emplace_back(y, x);
                //printf("two %d %d\n", y, x);
            } else {
                one.emplace_back(y, x);
                //printf("one %d %d\n", y, x);
            }
        }
    }
    for (int i = 0; i < 26; i++) {
        //printf("c[%d] = %d\n", i, c[i]);
        while (c[i] >= 4 && !four.empty()) {
            c[i] -= 4;
            four.pop_back();
        }
        while (c[i] >= 2 && !two.empty()) {
            c[i] -= 2;
            two.pop_back();
        }
        while (c[i] >= 1 && !one.empty()) {
            c[i] -= 1;
            one.pop_back();
        }
        if (c[i]) {
            fail();
        }
    }
    printf("Yes\n");
}


Measured memory_bytes: 256
import math
n,d = map(int,input().split())
x = []
for i in range(n):
  h = list(map(int,input().split()))
  x.append(h)
def l(i,j):
  s = 0
  for k in range(d):
    s += (x[i][k]-x[j][k])**2
  return math.sqrt(s)
S = 0
for i in range(0,n-1):
  for j in range(i+1,n):
    k = l(i,j)
    if k.is_integer() == True:
      S += 1
print(S)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

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

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

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");
        String arr02[] = mylist.get(1).split(" ");

        int n = Integer.valueOf(arr01[0]);
        Boolean chkflg = true;
        for (int i = 0; i < arr02.length; i++) {

            if (Integer.valueOf(arr02[i]) % 2 == 0
                    && (!(Integer.valueOf(arr02[i]) % 3 == 0 || Integer.valueOf(arr02[i]) % 5 == 0))) {
                chkflg = false;
                break;
            }

        }

        System.out.println(chkflg ? "APPROVED" : "DENIED");

    }
}


Measured memory_bytes: 21204
N, M = map(int, input().split(" "))
A = list(map(int, input().split(" ")))

A.sort()

D = []
for i in range(M):
    B, C = map(int, input().split(" "))
    D.append((C, B))

#D = list(D_dict)
D.sort(reverse=True)

D_index = 0
D_index_max = len(D)

ans = 0

ct_D_i = 0
ct_D_i_max = D[0][1]

ct_D_total = 0

for i in range(N):
    a = A[i]
    d = D[D_index][0]
    if a > d:
        break

    A[i] = d


    ct_D_i += 1
    if ct_D_i >= ct_D_i_max:
        D_index += 1
        if D_index >= D_index_max:
            break

        ct_D_i = 0
        ct_D_i_max = D[D_index][1]




print(sum(A))

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

int main(){
    int n = 5;
    vector<int> a(n);
    int a_min=10;
    int a_ids=0;
    rep(i, n){
        cin >> a[i];
        if(a_min > a[i]%10 && a[i]%10 != 0){
            a_min = a[i]%10;
            a_ids = i;
        }
    }
    int res = 0;
    for(int i=0; i<n; i++){
        if(i != a_ids){
            if(a[i]%10==0)
                res+= a[i];
            else{
                a[i] = a[i] - a[i]%10 + 10;
                res += a[i];
            }
        }else{
            res += a[i];
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <db,db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD=998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=100005;

int dp[N+1];

void solve()
{
int n,k;
cin>>n>>k;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
dp[0]=0;
for(int i=1;i<=k;i++)
{
    for(int j=0;j<n;j++)
    if(i>=a[j])
    dp[i]=dp[i]|(!dp[i-a[j]]);
}
if(dp[k])
{
    cout<<"First";
}
else
{
    cout<<"Second";
}
cout<<endl;


}




int32_t main()
{
    IOS;
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        
        solve();
    }
    return 0;
}

Measured memory_bytes: 4448
def valid?(a, b)
  cs = {}

  b.each_char.with_index do |bc, i|
    ac = a[i]
    if cs[ac] == nil
        cs[ac] = bc
    elsif cs[ac] != bc
      return false
    end
  end

  true
end

s = gets
t = gets

ans = valid?(s, t) && valid?(t, s) ? "Yes" : "No"
puts ans


Measured memory_bytes: 2300
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
#define For(i, x, y) for(int i=x;i<=y;i++)  
#define _For(i, x, y) for(int i=x;i>=y;i--)
#define Mem(f, x) memset(f,x,sizeof(f))  
#define Sca(x) scanf("%d", &x)
#define Sca2(x,y) scanf("%d%d",&x,&y)
#define Sca3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define Scl(x) scanf("%lld",&x);  
#define Pri(x) printf("%d\n", x)
#define Prl(x) printf("%lld\n",x);  
#define CLR(u) for(int i=0;i<=N;i++)u[i].clear();
#define LL long long
#define ULL unsigned long long  
#define mp make_pair
#define PII pair<int,int>
#define PIL pair<int,long long>
#define PLL pair<long long,long long>
#define pb push_back
#define fi first
#define se second 
typedef vector<int> VI;
const double eps = 1e-9;
const int maxn = 110;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7; 
int N,M,K;
char str[maxn];
int num1[maxn];
int num2[maxn];
void solve(){
	int now = 0;
	int ans = 0;
	for(int i = 1; i <= N ; i ++){
		num1[str[i] - 'a']--;
		num2[str[i] - 'a']++;
		if(!num1[str[i] - 'a'] && num2[str[i] - 'a'] >= 2) now--;
		if(num2[str[i] - 'a'] == 1 && num1[str[i] - 'a']) now++;
		ans = max(ans,now);
	}
	cout << ans << endl;
}
int main(){
	Sca(N);
	scanf("%s",str + 1);
	for(int i = 1; i <= N ; i ++){
		num1[str[i] - 'a']++;
	}
	solve();
	return 0;
}

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

using namespace std;

bool solve() {
  int N;
  cin >> N;

  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    if (A % 2 == 0) {
      if (A % 3 != 0 && A % 5 != 0) {
        return false;
      }
    }
  }

  return true;
}

int main() {
  cout << (solve() ? "APPROVED" : "DENIED") << endl;

  return 0;
}


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

int main(){
    int n,m;
    cin>>n>>m;
    long long dp[n+1];
    memset(dp,0,n+1);
    for(int i=0;i<m;i++){
        int index;
        cin>>index;
        dp[index]=-1;
    }
    dp[0]=1;
    if(dp[1]==(-1))dp[1]=0;
    else dp[1]=dp[0];
    for(int i=2;i<n+1;i++){
        if(dp[i]!=-1)dp[i]=dp[i-1]+dp[i-2];
        else dp[i]=0;
        dp[i]%=1000000007;
    }
    cout<<dp[n]%1000000007;
    return 0;
}


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

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  1e+5+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
string s;
ll k,n,x;ll v1[500005];
//<<-----Implement Functions Here---->>//


//<<-----Start of Main--------------->>//
void MAIN(){
		
		cin>>k>>n;
		for(ll i=0;i<n;i++)cin>>v1[i];
		sort(v1,v1+n);
		ll max1 = -1;
		for(ll i=0;i<n-1;i++)max1 = max(max1,v1[i+1]-v1[i]);
		max1 = max(max1,k-(v1[n-1]-v1[0])); 
		cout<<k-max1;
		
		

}

int main(){
	fastio;randomINIT;

	//cin>>t;
	while(t--){
		MAIN();
	}

    
}

Measured memory_bytes: 6784
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
#include <math.h>
#include <typeinfo>
#include <numeric>
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> H(N);
	vector<int> sorted(N);

	for (int i = 0; i < N; i++)
	{
		cin >> H[i];
		sorted[i] = H[i];
	}

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

	string ans = "Yes";
	long long diff = 0;
	for (int i = 0; i < N; i++)
	{
		int tmp = H[i] - sorted[i];
		if (abs(tmp) > 1)
		{
			ans = "No";
			break;
		}
	}

	cout << ans << endl;

	return 0;
 
}

Measured memory_bytes: 1024
n=int(input())
h=[10**6]+list(map(int,input().split()))
c=[0]*(n+1)
for i in range(2,n+1):
  a=c[i-1]+abs(h[i]-h[i-1])
  b=c[i-2]+abs(h[i]-h[i-2])
  c[i]=min(a,b)
print(c[n])

Measured memory_bytes: 13924
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,t;
vector<int>v;
set<int>s;
cin>>t;
for(int i=0;i<t;i++){
        cin>>n;
     v.push_back(n);
     s.insert(n);

}
if(s.size()==t)cout<<"YES"<<endl;
else cout<<"NO"<<endl;

}







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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define vi vector<int>

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cerr << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define debug(...) CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) (__VA_ARGS__)

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MAX_N = 100005;

void Main() {
  int n;
  cin >> n;
  int ans = 0, mx = 0;
  rep(i, n) {
    int p;
    cin >> p;
    ans += p;
    mx = max(p, mx);
  }
  ans -= mx/2;
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)

int main(void)
{
	li a, b;
	cin >> a >> b;
	cout << (a * b % 2 == 0 ? "Even" : "Odd") << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=1; i<=n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  vector<int> ans(N,0);
  rep(x,sqrt(N)) {
    rep(y,sqrt(N)) {
      rep(z,sqrt(N)) {
        int tmp = x*x + y*y + z*z + x*y + y*z+ z*x;
        if(tmp <= N) {
          ans[tmp-1]++;
        }
      }
    }
  }
  for(int i:ans) cout << i << endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
typedef std::pair<ll, ll>P;

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

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true;
bool fl = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
std::string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };

int main() {
	int n, ans = 0;
	std::cin >> n;
	std::vector<P>r(n),b(n);
	for (int i = 0;i < n;i++) {
		int ax, ay;
		std::cin >> ax >> ay;
		r[i] = std::make_pair(ay, ax);
	}
	for (int i = 0;i< n;i++) {
		int bx, by;
		std::cin >> bx >> by;
		b[i] = std::make_pair(bx, by);
	}
	std::sort(r.begin(), r.end());
	std::sort(b.begin(), b.end());
	bool used[1000];
	int minit;
	for (int i = 0;i < 1000;i++)used[i] = false;
	for (int i = 0;i < n;i++) {
		flag = false;
		ll x = b[i].first, y = b[i].second;
		for (int j = 0;j < n;j++) {
			int ax = r[j].second, ay = r[j].first;
			if (ax < x&&ay < y) {
				if (!used[j]) {
					flag = true;
					minit = j;
				}
			}
		}
		if (flag) {
			used[minit] = true;
			ans++;
		}
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
village = [tuple(map(int, input().split())) for _ in range(m)]
village = sorted(village, key=lambda x:x[1])

right_bridge,sum_bridge = 0,0
for a, b in village:
    if right_bridge<a:
        right_bridge=b-1
        sum_bridge+=1
        
print(sum_bridge)

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

int main() {

    ll L, R;
    cin >> L >> R;

    if (L == 0) {
        cout << 0 << endl;
        return 0;
    }

    if (R - L + 1 < 2019) {
        ll mi = 30000;
        for (ll l = L; l<R; ++l) {
            for (ll r = l+1; r<=R; ++r) {
                mi = min(mi, (l%2019)*(r%2019)%2019);
            }
        }

        cout << mi << endl;
    }
    else {
        cout << 0 << endl;
    }

}


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

using namespace std;

void output(int num){
  static vector<int> vec;
  if(num == -1){
    bool flag=true;
    reverse(vec.begin(),vec.end());
    for(int buf : vec){
      if(flag){
        flag=false;
        cout << buf;
      }
      else
        cout << " " << buf;     
    }
    cout << endl;
    vec.clear();
  }
  else
    vec.push_back(num);
}

void func(int weight){
  if(weight > 0){
    int buf=1;
    while(buf <= weight)
      buf <<= 1;
    buf >>=1;
    output(buf);
    func(weight-buf);
  }
}

int main(){
  int buf;
  while(cin >> buf){
    func(buf);
    output(-1);
  }
  return 0;
}

Measured memory_bytes: 1208
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 100

int s[1000],top;
void push(int x);
int pop(void); 

int main(){
  int a,b;
  char s[1000000];
  top = 0;

  while(scanf("%s",s)!=EOF){
    if('+' == s[0])
      push(pop()+pop());
    else if(s[0] == '-'){
      b = pop();
      a = pop();
      push(a - b);
    }
    else if('*' == s[0])
      push(pop() * pop());
    else
      push(atoi(s));
  }

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

  return 0;
}
void push(int x){
  s[++top] = x;
}
int pop(){
  return s[top--];
}

Measured memory_bytes: 556
# -*- coding: utf-8 -*-

import sys

line = sys.stdin.readline()
A, B, K = ( int(s) for s in line.split() )

x, y = A, B

for _ in range(K):
    #if x % 2 == 1:
    #    x -= 1
    x -= x % 2
    n = x // 2
    x -= n
    y += n
    x, y = y, x

if K % 2 == 1:
    x, y = y, x

print("%s %s" % (x, y))


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#define ll long long
#define ALL(a)  (a).begin(),(a).end()

#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define FOR(i,m,n) for(int (i)=(m);(i)<(n); i++)
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define WREP(i,in,j,jn) REP(i,in)REP(j,jn)
using namespace std;
//-------------------------------------------

int main(void){
	ll H,N;cin>>H>>N;
	ll A[N];REP(i,N)cin>>A[i];
	ll damage=0;
	bool flag=0;
	REP(i,N){
		damage+=A[i];
		if(damage>=H){
			flag=1;
			break;
		}
	}
	cout<<(flag?"Yes":"No");
	return 0;
}

Measured memory_bytes: 1024
package main

import "fmt"

func main() {
	var N int
	fmt.Scanf("%d", &N)

	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			if N == i*j {
				fmt.Println("Yes")
				return
			}
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
X, Y = map(int, input().split())
s = [300000, 200000, 100000]
if X == 1 and Y == 1:
    print(s[0]*2 + 400000)
else:
    if X <= 3 and Y <= 3:
        print(s[X-1] + s[Y-1])
    elif X <= 3 and Y > 3:
        print(s[X-1])
    elif X > 3 and Y <= 3:
        print(s[Y-1])
    else:
        print(0)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int w,n;
string stick[31];
string stick2[31];
string num[31]={"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"};
vector<pair<string,string> > pii;
int main(){
  cin>>w>>n;
  for(int i=1;i<=w;i++){
    if(i>=1&&i<=9)
      stick[i-1]=i+'0';
    else if(i>=10&&i<=99){
      stick[i-1]=(i/10)+'0';
      stick[i-1]+=(i%10)+'0';
    }
  }
  for(int i=0;i<n;i++){
    string a,b,c;
    cin>>a;
    for(int j=0;j<a.size();j++){
      if(a[j]==','){
	b=a.substr(0,j);
	c=a.substr(j+1,a.size()-b.size()-1);
      }
    }
    pii.push_back(make_pair(b,c));
  }
  for(int i=0;i<w;i++){
     for(int j=0;j<n;j++){
    if(stick[i]==pii[j].first)
      stick[i]=pii[j].second;
    else if(stick[i]==pii[j].second)
      stick[i]=pii[j].first;
     }
  }
  for(int i=0;i<w;i++){
    for(int j=0;j<w;j++){
      if(stick[i]==num[j]){
	if(i>=0&&i<=8)
	  stick2[j]=i+'1';
	else if(i>=9&&i<=99){
	  stick2[j]=((i+1)/10)+'0';
	  stick2[j]+=((i+1)%10)+'0';
	}
	break;
      }
    }
  }
  for(int i=0;i<w;i++)
    cout<<stick2[i]<<endl;
  return 0;
}

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

int main(){
	string  a[3]={"Sunny", "Cloudy", "Rainy"};
  	string b;
  cin >> b;
  int k;
  for (int i=0; i<3; i++){
  if (b==a[i])
    k=i;
  }
  if (k==2)
    k-=3;
  k++;
  cout << a[k];
}

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

int main(){
  char s[100000],s5[6],s6[7],s7[8];
  int i,n,flag;
  scanf("%s",s);
  n=strlen(s);
  s7[7]=s6[6]=s5[5]='\0';
  for(i=n-1;i>=0;i-=flag){
    for(int j=0;j<7;j++){
      s7[j]=s[i-6+j];
      if(j>0)
        s6[j-1]=s[i-6+j];
      if(j>1)
        s5[j-2]=s[i-6+j];
    }
    if(strcmp(s7,"dreamer")==0)
      flag=7;
    else if(strcmp(s6,"eraser")==0)
      flag=6;
    else if(strcmp(s5,"dream")==0||strcmp(s5,"erase")==0)
      flag=5;
    else{
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C;
    cin >> A >> B >> C;
    cout << (A ^ B ^ C) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;

int main() {
    string s;
    cin >> s;
    bool t=true;
    rep(i,s.size()){
        if (i%2==0 && s.at(i)=='L') t=false;
        if (i%2==1 && s.at(i)=='R') t=false;
    }
    if (t) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
import Data.List

day :: [String]
day = ["SUN", "MON", "TUE", "WED", "WED", "THU", "FRI", "SAT"]

main = print =<< ((pure parse) <*> getLine)

readInt :: String -> Int
readInt = read

parse :: String -> Int
parse =  (^ 2) . readInt


Measured memory_bytes: 508
from collections import defaultdict
N,X,Y = map(int,input().split())

counter = defaultdict(int)
for i in range(1,N):
  for j in range(i+1, N+1):
    step = min(j-i, abs(X-i)+1+abs(Y-j))
    counter[step] += 1

for i in range(1, N):
  print(counter[i])

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

#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

int main() {

    long long int n, a, b;
    cin >> n >> a >> b;
    a--;
    b--;

    vector< vector< long long int > > v;
    for ( long long int i = 0; i < n; i++ ) {
        vector< long long int > vv;
        v.push_back( vv );
    }

    for ( long long int i = 0; i < n - 1; i++ ) {
        long long int x, y;
        cin >> x >> y;
        x--;
        y--;
        v[x].push_back( y );
        v[y].push_back( x );
    }

    if ( a == b ) {
        cout << 0 << endl;
        return 0;
    }

    long long int x[114514] = {};
    long long int y[114514] = {};

    queue< pair< long long int, long long int > > q;
    q.push( make_pair( 1, a ) );
    x[a] = 1;
    while( q.size() > 0 ) {
        long long int d = q.front().first + 1;
        long long int k = q.front().second;
        q.pop();
        for ( long long int i = 0; i < v[k].size(); i++ ) {
            long long int p = v[k][i];
            if ( x[p] > 0 ) continue;
            x[p] = d;
            q.push( make_pair( d, p ) );
        }
    }

    long long int ans = 0;
    q.push( make_pair( 1, b ) );
    y[b] = 1;
    while( q.size() > 0 ) {
        long long int d = q.front().first + 1;
        long long int k = q.front().second;
        q.pop();
        for ( long long int i = 0; i < v[k].size(); i++ ) {
            long long int p = v[k][i];
            if ( y[p] > 0 ) continue;
            y[p] = d;
            q.push( make_pair( d, p ) );
            if ( y[p] >= x[p] ) ans = max( ans, y[p] );
        }
    }

    cout << ans - 2 << endl;

    return 0;

}


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

using namespace std;

int main()
{
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  while(k&&b<=a){
    b=b*2;
    k--;
  }
  while(k&&c<=b){
    c=c*2;
    k--;
  }
  if(b>a&&b<c){
    cout<<"Yes";
  }
  else cout<<"No";
}


Measured memory_bytes: 3632
#include<stdio.h>

int main(){
	
	int counter[105] = {0};
	int baris;
	int arr[105];
	int kolom;

	int t;
	
	for(int i=0;i<101;i++)
	{
		counter[i+1] = 0;
	}
	
	scanf("%d",&t);
		
	for(int j=0;j<t;j++)
	{
		scanf("%d %d", &baris, &kolom);
		for(int k=0;k<kolom;k++)
		{
			scanf("%d",&arr[k]);
			
			if(counter[arr[k]] == 0)
			{
				counter[arr[k]]+=1;
			}			
		}
		for(int l=0;l<t;l++)
		{
			if(l!=t-1)
			{
				if(counter[l+1] == 0)
				{
					printf("0 ");
				}
				else
				{
					printf("1 ");
				}
			}
			else //if()
			{
				if(counter[l+1] == 0)
				{
					printf("0\n");
				}
				else
				{
					printf("1\n");
				}
			}
		}
		for(int i=0;i<101;i++)
	{
		counter[i+1] = 0;
	}
	}	
	
//	for(int l=0;l<t;i++)
//	{
//		for(int m=0;m< t)
//	}
	
	
	
	
	
	return 0;
}


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

int main(void){
  int a=0;
  int b=0;
  cin >> a >> b;
  
  int p[a]={0};
  
  for(int i=0;i<a;i++){
    cin >> p[i];
  }
  int tmp = 0;
  for(int i=0;i<a;i++){
    for(int j=i+1;j<a;j++){
      if(p[i] > p[j]){
        tmp = p[i];
        p[i] = p[j];
        p[j] = tmp;
      }
    }
  }
  int ans = 0;
  
  for(int i=0;i<b;i++){
    ans += p[i];
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3568
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;

/**
 * 借金を計算する機能
 *
 * @author kohei.nitta
 *
 */
class Main {

	/**
	 * 標準入力から値を受け取り、n週間後の借金の残高を出力する。
	 *
	 * @param args
	 * @return
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {

		BigDecimal debt = new BigDecimal("100000");
		BigDecimal interest = new BigDecimal("1.05");
		BigDecimal roundUp = new BigDecimal("1000");

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

		int inputNo = Integer.parseInt(input.readLine());

		for (int i = 1; i <= inputNo; i++) {
			debt = debt.multiply(interest)
					.divide(roundUp, 0, BigDecimal.ROUND_UP).multiply(roundUp);
		}

		System.out.println(debt);
	}
}

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

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

  vector<int> vec;

  int a;
  int ans = 0;
  for(int i = 0;i < n;i++){
    cin >> a;
    if(a % 2 == 0){
      ans += a;
    }else{
      vec.push_back(a);
    }
  }

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

  int st = 0;
  if(vec.size() % 2 == 1){
    st++;
  }

  for(int i = st;i < vec.size();i++){
    ans += vec[i];
  }

  cout << ans / 2 << endl;

  return 0;
}


Measured memory_bytes: 3168
#include<stdio.h>
int main(){
int a,b,c,min,mid;
scanf("%d %d %d",&a,&b,&c);
if(a>=1 && a<=10000 && b>=1 && b<=10000 && c>=1 && c<=10000){
if(a<b&&a<c){
    min=a;
    if(b<c){
        mid=b;
    }
    else{
        mid=c;
    }
}
else if(b<a&&b<c){
    min=b;
    if(a<c){
        mid=a;
    }
    else{
        mid=c;
    }
}
else {
    min=c;
    if(a<b){
        mid=a;
    }
    else{
        mid=b;
    }
}
printf("%d",min+mid);

}

return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
  	cin>>n;
  	int A[n];
  	int i;
  	for(i=0;i<n;i++)cin>>A[i];
  	vector<int>B(n+1,0);
  	long int ans=0;
  	for(i=0;i<n;i++)
    {
      B[A[i]]++;
    }
    for(i=1;i<=n;i++)
    {
      if(B[i]>=2)
      {
        long int temp1=B[i];
        temp1*=(B[i]-1);
        temp1/=2;
		ans+=temp1;
      }
    }
  	for(i=0;i<n;i++)
    {
        int l=A[i];
		if(B[l]<2)
          printf("%ld\n",ans);
       else if(B[l]==2)
         printf("%ld\n",ans-1);
      else{
        long  int temp=ans;
        long int temp1=B[l]-1;
        temp1=temp1*B[l];
        temp1/=2;
        temp-=temp1;
        temp1=B[l]-2;
        temp1*=(B[l]-1);
        temp1/=2;
        temp+=temp1;
        printf("%ld\n",temp);
      }
    }
  return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <math.h>
#include <cstdio>
#include <algorithm>
#include <string>
#include <string.h>
using namespace std;

const int MAX_N=50000;
int n,m,c;
int dp[MAX_N+1];

int main(){
	cin >> n >> m;
	for(int i=0;i<=n;i++) dp[i]=i;
	
	for(int i=0;i<m;i++){
		cin >> c;
		for(int j=0;j<=n;j++) if(j-c>=0) dp[j] = min(dp[j], dp[j-c]+1);
	}
	
	cout << dp[n] << endl;
	
	return 0;
}

Measured memory_bytes: 3312
#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>;

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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=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 {
    mint res(*this);
    return res/=a;
  }

  // combination
  mint choose(int n, int a) {
      mint x = 1, y = 1;
      rep(i,a) {
          x *= n-i;
          y *= i+1;
      }
      return x / y;
  }
};

struct Sieve {
    int n;
    // f[i]はiが素数であればi
    // iが素数でなければ約数の中の最小の素数
    vector<int> f, primes;
    Sieve(int n = 1): n(n), f(n+1){
        f[0] == f[1] == -1;
        for(int i = 2; i <= n; ++i){
            if(f[i]) continue;
            primes.push_back(i);
            f[i] = i;
            for(int j = 2 * i; j <= n; j += i) {
                if (!f[j]) f[j] = i;
            }
        }
    }
    // 素数判定
    bool is_prime(int x) { return f[x] == x;}
    // 約数の列挙
    vector<int> prime_divisor(int x) {
        vector<int> res;
        while(x != 1) {
            res.push_back(f[x]);
            x /= f[x];
        }
        return res;
    }
    // 素因数分解
    vector<P> prime_factor(int x) {
        vector<int> pd = prime_divisor(x);
        if(pd.size() == 0) return {};
        vector<P> res(1, P(f[0], 0));
        for(auto i: pd) {
            if(res.back().first == i){
                res.back().second++;
            }
            else {
                res.emplace_back(P(i, 1));
            }
        }
        return res;
    }
};

int main() {
    Sieve sieve(1e6);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    map<int,int> mp;
    rep(i, n) {
        auto pf = sieve.prime_factor(a[i]);
        for(auto x: pf){
            mp[x.first] = max(mp[x.first], x.second);
        }
    }

    mint lcm = 1;
    for(auto p: mp){
        rep(i, p.second)
            lcm *= p.first;
    }
    mint ans = 0;
    rep(i, n){
        mint b = lcm / a[i];
        ans += b;
    }
    cout << ans.x << endl;

    return 0;
}

Measured memory_bytes: 4984
let ans, k, n = ref 0, ref 0, Scanf.scanf " %d" (+) 0
let ss, ls = Array.(make (n * (n - 1) / 2) 0, init n @@ fun _ -> Scanf.scanf " %d" (+) 0)
let g i k a = a.(i) > k
let f k a = let l, r = ref @@ -1, ref @@ Array.length a in while !r - !l > 1 do let m = !l + (!r - !l) / 2 in if g m k a then r := m else l := m done; !r
let _ = for i = 0 to n - 1 do for j = i + 1 to n - 1 do ss.(!k) <- ls.(i) + ls.(j); incr k done done;
  Array.(sort (-) ss; sort (fun x y -> y - x) ls; iteri (fun i l -> ans := !ans + (n - i - 1) * (n - i - 2) / 2 - f l ss) ls); Printf.printf "%d\n" !ans

Measured memory_bytes: 20476
s = input()[::-1]
t = input()[::-1]
if len(s) < len(t):
    print("UNRESTORABLE")
    exit()
    
tmp = s.replace("?", "a")
if t in tmp:
    print(tmp[::-1])
    exit()
    
for i in range(len(s) - len(t) + 1):
    for j in range(len(t)):
        if s[i + j] == "?":
            continue
        elif s[i + j] == t[j]:
            continue
        break
    else:
        ans = ""
        for k in range(i):
            if s[k] == "?":
                ans += "a"
            else:
                ans += s[k]
        for tt in t:
            ans += tt
        for k in range(len(t) + i, len(s)):
            if s[k] == "?":
                ans += "a"
            else:
                ans += s[k]
        print(ans[::-1])
        exit()
print("UNRESTORABLE")

Measured memory_bytes: 9108
#include<cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

int n, x;

int main()
{
  while( scanf( "%d%d", &n, &x ), n|x )
  {
    int ans = 0;
    
    repi( i, 1, n+1 ) repi( j, i+1, n+1 ) repi( k, j+1, n+1 ) if( i+j+k == x )
      ++ans;

    printf( "%d\n", ans );
  }
  
  return 0;
}

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

int main() {
  int A, B, K, c = 0, answer;
  cin >> A >> B >> K;
  for (int i = min(A, B); c < K; i--) {
    if (A % i == 0 && B % i == 0)
      c++;
    answer = i;
  }
  cout << answer;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>

using namespace std;

typedef long long ll;

bool solve(vector<vector<ll> > c, ll i, ll j, ll k) {
    vector<ll> n = {i, j, k};
    for (ll s = 0; s < 3; s++) {
        for (ll t = 0; t < 3; t++) {
            c[s][t] -= n[s];
        }
    }

    for (ll t = 0; t < 3; t++) {
        for (ll s = 1; s < 3; s++) {
            if (c[s][t] != c[s - 1][t]) {
                return false;
            }
        }
    }

    return true;
}

int main(void) {
    vector<vector<ll> > c;
    ll l;
    for (ll i = 0; i < 3; i++) {
        c.push_back(vector<ll>());
        for (ll j = 0; j < 3; j++) {
            cin >> l;
            c.back().push_back(l);
        }
    }

    for (ll i = 0; i <= 100; i++) {
        for (ll j = 0; j <= 100; j++) {
            for (ll k = 0; k <= 100; k++) {
                if (solve(c, i, j, k)) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }

    cout << "No" << endl;
    return 0;
}



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

int main(){
    int H, W;

    while(1){

        cin >> H >> W;

        if (H == 0 && W ==0) break;
        else{
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    cout << "#";
                }
                cout << endl;
            }
            cout << endl;
        }
    }

}



Measured memory_bytes: 3100
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int N,ny=0,nx=0,nt=0,y,x,t,i;
	cin>>N;
	for(i=0;i<N;i++)
	{
		cin>>t>>x>>y;
		int mc=abs(y-ny)+abs(x-nx);
		if(t-nt>=mc&&(t-nt-mc)%2==0)
		{
			nt=t;
			ny=y;
			nx=x;
		}
		else
		{
			break;
		}
	}
	cout<<(i==N?"Yes":"No")<<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 rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
#define fout cout << fixed << setprecision(20)
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define EPS 1e-8

int main(){

	int n;
	cin >> n;
	while(n--){
		double xa, ya, ra, xb, yb, rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
		if(d > ra + rb) cout << 0 << endl;
		else if(d < fabs(ra - rb)){
			if(ra > rb) cout << 2 << endl;
			else cout << -2 << endl;
		}
		else cout << 1 << endl;
	}
	return 0;
}

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


using namespace std;

int main() {

    

    int a, b;
    int counter = 0;
    cin >> a >> b;
    int s = 1;
    while (s < b) {
        counter++;
        s += a-1;
    }

    cout << counter;
    

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define popcount(x) __builtin_popcount(x)
#define fast ios_base::sync_with_stdio(false) , cin.tie(0) ;
#define w(x) cout << (#x) << " is " << x << "\n" ;
const char nl = '\n';

int main()
{
//    fast ;
//#ifndef ONLINE_JUDGE
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
//#endif
    int n,t,x,y;
    cin >> n;
    if(n>=30)
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;


}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,ans=0;
    string s;
    
    cin>>n>>s;
    rep(i,s.size()){
        map<ll,ll> mp;
        ll cnt=0;
        rep(j,i){
            mp[s[j]-'a']=1;
        }
        rep2(j,i,s.size()){
            if(mp[s[j]-'a']==1) mp[s[j]-'a']=2;
        }
        rep(j,26){
            if(mp[j]==2){
                cnt++;
            }
        }
        ans=max(ans,cnt);
    }
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 
  int x, y, xx, yy, xxx, yyy, xxxx, yyyy;
  cin >> x >> y >> xx >> yy;
  
  xxx = xx + y - yy;
  yyy =  yy + xx - x;
  xxxx = xxx + x - xx;
  yyyy = yyy + y - yy;
  
  
  cout << xxx << " " << yyy << " " << xxxx << " " << yyyy << endl;
 
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX_P = 50025;
bool p[MAX_P];  // prime table

void init()
{
    for (int i = 0; i < MAX_P; i++)
        p[i] = true;

    p[0] = p[1] = false;
    for (int i = 2; i * i < MAX_P; i++) {
        if (p[i]) {
            for (int j = i * 2; j < MAX_P; j += i)
                p[j] = false;
        }
    }
}

int main()
{
    int n;

    init();

    while (cin >> n) {
        int min, max;

        min = max = n;
        while (--min >= 2) 
            if (p[min])
                break;
        while (++max <= MAX_P) 
            if (p[max])
                break;

        cout << min << " " << max << endl;
    }

    return 0;
}

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

int main() {
 string s;
  cin>>s;
  sort(s.begin(),s.end());
  if((s.at(0)=='a'&&s.at(1)=='b')&&s.at(2)=='c')
    cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 764
#include "iostream"
#include "vector"
#include "array"
#include "string"
#include "algorithm"
#include "functional"

using namespace std;
#define rep(p,q) for(int i = p;i < q;i++)

//1

int main(void) {
	string str = "";
	cin >> str;
	int ans = 0;
	rep(0, str.length()) {
		ans += str[i] - '0';
	}
	if (ans == 1) ans = 10;
	cout << ans << endl;
}

Measured memory_bytes: 256
/**
* @author Ashini Singha
* IIT,Jahangirnagar University
*/
#include<bits/stdc++.h>
using namespace std;
#define     ll          long long int
#define     fo(i,b,n)   for(int i=(b); i<(n) ; i++)
#define     xx          first
#define     yy          second
#define     pb          push_back
#define     sz(n)       int(n.size())
#define     pii         pair
#define     MP          make_pair

#define     PI          acos(-1.0)

#define read(x)         scanf("%d",&x)
#define read2(x,y)      scanf("%d%d",&x,&y)
#define readl(x)        scanf("%lld",&x)
#define readl2(x,y)     scanf("%lld%lld",&x,&y)
#define readd(x)        scanf("%lf",&x)
#define readd2(x,y)     scanf("%lf%lf",&x,&y)

#define pr(n)           printf("%d",n)
#define prn(n)          printf("%d\n",n)
#define prl(n)          printf("%lld",n)
#define prln(n)         printf("%lld\n",n)
#define prd(x)          printf("%lf",x)
#define prdn(x)         printf("%lf\n",x)
#define TC(n) printf("Case %d: ",n)
/*_____________E_N_D______________*/

const int N = 1000005;
ll sum[N];

int main()
{
      int n;
      read(n);

      vector<ll>v;
      v.pb(0);
      ll tot = 0ll;

      fo(i, 0, n) {
            ll x;
            readl(x);
            v.pb(x);
            tot += x;
      }

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

      sum[0]=0ll;
      for(int i = 1; i <= n; i++) sum[i] = sum[i - 1]+v[i];



      int cnt = 1;
      for(int i=n-1;i>=1;i--)
      {
            //cout<<sum[i]<<" "<<v[i]<<endl;
            if(sum[i]*2 >= v[i+1] ){
                  cnt++;
            }
            else break;
      }
      prn(cnt);



      return 0;
}


























Measured memory_bytes: 1908
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;

procedure Solve is
   X : Integer;
begin
   Get (X);
   if X = 7 then
      Put_Line ("YES");
   elsif X = 5 then
      Put_Line ("YES");
   elsif X = 3 then
      Put_Line ("YES");
   else
      Put_Line ("NO");
   end if;
end Solve;

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

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    stable_sort(a, a+n);
    reverse(a, a+n);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (i%2 != 0) ans -= a[i];
        else ans += a[i];
    }
    cout << ans << endl;
}

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

using namespace std;

char s[200010];
int cnt[26];

int main() {
  scanf("%s", s);
  memset(cnt, 0, sizeof cnt);
  long long ans = 1;
  for (int i = 0; s[i]; ++i) {
    ans += i - cnt[s[i] - 'a'];
    ++cnt[s[i] - 'a'];
  }
  printf("%lld\n", ans);
}

Measured memory_bytes: 384
W, H, N = [int(x) for x in input().split()]

x_min = 0
x_max = W
y_min = 0
y_max = H

for i in range(N):
    x, y, a = [int(x) for x in input().split()]
    if a == 1:
        x_min = max(x_min, x)
    elif a == 2:
        x_max = min(x_max, x)
    elif a == 3:
        y_min = max(y_min, y)
    else: # a == 4
        y_max = min(y_max, y)

area = max(0, x_max - x_min) * max(0, y_max - y_min)

print(area)

Measured memory_bytes: 9208
import sys
from bisect import bisect_right
n, k, *a = map(int, sys.stdin.read().split())

mod = 1000000007
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        if a[i] > a[j]:
            ans += 1
ans = k * ans % mod
a.sort()
cnt = 0
for ai in a:
    cnt += n - bisect_right(a, ai)
ans += (k * (k - 1) // 2) % mod * cnt
print(ans % mod)


Measured memory_bytes: 3188