akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
//#include <complex>
#include <algorithm>
using namespace std;

//typedef complex<double> P;

struct P {
	double real, imag;

	P operator - (const P& obj)
	{
		return P{ real - obj.real,imag - obj.imag };
	}
};

#define EPS (1e-9)

double cross(P a, P b) {
	return (a.real * b.imag - a.imag * b.real);
}

int is_intersected(P a1, P a2, P b1, P b2) {
	return ((cross(a2 - a1, b1 - a1) * cross(a2 - a1, b2 - a1) < EPS) &&
		(cross(b2 - b1, a1 - b1) * cross(b2 - b1, a2 - b1) < EPS));
}

P s[101], t[101];
int c[101], l[101];

struct intersection {
	double t; // parameter t
	int n;    // index of intersected line

	bool operator<(const intersection &a) const {
		return (t < a.t);
	}
};

int main() {
	int N;
	cin >> N;
	while (N--) {
		P a, b;
		cin >> a.real >> a.imag;
		cin >> b.real >> b.imag;

		int n;
		cin >> n;
		for (int i = 0; i<n; i++) {
			cin >> s[i].real >> s[i].imag;
			cin >> t[i].real >> t[i].imag;
			cin >> c[i] >> l[i];
		}

		vector<intersection> is;
		for (int i = 0; i<n; i++) {
			if (!is_intersected(a, b, s[i], t[i])) { continue; }
			if (abs(cross(b - a, t[i] - s[i])) < EPS) { continue; }

			P x = t[i] - s[i];
			double d1 = abs(cross(x, a - s[i]));
			double d2 = abs(cross(x, b - s[i]));
			double t = d1 / (d1 + d2);

			intersection tmp = { t, i };
			is.push_back(tmp);
		}

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

		int curr; // current status: up (=1) or down (=0)
		if (is.size() > 0) {
			int idx = is[0].n;
			curr = (c[idx] == 1 ? l[idx] : !l[idx]);
		}

		int cnt = 0;
		for (int i = 1; i<is.size(); i++) {
			int idx = is[i].n;
			if ((c[idx] == 1 && curr != l[idx]) ||
				(c[idx] == 0 && curr == l[idx])) {
				curr = !curr;
				cnt++;
			}
		}

		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 3224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int y = scan.nextInt();
		int z = scan.nextInt();

		System.out.println((x-z)/(z+y));
	}

}


Measured memory_bytes: 21844
<>=~$";if(1<$'&&$'<2*$`-1){print'Yes',$/;
	$i=1;
	for(1..2*$`-1){
		if($i==$'-1){$i+=3;}
		if($`-1<=$_&&$_<=$`+1){
			print$'+$%++-1,$/;
		}else{
			print$i++,$/;
		}
	}
}else{print'No',$/}

Measured memory_bytes: 1664
use std::str::FromStr;
use std::fmt::Debug;

fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line: Vec<u32> = read_as_vec();
    let (x, y) = (line[0], line[1]);

    println!("{}", x+y/2);
}


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

signed main(){
	ll n; cin >> n;
	ll ans = 0;
	for(ll i = 1; i <= n; i++){
		ll p = n / i;
		ll l = p * i;
		ans += p * (i + l) / 2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstdio>
#include<algorithm>
#define ll long long
#define N 100100
using namespace std;

ll n,fa[N],bb,ans;
struct Node
{
	ll x,y,id;
} node[N];
struct Bn
{
	ll a,b,c;
	bool operator < (const Bn u) const
	{
		return c<u.c;
	}
} bn[N<<1];

ll ff(ll u)
{
	return u==fa[u]?u:fa[u]=ff(fa[u]);
}
inline bool cmp1(Node u,Node v)
{
	return u.x<v.x;
}
inline bool cmp2(Node u,Node v)
{
	return u.y<v.y;
}

int main()
{
	ll i,j,p;
	cin>>n;
	for(i=1; i<=n; i++)
	{
		scanf("%lld%lld",&node[i].x,&node[i].y);
		node[i].id=i;
		fa[i]=i;
	}
	sort(node+1,node+n+1,cmp1);
	for(i=1; i<n; i++) bn[++bb].a=node[i].id,bn[bb].b=node[i+1].id,bn[bb].c=node[i+1].x-node[i].x;
	sort(node+1,node+n+1,cmp2);
	for(i=1; i<n; i++) bn[++bb].a=node[i].id,bn[bb].b=node[i+1].id,bn[bb].c=node[i+1].y-node[i].y;
	sort(bn+1,bn+bb+1);
	for(i=1; i<=bb; i++)
	{
		if(ff(bn[i].a)==ff(bn[i].b)) continue;
		fa[ff(bn[i].a)]=ff(bn[i].b);
		ans+=bn[i].c;
	}
	cout<<ans;
}

Measured memory_bytes: 8064
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

constexpr lli inf = 10000 * 10000;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

bool a[100] = {};

int main(void) {

	lli n, k;
	cin >> n >> k;

	for (int i = 0; i < k; i++) {

		lli d;

		cin >> d;
		for (int j = 0; j < d; j++) {
			int t;
			cin >> t;
			a[--t] = true;
		}
	}

	int c = 0;

	for (int i = 0; i < n; i++) {
		if (!a[i])
			c++;
	}

	cout << c << endl;

	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include <string> 
using namespace std;
bool A[1000000001]={};
int main()
{
  int N,num;
  bool flag=false;
  cin>>N;
  for(int i=0;i<N;i++){
     cin>>num;
     if(A[num]){
       flag=true;
       break;
     } 
     A[num]=true;
  }
  if(!flag){
    cout<<"YES";
  }else{
    cout<<"NO";
  }
  return 0;
}


Measured memory_bytes: 975360
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

#define rep(i, n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

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

    string s;
    cin>>s;

    if(s[k-1]=='A')s[k-1]='a';
    if(s[k-1]=='B')s[k-1]='b';
    if(s[k-1]=='C')s[k-1]='c';
    cout<<s<<endl;



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
string s;

int main(){
	cin>>n;
	int l=0,r=n/2+1,t=0;
	cout<<l<<endl;
	cin>>s;
	if(s[0]=='V') return 0;
	if(s[0]=='F') t++;
	while(r-l>1){
		int m=(l+r)/2;
		cout<<2*m<<endl;
		cin>>s;
		if(s[0]=='V') return 0;
		if(s[0]=='M'^t) l=m;
		else r=m;
	}
	cout<<2*l+1<<endl;
	cin>>s;
}


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

int main()
{
	int n,siz,ite,strite;
	string res,str;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> str;
		res = str[0];
		strite = 1;
		siz = 0;
		ite = 0;
		while (strite < str.size()) {
			if (str[strite] == '<') {
				if (ite == 0) {
					siz++;
					strite += 2;
					res = str[strite++] + res;
				} else {
					strite += 3;
					ite--;
				}
			}
			else if (str[strite] == '-') {
				if (ite == siz) {
					siz++;
					ite = siz;
					strite += 2;
					res += str[strite++];
				} else {
					strite += 3;
					ite++;
				}
			}
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
struct LS {
	ll num, cost;
	//値、遅延配列
};
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%p;
		x = x * x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int a[200000];
int b[200000], c[200000];
signed main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	sort(a, a + n);
	int r = 1, t = n - 1;
	int s = 100000, e = 100002;
	b[100001] = a[0];
	while (t >= r) {
		b[s--] = a[t--];
		if (t >= r) {
			b[e++] = a[t--];
		}
		if (t >= r) {
			b[s--] = a[r++];
		}
		if (t >= r) {
			b[e++] = a[r++];
		}
	}
	c[100001] = a[n - 1];
	r = 0, t = n - 2;
	s = 100000, e = 100002;
	while (t >= r) {
		c[s--] = a[r++];
		if (t >= r) {
			c[e++] = a[r++];
		}
		if (t >= r) {
			c[s--] = a[t--];
		}
		if (t >= r) {
			c[e++] = a[t--];
		}
	}
	for (int i = s + 1; i < e - 1; i++) {
		ans += abs(b[i + 1] - b[i]);
	}
	int res = 0;
	for (int i = s + 1; i < e - 1; i++) {
		res += abs(c[i + 1] - c[i]);
	}
	ans = max(ans, res);
	cout << ans << endl;
}

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

int dp[101][4][4][4];
int mod = 1000000007;

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

    dp[0][3][3][3] = 1;   
    for(int len=0; len<n; len++){
        for(int c3=0; c3<4; c3++){
            for(int c2=0; c2<4; c2++){
                for(int c1=0; c1<4; c1++){
                    if(dp[len][c3][c2][c1] == 0)continue;
                    for(int p=0; p<4; p++){
                        if(c2==0 && c1==1 && p==2)  continue;
                        if(c2==1 && c1==0 && p==2)  continue;
                        if(c2==0 && c1==2 && p==1)  continue;
                        if(c3==0 && c1==1 && p==2)  continue;
                        if(c3==0 && c2==1 && p==2)  continue;
           
                        dp[len+1][c2][c1][p] += dp[len][c3][c2][c1];   
                        dp[len+1][c2][c1][p] %= mod;                     
                    } 
                }    
            } 
        }
    }
    
    int ans = 0;

    for(int c3=0; c3<4; c3++){
        for(int c2=0; c2<4; c2++){
            for(int c1=0; c1<4; c1++){
                ans += dp[n][c3][c2][c1]; 
                ans%=mod;           
            }
        }
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define sc(x) scanf("%d", &x)
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define ALL(x) x.begin(), x.end()
#define SZ(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define ABS(x) ((x)>=0?(x):(-(x)))
#define fastio ios::sync_with_stdio(0),cin.tie(0)
template<class T>T gcd(T a, T b){return b?gcd(b, a%b):a;}
const int maxn = 5e2+10;
vector<int> G[maxn];

int main()
{
    int n, m, q;
    sc(n); sc(m); sc(q);
    for(int i = 0; i < m; i++){
        int l, r;
        sc(l); sc(r);
        G[l].pb(r);
    }
    for(int i = 1; i <= n; i++)sort(ALL(G[i]));
    for(int i = 0; i < q; i++){
        int p, q;
        sc(p); sc(q);
        int ans = 0;
        for(int j = p; j <= q; j++){
            ans += upper_bound(ALL(G[j]), q)-G[j].begin();
        }
        printf("%d\n", ans);
    }
    return 0;
}




Measured memory_bytes: 2176
use proconio::{fastout, input};
use std::io::*;
use std::str::FromStr;

use std::cmp::{max, min};

fn main() {
    input! {
        num: String,
    };
    let mut prev: char = ' ';
    for i in num.chars() {
        if i == prev {
            println!("Bad");
            return;
        }
        prev = i;
    }
    println!("Good")
}


Measured memory_bytes: 2108
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
	Scanner scan =new Scanner(System.in);
	int kouka =scan.nextInt();
	int  fivehundreds =500;
	int five =5;

	int a=kouka/fivehundreds;
	int nokori =kouka-a*fivehundreds;
	int b=nokori/five;
	int c=1000*a+5*b;

	System.out.println(c);
	}

}


Measured memory_bytes: 22996
MOD=998244353
N,K=map(int,input().split())

lrlist=[]
for _ in range(K):
  l,r=map(int,input().split())
  lrlist.append((l,r))
#print(lrlist)

#A1～Aiまでの和 O(logN)
def BIT_query(idx):
  res_sum = 0
  while idx > 0:
    res_sum += BIT[idx]
    idx -= idx&(-idx)
  return res_sum
#Ai += x O(logN)
def BIT_update(idx,x):
  while idx <= N:
    BIT[idx] += x
    idx += idx&(-idx)
  return  

#初期化
BIT=[0]*(N+1)
BIT_update(1,1)

for i in range(2,N+1):
  for l,r in lrlist:
    left=i-r
    right=i-l    
    if right<1:
      continue
    elif left<1:
      left=1
    
    sum_intv=BIT_query(right)-BIT_query(left-1)
    BIT_update(i,sum_intv)
    
  nomod=BIT_query(i)-BIT_query(i-1)
  BIT_update(i,nomod%MOD-nomod)
    
print(BIT_query(N)-BIT_query(N-1))

Measured memory_bytes: 76204
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

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

    int x[N]; REP(0, i, N) cin >> x[i]; sort(x, x + N, greater<int>());

    int y[M]; REP(0, i, M) cin >> y[i]; sort(y, y + M);

    if (x[0] < y[0] && X < Y && X < y[0] && x[0] < Y) {
        cout << "No War" << endl;
    } else {
        cout << "War" << endl;
    }

    return 0;
}


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

int k , tot = 9;
queue <long long> Q;

int main(){
	scanf("%d" , &k);
	if(k <= 9){ printf("%d" , k); return 0; }
	for(int i = 1; i <= 9; i++) Q.push(i);
	while(true){
		long long u = Q.front() , p = u % 10;
		Q.pop();
		if(p != 0){
			Q.push(u * 10 + p - 1) , tot++;
			if(tot == k){ printf("%lld" , u * 10 + p - 1); return 0; }
		}
		Q.push(u * 10 + p) , tot++;
		if(tot == k){ printf("%lld" , u * 10 + p); return 0; }
		if(p != 9){
			Q.push(u * 10 + p + 1) , tot++;
			if(tot == k){ printf("%lld" , u * 10 + p + 1); return 0; }
		}
	}
} 

Measured memory_bytes: 768
N=int(input())
for i in range(N):
    x,y,z=map(int,input().split())
    if x**2==y**2+z**2:
        print('YES')
    elif y**2==x**2+z**2:
        print('YES')
    elif z**2==x**2+y**2:
        print('YES')
    else:
        print('NO')


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


def main():
    n = int(input())
    odds = [i for i in range(1, 201) if i % 2 == 1]
    ans = 0

    for j in range(1, n + 1):
        count = 0

        for odd in odds:
            if j % odd == 0:
                count += 1

        if count == 8:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair<lo,lo> ll;//pair
typedef vector<lo> vl;  //vector of long
typedef vector<ll > vll;   //vector of pair
typedef priority_queue<lo>p_q;
#define mp(a,b) make_pair((a),(b))
#define REP(a,b) for(lo i=(a);i<(b);i++)//no need to declare variable i
 
#define REP2(a,b) for(lo j=(a);j<(b);j++)
#define REPE(a,b,c,d) REP(a,b)for(lo j=(c);j<(d);j++)//no need to declare vaiables i,j
#define REPV(a,b,c) for((a)=b;(a)<(c);(a)++)//a is the variable
#define IREP(a,b) for(lo i=(a);i>=(b);i--)
#define IREPV(a,b,c) for((a)=b;(a)>=(c);(a)--)
#define all(v) (v).begin(),(v).end()
#define TRvl(c) for (vl::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvll(c) for (vll::iterator it = (c).begin(); it != (c).end(); it++
#define INF INT_MAX
#define gc getchar_unlocked
#define pc putchar_unlocked3
#define pb(a) push_back((a))
 
 
 
lo cel(lo x,lo y){
	if(x%y<=1)return x/y;
	else return x/y +1;
}
 
 
void solve(){
	lo n;
	cin>>n;
	lo a,b;
	cin>>a>>b;
	if(a+b+n >=22)cout<<"bust";
	else cout<<"win";
 
	
}
 
 
 
int main(){
	
 
	// lo n;
	// cin>>n;
	// while(n--)
		solve();
	
	return 0;
}

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

using namespace std;

int main(void) {
    int n;
    while (cin >> n, n) {
        char c[100], fr;
        int max = -1, cnt[26] = {};
        bool tie = true;

        for (int i = 0; i < n; i++)
            cin >> c[i];

        for (int i = 0; i < n; i++) {
            if (++cnt[c[i] - 'A'] > max) {
                fr = c[i];
                max = cnt[fr - 'A'];
            }

            bool flag = true;
            for (int j = 0; j < 26; j++) {
                if (j + 'A' == fr) continue;
                if (cnt[j] + n - i - 1 < max) continue;
                flag = false;
                break;
            }

            if (!flag) continue;
            cout << fr << " " << i + 1 << endl;
            tie = false;
            break;
        }
        if (tie) cout << "TIE" << endl;
    }

    return 0;
}


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


////////// 	Template structure for debugging

#define tr(...) trace(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void trace(const char* name, Arg1&& arg1){
cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void trace(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cout.write(names, comma-names) << " : " << arg1 << " | " ; 

trace(comma+1, args...);
}

#define print(...) pr(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void pr(const char* name, Arg1&& arg1){
cout << arg1 << endl;
}
template <typename Arg1, typename... Args>
void pr(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cout << arg1 << " "; 
pr(comma+1, args...);
}

void printV(vector<int> &arr)
{
for(int i=0;i<arr.size();i++)cout << arr[i] << " \n"[ i == arr.size()-1 ];
}

///////////////// Fenwick Tree 
// void update(int index,int num){

// 	while(index<=N){
// 		arr[index] += num;
// 		index += index & (-index);
// 		//cout << index << endl;
// 	}

// }

// int sum(int index){

// 	int s = 0;
// 	while(index){
// 		s += arr[index];
// 		index -= index & (-index);
// 	}
// 	return s;
// }

//////////////////////////////////////////////

/////////////////// Type definitions
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<long,long> pl;
typedef pair<double,double> pd;
#define f first
#define s second
////////////////////////////////////////////////////////////////////////////

int t;
void solve(){}	

int main(){

	int n, w;
	cin >> n >> w;
	ll dp[w+1] = { 0ll };

	for(int item = 0; item < n; item++)
	{
		int weight,val;
		cin >> weight >> val;
		for(int weight_already = w - weight; weight_already >= 0; weight_already--)
			dp[weight_already + weight] = max(dp[weight_already + weight],dp[weight_already]+val);
	}
	cout << *max_element(dp,dp+w+1);
}

Measured memory_bytes: 4376
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
ll n;
vector<ll> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >>n;
    for(int i=0;i<n;i++){
        ll s;
        cin>>s;
        a.push_back(s);
    }
    vector<ll> keta(61,0);
    ll b=1;
    for(int i=0;i<=60;i++){
        ll sum=0;
        for(int j=0;j<n;j++){
            if(a[j]&b){
                sum++;
            }
        }
        b*=2;
        keta[i]=sum;
        //cout<<sum<<"\n";
    }
    ll ans=0;
    b=1;
    for(int i=0;i<=60;i++){
        ans+=b%MOD*((keta[i]*(n-keta[i]))%MOD);
        //cout<<ans<<"\n";
        b*=2;
        ans%=MOD;
    }
    cout<<ans<<"\n";
}
//n*keta[i]-keta[i]*(1+keta[i])/2



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

int main(){
    int n;
    cin >> n;
    vector<int> t(n);
    for(int i = 0; i < n; i++) cin >> t[i];
    int m;
    cin >> m;
    vector<int> p(m), x(m);
    for(int i = 0; i < m; i++) cin >> p[i] >> x[i];

    int ans = 0;
    for(int i = 0; i < n; i++) ans += t[i];
    for(int i = 0; i < m; i++){
        cout << ans - t[p[i]-1] + x[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int d[] = new int[12];
		for(int i=0; i<12; i++){
			d[i] = sc.nextInt();
		}
		int sd1ary[] = {d[0], d[5], d[1], d[2], d[4], d[3]};
		int sd2ary[] = {d[6], d[7], d[8], d[9], d[10], d[11]};
		int sd3ary[][] = 
			   {{d[6], d[11], d[7], d[8], d[10], d[9]}, 
				{d[7], d[10], d[6], d[9], d[11], d[8]}, 
				{d[8], d[9], d[10], d[6], d[7], d[11]},  
				{d[9], d[8], d[10], d[11], d[7], d[6]},  
				{d[10], d[7], d[8], d[11], d[9], d[6]},  
				{d[11], d[6], d[9], d[10], d[8], d[7]}};
		int count = 0;
		int add = 0;
		
  out : for(int k=0; k<6; k++){
			if(sd1ary[0] == sd2ary[k]){
				for(int j=2; j<6; j++){
					count=0;
					if(sd1ary[2]==sd3ary[k][j]){
						for(int n=0; n<4; n++){
							add = j+n;
							if(add>5) add=add-4;

							if(sd1ary[n+2]==sd3ary[k][add]){
								count++;
								if(count==4)break out;
							}
						}
					}
				}
			}
		}
		if(count==4){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 26208
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)
#define N 1000000
ll a[1000009];
bool num[1000009];
vector<ll> prime;
void seive()
{
    ll i,j;
    num[1] = true;
    for(i=4; i<=N; i+=2)
        num[i] = true;
    for(i=3; i*i<=N; i+=2)
    {
        if(num[i]==false)
        {
            for(j=i*i; j<=N; j+=2*i)
            {
                num[j] = true;
            }
        }
    }
    prime.pb(2);
    for(i=3; i<=N; i+=2)
    {
        if(!num[i])
            prime.pb(i);
    }
}
int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    seive();
    cin>>n;
    map<ll,ll> ma;
    for(i=0;i<prime.size() && prime[i]*prime[i]<=n;i++)
    {
        x  =  0;
        if(n%prime[i]==0)
        {
            while(n%prime[i]==0)
            {
                n = n/prime[i];
                x++;
            }
            ma[prime[i]] = x;
        }
    }
    if(n>1)
    {
        ma[n]  =1;
    }
    map<ll,ll> :: iterator it;
    ll ans=  0;
    for(it = ma.begin();it!=ma.end();it++)
    {
        x = 1;
        y = 1;

        while(x<=it->second)
        {
            ans++;
            y++;
            x+= y;

        }
    }
    cout<<ans<<endl;

    return 0;
}



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

int main(){
	
  	int N;
  	int d[110];
  	cin >> N;
  	for(int i= 0; i<N;i++)cin >> d[i];
  
  	int num[110]={0};
  	for(int i=0;i<N;i++){
   		num[d[i]]++;
    }

	int res = 0;
  	for(int i= i; i <=100; ++i){
    
    	if(num[i]){
        	++res;
        }
    
    }

	cout << res << endl;
  
}

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

using namespace std;

int main()
{
    int n, a, b;
    while(cin >> n)
    {
        if(n == 1)
        {
            cout << "Hello World" << endl;
        }
        else
        {
            cin >> a >> b;
            cout << a + b << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.HashMap;
import java.util.TreeMap;
import java.util.Map;
import java.util.Collections;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    private static Scanner sc = new Scanner(System.in);
    private static int mod = (int) 10e8 + 7;

    public static void main(String[] args) {
        int n = sc.nextInt();
        for (int i = n; i <= Integer.MAX_VALUE; i++) {
            boolean isPrime = true;
            for (int j = 2; j < Math.sqrt(i); j++) {
                if (i%j == 0) {
                    isPrime = false;
                    break;
                }
            }
            if(isPrime) {
                System.out.println(i);
                return;
            }
        }
    }

}


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

N=int(input())
S=input().strip()

mod=998244353

NOW=dict()
NOW["R"]=0
NOW["G"]=0
NOW["B"]=0

ANS=1
for i in range(1,N+1):
    ANS=ANS*i%mod

for s in S:
    k,l,m=sorted((NOW["R"],NOW["G"],NOW["B"]))
    
    if NOW[s]==m:
        NOW[s]+=1

    elif NOW[s]==l:
        NOW[s]+=1
        ANS=ANS*(m-l)%mod

    else:
        NOW[s]+=1
        ANS=ANS*l%mod
    
    if NOW["R"]>=1 and NOW["G"]>=1 and NOW["B"]>=1:
        NOW["R"]-=1
        NOW["G"]-=1
        NOW["B"]-=1

print(ANS)

Measured memory_bytes: 3800
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String b = sc.next();
		if ("A".equals(b)) {
			System.out.println("T");
		} else if ("C".equals(b)) {
			System.out.println("G");
		} else if ("G".equals(b)) {
			System.out.println("C");
		} else {
			System.out.println("A");
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define mod 1000000007
#define f first
#define s second

using namespace std;

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

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

vi ans(10001,0);
vector<bool> vis(10001,false);
priority_queue<int> pq;
vi adj[10001];

void bfs(int x){
    queue<int> q;
    q.push(x);

    while(!q.empty()){
        int t = q.front();
        q.pop();
        if(vis[t] == true)
            continue;

        vis[t] = true;
        ans[t] = pq.top();
        pq.pop();


        for(int i =0;i<adj[t].size();i++){
            if(vis[adj[t][i]] == false)
                q.push(adj[t][i]);
        }

    }
}

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

    int n;
    cin>>n;

    vector<pii> edges;
    int a,b;
    for(int i =0;i<n-1;i++)
    	{cin>>a>>b;
    	adj[a].push_back(b);
        adj[b].push_back(a);
        edges.push_back(make_pair(a,b));
        }

    int x;
    for(int i =0;i<n;i++){
    	cin>>x;
    	pq.push(x);
    }
    bfs(1);
    
    long long sum = 0;
    for(int i =0;i<edges.size();i++){
        sum+=min(ans[edges[i].f] , ans[edges[i].s]);
    }

    cout<<sum<<"\n";

    for(int i =1;i<=n;i++)
        cout<<ans[i]<<" ";


	return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>

int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    int p[m];
    char s[m][3];
    for(int i = 0; i < m; i++){
        scanf("%d", &p[i]);
        scanf("%s", s[i]);
    }
    int w[n];
    int a = 0;
    int wa = 0;
    int flag[n];
    for(int i = 0; i < n; i++){
        flag[i] = 0;
        w[i] = 0;
    }
    for(int i = 0; i<  m; i++){
        if(flag[p[i]-1] == 0){
            if((s[i][0] == 'A') && (s[i][1] == 'C')){
                flag[p[i]-1] = 1;
                a++;
            }
            else if((s[i][0] == 'W')&& (s[i][1] == 'A')){
                w[p[i]-1]++;
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(flag[i] == 1){
            wa += w[i];
        }
    }
    
    printf("%d %d", a, wa);
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
using Graph = vector<vector<int> >;
using GraphC = vector<vector<char> >;
const int INF = 100000000;
typedef pair<int, int> P;
const int MAX_N = 1000000;

int N, K, Q;


int main() {
	cin >> N >> K >> Q;
	vector<int> vec(N, K);
	rep(i, N) {
		vec.at(i) -= Q;
	}
	int tmp;
	rep(i, Q) {
		cin >> tmp;
		vec.at(tmp-1) += 1;
	}
	rep(i, N) {
		if (vec.at(i)<=0)
		{
			cout << "No"<< endl;
			
		}
		else {
			cout << "Yes" << endl;
		}
	}
}

Measured memory_bytes: 3780
# -*- coding: utf-8 -*-
n = int(input())
s = input()

bcnt = [0 for _ in range(n+1)]
wcnt = [0 for _ in range(n+1)]
b = 0
w = 0
for i, (c, r) in enumerate(zip(s, s[::-1])):
    b += 1 if c == '#' else 0
    bcnt[i+1] = b

    w += 1 if r == '.' else 0
    wcnt[n-i-1] = w

change = [b + w for b, w in zip(bcnt, wcnt)]
print(min(change))


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


int main(void) {
    int R; cin >> R;
    double ans = 2*R*pi;
    printf("%.20f\n",ans);
}

Measured memory_bytes: 3712
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
int main(){
    string S;
    cin>>S;
    if(S[2] == S[3] && S[4] == S[5])
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
typedef	long long ll;
#define all(v) ((v).begin()),((v).end())
#define PI(n) ((double)acos(n))
int dx8[8] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy8[8] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file(){
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);
#else 
#endif
}
void fast(){
	std::ios_base::sync_with_stdio(0); cin.tie(NULL);
}
int main()
{

	fast();
	int x, t;
	cin >> x >> t;
	if (t <= x)
		cout << x - t << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    H = lmi()
    cnt = 0
    current_max = -1
    for height in H:
        if height >= current_max:
            cnt += 1
            current_max = height
    print(cnt)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <math.h>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

int main(){
	string s;
	while(getline(cin, s) && s != "0"){
		int num;
		int sum = 0;
		bool one = false;
		stringstream in(s);
		while(in >> num){
			if(num == 1) one = true;
			sum += min(num, 10);
		}
		if(sum <= 11 && one) sum += 10;
		if(sum > 21) sum = 0;
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
using namespace std;
 
#define fore(i, s, e) for(int i = s; i < e; i++)
#define pb push_back
#define fst first
#define snd second
 
typedef long long ll;
 
const int N = 2e4;
const int M = 1e9 + 7;
 
string s;
int n, d;
 
ll dp[20000][200][2];
 
 
ll calc(int i, int j, int k) {
    if(i == n && j == 0) return 1;
    if(i == n) return 0;
    ll &r = dp[i][j][k];
    if(r != -1) return r;
    ll times = 0;
    if(k) fore(dig, 0, s[i] - '0' + 1) {
        times += calc(i + 1, (j + dig) % d, (dig == (s[i] - '0')));
        times %= M;
    } else fore(dig, 0, 10) {
        times += calc(i + 1, (j + dig) % d, 0);
        times %= M;
    }
    return r = times % M;
}
 
int main() {
    s.resize(N);
    cin >> s;
    n = s.size();
    cin >> d;
    memset(dp, -1, sizeof dp);
    cout << (calc(0, 0, 1) - 1+M)%M << endl;
}

Measured memory_bytes: 63488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using pii = pair<int, int>;
int main() {
  string s;
  cin >> s;

  string tmp = s;

  vector<string> temp = {"dream", "dreamer", "eraser", "erase"};
  sort(temp.begin(), temp.end());
  do {
    s = tmp;
    for (int i = 0; i < temp.size(); i++) {
      auto pos = s.find(temp[i]);
      while (pos != string::npos) {
        s.erase(s.begin() + pos, s.begin() + pos + temp[i].size());
        pos = s.find(temp[i], pos);
      }
    }
    // cout << s << endl;
    if (s.empty()) {
      cout << "YES" << endl;
      return 0;
    }

  } while (next_permutation(temp.begin(), temp.end()));

  cout << "NO" << endl;
}

Measured memory_bytes: 640
// C - Bugged
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define all(x) (x).begin(),(x).end()
#define MAX 10000 // N*si = 100*100

int main(){
	int N; cin>>N;
	int maxi = 0;
	vi dp(MAX+1);
	for(int i=1; i<=N; ++i){
		int s; cin>>s;
		for(int j=MAX; j>=s; --j){
			dp[j] = max(dp[j], dp[j-s] + s);
			int c = dp[j];
			if(c%10 == 0) c = 0;
			maxi = max(maxi, c);
		}
	}
	cout<< maxi <<endl;
}

Measured memory_bytes: 256
import sys
from itertools import combinations
from math import sqrt

read = sys.stdin.read
readline = sys.stdin.readline


def main():
    N, K, *xyc = map(int, read().split())
    x = xyc[::3]
    y = xyc[1::3]
    xy = list(zip(x, y))
    c = xyc[2::3]
    left = 0
    right = 10 ** 6
    delta = 0.1 ** 7
    while right - left > delta:
        mid = (left + right) / 2
        intersections = []
        r = [(mid / i) ** 2 for i in c]
        for i, j in combinations(range(N), 2):
            x1, y1 = xy[i]
            x2, y2 = xy[j]
            X = x2 - x1
            Y = y2 - y1
            XY = X ** 2 + Y ** 2
            r1 = r[i]
            r2 = r[j]

            a = (XY + r1 - r2) / 2
            b = XY * r1 - a ** 2
            if b < delta:
                continue
            b = sqrt(b)
            xi1 = (a * X + Y * b) / XY + x1
            yi1 = (a * Y - X * b) / XY + y1
            xi2 = (a * X - Y * b) / XY + x1
            yi2 = (a * Y + X * b) / XY + y1
            intersections.append((xi1, yi1))
            intersections.append((xi2, yi2))

        intersections.extend(xy)
        cnt = 0
        for X, Y in intersections:
            tmp = 0
            for (i, j), k in zip(xy, r):
                XY = (X - i) ** 2 + (Y - j) ** 2
                if XY < k + delta:
                    tmp += 1
            cnt = max(tmp, cnt)
            if cnt >= K:
                break
        if cnt >= K:
            right = mid
        else:
            left = mid

    print(right)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define N 3002
char s[N], t[N];
int f[N][N], n, m;
void print(int x, int y) {
    if (!x || !y) return;
    if (s[x] == t[y]) {
        print(x - 1, y - 1);
        putchar(s[x]);
    } else {
        (f[x][y] == f[x][y - 1] ? y : x)--;
        print(x, y);
    }
}
int main() {
    scanf("%s%s", s + 1, t + 1);
    int n = strlen(s + 1), m = strlen(t + 1);
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++) {
            if (s[i] == t[j]) f[i][j] = f[i - 1][j - 1] + 1;
            f[i][j] = max(f[i][j], max(f[i - 1][j], f[i][j - 1]));
        }
    print(n, m);
    return 0;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);

int main(){
	int n;cin>>n;
	string s;cin>>s;
	rep(a,2)rep(b,2){
		string now;
		if(a==1)now.push_back('W');
		else now.push_back('S');
		if(b==1)now.push_back('W');
		else now.push_back('S');
		rep2(i,1,n){
			if(now[i]=='S'){
				if(s[i]=='o'){
					now.push_back(now[i-1]);
				}
				else now.push_back((now[i-1]=='W' ? 'S':'W'));
			}
			else{
				if(s[i]=='x'){
					now.push_back(now[i-1]);
				}
				else {
					now.push_back((now[i-1]=='W' ? 'S':'W'));
				}
			}
		}

		if(now[0]!=now[n])continue;
		if(now[0]=='S'){
			if(s[0]=='x'&&now[n-1]==now[1])continue;
			else if(s[0]=='o'&&now[n-1]!=now[1])continue;
		}
		if(now[0]=='W'){
			if(s[0]=='x'&&now[n-1]!=now[1])continue;
			else if(s[0]=='o'&&now[n-1]==now[1])continue;
		}
		now.erase(now.begin()+n);
		cout<<now<<endl;
		return 0;
	}
	cout<<-1<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  
  cout << '#';
  for(int i = 0; i < W; i++){
    cout << '#';
  }
  cout << '#' << endl;
  
  string pic;
  
  for(int i = 0; i < H; i++){
      cin >> pic;
      cout << '#' << pic << '#' << endl;
  }
 
  cout << '#';
  for(int i = 0; i < W; i++){
    cout << '#';
  }
  cout << '#' << endl;  
}

Measured memory_bytes: 3528
#include <iostream>
#include <cmath>
#include <vector>
#include <cstring>

constexpr int MAX = 1000;
char ls[MAX];
char rs[MAX];
int table[MAX + 1][MAX + 1];


void calc_lcs() {
    scanf("%s", ls);
    scanf("%s", rs);
    int l_len = int(std::strlen(ls));
    int r_len = int(std::strlen(rs));
    for (int i = 0; i < l_len; i++) {
        table[i][0] = 0;
    }
    for (int i = 0; i < r_len; i++) {
        table[0][i] = 0;
    }

    for (int l_i = 1; l_i < l_len + 1; l_i++) {
        for (int r_i = 1; r_i < r_len + 1; r_i++) {
            if (ls[l_i - 1] == rs[r_i - 1]) {
                table[l_i][r_i] = table[l_i - 1][r_i - 1] + 1;
            } else {
                table[l_i][r_i] = std::max(table[l_i][r_i - 1], table[l_i - 1][r_i]);
            }
        }
    }
    std::cout << table[l_len][r_len] << std::endl;
}

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        calc_lcs();
    }
}

Measured memory_bytes: 7064
#include <iostream>
#include <vector>
#include <string>
#include <set>

using namespace std;

int main()
{
  int n ,m ,x;
  cin >> n >> m >> x;
  int c[n], a[n][m];
  for(int i = 0;i <n;++i){
    cin >> c[i];
    for(int j = 0;j < m;++j) cin >> a[i][j];
  }
  
  int k, cost, min_cost = 1e8;
  for(int i = 0; i<4096;++i){
    k = i;
    cost = 0;
    std::vector<int> u(m, 0);
    for(int j = 0; j < n; ++j){
      if(k % 2 == 1){
        cost += c[j];
        for(int l = 0; l <m ;++l) u[l]+=a[j][l];
      }
      k /= 2;
    }
    bool t = true;
    for(int l = 0; l <m ;++l){
      if(u[l]<x) t= false;
    }
    if(t && min_cost > cost) min_cost = cost;
  }
  if(min_cost == 1e8) min_cost = -1;
  cout << min_cost << endl;
  
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int t, x;
  cin >> t >> x;
  double ans = (double)t/(double)x;
  printf("%.10f", ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int mod = 1000000007;
typedef long long ll;
typedef pair<ll, ll> ii;
ll gcd(ll a, ll b){
    return a==0?b:gcd(b%a,a);
}
ll p2[N];
ll ans = 1;
void f(ll &a, ll &b){
    ll g = gcd(abs(a),abs(b));
    if (g == 0) return;
    a /= g;
    b /= g;
    if (b < 0){
        a = -a;
        b = -b;
    }
    if (a < 0){
        a = -a;
        b = -b;
    }
}
ii D(ii a){
    return ii(a.second,-a.first);
}
map<ii, int> ct;
map<ii, int> vis;
int main(){
    int n;
    scanf("%d",&n);
    p2[0] = 1ll;
    for (int i = 1; i <= n; i++){
        p2[i] = (p2[i-1]*2)%mod;
    }
    for (int i = 0; i < n; i++){
        ll a,b;
        scanf("%lld%lld",&a,&b);
        f(a,b);
        ct[ii(a,b)]++;
    }
    for (auto it : ct){
        ii k = it.first;
        if (vis[it.first]) continue;
        if (k.first == 0 && k.second == 0){
            continue;
        }
        //printf("have vector %lld %lld\n",k.first,k.second);
        k = D(k);
        //printf("dot %lld %lld\n",k.first,k.second);
        f(k.first,k.second);
        //printf("correct %lld %lld\n",k.first,k.second);
        int s1 = it.second, s2 = ct[k];
        //printf("ct = %d, %d\n",s1,s2);
        ans *= (p2[s1]+p2[s2]-1);
        ans %= mod;
        vis[it.first] = vis[k] = 1;
    }
    ans += ct[ii(0,0)];
    ans = (ans+mod-1)%mod;
    printf("%lld",ans);
}


Measured memory_bytes: 55280
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, N)
  {
    cin >> a[i];
  }
  int ans = 0;
  rep(i, N)
  {
    if ((i + 1) % 2 == 1 && a[i] % 2 == 1)
    {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
S = input()
S2 = []
S3 = []
S4 = []
range1 = int((int(len(S))+1)/2)
range2 = int((int(len(S))-1)/2)
range3 = int((range2+1)/2)
range4 = int((int(len(S))+3)/2)
range5 = int((range4+1)/2)
isStrong = "Yes"
for i in S:
  S2.append(i)
  
for i in range(range2):
  S3.append(S2[i])
  
for i in range(range4-1,len(S)):
  S4.append(S2[i])
  
for i in range(range1):
  if S2[i]!=S2[-i-1]:
    isStrong = "No"

for i in range(range3):
  if S3[i]!=S3[-i-1]:
    isStrong = "No"

for i in range(range5-1):
  if S4[i]!=S4[-i-1]:
    isStrong = "No"
    
print(isStrong)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
    string a;
    getline(cin,a);
    char f = 'a';
    int fl = 0;
    while (fl != -1) {
        fl = a.find(f);
        f++;
    }
    f--;
    if (f > 'z')cout<<"None"<<endl;
    else cout<<f<<endl;
    return 0;
}


Measured memory_bytes: 512
N = int(input())
l = map(int, input().split())

dic = {}
for num in l:
    dic.setdefault(num, 0)
    dic[num] += 1
max_num = 0
for k, v in dic.items():
    prev = dic[k - 1] if k - 1 in dic else 0
    next = dic[k + 1] if k + 1 in dic else 0

    if (prev + v + next) > max_num:
        max_num = prev + v + next
print(max_num)


Measured memory_bytes: 16240