akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#define int long long
using namespace std;
inline int read(){
	int x=0,w=0;char c=getchar();
	while(!isdigit(c))w|=c=='-',c=getchar();
	while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return w?-x:x;
}
namespace star{
	const int maxn=1e5,mod=1e9+7;
	int h,w,a,b;
	inline int fpow(int a,int b){
		int ans=1;
		for(;b;b>>=1,a=a*a%mod)if(b&1)ans=ans*a%mod;
		return ans;
	}
	int mul[maxn*2+10],inv[maxn*2+10];
	inline void pre(int n){
		mul[0]=inv[0]=1;
		for(int i=1;i<=n;i++)
			mul[i]=mul[i-1]*i%mod;
		inv[n]=fpow(mul[n],mod-2);
		for(int i=n-1;i;i--)
			inv[i]=inv[i+1]*(i+1)%mod;
	}	
	inline int C(int n,int m){
		return mul[n]*inv[n-m]%mod*inv[m]%mod;
	}
	inline void work(){
		h=read(),w=read(),a=read(),b=read();
		pre(h+w);
		int ans=0;
		for(int i=b+1;i<=w;i++)
			ans=(ans+C(h-a+i-2,i-1)*C(w+a-i-1,a-1)%mod)%mod;
		printf("%lld\n",ans);
	}
}
signed main(){
	star::work();
	return 0;
}

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

int a, b;

int main()
{
	cin >> a >> b;
	if (a == 1)
		a = 14;
	if (b == 1)
		b = 14;
	if (a == b)
		cout << "Draw" << '\n';
	else
	{
		if (a < b)
			cout << "Bob" << '\n';
		else
			cout << "Alice" << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
#define int long long 
	while (true) {
		int n;
		cin >> n;
		if (n == 0) return 0;
		vector<int> cnt;
		REP(i, n) {
			string s;
			cin >> s;
			cnt.push_back(s.length());
		}
		for (int i = 0; i < cnt.size(); ++i) {
			int tmp_a = cnt[i];
			for (int q = i + 1;; ++q) {
				if (tmp_a == 5) {
					int tmp_b = cnt[q];
					for (int j = q + 1; ; ++j) {
						if (tmp_b == 7) {
							int tmp_c = cnt[j];
							for (int t = j + 1;;++t){
								if (tmp_c == 5) {
									int tmp_d = cnt[t];
									for (int p = t + 1;; ++p) {
										if (tmp_d == 7) {
											int tmp_e = cnt[p];
											for (int tea = p + 1;; ++tea) {
												if (tmp_e == 7) {
													cout << i+1 << endl;
													goto ok;
												}
												if (tea == cnt.size()) break;
												tmp_e += cnt[tea];
												if (tmp_e > 7) break;
											}
										}
										if (p == cnt.size()) break;
										tmp_d += cnt[p];
										if (tmp_d > 7) break;
									}
								}
								if (t == cnt.size()) break;
								tmp_c += cnt[t];
								if (tmp_c > 5) break;
							}
						}
						if (j == cnt.size()) break;
						tmp_b += cnt[j];
						if (tmp_b > 7) break;
					}
				}
				if (q == cnt.size()) break;
				tmp_a += cnt[q];
				if (tmp_a > 5) break;
			}
		}
	ok:;
	}
}



Measured memory_bytes: 3152
def main():
  N = int(input())
  A = list(map(int, input().split()))
  A_copy = A.copy()
  d_sum = 0
  
  for i in range(N - 1):
    a_dif = A[i+1] - A[i]
    if A[i+1] < A[i]:
      A[i+1] = A[i]
  
  for i in range(N):
    d_sum += A[i] - A_copy[i]
  
  print(d_sum)
  
if __name__ == "__main__":
  main()

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

void solve() {
    int n;
    cin >> n;

    int ans = 0;
    for (int a = 1; a < n; a++) {
        ans += (n - 1) / a;
    }
    cout << ans << endl;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 3628
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        int[] r = new int[n];
        for(int x=0; x < n; x++){
            r[x] = Integer.parseInt(sc.nextLine());
        }
        int maxv = -2000000000;
        int minv = r[0];

        for(int i = 1; i < n; i++){
            maxv = Math.max(maxv, r[i] - minv);
            minv = Math.min(minv, r[i]);
        }
        System.out.println(maxv);

    }
}

Measured memory_bytes: 169316
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int main()
{
    int q;
    cin>>q;
    map<string ,int > map;
    while (q--)
    {
        int c;
        cin>>c;
        if(c==0)
        {
            string key;
            int x;
            cin>>key>>x;
            map[key]=x;
        }
        else
        {
            string key;
            cin>>key;
            auto it=map.find(key);
            if(it!=map.end())
            {
                cout<<it->second<<endl;
            }
        }


    }

}


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

int main(){
    ll n, a, b;
    cin>>n>>a>>b;
    
    if((b-a)%2==0){
        cout << (b-a)/2 << endl;
    }else{
        cout << min(a + (b-a-1)/2, n-b+1 + (b-a-1)/2)<<endl;
        //端のテーブルで1回手待ちして折り返す
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

struct node {
    double x;
    double y;
};

double dis(double midx, double midy, double x, double y) {
    double r = sqrt((x - midx) * (x - midx) + (y - midy) * (y - midy));
    return r;
}
signed main() {
    int n;
    cin >> n;
    int a[n];
    int ans = 0;
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, n) {
        if (a[i] == 0) {
            continue;
        } else {
            if (i > 0) {
                ans += (a[i] + a[i - 1]) / 2;
                a[i] = (a[i] + a[i - 1]) % 2;
            } else {
                ans += a[i] / 2;
                a[i] %= 2;
            }
        }
    }
    cout << ans << "\n";
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int d, t, s; cin >> d >> t >> s;
    if(d > t*s) cout << "No" << endl;
    else cout << "Yes" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7748
n=int(input())
a=[int(x) for x in input().rstrip().split()]
dic={}
minus=0
for i in a:
  if i not in dic:
    dic[i]=1
  else:
    dic[i]+=1

for i in dic:
  v=dic[i]
  if i==v:
    continue
  elif i<v:
    minus+=v-i
  else:
    minus+=v

print(minus)

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

struct UnionFind
{
    vector<long long> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N)
    { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++)
            par[i] = i;
    }

    long long root(long long x)
    { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(long long x, long long y)
    {                           // xとyの木を併合
        long long rx = root(x); //xの根をrx
        long long ry = root(y); //yの根をry
        if (rx == ry)
            return;   //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(long long x, long long y)
    { // 2つのデータx, yが属する木が同じならtrueを返す
        long long rx = root(x);
        long long ry = root(y);
        return rx == ry;
    }
};

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

    ll N,M,ans=0;
    string S;
    cin >> N>>M;

    vector<ll> a(M),b(M);

    REP(i,M){
        cin >> a.at(i) >> b.at(i);
    }

    

    REP(i,M){
        UnionFind tree(N + 1);
        REP(j,M){
            if(i==j){

            }
            else{
                tree.unite(a.at(j), b.at(j));
            }
        }

        ll start = tree.root(1);
        for (ll j = 2; j <= N; j++) {
            ll tmp = tree.root(j);
            if(!(tmp==start)){
                ans++;
                break;
            }
        }
    }

    cout << ans << endl;
}


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

int main()
{
 int n;
  cin>>n;
  double sum=0.0;
  while(n--)
  {
    double x;
    string s;
    cin>>x>>s;
    if(s=="JPY")
    {
      sum+=x;
    }
    else
      sum+=380000.0*x;
  }
  cout<<sum<<"\n";
  
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")

# https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/all/DSL_1_B
import sys
sys.setrecursionlimit(1000000)
INF = float("inf")

while True:
    N,K = map(int,sys.stdin.readline().split())
    if N==0 and K==0:
        exit()
    a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param

    com = [0]*(N+1)
    for i in range(N):
        com[i+1]=com[i]+a[i]

    ret = -INF
    for i in range(N-K):
        ret = max(ret,com[i+K]-com[i])
    print(ret)


Measured memory_bytes: 13440
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 1000
int top,S[MAX];

void push(int);
int pop();

int main(){
  int x,a,b;
  char s[1000];

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

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

  return 0;
}

void push(int x){
  if(top == MAX-1){
    fprintf(stderr,"Overflow\n");
    exit(0);
  }
  S[++top]=x;
}

int pop(){
  if(top == 0){
    fprintf(stderr,"Underflow\n");
    exit(1);
  }
  top--;
  return S[top+1];
}



Measured memory_bytes: 2104
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(c) c.begin(), c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main()
{
    ll H, N;
    cin >> H >> N;
    vector<ll> A(N);
    ll sum = 0;
    rep(i, N)
    {
        cin >> A[i];
        sum += A[i];
    }
    if (sum >= H)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}

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



int main(){
   
   int N; cin >> N;
   
   vector<int> a;
   int punto;
   for (int i = 0; i < N; i++) {
   		cin >> punto;
   		a.push_back(punto);
   }
   
   vector<int> Popa;
   vector<int> Papu;
   
   
   
   for (int j = 0; j < N; j++) {
   int maximo = *max_element(a.begin(), a.end());
	   for (int i = 0; i < a.size(); i++) {
			if (a[i]==maximo) {
			   a.erase(a.begin() + i);
			   if (j%2==0) Popa.push_back(maximo);
			   else if (j%2!=0) Papu.push_back(maximo);
			   break;
			}
		}
	}
	int suma1 = 0;
	int suma2 = 0;
	for (int i = 0; i < Popa.size(); i++) suma1+=Popa[i];
	for (int i = 0; i < Papu.size(); i++) suma2+=Papu[i];
	
	cout << suma1 - suma2;
   
  
  
   return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#define pb push_back
#define mod 1000000007
using namespace std;
typedef long long int ll;

int n;
int p[111][11];
int f[111][11][11];


int main(void){
  cin>>n;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=5;j++){
      for(int k=1;k<=2;k++){
	cin>>f[i][j][k];
      }
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=0;j<=10;j++){
      cin>>p[i][j];
    }
  }

  int res=-(1e9);
  for(int ii=1;ii<=1023;ii++){
    int tmp=0;
    for(int i=1;i<=n;i++){
      int t=0;
      for(int j=0;j<10;j++){
	if(ii&(1<<j)){
	  if(f[i][((j/2) +1)][((j+2)%2) +1]) t++;
	}
      }
      tmp+=p[i][t];
    }
    res=max(res,tmp);
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
import math

a, b, h, m = map(int, input().split())

theta1 = (60*h+m)/360*math.pi
x1, y1 = a*math.cos(theta1), a*math.sin(theta1)
theta2 = m/30*math.pi
x2, y2 = b*math.cos(theta2), b*math.sin(theta2)

print(math.sqrt((x2-x1)**2+(y2-y1)**2))

Measured memory_bytes: 9508
#include<iostream>
#include<cstdlib>
#include <cmath>
#include<algorithm>
#include<vector>
#include<string>
#include<unordered_map>
#include <bits/stdc++.h>
using namespace std;

int main()
{      
    long long n;
    cin >> n;
    
    long long a[n];
    
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    
    long long all;
    all = a[0];
    for(int i=1; i<n; i++){
        all = all^a[i];
    }
    for(int i=0; i<n; i++){
        long long tmp = all ^ a[i];
        cout << tmp << " ";
    }
    cout << endl;
}


Measured memory_bytes: 5180
#include <stdio.h>
using namespace std;

int main() {
	int a,b;
	scanf("%d %d",&a,&b);
	int s1,s2,s3;
	s1=a+a-1;
	s2=b+b-1;
	s3=a+b;
	printf("%d",s1>s2?(s1>s3?s1:s3):(s2>s3?s2:s3));
	return 0;
}

Measured memory_bytes: 128
K = int(input())
S = input()
N = len(S)
MOD = 10**9 + 7

fct = [1]
invfct = [1]
pow25 = [1]
pow26 = [1]
for i in range(1, K+N+1):
    fct.append(fct[i-1] * i % MOD)
    invfct.append(pow(fct[i], MOD-2, MOD))
    pow25.append(pow25[i-1] * 25 % MOD)
    pow26.append(pow26[i-1] * 26 % MOD)

def cmb(n, k):
    return fct[n] * invfct[k] * invfct[n-k]

ans = 0
for i in range(K+1):
    temp = pow25[i]
    temp *= cmb(i+N-1, N-1)
    temp *= pow26[K-i]
    ans += temp
    ans %= MOD
print(ans)

Measured memory_bytes: 297528
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//const int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

vector<ll> a, b;

int main()
{
	ll n;
	ll ans = 0;
	cin >> n;
	for (ll i = 0; i < n+1; i++){
		ll tmp;
		cin >> tmp;
		a.push_back(tmp);
	}
	for (ll i = 0; i < n; i++) {
		ll tmp;
		cin >> tmp;
		b.push_back(tmp);
	}
	
	for (ll i = 0; i < n; i++) {
		ll tmp = min(a[i], b[i]);
		ans += tmp;
		a[i] -= tmp;
		b[i] -= tmp;

		tmp = min(a[i + 1], b[i]);
		ans += tmp;
		a[i + 1] -= tmp;
		b[i] -= tmp;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 2548
# ABC153e


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10 ** 6)

    h, n = map(int, input().split())
    maho = []
    for _ in range(n):
        maho.append(list(map(int, input().split())))

    # dp[i][j]=i番目までの魔法でモンスターの体力をj減らすためにつかう魔力の最小値
    # dp[i][j]=min(dp[i-1][j],dp[i][j-maho[i][0]])+maho[i][1]

    dp = [[10 ** 12] * (h + 1) for _ in range(3)]
    dp[0][0] = 0
    for i in range(n):
        for j in range(h + 1):
            if j == 0:
                dp[(i + 1) % 3][0] = 0
            dp[(i + 1) % 3][j] = min(dp[i % 3][j],
                                     dp[(i + 1) % 3][max(0, j - maho[i][0])] + maho[i][1])
    print(dp[n % 3][h])


if __name__ == '__main__':
    main()


Measured memory_bytes: 41456
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   string S;
   cin >> S;
   sort(S.begin(), S.end());
   for (int i = 1; i < S.size(); i++) {
      if (S[i - 1] == S[i]) {
         cout << "no" << endl;
         return 0;
      }
   }
   cout << "yes" << endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000

int main(){
	
	int N;
	cin>>N;
	
	vector<int> L(N);
	for(int i=0;i<N;i++){
		cin>>L[i];
	}
	
	sort(L.begin(),L.end());
	
	long long ans = 0;
	
	for(int i=1;i<N;i++){
		for(int j=i+1;j<N;j++){
			int x = distance(lower_bound(L.begin(),L.begin()+i,L[j]-L[i]+1),L.begin()+i);
			if(x<0)continue;
			ans += (long long)x;
			
		}
	}
	
	cout<<ans<<endl;
	
    return 0;
}

Measured memory_bytes: 256
//O(nlogn+mlogm)解
#include <iostream>
#include <algorithm>

using namespace std;

const int INF = 100000;

int main(){
	int n,m;//太郎、花子のそれぞれのカードの枚数
	while(true){
		cin >> n >> m;
		if(n==0 && m==0){
			break;
		}
		int *card1 = new int[n];//太郎
		int *card2 = new int[m];//花子のカード
		int sum1=0;//交換する前のcard1の和
		int sum2=0;//            card2の和
		for(int i=0;i<n;i++){
			cin >> card1[i];
			sum1 += card1[i];
		}
		for(int i=0;i<m;i++){
			cin >> card2[i];
			sum2 += card2[i];
		}

		if(abs(sum1-sum2) %2 == 1){//下コメ参照、(1-2)%2は-1になるので注意
			cout << -1 << endl;
		}else{
			sort(card1,card1+n);//昇順 O(nlogn)
			sort(card2,card2+m);
			//交換して組み合わせが等しい場合に代入。組み合わせがない場合はずっとINF
			int change1 = INF;//太郎が渡す
			int change2 = INF;//花子が渡す
			int idx1 = 0;
			int idx2 = 0;
			int dst = (sum1-sum2)/2;//e1-e2の目標の値(下コメ参照)
			while(idx1 != n && idx2 != m){//O(n+m)
				if(card1[idx1] - card2[idx2] > dst){
					idx2++;//card2[idx2]を増やす
				}else if(card1[idx1] - card2[idx2] < dst){
					idx1++;//card1[idx1]を増やす
				}else if(card1[idx1] - card2[idx2] == dst){
					//交換して和が等しい
					if(change1 + change2 > card1[idx1] + card2[idx2]){
						change1 = card1[idx1];
						change2 = card2[idx2];
					}
					idx1 ++;//とりあえずかたっぽだけ次に進める
				}
			}


			if(change1 == INF){//塗り替えなし、つまり見つからなかった
				cout << -1 << endl;
			}else{
				cout << change1 << ' ' << change2 << endl;
			}
		}//else終わり

		delete[] card1;
		delete[] card2;
	}//while終わり
	return 0;
}
/*
太郎が渡すカードe1
花子が渡すカードe2
交換して和が等しいとき
sum1-e1+e2 = sum2-e2+e1
⇔sum1 - sum2 = 2*(e1 - e2)
⇔(sum1 - sum2)/2 = e1 - e2
を満たすe1、e2を探せばよい。カードの値は整数なので、sum1-sum2が奇数のとき解なし
sum1-sum2の値はO(n+m)で求まる
e1-e2の値を全探索するときO(nm)
*/

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (register int i = a; i <= b; i++)
 

int n, a[200010];

inline void solve(int T) {
   cin >> n;
   if(n >= 30) puts("Yes");
   else puts("No");


}   
int main()
{
    // ios_base::sync_with_stdio(0);
    // cin.tie(0);
    // cout.tie(0);
 
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
 
    int T = 1;
    // cin >> T;
    rep(i, 1, T) solve(i);
    
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI a(n);
	rep(i, n) cin >>a[i];
	
	int ans =0;
	rep(i, n){
		for(int w=a[i]; w%2==0 && w>0; w/=2) ans++;
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
const int nmax=200005;
int dp[nmax];
int n,x,i,ans;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>x;
        dp[x]=max(dp[x],dp[x-1]+1);
        ans=max(ans,dp[x]);
    }
    cout<<n-ans;
    return 0;
}


Measured memory_bytes: 1024
inf = float('inf')

N,W = map(int,input().split())
w, v = [], []
for _ in range(N):
    wi, vi = map(int,input().split())
    w.append(wi)
    v.append(vi)

M = sum(v)

dp = [[inf]*(M+1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(1,N+1):
    for j in range(M+1):
        if j - v[i-1] >= 0:
            dp[i][j] = min(dp[i-1][j], dp[i-1][j-v[i-1]] + w[i-1])
        else:
            dp[i][j] = dp[i-1][j]

for j in range(M+1)[::-1]:
    if dp[N][j] <= W:
        ans = j
        break

print(ans)

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


int main()
{
	ll K;
	cin>>K;
	if(K%2==0||K%5==0)
	{
		cout<<-1<<endl;
		return 0;
	}
	ll v=7%K;
	ll ans=1;
	while(1)
	{
		if(v==0)
		{
			cout<<ans<<endl;
			break;
		}	
		v=v*10+7;
		v%=K;
		ans++;
	}
	return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

template< typename flow_t, typename cost_t >
struct MinCostFlow {
  const cost_t INF;

  struct edge {
    int to;
    flow_t cap;
    cost_t cost;
    int rev;
  };
  vector<vector<edge>> graph;
  vector<cost_t> potential,min_cost;
  vector<int> prevv,preve;

  MinCostFlow(int V) : graph(V),INF(numeric_limits< cost_t >::max()) {}

  void add_edge(int from,int to,flow_t cap,cost_t cost){
    graph[from].emplace_back((edge){to,cap,cost,(int)graph[to].size()});
    graph[to].emplace_back((edge){from,0,-cost,(int)graph[from].size()-1});
  }

  cost_t min_cost_flow(int s,int t,flow_t f){
    int V=(int)graph.size();
    cost_t ret=0;
    using Pi = pair<cost_t,int>;
    priority_queue<Pi,vector<Pi>,greater<Pi>> PQ;
    potential.assign(V,0);
    preve.assign(V,-1);
    prevv.assign(V,-1);

    while(f>0){
      min_cost.assign(V,INF);
      PQ.emplace(0,s);
      min_cost[s]=0;
      while(!PQ.empty()){
        cost_t d;
        int now;
        tie(d,now)=PQ.top();
        PQ.pop();
        if(min_cost[now]<d) continue;
        
        for(int i=0;i<graph[now].size();i++){
          edge &e=graph[now][i];
          cost_t nextCost=min_cost[now]+(e.cost+potential[now]-potential[e.to]);
          if(e.cap>0&&min_cost[e.to]>nextCost){
            min_cost[e.to]=nextCost;
            prevv[e.to]=now;
            preve[e.to]=i;
            PQ.emplace(min_cost[e.to],e.to);
          }
        }
      }

      if(min_cost[t]==INF) return -1;

      for(int v=0;v<V;v++) potential[v]+=min_cost[v];
      flow_t addflow=f;
      for(int v=t;v!=s;v=prevv[v]){
        addflow=min(addflow,graph[prevv[v]][preve[v]].cap);
      }
      f-=addflow;
      ret+=addflow*potential[t];
      
      for(int v=t;v!=s;v=prevv[v]){
        edge &e=graph[prevv[v]][preve[v]];
        e.cap-=addflow;
        graph[v][e.rev].cap+=addflow;
      }
    }
    return ret;
  }
};

int N,M,F;
vector<int> A,B,C,D;

int main(){
  cin>>N>>M>>F;
  A.resize(M);
  B.resize(M);
  C.resize(M);
  D.resize(M);
  for(int i=0;i<M;i++) cin>>A[i]>>B[i]>>C[i]>>D[i];

  MinCostFlow<int,int> mcf(N);
  for(int i=0;i<M;i++){
      mcf.add_edge(A[i],B[i],C[i],D[i]);
  }

  cout<<mcf.min_cost_flow(0,N-1,F)<<endl;

  return 0;
}



Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
#define int long long

signed main(){
    int X,A,B;
    cin >> X >> A >> B;
    
    if(B-A<=0){
        cout << "delicious" << endl;
    }else if(B-A<=X){
        cout << "safe" << endl;
    }else{
        cout << "dangerous" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define ST first
#define ND second
 
ostream& operator<<(ostream &out, string str) {
	for(char c : str) out << c;
	return out;
}
 
template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) {
	return out << "(" << p.ST << ", " << p.ND << ")";
}

template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
	out << '{';
	for(auto &e : x)
        	out << e << (&e == &*--x.end() ? "" : ", ");
	return out << '}';
}

template<class... Args> void dump(Args&&... args) {
	((cerr << args << ";  "), ...);
}
 
#ifdef DEBUG
#  define debug(x...) cerr << "[" #x "]: ", dump(x), cerr << "\n"
#else
#  define debug(...) false
#endif
 
template<class T> int size(T && a) { return (int) a.size(); }
 
using LL = long long;
using PII = pair<int, int>;

mt19937 rng(2137);
int rd(int a, int b) {
	return uniform_int_distribution<int>(a, b)(rng);
}

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

	auto start = chrono::steady_clock::now();

	int d;
	cin >> d;
	const int n = 26;
	vector<int> c(n);
	REP(i, n) cin >> c[i];
	vector<vector<int>> s(d, vector<int>(n));
	REP(i, d) REP(j, n) cin >> s[i][j];

	auto get_score = [&](vector<int> &ans) {
		LL score = 0;
		vector<int> last(n, -1);
		REP(i, d) {
			score += s[i][ans[i]];
			last[ans[i]] = i;
			REP(j, n) score -= c[j] * (i - last[j]);
		}
		return score;
	};

	auto get_time = [&]() {
		auto curr = chrono::steady_clock::now();
		return int(chrono::duration_cast<chrono::milliseconds>(curr - start).count());
	};


	LL inf = 1e18;
	auto init = [&]() {
		vector<int> ans(d), last(n, -1);
		REP(i, d) {
			pair<LL, int> opt = {0, -1};
			REP(j, n)
				opt = max(opt, {s[i][j] + c[j] * (i - last[j]), j});
			ans[i] = opt.ND;
			last[ans[i]] = i;
		}
		return ans;
	};

	vector<int> best = init();
	LL best_score = get_score(best);

	auto try_update = [&](vector<int> &cur) {
		LL new_score = get_score(cur);
		if(new_score >= best_score) {
			best = cur;
			best_score = new_score;
		}
	};

	while(get_time() <= 1950) {
		auto cur = best;
		if(get_time() <= 700) {
			int x = rd(0, d - 1);
			cur[x] = rd(0, 25);
		}
		else {
			int len = rd(3, 30);
			int x = rd(0, d - len);
			shuffle(cur.begin() + x, cur.begin() + x + len, rng);
		}
		try_update(cur);
	}

	for(int x : best)
		cout << x + 1 << "\n";
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

vector<ll> par(1000000);
vector<ll> rnk(1000000);

void init(ll n){
  rep(i, n){
    par.at(i) = i;
    rnk.at(i) = 1;
  }
}

ll root(ll x){
  if(par.at(x) == x){
    return x;
  }
  else{
    par.at(x) = root(par.at(x));
    return par.at(x);
  }
}

bool same(ll x, ll y){
  if(root(x) == root(y)){
    return true;
  }
  else{
    return false;
  }
}

void unite(ll x, ll y){
  x = root(x);
  y = root(y);
  if(x == y){
    return;
  }
  if(rnk.at(x) < rnk.at(y)){
    par.at(x) = y;
    rnk.at(y) += rnk.at(x);
  }
  else{
    par.at(y) = x;
    rnk.at(x) += rnk.at(y);
  }
}

int main()
{
    ll N, M;
    cin >> N >> M;
    init(N);
    vector<ll> A(M), B(M);
    rep(i, M){
        cin >> A.at(i) >> B.at(i);
        A.at(i)--;
        B.at(i)--;
        unite(A.at(i), B.at(i));
    }
    ll ans = 0;
    rep(i, N){
        chmax(ans, rnk.at(i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 22004
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#define lol(i,n) for(ll i=0;i<n;i++)
#define mod 1000000007
#define chmin(a,b) a=min(a,b);
typedef long long ll;

using namespace std;
#define N 200010
ll n,d[N],t,e;
ll BN(ll key){
    ll l=-1,r=n,m=(l+r)/2;
    for(;l<r-1;m=(l+r)/2){
	if(d[m+1]*2<key)l=m;
	else r=m;
    }
    return l;
}
ll f[N],g[N];
int main(){
    cin>>n>>e>>t; d[0]=0;
    lol(i,n)cin>>d[i+1];
    lol(i,N)f[i]=1e18; f[0]=0,g[0]=-2*d[1];
    for(ll i=1;i<=n;i++){
	ll surf=BN(d[i]*2-t);
	ll res=1e17;
	if(surf+1<i)chmin(res,f[surf+1]+t);
	if(~surf)chmin(res,g[surf]+2*d[i]);
	f[i]=res;
	g[i]=min(g[i-1],f[i]-2*d[i+1]);
    }
    cout<<f[n]+e<<endl;
    return 0;
}


Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>

#include<stdio.h>
#include<stdlib.h>

#define ll long long

using namespace std;

int main(){
    int X,A,B;
    cin >> X >> A >> B;
    cout << (X-A)%B << endl;
    return 0;
}


Measured memory_bytes: 256
import copy
import numpy as np
N=input()
N=int(N)
a=list(map(int,input().split()))
b=copy.copy(a)
a.sort(reverse=False)
c=np.array(a)-np.array(b)
NN=np.count_nonzero(c==0)
if N-NN<=2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 12500
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define ll int64_t
const long MOD = 1e9 + 7;


int main()
{
    int a,b,c,d;//かっている数//最大100
  priority_queue<int> v;
    
    cin >> a >> b >> c;
  
  v.push(a);
  v.push(b);
  v.push(c);
	
  a =v.top();
  v.pop();
  b =v.top();
  v.pop();
  c = v.top();


    cout << abs(a-b) + abs(b-c) << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using static System.Console;

class Program
{
	static void Main(string[] args)
	{
		int a, b, c;
		string[] str = ReadLine().Split(' ');
		a = int.Parse(str[0]);
		b = int.Parse(str[1]);
		c = int.Parse(str[2]);

		if ((a == b && a != c) || (a == c && a != b) || (b == c && b != a))
		{
			WriteLine("Yes");
		}
		else WriteLine("No");
	}
}


Measured memory_bytes: 13140
from sys import stdin
from bisect import bisect_right, bisect_left


def input():
    return stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))

    A.sort()
    B.sort()
    C.sort()

    ans = 0
    for b in B:
        ans += bisect_left(A, b) * (N - bisect_right(C, b))

    print(ans)


if __name__ == "__main__":
    main()


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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!

//

void solve(long long N, long long M, std::vector<long long> p,
           std::vector<std::string> S) 
{
  vector<bool> aced(N,false);
  vector<int> cnt(N,0); int ac=0;
  rep(i,M){
    if(S[i]=="AC"){
      if(!aced[p[i]-1]) { aced[p[i]-1] = true; ac++; }
    }
    else if(S[i]=="WA"){
      if(!aced[p[i]-1]) cnt[p[i]-1]++;
    }
  }
  int ret = 0;
  rep(i,N){
    if(aced[i]) ret += cnt[i];
  }
  cout << ac << " " << ret << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  long long N;
  std::cin >> N;
  long long M;
  std::cin >> M;
  std::vector<long long> p(M);
  std::vector<std::string> S(M);
  for (int i = 0; i < M; i++) {
    std::cin >> p[i];
    std::cin >> S[i];
  }
  solve(N, M, std::move(p), std::move(S));
  return 0;
}


Measured memory_bytes: 7364
x1,y1,x2,y2 = (int(x) for x in input().split())

x3=x2-(y2-y1)
y3=y2+(x2-x1)
x4=x3-(y3-y2)
y4=y3+(x3-x2)
print(x3,y3,x4,y4)



Measured memory_bytes: 2940
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

import java.io.BufferedReader;
import java.io.FileReader;

public class Main{
	
	public static void main(String[] args) throws IOException, InterruptedException {
		
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int a = sc.nextInt()-sc.nextInt();
		int c = sc.nextInt();
		
		int f = Math.min(c, a);
		
		if (f == a) {
			out.print(c-a);
		}
		else {
			out.print(0);
		}
		
		out.flush();
	}
		
}	
	
class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}
	
	public Scanner (String file) throws IOException{
        br=new BufferedReader(new FileReader(file));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public char nextChar() throws IOException {
		return next().charAt(0);
	}

	public Long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

	public void waitForInput() throws InterruptedException {
		Thread.sleep(3000);
	}


}



Measured memory_bytes: 23124
import java.util.Scanner;
public class Main {
   public static void main(String[] args){
     Scanner scanner = new Scanner(System.in);
     double r = scanner.nextDouble();
     double s=r*r*Math.PI;
     double c=2*r*Math.PI;
        System.out.print(String.format("%f", s));
         System.out.print(" ");
         System.out.print(String.format("%f", c));
   }   
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


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

  int x[3];
  int dp[3];
  REP (i, 3) dp[i] = 0;
  REP (i, n) {
    REP (j, 3) {
      cin >> x[j];
    }
    int next[3];
    next[0] = max(dp[1], dp[2]) + x[0];
    next[1] = max(dp[0], dp[2]) + x[1];
    next[2] = max(dp[1], dp[0]) + x[2];
    REP (j, 3) dp[j] = next[j];
  }
  
  cout << max({dp[0], dp[1], dp[2]}) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

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

Measured memory_bytes: 688
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
   int f,k,i;
   char c[1022];
   while(gets(c))
   {
       f=0;
       k=strlen(c);
       for(i=0;i<k;i++)
       {
           if(c[i]=='+')
            f++;
            else
            f--;
       }
       printf("%d\n",f);
   }

    return 0;
}

Measured memory_bytes: 128
#pragma  warning (disable:4996)
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#define MAX 1000000
using namespace std;
int amount[MAX];
int vis[MAX];
int prime[MAX];
int main(){
	//memset(vis, 0, sizeof(vis));
	//memset(prime, 0, sizeof(prime));
	fill(prime, prime + MAX, 1);
	prime[0] = prime[1] = 0;
	for (int i = 2; i*i <= MAX; i++){
		if (prime[i]){

			for (int j = i + i; j <= MAX; j += i){

				prime[j] = 0;
			}
		}
	}
	int sum = 0;
	for (int i = 0; i <= MAX; i++){
		if (prime[i]){
			sum++;
		}
		amount[i] = sum;
	}
	int n;
	while (cin >> n){
		cout << amount[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 10828
#include <iostream>
#include <stdlib.h>
#include <string>

using namespace std;

int main(){
  string color1, color2;
  cin >> color1 >> color2;
  int num1, num2;
  cin >> num1 >> num2;
  string sel;
  cin >> sel;
  if(sel == color1)
    num1--;
  else
    num2--;
  cout << num1 << " " << num2 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define N 200010
#define lint long long
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
using namespace std;
char s[N];int nxt[N];
struct E{
	lint len,cnt[26];E() { len=0,memset(cnt,0,sizeof cnt); }
	inline E operator=(const E &e)
	{	return len=e.len,memcpy(cnt,e.cnt,sizeof cnt),*this;	}
	inline E operator+(const E &e)const
	{
		E res;res=*this;
		for(int i=0;i<26;i++) res.cnt[i]+=e.cnt[i];
		return res.len+=e.len,res;
	}
	inline E operator-(const E &e)const
	{
		E res;res=*this;
		for(int i=0;i<26;i++) res.cnt[i]-=e.cnt[i];
		return res.len-=e.len,res;
	}
	inline E operator+=(const E &e) { return (*this)=(*this)+e; }
}a[1010];
inline int getg(char *s,int n)
{
	for(int i=2;i<=n;i++)
	{
		int &j=nxt[i];j=nxt[i-1];
		while(j&&s[j+1]!=s[i]) j=nxt[j];
		if(s[j+1]==s[i]) j++;
	}
	return n-nxt[n];
}
inline E query(lint n,int c)
{
	E ans;
	for(int i=c;i>=1;i--)
		if(n>=a[i].len) n-=a[i].len,ans+=a[i];
	for(int i=1;i<=n;i++) ans.cnt[s[i]-'a']++;
	return ans;
}
int main()
{
	scanf("%s",s+1);int n=(int)strlen(s+1),c=2;
	int k=n/2,g=getg(s,k);lint l,r;cin>>l>>r;
	for(int i=1;i<=k;i++) a[1].cnt[s[i]-'a']++;
	a[2]=a[1],a[1].len=k,a[2].len=k+g;
	for(int i=1;i<=g;i++) a[2].cnt[s[i]-'a']++;
	while(a[c-1].len+a[c].len<=r) c++,a[c]=a[c-1]+a[c-2];
	E ans=query(r,c);
	ans=ans-query(l-1,c);
	for(int i=0;i<26;i++) printf("%lld ",ans.cnt[i]);
	return !printf("\n");
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int n, x, y; cin >> n >> x >> y;
    map<int, int> ans;
    int sc = y-x-1;
    x--; y--;
    rep(i, n) FOR(j, i+1, n) {
        int distance = j-i;
        distance = min(distance, abs(i-x)+1+abs(j-y));
        ans[distance]++;
    }
    rep(i, n-1) {
        cout << ans[i+1] << endl;
    }
}

Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll k,s;
    ll ans = 0;
    cin >> k >> s;
    rp(i,k+1) rp(j,k+1){
        if(i+j<= s && s-i-j <= k) ans++;
    }
    cout << ans<<endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include <iostream>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define rng(a) a.begin(),a.end()
typedef long long ll;

using namespace std;



int main() {
    string s;
    cin>>s;
    rep(i,3){
        if(s[i]==s[i+1]){
            cout<<"Bad"<<endl;
            return 0;
        }
    }
    cout<<"Good"<<endl;
    return 0;
}

Measured memory_bytes: 3544
a, b, c, d = map(int, input().split())
N = int(input())
s = N //2
ans = 0

ans += s * min(a*8, b*4, c*2, d)

if N % 2 == 0:
    pass
else:
    ans += min(a*4, b*2, c)

print(ans)

Measured memory_bytes: 3060