akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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;
}

signed main() {
  int N;
  cin >> N;

  FOR(i, 1, 3500) {
    FOR(j, i, 3500) {
      if ((4 * i * j - N * j - N * i) == 0) continue;
      if ((N * i * j) % (4 * i * j - N * j - N * i) == 0) {
        int w = (N * i * j) / (4 * i * j - N * j - N * i);
        if(w <= 0) continue;
        cout << i << " " << j << " " << w << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
import math
N=int(input())

a=[0]*(N+1)
for i in range(1,N+1):
    k=[a[i-1]]
    for j in range(1,10):
        x=i-6**j
        if x<0: break
        k.append(a[x])
        
    for j in range(1,10):
        x=i-9**j
        if x<0: break
        k.append(a[x])
    
    a[i]=min(k)+1


print(int(a[N]))

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    ll x, y;
    cin >> x >> y;
    int ans = 0; 
    while(x <= y) {
        x *= 2;
        ans++;
    }

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

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;

long long int N, M, K, W, H, L, R;


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

	string s;
	cin >> s;
	map<char, long long int>m;
	for (auto i : s) {
		m[i]++;
	}
	N = s.size();
	M = N*(N + 1) / 2;
	for (char i = 'a'; i <= 'z'; i++) {
		M -= m[i] * (m[i] + 1) / 2;
	}
	M++;
	cout << M << endl;
	return 0;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define ll long long
#define pp pair<ll,ll>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
ll max(ll x, ll y)
{
    return x>y ? x : y;
}
ll min(ll x, ll y)
{
    return x<y ? x : y;
}
void _(ll&a , ll b)
{
    a=(a%mod+b%mod)%mod;
    a=(a+mod)%mod;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;cin >> s;
    ll a,b,c;a=b=c=0;
    for (int i = 0; i < s.size(); ++i)
    {
        if(s[i]=='a')a++;else if(s[i]=='b')b++;else c++;
    }
    ll x=min({a,b,c});
    a-=x;b-=x;c-=x;
    vector<ll> v{a,b,c};sort(v.begin(),v.end());
    a=v[1];b=v[2];
    if((a==0 and b==1) or (a==1 and b==1) or (a==0 and b==0))cout << "YES";else cout << "NO";
    }

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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll i,j,k,n,a[5]={0},ans;
	string b;
	cin>>n;
	for (i=0;i<n;i++){
		cin>>b;
		if (b[0]=='M'){
			a[0]++;
		}
		else if(b[0]=='A'){
			a[1]++;
		}
		else if (b[0]=='R'){
			a[2]++;
		}
		else if (b[0]=='C'){
			a[3]++;
		}
		else if (b[0]=='H'){
			a[4]++;
		}
	}
	ans=a[0]*(a[1]*a[2]+a[1]*a[3]+a[1]*a[4]+a[2]*a[3]+a[2]*a[4]+a[3]*a[4])+a[1]*(a[2]*a[3]+a[2]*a[4]+a[3]*a[4])+a[2]*a[3]*a[4];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
/**
 * Title:
 * Url:
 */
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<numeric>
#include<functional>
#include<sstream>
#include<iomanip>

using namespace std;

#define ll long long

int main() {
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    double ans = 0.0;
    pair<int, int> ans_pair(f, 0);
    for(int i=0; i<31; i++) {
        for(int j=0; j<31; j++) {
            int water = 100*a*i + 100*b*j;
            if(f<water) continue;
            int suger = min((i*a+j*b)*e, f-water);
            if(suger < c) {
                if(ans==0.0) {
                    ans_pair.first = water;
                    ans_pair.second = 0;
                }
                continue;
            }
            int r = f;
            int max_x = suger/c;
            int max_y = suger/d;
            for(int x=0; x<=max_x; x++) {
                for(int y=0; y<=max_y; y++) {
                    if(x*c+y*d<=suger) {
                        r = min(r, suger-(x*c+y*d));
                    }
                }
            }
            int max_suger = suger - r;
            if(water+max_suger>f) continue;
            if(ans < 100*max_suger/(double)(water+max_suger)) {
                ans = 100*max_suger/(double)(water+max_suger);
                ans_pair.first = water+max_suger;
                ans_pair.second = max_suger;
            }
        }
    }

    cout << ans_pair.first << " " << ans_pair.second << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  for(int i=0;i<=N;i++){
    int X=i*108/100;
    if(X==N){
      cout<<i<<endl;
    return 0;
    }
  }
  cout<<":("<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n,m,i,j;
	int a[100][100],b[100],c[100];
	scanf("%d %d",&n,&m);
	if(n>=1&&n<=100&&m>=1&&m<=100){
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				scanf("%d",&a[i][j]);
				c[i]=0;
			}
		}
		for(i=0;i<m;i++) scanf("%d",&b[i]);
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				if(a[i][j]>=0&&a[i][j]<=1000&&b[j]>=0&&b[j]<=1000){
					c[i]+=a[i][j]*b[j];
				}
			}
		}
		for(i=0;i<n;i++) printf("%d\n",c[i]);
	}
	return 0;
}



Measured memory_bytes: 2128
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):
    return map(type,input().split())

#%%code

def resolve():
    bigint=10**9
    N,K,S=pin()
    if S!=bigint:
        print(*([bigint]*(N-K)+[S]*(K)))
        return
    print(*([1]*(N-K)+[bigint]*K))
    
    
#%%submit!
resolve()

Measured memory_bytes: 5996
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()
	f, p := make([][10]int, n), make([][11]int, n)
	for i := range f {
		for j := range f[i] {
			f[i][j] = nextInt()
		}
	}
	for i := range p {
		for j := range p[i] {
			p[i][j] = nextInt()
		}
	}

	ans := -100000000 * n
	open := make([]int, 10)
	for bit := 1; bit < 1<<10; bit++ {
		// 営業するか否かを決定
		for hour := 0; hour < 10; hour++ {
			open[hour] = (bit >> uint(hour)) & 1
		}
		// 得られる利益を計算
		profit := 0
		for i := 0; i < n; i++ {
			// 各店舗と被っている時間帯数
			c := 0
			for j := 0; j < 10; j++ {
				c += open[j] * f[i][j]
			}
			profit += p[i][c]
		}
		// 最大値更新
		ans = max(ans, profit)
	}

	puts(ans)
}


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

typedef unsigned long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

#define INF (int)(1e9)

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

#define DEBUG

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

	int ans = 0;
	rep(i,s.size()-2)
	{
		if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') ans++;
	}

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

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

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
// Sat Apr 11 06:23:29 IST 2020   

#define forn(i,a,b)        for( i = a ; i < b  ; i++ )
#define debug(x)           cout << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll                 long long    
#define MOD                998244353
#define pi                 pair<int,int>
#define vi                 vector <int>
#define pb                 push_back
#define vp                 vector <pair<ll,ll>>
#define endl               cout << "\n"  
#define f1                 first 
#define s1                 second    
#define in                 insert
#define all(x)             (x).begin(),(x).end() 

using namespace std ; 
using namespace __gnu_pbds;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
const int M = 1e9+7 ;

int tests(){
  int n ; cin >> n ;
  while(n){
    if(n%10 == 7)
      return cout << "Yes\n",0;
    n /= 10 ;
  }
  cout << "No" ;
  return  0; 
}
int32_t main(){
    I__O ;            
    int cases = 1 ;  
    // cin >> cases ;  
    for(int  _ = 1 ; _ <= cases ; _++ ){   
    // cout << "Case #" << _ << ": "; 
      tests(); 
    }
    return 0 ; 
}

// -Wall -Weptra -O2
// -pedantic -std=c++11
// -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC


Measured memory_bytes: 3612
N, K = map(int, input().split())
A = list(map(int, input().split()))

dp = ['First']*(K+1)
dp[0] = 'Second'
def solve(dp):
    for i in range(1,K+1):
        for j in range(N):
            dp[i] = 'Second'
            if dp[i-A[j]]=='Second':
                dp[i] = 'First'
                break
    ans = dp[K]
    return ans
print(solve(dp))

Measured memory_bytes: 3828
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
	char ch=getchar();int f=0;
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') {f=f*10+(ch^48);ch=getchar();}
	return f;
}
int n,m,f[300005];
struct data
{
	int l;
	int r;
	int len;
}a[300005];
int cmp(const data &x,const data &y)
{
	return x.len<y.len;
}
int lowbit(int x)
{
	return x&-x;
}
void modify(int x,int y)
{
	for(int i=x;i<=m;i+=lowbit(i))
	{
		f[i]+=y;
	}
}
int query(int x)
{
	int ret=0;
	for(int i=x;i;i-=lowbit(i))
	{
		ret+=f[i];
	}
	return ret;
}
int main()
{
	n=read();m=read();
	for(int i=1;i<=n;i++)
	{
		a[i].l=read();a[i].r=read();
		a[i].len=a[i].r-a[i].l+1;
	}
	sort(a+1,a+n+1,cmp);
	int now=0;
	for(int i=1;i<=m;i++)
	{
		while(a[now+1].len<i&&now<n)
		{
			now++;
			modify(a[now].l,1);
			modify(a[now].r+1,-1);
		}
		int ans=n-now;
		for(int j=i;j<=m;j+=i)
		{
			ans+=query(j);
		}
		printf("%d\n",ans);
	}
}

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

using namespace std;

int main(){
	char b;
	cin >> b;
	switch (b){
	case 'A':
		cout << "T"<<endl;
		break;
	case 'T':
		cout << "A" << endl;
		break;
	case 'G':
		cout << "C" << endl;
		break;
	case 'C':
		cout << "G" << endl;
		break;
	}
	return 0;
}

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

enum C_Type {SPADE, HEART, CLUB, DIA};

C_Type Mark_To_Type(char m)
{
	switch(m) {
	case 'S': return SPADE;
	case 'H': return HEART;
	case 'C': return CLUB;
	case 'D': return DIA;
	}
}

char Num_To_Mark(int t)
{
	switch(t) {
	case 0: return 'S';
	case 1: return 'H';
	case 2: return 'C';
	case 3: return 'D';
	}
}

int main(void)
{
	int n;
	int card[4][13] = {0};

	cin >> n;

	for(int i = 0; i < n; i++) {
		char mark;
		int num;
		C_Type typ;

		cin >> mark >> num;
		
		num --;
		typ = Mark_To_Type(mark);
		card[typ][num] = 1;
	}

	for(int i = 0; i < 4; i++)
		for(int j = 0; j < 13; j++)
			if(card[i][j] == 0)	cout << Num_To_Mark(i) << " " << j + 1 << endl;

	return 0;
}

Measured memory_bytes: 1160
/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll n,m,k;
ll cost[50];
ll indj[50];
ll indi[50];
ll fin[50];
ll maxi = 0;
void check(vector<ll>&ans)
{
    ll cnt = 0;
    for(ll i = 0; i < k; i++)
    {
        if(ans[indj[i]-1] - ans[indi[i]-1] == fin[i])
            cnt += cost[i];
        //cout<<ans[i]<<" ";
    }
   // cout<<endl;
    maxi = max(maxi,cnt);
}
void f(ll i,ll curr,vector<ll>&ans)
{
    if(i == n)
    {
        check(ans);
        return;
    }
    for(ll j = curr; j <= m; j++)
    {
        ans.pb(j);
        f(i+1,j,ans);
        ans.pop_back();
    }
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    cin>>n>>m>>k;
    for(ll i = 0; i < k; i++)
    {
        cin>>indi[i]>>indj[i]>>fin[i]>>cost[i];
    }
    vector<ll>ans;
    f(0ll,1ll,ans);
    cout<<maxi;
    return 0;
}


Measured memory_bytes: 3624
n = int(input())
ans = (n*(n+1))/2
n3 = n // 3
n5 = n // 5
n15 = n // 15

for i in range(n3):
    ans -= 3 * (i+1)
for i in range(n5):
    ans -= 5 * (i+1)
for i in range(n15):
    ans += 15 * (i+1)
print(int(ans))


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

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a[] = new int[3];
        a[0] = scan.nextInt();
        a[1] = scan.nextInt();
        a[2] = scan.nextInt();

        Arrays.sort(a);
        System.out.println(a[2] * 10 + a[1] + a[0]);
    }
}

Measured memory_bytes: 21844
import java.util.Scanner;
 
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a  =sc.nextInt();
		int b = sc.nextInt();
		for(int i = 1; i <= 1000; i++) {
			if((int)(i*0.08)==a &&(int)( i*0.10)==b) {
				System.out.println(i);
				return;
			}
		}
		System.out.println(-1);
	}
}


Measured memory_bytes: 23764
def f(a,b):
    if b:return f(b,a%b)
    return a
n,k=map(int,input().split())
a=list(map(int,input().split()))
if n==1:
    print('POSSIBLE' if k==a[0] else 'IMPOSSIBLE')
    exit()
p=f(a[0],a[1])
for i in a[1:]:
    p=f(p,i)
print('POSSIBLE' if p==f(p,k) and k<=max(a) else 'IMPOSSIBLE')

Measured memory_bytes: 14224
#include <stdio.h>

int main(void)
{
	long long a,b[100010],i,c=0,d=1000000000,e=0,f=0;
	scanf("%lld",&a);
	for(i=0;i<a;i++){
		scanf("%lld",&b[i]);
		if(b[i]<0){
			c++;
			b[i]=b[i]*-1;
		}
		if(b[i]==0) f=1;
		if(b[i]<d) d=b[i]; 
		e=e+b[i];
	}
	if(f==1){
		printf("%lld",e);
	}else if(c%2==0){
		printf("%lld",e);
	}else{
		printf("%lld",e-d*2);
	}
	return 0;
}

Measured memory_bytes: 896
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>

#define in std::cin
#define out std::cout

int32_t A,B;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> A>>B;
	out << (A + B) % 24 << endl;

	return 0;
}
#endif


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

using namespace std;


void koch(int n, double p1[], double p2[]) {

	if (n == 0)return ;

	double s[2], t[2], u[2];

	s[0] =( p1[0] * 2 + p2[0])/3;
	s[1] = (2 * p1[1] + p2[1]) / 3;
	t[0] = (p1[0] + 2 * p2[0]) / 3;
	t[1] = (p1[1] + 2 * p2[1]) / 3;
	u[0] = (t[0] - s[0]) / 2 - (t[1] - s[1])*1.7320508 / 2 + s[0];
	u[1] = (t[0] - s[0])*1.7320508 / 2 + (t[1] - s[1])/ 2 + s[1];

	koch(n - 1, p1, s);
	printf("%.8f %.8f\n", s[0], s[1]);
	koch(n - 1, s, u);
	printf("%.8f %.8f\n", u[0], u[1]);
	koch(n - 1, u, t);
	printf("%.8f %.8f\n", t[0], t[1]);
	koch(n - 1, t, p2);
}

int main() {
	int n;
	cin >> n;
	double p1[2] = { 0.00000000,0.00000000 };
	double p2[2] = { 100.00000000,0.00000000 };
	printf("%.8f %.8f\n", p1[0], p1[1]);
	koch(n, p1, p2);
	printf("%.8f %.8f\n",p2[0], p2[1]);
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define N 506
int n,m,h,w,a[N][N];
inline int read()
{
	int x=0,c=getchar();while(c<'0'||c>'9')c=getchar();
	while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+c-48,c=getchar();return x;
}
int main()
{
	n=read();m=read();h=read();w=read();
	if(n%h==0&&m%w==0)return puts("No"),0;
	else puts("Yes");
	if(n%h==0){
		for(int i=1;i<=m;i++){
			if(i%w!=1)for(int j=1;j<=n;j++)a[j][i]=-1000;
			else for(int j=1;j<=n;j++)a[j][i]=1000*(w-1)-1;
		}
	}else{
		for(int i=1;i<=n;i++){
			if(i%h!=1)for(int j=1;j<=m;j++)a[i][j]=-1000;
			else for(int j=1;j<=m;j++)a[i][j]=1000*(h-1)-1;
		}
	}
	for(int i=1;i<=n;puts(""),i++)
		for(int j=1;j<=m;j++)printf("%d ",a[i][j]);
}

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

using namespace std;

bool check(int j, int W) {
    bool ok = true;
    for (int k = 0; k + 1 < (W - 1); k++) {
        if ((j >> k & 1) && ((j >> (k + 1)) & 1)) ok = false;
    }
    return ok;
}

int main() {
    int H, W, K;
    const int mod = 1e9 + 7;
    cin >> H >> W >> K;

    vector<vector<int>> dp(H + 1, vector<int>(W));
    dp[0][0] = 1;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            for (int k = 0; k < 1 << (W - 1); k++) {
                if (!check(k, W)) continue;
                int pos = j;

                if (k >> j & 1) pos++;
                else if (j >= 1 && k >> (j - 1) & 1) pos--;
                
                dp[i + 1][pos] += dp[i][j];
                dp[i + 1][pos] %= mod;
            }
        }
    }
    cout << dp[H][K - 1] << endl;
    return 0;
}

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

int main(){
  
  string S;
  int cnt=0;
  cin>>S;
  for(int i=0;i<S.size();i++){
   
    if(S[i]=='o')cnt++;
    
  }
  cout<<700+100*cnt<<endl;
  
 return 0; 
}

Measured memory_bytes: 256
n=int(input())
a=[int(i)for i in input().split()]
count2=0
count4=0
for i in a:
    if i%4==0:
        count4+=1
        continue
    if i%2==0:
        count2+=1
if count2!=0:n-=count2-1
if count4>=int(n/2):print("Yes")
else:print("No")

Measured memory_bytes: 14252
program sample
  implicit none

  integer :: a,b,c,x,y,i,aa,bb
  integer,allocatable :: sm(:)

  read(*,*) a,b,c,x,y
  allocate(sm(0:max(2*x,2*y)))

  sm=0
  do i=0,max(2*x,2*y)
     aa=int(x-i/2+0.5)
     bb=int(y-i/2+0.5)
     sm(i)=c*i+a*aa+b*bb
     if(aa<0)then
        sm(i)=sm(i)-a*aa
     endif
     if(bb<0)then
        sm(i)=sm(i)-b*bb
     endif     
  enddo

  write(*,*) minval(sm)

  stop
end program sample

Measured memory_bytes: 3364
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<map>

using namespace std;

int main(void){

    int n, k, ans = 1000000007;
    cin >> n >> k;

    vector<int> h(n);

    for(int i = 0;i < n;i++){
        cin >> h[i];
    }

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

    int tmp;
    for(int i = 0;i < n - k + 1;i++){
        tmp = h[i+k-1] - h[i];
        if(ans > tmp){
            ans = tmp;
        }
    }

    cout << ans << endl;

    return 0;
}

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

struct Info{
	Info(){
		to = dist = cost = road_index =0;
	}

	bool operator<(const struct Info &arg) const{
		if(dist != arg.dist)return dist < arg.dist;
		else{
			return cost < arg.cost;
		}
	};
	Info(int arg_to,int arg_dist,int arg_cost,int arg_road_index){
		to = arg_to;
		dist = arg_dist;
		cost = arg_cost;
		road_index = arg_road_index;
	}

	int to,dist,cost,road_index;
};

int N,M,min_dist[10001],min_cost[10001];

vector<Info> V[10001];

void func(){

	for(int i = 1; i <= N; i++){
		V[i].clear();
		min_dist[i] = BIG_NUM;
		min_cost[i] = BIG_NUM;
	}

	int from,to,dist,cost;

	for(int i = 0; i < M; i++){
		scanf("%d %d %d %d",&from,&to,&dist,&cost);
		V[from].push_back(Info(to,dist,cost,i));
		V[to].push_back(Info(from,dist,cost,i));
	}

	priority_queue<Info> Q;

	min_dist[1] = 0;
	min_cost[1] = 0;

	for(int i = 0; i < V[1].size(); i++){
		min_dist[V[1][i].to] = V[1][i].dist;
		min_cost[V[1][i].to] = V[1][i].cost;
		Q.push(Info(V[1][i].to,V[1][i].dist,V[1][i].cost,0));
	}

	int min_index;

	while(!Q.empty()){
		if(Q.top().dist > min_dist[Q.top().to] || Q.top().cost > min_cost[Q.top().to]){
			Q.pop();
		}else{
			min_index = Q.top().to;
			Q.pop();

			for(int i = 0; i < V[min_index].size(); i++){
				if(min_dist[V[min_index][i].to] > min_dist[min_index]+V[min_index][i].dist){
					min_dist[V[min_index][i].to] = min_dist[min_index]+V[min_index][i].dist;
					min_cost[V[min_index][i].to] = V[min_index][i].cost;
					Q.push(Info(V[min_index][i].to,min_dist[V[min_index][i].to],min_cost[V[min_index][i].to],0));
				}else if(min_dist[V[min_index][i].to] == min_dist[min_index]+V[min_index][i].dist && min_cost[V[min_index][i].to] > V[min_index][i].cost){
					min_cost[V[min_index][i].to] = V[min_index][i].cost;
					Q.push(Info(V[min_index][i].to,min_dist[V[min_index][i].to],min_cost[V[min_index][i].to],0));
				}
			}
		}
	}

	int ans = 0;

	for(int i = 2; i <= N; i++)ans += min_cost[i];

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

}

int main(){

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 5520
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int A, B;

  std::cin >> A >> B;

  if (A == 1)
    A = 14;

  if (B == 1)
    B = 14;

  std::cout << (A == B ? "Draw" : A > B ? "Alice" : "Bob") << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
from math import gcd
lcm = lambda x,y: (x*y)//gcd(x,y)
A,B,C,D = [int(i) for i in input().split()]
print(B - A + 1 - (B//C - (A-1)//C) - (B//D - (A-1)//D) + (B//lcm(C,D) - (A-1)//lcm(C,D)))

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

int main(){
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  double d;
  d = pow((pow(x1 - x2, 2) + pow(y1 - y2, 2)), 0.5);
  
  cout << fixed << setprecision(5);
  cout << d << endl;

}


Measured memory_bytes: 3404
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Joy
 */

#include <bits/stdc++.h>
#define REP(i, N) for (ll i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF 1e9
#define INFL 1e18
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

class B81 {
public:
	void solve(std::istream& in, std::ostream& out) {
        int N;
        in >> N;
        string ans = "No";
        for (int i = 1; i <= 9; i++) {
            if (N % i == 0) {
                if (N / i <= 9) ans = "Yes";
            }
        }
        out << ans << '\n';
	}
};


int main() {
	B81 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

const int inf = 1e9;

int N, K;
int A[505];
vi d;
int L[505], R[505];

signed main()
{
	cin >> N >> K;

	int Sum = 0;
	rep1(i, N) cin >> A[i], Sum += A[i];

	for (int i = 1; i * i <= Sum; ++i) {
		if (Sum % i == 0) {
			d.PB(i);
			if (i != Sum / i) d.PB(Sum / i);
		}
	}

	sort(all(d), greater<int>());

	for (int &a : d) {
		memset(L, 0, sizeof L);
		memset(R, 0, sizeof R);

		vi m;
		rep1(i, N) {
			if (A[i] % a) {
				m.PB(A[i] % a);
			}
		}

		if (m.empty()) {
			cout << a << endl;
			return 0;
		}

		int sz = m.size();

		m.PB(0);

		sort(all(m));

		for (int i = 1; i <= sz; ++i) {
			L[i] += L[i - 1] + m[i];
		}

		for (int i = sz; i >= 1; --i) {
			R[i] += R[i + 1] + (a - m[i]);
		}

		for (int i = 1; i <= sz - 1; ++i) {
			if (L[i] == R[i + 1] and L[i] <= K) {
				cout << a << endl;
				return 0;
			}
		}
	}
}




Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>
#include <functional>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

#ifndef LOCAL
#define cerr _cer
struct _cert
{
    template <typename T> _cert& operator << (T) { return *this; }
};
_cert _cer;
#endif

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
		cerr << (*i) << " ";
    }
    cerr << "\n";
}
int n, m;
ll dp[3010][3010][2];
const ll MOD = 1e9 + 7;

void add(ll &a, ll b) {
    a += b;
    if (a >= MOD)
        a -= MOD;
}

int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        dp[0][i][0] = 1;
    dp[0][0][1] = 1;
    for (int i = 0; i < m; ++i) {
        for (int j = 1; j < n; ++j) {
            for (int k = 0; k < 2; ++k) {
                add(dp[i + 1][j][k], dp[i][j][k]);
                if (j != 1)
                    add(dp[i + 1][j][k], dp[i][j][k]);
                else
                    add(dp[i + 1][j][k | 1], dp[i][j][k]);
                add(dp[i + 1][j + 1][k], dp[i][j][k]);
                add(dp[i + 1][j - 1][k], dp[i][j][k]);
            }
        }
        for (int k = 0; k < 2; ++k) {
            add(dp[i + 1][1][k], dp[i][0][k]);
            add(dp[i + 1][0][k], dp[i][0][k]);
            add(dp[i + 1][n - 1][k], dp[i][n][k]);
            if (n != 1)
                add(dp[i + 1][n][k], dp[i][n][k]);
            else
                add(dp[i + 1][n][k | 1], dp[i][n][k]);
        }
        add(dp[i + 1][0][1], dp[i + 1][0][0]);
        dp[i + 1][0][0] = 0;
    }
    ll ans = 0;
    for (int i = 0; i <= n; ++i)
        add(ans, dp[m][i][1]);
    cout << ans << "\n";
	return 0;
}




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

int main(){
    int N; cin >> N;
    vector<long long> A(N), B(N);
    for(int i=0; i<N; i++){
        cin >> A.at(i);
        B.at(i) = A.at(i)-(i+1);
    }
    sort(B.begin(),B.end());
    
    int m;
    long long ans=0;
    if(N%2==1){
        m = N/2;
    }
    else{
        m = N/2-1;
    }
    long long b=B.at(m);
//    cout << b << endl;
    for(int i=0; i<N; i++){
        ans += abs(B.at(i)-b);
    }
    cout <<  ans << endl;
}

Measured memory_bytes: 3328
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int u[100], v[100], n; bool used[100];
vector<pair<int, int>>vec, vec2;
bool solve(vector<pair<int, int>>x) {
	for (int i = 0; i < 100; i++)used[i] = false;
	int r = 0;
	for (int i = 0; i < x.size(); i++) {
		int maxn = -10000, maxid = 0;
		for (int j = 0; j < x.size(); j++) {
			if (used[j] == true)continue;
			if (r + x[j].second < 0)continue;
			if (maxn < x[j].first) { maxn = x[j].first; maxid = j; }
		}
		if (maxn == -10000) {
			return false;
		}
		r += x[maxid].first; used[maxid] = true;
	}
	return true;
};
int main() {
	cin >> n; int E = 0;
	for (int i = 0; i < n; i++) {
		string S; cin >> S; int cnt = 0, minx = 0;
		for (int j = 0; j < S.size(); j++) {
			if (S[j] == '(')cnt++; if (S[j] == ')')cnt--;
			minx = min(minx, cnt);
		}
		u[i] = cnt; v[i] = minx;
		E += cnt;
		if (u[i] >= 0)vec.push_back(make_pair(u[i], v[i]));
		else { v[i] = v[i] - u[i]; u[i] *= -1; vec2.push_back(make_pair(u[i], v[i])); }
	}
	if (E != 0) { cout << "No" << endl; return 0; }
	bool ans = solve(vec), ans2 = solve(vec2);
	if (ans == true && ans2 == true)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3176
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

template<typename T> void simultaneous_equation(T &x, T &y, T a, T b, T c, T d, T e, T f)
{
	if (a == 0 || b == 0 || d == 0 || e == 0)
	{
		if (a == 0)
		{
			y = c / b;
			x = (f - e * y) / d;
		}
		else if (b == 0)
		{
			x = c / a;
			y = (f - d * x) / e;
		}

		if (d == 0)
		{
			y = f / e;
			x = (c - b * y) / a;
		}
		else if (e == 0)
		{
			x = f / d;
			y = (c - a * x) / b;
		}
	}
	else
	{
		double a0 = a * e;
		double c0 = c * e;

		double d0 = d * b;
		double f0 = f * b;

		x = (f0 - c0) / (d0 - a0);

		y = (c - a * x) / b;
	}
}

int main()
{
	double a, b, c, d, e, f;
	for (; cin >> a >> b >> c >> d >> e >> f;)
	{
		double x, y;

		simultaneous_equation(x, y, a, b, c, d, e, f);
		cout << fixed << setprecision(3) << x + 0 << " " << y + 0 << endl;
	}
}


Measured memory_bytes: 3268
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>


int main(void){
    int N, ans;
    std::cin >> N;
    std::vector<int> P(N);
    std::vector<int> Q(N);
    std::vector<int> A(N);
    for (int i=0; i<N; ++i){
        std::cin >> P.at(i);
    }
    for (int i=0; i<N; ++i){
        std::cin >> Q.at(i);
    }
    for (int i=0; i<N; ++i){
        A.at(i) = i + 1;
    }

    std::map<std::vector<int>, int> mp;
    do {
        mp[A] = mp.size();
    } while (next_permutation(A.begin(), A.end()));

    ans = abs(mp[P] - mp[Q]);

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 8616
#include <stdio.h>

int main(void) {

  int h, w, i, j, k, l;
  while(1) {
    scanf("%d %d", &h, &w);

    if(h == 0 && w == 0) break;

      for(j = 1; j <= w; j++) {
	printf("#");
      }
      printf("\n");
      for(i = 1; i <= h - 2; i++) {
	printf("#");
	for(k = 1; k <= w - 2; k++) {
	  printf(".");
	}
	printf("#\n");
      }
      for(l = 1; l <= w; l++) {
	printf("#");
      }
    printf("\n\n");
  }

  return 0;
 
}

Measured memory_bytes: 588
/*
我们有一张3×3格子的卡。顶部第i行和左侧第j列的方块包含数字a[i，j]。
MC将选择n个数字 b1,b2...bn.如果我们的宾果表包含这些数字，我们会在我们的表上做标记。
确定当选择n个数字时，我们是否会有宾果游戏，也就是说，该表将包含三个标记的数字在一行、一列或对角线上。
*/
#include<bits/stdc++.h>
using namespace std;
int a[4][4];
int b,n;
bool vis[4][4]={0};
int main()
{
	for(int i=1;i<=3;i++)
		for(int j=1;j<=3;j++)
			cin>>a[i][j];
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>b;
		for(int i=1;i<=3;i++)
			for(int j=1;j<=3;j++)
				if(a[i][j]==b)
				{
					vis[i][j]=1;
					continue;
				}
	}
	
	for(int i=1;i<=3;i++)
	{
		if(vis[i][1]==1&&vis[i][2]==1&&vis[i][3]==1)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	for(int j=1;j<=3;j++)
	{
		if(vis[1][j]==1&&vis[2][j]==1&&vis[3][j]==1)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	if(vis[1][1]==1&&vis[2][2]==1&&vis[3][3]==1)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	if(vis[3][1]==1&&vis[2][2]==1&&vis[1][3]==1)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
		cout<<"No"<<endl;
		return 0;
}
 

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

struct UnionFind {
  UnionFind(size_t size) : v(size, -1) {}
  vector<int> v;

  int root(int x) {
    return (v[x] < 0 ? x : v[x] = root(v[x]));
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) {
      if (v[x] > v[y]) swap(x, y);
      v[x] += v[y];
      v[y] = x;
    }
  }

  int count(int x) {
    return -v[root(x)];
  }
};

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

  vector<int> a(M), b(M);
  for (int i = 0; i < M; ++i) cin >> a[i] >> b[i];

  UnionFind uf(N + 1);
  vector<int64_t> ans(M);
  for (int i = M - 1; i >= 0; --i) {
    if (!uf.same(a[i], b[i])) {
      ans[i] = 1ll * uf.count(a[i]) * uf.count(b[i]);
    }

    uf.unite(a[i], b[i]);
  }

  for (int i = 1; i < M; ++i) {
    ans[i] += ans[i - 1];
  }

  for (auto i : ans) cout << i << endl;
}


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

int main()
{
	int a, b, c, x;
	int na, nb, nc, ncount, i, j, k;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> x;
	ncount = 0;
	for (i = 0; i < a+1; i++) {
		for (j = 0; j < b+1; j++) {
			for (k = 0; k < c+1; k++) {
				if (i * 500 + j * 100 + k * 50 == x) {
					ncount += 1;
				}
			}
		}
	}
	cout << ncount;
	return 0;
}


Measured memory_bytes: 256
N,Q = [int(i) for i in input().split()]
graph = [[] for _ in range(N+1)]
ans = [0] * (N+1)
for i in range(N-1):
    a,b = [int(j) for j in input().split()]
    graph[a].append(b)
    graph[b].append(a)
for i in range(Q):
    pa,xaa = [int(j) for j in input().split()]
    ans[pa] += xaa

seen = [False] * (N+1)

import collections
from collections import deque
que = deque()
que.append(1)
seen[1] = True
while len(que) != 0:
    x = que.popleft()
    seta = set(graph[x])
    for i in seta:
        if seen[i]:
            continue
        ans[i] += ans[x]
        que.append(i)
        seen[i] = True
print(*ans[1:])


Measured memory_bytes: 151084
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		int T=in.nextInt();
		for(int t=1;t<=T;t++){
			double x1=in.nextDouble();
			double y1=in.nextDouble();
			double r1=in.nextDouble();
			double x2=in.nextDouble();
			double y2=in.nextDouble();
			double r2=in.nextDouble();
			double d=Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
			int ans;
			if(d>r1+r2)
				ans=0;
			else if(d<r1-r2)
				ans=2;
			else if(d<r2-r1)
				ans=-2;
			else
				ans=1;
			System.out.println(ans);
		}
		in.close();
	}
}

Measured memory_bytes: 28240
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

inline int getint()
{
	static char c;
	while ((c = getchar()) < '0' || c > '9');

	int res = c - '0';
	while ((c = getchar()) >= '0' && c <= '9')
		res = res * 10 + c - '0';
	return res;
}

const int MaxN = 100000;
const int INF = 0x3f3f3f3f;

int nR, nC, n, m = 0;

inline int calc(int x, int y)
{
	if (x == 0)
		return y;
	if (y == nC)
		return x + nC;
	if (y == 0)
		return -x;
	if (x == nR)
		return -y - nR;
	return INF;
}

struct object
{
	int x, y;
	object() {}
	object(const int &_x, const int &_y)
		: x(_x), y(_y) {}

	friend inline bool operator<(const object &lhs, const object &rhs)
	{
		if (lhs.x != rhs.x)
			return lhs.x < rhs.x;
		return lhs.y < rhs.y;
	}
};
object a[MaxN + 1];

int sta_n = 0;
int sta[MaxN + 1];

inline bool solve()
{
	for (int i = 1; i <= m; ++i)
	{
		while (sta_n && sta[sta_n] < a[i].x)
			--sta_n;
		if (sta_n && sta[sta_n] < a[i].y)
			return false;
		sta[++sta_n] = a[i].y;
	}
	return true;
}

int main()
{
	cin >> nR >> nC >> n;
	for (int i = 0; i < n; ++i)
	{
		int x1 = getint(), y1 = getint();
		int x2 = getint(), y2 = getint();

		int u = calc(x1, y1), v = calc(x2, y2);
		if (u > v)
			swap(u, v);
		if (u != INF && v != INF)
			a[++m] = object(u, v);
	}

	sort(a + 1, a + m + 1);

	puts(solve() ? "YES" : "NO");

	return 0;
}

Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] s1 = sc.next().toCharArray();
        char[] s2 = sc.next().toCharArray();
        long MOD = 1_000_000_007;
        long ans = 1;
        int prev = 0; // 0: vertical, 1: horizontal
        for (int i = 0; i < s1.length; i++) {
            if (s1[i] == s2[i]) {
                if (i == 0) {
                    ans *= 3;
                    prev = 0;
                    continue;
                }
                if (prev == 0) {
                    ans *= 2;
                }
                prev = 0;
            } else {
                if (i == 0) {
                    ans *= 6;
                    prev = 1;
                    i++;
                    continue;
                }
                if (prev == 0) {
                    ans *= 2;
                } else {
                    ans *= 3;
                }
                prev = 1;
                i++;
            }
            ans %= MOD;
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 35812
#include<stdio.h>
int main(void)
{  char s[10];
   int b;
   int i,l,a;
  scanf("%s",s);
  for(i=0;i<=9;i++){
    if((s[i]=='A')||(s[i]=='T')||(s[i]=='G')||(s[i]=='C'))
    {
      a=a+1; if(a>b){
      b=a;}
    }       
    else{
    a=0;}
       }
    printf("%d",b);
 return(0);}
  

Measured memory_bytes: 128
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=(1ull<<63)-1,mod=1e9+7;
const int inf=(1ull<<31)-1;
int a,b,c;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(18);
	cin>>a>>b>>c;
	if (a+b+c>=22)
		cout<<"bust";
	else 
		cout<<"win";
	return 0;
}

Measured memory_bytes: 256
x, n = map(int,input().split())
if n == 0:
    print(x)
    
else:
    p = list(map(int,input().split()))

    target_abs = [0]*100

    for i in range(n):
        if abs(p[i]-x) >= 100:
            continue
        elif p[i]-x > 0:
            target_abs[abs(p[i]-x)] += 1
        else:
            target_abs[abs(p[i]-x)] += 2

    ans = 1000000
    for i in range(100):
        if i == 0:
            if target_abs[i] == 0:
                ans = x
        elif ans == 1000000:
            if target_abs[i] == 0:
                ans = x - i
            elif target_abs[i] == 1:
                ans = x - i
            elif target_abs[i] == 2:
                ans = x + i
    print(ans)

Measured memory_bytes: 9232
//In The Name Of GOD
 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
const ll mod = 998244353;
const ll inf = 2000000000;
const ll infll = (ll)2*1000*1000*1000*1000*1000*1000;
const ll maxn = 100*1000+1;
#define pb push_back
#define pp pop_back
#define X first
#define Y second
#define IO ios_base::sync_with_stdio(false);
 
int sz[maxn];
bool mark[maxn];
 
int main(){
  IO;
  int n,m;
  cin >> n >> m;
  mark[1]=true;
  for(int i=1;i<=n;i++)sz[i]=1;
  for(int i=0;i<m;i++){
    int u,v;
    cin >> u >> v;
    if(mark[u])mark[v]=true;
    if(sz[u]==1)mark[u]=false;
    sz[u]--;
    sz[v]++;
  }
  int ans=0;
  for(int i=1;i<=n;i++){
    ans+=mark[i];
  }
  cout<<ans;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define int long long
#define endre getchar();getchar();return 0
#define INF 1000000007
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return (kai(n - 1)*n) % INF;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int mystoi(string s) {
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		cnt += (int)(s[i] - '0') * pow(10, s.size() - i - 1);
	}
	return cnt;
}
int h, w;
char c[105][105];
bool x[105], y[105];
signed main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> c[i][j];
			if (c[i][j] == '#')x[i] = true;
		}
	}
	for (int i = 0; i < w; i++) {
		for (int j = 0; j < h; j++) {
			if (c[j][i] == '#')y[i] = true;
		}
	}
	for (int i = 0; i < h; i++) {
		if (!x[i])continue;
		for (int j = 0; j < w; j++) {
			if (!y[j])continue;
			cout << c[i][j];
		}
		cout << endl;
	}
	endre;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

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

    int n0=0, n1=0;
    for(int i=0; i<s.length(); i++){
        if(s[i] == '0') n0++;
        else n1++;
    }

    for(int i=1; i<s.length(); i++){
        if(s[i-1] == s[i]){
            if(s[i] == '0'){
                s[i] = '1';
                ans++;
            }else{
                s[i] = '0';
                ans++;
            }
        }
    }

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

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int X;
	cin >> X;

	Int temp = X / 100;
	temp *= 100;

	Int res = X - temp;//Xの下二桁

	Int cnt = 0;
	cnt += res / 5;
	res %= 5;

	cnt += res / 4;
	res %= 4;

	cnt += res / 3;
	res %= 3;

	cnt += res / 2;
	res %= 2;

	cnt += res / 1;
	res %= 1;


	if (cnt*100<=temp) {
		cout << 1 << "\n";
	}
	else {
		cout << 0 << "\n";
	}
}


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

typedef long long  ll;
	

int main()
{
  
  	string s;
  	cin>>s;
  	if(s[1]=='B')
  		s[1]='R';
  	else
  		s[1]='B';
  	cout<<s;
}

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

const int N = 2e5 + 5;

int n, ne[N][26] , now[26], t = 1 , xxy , dp[N];
char s[N];

void dfs(int x) {
    for(int i = 0;i < 26;++ i) if(!ne[x][i]) {
	    putchar(i + 'a'); exit(0);
	}
    int Min = 2e9;
    for(int i = 0;i < 26;++ i) {
	Min = min(Min , dp[ne[x][i]]);
    }
    for(int i = 0;i < 26;++ i) {
	if(Min == dp[ne[x][i]]) {
	    putchar(i + 'a'); dfs(ne[x][i]);
	    return;
	}
    }
}

int main(void) {
    scanf("%s" , s + 1);
    n = strlen(s + 1);
    for(int i = n;i >= 0;-- i) {
	dp[i] =2e9;
	for(int j = 0;j < 26;++ j) {
	    ne[i][j] = now[j];
	    dp[i] = min(dp[i] , dp[ne[i][j]]);
	}
	int sby = 1;
	for(int j = 0;j < 26;++ j) {
	    sby &=(!!now[j]);
	}
	dp[i] += sby;
	if(i == 0) break;
	now[s[i] - 'a'] = i;
	xxy |= (1 << (s[i] - 'a'));
	if(xxy == (1 << 26) - 1) {
	    ++ t; xxy = 0;
	}
    }
    dfs(0);
}


Measured memory_bytes: 21632
n=int(input())
ansli=[0]

import itertools

#判定配列用意
a=[]
for i in range(n):
  templi=[]
  for j in range(int(input())):
    x,y=map(int,input().split())
    templi.append([x,y])
  a.append(templi)

for i in itertools.product((0,1),repeat=n): #2のn乗通りの組み合わせ全て調査。
  temp=[-1]*n #n人について判定用配列作る。
  flag=1
  for j in range(n): #n人それぞれの証言を検証する。
    for k in a[j]: #jさんのk番目の証言について。
      x=k[0]-1
      y=k[1]

      #ここから先はjさんが正直か迷惑かでわかれる
      if i[j]==1: #もしjさんが正直なら…

        #まだ判定用配列に値がない場合
        if temp[x]==-1:
          temp[x]=y #このyの値をデフォルトとする。
        
        #判定用配列に既に値がある場合
        else:
          if temp[x]!=y: #先に入っている値と矛盾する場合は、このitertoolsループをスキップ
            flag=0
            break

      # else: #jさんが迷惑な場合…

      #   #まだ判定用配列に値がない場合
      #   if temp[x]==-1:
      #     if y==1:
      #       temp[x]=0 #このyの値をデフォルトとする。
      #     else:
      #       temp[x]=1
      #   #判定用配列に既に値がある場合
      #   else:
      #     if temp[x]==y: #先に入っている発言と矛盾する場合は、このitertoolsループをスキップ(jさんが嘘つきな場合なので、数値一致するケースが矛盾。)
      #       flag=0
      #       break

  #発言の検証のあとは、itertoolsと判定用配列の矛盾を調査
  for j in range(n):
    if temp[j]!=-1:
      if i[j]!=temp[j]: #ここで矛盾の検査
        flag=0
        break
  if flag==1: #全て検証して矛盾がない場合は、答えを入れてあげよう。
    ansli.append(sum(i))
    #print(i)

print(max(ansli))

Measured memory_bytes: 3500