akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

int main()
{
    long long X;
    std::cin >> X;
    constexpr int RANGE_MAX = 178;
    long long pow5[RANGE_MAX];
    for (int i = 0; i < RANGE_MAX; i++)
    {
        long x = i;
        pow5[i] = x * x * x * x * x;
    }

    for (int A = 0; A < RANGE_MAX; A++)
    {
        for (long long B = 0; B < A; B++)
        {
            if (pow5[A] - pow5[B] == X)
            {
                std::cout << A << " " << B << std::endl;
                return 0;
            }
            else if (pow5[A] + pow5[B] == X)
            {
                std::cout << A << " " << -B << std::endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
#define int long long int
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);

void solve(long long X)
{
  int ans = (X / 500) * 1000;
  ans += 5 * ((X % 500) / 5);
  cout << ans << endl;
}

signed main()
{
  long long X;
  scanf("%lld", &X);
  solve(X);
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
  public static void main (String[] arg) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int A[] = new int[N];
    int Max = 0;
    int Maxi = 0;
    int Max2 = 0;
    
    for (int i = 0; i < N; i++){
      A[i] = scan.nextInt();
      if(A[i] > Max){
        Max2 = Max;
        Max = A[i];
        Maxi = i;
      } else if(A[i] > Max2){
        Max2 = A[i];
      }
    }
    
    for(int i = 0; i < N; i++){
      if(i == Maxi){
        System.out.println(Max2);
      } else {
        System.out.println(Max);
      }
    }
  }
}

Measured memory_bytes: 92948
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;
static const int MAX = 50;

int main() {
    int N, A[MAX], B[MAX], C[MAX];
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    for (int i = 0; i < N - 1; i++) cin >> C[i];
    
    int s = 0;
    for (int i = 0; i < N; i++) {
        int dish = A[i] - 1;
        s += B[dish];
        if (i + 1 < N && A[i + 1] - 1 == dish + 1) {
            s += C[dish];
        }
    }
    
    cout << s;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    vl ac(n,0),wa(n,0);
    rep(i,m){
        ll p; string r;cin>>p>>r;
        if(r=="AC"){
            ac[p-1]=1;
        }else{
            if(!ac[p-1])wa[p-1]++;
        }
    }
    ll ans=0;
    rep(i,n)if(ac[i])ans+=wa[i];
    puta(sum(ac),ans);
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

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

namespace {  // 名前なし名前空間
	// gcd, lcm は C++17 でstdに標準入りしたので言語のバージョンに注意
	// 最大公約数
	ll gcd(ll a, ll b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	// 最小公倍数
	ll lcm(ll a, ll b) {
		return a / gcd(a, b) * b;
	}
}

int main() {

	int n;
	cin >> n;
	vector<vector<int>> a(n, vector<int>(n - 1));
	rep(i, n)rep(j, n - 1) {
		int tmp;
		cin >> tmp;
		a[i][j] = tmp - 1;
	}
	// それぞれの選手がどこまでいったか
	vector<int> matchNum(n, 0);
	int sum = 0;

	int ans = 0;

	vector<bool> used(n, false);
	int dest = n * (n - 1);
	int prevSum;
	vector<int> movePlayer(n, 0);
	queue<int> que;
	int moveNum = 0;
	int prevMoveNum = -1;
	while (sum != dest) {
		// 一人に集中しているのがおそらくTLEの原因
		// 初期化
		rep(i, n) {
			used[i] = (matchNum[i] == n - 1);
		}
		prevSum = sum;
		moveNum = 0;
		if (prevMoveNum == -1) { // 最初は全員見る
			// 全選手見ていく
			rep(i, n - 1) {
				if (used[i]) continue;
				int opponent = a[i][matchNum[i]];
				if (used[opponent]) continue;
				// 相手も自分を求めてた
				if (a[opponent][matchNum[opponent]] == i) {
					// match!!!!
					matchNum[opponent]++;
					matchNum[i]++;
					used[opponent] = true;;
					used[i] = true;
					sum += 2;
					que.push(i);
					que.push(opponent);
					moveNum += 2;
				}
			}
		}
		// 進んだ選手だけを見ればいい
		rep(i, prevMoveNum) {
			int j = que.front();
			que.pop();
			if (used[j]) continue;
			int opponent = a[j][matchNum[j]];
			if (used[opponent])continue;

			if (a[opponent][matchNum[opponent]] == j) {
				matchNum[opponent]++;
				matchNum[j]++;
				used[opponent] = true;
				used[j] = true;
				sum += 2;
				que.push(opponent);
				que.push(j);
				moveNum += 2;
			}
		}
		prevMoveNum = moveNum;
		ans++;
		if (sum == prevSum) {
			cout << -1 << endl;
			return 0;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#include<numeric>
#define int long long
#define ld long double
#define all(x) x.begin(),x.end()
const int maxn=1000000;
#define what_is(x) cerr << #x << " is " << x << endl;
const int MOD = 1e9 + 7;
using namespace std;
string abc="abcdefghijklmnopqrstuvwxyz";
int powmod(int a, int b, int MOD = MOD){
    if(!a and !b)    return 1ll;
    if(!a)    return a;
    int res = 1ll;
    b %= (MOD - 1ll), a %= MOD;
    while(b){
        if(b%2 == 1)    res = (res * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }
    return res;
}
int popcount(uint32_t n)
{
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
bool check(int n) {return (((double)sqrt(n)-floor((double)sqrt(n)))==0);}
vector<bool> sieve(maxn + 1, true);
void fillprime() {
    sieve[0] = sieve[1] = false;
    for (int i = 2; i <= maxn; ++i) {
        if (sieve[i] && (int) i * i <= maxn) {
            for (int j = i * i; j <= maxn; j += i) {
                sieve[j] = false;
            }
        }
    }
}
const int nn=1e5+5;
void solve() {
       int n;
       cin>>n;
       map<string,int> mp;
       string s;
       while(n--)
       {
           cin>>s;
           mp[s]++;
       }
       cout<<"AC x "<<mp["AC"]<<"\n";
    cout<<"WA x "<<mp["WA"]<<"\n";
    cout<<"TLE x "<<mp["TLE"]<<"\n";
    cout<<"RE x "<<mp["RE"]<<"\n";

}

int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    //fillprime();
    //int t;cin>>t;while(t--)
        solve();
}

Measured memory_bytes: 3808
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>

#define _USE_MATH_DEFINES
#include <math.h>  /* M_PI */

int main(){

    double r;
    cin >> r;

     // double型定数2
    // double a = std::numbers::pi;
    // std::cout << 2 * r * a << std::endl;


    printf("%.5f\n", 2* r * M_PI);
}

Measured memory_bytes: 3788
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
*/

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

	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];

	sort(allof(a), greater<ll>());

	ll edge[2];
	int cnt = 0;
	rep(i, n - 1) {
		if (a[i] == a[i + 1]) {
			edge[cnt++] = a[i];
			i++;
		}
		if (cnt == 2) break;
	}

	if (cnt != 2) {
		cout << 0 << endl;
		return 0;
	}

	cout << edge[0] * edge[1] << endl;

	return 0;
}


Measured memory_bytes: 1024
n = int(input())
s = [False]*13
h = [False]*13
c = [False]*13
d = [False]*13

for _ in range(n):
    m,a = input().split()
    if m == 'S':s[int(a)-1] = True
    if m == 'H':h[int(a)-1] = True
    if m == 'C':c[int(a)-1] = True
    if m == 'D':d[int(a)-1] = True

for i in range(13):
    if not s[i]: print("S %d"%(i+1))
for i in range(13):
    if not h[i]: print("H %d"%(i+1))
for i in range(13):
    if not c[i]: print("C %d"%(i+1))
for i in range(13):
    if not d[i]: print("D %d"%(i+1))



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

#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=2e4+5,U=1e9;
int a[N],b[N];

int main()
{
	//freopen("1.in","r",stdin);
	int n;
	cin>>n;
	rep(i,1,n)
	{
		int p;
		scanf("%d",&p);
		a[p]+=i;
		b[p+1]-=i;
	}
	rep(i,1,n){a[i]+=a[i-1];b[i]+=b[i-1];}
	rep(i,1,n)printf("%d\n",1+a[i]);
	rep(i,1,n)printf("%d\n",U+b[i]);
}

Measured memory_bytes: 768
import sys
from io import StringIO
import unittest
import math

def resolve():
    N, =  input().split()
    calc9(N)

# def resolve():
#     N, = map(int, input().split())
#     if N%9==0:
#         print("Yes")
#     else:
#         print("No")

def calc9(n):
    if len(n)==1:
        if n=='9' or n=='0':
            # print(n)
            print("Yes")
        else:
            # print(n)
            print("No")
    else:
        sum =0
        for s in n:
            sum=sum+int(s)
        calc9(str(sum))

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    # def test_入力例_1(self):
    #     input = """123456789"""
    #     output = """Yes"""
    #     self.assertIO(input, output)
    #
    def test_入力例_2(self):
        input = """0"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """31415926535897932384626433832795028841971693993751058209749445923078164062862089986280"""
        output = """No"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 72676
#include <iostream>
#include <algorithm>

using namespace std;

int n;
int m[105];
int X;

int main(void)
{
	cin >> n >> X;
	for(int i = 1; i <= n; i++) cin >> m[i];
	for(int i = 1; i <= n; i++) X -= m[i];
	sort(m+1, m+n+1);
	
	int ans = n;
	for(int i = 1; i <= n; i++){
		ans += X / m[i];
		X %= m[i];
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int i = 0;
		for(i = 1; i <= n; i = i * 2) {
		}
		i = i / 2;
		System.out.println(i);
	}
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}


int main(){
  int N,D,X;
  cin >> N >> D >> X;
  int ans = X;
  int A[N];
  rep(i,N){
    cin >> A[i];
    ans += (D-1) / A[i] +1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>bool chmax(T &a, const T &b) { if (b > a) { 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; }

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#pragma endregion

constexpr ll mod = 1e9 + 7;

long long inv(long long n) {
    long long res = 1;
    while (n > 1) {
        res *= (mod - mod / n);
        res %= mod;
        n = mod % n;
    }
    return res;
}

void solve() {
    ll n;
    cin >> n;
    vector<ll> x(n);
    for (int i=0; i<n; i++) {
        cin >> x.at(i);
    }

    ll ans = 0;
    ll p = 0;
    for (ll i=1; i<n; i++) {
        p += inv(i);
        p %= mod;
        if (p < 0) p += mod;
        ans += p * (x.at(i) - x.at(i-1)) % mod;
        ans %= mod;
    }
    if (ans < 0) ans += mod;
    for (ll i=1; i<n; i++) {
        ans *= i;
        ans %= mod;
    }

    cout << ans % mod << "\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


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

int main() {
  int h, w; cin >> h >> w;
  REP(i, h) {
    vector<char> c(w); REP(j, w) cin >> c.at(j);
    REP(j, 2) {{REP(k, w) cout << c.at(k);} cout << endl;}
  }
  
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int line = Integer.parseInt(br.readLine());

		line = line * line * line;
		System.out.println(line);
	}

}

Measured memory_bytes: 24032
#include<stdio.h>
int main(){
  char s[1002];
  int i;
  scanf("%s",s);
  for(i=0;s[i];i++){
    s[i]-=3;
    if(s[i]<'A')s[i]+=26;
  }
  printf("%s\n",s);
  return 0;
}
  

Measured memory_bytes: 524
#pragma GCC optimize(2)
#pragma G++ optimize(2)
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<vector>
typedef long long ll;
const int maxn = 1e6 + 7;
const int mod = 1e9 + 7;
const int INF = 0x7fffffff;
map<ll,ll>mp;
queue<int>q1;
deque<int>q2;
stack<int>st;
ll n, m,x,y,z,h,t,temp=0,s[maxn],flag,st2[maxn],w[maxn],ans = 0, k,flag1=10,flag2=0;
ll l[maxn],r[maxn],a[maxn];
int main(){
    scanf("%lld",&n);
    for(ll i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        l[i]=0;
        r[i]=n+1;
    }
    for(ll i=1;i<=n;i++)
    {
        while(!st.empty()&&a[st.top()]>a[i]){
            r[st.top()]=i;
            st.pop();
        }
        st.push(i);
    }
    for(ll i=n;i>=1;i--)
    {
        while(!st.empty()&&a[st.top()]>a[i]){
            l[st.top()]=i;
            st.pop();
        }
        st.push(i);
    }
    ///for(ll i=1;i<=n;i++) cout << l[i] << " ";
    for(ll i=1;i<=n;i++)
    {
        ans+=a[i]*(i-l[i])*(r[i]-i);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 12928
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma GCC optimize("O3")
#define rtn return
#define endl '\n'
#define F first
#define S second
#define mt make_tuple
#define pb push_back
#define int long long
#define sz(x) (int) x.size()
#define value_at find_by_order
#define index_of order_of_key
#define fill(a, v) memset(a,v,sizeof(a))
#define copy(a, b) memcpy(b,a,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i, n) for(int i=0;i<(int)n;++i)
#define per(i, n) for(int i=(int)n-1;i>=0;--i)
#define rep1(i, n) for(int i=1;i<=(int)n;++i)
#define per1(i, n) for(int i=(int)n;i>=1;--i)
#define loop(i, begin, end) for(int i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " = " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1 << " |";
  __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

typedef string str;
typedef long double db;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<str> vstr;
typedef vector<db> vdb;

template<class T, class V> void remin(T &a, V b) { a > b ? a = b : a = a; }
template<class T, class V> void remax(T &a, V b) { a < b ? a = b : a = a; }
template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


const int INF = 1e18;
const db EPS = 1e-15;
const int MOD = 1e9 + 7;
const int N = 1e5 + 7;

//

int32_t main() {
  FAST_IO;
  int s, w;
  cin >> s >> w;
  if (w >= s) {
    cout << "unsafe";
  } else {
    cout << "safe";
  }
  rtn 0;
}


Measured memory_bytes: 3536
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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;
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = __LONG_LONG_MAX__;

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,d,x; cin >> n >> d >> x;
    rep(i,0,n){
        int a; cin >> a;
        x++;
        x += (d-1)/a;
    }
    cout << x << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int n,x,cnt=1<<29;
    for(scanf("%d",&n);n--;){
        int r=0;
        scanf("%d",&x);
        for(;x%2<1;x/=2)r++;
        if(cnt>r){
            cnt=r;
        }
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)n; i++)
const int MOD = 1000000007;
// long long a;
int main(){
  int a,b,c ;
  cin >> a>>b >> c;
  int Max = max(a, max(b, c));
  if(2*Max == a+ b + c) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;//namespace

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define SANKOU(n,a,b) cout << ((n) ? (a) : (b) ) << endl;

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);// warshall-floyd

#define CIN(x) int x;cin>>x;
#define COUT(x) cout<<(x)<<endl;
#define SCOUT(x) cout<<(x)<<" ";

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_;
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl;

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end());

#define P pair<int,int>
#define V vector<int>

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    CIN(n);
    V vec(n);
    VECCIN(vec);
    deque<int> ans;
    REP(i,n){
        if(i%2==0)ans.push_back(vec[i]);
        else ans.push_front(vec[i]);
    }
    if(n%2)reverse(ALL(ans));
    FOREACH(x,ans)SCOUT(x);cout<<endl;
    return 0;
}


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


int main() {
    long long num, K;
    cin >> num >> K;

    long long sum = 0;
    for (int i=K;i<num+2;i++)
    {
        sum = (sum + (i * (num + 1 - i) + 1)) % 1000000007;
    }
    cout << sum << "\n";
    return 0;
}


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

int main() {
    long int  N,ans=0;
    long int  a[300010];
    cin >> N;
    for (int i = 0; i < 3*N; ++i) cin >> a[i];

    sort(a, a + 3*N, greater<long int>());
    for (int i = 0; i < N ; ++i){
      ans += a[2*i + 1] ;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
/*
P135
POJ 2377 Out of Hay
Difficult: 2
*/

#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <functional>
#include <string.h>
#include <cmath>

using namespace std;

const int MAXN = 10010;
const int MAXE = 1000000;

int uset[MAXN];
class UnionSet{
public:
    void Init(int n){
        for(int i=0; i<=n; ++i)
            uset[i] = i;
    }
    int Find(int x){
        if( uset[x] == x ) return x;
        else return uset[x] = Find(uset[x]);
    }
    bool Union(int x, int y){
        int fx = Find(x), fy = Find(y);
        if(fx == fy) return false;
        uset[fx] = fy;
        return true;
    }
};


int x[MAXN], y[MAXN];

double sq(int x)
{
    return x*x;
}

struct Edge{
    int u,v; double d;
    double input(){
        scanf("%d%d", &u, &v);
        u--, v--;
        d = sqrt(sq(x[u] - x[v]) + sq(y[u] - y[v]));
        return d;
    }

    bool operator<(const Edge&e)const{
        return d > e.d;
    }
}edge[MAXE];

const int INF = 1<<30;
int M, N;
double total = 0;
bool read()
{
    total = 0;
    scanf("%d%d", &N, &M);
    for(int i=0; i<N; ++i)
        scanf("%d%d", &x[i], &y[i]);
    for(int i=0; i<M; ++i)
        total += edge[i].input();
    return true;
}

double Kruskal()
{
    sort(edge, edge+M);
    UnionSet us;
    us.Init(N);
    double ans = 0;
    for(int i=0; i<M; ++i){
        int u = edge[i].u, v = edge[i].v;
        if(us.Union(u, v)) {
            ans += edge[i].d;
        }
    }
    return total - ans;
}

void solve()
{
    double ans = Kruskal();
    printf("%.5f\n", ans);
}

int main()
{
    read();
    solve();
}

Measured memory_bytes: 1796
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;
 
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> a(n), b(n);
    int sum = 0;
    int now = 0;
    rep(i, 0, n){
        cin >> a[i] >> b[i];
        sum += b[i];
        now |= a[i];
    }
    bool f[114514] = {};
    int ans = 0;
    repb(i, 31, 0){
        if(k & (1LL << i)){
            int tmp = 0;
            rep(j, 0, n){
                if(f[j] == false && a[j] & (1LL << i)){
                    tmp += b[j];
                }
            }
            chmax(ans, sum - tmp);
        }else{
            rep(j, 0, n){
                if(f[j] == false && a[j] & (1LL << i)){
                    sum -= b[j];
                    f[j] = true;
                }
            }
        }
    }
    chmax(ans, sum);
    cout << ans << endl;
}

Measured memory_bytes: 1920
n,m=map(int,input().split())
A=[]
B=[]
for i in range(n):
    A.append(list(map(int,input().split())))
for j in range(m):
    B.append(int(input()))
for l in range(n):
    c=0
    for k in range(m):
        c+=A[l][k]*B[k]
    print(c)



Measured memory_bytes: 6008
from sys import stdin

input = stdin.readline
lines = stdin.readlines

n = int(input())

txy = ((map(int, line.split())) for line in lines())
ans = "Yes"
t,x,y = 0,0,0

for t1,x1,y1 in txy:
    
    td,dis = t1-t,abs(x1-x)+abs(y1-y)
    if td%2 != dis%2 or td < dis:
        ans = "No"
        break
    t,x,y = t1,x1,y1
print(ans)

Measured memory_bytes: 10284
S = list(input())

count = 0
mem = 0
for i in range(len(S)):
    s_ = S[i]
    if(s_=="A" or s_=="C" or s_=="G" or s_=="T"):
        mem += 1
    else:
        count = max([mem,count])
        
        mem = 0
        
count = max([mem,count])      
print(count)

Measured memory_bytes: 3060
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CManagement solver = new CManagement();
        solver.solve(1, in, out);
        out.close();
    }

    static class CManagement {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            int n = s.nextInt();
            int[] nodes = new int[n];
            for (int i = 1; i < n; i++)
                nodes[s.nextInt() - 1]++;
            for (int i = 0; i < n; i++) w.println(nodes[i] + " ");
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 45956
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>
#include <complex>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }




int main() {
	int n; cin >> n;
	
	int ans1 = 10000, ans2 = 0;
	
	int a, b;
	for_(i, 0, n) {
		cin >> a >> b;
		if (ans2<b) {
			ans2 = b;
			ans1 = a;
		} else if (ans2==b) {
			ans1 = min(ans1, a);
		}
	}
	
	cout << ans1 << " " << ans2 << endl;
	
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define ll long long
#define LIM 100000
using namespace std;
ll v[LIM];
int main() {
  ll n, k;
  cin >> n >> k;
  ll sum = 0;
  sum = k;
  n--;
  while (n--) {
    sum *= (k-1);
  }
  cout << sum << endl;
  return 0;
}


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

int main()
{
    int n;
    cin >> n;
    int m = 1e9;
    int ans = 0;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        m = min(m,a);
        if(m >= a) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
// All Heil Fire Lord Zuko

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

#define F first
#define S second
#define PB push_back
#define debug(x) cerr << #x << " = " << x << endl

#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

typedef long long ll;
typedef long double ld;

const int N = 2 * 100 * 1000 + 19;

int32_t main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    cout << pow(n, 3);
    return 0;
}


Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * d.cc: D: Wall
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 10;

/* typedef */

/* global variables */

int cs[N][N];

/* subroutines */

inline void setmin(int &a, int b) { if (a > b) a = b; }

/* main */

int main() {
  int h, w;
  scanf("%d%d", &h, &w);

  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) scanf("%d", &cs[i][j]);

  for (int k = 0; k < N; k++)
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++)
	setmin(cs[i][j], cs[i][k] + cs[k][j]);

  int sum = 0;
  for (int y = 0; y < h; y++)
    for (int x = 0; x < w; x++) {
      int a;
      scanf("%d", &a);
      if (a >= 0) sum += cs[a][1];
    }

  printf("%d\n", sum);
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
vector<pair<int,int> > Move[2];
const int N=605;
int mask[N][N],n;
bool was[N][N][2];
void DFS(int x, int y, int m, int t, int o)
{
	if(x<=0 || y<=0 || x>n*2 || y>n*2 || was[x][y][m]) return;
	mask[x][y]|=t*o;
	was[x][y][m]=1;
	for(auto p:Move[m])
	{
		DFS(x+p.first,y+p.second,m,t^1,o);
	}
}
int cnt[4];
int main()
{
    int i,j,d1,d2;
    scanf("%i %i %i",&n,&d1,&d2);
    for(i=-2*n;i<=2*n;i++)
	{
		for(j=-2*n;j<=2*n;j++)
		{
			if(i*i+j*j==d1)
			{
				Move[0].pb(mp(i,j));
			}
			if(i*i+j*j==d2)
			{
				Move[1].pb(mp(i,j));
				//printf("%i %i\n",i,j);
			}
		}
	}
	for(i=1;i<=2*n;i++) for(j=1;j<=2*n;j++) DFS(i,j,0,1,1);
	for(i=1;i<=2*n;i++) for(j=1;j<=2*n;j++) DFS(i,j,1,1,2);
	for(i=1;i<=2*n;i++) for(j=1;j<=2*n;j++) cnt[mask[i][j]]++;
	//for(i=1;i<=2*n;i++) for(j=1;j<=2*n;j++) printf("%i%c",mask[i][j],j==2*n?'\n':' ');
	int mx=0;
	for(i=1;i<4;i++) if(cnt[i]>cnt[mx]) mx=i;
	int goal=n*n;
	//printf("mx:%i\n",mx);
	for(i=1;i<=2*n;i++) for(j=1;j<=2*n;j++) if(mask[i][j]==mx)
	{
		if(goal>0) printf("%i %i\n",i-1,j-1),goal--;
	}
	return 0;
}

Measured memory_bytes: 31232
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N;
vector<int> H;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  H.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }

  bool ans = true;
  int m = H[0];
  for (int i = 1; i < N; i++) {
    if (H[i] < m - 1) {
      ans = false;
      break;
    } else if (H[i] == m - 1) {
      // do nothing
    } else {
      m = H[i];
    }
  }

  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 640
N = int(input())
S = input()

alp = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
count = [1]*26

for n  in range(N):
    for a in range(26):
        if S[n] == alp[a]:
            count[a] += 1

ans = 1
for a in range(26):
    ans *= count[a]
    ans %= 10**9+7

ans -= 1

print(ans%(10**9+7))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF 1<<30
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  rep(i,N) cin >> h.at(i);
  vector<int> dp(N, INF);
  dp.at(0) = 0;
  int x;
  rep(i, N) rep(j, K){
    if(i > j) {
      x  = dp.at(i-j-1)+abs(h.at(i)-h.at(i-j-1));
      if(dp.at(i) > x) dp.at(i) = x;
    }
  }
  cout << dp.at(N-1) << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m, v, p;
	cin >> n >> m >> v >> p;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	sort(a.rbegin(), a.rend());
	int ans = 0;
	int low = p, high = n;
	while(low < high){
		int mid = (low + high + 1) / 2;
		ll total = 0;
		rep(i,n){
			if(i < p-1 || i >= mid - 1) total += m;
			else{
				if(a[i] > a[mid-1]+m){
					total = -1;
					break;
				}
				total += (a[mid-1] + m) - a[i];
			}
		}
		if(total >= (ll)m * v) low = mid;
		else high = mid - 1;
	}
	cout << low << endl;
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(){
  int A[101], n, i, j, t, sw = 0, mini;
 
  scanf("%d", &n);
  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
 
  for ( i = 1; i <= n; i++ ){
    mini = i;
    for ( j = i; j <= n; j++ ){
      if ( A[j] < A[mini] ) mini = j;
    }
    t = A[i]; A[i] = A[mini]; A[mini] = t;
    if ( i != mini ) sw++;
  }
 
  for ( i = 1; i <= n; i++ ){
    if (i>1) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", sw);
 
  return 0;
}

Measured memory_bytes: 604
#include <stdio.h>

int main(void){

   int l_num=0;
   int num1,num2,num3;
   int i=0;
   int check=0;
   
   scanf("%d", &l_num);
   
   while(i < l_num){
      scanf("%d %d %d", &num1, &num2, &num3);

      check = num1*num1 - num2*num2 -num3*num3;
      if(check == 0){
          puts("YES");
          i++;
          continue;
      }
      
      check = num2*num2 - num1*num1 -num3*num3;
      if(check == 0){
          puts("YES");
          i++;
          continue;
      }
      
      check = num3*num3 - num1*num1 -num2*num2;
      if(check == 0){
          puts("YES");
          i++;
          continue;
      }
      
      puts("NO");
      i++;
   }
   return 0;
}

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

int main() {
    int X, Y, Z;
    
    cin >> X >> Y >> Z;
    
    int N = 0;
    
    X -= Z;
    while(X >= Y+Z){
        X -= Y+Z;
        N++;
    }
    
    cout << N << endl;
    
    return 0;
}

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

void InputNumbers(int& Count,std::vector<int>& Numbers);
void OutputNumbers(const std::vector<int>& Numbers);
int SelectionSort(std::vector<int>& Numbers);

int main()
{
	int Count = 0;
	std::vector<int> Numbers;
	InputNumbers(Count,Numbers);
	
	int SwapCount = SelectionSort(Numbers);
	
	OutputNumbers(Numbers);
	std::cout << SwapCount << std::endl;
	
	return 0;
}

void InputNumbers(int& Count,std::vector<int>& Numbers)
{
	std::cin >> Count;
	for(int i=0;i<Count;i++)
	{
		int Input = 0;
		std::cin >> Input;
		Numbers.push_back(Input);
	}
}

void OutputNumbers(const std::vector<int>& Numbers)
{
	for(unsigned int i=0;i<Numbers.size();i++)
	{
		std::cout << Numbers[i] << std::flush;
		if(i != Numbers.size() - 1)
		{
			std::cout << " " << std::flush;
		}else{
			std::cout << std::endl;
		}
	}
}

int SelectionSort(std::vector<int>& Numbers)
{
	int SwapCount = 0;
	for(unsigned int i = 0;i<Numbers.size();i++)
	{
		unsigned int Min = i;
		for(unsigned int j = i;j<Numbers.size();j++)
		{
			if(Numbers[j] < Numbers[Min])
			{
				Min = j;
			}
		}
		if(i != Min) SwapCount++;
		std::swap(Numbers[i],Numbers[Min]);
	}
	return SwapCount;
}

Measured memory_bytes: 1220
#include <stdio.h>

int main(void)
{
  int D, n;
  scanf("%d%d", &D, &n);
  int dup = 0, gap;
  int pow100[4] = {1, 100, 10000, 1000000};
  n *= pow100[D];
  while((gap = n/pow100[D+1]-dup) > 0){
    dup += gap;
    n += dup*pow100[D];
  }
  printf("%d", n);
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline
from collections import deque

N = int(input())
G = [list(map(lambda x: int(x)-1, input().split()))[2:] for _ in range(N)]

D = [-1]*N
q = deque([[0, 0]])
while q:
    cur, dis = q.popleft()
    if D[cur] != -1: continue
    D[cur] = dis
    for nex in G[cur]:
        q.append([nex,dis+1])
for i in range(N):
    print(i+1, D[i])



Measured memory_bytes: 6032
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
map<ll,ll > ma;
vector<ll> ki;
vector<pair<ll,ll> > it;
void sieve()
{
    ma[1] = 1;
    int i;;
    for( i=3; i*i<=20000010; i=i+2)
    {
        if(ma[i]==0)
        {
            for(int j=i*i; j<=20000010; j=j+(2*i))
            {
                ma[j] = 1;
            }
        }

    }
    int c1,c2;
    c1 = 3;
    c2 = 3;
    for(i=5; i<=20000010; i=i+2)
    {
        if(ma[i]==0)
        {
            c1=c2;
            c2=i;
            if((c2-c1)==2)
            {
                it.push_back({c1,c2});
            }
        }
    }
}

int main()
{

    ll i,j,k,a,b,c,n,t,m,d,r,g,y,f;
    vector<ll> v,s,ss,vv;
    map<char,ll> ga,ha;
    string st,et,mt;
    long double aa,bb;
    cin>>n>>m;
    b = 0;
    for(i=1;i<=m;i++){
        cin>>a;
        b = b+a;
    }
    if(n-b<0){
        cout<<-1<<endl;
    }
    else if(n-b>=0){
        cout<<n-b<<endl;
    }
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl


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

    int U = stoi(S.substr(0, 2));
    int D = stoi(S.substr(2, 2));

    bool flag1 = false;
    bool flag2 = false;

    if (U >= 1 && U <= 12) flag1 = true;
    if (D >= 1 && D <= 12) flag2 = true;

    if (flag1 && flag2) print("AMBIGUOUS");
    else if (flag1) print("MMYY");
    else if (flag2) print("YYMM");
    else print("NA");

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
    using namespace std;
    using namespace __gnu_pbds;
    #define endl "\n"
    #define fi first
    #define se second
    #define pb push_back
    #define ll long long
    #define ld long double
    #define pii pair<ll,ll>
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define For(i,n) for(ll i=0;i<n;i++)
    #define what(x) cerr << #x << " is " << x << endl;
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;
    typedef tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> ordered_mset;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
/*.....................................................................................................................*/

    const ll mod=(ll)1e9+7;
    ll add(ll x,ll y) {return (x+y)%mod;}
    ll mult(ll x, ll y){return ((x%mod )* (y%mod)) % mod;}
    long long binpow(long long x, long long p) 
    {
        if (p == 0) {return 1;}
    	if (p == 2 || (p & 1)) {return mult(x, binpow(x, p - 1));}
    	return binpow(binpow(x, p / 2), 2);
    }
    ll modinv(ll a) {return binpow(a,mod-2);}
    double pi=3.141592653589793238462641;
    ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
    const ll man=(ll)1e5+5;
/*........................................................................................................................*/

signed main()
{
    fast;
    ll n,m;
    cin>>n>>m;
    if(m<n)swap(n,m);
    For(i,m)cout<<n;
    cout<<endl;
}   


Measured memory_bytes: 3564