akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	long ans = 0;

	int min_idx = 0;
	int max_idx = 0;
	
	rep(i,1,3){
		if(a[i] > a[max_idx])
			max_idx = i;

		if(a[i] < a[min_idx])
			min_idx = i;
	}
	
	int mid_idx;
	bool b[3]={};
	
	b[max_idx]++;
	b[min_idx]++;
	rep(i,0,3){
		if(!b[i])
			mid_idx = i;	
	}
	
	//cout << "max:" << max_idx << " mid:" << mid_idx << " min:" << min_idx << endl;

	bool c[3]={};
	rep(i,0,3){
		if(a[i] % 2 == 1 )
			c[i]=1;

		//cout << "c[" << i << "]:" << c[i] << endl;
	}
	
	if(c[max_idx] == c[mid_idx] && c[max_idx] == c[min_idx]){
		//P("done1");
		ans += (a[max_idx] - a[min_idx])/2;
		ans += (a[max_idx] - a[mid_idx])/2;
	}
	else if( c[max_idx] == c[mid_idx] ){
		//P("done2");
		ans += 1;
		a[max_idx]++;
		a[mid_idx]++;
		ans += (a[max_idx] - a[min_idx])/2;
		ans += (a[max_idx] - a[mid_idx])/2;
	}
	else if( c[max_idx] == c[min_idx] ){
		//P("done3");
		ans += 1;
		a[max_idx]++;
		a[min_idx]++;
		ans += (a[max_idx] - a[min_idx])/2;
		ans += (a[max_idx] - a[mid_idx])/2;
	}
	else if( c[min_idx] == c[mid_idx] ){
		//P("done4");


		ans++;
		a[min_idx]++;
		a[mid_idx]++;
		ans += (a[max_idx] - a[min_idx])/2;
		ans += (a[max_idx] - a[mid_idx])/2;
	}

	P(ans);
	
	

	ret 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

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

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int n;
set<string> ans;

void dfs(string s, char last) {
  if(SZ(s)== n) {
    ans.insert(s);
    return;
  }

  for(char c = 'a'; c <= last+1; ++c) dfs(s+c, max(c, last));
  
}

int main()
{
  cin >> n;
  dfs("a", 'a');
  for(auto x : ans) cout << x << endl;
}

Measured memory_bytes: 12604
//
// Created by yuu on 2019-04-18.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>

using namespace std;


int main(void){

    int N;
    int A[100010][3];

    cin>>N;


    long long dp[100010][3] = {};

    for (int i = 0; i < N; ++i) {
        for(int j=0;j<3;j++){
            cin>>A[i][j];
        }
    }

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if(j==k)continue;
                dp[i+1][k] = max(dp[i+1][k], dp[i][j] + A[i][k]);
            }
        }
    }

    long long max=0;

    for (int l = 0; l < 3; ++l) {

        if(max<dp[N][l]){
            max = dp[N][l];
        }
    }

    cout<<max<<endl;

    return 0;
}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

// BIT 1-indexed
template<typename T>
class BinaryIndexedTree {
private:
    vector<T> v;
    Int n;
public:
    BinaryIndexedTree(Int sz) : v(sz + 1, 0), n(sz) {}
    T sum(Int i) {
        T s = 0;
        while (i > 0) {
            s += v[i];
            i -= i & -i;
        }
        return s;
    }
    void add(Int i, T x) {
        while (i <= n) {
            v[i] += x;
            i += i & -i;
        }
    }
};

int main() {
    Int n, q;
    cin >> n >> q;
    vector<Int> c(q), x(q), y(q);
    for (Int i = 0; i < q; i++) {
        cin >> c[i] >> x[i] >> y[i];
    }
    BinaryIndexedTree<Int> BIT(n);
    for (Int i = 0; i < q; i++) {
        if (c[i] == 0) {
            BIT.add(x[i], y[i]);
        } else {
            dump(BIT.sum(y[i]) - BIT.sum(x[i] - 1));
        }
    }
    return 0;
}


Measured memory_bytes: 6000
#include <bits/stdc++.h>
using namespace std;
int main(void){

    int n;
    cin >> n;
    
    set<int> data;
    
    for(int i=0; i<n; i++) {
        int input;
        cin >> input;
    
        auto it = data.find(input);
        if(it != data.end()) {
            cout << "NO" << endl;
            return 0;
        }
        else {
            data.insert(input);
        }
    }
    
    cout << "YES" << endl;

    return 0;
}


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

using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define sz size
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define FORRN(i,a,b) for (int i=(a);i>=(b);i--)
#define FORR(i,a,b) for (int i=(a);i>(b);i--)
void chmin(int &a,int b){ if(a>b) a=b;}
typedef unsigned long long ull;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);

    int a,b;
    cin >> a >> b;

    if(b%a==0)
        cout << a+b << endl;
    else
        cout << b-a << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		if (a <= 8 && b <= 8) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");
		}
	}
}


Measured memory_bytes: 22740
import java.util.HashSet;
import java.util.Set;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    static int len;
    static boolean ans = false;
    static String line1, line2;
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        line1 = br.readLine();
        line2 = br.readLine();
        len = line1.length();
        //boolean ans = false;
        //boolean next = false;
        int x = 0;
        int index1, index2;
        for (int i = 0; i < line1.length(); i++) {
            for (int j = 0; j < line2.length(); j++) {
                if (line1.charAt(i) == line2.charAt(j)) {
                    check(i, j);
                }
                
            }
        }
        System.out.println(ans?"Yes":"No");
    }
    
    public static void check(int i, int j) {
        int count = 0;
        while (true) {
            if (i >= len) i -= len;
            if (j >= len) j -= len;
            if (line1.charAt(i) == line2.charAt(j)) {
                i++;
                j++;
                count++;
                if (count == len) {
                    ans = true;
                    return;
                }
                continue;
            }
            else break;
        }
    }
}


Measured memory_bytes: 23508
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let n: usize = read();
    let a: Vec<f64> = read_vec();
    let mut tmp: f64 = 1.0;
    for i in 0..n {
      tmp *= a[i];
    }

    let mut sum: f64 = 0.0;
    for i in 0..n {
      sum += tmp / a[i];
    }

    let ans = tmp / sum;

    println!("{}", ans);


}


Measured memory_bytes: 4352
N = int(input())
B = list(map(int, input().split()))

A = [0 for i in range(N)]

A[0] = B[0]
for i in range(1, N-1):
    A[i] = min(B[i], B[i-1])

A[N-1] = B[N-2]

print(sum(A))


Measured memory_bytes: 3060
N, S = readlines.map(&:to_i)
RN = Math.sqrt(N).to_i

def f(b, n)
  return n if n < b
  f(b, n/b) + (n % b)
end

puts case
     when N < S
       -1
     when N == S
       N + 1
     when b_ = (2 .. RN).find{|b| f(b, N) == S}
       b_
     when p_ = RN.downto(1).find{|p| (N - S) % p == 0 && f((N - S)/p + 1, N) == S}
       (N - S)/p_ + 1
     else
       -1
     end

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

const int MX = 100001;

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  int s = 0;
  rep(i,n) s ^= a[i];
  rep(i,n) a[i] ^= s;
  rep(i,n) cout << a[i] << endl;
  return 0;
}

Measured memory_bytes: 4840
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int a,b,x;
    cin >> a >> b >> x;
    if(a + b < x || a > x ) cout << "NO" << endl;
    else cout << "YES" << endl;

    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	int array[3];
	for(int i = 0; i < 3; i++) scanf("%d",&array[i]);
	for(int i = 2; i > 0; i--){
		for(int j = 0; j < i; j++){
			if(array[j] > array[j+1])swap(array[j],array[j+1]);
		}
	}
	printf("%d %d %d\n",array[0],array[1],array[2]);
}



Measured memory_bytes: 2612
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int a[200000];

int main(){
	
	int N;
	
	cin >> N;
	
	int a_max = 0;
	int a_min = 10000000;
	
	for(int i = 0; i < N; i++){
		cin >> a[i];
		a_max = max(a_max, a[i]);
		a_min = min(a_min, a[i]);
	}
	
	if(a_max - a_min > 1){
		cout << "No" << endl;
		return 0;
	}
	
	sort(a, a + N);
	
	int a_first = a[0];
	
	int count = 0;
	
	for(int i = 0; i < N; i++){
		if(a[i] == a_first){
			count++;
		}
	}
	
	bool flag = false;
	
	if(count == N){
		if(a_first == N - 1 || a_first * 2 <= N){
			flag = true;
		}
	}else{
		if(N + count >= (a_first + 1) * 2 && count <= a_first){
			flag = true;
		}
	}
	
	if(flag){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
using Data = pair<ll, vector<int>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge { ll from; ll to; ll cost; };
typedef tuple<ll, ll, ll>T;



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

	vector<string>a(h);
	rep(i, 0, h)cin >> a[i];
	
	vector<vector<int>>dat(h,vector<int>(w,-1));
	queue<pair<int,int>>q;
	rep(i, 0, h)rep(j, 0, w)if (a[i][j] == '#') {
		q.push({ i,j });
		dat[i][j] = 0;
	}


	while (q.size()) {
		auto p = q.front();
		q.pop();

		int i = p.first;
		int j = p.second;

		int di[4] = { -1,0,1,0 };
		int dj[4] = { 0,1,0,-1 };
		rep(k, 0, 4) {
			int _i = i + di[k];
			int _j = j + dj[k];
			if (0 > _i || _i >= h || 0 > _j || _j >=w)continue;
				if (dat[_i][_j] == -1) {
					q.push({ _i,_j });
					dat[_i][_j] = dat[i][j] + 1;
				}
		}
	}

	int ans = -1;
	rep(i, 0, h)rep(j, 0, w){
		ans = max(ans, dat[i][j]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 13456
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b;cin>>a;
  rep(i,33){
    rep(o,25){
      b=i*7+o*4;
      if(b==a){
        cout<<"Yes";
        return 0;
      }
    }
  }
  cout<<"No";
}

Measured memory_bytes: 256
#include<stdio.h>

 int main(void){

 int i,n;

 int number;

 long long int sum=0;

 int min=0;

 int max=0;

 scanf("%d",&n);

 for(i=0;i<n;i++){

 scanf("%d",&number);

 if(i==0){

min=number;

 max=number;

 }

 if(number<min)min=number;

 if(number>max)max=number;

 sum+=number;

 }

 printf("%d %d %lld\n",min,max,sum);

 return 0;

 }

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

int main(){
	int N,M;
	cin >> N >> M;
	for(int i = 1; i <= M; i++){
		int t;
		cin >> t;
		N -= t;
	}
	if( N < 0 ) cout << -1 << endl;
	else cout << N << endl;
}


Measured memory_bytes: 3624
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

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

	int weight[101];
	int value[101];

	long long dp[101][100001];

	REP(i, n) {
		cin >> weight[i] >> value[i];
	}

	FOR(j, 0, w) {
		dp[0][j] = 0;
	}

	REP(i, n) {
		FOR(j, 0, w) {
			if (weight[i] <= j) {
				dp[i + 1][j] = max(dp[i][j - weight[i]] + value[i], dp[i][j]);

			}
			else {
				dp[i + 1][j] = dp[i][j];
			}
		}
	}

	ANS(dp[n][w]);

	return 0;
}


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    vector a(n, 0L);
    for (auto&& aa : a) {
        cin >> aa;
    }

    int64_t m = 1000L;
    vector s(201L, 0L);
    for (auto aa : a) {
        vector s2(201L, 0L);

        s2[m % aa] = m / aa;

        for (auto i : irange(0L, 201L)) {
            m = max(m, i + s[i] * aa);
            s2[i % aa] = max(s2[i % aa], s[i] + i / aa);
        }

        s = std::move(s2);
    }

    cout << m << endl;
}

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

int main() {
  ll n,k;
  cin>>n>>k;
  P ab[100005];
  rep(i,n) {
    cin>>ab[i].first>>ab[i].second;
  }
  sort(ab,ab+n);
  ll cnt=0; int now;
  rep(i,n) {
    if (cnt<k) {
      now=ab[i].first;
      cnt+=(ll)ab[i].second;
    }
  }
  cout<<now<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;

void solve(){
	double a,b;
	cin>>a>>b;
	ll c=a;
	ll d=b*100+0.1;
	ll ans=c*d/100;
	cout<<ans<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)solve();
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define pii pair<ll,ll>
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

vector<ll> get(ll a, ll b)
{
    vector<ll> v1;
   v1.pb(a);
   if(-1>=a && -1<=b)
        v1.pb(-1);
   if(0>=a && 0<=b)
        v1.pb(0);
   if(1>=a && 1<=b)
        v1.pb(1);
   v1.pb(b);  
    return v1;
}

int main()
{
  FAST/**/
   
   ll a,b,c,d;
   cin>>a>>b>>c>>d;
   
   vector<ll> v1,v2;
   v1 = get(a,b);
   v2 = get(c,d);
   ll ans = LLONG_MIN;
   autoit(v1,it)
        autoit(v2,it1)
        {
            ans = max(ans, (*it) * (*it1));
        }
   
   cout<<ans;        
   
   
   return 0;        
}  

  
          
   

Measured memory_bytes: 3656
import math
i = list(map(int, input().split()))

sqa = i[0] * i[0]
sqb = i[1] * i[1]
angh = 30 * i[2]
angm = 6 * i[3]
angh += 0.5 * i[3]
theta = abs(angh - angm)
if theta > 180:
  theta = 360 - theta
ans = math.sqrt(sqa + sqb -2 * i[0] * i[1] * math.cos(theta * math.pi / 180))
print(ans)

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

using namespace std;

int main()
{
	string s;
	cin>>s;
	long long w_cnt = 0;
	long long sum = 0;
	for(int i=0;i<s.length();i++){
		if(s[i]=='W'){
			sum += i-w_cnt;	
			w_cnt++;
		}
	}
	cout<<sum;
}

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

using namespace std;
typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define ill(_x)  ll _x;scanf("%lld",&_x);
#define idb(_x)  double _x;scanf("%lf",&_x);
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vs vector<string>
#define in0(x, a, b)((x)>=a && (x)<=b    )
#define in1(x, a, b)((x)>a && (x)<b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define gcd __gcd
const double pi = 3.14159265358979323846;
const int INF = 0x3f3f3f3f;
const int MOD = (int)(1e9+7);

int pDivisors(int n, int t)
{
    vector<int> v;
    int mx = 0;
    for (int i=1; i<=sqrt(n); i++)
    {
        if (n%i == 0)
        {
            if(i<=t)mx = max(i, mx);
            if(n/i<=t)mx = max(n/i, mx);
        }

    }
    return mx;
}

int x[102],y[202], h[234];
void _(){
    int n,t;
    cin >> n >> t;
    int mi =INT_MAX;
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        if(b <= t)mi = min(mi, a);
    }
    if(mi != INT_MAX)
        cout << mi;
    else cout << "TLE";

}


int main() {
#ifdef Debug
    freopen("/home/joduskame/Desktop/cpp/IO/Input.txt", "r", stdin);
    freopen("/home/joduskame/Desktop/cpp/IO/Output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    _();
    return 0;

}





Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mp(x,y) make_pair(x,y)
const int nax=2e5+5;
void solve(){
    int n,m,x;
    cin>>n>>m>>x;
    int mask=(1<<n);
    int ans=INT_MAX;
    vector<int> v[n];
    for(int i=0;i<n;i++){
        for(int j=0;j<m+1;j++){
            int x; cin>>x; 
            v[i].push_back(x);
        }
    }
    for(int i=1;i<mask;i++){
        int f[m]={0};
        int j=i;
        int l=0;
        int c=0;
        while(j){
            if(j&1){
                c+=v[l][0];
                for(int i=0;i<m;i++){
                    f[i]+=v[l][i+1];
                }
            }
            j/=2;
            l++;
        }
        int gh=0;
        for(int i=0;i<m;i++){
            if(f[i]<x) gh=1;
        }
        if(gh==0 && ans>c){
            ans=c;
        }
    }
    if(ans==INT_MAX) cout<<"-1\n";
    else cout<<ans<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int tc;
    tc=1;
    while(tc--){
        solve();
    }
    return 0;
}

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

from collections import deque

def linput(_t=int):
    return list(map(_t, input().split()))

def gcd(n,m):
    while m: n,m = m, n%m
    return n

def lcm(n,m): return n*m//gcd(n,m)

def main():

    N,M = linput()
    # res = 0
    # print(N)
    mG = [[] for _ in [0,]*(N+1)]

    for _ in [0,]*M:
        a,b = linput()
        mG[a].append(b)
        mG[b].append(a)

    vR = [0,] * (N+1)
    vR[1] = 1

    vQ = deque([])
    vQ.append((mG[1],1))

    while vQ:
        vG, pp = vQ.popleft()
        # print(vG,pp,"vQ_pop")

        for g in vG:
            if vR[g] == 0:
                vR[g] = pp
                vQ.append((mG[g],g))

    print("Yes")
    print(*(r for r in vR[2:]), sep="\n")
    # print(res)
    # print(("No","Yes")[res%2])


main()


Measured memory_bytes: 105492
#include <iostream>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int store[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
  int x, y;
  cin >> x >> y;
  cout << ((store[x] == store[y]) ? "Yes\n" : "No\n") << "\n";
  return 0;
}


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

int main(){
  int x, y;
  cin >> x >> y;
  
  for(int i = 0; i <= x; i++){
	if(2*i+4*(x-i) == y){
      cout << "Yes";
      return 0;
    }
  }
  
  cout << "No";
  return 0;
}

Measured memory_bytes: 3584
import java.util.*;

class Main{

    void solve(){
	Scanner sc = new Scanner(System.in);

	while(true){
	    int n = sc.nextInt();
	    if(n==0) break;

	    int[][] seigen = new int[n][2];
	    for(int i=0; i<n; i++){
		seigen[i][0] = sc.nextInt();
		seigen[i][1] = sc.nextInt();
	    }

	    Arrays.sort(seigen, new Comparator<int[]>(){
		    public int compare(int[] a, int[] b){
			return a[1] - b[1];
		    }
		});

	    int now = 0;
	    boolean boo = true;
	    for(int i=0; i<n; i++){
		if(seigen[i][1]>=now && seigen[i][1]>=seigen[i][0]+now) now += seigen[i][0];
		else{
		    boo = false;
		    break;
		}
	    }
	    if(boo) System.out.println("Yes");
	    else System.out.println("No");
	}

    }

    public  static void main(String[] args){
	new Main().solve();
    }
}

Measured memory_bytes: 24508
#include<stdio.h>
int main(void)
{
  
  int day;
  char ans;
  scanf("%d",&day);
  if(day==22) printf("Christmas Eve Eve Eve");
  else if(day==23) printf("Christmas Eve Eve");
  else if(day==24) printf("Christmas Eve");
  else printf("Christmas");
  //printf("%s",ans);
  return 0;
}

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

const int mod = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    vector<long long> a(n);
    long long sum = 0, squaresum = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
        sum %= mod;
        squaresum += (a[i] * a[i]) % mod;
        squaresum %= mod;
    }
    long long ans = sum * sum - squaresum;
    ans %= mod;
    if(ans & 1) ans = (ans + mod) / 2;
    else ans = ans / 2;
    cout << ans << endl;
}

Measured memory_bytes: 4852
////////////
//||||| ||//
//   || ||//
//||||||||//
//|| ||   //
//|| |||||//
////////////
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define   ll  long long int
#define   dl double
#define   llu unsigned long long int
#define   scll(x) scanf("%lld",&x)
#define   scld(x) scanf("%lf",&x)
#define   scull(x) scanf("%llu",&x)
#define   scch(x) scanf(" %c",&x)
#define   eb(x)   emplace_back(x)
#define   pb(x) push_back(x)
#define   pf(x) push_front(x)
#define   ppb() pop_back()
#define   ppf() pop_front()
#define   Pi acos(-1.0)
#define   inf 1000000000000000000
#define   mod 1000000007
#define   ff first
#define   ss second
#define   mpr make_pair
#define   debug(x) cout<<x<<'\n';
#define   MAX 1000000
#define   eps 1e-8
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;
//Taking input by EOF
//while(scanf("%lld",&x)!=-1){ }
// Creates a min heap
//priority_queue <int, vector<int>, greater<int> > pq;
//sin((x*pi)/180.0)[x in degree]
//sin(x)[x in radian]
//asin(x)[radian]
//(asin(x)*180)/pi[degree]
//or(|)//and(&)//xor(^)//not(~)
//S.order_of_key(x)[Give me the position of x]
//S.find_by_order(x)[Give me the x th element in set]
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll lcm(ll a, ll b) {return (a * b) / __gcd(a, b);}
int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ll a, b, c = 1, d, e, f = 0, g, h, i, j = 0, k, m, n, o, p, s, t, v, w, x = 0, y, z, l,res=0;
  ll cnt = 0, l1 = 0, l2, l3, c1 = 0, c2 = 0, c3 = 0, mx = 0, mn = 0;
  ll prevsum = 0, ans1 = 0, ans2 = 0, odd = 0, even = 0, hh, mm;
  string str, str1, str2, str3 = "", str4 = "";
  ll ide = 0, idx = 0, Q;
scll(k);
for(i=0;i<k;i++)
cout<<"ACL";
  return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
typedef long long int ll;
const ll LINF = 9000000000000000000ll;
const int INF = 2000000000;
const ll MOD = 1e9+7;

int main() {
    int n, d;
    cin >> n >> d;
    vector<vector<int>> x(n, vector<int>(d));
    rep(i, n) {
        rep(j, d){
            cin >> x[i][j];
        }
    }
    int ans = 0;
    float total;
    rep(i, n-1) {
        rep(j, n-i-1) {
            total = 0;
            rep(k, d) {
                total += pow(x[i][k] - x[i+j+1][k], 2);
            }
            total = sqrt(total);
            if (floor(total) == total) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
void file(){
    freopen("read.in","r",stdin);
    freopen("write.out","w",stdout);
}
const int N=500010;
inline int read(){
    int sym=0,res=0;char ch=getchar();
    while (!isdigit(ch))sym|=(ch=='-'),ch=getchar();
    while (isdigit(ch))res=(res<<3)+(res<<1)+(ch^48),ch=getchar();
    return sym?-res:res;
}
int n,m;
int main(){
    n=max(read(),read());m=read();
    printf("%d",m%n?m/n+1:m/n);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N,K;
	cin>>N>>K;
	int l[N];
	int sum=0;
	for(int i=0;i<N;i++){
		cin>>l[i];
	}
	sort(l,l+N);
	reverse(l,l+N);
	for(int k=0;k<K;k++){
		sum+=l[k];
	}
	cout<<sum<<endl;
}


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

int main(void)
{
  char in[100]={};
  char ans[100]={};
  char rot[100]={};
  int match = 0;
  int len=0;
  int i=0;
  int j=0;
  int idx=0;
  scanf("%s",in); 
  scanf("%s",ans); 
  len = strlen(in);
  
#if 0
  printf("%s\n",in);
  printf("%s\n",ans);
  printf("%d\n",len);
#endif
  for(i=0;i<len;i++)
  {
    for(j=0;j<len;j++)
    {
       idx = i+j;
       if (idx >= len ) idx -= len;
       rot[idx] = in[j]; 
    }
    rot[len] = '\0';
#if 0
  printf("rot : %s\n",rot);
#endif
    if (  0 == strcmp( rot, ans) )
    {
      match=1;
      break;
    }
  }
  printf( "%s", (0==match)?"No":"Yes");
  return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<cassert>
#include<vector>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,a) for(int i=start[(a)];i;i=e[i].next)
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
inline int read()
{
	int sum=0,p=1;char ch=getchar();
	while(!(('0'<=ch && ch<='9') || ch=='-'))ch=getchar();
	if(ch=='-')p=-1,ch=getchar();
	while('0'<=ch && ch<='9')sum=sum*10+ch-48,ch=getchar();
	return sum*p;
}

const int maxn=2e3+20;
const int mod=1e9+7;
inline void pls(int &a,int b){ a+=b;if(a>=mod)a-=mod;}

int jc[maxn*maxn],jcn[maxn*maxn],inv[maxn*maxn];

int n,k;

inline void init()
{
	n=read();k=read();
	if(k==1)puts("1"),exit(0);
	jc[0]=jcn[0]=inv[1]=jcn[1]=jc[1]=1;
	REP(i,2,n*k)inv[i]=(ll)(mod-mod/i)*inv[mod%i]%mod,jc[i]=(ll)i*jc[i-1]%mod,jcn[i]=(ll)inv[i]*jcn[i-1]%mod;
}

inline int C(int n,int m){ return (ll)jc[n]*jcn[m]%mod*jcn[n-m]%mod;} 

int dp[maxn][maxn];

inline void doing()
{
	dp[1][0]=1;
	REP(i,1,n)
	{
		REP(j,0,i)
		{
			if(i<n)pls(dp[i+1][j],dp[i][j]);
			if(j<i)pls(dp[i][j+1],(ll)dp[i][j]*C(n*k-i-(j)*(k-1)-1,k-2)%mod*(n-j)%mod);
		}
	}
	printf("%d\n",dp[n][n]);
}

int main()
{
	init();
	doing();
	return 0;
}



Measured memory_bytes: 62848
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int sqr(int x) { return x*x; }

int main()
{
  int N, M;
  while (scanf("%d %d", &N, &M) != EOF && N != 0) {
    vector<int> cs(M);
    for (int i = 0; i < M; i++) {
      scanf("%d", &cs[i]);
    }

    static long long dp[20000+1][256];
    static const long long INF = 1LL<<50;
    fill_n(dp[0], 256, INF);
    dp[0][128] = 0;
    for (int i = 1; i <= N; i++) {
      int x;
      scanf("%d", &x);
      fill_n(dp[i], 256, INF);
      for (int j = 0; j < 256; j++) {
        for (int k = 0; k < M; k++) {
          int y = j + cs[k];
          if (y < 0) {
            y = 0;
          } else if (y > 255) {
            y = 255;
          }
          dp[i][y] = min(dp[i][y], dp[i-1][j] + sqr(y - x));
        }
      }
    }
    printf("%lld\n", *min_element(dp[N], dp[N]+256));
  }
  return 0;
}

Measured memory_bytes: 0
def main():
    n = int(input())
    a = list(map(int, input().split()))

    flag = True
    count = 0
    for i in a:
        if(i%2 == 1):
            flag = False

    while flag == True:
        count += 1
        a = list(map( lambda x: int(x/2), a))
        for i in a:
            if(i%2 != 0):
                flag = False
    
    print(count)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
typedef long long ll;
const long long MOD = 1000000007LL;
const double EPS = 1e-9;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  string S;
  cin >> S;
  int n = S.length();

  vector<int> dp(13);
  dp[0] = 1;

  REP(i, n) {
    vector<int> dp_nxt(13);
    int c;
    if (S[i] == '?') c = -1;
    else c = S[i] - '0';

    REP(j, 10) {
      if (c != -1 && c != j) continue;
      REP(ki, 13) {
        (dp_nxt[(ki * 10 + j) % 13] += dp[ki]) %= MOD;
      }
    }
    dp = dp_nxt;
  }

  cout << dp[5] << endl;
  return 0;
}


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(100002)


N, M = map(int, input().split())
g = {}
for i in range(N):
    g[i] = set()
for _ in range(M):
    pre, post = map(int, input().split())
    g[post-1].add(pre-1)    # reversed

# dp[i 頂点まで使って][j 頂点を終端とする] = 最長有向パス
dp = [-1 for _ in range(N)]


def dp_rec(p):

    if dp[p] != -1:
        return dp[p]

    res = 0
    for n in g[p]:
        res = max(res, dp_rec(n) + 1)

    dp[p] = res
    return res


for i in range(N):
    dp_rec(i)
print(max(dp))


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

int main() {
  int N;
  int a=0,j=0;
  cin >> N;
  
  int coins[6] = {100, 5, 4, 3, 2, 1};
  int ans = 0, res=0;
  
  res = N;
  for (int i = 0; i < 6; i++){
		int c = coins[i];
		int q = res / c;
		ans += q;
		res -= c * q;
        if(i!=0)j+=q;
  }
 
 //cout << j << endl;
 if(j<=N/100&&res==0) cout << 1 << endl;
 else cout << 0 << endl;
  
      
}


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

int main()
{   
    int k,s;
    cin>>k>>s;
    int ans=0;
    
    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            int z=s-i-j;
            if(0<=z && z<=k) ans++;
        }
    }

    cout<<ans<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007, mod998 = 998244353;

int A, B, C, a[11];


int main() {
	cin >> A >> B >> C;
	++a[A];
	++a[B];
	++a[C];
	if (a[5] == 2 && a[7] == 1)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = N % 1000
# if 0 <= N < 1000:
#     print(N)
if N % 1000 == 0:
    print(0)
else:
    print(1000 - a)


# for i in range(1, 10+1):
#     have = 1000 * i

#     if 0 <= have - N < 1000:
#         print(have - N)
#         exit()


Measured memory_bytes: 10588
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    vector<int> p(N);
    int S = 0;
    for(int i = 0; i < N; i++){
        cin >> p[i];
        S += p[i];
    }
    sort(p.begin(),p.end());
    cout << S - p[N-1]/2 << endl;
}


Measured memory_bytes: 256
/*
C - : (Colon)
https://atcoder.jp/contests/abc168/tasks/abc168_c
*/
#include <bits/stdc++.h>
using namespace std; 

#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()  
{ 
    FAST_INP;
    int a,b,h,m;
    long double PI=acos(-1);
    cin >> a >> b >> h >> m;
    // c^2 = a^2+b^2-2abcosC
	long double rad = 2*PI*( (long double)h/12.0 + ((long double)m/60.0)/12.0 - (long double)m/60.0);
    cout << setprecision(20) << sqrtl((long double)(a*a+b*b)-(long double)(2*a*b)*cosl(rad)) << "\n";
    return 0;
} 


Measured memory_bytes: 4140
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int m = sc.nextInt();
		final int n = sc.nextInt();
		
		final int k = sc.nextInt();
		
		char[][] map = new char[m][n];
		
		for(int i = 0; i < m; i++){
			String str = sc.next();
			char[] input = str.toCharArray();
			
			for(int j = 0; j < n; j++){
				map[i][j] = input[j];
			}
			
		}
		
		int[][] js = new int[m][n];
		int[][] os = new int[m][n];
		int[][] is = new int[m][n];
		
		for(int i = 0; i < m; i++){
			for(int j = 0; j < n; j++){
				if(i == 0 && j == 0){
					js[i][j] += map[i][j] == 'J' ? 1 : 0;
					os[i][j] += map[i][j] == 'O' ? 1 : 0;
					is[i][j] += map[i][j] == 'I' ? 1 : 0;
				}else if(i == 0){
					js[i][j] += js[i][j-1] + (map[i][j] == 'J' ? 1 : 0);
					os[i][j] += os[i][j-1] + (map[i][j] == 'O' ? 1 : 0);
					is[i][j] += is[i][j-1] + (map[i][j] == 'I' ? 1 : 0);
				}else if(j == 0){
					js[i][j] += js[i-1][j] + (map[i][j] == 'J' ? 1 : 0);
					os[i][j] += os[i-1][j] + (map[i][j] == 'O' ? 1 : 0);
					is[i][j] += is[i-1][j] + (map[i][j] == 'I' ? 1 : 0);
				}else{
					js[i][j] += js[i-1][j] + js[i][j-1] - js[i-1][j-1] + (map[i][j] == 'J' ? 1 : 0);
					os[i][j] += os[i-1][j] + os[i][j-1] - os[i-1][j-1] + (map[i][j] == 'O' ? 1 : 0);
					is[i][j] += is[i-1][j] + is[i][j-1] - is[i-1][j-1] + (map[i][j] == 'I' ? 1 : 0);
				}
			}
		}
		
		for(int i = 0; i < k; i++){
			final int y1 = sc.nextInt()-1;
			final int x1 = sc.nextInt()-1;
			final int y2 = sc.nextInt()-1;
			final int x2 = sc.nextInt()-1;
			
			int J = 0, O = 0, I = 0;
			
			if(x1 == 0 && y1 == 0){
				J = js[y2][x2];
				O = os[y2][x2];
				I = is[y2][x2];
			}else if(x1 == 0){
				J = js[y2][x2] - js[y1-1][x2];
				O = os[y2][x2] - os[y1-1][x2];
				I = is[y2][x2] - is[y1-1][x2];
			}else if(y1 == 0){
				J = js[y2][x2] - js[y2][x1-1];
				O = os[y2][x2] - os[y2][x1-1];
				I = is[y2][x2] - is[y2][x1-1];
			}else{
				J = js[y2][x2] - js[y2][x1-1] - js[y1-1][x2] + js[y1-1][x1-1];
				O = os[y2][x2] - os[y2][x1-1] - os[y1-1][x2] + os[y1-1][x1-1];
				I = is[y2][x2] - is[y2][x1-1] - is[y1-1][x2] + is[y1-1][x1-1];
			}
			
			System.out.println(J + " " + O + " " + I);
		}
		
	}

}

Measured memory_bytes: 26000
import java.util.EnumSet;
import java.util.Scanner;


public class Main{
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int rec = 0;
		int loz = 0;
		while(sc.hasNextLine()) {
			String s = sc.nextLine();
			Scanner scstr = new Scanner(s);
			scstr.useDelimiter(",");
			int s1 = scstr.nextInt();
			int s2 = scstr.nextInt();
			int d = scstr.nextInt();
			scstr.close();
			Quadrangle q = kindOfQuadrangle(s1, s2, d);
			if(q.equals(Quadrangle.rectangle) || q.equals(Quadrangle.square)) rec++;
			if(q.equals(Quadrangle.lozenges) || q.equals(Quadrangle.square)) loz++;
		}
		sc.close();
		System.out.println(rec);
		System.out.println(loz);
	}
	
	
	static Quadrangle kindOfQuadrangle(int firstSide, int secondSide, int diagonal) {
		EnumSet<Quadrangle> es = EnumSet.noneOf(Quadrangle.class);
		if(firstSide * firstSide + secondSide * secondSide == diagonal * diagonal) es.add(Quadrangle.rectangle);
		if(firstSide == secondSide) es.add(Quadrangle.lozenges);
		
		if(es.contains(Quadrangle.rectangle) && es.contains(Quadrangle.lozenges)) return Quadrangle.square;
		if(es.contains(Quadrangle.rectangle)) return Quadrangle.rectangle;
		else if(es.contains(Quadrangle.lozenges)) return Quadrangle.lozenges;
		else return Quadrangle.quadrangle;
	}
}

enum Quadrangle{
	rectangle, lozenges, square, quadrangle
}

Measured memory_bytes: 19224
#include<iostream>
using namespace std;
int main(){
  int n,r=0,b=0;
  char c;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>c;
    if(c=='R')r++;
    else b++;
  }
  cout<<((r>b)?"Yes":"No")<<endl;
  return 0;
}

Measured memory_bytes: 256
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

N = int(input())
Ai = list(map(int, input().split()))

l = 1
for a in Ai:
    l = lcm(l, a)
l -= 1

total = 0
for a in Ai:
    total += l % a
print(total)

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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#include <iostream>
//#define ll long long
//#define pb push_back
int getTheAnswer() {
    return 42;
}

using namespace std;
using ll=long long;

class AStudyScheduling {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        int h1,m1,h2,m2,k;
        cin>>h1>>m1>>h2>>m2>>k;
        if (m2>=m1){
            m2-=m1;
            h2-=h1;
        }
        else{
            m2=m2+60-m1;
            h2--;
            h2-=h1;
        }
        if (h2*60 + m2>k)
            cout<<h2*60 + m2 - k<<endl;
        else if(h2*60 + m2<=k)
            cout<<0<<endl;
	}
};


int main() {
	AStudyScheduling solver;
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

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

	string ans;
	for( int i = 0; i < N; i++ ) {
		ans += S[i];
		ans += T[i];
	}

	cout << ans << endl;
}


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

int main() {
  int n, limit;
  cin >> n >> limit;
  vector<int> length(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &length[i]);
  }

  int last = -1;
  for (int i = 0; i < n - 1; ++i) {
    if (length[i] + length[i + 1] >= limit) {
      last = i;
      break;
    }
  }

  if (!~last) {
    cout << "Impossible" << endl;
  } else {
    cout << "Possible" << endl;
    for (int i = 0; i < last; ++i) {
      printf("%d\n", i + 1);
    }
    for (int i = n - 2; i > last; --i) {
      printf("%d\n", i + 1);
    }
    printf("%d\n", last + 1);
  }

  return 0;
}

Measured memory_bytes: 1152
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

namespace CSharpSpiral {
	class Program {
		static void Main(string[] args) {
			var sw = new StreamWriter(Console.OpenStandardOutput()) {
				AutoFlush=
#if DEBUG
			true
#else
			false
#endif
			};
			Console.SetOut(sw);
			new Program().Solve(new ConsoleInput(
#if DEBUG
			new StreamReader("../../../inputData.txt")
#else
			Console.In
#endif
			, ' '));
			Console.Out.Flush();
		}
		public void Solve(ConsoleInput cin) {
			var N = 3001;
			var table = new long[N];
			for(int i = 0; i<N; i++) {
				table[i]=(long)i*i*i*i*i;
			}
			var X = cin.ReadInt;
			for(int i = 0; i<N; i++) {
				var b5 = table[i]-X;
				if(b5==0) {
					Console.WriteLine($"{i} 0");
					return;
				} else if(b5<0) {
					var j = Array.BinarySearch(table, -b5);
					if(j>=0) {
						Console.WriteLine($"{i} {-j}");
						return;
					}
				} else {
					var j = Array.BinarySearch(table, b5);
					if(j>=0) {
						Console.WriteLine($"{i} {j}");
						return;
					}
				}
			}
		}
	}
	static class ExtendClass {
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator=separator;
			this._stream=stream;
			inputStream=new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count!=0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i<tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i<N; ++i)
				ret[i]=Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i<N; ++i) ret[i]=ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i<N; ++i) ret[i]=ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i<N; ++i) ret[i]=ReadDouble; return ret; }
		public bool isEOF {
			get { return _stream.Peek()==-1; }
		}
	}
}

Measured memory_bytes: 28008
#define _USE_MATH_DEFINES 
#include <iomanip> 
#include <cmath>  
#include<iostream>
#include <fstream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

ll N, K, ans = 1;

int main() {
	cin >> N >> K;
	repi(i, 0, N) {
		if (ans < K) ans *= 2;
		else ans += K;
	}

	wrln(ans);

	return 0;
}

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

using namespace std;

int main(){

    long long Q, H, S, D;
    cin >> Q >> H >> S >> D;

    long long N;
    cin >> N;
    N = 4 * N;

    long long L8, L4, L2, L1;
    L8 = N / 8;
    N = N % 8;
    L4 = N / 4;
    N = N % 4;
    L2 = N / 2;
    L1 = N % 2;

    long long ans = Q * L1;
    ans += min(2 * Q, H) * L2;
    ans += min(4 * Q, min(2 * H, S)) * L4;
    ans += min(min(8 * Q, 4 * H), min(2 * S, D)) * L8;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import heapq

INF = 10 ** 9

v, e, r = map(int, input().split())
adjw = [[] for _ in range(v)]
for i in range(e):
    s, t, d = map(int, input().split())
    adjw[s].append((t, d))


# 終点を渡す
def dijkstra(x):
    d = [INF] * x # dist
    d[r] = 0 # r = 0
    hq = [(0, r)] # (dist, v)

    while hq:
        c, v = heapq.heappop(hq) # pop

        if d[v] < c: # seen の役割
            continue

        for t, cost in adjw[v]: # 隣接しているノードについて
            if d[v] + cost < d[t]:
                d[t] = d[v] + cost
                heapq.heappush(hq, (d[t], t))
    
    return d

d = dijkstra(v)
for i in range(v):
    print(d[i]) if d[i] < INF else print('INF')



Measured memory_bytes: 89280