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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll MOD = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    string s; cin>>s;
    ll ans=0,n=s.size(),cnt=0;
    rep(i,n){
            if(s[i]=='A'||s[i]=='G'||s[i]=='T'||s[i]=='C'){
            cnt++;
            }else{
                ans=max(ans,cnt);
            cnt=0;
            }
        }
    ans=max(ans,cnt);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
using ping = pair<ll, ll>;

int main(){
    ll N;
    cin >> N;
    ll cnt = 0;
    for (int i = 1; i <= N; i++) {
      if (i % 3 == 0 || i % 5 == 0)
        continue;
      else
        cnt += i;
    }
    cout << cnt << endl;
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<pair<int,int>> p(n);
    for(int i = 1; i <= n; i++){
        int a;
        cin >> a;
        int b = i;
        p.at(i-1) = make_pair(a,b);
    }
    sort(p.begin(), p.end());
    for(int i = 0; i < n; i++){
        if(i != n-1){
            cout << p.at(i).second << ' ';
        } else {
            cout << p.at(i).second;
        }
    }
}

Measured memory_bytes: 1536
import sys

"""
# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
# 電球iがつながっているスイッチに関するリストが得られる
# xorを使うと効率的に解けた気がするが...
# xor (1,1) = 0, (0, 0) = 0 / (1, 0) = 1, (0, 1) = 1
if __name__ == "__main__":
    N, M = map(int, sys.stdin.readline().split())
    L = [list(map(int,list(sys.stdin.readline().split()))) for i in range(M)]
    cond = list(map(int, sys.stdin.readline().split()))

    cnt = 0
    for sw_bit in range(1 << N):
        flag = True
        for l, c in zip(L, cond):
            bit = 0
            for e in l[1::]:
                bit |= (1 << (e - 1))
            # 点灯判定を上手くやりたい
            bit &= sw_bit
            if bin(bit).count("1") % 2 != c:
                flag = False
                break
        if flag:
            cnt += 1
    print(cnt)

Measured memory_bytes: 3064
# AtCoDeerくんとTopCoDeerくんが何と言ってるかを a,bで入力
a,b = input().split()
# もしa=Hでb=HならTopCoDeerくんは正直者
if a == "H" and b == "H":
    print("H")
# もしa=Dでb=HならTopCoDeerくんは正直者
elif a == "D" and b == "D":
    print("H")
# それ以外はbは嘘つき
else:
    print("D")

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

#define scd second;
#define fst first;
#define mkp make_pair
#define pb push_back
#define pf push_front

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vlong;
typedef vector<vint> vvint;
typedef vector<vlong> vvlong;

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

	int a, b, c, d, t=1;
	cin>>a>>b>>c>>d;
	while(a>0 && c>0){
		if(t){
			c-=b;
		} else {
			a-=d;
		}
		t=t^1;
	}
	if(a>0) cout<<"Yes\n";
	else cout<<"No\n";
}

Measured memory_bytes: 3544
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <math.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;

int n;
int a[21], b[51], c[51];
int ans = 0;

int main() {
   cin >> n;
   rep(i, n) cin >> a[i];
   rep(i, n) cin >> b[i];
   rep(i, n-1) cin >> c[i];

   rep(i, n) {
      if (a[i+1] == a[i] + 1) ans += c[a[i]-1];
      ans += b[a[i]-1];
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>


typedef long long ll;

using namespace std;

int main() 
{ 
    int a, b;
	cin >> a >> b;

	int res = 0;

	while (a > 0){
		a-=b;
		res++;
	}

	cout << res << endl;

	return 0; 
} 


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

class Program
{
    static void Main()
    {
        var N = Int32.Parse(Console.ReadLine());
        var sameLetters = string.Empty;
        for (int i=0;i<N;++i)
        {
            var newSameLetters = string.Empty;
            var str = Console.ReadLine().OrderBy(x=>x).ToArray();
            var sIndex = 0;
            for (int j=0;j<str.Length;++j)
            {
                if(0 < sameLetters.Length)
                {
                    while (sameLetters[sIndex] < str[j])
                    {
                        if (sameLetters.Length-1 <= sIndex) break;
                        sIndex++;
                    }
                    if (sameLetters[sIndex] == str[j])
                    {
                        newSameLetters += str[j];
                        sIndex++;
                        if (sameLetters.Length  <= sIndex) break;
                    }
                }
                if (i == 0) newSameLetters += str[j];
            }
            sameLetters = newSameLetters;
        }
        Console.WriteLine(sameLetters);
    }
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int ans=0;
    rep(i, n-1) {
        if (i+1 == a[i]) {
            swap(a[i], a[i+1]);
            ans++;
        }
    }
    if (n == a[n-1]) {
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int n,d,x,a[105];
int main()
{
	cin>>n>>d>>x;
	for(int i=0;i<n;i++)
		cin>>a[i];
	int ans=x;
	for(int i=0;i<n;i++)
	{
		for(int j=1;j<=d;j+=a[i])
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
from sys import stdin, stdout, stderr

while 1:
    n, p = map(int, stdin.readline().split())

    if n + p == 0:
        break

    a = [0] * n
    wan = p

    for i in range(10**6):
        if wan > 0:
            a[i % n] += 1
            wan -= 1
        else:
            wan += a[i % n]
            a[i % n] = 0

        if a[i % n] == p:
            print(i % n)
            break

Measured memory_bytes: 7508
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

bool safe(int N, int C, int k) {
  // A + Ck = N - 1
  int A = N - 1 - C * k;
  if (A <= 0) return false;
  // C = A - B
  int B = A - C;
  if (B <= 0 || B > A) return false;
  if (A % C != 0) return true;
  return (A / C) > k;
}

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N;
  while (cin >> N) {
    vector<ll> S(N);
    for (ll& x : S) cin >> x;
    ll res = 0;
    for (int C = 1; C < N; C++) {
      ll sum = 0;
      for (int k = 1; k * C < N; k++) {
        sum += S[k * C] + S[N - 1 - k * C];
        if (safe(N, C, k)) {
          chmax(res, sum);
        }
      }
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include<string>
#include<iostream>
using namespace std;
int n,h=0,ans1,ans2;
string s,s1;
int main()
{
	cin>>s;
	s1=s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='0' && s[i+1]=='0')
		{
			s[i+1]='1';
			ans1++;
		}
		if(s[i]=='1' && s[i+1]=='1')
		{
			s[i+1]='0';
			ans1++;
		}
	}
	s=s1;
	ans2++;
	s[0]++;
	s[0]%=2;
	for(int i=1;i<s.size();i++)
	{
		if(s[i-1]=='0' && s[i]=='0')
		{
			s[i]='1';
			ans2++;
		}
		if(s[i-1]=='1' && s[i]=='1')
		{
			s[i]='0';
			ans2++;
		}
	}
	cout<<min(ans1,ans2)<<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int sequenceNum = 0;
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<double> x(2*n), y(2*n), x1(n), y1(n), x2(n), y2(n);
        for(int i=0; i<n; ++i){
            double x0, y0, r;
            cin >> x0 >> y0 >> r;
            x[2*i] = x1[i] = x0 - r;
            x[2*i+1] = x2[i] = x0 + r;
            y[2*i] = y1[i] = y0 - r;
            y[2*i+1] = y2[i] = y0 + r;
        }
        sort(x.begin(), x.end());
        sort(y.begin(), y.end());

        double ret = 0.0;
        for(int i=0; i<2*n-1; ++i){
            for(int j=0; j<2*n-1; ++j){
                for(int k=0; k<n; ++k){
                    if(x1[k] <= x[i] && x[i+1] <= x2[k] && y1[k] <= y[j] && y[j+1] <= y2[k]){
                        ret += (y[j+1] - y[j]) * (x[i+1] - x[i]);
                        break;
                    }
                }
            }
        }
        printf("%d %.02f\n", ++sequenceNum, ret);
    }
}

Measured memory_bytes: 988
#include <bits/stdc++.h>
const int M = 1e4+10;
using namespace std;
int cnt;
vector<int> arr,vec[M];
set<int> st;
int in[M];
void go(){
  	while(!st.empty()){
    	int u=*st.begin();
   		st.erase(st.begin());
    	arr.push_back(u);
    	cnt++;
    	for(int i=0;i!=vec[u].size();i++){
      		in[vec[u][i]]--;
      		if(!in[vec[u][i]])
        		st.insert(vec[u][i]);
    	}
  	}
}
main(){
  	int n,m;
  	cin>>n>>m;
 	for(int i=1;i<=m;i++){
		int x,y;
   		cin>>x>>y;
    	vec[x].push_back(y);
  		in[y]++;
  	}
 	for(int i=0;i<n;i++)
    	if(!in[i])
      		st.insert(i);
  	go();
  	for(int i=0;i<n;i++)
		cout<<arr[i]<<endl;
}

Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


const int INF=1e9;


const int MAX_N = 110, MAX_W=10010;
int dp[MAX_W];

int main(){
	int n, W;
	cin>>n>>W;
	vi v(n, 0), w(n, 0);
	rep(i, n) cin>>v[i]>>w[i];

	for(int i = 0; i < n; i++){
		for(int j = w[i]; j <=W; j++){
			dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
		}
	}
	cout<<dp[W]<<endl;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
ll mod=1000000005;
using namespace std;

int main(){
	ll a,b,c,d;
	cin>>a>>b>>c>>d;

	
	ll p = a*c;
	ll q=a*d;
	ll r=b*c;
	ll s=b*d;

	cout<<max(p,max(q,max(r,s)))<<endl;
}

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

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

int main() {
    int N,M=0;
    cin >> N;
    int A[N+1];
    int B[N+1]={};
    for(int i=1;i<=N;i++) cin >> A[i];
    vector<int> res;
    for(int i=N;1<=i;i--){
        int count = 0;
        for(int j=i*2;j<=N;j+=i) if(B[j]) count++;
        if(count%2 != A[i]){
            M++;
            B[i] = 1;
            res.emplace_back(i);
        }
    }
    cout << M << endl;
    for(auto r : res) cout << r << " ";
    return 0;
}

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

#include <iostream>
#include <array>
// #include <map>
// #include <string>
// #include <algorithm>
// #include <numeric>
// #include <limits>

using namespace std;

array<int, 100002> box; // use key 100001

int n;
int min_;
int max_;

int solve() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> min_ >> max_;
		for (int j = min_; j <= max_; j++) {
			box[j]++;
		}
	}
	for (int i = n + 1; i >= 0; i--) {
		//std::cout << "debug " << i << " " << box[i] << std::endl; // debug
		if (i - 1 <= box[i]) {
			return i - 1;
		}
	}
	return 0;
}

int main() {

	cout << solve() << endl;

	//std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	return 0;
}

Measured memory_bytes: 3424
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args)  {
	Scanner in = new Scanner(System.in);
	int n = in.nextInt(),m = in.nextInt();;	
	ArrayList<String> a = new ArrayList<>(n);
	for (int i = 0; i < n; i++) {
		String y = in.next();
		a.add(y);
	}
	Collections.sort(a);	
	for (int i = 0; i < n; i++) {
		System.out.print(a.get(i));
	}	
	System.out.println();
		
	}
	
}



Measured memory_bytes: 29684
import java.util.*;
public class Main {

	public static void main(String[] args) {
		String S = new Scanner(System.in).next();
		int N = S.length();
		int ans = 0;
		int[][] dp = new int[2][2019];
		for(int i = 0; i < N; i++) {
			int s = Character.getNumericValue(S.charAt(i));
			dp[1][s] = 1;
			for(int j = 0; j < 2019; j++)
				dp[1][(j*10+s)%2019] += dp[0][j];
			ans += dp[1][0];
			dp[0] = dp[1].clone();
			Arrays.fill(dp[1], 0);
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 47360
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int n;
int a[100000];

signed main() {
	int i;
	
	cin >> n;
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	
	int ans = 1;
	int INF = (1e+18);
	for (i = 0; i < n; i++) {
		if (a[i] > INF / ans) {
			cout << "-1" << endl;
			return 0;
		}
		ans *= a[i];
		if (ans == 0) break;
	}
	if (ans > INF) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4420
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int a,b;
  cin>>a>>b;
  if(b%a==0) cout<<a+b<<endl;
  else cout<<b-a<<endl;

  return 0;
}


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

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

int dist[10][10];

int main() {
    int H, W;
    cin >> H >> W;
    rep(i, 10) rep(j, 10) {
        int c;
        cin >> c;
        dist[i][j] = c;
    }
    for (int k=0; k<10; ++k) {
        for (int i=0; i<10; ++i) {
            for (int j=0; j<10; ++j) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    ll ans = 0;
    rep(i, H) rep(j, W) {
        int a;
        cin >> a;
        if (a == -1) continue;
        else ans += (ll)dist[a][1];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = map(int, input().split())
c = Counter(A)
summ = 0
for k, v in c.items():
    summ += k * v
Q = int(input())
for _ in range(Q):
    B, Q = map(int, input().split())
    summ += Q * c[B] - B * c[B]
    c[Q] += c[B]
    c[B] = 0
    print(summ)


Measured memory_bytes: 22076
#include <bits/stdc++.h>
#define inf (long long)1e16
using namespace std;

struct data {
  long long p, d;
};

bool operator<(const data &l, const data &r) {
  if(l.d != r.d) return l.d > r.d;
  return l.p > r.p;
}

long long n;
long long dis[100005] = {0};
vector<data> edge[100005];
priority_queue<data> pq;

void solve();

int main() {
  cin >> n;
  for(int i = 0; i < n - 1; ++i) {
    long long x, y, d;
    cin >> x >> y >> d;
    --x, --y;
    edge[x].push_back({y, d});
    edge[y].push_back({x, d});
  }
  solve();
  for(int i = 0; i < n; ++i) cout << dis[i] % 2 << endl;
  return 0;
}

void solve() {
  for(int i = 0; i < n; ++i) dis[i] = inf;
  dis[0] = 0;
  pq.push({0, 0});
  while(pq.size() > 0) {
    data now = pq.top();
    pq.pop();
    for(int i = 0; i < edge[now.p].size(); ++i) {
      data nextp = now;
      nextp.d += edge[now.p][i].d;
      nextp.p = edge[now.p][i].p;
      if(nextp.d < dis[nextp.p]) {
        dis[nextp.p] = nextp.d;
        pq.push(nextp);
      }
    }
  }
}

Measured memory_bytes: 9728
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[10**9]*n
dp[0]=0
for i in range(n):
  for j in range(i+1,min(i+k+1,n)):
    d=dp[i]+abs(h[i]-h[j])
    if d<dp[j]:
      dp[j]=d
print(dp[n-1])      
      
      
  

Measured memory_bytes: 52448
#include <algorithm>
#include <cstdint>
#include <limits>
#include <vector>

// verified @ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A
template <typename T>
class segtree
{
  private:
    std::size_t N;
    std::vector<T> data;

    T query(std::size_t a, std::size_t b, std::size_t k, std::size_t l, std::size_t r)
    {
        if (r <= a || b <= l)
        {
            return std::numeric_limits<T>::max();
        }
        if (a <= l && r <= b)
        {
            return data[k];
        }
        size_t m = (l + r) / 2;
        return std::min(query(a, b, k * 2 + 1, l, m), query(a, b, k * 2 + 2, m, r));
    }

  public:
    segtree(const std::size_t n, const T init)
    {
        N = 1;
        while (N < n)
        {
            N *= 2;
        }
        data.resize(N * 2, init);
    }

    void update(std::size_t k, T a)
    {
        k += N - 1;
        data[k] = a;
        while (k > 0)
        {
            k = (k - 1) / 2;
            data[k] = std::min(data[k * 2 + 1], data[k * 2 + 2]);
        }
    }

    T query(std::size_t a, std::size_t b)
    {
        return query(a, b, 0, 0, N);
    }
};

#include <iostream>

using namespace std;

int main()
{
    size_t n, q;
    cin >> n >> q;

    segtree<uint64_t> tree(n, (1ull << 31) - 1);

    for (size_t i = 0; i < q; i++)
    {
        int comp, x, y;
        cin >> comp >> x >> y;
        if (comp == 0)
        {
            tree.update(x, y);
        }
        else
        {
            cout << tree.query(x, y + 1) << endl;
        }
    }
}


Measured memory_bytes: 4920
lst = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(lst[K-1])


Measured memory_bytes: 2940
#include<iostream>

using namespace std;

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;

	if (A * B < C * D) {
		cout << C * D << endl;
	}
	else if (A * B > C* D) {
		cout << A * B << endl;
	}
	else cout << A * B << endl;

	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Control.Applicative
solve :: [String] -> [String]
solve ("0":_) = []
solve (n:ss:lines) =
    let n' = read n :: Double in
    let ss' = [read s | s<-words ss] :: [Double] in
    let m = sum ss' / n' in
    let alpha = sqrt (sum [(s - m)^2 | s<-ss'] / n') in
    (show alpha) : solve lines

main = mapM_ putStrLn =<< solve . lines <$> getContents 


Measured memory_bytes: 4916
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X;
  cin>>X;
  if(X==2){
    cout<<2;
    return 0;
  }
  

  for(int i=X;i<=110000;i++){
    for(int j=2;j<i;j++){
      if(i%j==0){
        break;
      }
      if(i-1==j){
        cout<<i;
        return 0;
    }
  }
}
}

      


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

a = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            yield i + n//i - 2
            # if i != n // i:
            #     yield n//i

print(min([x for x in make_divisors(a)]))

Measured memory_bytes: 3064
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    while(sc.hasNext()) {
      double[][] point = new double[4][2];
      for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 2; j++) {
          point[i][j] = sc.nextDouble();
        }
      }
      if(point[0][0] <= point[3][0] &&
         point[0][1] <= point[3][1] &&
         point[1][0] >= point[2][0] &&
         point[1][1] >= point[2][1] ) {
        System.out.println("YES");
      }
      else {
        System.out.println("NO");
      }
    }
  }
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;

const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE
_int used[3][200010], mem[3][200010];
const Int INF = 1e9; // ~ 1.15 * 1e18
signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string str;
  cin>>str;
  Int N = str.size();

  const Int null = 29;
  function<Int(Int, Int)> dfs = [&](Int len, Int idx){
    if(idx == N) return 0;
    if(used[len][idx]++) return mem[len][idx];

    Int a = -INF, b = -INF;
    char p1 = len == 2? str[idx-2] - 'a':29;
    char p2 = idx > 0? str[idx-1] - 'a':29;

    if(idx+1 <= N){
      Int ch1 = null;
      Int ch2 = str[idx] - 'a';
      if(p1 != ch1 || p2 != ch2) a = dfs(1, idx + 1) + 1;
    }

    if(idx+2 <= N){
      Int ch1 = str[idx] - 'a';
      Int ch2 = str[idx+1] - 'a';
      if(p1 != ch1 || p2 != ch2) b = dfs(2, idx + 2) + 1;
    }
    Int res = max(a, b);
    return mem[len][idx] = res;
  };

  Int ans = dfs(0, 0);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 28564
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>

using namespace std;

typedef long long llong;
typedef pair<llong,int> PA;

const llong INF = 100001000010000100LL;

llong min_cost[100010];
llong h[100010];

int main()
{
    
    int n,m,x;
    llong a,b,t;
    vector<PA> vec[300010];
    
    cin >> n >> m >> x;
    for(int i=1;i<=n;i++){
        cin >> h[i];
    }
    
    for(int i=0;i<m;i++){
        cin >> a >> b >> t;
        vec[a].push_back(PA(t,b));
        vec[b].push_back(PA(t,a));
    }
    
    priority_queue<PA,vector<PA>,greater<PA> > pq;
    
    for(int i=0;i<=n;i++){
        min_cost[i] = INF;
    }
    
    min_cost[1] = 0;
    pq.push(PA(0,1));
    
    while(!pq.empty()){
        PA p = pq.top();
        pq.pop();
        
        for(int i=0;i<vec[p.second].size();i++){
            if(h[p.second] < vec[p.second][i].first) continue;
            
            llong cost = p.first + vec[p.second][i].first;
            int to = vec[p.second][i].second;
            if(x-cost > h[to]) cost += (x-cost)-h[to];
            
            if(min_cost[to] > cost){
                min_cost[to] = cost;
                pq.push(PA(cost,to));
            }
        }
        
    }
    if(min_cost[n] == INF) cout << -1 << endl;
    else cout << min_cost[n]+(min_cost[n]-x)+h[n] << endl;
    
    return(0);
}


Measured memory_bytes: 27720
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

int main()
{
    int a, b, c;

    cin >> a >> b >> c;

    int maxm = max(a, max(b, c));
    if(maxm == a + b + c - maxm)
    	cout << "Yes" << endl;
    else
    	cout << "No" << endl;
}

Measured memory_bytes: 256
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

/* see https://github.com/pllk/cphb/ */
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
    tree_order_statistics_node_update> indexed_set;

typedef unsigned int uint;
typedef long long ll;
typedef __int128 lll;

#define fori(n) for(ll i=0; i<(n); i++)
#define forn(i, n) for(ll i=0; i<(n); i++)
#define forn3(i, x, n) for(ll i=(x); i<(n); i++)

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> a(n);
    fori(n)
        cin>>a[i];

    sort(a.begin(), a.end());
    
    vector<pair<ll, ll>> ans;
    ll sum=0;
    if(a[0]>=0) { // no negative
        sum=a[0];
        for(int i=1;i<n-1; i++) {
            ans.push_back({ sum, a[i] });
            sum-=a[i];
        }
        ans.push_back({ a[n-1], sum });
        sum=a[n-1]-sum;
    } else if(a[n-1]<=0) { // no positive
        sum=a[n-1];
        for(int i=0; i<n-1; i++) {
            ans.push_back({ sum, a[i] });
            sum-=a[i];
        }
    } else { // mixed
/* use one neg, subtract all pos except one.
 * use that one pos, subtract all other neg.
 */
        int firstPos=-1;    // position of first positive
        for(int i=0; i<n; i++)
            if(a[i]>=0) {
                firstPos=i;
                break;
            }

        sum=a[0];
        for(int i=firstPos; i<n-1; i++) {
            ans.push_back({ sum, a[i] });
            sum-=a[i];
        }
        ans.push_back({ a[n-1], sum });
        sum=a[n-1]-sum;

        for(int i=1; i<firstPos; i++) {
            ans.push_back({ sum, a[i] });
            sum-=a[i];
        }
    }

    cout<<sum<<endl;
    for(auto p : ans)
        cout<<p.first<<" "<<p.second<<endl;
}



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

int main(){
	long long int n;
	cin>>n;
	
	long long int i;
	
	for(i=1;i*i<=n;i++){
		
	}
	
	cout<<(i-1)*(i-1)<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        String S = ns();
        Character c = S.charAt(0);
        if(Character.isUpperCase(c)){
            out.println("A");
        }else{
            out.println("a");
        }
    }

 
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 32776
input()
card = list(map(int,input().split()))
card.sort(reverse=True)
alice_turn = 1
alice = 0
bob = 0
for n in card:
  if alice_turn == 1:
    alice += n
    alice_turn = 0
  else:
    bob += n
    alice_turn = 1
print(alice-bob)

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

using namespace std;

long long a(int n) {// レベルnバーガーの厚さ
    return (1LL << (n + 2)) - 3;
}

long long p(int n) {// レベルnバーガーに含まれるパティの枚数
    return (1LL << (n + 1)) - 1;
}

long long solve(int n, long long x) {
    if (n == 0) return 1;
    
    auto aa = a(n - 1);
    auto pp = p(n - 1);
    
    if (x == 1) return 0;
    else if (x <= aa + 1) return solve(n - 1, x - 1);
    else if (x == aa + 2) return pp + 1;
    else if (x <= (aa + 1) * 2) return pp + 1 + solve(n - 1, x - aa - 2);
    else return pp * 2 + 1;
}

int main() {
    int N;
    long long X;

    cin >> N >> X;
    cout << solve(N, X) << endl;
    return 0;
}


Measured memory_bytes: 256
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

/* see https://github.com/pllk/cphb/ */
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
        tree_order_statistics_node_update> indexed_set;

typedef unsigned int uint;
typedef long long ll;

#define fori(n) for(ll i=0; i<(n); i++)
#define forn(i, n) for(ll i=0; i<(n); i++)
#define forn3(i, x, n) for(ll i=(x); i<(n); i++)

int main() {
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int p, q, r;
    cin>>p>>q>>r;

    int ans=p+q;
    ans=min(ans, p+r);
    ans=min(ans, q+r);
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9+5;

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n;
    cin>>n;
    vector<int> v(n);

    for(auto &i:v)        cin>>i;

    vector<int> dp(n,INF);

    dp[0]=0;
    for(int i=0 ; i<n ; i++)
    {
        for(int j:{i+1,i+2})
            {
                if(j<n)
                    dp[j]=min(dp[j], dp[i] + abs(v[i]-v[j]));
            }
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;
// const int MOD = 998244353;

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

   int X, Y;
   cin >> X >> Y;
   rep(a, 0, 100) {
      rep(b, 0, 100) {
         if (a + b == X && 2 * a + 4 * b == Y) {
            cout << "Yes" << endl;
            return 0;
         }
      }
   }
   cout << "No" << endl;
   return 0;
}

Measured memory_bytes: 3648
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

struct Edge {
  int to;
  LL cost;
  Edge(int a, LL b) : to(a), cost(b) {}
};

typedef pair<LL, int> P;  // cost, vertex_idx

vector<vector<Edge>> G1, G2;

vector<LL> dijkstra(int s, const vector<vector<Edge>>& G) {
  priority_queue<P, vector<P>, greater<P>> que;
  vector<LL> d(G.size(), LLONG_MAX);

  d[s] = 0;
  que.push(P(0, s));

  while (!que.empty()) {
    auto p = que.top(); que.pop();
    LL dist = p.first;
    int v = p.second;

    if (d[v] < dist) continue;
    for (const auto& e : G[v]) {
      if (d[e.to] > d[v] + e.cost) {
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }

  return d;
}

int main() {
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  G1.resize(n + 1);
  G2.resize(n + 1);
  for (int i = 0; i < m; ++i) {
    int u, v;
    LL a, b;
    cin >> u >> v >> a >> b;
    G1[u].push_back(Edge(v, a));
    G1[v].push_back(Edge(u, a));
    G2[u].push_back(Edge(v, b));
    G2[v].push_back(Edge(u, b));
  }

  auto d1 = dijkstra(s, G1);
  auto d2 = dijkstra(t, G2);
  priority_queue<P, vector<P>, greater<P>> que;
  for (int i = 1; i <= n; ++i) {
    que.push({d1[i] + d2[i], i});
  }

  LL x = 1e15;
  for (int i = 1; i <= n; ++i) {
    while (que.top().second < i && !que.empty()) que.pop();
    cout << x - que.top().first << endl;
  }
}


Measured memory_bytes: 19836
n,m = map(int,input().split())
chk = [0]*n
for i in range(m):
  a,b = map(int,input().split())
  chk[a-1] += 1
  chk[b-1] += 1
ans = 'YES'
for i in chk:
  if i % 2  == 1:
    ans = 'NO'
print(ans)

Measured memory_bytes: 3828
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;


int main(){
    int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int a = x2 - x1;
    int b = y2 - y1;
    int x4 = x1 - b;
    int y4 = y1 + a;
    int x3 = x4 + x2 - x1;
    int y3 = y4 + y2 - y1;
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << "\n";
}


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

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, W;
  cin >> n >> W;

  vector<llong> w(n), v(n);
  REP(i,n){
    cin >> w[i] >> v[i];
  }

  llong dp[2][100001];
  REP(i, n * 1000 + 1){
    dp[0][i] = 1ll << 50;
  }

  dp[0][0] = 0;

  REP(i,n){
    int pre = i % 2, next = (i+1) % 2;
    REP(j, n * 1000 + 1){
      if(j - v[i] >= 0)
        dp[next][j] = min(dp[pre][j], dp[pre][j-v[i]] + w[i]);
      else
        dp[next][j] = dp[pre][j];
    }
  }

  llong ans = 0;
  REP(i,n * 1000 + 1){
    if(dp[n%2][i] <= W && dp[n%2][i] > 0){
      ans = i;
    }
  }

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


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define INF (1<<10)
using namespace std;

string s;
vector<int> idx;
vector<char> c;
char lis[7]={'0','1','+','-','*','(',')'};
int ans=-1, p, flag;

bool check(){

  int r=0, f=0;

  for(int i=p;i<s.size();i++){
    if(r==1&&(s[i]=='+'||s[i]=='-'||s[i]=='*')) f=1;
    if(s[i]=='(') r++;
    if(s[i]==')') r--;
    if(r==0) break;
  }
  
  return f==1;
}

int bnf();

int bnf3(){

  int res=0;
  
  if(s[p]=='('){
    
    bool r=check();
    
    p++;
    res=bnf();
    p++;
   
    if(!r) flag=1;
    
    return res;
  }

  if(!('0'<=s[p]&&s[p]<='1')) flag=1;
  
  while('0'<=s[p]&&s[p]<='1'){
    res=res*2+s[p]-'0', p++;
    if(res>=INF||res<0) flag=1;
  }

  return res;
}

int bnf2(){
  
  int res=bnf3();
  
  while(p<s.size()){
    
    if(s[p]=='*'){
      p++;
      res=res*bnf3();
      if(res>=INF) flag=1;
    }else{
      if(p<s.size()&&s[p]!=')'&&s[p]!='+'&&s[p]!='-') flag=1;
      break;
    }
    
  }

  return res;
}

int bnf(){

  int res=bnf2();
  
  while(p<s.size()){
    
    if(s[p]=='+'){
      p++;
      res=res+bnf2();
      if(res>=INF) flag=1;
    }
    else if(s[p]=='-'){
      p++;
      res=res-bnf2();
      if(res<0) flag=1;
    }else{
      if(p<s.size()&&s[p]!=')') flag=1;
      break;
    }
  }
  
  return res;
}

bool check2(){
  
  int r=0;
  
  for(int i=0;i<s.size();i++){
    if(s[i]=='(') r++;
    if(s[i]==')'){
      if(!r) return false;
      r--;
    }
  }

  if(r) return false;

  return true;
}

void dfs(int x){
  
  if(x==idx.size()){
    
    for(int i=0;i<idx.size();i++)
      s[idx[i]]=c[i];
    
    p=0, flag=0;
    
    if(!check2()) return ;
    
    int r=bnf();
    
    if(r>=INF||flag) return ;

    ans=max(ans,r);
    
    return ;
  }
  
  for(int i=0;i<7;i++){
    
    c[x]=lis[i];
    
    dfs(x+1);
    
  }
  
}

int main(){

  cin>>s;
  
  for(int i=0;i<s.size();i++)
    if(s[i]=='.') idx.push_back(i);

  c.resize(idx.size());

  dfs(0);
  
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 3204
N, K = map(int, input().split(" "))
v = list(map(int, input().split(" ")))

pick_max = min(N, K)
ans = 0
for left in range(pick_max + 1):
    for right in range(pick_max - left + 1):
        t = v[:left] + v[N - right:]
        m = sorted(filter(lambda x: x < 0, t))[:K - left - right]
        ans = max(ans, sum(t) - sum(m))
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (2147483647)
#define mod (1000000007)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)

void solve()
{
    int h,a;cin>>h>>a;
    cout<<(h-1)/a+1<<endl;
}

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

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<iostream>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define rep(i, c) for(int i = 0; i < (int)c; i++)
const ll inf = ll(1e18)+1;

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

	vector<ll> a(n);

	rep(i,n) {
		cin >> a[i];
	}

	for (int i = 0; i < n - k;i++) {
		if (a[i] < a[i+k]) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 4840
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<bitset>
#include<unordered_map> 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fio ios_base::sync_with_stdio(false)
#define mod 1000000007
#define mod1 mod
#define mod2 100000009
#define li long long int
#define ll long long int
// #define INT_MAX 5000000
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s", x)
#define readl(x) scanf("%I64d",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define si short int
#define INTMAX 1000000000
#define MAXN 1000000000000000000
#define MINN -1000000000000000000
// #define INTMAX 1000001000
#define pii pair<ll,ll> 
#define pdd pair<double,double>
#define pic pair<int,char>
#define N 700010
#define lgn 20
#define ddouble long double
#define minus minu
#define lgn 20

// #define INTMAX 200000000  
// using namespace boost;
// #define si short int

using namespace std;
using namespace __gnu_pbds;             
typedef priority_queue<ll, vector<ll > > max_pq;
// typedef priority_queue<pii, vector<pii> , greater<pii >  > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}

// using namespace __gnu_pbds;         
// typedef priority_queue<pair<ll,char> , vector<pair<ll , char> > > max_pq;
// typedef priority_queue<pii , vector<pii > ,greater<pii > > min_pq;
typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> OST;
// typedef priority_queue<pair < ll , pair < pii , ll > >  , vector<pair < ll , pair < pii , ll > >  > ,greater<pair < ll , pair < pii , ll > >  > > min_pq;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
    //use cerr if u want to display at the bottom
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c;
    cin >> a >> b;
    for ( ll i =1;i <= 3; i ++)
    {
        if ( (a*b*i)%2 )
        {
            cout <<"Yes";
            return 0;
        }
    }
    cout <<"No";
    
}



Measured memory_bytes: 256
import java.util.Scanner;
	class Main{
	public void Germany() {
		Scanner sc = new Scanner(System.in);
		int x,y,z;
		x = sc.nextInt();
		y = sc.nextInt();
		while(x != 0 || y != 0){
			if(x > y){
				z = x;
				x = y;
				y = z;
			}else{
				z = x;
				x = y;
				y = z;
				z = y;
				y = x;
				x = z;				
			}
			System.out.println(x + " " + y);
			x = sc.nextInt();
			y = sc.nextInt();
		}
	}
public static void main(String[] args) {
	new Main().Germany();
	}
}

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

using namespace std;

int main(){
    int A, B; cin >> A >> B;

    if(A == 1 && B == 1){
        cout << "Draw" << endl;
    }else if(A == 1){
        cout << "Alice" << endl;
    }else if(B == 1){
        cout << "Bob" << endl;
    }else if(A > B){
        cout << "Alice" << endl;
    }else if(A < B){
        cout << "Bob" << endl;
    }else{
        cout << "Draw" << endl;
    }

    return 0;
}

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

typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] *= 2;
  }

  ll offset = 0;
  for (int i = 0; i < n; i++) {
    offset = a[i] - offset;
  }
  // cout << offset << endl;
  ll x = offset / 2;

  ll cur = x;
  for (int i = 0; i < n; i++) {
    cout << cur << " ";
    cur = a[i] - cur;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2048
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var ab = ReadSplitLong();
            var a = ab[0];
            var b = ab[1];
            
            if ((a > 0 && b > 0) || ((a < 0 && b < 0) && (Abs(a) - Abs(b) + 1) % 2 == 0))
                Println("Positive");
            else if (a < 0 && b >= 0)
                Println("Zero");
            else
                Println("Negative");
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}



Measured memory_bytes: 13268
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2019-12-13 13:18:18
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    string ans = "No";
    for (int i = 1; i <= 9; i++) {
        if (N % i == 0) {
            if (N/i <= 9) ans = "Yes";
        }
    }

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


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main()
{
    ll n;
    cin>>n;
    vector<ll> v(5);
    for(int i=0;i<5;i++){
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    cout<<(n+v[0]-1)/v[0]+4<<endl;
    return 0;
}

Measured memory_bytes: 256