akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
   
#define debug cout<<"???"<<endl
#define sync std::ios::sync_with_stdio(false)
#define ll long long
#define pb push_back
#define mp make_pair
#define maxn 100005
#define INF 0x3f3f3f3f
#define frein freopen("input.txt", "r", stdin)
#define freout freopen("output.txt", "w", stdout)
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%I64d", &x)
#define pr(x) printf("%lld", (x))
int main()
{
     //sync 
	 //frein
     //freout
     string s;
     int okc = 0, ok = 1;
     cin >> s;
     if (s[0] != 'A' || s[1] == 'C' || s[s.length() - 1] == 'C') {
     	printf("WA\n");
     	return 0;
	 }
	 if (s[1] < 'a' || s[1] > 'z') {
		printf("WA\n");
     	return 0;
	 }
	 if (s[s.length() - 1] < 'a' || s[s.length() - 1] > 'z') {
		printf("WA\n");
     	return 0;
	 }
	 for (int i = 2; i < s.length() - 1; i++) {
	 	if (s[i] == 'C') {
	 		okc++;
		 }
		 else if (s[i] < 'a' || s[i] > 'z') {
		 	ok = 0;
		 	break;
		 }
	 }
	 if (okc != 1 || ok == 0) printf("WA\n");
	 else printf("AC\n");
     return 0;
}

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

/*
vector.push_back()
vector<int> hoge(3,-1); {-1,-1,-1}
vector<vector<int>> hogehoge(2,vector<int>(2,-1)); {{-1,-1},{-1,-1}} 
*/

int checkpoint_num=0;
void pcheck(){
    cout << "----------------" << endl << checkpoint_num << endl << "----------------" << endl;
    checkpoint_num +=1;
}

template <typename T> void debug(T arr){
    for (auto col:arr){
        cout << col << " ";
    }
    cout <<endl;
}

template <typename T> void debug (T arr, int dim){
    for (auto raw:arr){
        for(auto col:raw){
            cout << col << " ";
        }
        cout << endl;
    }
}



int main(void){
    int A,B,Q;
    vector<long long> ans;
    scanf("%d %d %d",&A,&B,&Q);
    //cout << A << B << Q << endl;
    vector<long long> a;
    vector<long long> b;
    for (int i =0; i < A; ++i){
        long long temp;
        //scanf("%ll",&temp);
        cin >>temp;
        a.push_back(temp);
    }

    for (int i = 0; i < B; ++ i){
        long long temp;
        //scanf("%ll",&temp);
        cin >>temp;
        b.push_back(temp);
    }

    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    a.push_back(4000000000000);
    b.push_back(4000000000000);
    a.insert(a.begin(),-1000000000000);
    b.insert(b.begin(),-1000000000000);

    for (int i = 0; i < Q; ++i){
        long long x;
        cin >> x;

        auto a_l_it = upper_bound(a.begin(),a.end(),x);
        auto t1 = *a_l_it;
        auto a_s_it = --a_l_it;

        auto b_l_it = upper_bound(b.begin(),b.end(),x);
        auto t2 = *b_l_it;
        auto b_s_it = --b_l_it;


        vector<long long> ac = {*a_s_it,t1};
        vector<long long> bc = {*b_s_it,t2};

        vector<long long> ls = {0,0,0,0};

        ls[0] = ac[1]-bc[0]+min(ac[1]-x,x-bc[0]);
        ls[1] = bc[1]-ac[0]+min(bc[1]-x,x-ac[0]);
        ls[2] = x-min(ac[0],bc[0]);
        ls[3] = max(ac[1],bc[1])-x;
        sort(ls.begin(),ls.end());
        // debug(a);
        // debug(b);
        // cout << ac[0] << " " << ac[1] << endl;
        // cout << bc[0] << " " << bc[1] << endl;
        ans.push_back(ls[0]);
    }
    for (auto raw:ans){
        cout << raw << endl;
    }

    

};


Measured memory_bytes: 3828
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a % 2 != 0 && b % 2 != 0)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
//幸福度がk以上な握手の数
ll cont(ll k, vector<ll> &a) {
    ll c = 0;
    for(int i = 0; i < a.size(); i++) {
        c += a.end() - lower_bound(all(a), k - a[i]);
    }
    return c;
}
int main() {
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    vector<ll> rui(n + 1, 0);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(all(a));
    for(int i = 0; i < n; i++) {
        rui[i + 1] = rui[i] + a[i];
    }
    ll l = -1, r = 2 * 100000 + 100;
    while(l + 1 < r) {
        ll mid = (l + r) / 2;
        if(cont(mid, a) > m) {
            l = mid;
        } else {
            r = mid;
        }
    }
    ll ans = (r - 1) * (m - cont(r, a));
    for(int i = 0; i < n; i++) {
        ll b = lower_bound(all(a), r - a[i]) - a.begin();
        ans += rui[n] - rui[b] + (n - b) * a[i];
        // cout << a[i] << ":" << b << ":" << ans << endl;
        // cout << rui[n] - rui[b] << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
//Remove below header file if c++ version greater than 14
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>

#define ll long long int
#define pb push_back
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define deb(x) cout << #x << " "<< x << endl;
#define fo(i, n) for(i=0; i<n; i++)
#define Fo(i, k, n) for(i=k; i<n; i++)

using namespace std;
using mii=map<int, int>;
using mll=map<ll, ll>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int mod = 1000000007;

ll desc(ll x, ll y)
{
    return x > y;
}
int gcd(long  a, long b)
{
    if(a == 0)
    return b;
    else
        return gcd(b % a, a);

}

ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}
int main() {
    fastIO
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll dif = b - a + 1;
    a--;
    ll div1 = b / c - a / c;
    ll div2 = b / d - a / d;
    ll l = lcm(c, d);
    ll in = b / l - a / l;

    cout << dif - (div1 + div2 - in) << endl;
    return 0;
}

Measured memory_bytes: 256
s = list(input())
li = []
n = len(s)
ans = 0
b = False
for i in range(n-1):
    if b:
        b = False
        continue
    if s[i] + s[i+1] == 'BC':
        li.append('D')
        b = True
    if s[i] == 'B' and s[i+1] != 'C':
        li.append('E')
    if s[i] == 'C':
        li.append('E')
    if s[i] == 'A':
        li.append('A')
cnt = 0
for i in range(len(li)):
    if li[i] == 'A':
        cnt += 1
    elif li[i] == 'E':
        cnt = 0
    else:
        ans += cnt
print(ans)

Measured memory_bytes: 12028
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    long long A, B;
    cin >> A >> B;
    vector<long long> usea(40, 0), useb(40, 0);
    long long t = 1;
    long long ans = 0;
    long long cnt = 0;
    while(B >= t){
        long long syo = B / (t * 2);
        long long m = B % (t * 2);
        if(m >= t - 1) m -= t - 1;
        else m = 0;
        useb[cnt] += syo * t + m;
        t *= 2;
        cnt++;
    }
    t = 1;
    cnt = 0;
    A--;
    while(A >= t){
        long long syo = A / (t * 2);
        long long m = A % (t * 2);
        if(m >= t - 1) m -= t - 1;
        else m = 0;
        usea[cnt] += syo * t + m;
        t *= 2;
        cnt++;
    }
    for(int i = 0; i < 40; i++){
        if((useb[i] - usea[i]) % 2 == 1) ans += (1LL << i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
use proconio::{input, fastout};
use proconio::marker::Usize1;

pub struct UnionFind {
    p: Vec<usize>,
    rank: Vec<usize>,
}
impl UnionFind {
    pub fn new(n: usize) -> Self {
        UnionFind {
            p: (0..n).collect(),
            rank: vec![1; n],
        }
    }
    pub fn find(&mut self, x: usize) -> usize {
        let p = self.p[x];
        if x != p {
            self.p[x] = self.find(p);
        }
        self.p[x]
    }
    pub fn unite(&mut self, x: usize, y: usize) -> bool {
        let mut x = self.find(x);
        let mut y = self.find(y);
        if x == y {
            return false;
        }
        if self.rank[x] < self.rank[y] {
            std::mem::swap(&mut x, &mut y);
        }
        self.rank[x] += self.rank[y];
        self.p[y] = x;
        true
    }
    pub fn same(&mut self, x: usize, y: usize) -> bool {
        self.find(x) == self.find(y)
    }
    pub fn size(&mut self, x: usize) -> usize {
        let p = self.find(x);
        self.rank[p]
    }
}

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        v: [(Usize1,Usize1);m]
    }
    let mut u = UnionFind::new(n);
    for (a,b) in v {
        u.unite(a,b);
    }
    let res = (0..n).map(|x| u.size(x)).max().unwrap();
    println!("{}", res);
}


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




int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int N , X , T;
	cin >> N >> X >> T;
	cout<<(int)ceil((double)N / X) * T<<endl;
}

Measured memory_bytes: 3756
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#define PI 3.14159265358979323846

int main(void) {
	
	int N;
	scanf("%d", &N);
	int a = N;
	int sum = 0;

	while (N > 0) {
		sum += N % 10;
		N /= 10;
	}

	if (a % sum==0) {
		printf("Yes");
	}
	else {
		printf("No");
	}



	return 0;
}

Measured memory_bytes: 128
def main():
    N = int(input())

    def Eratosthenes(x: int):
        import math
        sup = int(x)
        primes = {i for i in range(2, sup+1)}
        for i in range(2, int(math.sqrt(sup+1))+1):
            if i in primes:
                mul = 2
                while i*mul <= sup:
                    primes.discard(i*mul)
                    mul += 1
        return [p for p in primes if p % 5 == 1]

    primes = Eratosthenes(55555)
    # print(len(primes))
    from itertools import combinations
    for ps in combinations(primes, N):
        # print(ps)
        return print(*ps)


if __name__ == '__main__':
    main()


Measured memory_bytes: 41580
using System;
using System.Collections.Generic;
using System.Linq;

namespace cs
{
    public class Program
    {
        public static void Main(string[] args)
        {
        
        	long min = 0;
        	long sum = 0;
        	long input = 0;
        	long t = 0;
        	long n = long.Parse(Console.ReadLine());
        	
        	min = long.Parse(Console.ReadLine());
        	
        	for(int i = 1; i < 5; i++){
				input = long.Parse(Console.ReadLine());
        		min = min == 0 ? input : Math.Min(min, input);
        	
        	}
        	sum = 4;
        	t = n / min;
        	sum += (n%min == 0) ? t : t+1;
        	Console.WriteLine(sum);
        
        
        
        }
            
    }
}



Measured memory_bytes: 11220
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

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

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

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
typedef pair<ll,ll> P;
struct edge{ll to, cost;};
vector<edge> G[100010];
ll d_dijkstra[100010];

void dijkstra(ll s){
    priority_queue<P, vector<P>, greater<P>>que;
    Fill(d_dijkstra,INF);
    d_dijkstra[s]=0LL;
    que.push(P(0,s));

    while(!que.empty()){
        P p=que.top(); que.pop();
        ll v = p.second;
        if(d_dijkstra[v]<p.first) continue;
        for(int i=0; i<G[v].size(); i++){
            edge e=G[v][i];
            if(d_dijkstra[e.to] > d_dijkstra[v]+e.cost){
                d_dijkstra[e.to]=d_dijkstra[v]+e.cost;
                que.push(P(d_dijkstra[e.to], e.to));
            }
        }
    }
}

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

    rep(i,N-1){
        int u,v,w; cin >> u >> v >> w;
        u--, v--;
        G[u].push_back(edge{v,w});
        G[v].push_back(edge{u,w});
    }
    dijkstra(0LL);

    rep(i,N){
        if(d_dijkstra[i]%2==0){
            cout << 0 << endl;
        }else{
            cout << 1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 8704
n,m = map(int,input().split())
keta = []
number = []

for i in range(m):
    b,a=input().split()
    keta.append(int(b))
    number.append(a)

ccount = 0
count = 0   
ans = 0
if n == 3:
   ans = 100
else:
   pass
if n == 2:
   ans = 10
else:
   pass
if n == 1:
   ans = 0
else:
   pass

while count == 0:
   ans = str(ans)
   for i in range(0,m):
      if ans[keta[i]-1] == number[i]:
         ccount += 1
   if ccount == m:
      count += 1
   ccount = 0
   ans = int(ans)
   ans += 1
   if n == 3 and (ans - 1) == 1000:
      ans = 0
      break
   if n == 2 and (ans - 1) == 100:
      ans = 0
      break
   if n == 1 and (ans - 1) == 10:
      ans = 0
      break
print(ans - 1)

Measured memory_bytes: 3064
#include <stdio.h>

int past[1024];
int p = 0;


int check_past(int x)
{
    int i;

    for(i = 0; i < p; i++){
        if(past[i] == x)
            return 1;
    }

    return 0;
}


int main(void)
{
    int q, n, i, j;

    scanf("%d", &q);

    for(i = 0; i < q; i++){
        int base, count;

        p = count = 0;

        scanf("%d", &n);

        while(1){
            int max = 0;

            if(n / 10 == 0)
                break;

            count++;

            for(base = 10; base < 1000000; base = base * 10){
                int quo, rem;
                quo = n / base;
                rem = n % base;

                if(quo * rem > max)
                    max = quo * rem;

            }

            if(check_past(max)){
                count = -1;
                break;
            }

            past[p++] = max;
            n = max;
        }

        printf("%d\n", count);
    }

    return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
int main(void){
  int line,num,i;
  int max_diff=-1000000000,min;
  scanf("%d",&line);
  scanf("%d",&min);
  while(scanf("%d",&num)!=EOF){
    if(max_diff<num-min) max_diff=num-min;
    if(min>num) min=num;
  }
  printf("%d\n",max_diff);
  return 0;
}

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

/*-------------------------------Template---------------------------------------*/

#define shameem              ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll                   long long int
#define gcd(a,b)              __gcd(a,b)
#define lcm(a,b)             (a*b)/gcd(a,b)
#define pi                    2*acos(0.0)
#define testi                int t; cin>>t; while(t--)
#define testl                ll t; cin>>t; while(t--)
#define vi                   vector<int>
#define vl                   vector<ll>
#define pb                   push_back
#define mk                   make_pair

/*-------------------------------Print---------------------------------------*/

#define YES                  cout<<"YES"<<endl
#define NO                   cout<<"NO"<<endl
#define yes                  cout<<"yes"<<endl
#define no                   cout<<"no"<<endl

using namespace std;

void solve()
{
    int n;
    cin>>n;
    int a[n],b[n];
    for(int i=0; i<n; i++)
    {
        int x,y;
        cin>>x>>y;
        a[i]=x;
        b[i]=y;
    }
    int cnt=0;

    for(int i=0; i<n-2; i++)
    {
        if(a[i]==b[i] && a[i+1]==b[i+1] && a[i+2]==b[i+2])
        {
            cnt++;
            break;
        }

    }
    if(!cnt) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

}
int main()
{
    shameem

    //testi

    //testl



    solve();

    return 0;
}



Measured memory_bytes: 3640
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstring>
const int N=250001;
int n, dis[N], q[N];
bool vis[N];
bool cmin(int &a, int b) {
	return b<a?(a=b, true):false;
}
int main() {
	scanf("%d", &n);
	for(int i=1; i<=n; ++i) {
		for(int j=1; j<=n; ++j) {
			dis[i*n+j-n]=std::min(std::min(i, n-i+1), std::min(j, n-j+1));
			vis[i*n+j-n]=true;
		}
	}
	int ans=0;
	for(int i=1; i<=n*n; ++i) {
		int p, *qhead=q, *qtail=q;
		scanf("%d", &p);
		*qtail++=p;
		ans+=--dis[p];
		vis[p]=false;
		while(qhead<qtail) {
			int u=*qhead++;
			if(u>n && cmin(dis[u-n], dis[u]+vis[u-n])) *qtail++ = u-n;
			if(u<=n*n-n && cmin(dis[u+n], dis[u]+vis[u+n])) *qtail++ = u+n;
			if(u%n!=1 && cmin(dis[u-1], dis[u]+vis[u-1])) *qtail++ = u-1;
			if(u%n!=0 && cmin(dis[u+1], dis[u]+vis[u+1])) *qtail++ = u+1;
		}
	}
	printf("%d\n", ans);
	return 0;
}


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

#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()

const int NAX = 2e5 + 5, MOD = 1000000007;

class Solution
{
private:
public:
    Solution() {}
    ~Solution() {}
    void solveCase()
    {
        ll n;
        cin >> n;
        cout << n * (n + 1) / 2 - 3 * (n / 3) * (n / 3 + 1) / 2 - 5 * (n / 5) * (n / 5 + 1) / 2 + 15 * (n / 15) * (n / 15 + 1) / 2;
    }
};

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
    // cin >> t;
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef LOCAL
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


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

int main()
{
    int N, cnt = 0;
    cin >> N;
    int n = to_string(N).size();
    string str = to_string(N);

    for (int i = 0; i < n; i++)
    {
        if (str[i] == '2')
            cnt++;
    }
    cout << cnt << endl;
}

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

const double eps = 1e-10;

int main(void){
	int n;
	scanf("%d", &n);
	
	for(int i = 0; i < n; i++){
		double ax, ay, ar, bx, by, br;
		scanf("%lf %lf %lf %lf %lf %lf", &ax, &ay, &ar, &bx, &by, &br);
		double x = pow(ax-bx,2);
		double y = pow(ay-by,2);
		double d = sqrt(x+y);
		
		if(d>ar+br){
			puts("0");
		}else if(ar+d < br){
			puts("-2");
		}else if(br+d < ar){
			puts("2");
		}else{
			puts("1");
		}
	}
	
	return 0;
}

Measured memory_bytes: 1048
#include<stdio.h>
int main()
{
  int N,A,B,train=0;
  scanf("%d %d %d",&N,&A,&B);
  train=N*A;
  if(train<=B)
  {
    printf("%d",train);
  }
  else
  {
    printf("%d",B);
  }
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int input1; 
int input2;

int main() {
    cin >> input1 >> input2;
    int plus =  input1 + input2;
    int minus = input1 - input2;
    int times = input1 * input2;

    if (plus>=minus && plus>=times){
        cout << plus;
    }

    else if (minus>=plus && minus>=times){
        cout << minus;
    }

    else{
        cout << times;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
    double a, b, x;
    cin >> a >> b >> x;

    double half = a * a * b / 2;
    double pi = acos(-1);

    if (x < half) {
        double tant = a * b * b / 2 / x;
        double t = atan(tant);
        printf("%.10f\n", 180 * t / pi);
    } else {
        double tant = 2 * (a * a * b - x) / a / a / a;
        double t = atan(tant);
        printf("%.10f\n", 180 * t / pi);
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int n = 0, i, x;
    scanf("%d",&n);
    for (i=1 ;i<n+1 ;i++){
        x=i;
        if ((x%3)==0){
            printf(" %d",i);
        } else while(1){
            if ((x%10)==3){
                printf(" %d",i);
                break;
            }
            x/=10;
            if (!x) break;
        }
    }

    printf("\n");
    return 0;
}


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

using namespace std;

int mod(int a,int b){
	
	if(a>b){
		return a-b;
	}
	return b-a;
	
}

int main(){
	
	int n,k;
	cin>>n>>k;
	int a[n];
	for (int i=0;i<n;i++){
		cin>>a[i];
	}
	int dp[n];
	for (int i=0;i<n;i++){
		dp[i]=INT_MAX;
	}
	dp[0]=0;
	dp[1]=mod(a[1],a[0]);
	for (int i=2;i<n;i++){
		for (int j=1;j<=min(k,i);j++){
			if (dp[i]>dp[i-j]+mod(a[i],a[i-j])){
				dp[i]=dp[i-j]+mod(a[i],a[i-j]);
			}
		}
		//cout<<dp[i]<<" ";
	}
	cout<<dp[n-1];
	
}

Measured memory_bytes: 4364
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define SREP(s,i,m) for(unsigned int i = s; i < m; ++i)
#define REP(i,m) SREP(0,i,m)

using namespace std;
#ifdef _MSC_VER
using LONG = __int64;
using ULONG = unsigned __int64;
#else
using LONG = long long int;
using ULONG = unsigned long long int;
#endif


int main(void) {
	int N, M;
	cin >> N >> M;
	vector<int> c(N);
	REP(i, M) {
		int a, b;
		cin >> a >> b;
		c[a]++;
		c[b]++;
	}
	bool canCreate = true;
	REP(i, N) {
		canCreate = c[i] % 2 == 0;
		if (!canCreate) break;
	}
	cout << (canCreate ? "YES" : "NO") << endl;
	return 0;
}

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


if __name__ == '__main__':

    n = int(input())
    A = [int(a) for a in input().split(" ")]
    q = int(input())
    M = [int(m) for m in input().split(" ")]

    def solve(i, m):
        if m == 0:
            return True
        if i >= n or m > sum(A):
            return False
        res = solve(i+1, m) or solve(i+1, m-A[i])
        return res

    ans = []
    for m in M:
        if solve(0, m):
            ans.append("yes")
        else:
            ans.append("no")

    print("\n".join(ans))



Measured memory_bytes: 5612
n = int(input())
a = list(map(int, input().split()))

ans = [0] * 8
over_3200 = 0

for i in range(n):
    if a[i] < 400:
        ans[0] = 1
    elif a[i] < 800:
        ans[1] = 1
    elif a[i] < 1200:
        ans[2] = 1
    elif a[i] < 1600:
        ans[3] = 1
    elif a[i] < 2000:
        ans[4] = 1
    elif a[i] < 2400:
        ans[5] = 1
    elif a[i] < 2800:
        ans[6] = 1
    elif a[i] < 3200:
        ans[7] = 1
    else:
        over_3200 += 1

print(max(sum(ans), 1), end=' ')
print(sum(ans) + over_3200)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define MAX (ll)(1e5 + 4)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(1e18 + 3)
#define PI (double)(3.14159265)

using namespace std;
using ll = long long;
using ld = long double;

int main () {
	ll n, k;
	cin >> n >> k;
	ll ar[n];
	for (ll i = 0; i < n; i++) {
		cin >> ar[i];
		ar[i]--;
		ar[i] %= k;
	}
	for (ll i = 1; i < n; i++) {
		ar[i] += ar[i - 1];
		ar[i] %= k;
		ar[i] += k;
		ar[i] %= k;
	}
	map<ll, ll> ma;
	ll ans = 0;
	ma[0]++;
	for (ll i = 0; i < n; i++) {
		if (i == k - 1) {
			ma[0]--;
		}
		if (i >= k) {
			ma[ar[i - k]]--;
		}
		ans += ma[ar[i]];
		ma[ar[i]]++;
	}
	cout << ans << "\n";
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int main2() {
  int N, M; cin >> N >> M;
  vector<int> mask(N, 0);
  REP(i, M) {
    int K; cin >> K;
    REP(k, K) {
      int b; cin >> b;
      b--;
      mask[b] |= (1 << i);
    }
  }


  int P = 0;
  REP(i, M) {
    int b; cin >> b;
    if (b) P |= (1 << i);
  }

  int ans = 0;
  for (int set = 0; set < (1 << N); set++) {
    int res = 0;
    REP(i, N) if (set >> i & 1) {
      res ^= mask[i];
    }
    if (res == P) ans++;
  }
  cout << ans << endl;

  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 256
def sol():
    n,a=map(int,input().split())
    x=[int(i) for i in input().split()]
    ans=chk=0
    d=[[0]*2501 for j in range(51)]
    d[0][0]=1
    for i in x:
        for k in range(50,0,-1):
            for j in range(2500,i-1,-1):
                d[k][j]+=d[k-1][j-i]
    for i in range(1,51):
        ans+=d[i][i*a]
    print(ans)
 
if __name__=="__main__":
    sol()

Measured memory_bytes: 40176
N = int(input())

if N < 10 :
    print(N)
elif N < 100 :
    print(9)
elif N < 1000 :
    print(9+N-99)
elif N < 10000 :
    print(909)
elif N < 100000 :
    print(909+N-9999)
else :
    print(90909)


Measured memory_bytes: 2940
import java.util.*;

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

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        h = sc.nextDouble();
        w = sc.nextDouble();
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        double odd = Math.round(w / 2);
        double even = (long)w / 2;
        double odd_row = Math.round(h / 2);
        double even_row = (long)h / 2;
        double ans = odd * odd_row + even * even_row;
        if (w == 1 || h == 1) {
            ans = 1;
        }
        System.out.println((long)ans);
    }
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max()/2;
const int MOD = 1e9+7;

typedef vector<vector<int>> Graph;

vector<int> dijkstra(const Graph &g, int st){
    vector<int> d(g.size(),INF);
    d[st] = 0;
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0,st)); // P(dis, pos)
    while(!que.empty()){
        int dist = que.top().first;
        int v = que.top().second;
        que.pop();
        if(d[v]<dist) continue;
        for(const auto &to: g[v]){
            if(d[to]<=d[v]+1) continue;
            d[to] = d[v] + 1;
            que.push(P(d[to], to));
        }
    }
    return d;
}

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

    int n,m,st,gt;cin>>n>>m>>st>>gt;
    st--;gt--;
    Graph g(n);
    for(int i=0;i<m;i++){
        int x,y; cin>>x>>y; x--;y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    vector<int> ds=dijkstra(g,st),dt=dijkstra(g,gt);
    int dis=ds[gt];
    if(dis==1){
        cout<<0<<endl;
    }
    else{
        map<int,int> mp;
        for(int i=0;i<n;i++){
            int d=dt[i];
            mp[d]++;
        }
        ll res=0;
        for(int i=0;i<n;i++){
            int d=dis-2-ds[i];
            res+=mp[d];
        }
        cout<<res<<endl;
    }
}


Measured memory_bytes: 10832
#include<bits/stdc++.h>
#define maxn 100005
typedef long long ll;
const ll mod = 1e9+7;
using namespace std;
ll a[maxn];
ll qpow(ll k,ll n)
{
    ll res=1;
    while(n)
    {
        if(n&1) res=res*k%mod;
        k=k*k%mod;
        n>>=1;
    }
    return res;
}
ll inv(ll n)
{
    return qpow(n,mod-2);
}
ll sum[maxn];
int main()
{
    int n;
    ll fac=1;
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
    {
        scanf("%lld",&a[i]);
    }
    for(int i=1;i<=n;++i)
    {
        fac=(fac*(ll)i)%mod;
    }
    for(ll i=1;i<=n;++i)
    {
        sum[i]=(sum[i-1]+inv(i))%mod;
    }
    ll ans=0;
    for(ll i=1;i<=n;++i)
    {
        ll temp=(sum[i]+(sum[n-i+1]-sum[1]))%mod;
        ans=(ans+(temp*a[i])%mod)%mod;
    }
    ans=ans*fac%mod;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
long long a[300005],ans=0,one,zero;
int def=1e9+7;
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}	
	for(int i=0;i<60;i++)
	{
		long long bit=1LL<<i;   //1向左移动i位，变化为：1,10,100,1000,为判断第i位有几个1，几个0 
		one=0,zero=0;
		for(int j=1;j<=n;j++)
		{
			if(a[j]&bit) one++;
			else zero++;
		}
		ans+=(bit%def)*((one*zero)%def)%def;
	}		
	printf("%lld",ans%def);
	return 0;
}

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

using namespace std;

#define N (2 << 18)

int n;

pair<int, int> f[N];

pair<int, int> merge(pair<int, int> a, pair<int, int> b)
{
	if(b.first > a.first) swap(a, b);
	pair<int, int> ans = a;
	if(b.first > ans.second) ans.second = b.first;
	return ans;
}

int main()
{
	scanf("%d", &n);
	int all = (1 << n);
	for(int i = 0; i < all; i++) 
	{
		int x;
		scanf("%d", &x);
		f[i] = make_pair(x, 0);
	}
	for(int j = 0; j < n; j++)
		for(int i = 0; i < all; i++)
			if(i >> j & 1) f[i] = merge(f[i], f[i ^ (1 << j)]);
	int ans = 0;
	for(int i = 1; i < all; i++)
	{
		ans = max(ans, f[i].first + f[i].second);
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 5828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
ll po(ll x,ll k){
    if(x>=k)return 0;
    return 1+po(2*x,k);
}
int main(void){
    ll n,k;
    cin>>n>>k;
    double tmp=1./n;
    //cout<<tmp<<endl;
    double ans=0.;
    rep(1,i,n+1){
        ll x=po(i,k);
        //cout<<x<<endl;
        double p=1;
        rep(0,i,x)p*=1./2.;
        //cout<<p<<endl;
        ans+=tmp*p;
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n,k,q=map(int,input().split())
point=[0]*n
for a in range(q):
    a=int(input())
    point[a-1]+=1
#print(point)
for i in point:
    if i>q-k:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 47832
#include <bits/stdc++.h>
using namespace std;
int H, W, N;
int sr, sc;
string p1, p2;

int p1u[202020], p1d[202020], p1l[202020], p1r[202020];
int p2u[202020], p2d[202020], p2l[202020], p2r[202020];

int main(){
	//freopen("test.in", "r+", stdin);
	
	cin >> H >> W >> N;
	cin >> sr >> sc;
	cin >> p1;
	cin >> p2;

	for(int i = 0; i < N; i++){
		if(i > 0){
			p1u[i] += p1u[i - 1];
			p1d[i] += p1d[i - 1];
			p1l[i] += p1l[i - 1];
			p1r[i] += p1r[i - 1];

			p2u[i] += p2u[i - 1];
			p2d[i] += p2d[i - 1];
			p2l[i] += p2l[i - 1];
			p2r[i] += p2r[i - 1];
		}

		if(p1[i] == 'U')p1u[i]++;
		if(p1[i] == 'D')p1d[i]++;
		if(p1[i] == 'L')p1l[i]++;
		if(p1[i] == 'R')p1r[i]++;

		if(sr - p1u[i] + p2d[i] < 1)return cout << "NO" << endl, 0;
		if(sr + p1d[i] - p2u[i] > H)return cout << "NO" << endl, 0;
		if(sc - p1l[i] + p2r[i] < 1)return cout << "NO" << endl, 0;
		if(sc + p1r[i] - p2l[i] > W)return cout << "NO" << endl, 0;
		
		p1u[i] = min(p1u[i], sr + p2d[i] - 1);
		p1d[i] = min(p1d[i], H - sr + p2u[i]);
		p1l[i] = min(p1l[i], sc + p2r[i] - 1);
		p1r[i] = min(p1r[i], W - sc + p2l[i]);
		
		if(p2[i] == 'U')p2u[i]++;
		if(p2[i] == 'D')p2d[i]++;
		if(p2[i] == 'L')p2l[i]++;
		if(p2[i] == 'R')p2r[i]++;

		p2u[i] = min(p2u[i], sr + p1d[i] - 1);
		p2d[i] = min(p2d[i], H - sr + p1u[i]);
		p2l[i] = min(p2l[i], sc + p1r[i] - 1);
		p2r[i] = min(p2r[i], W - sc + p1l[i]);
	
	}
	/*
	for(int i = 0; i < N; i++)cout << p1u[i] << " ";cout << '\n';
	for(int i = 0; i < N; i++)cout << p1d[i] << " ";cout << '\n';
	for(int i = 0; i < N; i++)cout << p1l[i] << " ";cout << '\n';
	for(int i = 0; i < N; i++)cout << p1r[i] << " ";cout << '\n';
	cout << '\n';
	for(int i = 0; i < N; i++)cout << p2u[i] << " ";cout << '\n';
	for(int i = 0; i < N; i++)cout << p2d[i] << " ";cout << '\n';
	for(int i = 0; i < N; i++)cout << p2l[i] << " ";cout << '\n';
	for(int i = 0; i < N; i++)cout << p2r[i] << " ";cout << '\n';
	*/
	cout << "YES" << endl;
	
}

Measured memory_bytes: 7048
#include <bits/stdc++.h>
using namespace std;
const long long MD=1e9+7;
int n;
long long a[200001],p2[200001];
long long ans,pre[200001];
int main() {
    cin>>n;
    for (int i=1; i<=n; i++) cin>>a[i];
    sort(a+1,a+n+1);
    p2[0]=1;
    for (int i=1; i<=n; i++) {p2[i]=p2[i-1]*2; p2[i]%=MD;}
    for (int i=1; i<=n; i++) {
        if (i==n) ans+=(p2[n-1]*a[i])%MD;
        else ans+=(((((p2[i-1]*(n-i+2))%MD)*(p2[n-i-1]))%MD)*a[i])%MD;
        ans%=MD;
    }
    cout<<(p2[n]*ans)%MD<<'\n';
}


Measured memory_bytes: 6696
#include <bits/stdc++.h>
using namespace std;
string n;
int a,i;
int main()
{
    cin>>n;
    a=n.length();
   for(i=0;i<a;i++)
   {
       if(n[i]==',')cout<<" ";
       else cout<<n[i];
   }
   cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main(){
  int A, B, C, D, turn = 1, ans = 0 ;
  cin >> A >> B >> C >> D ;
  while(A * C > 0){
    if(turn == 1){
      C -= B ;
      turn = 2 ;
    }
    else{
      A -= D ;
      turn = 1 ;
    }
  }
  if(turn == 2){
    cout << "Yes" << endl ;
  }  
  else{
    cout << "No" << endl ;
  }  
  return 0 ;
}  

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define FT() int t; scanf("%d",&t); while(t--)
#define pb push_back
#define nl printf("\n")
#define fi(i,start,end) for(int i=start; i < (int)end ; ++i)
#define ip(n)   scanf("%d",&n)
#define mz(a)   memset(a,0,sizeof(a))
#define inpArr(A,n) fi(i,0,n)   ip(A[i]);
#define print(a)  for(auto i : a)   cout<<i<<" "; nl;
#define Fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
ll max(ll a,ll b)   {return a>b?a:b;}
ll min(ll a,ll b)   {return a<b?a:b;}

int main() {
    #ifndef ONLINE_JUDGE
    freopen("D:/Sublime/Rough/input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    //std::cout << std::fixed;
    //std::cout << std::setprecision(6);
    Fastio;
    int testcase = 1;
//    cin>>testcase;
    while(testcase--)
    {
        ll d,t,s;
        cin>>d>>t>>s;
        ll c = t*s;
        if(c >= d)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
    #endif
    
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long mod = 1e9+7;
const int maxn=2e5+7;

int dfs(int &n,int curn,vector<int> &dp){
    if(n==curn){
        return 0;
    }
    
    if(curn>n) return 1e6+1;
    if(dp[curn] != -1) return dp[curn];
    int ways = 1+dfs(n,curn+1,dp);
    for(int i=1;i<=6;i++){
        ways = min(ways,1+dfs(n,curn+pow(6,i),dp));
    }
    for(int i=1;i<=5;i++){
        ways = min(ways,1+dfs(n,curn+pow(9,i),dp));
    }
    return dp[curn] = ways;
}

int main(){
    int n;
    cin>>n;    
    vector<int> dp(n+1,-1);
    cout<<dfs(n,0,dp);    
}

Measured memory_bytes: 10068
#include <bits/stdc++.h>
using namespace std;
#define ll long long
main()
{
    ll x, k, d, m = INT_MAX;
    cin >> x >> k >> d;
    x = abs(x);
    ll y = x / d;
    if (y >= k)
    {
        x -= (k * d);
        cout << x << endl;
        return 0;
    }
    x -= y * d;
    k -= y;
    if (k % 2 == 0)
    {
        cout << x << endl;
    }
    else
    {
        cout << abs(min(x + d, x - d)) << endl;
    }
    return 0;
}

Measured memory_bytes: 3644
x, a, b = gets.chomp.split.map(&:to_i)
gets.to_i.times{
    case gets.chomp
    when "nobiro"
        x += a
    when "tidime"
        x += b
    when "karero"
        x = 0
    end
    x = 0 if x.negative?
}
puts x


Measured memory_bytes: 6880
#include"bits/stdc++.h"
using namespace std;

//RMQ
struct SegmentTree{
private:
	int N;
	vector<long long> node, lazy;
	vector<bool> lazyFlg;
	const long long DEFAULT = INT_MAX;
public:
	void init(int n){ //初期化 O(N)
		node.clear();
		lazy.clear();
		lazyFlg.clear();
		N = 1;
		while(N < n) N = (N<<1);
		for(int i=0; i<2*N-1; i++){
			node.push_back(DEFAULT);
			lazy.push_back(0LL);
			lazyFlg.push_back(false);
		}
	}
	void eval(int k, int l, int r){ //遅延評価 O(1)
		if(lazyFlg[k]){ //RUQ：下に更新クエリが溜まっていても加算クエリが溜まっていても上書き
			node[k] = lazy[k];
			if(r-l > 1){
				lazy[2*k+1] = lazy[k];
				lazyFlg[2*k+1] = true;
				lazy[2*k+2] = lazy[k];
				lazyFlg[2*k+2] = true;
			}
			lazy[k] = 0LL;
			lazyFlg[k] = false;
		}
		else{ //RAQ：下に更新クエリが溜まっていても加算クエリが溜まっていても加算
			node[k] += lazy[k];
			if(r-l > 1){
				lazy[2*k+1] += lazy[k];
				lazy[2*k+2] += lazy[k];
			}
			lazy[k] = 0LL;
		}
	}
	void update(int a, long long x){ //[a,a+1)の値を変更 O(log N)
		update(a, a+1, x);
	}
	void update(int a, int b, long long x, int k=0, int l=0, int r=-1){ //[a,b)の値を変更 O(log N)
		if(r == -1) r = N;
		eval(k, l, r);
		if(b <= l || r <= a) return; //交差する場合
		if(a <= l && r <= b){ //完全に含む場合
			lazy[k] = x;
			lazyFlg[k] = true;
			eval(k, l, r);
		}
		else{
			update(a, b, x, 2*k+1, l, (l+r)/2);
			update(a, b, x, 2*k+2, (l+r)/2, r);
			node[k] = std::min(node[2*k+1], node[2*k+2]);
		}
	}
	void add(int a, long long x){ //[a,a+1)の値に加算 O(log N)
		add(a, a+1, x);
	}
	void add(int a, int b, long long x, int k=0, int l=0, int r=-1){ //[a,b)の値に加算 O(log N)
		if(r == -1) r = N;
		eval(k, l, r);
		if(b <= l || r <= a) return; //交差する場合
		if(a <= l && r <= b){ //完全に含む場合
			lazy[k] += x;
			eval(k, l, r);
		}
		else{
			add(a, b, x, 2*k+1, l, (l+r)/2);
			add(a, b, x, 2*k+2, (l+r)/2, r);
			node[k] = std::min(node[2*k+1], node[2*k+2]);
		}
	}
	long long min(int a, int b, int k=0, int l=0, int r=-1){ //[a,b)の最小値 O(log N)
		if(r == -1) r = N;
		if(b <= l || r <= a) return DEFAULT; //交差する場合
		eval(k, l, r);
		if(a <= l && r <= b) return node[k]; //完全に含む場合
		return std::min(min(a, b, k*2+1, l, (l+r)/2), min(a, b, k*2+2, (l+r)/2, r));
	}
	void print(){
		for(int i=0; i<node.size(); i++) cout << node[i] << endl;
		for(int i=0; i<node.size(); i++) cout << lazy[i] << endl;
		for(int i=0; i<node.size(); i++) cout << lazyFlg[i] << endl;
	}
};

int main(){
	int N, Q;
	cin >> N >> Q;
	SegmentTree st;
	st.init(N+1);
	for(int q=0; q<Q; q++){
		int c, s, t;
		cin >> c >> s >> t;
		if(c == 0){
			long long x; cin >> x;
			st.update(s, t+1, x);
		}
		else cout << st.min(s, t+1) << endl;
	}
}


Measured memory_bytes: 7140
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 
		int n=Integer.parseInt(br.readLine());
		Map<Integer, Integer> map=new HashMap<Integer,Integer>();
		int count=0;
		for(int i=0;i<n;i++){
			int a=Integer.parseInt(br.readLine());
			if(!map.containsKey(a)){
				map.put(a, 1);
				count++;
			}else{
				map.remove(a);
				count--;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 42992
# -*- coding: utf-8 -*-
# モジュールのインポート
import sys
import itertools

# 標準入力を取得
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))

# 求解処理
ans = sys.maxsize
for buildings in itertools.combinations(range(N), K):
    cost = 0
    highest = a[0] - 1
    for n in range(N):
        a_n = a[n]
        built = 0
        if n in buildings:
            built = max(highest - a_n + 1, 0)
            cost += built
        highest = max(highest, a_n + built)
    ans = min(ans, cost)

# 結果出力
print(ans)


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

int N , K;
const ll mod = 1e9 + 7;
ll DP[55][55][2500];

int main(){
  cin >> N >> K;
  DP[0][0][0] = 1;
  for(int i = 1; i <= N; ++i){
    for(int j = 0; j <= i; ++j){
      for(int k = 0; k <= K; ++k){
        if(k - 2 * j < 0)continue;
        ll& r = DP[i][j][k];
        r = (r + DP[i - 1][j][k - 2 * j] * (2 * j + 1) % mod) % mod; // one pair match
        if(j - 1 >= 0){
          r = (r + DP[i - 1][j - 1][k - 2 * j]) % mod; // no match
        }
        if(j + 1 <= i - 1){
          r = (r + DP[i - 1][j + 1][k - 2 * j] * ((j + 1) * (j + 1) % mod) % mod) % mod; // 2 pairs match
        }
      }
    }
  }
  cout << (DP[N][0][K] + mod) % mod << endl;
}


Measured memory_bytes: 53504
// g++ -std=c++11 temp.cpp
#include <bits/stdc++.h>
using namespace std;

#define For(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Rep(i,n) For(i,0,n)
#define Each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3;

#define MAX_N 100

int N;
int board[MAX_N*2][MAX_N*2];
int h[MAX_N*2][MAX_N*2];

struct dice{
	int x, xx, y, yy, z, zz;
};
dice d;

void rotation(int *a, int *b, int *c, int *d){
	int t = *a;
	*a = *b;
	*b = *c;
	*c = *d;
	*d = t;
}
void roll_x(){ rotation(&d.x,&d.z,&d.xx,&d.zz); }
void roll_xx(){ rotation(&d.x,&d.zz,&d.xx,&d.z); }
void roll_y(){ rotation(&d.y,&d.z,&d.yy,&d.zz); }
void roll_yy(){ rotation(&d.y,&d.zz,&d.yy,&d.z); }
void roll_xy(){ rotation(&d.x,&d.y,&d.xx,&d.yy); }
void make_dice(int t, int f){
	d.x = 3; d.xx = 4; d.y = 5; d.yy = 2; d.z = 1; d.zz = 6;
	Rep(i,4){
		if(d.z == t) break;
		roll_x();
	}
	Rep(i,4){
		if(d.z == t) break;
		roll_y();
	}
	while(d.x != f){ roll_xy(); }
}

int main(int argc, char const *argv[])
{
	while(1){
		cin >> N;
		if(N == 0) break;
		Rep(i,MAX_N*2)Rep(j,MAX_N*2){
			board[i][j] = 0;
			h[i][j] = 0;
		}
		Rep(i,N){
			int t, f;
			scanf("%d %d", &t, &f);
			make_dice(t,f);
			int dx = 100, dy = 100;
			while(1){
				int maxx = 0;
				if(d.x >= 4 && h[dx][dy] > h[dx+1][dy]){
					if(maxx < d.x) maxx = d.x;
				}
				if(d.y >= 4 && h[dx][dy] > h[dx][dy+1]){
					if(maxx < d.y) maxx = d.y;
				}
				if(d.xx >= 4 && h[dx][dy] > h[dx-1][dy]){
					if(maxx < d.xx) maxx = d.xx;
				}
				if(d.yy >= 4 && h[dx][dy] > h[dx][dy-1]){
					if(maxx < d.yy) maxx = d.yy;
				}
				if(maxx == 0) break;
				if(maxx == d.x){
					roll_x(); dx++;
				}else if(maxx == d.y){
					roll_y(); dy++;
				}else if(maxx == d.xx){
					roll_xx(); dx--;
				}else if(maxx == d.yy){
					roll_yy(); dy--;
				}
			}
			h[dx][dy]++;
			board[dx][dy] = d.z;
		}
		int res[7];
		Rep(i,7) res[i] = 0;
		Rep(i,MAX_N*2)Rep(j,MAX_N*2){
			res[board[i][j]]++;
		}
		cout << res[1];
		For(i,2,7) cout << " " << res[i];
		cout << endl; 
	}
	return 0;
}

Measured memory_bytes: 3452
#include <iostream>
#include <string>

using namespace std;

int main(){
  string S;
  cin >> S;

  int n = S.size(), a[n+1];
  for (int i = 0; i < n+1; i++){
    a[i] = 0;
  }
  
  for (int i = 0; i < n; i++){
    if (S[i] == '<') a[i+1] = a[i] + 1;
  }

  for (int i = n - 1; i >= 0; i--){
    if (S[i] == '>') a[i] = max(a[i], a[i+1] + 1);
  }

  long long ans = 0;
  for (int i = 0; i < n+1; i++){
    ans += a[i];
  }
  
  printf("%lld\n", ans);
}


Measured memory_bytes: 5864
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_lr(i,l,r) for(int i=(l);i<(r);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;

int main() {
	
	int n;
	cin >> n;
	vi a(n);
	vi sum(n + 1);
	ll ans = 0;
	rep(i, n) {
		cin >> a[i];
		sum[i + 1] = sum[i] + a[i];sum[i + 1] %= MOD;
		ll p = (ll)a[i] * sum[i];p %= MOD;
		ans += p;ans %= MOD;
	}

	cout << ans << endl;

}

Measured memory_bytes: 4780
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>


#define fs first
#define sc second

using namespace std;

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


int main(){
    int N;
    cin >> N;
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            if(i * j == N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007 //1000000000000000003
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

struct edge{ll to, cost;}; //edgeパラメータ
typedef pair<ll,ll> P;
struct graph{
  ll N; //ノードの個数
  vector<vector<edge> > G; //G[辺の元]((.to辺の先,.costコスト),...)
  vector<ll> d; // dist[n] = ノードnまでのの重み
  vector<ll> parent;

  graph(ll n){ //グラフ生成時
    N = n;
    G.resize(N); //Edge情報
    d.resize(N); //Node情報,ans
    parent.resize(N);
    rep(i,N){d[i] = INF;}
  }

  void add_edge(ll s, ll t, ll cost){
    G[s].emplace_back((edge){t, cost});
  }

  ll dijkstra(ll s, ll goal){
    rep(i,N){d[i] = INF;}
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que; //ansが小さい順に出る
    que.push(P(0,s)); // P < ans , Node >
    while(!que.empty()){
      P p = que.top(); que.pop(); //pに <ans,Node> 入れる
      ll v = p.second; //vに Node 入れる
      if(d[v] < p.first) continue; //すでに良い数値が入っているならパス
      rep(i,G[v].size()){
        edge& E = G[v][i];
        if(d[E.to] > d[v] + E.cost){ //更新するなら
          d[E.to] = d[v]+ E.cost;
          parent[E.to] = v; //親を記録,goalから遡れば道順
          que.push(P(d[E.to], E.to));
        }
      }
    }
    return d[goal];
  }
};

void Main(){

  int N;

  cin>>N;

  vector<tuple<int,int,int>> tp;

  rep(i,N){
    rep(j,N){
      int a; cin>>a;
      if(i==j or i>j) continue;
      tp.emplace_back(a,i,j);
    }
  }

  SORT(tp);

  graph g(N);
  ll ans=0;

  for(auto x:tp){
    int x0=get<0>(x);
    int x1=get<1>(x);
    int x2=get<2>(x);

    ll dist=g.dijkstra(x1,x2);
    if(x0==dist) continue;
    if(x0>dist){
      cout<< -1 <<"\n";
      return;
    }
    else{
      g.add_edge(x1,x2,x0);
      g.add_edge(x2,x1,x0);
      ans+=x0;
    }
  }

  cout<< ans<<"\n";

}

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


Measured memory_bytes: 1148