akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000000
#define MAX 200001

const ll MOD = 1000000007;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

int main(){
    int N;
    cin >> N;
    int cnt = 0;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    for(int i = 0; i < N; i+=2){
        if(a[i] % 2 == 1) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class A_169_Multiplication_1
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var Array = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            int result = Array[0]*Array[1];

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28244
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define inf 1000000000000000000
void checkpoint1()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	*/
}
int main()
{
	checkpoint1();
	ll n,m;
	cin>>n>>m;
	char a[n][m];
	for(ll i=0;i<n;i++)
		for(ll j=0;j<m;j++)
			cin>>a[i][j];
	if(a[0][0]=='#'||a[n-1][m-1]=='#')
	{
		cout<<0;
		return 0;
	}
	ll dp[n][m];
	dp[0][0]=1;
	for(ll i=0;i<n;i++)
	{
		for(ll j=0;j<m;j++)
		{
			if(i==0&&j==0)
				continue;
			else if(a[i][j]=='#')
				dp[i][j]=0;
			else{
				dp[i][j]=(i-1<0 ?0 :dp[i-1][j])+(j-1<0 ?0 :dp[i][j-1]);
				if(dp[i][j]>=mod)
					dp[i][j]-=mod;
			}
		}
	}
	cout<<dp[n-1][m-1];
	return 0;
}


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

using namespace std;

int n, k;
long long dp[305][305][305], x[305];

int main() {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++)
		scanf("%lld", x + i);
	for (int i = 0; i <= n + 1; i++)
		for (int j = 0; j <= k; j++)
			for (int l = 0; l <= i; l++)
				dp[i][j][l] = LLONG_MAX / 3;
	dp[0][0][0] = 0;
	for (int i = 1; i <= n + 1; i++)
		for (int j = 0; j <= k; j++)
			for (int l = 0; l < i; l++) {
				dp[i][j][i] = min(dp[i][j][i], dp[i - 1][j][l] + max(0LL, x[l] - x[i]));
				dp[i][j + 1][l] = min(dp[i][j + 1][l], dp[i - 1][j][l]);
			}
	printf("%lld\n", dp[n + 1][k][n + 1]);
}



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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

void solve(long long N, long long M, long long C, std::vector<long long> B,
           std::vector<std::vector<long long>> A) {
  int ans = 0;
  for(int i = 0 ; i < N ; i++){
    long long x = 0;
    for(int j = 0 ; j < M ; j++){
      x += A[i][j] * B[j];
    }
    x += C;
    if( x > 0 ) ans++;
  }
  cout << ans << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long M;
  scanf("%lld", &M);
  long long C;
  scanf("%lld", &C);
  std::vector<long long> B(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &B[i]);
  }
  std::vector<std::vector<long long>> A(N, std::vector<long long>(M));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      scanf("%lld", &A[i][j]);
    }
  }
  solve(N, M, C, std::move(B), std::move(A));
  return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros, dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
#[allow(unused_macros, dead_code)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
#[allow(unused_macros, dead_code)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        a: i32,
        b: i32,
    }

    if (a - b) % 2 == 0 {
        println!("Alice");
    } else {
        println!("Borys");
    }
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    map<char, int> counter;
    string s;
    cin >> s;
    for (char c : s) {
        ++counter[c];
    }
    if (counter.size() == 2 && counter.begin()->second == 2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)    
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
using namespace std;
const long long N=100005, INF=(int)1e9;
int h,w;
string s[1001];
int dp[1002][1002];
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
bool valid(int x, int y)
{
    if(x>=0&&x<h&&y>=0&&y<w&&s[x][y]=='.')
    return true;
    return false;
}
int32_t main()
{
    cin>>h>>w;
    int x1,x2,y1,y2;
    cin>>x1>>y1>>x2>>y2;
    x1--;x2--;y1--;y2--;
    for(int i=0;i<h;i++)
    cin>>s[i];
    rep(i,0,h)
    rep(j,0,w)
    dp[i][j]=INF;
    deque <pair<pii, int> > q;
    vector <pii> temp;
    for(int i=-2;i<3;i++)
    {
        for(int j=-2;j<3;j++)
        {
            if(i!=0||j!=0)
            {
                temp.pb({i, j});
                //cout<<i<<" "<<j<<"\n";
            }
        }
    }
    q.push_front({{x1, y1}, 0});
    dp[x1][y1]=0;
    while(!q.empty())
    {
        pair<pii, int> p=q.front();
        int x=p.ff.ff,y=p.ff.ss;
        q.pop_front();
        for(int i=0;i<4;i++)
        {
            if(valid(x+dx[i], y+dy[i])&&dp[x+dx[i]][y+dy[i]]>p.ss)
            {
                dp[x+dx[i]][y+dy[i]]=p.ss;
                q.push_front({{x+dx[i], y+dy[i]}, p.ss});
            }
        }
        for(int i=0;i<24;i++)
        {
            if(valid(x+temp[i].ff, y+temp[i].ss)&&dp[x+temp[i].ff][y+temp[i].ss]>(p.ss+1))
            {
                dp[x+temp[i].ff][y+temp[i].ss]=p.ss+1;
                q.push_back({{x+temp[i].ff, y+temp[i].ss}, p.ss+1});
            }
        }
    }
    if(dp[x2][y2]==INF)
    cout<<-1;
    else
    cout<<dp[x2][y2];
}


Measured memory_bytes: 9552
N = int(input())
H = list(map(int, input().split()))
cnt = 0
for i in range(N):
    flg = 0
    for j in range(i):
        if H[i] < H[j]:
            flg = 1
            break
    if flg == 1:
        continue
    cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(void){
  char str[11];
  
  scanf("%s",str);
  
  int len = strlen(str);
  int ans = 999,abs;
  
  for(int n=0 ; n <= len-3 ; n++){
    int num = (str[n]-'0')*100 + (str[n+1]-'0')*10 + (str[n+2]-'0');
    abs = 753 - num;
    if(abs<0) abs = -abs;
    if(abs < ans) ans = abs;
  }
  printf("%d",ans);
  
  return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
//#pragma GCC target ("avx2,tune=native")
#include<bits/stdc++.h>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv1(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
template<typename a, typename b>
void minq(a& x, b y) {
	if (x > y)
		x = y;
}
template<typename a, typename b>
void maxq(a& x, b y) {
	if (x < y)
		x = y;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef ll _I;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
//WHEN DOING MODULAR SUBTRACTION ALWAYS **ALWAYS** ADD MOD
//don't use AVX at AtCoder
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
//	doin();
	ll t;
	cin >> t;
	while (t--) {
		set<int> s;
		ll a, b, ans = 0;
		cin >> a >> b;
		if (a > b)
			swap(a, b);
		ll t = ceil(2.0*sqrt((a *1.0* b)));
		t -= 2;
		if(a == 1 ||(((a*b - 1) / a) != ((a*b - 1) / (a-1)) && ((a*b - 1) / a) != ((a*b - 1) / (a+1))))t--;
		cout << max(0ll, t) << "\n";
	}
	return 0;
}


Measured memory_bytes: 256
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    total = 0
    for a in A:
        total ^= a
    Ans = [-1] * N
    for i, a in enumerate(A):
        Ans[i] = total ^ a
    print(*Ans, sep = " ")

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 31308
n,m=map(int,input().split())
ans=0
for i in range(n):
  for j in range(m):
    mo=i+1
    da=j+1
    if(da>=11):
      dd=str(da)
      if(mo==int(dd[0])*int(dd[1])):
        if(int(dd[0])>=2 and int(dd[1])>=2):
          ans+=1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))
#define MINC(c, x) (c = min(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

const ll INF = 1e9;

template<class T, class U = size_t>
class Dinic {
	struct E { U to, rev_edge_index; T c; };
	U n;
	vector<vector<E>> g;
public:
	explicit Dinic(U n) : n(n), g(n) {}
	void add_undirected_edge(U from, U to, T c) { add_edge(from, to, c, c); }
	void add_edge(U from, U to, T c, T c2 = 0) {
		if (from != to) {
			g[from].push_back({ to,   g[to].size(),     c });
			g[to].push_back({ from, g[from].size() - 1, c2 });
		}
	}

	T max_flow(U in, U out) {
		vector<U> d(n);
		auto bfs = [&]() {
			d.assign(n, 0);
			d[in] = 1;
			queue<U> q; q.push(in);
			while (!q.empty()) {
				U v = q.front(); q.pop();
				for (E e : g[v]) {
					if (e.c > 0 && !d[e.to]) {
						d[e.to] = d[v] + 1;
						q.push(e.to);
					}
				}
			}
			return d[out] > 0;
		};

		vector<U> ptr(n); // 各頂点について何処まで探索したかを保持
		function<T(U, T)> dfs = [&](U v, T lim) {
			if (in == v || !lim) return lim;
			T sum = 0;
			for (U &i = ptr[v]; i < g[v].size(); ++i) {
				E &e = g[v][i], &re = g[e.to][e.rev_edge_index];
				if (d[e.to] >= d[v] || re.c <= 0) continue;
				T f = dfs(e.to, min(lim - sum, re.c));
				if (f <= 0) continue;
				re.c -= f;
				e.c += f;
				sum += f;
				if (sum == lim) break;
			}
			return sum;
		};

		T ans = 0;
		while (bfs()) {
			ptr.assign(n, 0);
			ans += dfs(out, numeric_limits<T>::max() / 8);
		}
		return ans;
	}
};

int main() {
	#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
	#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	ll n; cin >> n;
	vl a(n); REP(i, n) cin >> a[i];
	Dinic<ll> dinic(n + 2);
	FOR(i, 1, n + 1) {
		if (a[i - 1] < 0) dinic.add_edge(0, i, -a[i - 1]);
		if (a[i - 1] > 0) dinic.add_edge(i, n + 1, a[i - 1]);
		for (ll j = i * 2; j <= n; j += i) dinic.add_edge(i, j, TEN(14));
	}

	ll sum = 0;
	REP(i, n) if (a[i] > 0) sum += a[i];
	cout << sum - dinic.max_flow(0, n + 1) << endl;

	return 0;
}


Measured memory_bytes: 256
S = input()

length = len(S)
evenN = []
oddN = []
for i in range(length):
    if (i + 1) % 2 == 0:
        if S[i] == 'R':
            evenN.append(False)
        else:
            evenN.append(True)
    if (i + 1) % 2 == 1:
        if S[i] == 'L':
            oddN.append(False)
        else:
            oddN.append(True)


if all(oddN) is True and all(evenN) is True:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {

  long long N,K;
  cin >> N >> K;

  long long ans = 0;
  if(K == 0) {
    cout << N * N << endl;
    return 0;
  }
  for(long long i = K+1;i <= N;i++) {
    int l = i - K;
    int m = N / i;
    ans += l * m;
    ans += max(0LL,N % i - (K-1));
  }

  cout << ans << endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;

int main() {
  string S;
  cin>>S;
  
  string X=S.substr(0,2);
  string Y=S.substr(2,2);
  
  int x=stoi(X);
  int y=stoi(Y);
  
  // xとyが1-12であるか判定するフラグ
  bool x_m=false;
  bool y_m=false;
  
  if(1<=x && x<=12)
    x_m=true;
  if(1<=y && y<=12)
    y_m=true;
  
  if(x_m && !y_m)
    cout<<"MMYY"<<endl;
  else if(!x_m && y_m)
    cout<<"YYMM"<<endl;
  else if(x_m && y_m)
    cout<<"AMBIGUOUS"<<endl;
  else if(!x_m && !y_m)
    cout<<"NA"<<endl;
  
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC130A
{
    class Program
    {
        static void Main(string[] args)
        {
            var whxy = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
            var sq = whxy[0] * whxy[1] * 0.5;
            if (whxy[0] / 2 == whxy[2] && whxy[1] / 2 == whxy[3])
            {
                Console.WriteLine("{0} 1", sq);
            }
            else
            {
                Console.WriteLine("{0} 0", sq);
            }

        }
    }
}


Measured memory_bytes: 13396
// テ・ツ淞コテヲツ慊ャテ」ツδ?」ツδウテ」ツδ療」ツδャテ」ツδシテ」ツδ?

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

signed main() {
    int N; cin >> N;
    if(N == 0 || N == 2) cout << 1 << endl;
    else if(N == 1) cout << 2 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3104
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int N,A;
long long K;


int main()
{
	cin >> N >> K;//N=4,K=5
	vector<int>to(N);
	rep(i, N)
	{
		cin >> A;
		
		to[i] = A - 1;//to{5,4,1,4,2,1}
	}	
	vector<int> a(N , 0);//a{0,0,0,0,0,0}	
		vector<int> b(1,0);
		b[0] = 0;
		int c = 0;		
		while (a[b[c]] == 0)
		{
			a[b[c]] = 1;			
			b.push_back(to[b[c]]);
			c++;
		}		
		
		int f = b.size();
		if (K < f)
		{
			cout << b[K] + 1 << endl;			
		}
		else
		{
			//a{1,1,1,0,1,1}, b{0,5,1,4,2,1},c=5	
			auto e = find(b.begin(), b.end(), b[c]);
			b.erase(b.begin(), e);
			int g = b.size();

			long long d = (K - (f - g)) % (c - (f - g));
			cout << b[d] + 1 << endl;
		}
	return 0;
}

Measured memory_bytes: 5884
#include<iostream>
#include<string>
using namespace std;
int main(){
	long int x;
	cin>>x;
	long int ans=0;
	ans+=(x/11)*2;
	if(x%11>6){
		ans+=2;
	}
	else if(x%11<=6&&x%11!=0){
		ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  vi a(n); rep(i, n) cin >> a[i];

  int sum = 0;
  rep(i, n) sum ^= a[i];

  std::cout << (sum ? "No" : "Yes") << '\n';
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include <string>
#include <math.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;
int main(){
  ll n,a,b,c,d; cin >>n>>a>>b>>c>>d;
  for(int p=0;p<n;p++){
    ll Min=p*c-d*(n-1-p);
    ll Max=p*d-c*(n-1-p);
    if(Min<=b-a&&b-a<=Max){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
import math
X = int(input())

ans = 1


def cal(a, b): return a ** b


a = int(math.sqrt(X))

for i in range(a, 2, -1):
    b = 2
    tmp = cal(i, b)
    while (tmp <= X):
        tmp = cal(i, b)
        if tmp <= X:
            ans = max(ans, tmp)
            b += 1
        else:
            b += 1
print(ans)


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

using i8   = int8_t;
using u8   = uint8_t;
using i16  = int16_t;
using u16  = uint16_t;
using i32  = int32_t;
using u32  = uint32_t;
using i64  = int64_t;
using u64  = uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;

using f32  = float;
using f64  = double;
using f80  = __float80;
using f128 = __float128;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'000LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

// {{{ util
#define FOR(i, start, end) for(i64 i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cc) { return (f)(begin(cc), end(cc), ## __VA_ARGS__); })(c))

template<typename T, typename U>
bool chmax(T& xmax, const U& x) {
    if(xmax < x) {
        xmax = x;
        return true;
    }
    else {
        return false;
    }
}

template<typename T, typename U>
bool chmin(T& xmin, const U& x) {
    if(x < xmin) {
        xmin = x;
        return true;
    }
    else {
        return false;
    }
}

template<typename T>
void RD(T& x) {
    cin >> x;
#ifdef PROCON_LOCAL
    assert(cin);
#endif
}

template<typename T>
void RD(vector<T>& v, int n) {
    v.reserve(n);
    REP(_, n) {
        T e; RD(e);
        v.emplace_back(e);
    }
}

template<typename T>
void PRINT(const T& x) {
    cout << x;
}

template<typename T>
void PRINT(const vector<T>& v) {
    for(auto first = begin(v), it = first; it != end(v); ++it) {
        if(it != first)
            cout << ' ';
        cout << *it;
    }
}

template<typename T>
void PRINTLN(const T& x) {
    PRINT(x);
    cout << '\n';
}

template<typename T>
void DBG_IMPL(i64 line, const char* expr, const T& value) {
#ifdef PROCON_LOCAL
    cerr << "[LINE " << line << "]: ";
    cerr << expr << " = " << value << "\n";
#endif
}

#define DBG(expr) DBG_IMPL(__LINE__, #expr, (expr))
// }}}

//--------------------------------------------------------------------

i64 H, W;
i64 h, w;

void solve() {
    RD(H); RD(W);
    RD(h); RD(w);

    i64 ans = H*W - h*W - w*H + h*w;

    PRINTLN(ans);
}

signed main() {
    

    solve();

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int INF=1e9+7;
int main(){
	ll a1=1LL,a2=1LL;
	int n,a[15]={};
	scanf("%d",&n);
	rep(k,n){
		scanf("%d",&a[k]);
		a1*=3;
		a2*=(a[k]&1)?1:2;
	}
	printf("%I64d\n",a1-a2);
	return 0;
}

Measured memory_bytes: 256
//This program is written by Brian Peng.
#pragma GCC optimize("Ofast","inline","no-stack-protector")
#include<bits/stdc++.h>
using namespace std;
#define Rd(a) (a=rd())
#define Gc(a) (a=getchar())
#define Pc(a) putchar(a)
int rd(){
	int x;char c(getchar());bool k;
	while(!isdigit(c)&&c^'-')if(Gc(c)==EOF)exit(0);
	c^'-'?(k=1,x=c&15):k=x=0;
	while(isdigit(Gc(c)))x=x*10+(c&15);
	return k?x:-x;
}
void wr(int a){
	if(a<0)Pc('-'),a=-a;
	if(a<=9)Pc(a|'0');
	else wr(a/10),Pc((a%10)|'0');
}
signed const INF(0x3f3f3f3f),NINF(0xc3c3c3c3);
long long const LINF(0x3f3f3f3f3f3f3f3fLL),LNINF(0xc3c3c3c3c3c3c3c3LL);
#define Ps Pc(' ')
#define Pe Pc('\n')
#define Frn0(i,a,b) for(int i(a);i<(b);++i)
#define Frn1(i,a,b) for(int i(a);i<=(b);++i)
#define Frn_(i,a,b) for(int i(a);i>=(b);--i)
#define Mst(a,b) memset(a,b,sizeof(a))
#define File(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout)
int a,b,c,d;
signed main(){
	Rd(a),Rd(b),Rd(c),Rd(d);
	while(1){
		if((c-=b)<=0)printf("Yes"),exit(0);
		if((a-=d)<=0)printf("No"),exit(0);
	}
	exit(0);
}


Measured memory_bytes: 3764
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;
using System.Text;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            return "ABC" + consoleReader.String;
        }


        #region いつもの
#pragma warning disable
        private ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
    }
    static class Ext
    {
        public static Dictionary<TKey, int> GroupCount<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) => source.GroupBy(keySelector).ToDictionary(g => g.Key, g => g.Count());
        public static Dictionary<TKey, int> GroupCount<TKey>(this IEnumerable<TKey> source) => source.GroupCount(i => i);
    }
    public class ConsoleReader { private string[] ReadLineSplit() => textReader.ReadLine().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries); private string[] line = Array.Empty<string>(); private int linePosition; private TextReader textReader; public ConsoleReader(TextReader tr) { textReader = tr; } public int Int => int.Parse(String); public long Long => long.Parse(String); public double Double => double.Parse(String); public string String { get { if (linePosition >= line.Length) { linePosition = 0; line = ReadLineSplit(); } return line[linePosition++]; } } public class SplitLine { private string[] splited; public SplitLine(ConsoleReader cr) { splited = cr.ReadLineSplit(); cr.line = Array.Empty<string>(); } public int[] Int => String.Select(x => int.Parse(x)).ToArray(); public int[] Int0 => String.Select(x => int.Parse(x) - 1).ToArray(); public long[] Long => String.Select(x => long.Parse(x)).ToArray(); public double[] Double => String.Select(x => double.Parse(x)).ToArray(); public string[] String => splited; } public SplitLine Split => new SplitLine(this); public class RepeatReader : IEnumerable<ConsoleReader> { ConsoleReader cr; int count; public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; } public IEnumerator<ConsoleReader> GetEnumerator() => Enumerable.Repeat(cr, count).GetEnumerator(); System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public IEnumerable<string> String => this.Select(cr => cr.String); public IEnumerable<int> Int => this.Select(cr => cr.Int); public IEnumerable<int> Int0 => this.Select(cr => cr.Int - 1); public IEnumerable<long> Long => this.Select(cr => cr.Long); public IEnumerable<double> Double => this.Select(cr => cr.Double); } public RepeatReader Repeat(int count) => new RepeatReader(this, count); }
    #endregion
}


Measured memory_bytes: 11092
//Robot Arms
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

class Wide{
    public:
    int r,l;
    Wide(){}
    Wide(int l,int r):r(r),l(l){}
    int Get_l(){
        return l;
    }
    int Get_r(){
        return r;
    }
    bool operator < (const Wide &w)const{
        return r!=w.r ? r<w.r : l<w.l; 
    }
    bool operator == (const Wide &w)const{
        return r==w.r && l==w.l;
    }
};

int main(){
    int n;
    vector<Wide> Robot_Arms;
    int ans=1,t;

    cin>>n;
    //Robot_Arms.resize(n);

    for(int i=0; i<n; i++){
        int x,l;
        cin>>x>>l;
        Robot_Arms.push_back(Wide(x-l,x+l));
        //cout<<x-l<<","<<x+l<<endl;
    }
    /*
    cout<<Robot_Arms.size()<<endl;
    
    for(int i=0; i<Robot_Arms.size(); i++){
        cout<<"("<<Robot_Arms[i].l<<","<<Robot_Arms[i].r<<") ";
    }
    cout<<endl;
    */

    sort(Robot_Arms.begin(),Robot_Arms.end());
    /*
    for(int i=0; i<Robot_Arms.size(); i++){
        cout<<"("<<Robot_Arms[i].l<<","<<Robot_Arms[i].r<<") ";
    }
    cout<<endl;
    */
    t=Robot_Arms[0].r;
    for(int i=1; i<n; i++){
        if(t<=Robot_Arms[i].l){
            ans++;
            t=Robot_Arms[i].r;
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1400
def main():
    n, m = map(int, input().split())
    *a, = map(int, input().split())

    LIM = sum(a) / (4 * m)

    cnt = 0
    for x in a:
        if x >= LIM:
            cnt += 1

    print('Yes' if cnt >= m else 'No')


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())


Measured memory_bytes: 38384
#include <cstdio>
#include <cstdlib>
double abs(double t){
	if(t<0.0){
		return -1.0*t;
	}else{
		return t;
	}
}
int main(){
	double r;
	while(scanf("%lf",&r) && r!=-1.0){
		double e=r/2.0;
		for(;;){
			e=(e-(e*e*e-r)/(3*e*e));
			if(abs((double)e*e*e-(double)r)<0.00001*r){
				printf("%f\n",e);
				break;
			}
		}
	}
}

Measured memory_bytes: 1076
#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    long long m=0;
    for(int i=1;i<=n;++i){
        if(i%3==0||i%5==0){
            continue;
        }
        m+=i;
    }
    printf("%lld\n",m);
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){return b == 0 ? a : gcd(b, a % b);}
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++)
        cin >> a[i];
    sort(a.begin(), a.end());
    int ans = a[0];
    for(int i = 1; i < n; i++)
        ans = gcd(ans, a[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3784
/**
    In the name of Allah, the Most Gracious, the Most Merciful.
**/

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

typedef long long ll;


int main() {
    #ifdef _OFFLINE_
        freopen("in.txt", "r", stdin);
    #endif /// _OFFLINE_

    string s;
    cin >> s;

    int a = s[0] - '0';
    int b = s[1] - '0';
    int c = s[2] - '0';
    int d = s[3] - '0';

    if(a + b + c + d == 7) {
        cout << s[0] << "+" << s[1] << "+" << s[2] << "+" << s[3] << "=7\n";
        exit(0);
    }
    if(a + b + c - d == 7) {
        cout << s[0] << "+" << s[1] << "+" << s[2] << "-" << s[3] << "=7\n";
        exit(0);
    }
    if(a + b - c + d == 7) {
        cout << s[0] << "+" << s[1] << "-" << s[2] << "+" << s[3] << "=7\n";
        exit(0);
    }
    if(a + b - c - d == 7) {
        cout << s[0] << "+" << s[1] << "-" << s[2] << "-" << s[3] << "=7\n";
        exit(0);
    }
    if(a - b + c + d == 7) {
        cout << s[0] << "-" << s[1] << "+" << s[2] << "+" << s[3] << "=7\n";
        exit(0);
    }
    if(a - b + c - d == 7) {
        cout << s[0] << "-" << s[1] << "+" << s[2] << "-" << s[3] << "=7\n";
        exit(0);
    }
    if(a - b - c + d == 7) {
        cout << s[0] << "-" << s[1] << "-" << s[2] << "+" << s[3] << "=7\n";
        exit(0);
    }
    if(a - b - c - d == 7) {
        cout << s[0] << "-" << s[1] << "-" << s[2] << "-" << s[3] << "=7\n";
        exit(0);
    }

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n,k,ans=1000000007;
string s;
vector <string> p;
void iro(string s){
  if(s!=""){
  ll l=stol(s);
  if(l>=n) ans=min(ans,l);
  }
  if(s.size()==6) return;
  for(ll i=0;i<10-k;i++){
    iro(s+p[i]);
  }
}
int main(){
  cin >>n>>k;
  ll d[k];
  for(ll i=0;i<k;i++) cin >>d[i];
  for(ll i=0;i<=9;i++){
    ll fl=1;
    for(ll j=0;j<k;j++){
      if(d[j]==i) {
        fl=0;
        break;
      }
    }
    if(fl==1) p.push_back(to_string(i));
  }
  string s="";
  iro(s);
  cout <<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define faster ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define ll long long
#define FO(n) for (ll i = 0; i < n; i++)
#define endl "\n"
const long long int M = 10e9 + 7;
void solve()
{
    int n, x, t;
    cin >> n >> x >> t;
    if (n % x == 0)
    {
        cout << t * n / x << endl;
    }
    else
    {
        cout << t * (n / x + 1) << endl;
    }
}

int main()
{
    faster;
    //int t;
    //cin >> t;
    //while (t--)
    solve();
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

vector<vector<ll>> memo;
void init() {
    memo[0].push_back(1);
    memo[1].push_back(1);
    memo[1].push_back(1);
    for (int i = 2; i < memo.size(); i++) {
        memo[i].resize(i+1);
        memo[i][0] = 1;
        memo[i][i] = 1;
        for (int j = 1; j < i; j++) {
            memo[i][j] = memo[i-1][j-1] + memo[i-1][j];
        }
    }
}


int main() {
    int N, P; cin >> N >> P;
    memo.assign(N+1, vector<ll>());
    init();
    vector<int> A(N);
    int even = 0, odd = 0;
    rep(i,N) {
        cin >> A.at(i);
        if (A[i] % 2 == 0) even++; else odd++;
    }
    ll res = 0;
    if (P) { // odd
        for (int i = 1; i <= odd; i += 2) {
            rep(j, even+1) {
                res += memo[even][j] * memo[odd][i];
            }
        }
    } else { // even
        rep(i, even + 1) {
            for (int j = 0; j <= odd; j += 2) {
                res += memo[even][i] * memo[odd][j];
            }
        }
    }
    cout << res << endl;
}


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

#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"

#define ll long long
#define ff first
#define ss second
#define null NULL
#define all(c) (c).begin(),(c).end()
#define nl "\n"

#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front
#define mod 1000000007

typedef vector<ll> vl;
typedef vector< vl > vvl;
typedef pair< ll, ll> pll;
typedef map< ll, ll> mll;

#define pie_value 3.14159265358979323846

unordered_map<ll, ll> vis;
map<ll, set<ll>> mp;
ll s;

void dfs(ll i) {
	vis[i] = 1;
	s++;

	for (auto child : mp[i]) {
		if (!vis[child])
			dfs(child);
	}
}

int main() {

	// Use ctrl+shift+b ( second option )
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt" , "w" , stderr);
#endif

	ll n, m;
	cin >> n >> m;

	vis.clear();
	mp.clear();

	for (ll i = 1; i <= m; i++) {
		ll a, b;
		cin >> a >> b;

		mp[a].insert(b);
		mp[b].insert(a);
	}

	ll c = 0;
	ll max_size = 0;
	for (ll i = 1; i <= n; i++) {
		s = 0;
		if (!vis[i]) {
			dfs(i);
			c++;
			max_size = max(max_size , s);
		}
	}

	cout << max_size << nl;

	return 0;
}


Measured memory_bytes: 67592
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)n; i++)

int main() {
    int N;
    string S;

    cin >> N >> S;

    int result = 0;
    int l = 0;
    int r = N - 1;

    while(true){
        while(l < N-1){
            if(S[l] == 'R')l++;
            else break;
        }
        while(r > 0){
            if(S[r] == 'W')r--;
            else break;
        }
        if(r - l > 0){
            result++;
            r--;
            l++;
        }
        else break;
    }

    cout << result << "\n";
    return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    ll N,A,B; cin >> N >> A >> B;
    ll ans = N / (A+B) * A;
    ll amari = N%(A+B);
    ans += min(amari, A);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
m=[]
for _ in range(n):
  m+=[list(map(int,input().split()))]
m.sort(key=lambda x:x[1])
t=0
ans=1
for i in range(n):
  t+=m[i][0]
  if t>m[i][1]:
    ans=0
    break
print("YNeos"[1-ans::2])

Measured memory_bytes: 88920
#include <stdio.h>
int main(){
	
	int A, B, C;
	scanf("%d %d %d", &A, &B, &C);
	if(A==B&&B==C&&C==A){
		printf("No\n");	 
	}
	else if(A!=B&&A!=C&&B!=C)
		printf("No\n");
	 else if(A==C&&A!=B&&C!=B)
		printf("Yes\n");
	 else if(A==B&&A!=C&&B!=C)
		printf("Yes");
	 else if(B==C&&B!=A&&C!=A)
		printf("Yes");
	
	
	return 0; 
}

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

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

  int64_t sum = 0;

  for (int64_t i = 1; i<=N; i++){ 
    
  if (i%3 != 0 && i%5 != 0) {
        sum += i;  
  }
  else continue;    
  }  
    
    cout << sum << endl;
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Text;

namespace ABC131
{
    class A
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            for(var i=0;i<s.Length-1;i++)
            {
                if(s[i] == s[i+1])
                {
                    Console.WriteLine("Bad");
                    return;
                }
            }
            Console.WriteLine("Good");
        }
    }
}


Measured memory_bytes: 11092
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, k = map(int, input().split())
    X, Y = [], []
    XY = []
    for _ in range(n):
        x, y = map(int, input().split())
        X.append(x)
        Y.append(y)
        XY.append([x, y])
    X.sort()
    Y.sort()

    res = f_inf
    for x1 in range(n):
        left = X[x1]
        for x2 in range(x1 + 1, n):
            right = X[x2]
            for y1 in range(n):
                bottom = Y[y1]
                for y2 in range(y1 + 1, n):
                    up = Y[y2]
                    cnt = 0
                    for x, y in XY:
                        if left <= x <= right and bottom <= y <= up:
                            cnt += 1
                        if cnt >= k:
                            area = (right - left) * (up - bottom)
                            res = min(res, area)
                            break
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 74432
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
typedef long long llong;
using namespace std;

int main(){
	int n,wl;
	cin>>n>>wl;
	
	vector<int> w(n),v(n);
	REP(i,n) cin>>w[i]>>v[i];
	
	vector<llong> dp(wl+1,0);//残り重さiにおける最大価値dp[i].
	REP(i,n){
		for(int j=wl;j>=w[i];--j){
			dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
		}
	}
	
	cout<<dp[wl]<<endl;
	return 0;
}//β.解答参考.

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

int main() {
    int n;
    cin >> n;
    vector<int> P(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &P.at(i));
    }

    int minP = MAX;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (minP >= P.at(i)) {
            ans++;
            minP = P.at(i);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long i64;
typedef pair<i64,i64> P;


int n, m;
P p[101010];

int main(){
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		cin >> p[i].first >> p[i].second;
	}
	
	sort(p, p+m);
	
	i64 l = 0, r = INF, cnt = 1;
	for(int i = 0; i < m; i++){
		if(p[i].first <= l) continue;
		if(p[i].first >= r){
			cnt++;
			l = p[i].first;
			r = p[i].second;
			continue;
		}
		l = p[i].first;
		r = min(r, p[i].second);
	}
	
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 1792
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

ll H, W;
vpl dpl = {PL(-1,0), PL(1,0), PL(0,1), PL(0,-1)};

bool valid(ll x, ll y){
    return x >= 0 && x < H && y >= 0 && y < W;
}

int main(){
    cin >> H >> W;
    ll w_count = 0;
    vvc s(H, vc(W));
    REP(i, H){
        string str; cin >> str;
        REP(j, W){
            s[i][j] = str[j];
            if(str[j] == '.') w_count++;
        }
    };
    vvl ds(H, vl(W, LINF)); ds[0][0] = 0;
    vvb used(H, vb(W, false));
    while(true){
        // dijkstra
        PL cur(-1,-1);
        REP(i, H) REP(j, W){
            if(!used[i][j] && (cur == PL(-1,-1) || ds[i][j] < ds[cur.ff][cur.ss])){
                cur = PL(i,j);
            }
        }
        if(cur == PL(-1,-1)) break;
        used[cur.ff][cur.ss] = true;
        for(PL d : dpl){
            ll nx = cur.ff + d.ff, ny = cur.ss + d.ss;
            if(valid(nx, ny) && s[nx][ny] == '.'){
                ds[nx][ny] = min(ds[nx][ny], ds[cur.ff][cur.ss] + 1);
            }
        }
    }
    cout << (ds[H-1][W-1] == LINF ? -1 : w_count - (ds[H-1][W-1] + 1)) << endstr;
    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 Cout(s) cout << s << endl;
using ll = long long;
using P = pair<int, int>;

const ll INF = 1ll << 60;
ll MOD = 1e9 + 7;

int main()
{

    int a, b;
    cin >> a >> b;
    cout << (b % a ? b - a : a + b) << endl;

    return 0;
}

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

n1 = 0
n2 = 0
n3 = 0
for i in range(n):
    if a[i] % 4 == 0:
        n1 += 1
    elif a[i] % 2 == 0:
        n2 += 1
    else:
        n3 += 1

if n2 == 0:
    if n3 <= n1 + 1:
        print('Yes')
    else:
        print('No')
else:
    if n3 <= n1:
        print('Yes')
    else:
        print('No')


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

int main(){
  int N,i,a=0,b=0,c=0,d=0;
  string s;
  cin >> N;
  
  for(i=0;i<N;i++){
    cin >> s;
    if(s=="AC") a++;
    else if(s=="WA") b++;
    else if(s=="TLE") c++;
    else if(s=="RE") d++;
  }
  
  cout << "AC x "<< a << endl;
  cout << "WA x "<< b << endl;
  cout << "TLE x "<< c << endl;
  cout << "RE x "<< d << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int x,i,j,n,a[1<<17],p,q;
vector<int>v;
main(){
  for(cin>>n;i<n;)cin>>a[i++];
  for(sort(a,a+n,greater<int>()),x=a[0],j=1;j<n;++j){
    if(x==a[j])v.push_back(a[j]),++j;
    x=a[j];
  }
  if(v.size()>1)cout<<(long long)v[0]*v[1]<<endl;
  else cout<<0<<endl;
}


Measured memory_bytes: 1024