akhauriyash/Code-Regression huggingface dataset:
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define EPS 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f3f3f3f3f
#define MEM(a, b) memset(a, b, sizeof(a))
#define PPER(i, n, m) for (int i = n; i >= m; i--)
#define REPP(i, n, m) for (int i = n; i <= m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define PER(i, n, m) for (int i = n; i > m; i--)
#define SA(n) scanf("%d", &(n))
#define SLLA(n) scanf("%lld", &(n))
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define DE(val) cout << #val << ": " << val << endl;
 
const int dx44[6] = {0, -1, -1, 1, 1};
const int dy44[6] = {0, -1, 1, -1, 1};
const int dx4[6] = {0, 0, 1,-1};
const int dy4[6] = {1, -1, 0,0};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int dx82[9] = {0, -1, -1, 1, 1, 2, 2, -2, -2};
const int dy82[9] = {0, 2, -2, 2, -2, 1, -1, 1, -1};

void update(ll& x,ll v){
    if(x==-1)x=v;
    else if(x>v)x=v;
}
 
ll po(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
void extgcd(ll a, ll b, ll &d, ll &x, ll &y)
{
    if (!b)
    {
        d = a;
        x = 1;
    }
    else
    {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
ll inverse(ll a, ll n)
{
    ll d, x, y;
    extgcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn = 1e5 + 15;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
/*************************************************************************/

void solve() {
    int n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2 + m*(m-1)/2<<endl;
}

int main()
{   

    solve();
    return 0;
 
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

ll LCM(ll x, ll y) {
    return x * y / GCD(x, y);
}


int main() {
	int a, b; cin >> a >> b;
    cout << max(max(a+b, a-b), a*b);
    
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

class UnionFind{
public:
	vector<int> par;
	//0-indexed
	void init(int n = 1) {
		par.resize(n);
		for (int i = 0; i < n; ++i) par[i] = i;
	}
	int root(int x = 1){
		if(par[x]==x)return x;
		else{
			return par[x] = root(par[x]);
		}
	}
	void unite(int x = 1,int y = 1){
		x = root(x);
		y = root(y);
		if(x==y)return;
		else par[x] = y;
	}
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll V,E;
	cin >> V >> E;
	priority_queue< pair<ll,P> > Q;
	UnionFind uf;
	uf.init(V);
	FOR(i,0,E){
		ll a,b,c;
		cin >> a >> b >> c;
		Q.push({-c,{a,b}});
	}
	ll ans = 0;
	while(Q.size()){
		ll x = Q.top().second.first;
		ll y = Q.top().second.second;
		ll cost = -Q.top().first;
		Q.pop();
		if(uf.root(x)!=uf.root(y)){
			ans += cost;
			uf.unite(x,y);
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 6052
import java.util.Scanner;

class Main{
     public static void main(String[] args){
	//???????????\???
    	Scanner scan = new Scanner(System.in);
	//???????????´??°?????????????????£??\
    	int n = scan.nextInt();
	//boolean??????????´???°???[4][13]??¨??????
    	boolean[][] cards = new boolean[4][13];
    	String s = null;
    	int num;
    	
    	//n?????????????????????s?????????????????£???????????????????????????true?????£??\
    	for(int i = 0; i < n; i++){
    		s = scan.next();
    		num = scan.nextInt();
    		num--;
    		
    		
    		switch(s){
    			case "S":
    				cards[0][num] = true;
    				break;
    			case "H":
    				cards[1][num] = true;
    				break;
    			case "C":
    				cards[2][num] = true;
    				break;
    			case "D":
    				cards[3][num] = true;
    				break;
    		}
    	}
    	
	//????????????????????°??????????????????false????????????????????????
    	for(int j = 0; j < 4; j++){
    		for(int i = 1; i < 14; i++){
    			if(cards[j][i - 1] == true){   				
    			}else{
    				switch(j){
    				  case 0:
    					  s = "S";
    					  break;
    				  case 1:
    					  s = "H";
    					  break;
    				  case 2:
    					  s = "C";
    					  break;
    				  case 3:
    					  s = "D";
    					  break;
    				}   				
    				System.out.println(s + " " + i);
    			}
    			
    		}
    	}
     }
}

Measured memory_bytes: 26076
#pragma GCC optimize ("Ofast")
#include "bits/stdc++.h"
	
#define PI 3.141592653589793
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
// Use for file I/O;
#define FIN string _fname = ""; \
			string _is = _fname + ".in", _os = _fname + ".out"; \
			freopen(_is.c_str(), "r", stdin); \
			freopen(_os.c_str(), "w", stdout);
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;

using namespace std;

const ll INF = 1e9 + 10;
const ll INF2 = 1e18 + 10;
const int MOD = 1e9 + 7;
const ld EPS = 1e-4;

const int LOGN = 19;
const int MAXN = 2e5;

ll t[MAXN * 4], lp[MAXN * 4];

void update(int v, int tl, int tr, int l, int r, ll x) {
	if (l >= r) return;
	else if (tl == l && tr == r) {
		lp[v] += x;
		t[v] += x;
	} else {
		int tm = (tl + tr) / 2;
		update(2*v + 1, tl, tm, l, min(r, tm), x);
		update(2*v + 2, tm, tr, max(l, tm), r, x);
		t[v] = min(t[2*v + 1], t[2*v + 2]) + lp[v];
	}
}

ll query(int v, int tl, int tr, int l, int r) {
	if (l >= r) return INF2;
	else if (tl == l && tr == r) return t[v];
	else {
		int tm = (tl + tr) / 2;
		ll r1 = query(2*v + 1, tl, tm, l, min(r, tm));
		ll r2 = query(2*v + 2, tm, tr, max(l, tm), r);
		return min(r1, r2) + lp[v];
	}
}


int main() {
	FAST;

	int n, m;
	cin >> n >> m;
	vector<vector<pair<int, ll>>> a(n + 2);

	for (int i = 0; i < m; i++) {
		int l, r;
		ll v;
		cin >> l >> r >> v;
		a[r].emplace_back(l, v);
	}


	vector<ll> dp(n + 2);

	ll ans = 0;
	for (int i = 1; i <= n + 1; i++) {
		dp[i] = query(0, 0, n + 2, 0, i);
		update(0, 0, n + 2, i, i + 1, dp[i]);
		for (auto p: a[i]) {
			update(0, 0, n + 2, 0, p.first, p.second);
			ans += p.second;
		}
	}

	cout << ans - dp[n + 1];
}



Measured memory_bytes: 23968
#include<iostream>
#include<algorithm>
using namespace std;

int color[3] = {3,1,2};
int main(){
  int n,k;
  cin >> n >> k;
  for(int i = 0; i < k; i++){
    int a,b;
    cin >> a >> b;
    int ans = min(a, b);
    if(a + b > n){
      cout << color[(n - max(a, b) + 1)%3] << endl;
    }else{
      cout << color[ans%3] << endl;
    }
  }
  return 0;
}

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

using namespace std;

int main(void){

    string s;
    cin >> s;
    
    int result = 700;
    for(int i=0; i<s.size(); i++) {
        if(s.substr(i,1) == "o") result += 100;
    }

    cout << result << endl;

    return 0;
    
}


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

class B
{
	static void Main()
	{
		var s = Console.ReadLine();
		var s1 = s.Remove(s.Length / 2);
		var s2 = string.Join("", s1.Reverse());
		Console.WriteLine(s1 == s2 && $"{s1}{s[s.Length / 2]}{s1}" == s ? "Yes" : "No");
	}
}


Measured memory_bytes: 26672
#include <cstdio>
#include <vector>
#include <map>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <set>
#include <cstring>
#include <string>
#include <queue>
using namespace std;
#define LL long long
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair < int , int >

int n,m,p;
LL dist[2505];
bool vis[2505];
int unreach[2505];
vector < pii > E[2505];

LL max( LL a, LL b ){
	if ( a > b ) return a;
	return b;
}

int reach( int u ){
	if ( u == n ) return true;
	if ( vis[u] ) return false;
	vis[u] = true;
	for ( auto it : E[u] ){
		if ( reach(it.fi) ) return true;
	}
	return false;
}

void dfs( int u ){
	if ( vis[u] ) return;
	vis[u] = true;
	for ( auto it : E[u] ){
		dfs(it.fi);
	}
}

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> m >> p;

	bool loop = false;
	for ( int i = 0; i < m; i++ ){
		int u , v, z;
		cin >> u >> v >> z;
		E[u].pb(mp(v,z));
	}

	for ( int i = 1; i <= n; i++ ){
		memset(vis,0,sizeof(vis));
		if ( reach(i) ) unreach[i] = false;
		else unreach[i] = true;
	}
	memset(vis,0,sizeof(vis));
	dfs(1);
	for ( int i = 1; i <= n; i++ ){
		if ( unreach[i] == false && vis[i] == false ) unreach[i] = true;
	}

	for ( int i = 1; i <= n; i++ ) dist[i] = 1e18;
	dist[1] = 0;
	for ( int V = 0; V < n; V++ ){
		for ( int u = 1; u <= n; u++ ){
			for ( auto it : E[u] ){
				if ( dist[it.fi] > dist[u] - it.se + p ){
					dist[it.fi] = dist[u] - it.se + p;
				}
			}
		}
	}

	for ( int u = 1; u <= n; u++ ){
		for ( auto it : E[u] ){
			if ( dist[it.fi] > dist[u] - it.se + p && !unreach[it.fi] ){
				cout << -1 << endl;
				return 0;
			}
		}
	}
	if ( dist[n] > 0 ) dist[n] = 0;
	else if ( dist[n] < 0 ) dist[n] = -dist[n];
	cout << dist[n] << endl;
	return 0;
}

Measured memory_bytes: 512
madd (Just a) (Just b) = Just (a+b)
madd _ _ = Nothing

mmax mx [] = mx
mmax mx (m:ms) = 
    case mx of
        Nothing -> mmax m ms
        Just a  -> case m of
                    Nothing -> mmax mx ms
                    Just b  -> mmax (Just (maximum [a,b])) ms

-- |
-- >>> cmpl [5,5,5] [1,0,1] [1,0,1]
-- Just 15
cmpl _ _ [] = Just 0
cmpl (a:as) (b:bs) (c:cs) = madd v v'
    where
        v = if b /= c then Nothing else Just a 
        v'= cmpl as bs cs
-- |
-- >>> cmpa [[47,32,11],[99,12,-8]] [[1,0,1],[0,1,0]] [[1,0,1],[0,1,0]]
-- Just 193
cmpa _ _ [] = Just 0
cmpa (a:as) (b:bs) (c:cs) = madd (cmpl a b c) (cmpa as bs cs)

scn' a b c =
    if la >= lc then sa:sr else []
    where
        sa = cmpa a b c
        sr = scn' (tail a) (tail b) c
        la = length a
        lc = length c
scn :: [[Int]] -> [[Int]] -> [[Int]] -> [Maybe Int]
scn a b c =
    if la >= lc then (sa ++ sr) else []
    where 
        sa = scn' a b c
        sr = scn (map tail a) (map tail b) c
        la = length $ head a
        lc = length $ head c

ans ([h,w]:x) = 
    let a = take h x
        b = take h $ drop h x
        c = drop (2*h+1) x
        r = mmax Nothing $ scn a b c
    in
        case r of
            Nothing -> "NA"
            Just v  -> show v

main = do
    c <- getContents
    let i = map (map read) $ map words $ lines c :: [[Int]]
        o = ans i
    putStrLn o



Measured memory_bytes: 7532
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] p = new int[N];
        for (int i = 0; i < p.length; i++) {
            p[i] = sc.nextInt();
        }
        Arrays.sort(p);
        int sum = 0;
        for (int i = 0; i < K; i++) {
            sum += p[i];
        }
        System.out.println(sum);
        sc.close();
    }
}

Measured memory_bytes: 38952
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
	int dis[10],v1,v2;
	while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d"
		,&dis[0],&dis[1],&dis[2],&dis[3],&dis[4],&dis[5],&dis[6],&dis[7],&dis[8],&dis[9],&v1,&v2)!=EOF){
			int sum=0;
			for(int i=0;i<10;i++)sum+=dis[i];
			double col=(double)sum*(double)v1/(double)(v1+v2);
			//cout<<"col:"<<col<<endl;
			sum=0;
			for(int i=0;i<10;i++){
				sum+=dis[i];
				if((double)sum-col>=-0.000000001){sum=i;break;}
			}
			cout<<sum+1<<endl;
	}
	return 0;
}

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

template <typename anyType>
void err(anyType message) {
    std::cerr << message << std::endl;
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);

#if DEBUG_ON
    freopen("input", "r", stdin);
#endif

    int m, d;
    std::cin >> m >> d;
    int last[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    if (last[m - 1] == d) {
        std::cout << 1 << '\n';
    } else {
        std::cout << 0 << '\n';
    }
    return 0;
}

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

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

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

    cout << ((b - a) % 2 == 0 ? "Alice" : "Borys") << endl;

    return 0;
}

Measured memory_bytes: 892
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
const int dx[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy[8] = { 1,1,1,0,0,-1,-1,-1 };


//LOVE NyantakoGG	https://www.youtube.com/channel/UC6XdFs8T6Ei54O0FYl3PVVA


using namespace std;



int main() {
	int N;
	cin >> N;
	vector<int>data(1000000);
	for (int i = 0; i < N; i++) {
		int n;
		cin >> n;
		data[n]++;
	}
	int M = 0;
	int ans;
	for (int i = 0; i < 100000; i++) {
		if (M < data[i] + data[i + 1] + data[i + 2]) {
			chmax(M, data[i] + data[i + 1] + data[i + 2]);
			ans = i + 1;
		}
	}
	if (ans > 0) {
		cout << data[ans - 1] + data[ans] + data[ans + 1] << endl;
	}
	else {
		cout << data[0] + data[1] + data[2] << endl;
	}
}


Measured memory_bytes: 4096
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    if(A+B>C+D){
        cout << "Left" << endl;
    }
    if(A+B==C+D){
        cout <<"Balanced"<< endl;
    }
    if(A+B<C+D){
        cout<<"Right"<< endl;
    }
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
#define REP(i,m,n) for(LL i=(m);i<(n);i++)
	//i=m -> n-1(昇順)
#define RREP(i,m,n) for(LL i=(m);i>=(n);i--)
	//i=m -> n(降順)

int main(){
  LL k,a,b;
  cin >> k >> a >> b;
  
  REP(i,a,b+1){
    if(i % k == 0){
      cout << "OK" << endl;
      return 0;
    }
  }
  
  cout << "NG" << endl;
  
  return 0;
}


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

using namespace std;

#define int long long

signed main(){
  int X,Y,Z,K;
  cin >> X >> Y >> Z >> K;
  
  vector<int> a(X),b(Y),c(Z),v;
  
  for(auto &i:a)cin >> i;
  
  sort(a.begin(), a.end(), greater<int>());
  
  for(auto &i:b)cin >> i;
  
  sort(b.begin(), b.end(), greater<int>());
  
  for(auto &i:c)cin >> i;
  
  sort(c.begin(), c.end(), greater<int>());
  
  for(int i = 0;i<X; i++){
    for(int j = 0;j<Y;j++){
      for(int k = 0;k<Z;k++){
        if((i+1)*(j+1)*(k+1) <= K) v.push_back(a[i]+b[j]+c[k]);
        else break;
      }
    }
  }
  sort(v.begin(), v.end(), greater<int>());
  for(int i = 0;i<K;i++)cout << v[i] << endl;
  
  return 0;
}
  


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

const int INF = (1 << 30) - 1;

int N, Q;
int S[1000005], sIdx[1000005];
pair < int , int > sorted[1000005];

int main()
{

    cin >> N >> Q;
    for ( int i = 0; i < N; i++ ) { cin >> S[i];
        sorted[i] = make_pair(S[i], i);
    }

    sort(sorted, sorted + N);

    for ( int i = 0; i < N; i++ ) {
        sIdx[sorted[i].second] = i;
    }

    set < int > leader;

    while ( Q > 0 ) {
        string T;
        cin >> T;
        int a, x;
        if ( T == "ADD" ) {
            cin >> a;
            leader.insert(a - 1);
        } else if ( T == "REMOVE" ) {
            cin >> a;
            leader.erase(a - 1);
        } else {
            int ng = -1, ok = INF;
            bool flag = false;
            vector < int > pos;

            cin >> x;
            for ( auto &d : leader ) {
                pos.push_back(sIdx[d]);
            }
            sort(begin(pos), end(pos));

            while ( abs(ng - ok) > 1 ) {
                int r = (ng + ok) / 2;
                int cnt = 0;
                int covered = -1; //どこまでやってるか
                for ( auto right : pos ) {
                    int left = lower_bound(sorted, sorted + N, make_pair(sorted[right].first - r, -INF)) - sorted;
                    right = upper_bound(sorted, sorted + N, make_pair(sorted[right].first, INF)) - sorted - 1;

                    left = max(covered + 1, left);

                    cnt += right - left + 1;
                    covered = right;
                }
                if ( (N - x) <= cnt ) {
                    ok = r;
                    flag = true;
                } else {
                    ng = r;
                }
            }
            if ( flag ) {
                cout << ok << endl;
            } else {
                cout << "NA" << endl;
            }
        }
        Q--;
    }
    return ( 0 );
}



Measured memory_bytes: 18792
#[allow(unused_macros)]
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)]
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)]
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, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      s: chars,
    }
    for d in 0..26 {
        let t = ('a' as u8 + d) as char;
        let mut cnt1 = 0 as i64;
        let mut cnt2 = 0 as i64;

        let mut left = 0;
        for i in 0..s.len() {
            // Reset
            if cnt2 > cnt1 {
                cnt1 = 0;
                cnt2 = 0;
                left = i;
            }

            if s[i] == t {
                cnt1 += 1;
                let len = (i-left+1) as i64;

                // debug!(t, left, i, len, cnt1, cnt2);

                if len >=2 && cnt1 > len/2 {
                    return println!("{} {}", left+1, i+1);
                }
            } else {
                cnt2 += 1;
            }
        }
    }
    println!("{} {}", -1, -1);
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        System.out.println(a / 3);
    }

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int M, N, tmp;

    cin >> M >> N;
    vector<int> cnt(M, 0);

    for (int i = 0; i < M; ++i)
        for (int j = 0; j < N; ++j) {
            cin >> tmp;
            cnt[i] += tmp;
        }

    int ans = 0;
    for (int i = 0; i < M; ++i)
        ans = max(ans, cnt[i]);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1192
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int x_1, y_1, x_2, y_2;
  scanf("%d%d%d%d", &x_1, &y_1, &x_2, &y_2);
  int dx = x_2 - x_1;
  int dy = y_2 - y_1;
  printf("%d %d %d %d\n", x_2 - dy, y_2 + dx, x_2 - dx - dy, y_2 + dx - dy);
  return 0;
}


Measured memory_bytes: 128
using System;
class program{
  static void Main(){
    string[] s=Console.ReadLine().Split(' ');
    int A=int.Parse(s[0]);
    int B=int.Parse(s[1]);
    
    int Maxim=Math.Max(A+B,A-B);    
    Console.WriteLine(Math.Max(Maxim,A*B));
  }
}

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

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

int main() {
	ll n;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		ll ans = 0;
		for (int x = 1; x * x <= i; ++x) {
			for (int y = x; y * y <= i; ++y) {
				for (int z = y; z * z <= i; ++z) {
					if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
						if(x == y && z == y){
							ans++;
						} else if (x != y && z != y && x != z){
							ans += 6;
						}else{
							ans += 3;
						}
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3520
#include <math.h>

#include <algorithm>
#include <iostream>
using namespace std;

int main() {
    // int n;
    // cin >> n;
    // int a[n];
    // sort(a, a + n);
    // int len = 0;
    // for (int i = 0; i < n; i++) cin >> a[i];
    // for (int i = 0; i < n; i++) {
    //     for (int j = i + 1; j < n; j++) {
    //         for (int k = j + 1; k < n; k++) {
    //             if (a[i] + a[j] > a[k]) len = max(len, a[i] + a[j] + a[k]);
    //         }
    //     }
    // }
    // cout << len << endl;

    // int n;
    // cin >> n;
    // int x[n], y[n];
    // double dist = 0.0;
    // for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
    // for (int i = 0; i < n; i++) {
    //     for (int j = i + 1; j < n; j++) {
    //         dist = max(dist, sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j],
    //         2)));
    //     }
    // }
    // cout << dist << endl;

    int k, s;
    cin >> k >> s;
    int count = 0;
    for (int x = 0; x <= k; x++) {
        for (int y = 0; y <= k; y++) {
            int z = s - x - y;
            if (z >= 0 && z <= k) count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3640
def main():
    el = list(input())
    oplist = ["+", "-"]

    for op1 in oplist:
        for op2 in oplist:
            for op3 in oplist:
                q = "{}".join(el)
                q = q.format(op1, op2, op3)
                if eval(q) == 7:
                    print(q + "=7")
                    return 0

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
using namespace std;
int N, M, a[2009], b[2009], c[2009]; long long d[1009];
int main() {
	scanf("%d %d", &N, &M);
	for (int i = 0; i < M; i++) scanf("%d %d %d", &a[i], &b[i], &c[i]), a[i]--, b[i]--;
	fill(d + 1, d + N, -1LL << 60);
	bool f = false;
	for (int i = 0; i < 2 * M; i++) {
		for (int j = 0; j < M; j++) {
			if (i >= M && b[j] == N - 1 && d[b[j]] < d[a[j]] + c[j]) f = true;
			d[b[j]] = max(d[b[j]], d[a[j]] + c[j]);
		}
	}
	if (f) printf("inf\n");
	else printf("%lld\n", d[N - 1]);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    double p[n];
    double e[n];
    for (int i=0; i<n; i++){
        cin >> p[i];
        e[i] = (1+p[i]) * p[i] / 2 / p[i];
    }
    double max = 0.0;
    double total = 0.0;
    for (int i=0; i<k; i++){
        max += e[i];
        total += e[i];
    }
    for (int i=0; i<n-k; i++){
        total = total + e[i+k] - e[i];
        if (total > max){
            max = total;
        }
    }
    printf("%.12f\n",max);
}

Measured memory_bytes: 3328
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<assert.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,b,a) for(int i=(b);i>=(a);--i)
#define bfo(i,v,u) for(int i=BB[v],u=B[i][1];i;u=B[i=B[i][0]][1])
#define mset(a,x) memset(a,x,sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(b))
template<typename T> bool chkmin(T &a,const T &b) {return b<a?a=b,1:0;}
template<typename T> bool chkmax(T &a,const T &b) {return b>a?a=b,1:0;}
using namespace std;
typedef long long ll;
int read(){int n=0,p=1;char ch;for(ch=getchar();ch<'0' || ch>'9';ch=getchar())if(ch=='-') p=-1;for(;'0'<=ch && ch<='9';ch=getchar()) n=n*10+ch-'0';return n*p;}
int n,k,bitcnt[1<<18];
int lowbit(int x) {return x&-x;}
bool use[1<<18];
void solve(int st,int en)
{
	int x=lowbit(st^en);
	use[x]=1;
	int w=-1;
	fo(i,0,n-1)
		if(!use[1<<i]) {w=i;break;}
	if(w==-1)
	{
		printf("%d %d ",st,en);
		use[x]=0;
		return;
	}
	int t1=st ^ (1<<w);
	solve(st,t1);
	int t2=t1 ^ x;
	solve(t2,en);
	use[x]=0;
}
int main()
{
	n=read();
	int A=read(),B=read(),cnt=0;
	fo(i,0,n-1) if((A^B) & (1<<i)) ++cnt;
	if(!(cnt&1)) return puts("NO"),0;
	puts("YES");
	solve(A,B);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <unordered_map>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    long n;
    cin >> n;
    string s;
    cin >> s;
    
    long x = 0;
    long m = -1000;
    
    REP(i,s.size()) {
        m = max(m, x);
        if (s[i] == 'I') {
            x++;
        } else {
            x--;
        }
        m = max(m, x);
    }
    cout << m << endl;
}


Measured memory_bytes: 256
a = int(input())
b = list(map(int, input().split()))
c = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0}
d = 0
for i in b:
    if 1 <= i <= 399:
        c[0] += 1
    elif 400 <= i <= 799:
        c[1] += 1
    elif 800 <= i <= 1199:
        c[2] += 1
    elif 1200 <= i <= 1599:
        c[3] += 1
    elif 1600 <= i <= 1999:
        c[4] += 1
    elif 2000 <= i <= 2399:
        c[5] += 1
    elif 2400 <= i <= 2799:
        c[6] += 1
    elif 2800 <= i <= 3199:
        c[7] += 1
    else:
        d += 1
e = 0
for k, v in c.items():
    if v != 0:
        e += 1
print(str(max(e, 1)) + " " + str(e + d))


Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int qmax(int a, int b){
	return (a > b) ? a : b;
}

char s[22];

int n;
void dfs(int now, int m){
	if(now == n){
		puts(s);
		return ;
	} 
	for(int i = 0; i <= m; i++){
		s[now] = (char)('a' + i);
		dfs(now+1, qmax(m, i+1));
	}
}

int main(){
	cin >> n;
	dfs(0, 0);
	return 0;
} 

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


ll gdc(ll a , ll b)
{

    if(a== 0 )
        return b ;
    if(b==0)
        return a ;





    return gdc(b%a , a ) ;
}

static int x = []() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  return 0;
}();




int main()
{

    ll t ;
    cin>>t;

    ll count = 0 ;

    for(ll i= 1 ; i <= t ; i ++)
    {
        for(ll j =1   ;  j <= t ; j++)
        {

            for( ll k = 1 ; k <=t ; k++)
            {



                count+= gdc(gdc(i , j ) , k ) ;
            }
        }
    }

    cout<< count <<endl ;


    return 0 ;
}


Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int n;
  cin>>n;
  string s;
  int ccount[26], ccount2[26];
  REP(i, 26) ccount[i]=0, ccount2[i]=0;
  cin>>s;
  REP(i, s.size()){
    ++ccount[s[i]-'a'];
  }
  //REP(i, 26) cout<<ccount[i]<<endl;
  REP(i, n-1){
    cin>>s;
    REP(j, s.size()){
      ++ccount2[s[j]-'a'];
    }
    REP(j, 26){
      ccount[j] = min(ccount[j], ccount2[j]);
    }

    REP(i, 26)ccount2[i]=0;
  }

  char c;
  REP(i, 26){
    c='a' + i;
    REP(j, ccount[i]) cout<<c;
  }
  cout<<endl;


  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = []

def f(s):
    if int(s) > N:
        return 0
    if all(s.count(i) >= 1 for i in '753'):
        A.append(int(s))
    for i in '753':
        f(s + i)

f('0')
print(len(A))
# print(sorted(A))

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

int M, N, numHouse, gr, gc;
int map[12][12];
P neighbors[12][12][4];
int dp[1<<24];

int rec(int r, int c, int n){
    if(n == 0){
        return r == gr || c == gc;
    }

    for(int i=0;i<4;++i){
        int rn, cn;
        std::tie(rn, cn) = neighbors[r][c][i];

        if(rn != -1){
            neighbors[rn][cn][(i + 2) & 3] = neighbors[r][c][(i + 2) & 3];
        }
    }
    
    int res = 0;
    for(int i=0;i<4;++i){
        int rn, cn;
        std::tie(rn, cn) = neighbors[r][c][i];

        if(rn == -1){
            continue;
        }

        res += rec(rn, cn, n - 1);
    }

    for(int i=0;i<4;++i){
        int rn, cn;
        std::tie(rn, cn) = neighbors[r][c][i];

        if(rn != -1){
            neighbors[rn][cn][(i + 2) & 3] = std::make_tuple(r, c);
        }
    }

    return res;
}

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

    while(true){
        std::cin >> M >> N;

        if(M == 0){
            break;
        }

        numHouse = 0;
        std::fill(&neighbors[0][0][0], &neighbors[0][0][0] + 12 * 12 * 4, std::make_tuple(-1, -1));
        memset(dp, -1, sizeof(dp));

        for(int i=0;i<N;++i){
            for(int j=0;j<M;++j){
                std::cin >> map[i][j];

                if(map[i][j] == 1){
                    numHouse += 1;
                }else if(map[i][j] == 2){
                    gr = i;
                    gc = j;
                }
            }
        }

        for(int i=0;i<N;++i){
            for(int j=0;j<M;++j){
                if(map[i][j] == 0){
                    continue;
                }

                for(int k=j-1;k>=0;--k){ // 左
                    if(map[i][k] > 0){
                        neighbors[i][j][0] = std::make_tuple(i, k);
                        break;
                    }
                }

                for(int k=j+1;k<M;++k){ // 右
                    if(map[i][k] > 0){
                        neighbors[i][j][2] = std::make_tuple(i, k);
                        break;
                    }
                }

                for(int k=i-1;k>=0;--k){ // 上
                    if(map[k][j] > 0){
                        neighbors[i][j][1] = std::make_tuple(k, j);
                        break;
                    }
                }

                for(int k=i+1;k<N;++k){ // 下
                    if(map[k][j] > 0){
                        neighbors[i][j][3] = std::make_tuple(k, j);
                        break;
                    }                
                }
            }
        }

        int res = rec(gr, gc, numHouse);
        std::cout << res << std::endl;
    }
}


Measured memory_bytes: 68660
#include<bits/stdc++.h>
#define ll long long
int M=1e9+7;
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n],i;
    ll ans=0;
	cin>>a[0];
	for(i=1;i<n;i++)
	{
		cin>>a[i];
		if(a[i]<a[i-1])
		{
			ans+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	cout<<ans;
}

Measured memory_bytes: 4400
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vl A(N);
    rep(i,N){
        cin >> A[i];
    }
    if(A[0]!=0){
        cout << -1 << endl;
        return 0;
    }
    rep(i,N-1){
        if(A[i+1]-A[i]>1){
            cout << -1 << endl;
            return 0;
        }
    }
    ll ans=A[N-1];
    per(i,N-2){
        if(A[i]+1!=A[i+1]){
            ans+=A[i];
        }
        else{
            continue;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4772
X, Y = map(int, input().split())
ans = 0

if X <= 3:
    ans += (4 - X) * 10 ** 5

if Y <= 3:
    ans += (4 - Y) * 10 ** 5

if X == Y == 1:
    ans += 4 * 10 ** 5

print(ans)


Measured memory_bytes: 2940
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        if (n > m) {
            System.out.println(n - 1);
        } else {
            System.out.println(n);
        }
    }
}


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

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

  vector<string> blue(N);
  for (int i = 0; i < N; i++) {
    cin >> blue.at(i);
  }
  int M;
  cin >> M;
  vector<string> red(M); 
  for (int i = 0; i < M; i++) {
    cin >> red.at(i);
  }
  
  int sum=0;
  
  for (int i = 0; i < N; i++) {
  	int score = 0;
  	for(int j=0; j<N; j++){
  		if(blue.at(i)==blue.at(j)){
  			score++;
  		}
  	}
  	
  	for(int j=0; j<M; j++){
  		if(blue.at(i)==red.at(j)){
  			score--;
  		}
  	}
  	sum=max(sum,score);
  }
  cout <<sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long long ll;

template <typename T> void max_self(T& a, T b){
  a = max(a,b);
}

template <typename T> void min_self(T& a, T b){
  a = min(a,b);
}

void solve(){	
  int n,x,t;
  cin>>n>>x>>t;
  ll ans = n/x;
  if(n%x)
    ans++;

  cout<<ans*t<<endl;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //int t; cin >> t;
  //while(t--) solve();
  //
  solve();
  return 0;
}


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

int32_t main() {

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

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);


	int n;
	cin >> n;
	string s[n];
	map<string, int> m;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		m[s[i]]++;
	}

	cout << m.size();



	return 0;
}

Measured memory_bytes: 25464
K,A,B = map(int,input().split())
if B-A<=2:
    print(1+K)
else:
    if K<=A-1:
        print(1+K)
    else:
        d = K-(A-1)
        if d==1:
            print(A+1)
        elif d%2==0:
            print(B+((d-2)//2)*(B-A))
        else:
            print(B+((d-3)//2)*(B-A)+1)

Measured memory_bytes: 61760
import sys
readline = sys.stdin.readline

def f(x):
    if x % 2 == 0:
        if (x//2) % 2 == 0:
            return x ^ 0
        else:
            return x ^ 1
    else:
        if ((x+1)//2) % 2 == 0:
            return 0
        else:
            return 1

def main():
    A, B = map(int, readline().rstrip().split())
    print(f(A-1) ^ f(B))

if __name__ == '__main__':
    main()

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

int A,B,C;

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

for(int i=1; i<=2*B; i++){
    if(A*i%B==C){
        puts("YES"); return 0;
    }
}

puts("NO"); return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int l;
    cin >> l;
    int n = 0;
    while((1 << n) <= l) n++;
    vector<vector<int>> v;
    for (int i = 0; i < n-1; ++i) {
        v.push_back({i+1, i+2, 0});
        v.push_back({i+1, i+2, 1 << i});
    }
    int p = (1 << (n-1));
    for (int i = n-2; i >= 0; --i) {
        if(l & (1 << i)){
            v.push_back({i+1, n, p});
            p += (1 << i);
        }
    }
    printf("%d %d\n", n, static_cast<int>(v.size()));
    for (auto &i : v) {
        for (int j = 0; j < i.size(); ++j) {
            if(j) printf(" ");
            printf("%d", i[j]);
        }
        printf("\n");
    }
    return 0;
}


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

using namespace std;

int main()
{
    long long int ans = 5;
    long long int a[5];
    long long int n;


    cin >> n;

    for (int i = 0; i < 5; i++) {
        cin >> a[i];
    }

    sort(a, a+5);

    if (n > a[0]) {
        ans += ((n-a[0])/a[0]);

        if ((n-a[0]) % a[0] != 0) ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n;cin>>n;
    n%=10;
    if(n==2 or n==4 or n==5 or n==7 or n==9) cout<<"hon"<<endl;
    else if(n==3) cout<<"bon"<<endl;
    else cout<<"pon"<<endl;
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000

//using namespace atcoder;
using namespace std;

bool issq(ll c){
  for (int i = 0; i*i <= c; i++){
    if (i*i == c)
      return true;
  }
  return false;
}

ll pow10(ll n){
  if (n == 0)
    return 1;

  return 10 * pow10(n-1);
}

int main(void){
  string a, b;
  cin >> a >> b;
  
  ll c = stoi(a) * pow10(b.size()) + stoi(b);

  if (issq(c))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


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

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

    int n, d, ans = 0;
    cin >> n >> d;

    vector<vector<int>> x(n, vector<int>(d));

    rep(i, 0, n) rep(j, 0, d) cin >> x[i][j];

    rep(i, 0, n - 1) rep(j, i + 1, n)
    {
        int s = 0;
        rep(k, 0, d) s += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
        int t = sqrt(s);
        if (t * t == s)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  int n; cin >> n;
  int tmp = 0, sum = 0;
  for(int i = 0; i < n; i++){
    int a; cin >> a;
    if(a > tmp){
      sum += tmp;
      tmp = a;
    }
    else sum += a;
  }
  if(sum > tmp) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main()
{
    int n; cin >> n;
    vector<int> a(n); rep(i, n) cin >> a[i];
    Sort2(a);
    ll ans = 0;
    int t = n - 1;
    rep(i,n){
        ll lim = 2;
        if(i == 0) lim = 1;
        rep(j,lim){
            if(t > 0){
                ans += a[i];
                t--;
            }
        }
    }
    cout << ans << endl;
}

/*
g++ d.cpp
./a.out

oj d https://atcoder.jp/contests/abc172/tasks/abc172_c
g++ c.cpp
oj t
*/


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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

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

    static int64_t dp[51][51][2501];
    dp[0][0][0] = 1;
    for(int i=0; i<N; i++) for(int j=0; j<N; j++) for(int k=0; k<=K; k++){
        if(dp[i][j][k] == 0) continue;
        add(dp[i+1][j][k+2*j], dp[i][j][k]);
        for(int ball=0; ball<2; ball++) for(int box=0; box<2; box++){
            if(j+1-ball-box >= 0) add(dp[i+1][j+1-ball-box][k+2*j], dp[i][j][k] * pow(j, ball+box));
        }
    }
    cout << dp[N][0][K] << endl;
}


Measured memory_bytes: 48512
N, M = map(int, input().split())
bridge = [list(map(int, input().split())) for i in range(M)]
bridge = sorted(bridge, key = lambda x:x[1])
ans = 1
edge = bridge[0][1]
for i in range(1,M):
    if bridge[i][0] < edge:
        continue
    else:
        edge =bridge[i][1]
        ans += 1
print(ans)
    
    
    


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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



void func(long long N, std::vector<long long> a){

    lli ans = 0;
    REP(i,0,N){
        if(i%2==0 && a[i]%2==1){
            ans++;
        }
    }

    cout<<ans<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    func(N, std::move(a));
    return 0;
}


Measured memory_bytes: 3684