akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision
vector<pair<ll, ll> > prime_factorize(ll N) {
    vector<pair<ll, ll> > res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.PB({N, 1});
    return res;
}

vector<vector<int>> G;
vector<int> ans;

void dfs(int v, int p=-1){
    for(int u : G[v]){
        if(u==p) continue;
        ans[u]+=ans[v];
        dfs(u,v);
    }
}

int main()
{
    ll N, Q;
    cin >> N >> Q;
    VI a(N), b(N);
    G.resize(N);
    ans.resize(N);   
    vector<int> score(N);
    rep(i,N-1){
        cin >> a[i] >> b[i];
        G[a[i]-1].PB(b[i]-1);
        G[b[i]-1].PB(a[i]-1);
    }
    rep(i,Q){
        int p,x;
        cin >> p >> x;
        p--;
        ans[p]+=x;
    }
    dfs(0);
    rep(i,N){
        cout << ans[i] << " ";
    } 
    cout << endl;
}

Measured memory_bytes: 26240
#include<stdio.h>
#include<string.h>
int main()
{
    int a,b[100],n,c,d;
    scanf("%d",&n);
    for(a=0;a<n;a++)
    {
     scanf("%d",&b[a]);
     if(a==0)
     {c=b[0];d=b[0];}
     if(b[a]>c) c=b[a];
     if(b[a]<d) d=b[a];
    }
    printf("%d\n",c-d);
    return 0;
}


Measured memory_bytes: 128
def abc109_c():
    import numpy as np
    import functools
    import fractions
    n, x = map(int, input().split())
    x = np.abs(np.array(list(map(int, input().split()))) - x)
    gcd = functools.reduce(fractions.gcd, x)
    return gcd


print(abc109_c())

Measured memory_bytes: 25000
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 998244353;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}



int main(void) {

  int n;
  int m, a[110];
  cin >> n >> m;
  rep(i, n) cin >> a[i];

  int s = 0;
  rep(i, n) s += a[i];

  int k = 0;
  rep(i, n) {
    if (4 * m * a[i] >= s) k++;
  }

  if (k >= m) cout << "Yes\n";
  else cout << "No\n";









}


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

leader = S[0]
right = 0
left = 0

for i in range(1, N):
    if S[i] == "W":
        right += 1
        
result = right

for i in range(1, N):
    if S[i-1] == "E":
        left += 1
    if S[i] == "W":
        right -= 1
    result = max(result, right+left)
    
print(N - result - 1)

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

int main(){
	long long t,a,k;
	cin >> t >> a >> k;
	for(int i = 0; i < k; i++){
		if(i % 2 == 0){
			if(t % 2 != 0){
				t--;
			}
			t /= 2;
			a += t;
		}
		else{
			if(a % 2 != 0){
				a--;
			}
			a /= 2;
			t += a;
		}
	}
	cout << t << " " << a << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAXN=2e5+5;
const ll MOD=1e9+7;
const ll INF=1e18;
const double eps=1e-10;
ll n,m,a[MAXN],dp[MAXN],broken[MAXN];
ll add(ll x,ll y)
{
    ll ret=x+y;
    if(ret>=MOD)
    {
        return ret-MOD;
    }
    return ret;
}
void solve()
{
    dp[0]=1;
    for(ll i=1;i<=n;i++)
    {
        if(!broken[i])
        {
            if(i==1)
            {
                dp[i]=dp[i-1];
            }
            else
            {
                dp[i]=add(dp[i-1],dp[i-2]);
            }
        }
    }
    printf("%lld\n",dp[n]);
}
int main()
{
//    freopen("c://duipai//data.txt","r",stdin);
//    freopen("c://duipai//wa.txt","w",stdout);
    while(~scanf("%lld %lld",&n,&m))
    {
//        string ss;
//        cin>>ss;
//        cout<<ss<<endl;
        for(ll i=1;i<=m;i++)
        {
            scanf("%lld",&a[i]);
            broken[a[i]]=1;
        }
        solve();
    }
}
/*

*/


Measured memory_bytes: 3584
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;

using Edge = vector<list<int>>;
Edge edge;
vec used;
bool flag = false;
int T[2]={};

void dfs(int v,int team)
{
    used[v]=team;
    T[team]++;
    for(auto & u : edge[v])
    {
        if(used[u]==-1)
        {
            dfs(u,(team+1)%2);
        }
        else if(team==used[u])
        {
            flag = true;
        }
    }
}


int main()
{
    int N,M;
    cin >> N >> M;
    edge=Edge(N);
    used=vec(N,-1);

    for(int i=0;i<M;++i)
    {
        int A,B;
        cin >> A >> B;
        --A;--B;
        edge[A].emplace_back(B);
        edge[B].emplace_back(A);
    }

    dfs(0,0);

    if(flag)
    {
        cout << 1ll*N*(N-1)/2 - M << endl;
    } else{
        cout << 1ll*T[0]*T[1] - M << endl;
    }

    return 0;
}

Measured memory_bytes: 9728
import java.util.Scanner;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int count = 0;

        for(int i = 0; b - a >= 0 && count < c; i++){
                b = b - a;
                count = count + 1; 
        }

        System.out.println(count);
    }
}

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

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

    int h, n;
    cin >> h >> n;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        h -= a;
    }

    if (h > 0) {
        cout << "No\n";
    } else {
        cout << "Yes\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

main(){
  int m,n;
  while(cin>>m>>n && m){
    int maxi=0;
    rep(i,m){
      int tmp=0,cnt=0;
      rep(j,n)cin>>tmp,cnt+=tmp;
      maxi=max(maxi,cnt);
    }
    cout << maxi << endl;
  }
}

Measured memory_bytes: 0
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=9e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,k,ans=0;
  cin >> n >> k;
  while(n>0) {
    ans++;
    n/=k;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N,W=map(int,input().split())
wv=[list(map(int,input().split())) for _ in range(N)]

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


for w in range(W+1):
    for n in range(N):
        if w>=wv[n][0]:
            dp[n+1][w] += max(dp[n][w-wv[n][0]]+wv[n][1], dp[n][w])
        else:
            dp[n+1][w]=dp[n][w]

print(dp[-1][-1])


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

using namespace std;
using namespace __gnu_pbds; 
#define     mod             1e9+7
#define     MOD             998244353
#define     ll              long long
#define     mp              make_pair
#define     F               first
#define     S               second
#define     t()             int test;cin>>test;while(test--)
#define     ii              pair<int,int>
#define     que_max         priority_queue <int>
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n"
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

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

    IOS;
   
    //t()
    {
            int n;
            cin>>n;
            vector<ll int> v(n);
            int zero =0; 
            for(int i=0; i<n; i++)
            {
                cin>>v[i];
                if(v[i] == 0)zero++;
            }

            if(zero)
            {
                cout<<0;
                return 0;
            }
            ll int ans=1;

            for(int i=0; i<n; i++)
            {
                
                if(v[i]<=1000000000000000000/ans)
                {
                    ans*=v[i];
                }
                else
                {
                    ans = -1;
                    break;
                }

            }


            cout<<ans<<endl;
       
    }
    

}

Measured memory_bytes: 3992
#include <iostream>
#include <cstdlib>
using namespace std;
typedef long long ll;
#define INF (1LL<<60)
ll min(ll x, ll y){return x < y ? x : y;}
ll dp[100010];

int main(){
	ll N; cin >> N;
	ll s = 6, n = 9;
	for(ll i = 1; i <= N; i++) dp[i] = INF;
	dp[1] = 1;
	while(s <= N){
		dp[s] = 1;
		s *= 6;
	}
	while(n <= N){
		dp[n] = 1;
		n *= 9;
	}
	for(ll i = 1; i < N; i++){
		dp[i+1] = min(dp[i+1], dp[i]+1);
		s = 6; n = 9;
		while(i + s <= N){
			dp[i+s] = min(dp[i+s], dp[i]+1);
			s *= 6;
		}
		while(i + n <= N){
			dp[i+n] = min(dp[i+n], dp[i]+1);
			n *= 9;
		}
	}
	cout << dp[N] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	VI a(10);
	rep(i, 10)cin >> a[i];
	SORT(a); REVE(a);
	rep(i, 3)cout << a[i] << endl;
}


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

#define all(x) (x).begin(),(x).end()
#define init() \
  ios::sync_with_stdio(false); \
  cin.tie(0)

#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;

template<typename M, typename N>
constexpr common_type_t<M, N> gcd(M a, N b) {
  return a == 0 ? b
    : b == 0 ? a
    : gcd(b, a % b);
}

template <typename M, typename N>
constexpr common_type_t<M, N> lcm(M a, N b) {
  return a * b / gcd(a, b);
}

template <long long MAX>
class CombinationCalculator {
  long long mod_;
  long long fac[MAX];
  long long finv[MAX];
  long long inv[MAX];

public:
  CombinationCalculator(long long mi = MOD): fac(), finv(), inv() {
    mod_ = mi;
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i - 1] * i % mod_;
      inv[i] = mod_ - inv[mod_ % i] * (mod_ / i) % mod_;
      finv[i] = finv[i - 1] * inv[i] % mod_;
    }
  }

  long long c(long long n, long long k) const {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod_) % mod_;
  }
};

template <long long MAX = 210000>
using CC = CombinationCalculator<MAX>;

template<typename T>
T modpow(T a, T n, T mod = MOD) {
    T res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

template<typename T>
T modinv(T a, T m = MOD) {
    T b = m, u = 1, v = 0;
    while (b) {
        T t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

int main() {
  init();

  int n, x;
  cin >> n >> x;

  int res = 1;
  int d = 0;
  for (int i = 0; i < n; i++) {
    int l;
    cin >> l;

    d += l;
    if (d <= x) { res++; }
    else { break; }
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char** argv)
{
	int j, k, max_i, H, W, a[10000];

	int i = 0;
	while (1) {
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0) {
			break;
		}
		a[i * 2] = H;
		a[i * 2 + 1] = W;
		i++;
	}
	max_i = i;

	for (i = 0; i < max_i; i++) {
		for (j = 0; j < a[i * 2]; j++) {
			for (k = 0; k < a[i * 2 + 1]; k++) {
				if (j == 0 || j == a[i * 2] - 1) {
					printf("#");
				}
				else {
					if (k == 0 || k == a[i * 2 + 1] - 1) {
						printf("#");
					}
					else {
						printf(".");
					}
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 576
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

const int mod = 1e9 + 7;
int n;
llong a, b;
llong s[100005];
int sum1[100005];
int dp2[100005];

int main() {
    scanf("%d%lld%lld", &n, &a, &b);
    for (int i = 1; i <= n; ++i) {
        scanf("%lld", s + i);
    }
    if (a < b) swap(a, b);
    s[0] = -2e18;
    s[n + 1] = 3e18;
    sum1[0] = 1;
    sum1[1] = -1;
    for (int i = 0, j = 2, k = 2; i <= n; ++i) {
        j = max(j, i + 2);
        k = max(k, i + 2);
        while (j <= n && s[i] + a > s[j]) ++j;
        while (k <= n + 1 && s[k - 1] + b <= s[k]) ++k;
        
        if (j <= k) {
            int p = dp2[i];
            if (i == 0 || s[i - 1] + b <= s[i + 1]) p = (p + sum1[i]) % mod;
            sum1[j] += p;
            sum1[j] %= mod;
            
            sum1[k + 1] += mod - p;
            sum1[k + 1] %= mod;
        }
        
        if (s[i] + a <= s[i + 1]) dp2[i + 1] = (sum1[i] + dp2[i]) % mod;
        
        sum1[i + 1] += sum1[i];
        sum1[i + 1] %= mod;
    }
    printf("%d\n", (sum1[n + 1] + dp2[n + 1]) % mod);
    
	return 0;
}


Measured memory_bytes: 1792
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    n = int(input())
    d, x = map(int, input().split())
    al = [int(input()) for i in range(n)]

    sum = 0
    for a in al:
        sum += 1 + (d-1) // a

    print(sum+x)


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
#include <cctype>
#include <iterator>
////////////////////////////////////////////////
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n, k;
  cin >> n >> k;
  vecint a(n, 0);
  REPe(e, a) cin >> e;
  // if (n <= k) {
  //   REP(i, n) cout << n << " ";
  //   cout << endl;
  //   return 0;
  // }
  vecint b(n, 0);
  REP(j, k) {
    REP(i, n) b[i] = 0;
    REP(i, n) {
      int l = max(0, i - a[i]);
      int r = i + a[i] + 1;
      b[l]++;
      if (r < n) b[r]--;
    }

    a[0] = b[0];
    int mini = a[0];
    for (int i = 1; i < n; i++) {
      a[i] = a[i - 1] + b[i];
      mini = min(mini, a[i]);
    }
    if (mini == n) {
      break;
    }
  }
  REPe(e, a) cout << e << " ";
  cout << endl;
}


Measured memory_bytes: 4748
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool up_min(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool up_max(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<class T>
    vector<T> make_mdvector(int n, T t){
        return vector<T>(n, t);
    }
    template<class ...Ts>
    auto make_mdvector(int n, Ts ... ts){
        return vector<decltype(make_mdvector(ts...))>(n, make_mdvector(ts...));
    }

    inline ll bit(int x){
        return 1ll << x;
    }

    template<class T>
    istream& operator>>(istream& is, vector<T>& v){
        for (auto &&x : v) { is >> x; } return is;
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } cout << endl; return os ;
    }
}
using namespace utils;

class solver{
    istream& is;
    ostream& os;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}
    ll N;
    void run();
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef XELMH
    string test_cases = "test_C.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}


void solver::run(){
    ll M;
    is >> N >> M;
    if(!is) return;
    ll x = (M - 2*N) / 4;
    if(x > 0){
        N += x; M -= 2*x;
    }
    ll ans = min(N, M/2);
    os << ans << endl;
}


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

int main() {
  int a;
  cin >> a;
  
  int b = 0;
  b = b + a % 10;
  
  a = (a - a % 10) / 10;
  
  b = b + a % 10;
  
  a = (a - a % 10) / 10;
  
  b = b + a;
 
  cout << b << endl;
}

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

#define sc(x) cin >>x
#define sc2(x,y) cin >> x >> y ;
#define sc3(x,y,z) cin >> x >> y >> z ;
#define pb push_back
#define mp make_pair
#define fi first
#define se second 

#define M 1000000007
#define inf 99999999999999999LL	//long long inf

#define debug(x) cerr<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define debug4(x,y,z,a) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#a<<" :: "<<a<<"\n";

#define LIM 100020
set< ll > find_factors(ll n)
{
	ll i ;
	set< ll > temp ;
	for(i=1;i*i <= n ;i++){
		if( n % i == 0 )
		{
			temp.insert(i) ;
			temp.insert(n/i) ;
		}
	}
	return temp ;
}
int main()
{
	int i,j,t;
    ll n,m ;
    sc2(n,m) ;
    set< ll > factors = find_factors(m) ;
    ll answer = 1 ;
    for(auto it = factors.begin();it!=factors.end();it++)
    {
    	if( (* it ) >= n ){
    		answer = max(answer,m/(*it)) ;
    	}
    }			
    printf("%lld\n",answer) ;
	return 0;
}

 


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

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

  int k = 1;
  while (true) {
    int n0 = k * (k - 1) / 2;
    if (n == n0) {
      cout << "Yes" << endl;
      cout << k << endl;
      break;
    }
    if (n < n0) {
      cout << "No" << endl, exit(0);
    }
    k++;
  }

  int m = k / 2;
  vector<vector<int>> v(k);
  int num = 1;
  for (int i = 0; i < k - 1; i++) {
    for (int j = i + 1; j < k; j++) {
      v[i].push_back(num);
      v[j].push_back(num);
      num++;
    }
  }

  for (int i = 0; i < k; i++) {
    cout << k - 1 << " ";
    for (auto&& w : v[i]) cout << w << " ";
    cout << endl;
  }
}

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

/*
int main() {
    string S, T;
    int AC=0;
    std::cin >> S >> T;
    for(int i=0; i<3; i++){
        if(S[i]==T[i]){
            AC++;
        }
    }
    std::cout << AC << std::endl;
    return 0;
}
 */

/*
int main(){
    int A,B;
    int hole=1;
    int tap=0;
    std::cin >> A >> B;
    while(hole<B){
        hole+=A-1;
        tap++;
    }
    std::cout << tap << std::endl;
    return 0;
}
 */

/*
int main(){
    int N;
    std::cin >> N;
    int a[N];
    int max=0;
    for(int i=0; i<N; i++){
        std::cin >> a[i];
    }
    for(int i=0; i<N-1; i++){
        if(a[i]>=a[i+1]){
            a[i]=1;
        }
        else{
            a[i]=0;
        }
    }
    a[N-1]=0;
    for(int i=0; i<N; i++){
        if(a[i]==1){
            int max_tmp=0;
            while(a[i]==1){
                max_tmp++;
                i++;
            }
            if(max_tmp>max){
                max=max_tmp;
            }
        }
    }
    std::cout << max << std::endl;
    return 0;
}
 */

/*
int count_upper(int val, int mod_sum);

int main(){
    int N;
    std::cin >> N;
    int start=N/2+1;
    int mod_sum;
    mod_sum=count_upper(N,0);
    std::cout << mod_sum << std::endl;
    return 0;
}

int count_upper(int val, int mod_sum){
    if(val==1){
        return mod_sum;
    }
    else if(val==2){
        mod_sum ++;
        return mod_sum;
    }
    else{
        int start = val/2+1;
        for(int i=start; i<=val; i++){
            mod_sum+=(val%start);
        }
        count_upper(start-1, mod_sum);
    }
    return mod_sum;
}
 */
/*
int main(){
    unsigned long N;
    std::cin >> N;
    unsigned long ans;
    ans = (N*(N-1))/2;
    std::cout << ans << std::endl;
    std::cout << N << std::endl;
    return 0;
}
*/

int main()
{
    unsigned long n;
    cin>>n;
    unsigned long answer= (n*(n-1))/2;
    cout<<answer;
    return 0;
}



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

int main(){
	
	long long N,M;
	cin>>N>>M;
	
	long long ok = 0;
	long long ng = Inf;
	
	while(ng-ok>1){
		long long mid = (ok+ng)/2;
		long long a = max(mid-N,(long long)0);
		long long b = M - (mid*2) - a*2;
		
		if(b<0)ng=mid;
		else ok=mid;
	}
	
	cout<<ok<<endl;
	
    return 0;
}



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

using namespace std;


int main() {
    long long ncr[55][55];
    ncr[0][0] = 1;
    for (int i = 0; i < 52; i++) {
        for (int j = 0; j < 52; j++) {
            ncr[i + 1][j] += ncr[i][j];
            ncr[i + 1][j + 1] += ncr[i][j];
        }
    }

    int N, P;
    cin >> N >> P;
    int A[2] = {};
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        A[x % 2]++;
    }

    long long ans = 0;
    for(int i = 0 ; i <= A[0] ; i++){
        for(int j = 0 ; j <= A[1] ; j++){
            if( j % 2 == P ){
                ans += ncr[A[0]][i] * ncr[A[1]][j];
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define sz(v) (ll)v.size()
#define inf 100000000000000
#define vll vector<ll>
#define pll pair<ll,ll>nnnn
using namespace std;
const int N=200004;

void solve()
{
	ll n,k;
	cin>>n>>k;
	if(k<=(n+1)/2)
		cout<<"YES";
	else
		cout<<"NO";
}
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;

#define INF 1e+9
#define MAX_V 300

struct edge {
    int to;
    int cost;
};
using P = pair<ll, ll>;
ll gcd(ll x, ll y)
{
  if(x<y)
  {
    swap(x,y);
  }
  while(y>0)
  {
    ll r=x%y;
    x=y;
    y=r;
  }
  return x;
}
int main(){
  ll n;cin>>n;
  VL a(n);REP(i,n){cin>>a[i];}
  //買いシグナル1売りシグナリ-1
  VL b(n);
  for(int i=0;i<n-1;i++){
    if(a[i]<a[i+1]){
      b[i]=1;
    }
    if(a[i]>a[i+1]){
      b[i]=-1;
    }
    if(a[i]==a[i+1]){
      b[i]=0;
    }
  }
  b[n-1]=-1;
  ll moti=1000;
  ll kabu=0;
  for(int i=0;i<n;i++){
    if(b[i]==1){
      moti=moti+kabu*a[i];
      kabu=0;
      kabu=moti/a[i];
      moti=moti%a[i];
    }
    if(b[i]==-1){
      moti=moti+kabu*a[i];
      kabu=0;
    }
    //cout<<moti<<" "<<kabu<<endl;
    if(b[i]==0){
      continue;
    }
  }
  cout<<moti<<endl;
}


Measured memory_bytes: 3188
#include <vector>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <functional>

const int INF = 1001001000;
const int MOD = (int)1e9 + 7;

using ll = long long;

using namespace std;

typedef pair<int,int> P;

struct edge{
  int to;
  int cost;
};

int V,E,r;
vector<edge> G[100000];
int d[100000];


int main(){

  cin >> V >> E >> r;
  for( int i = 0; i < E; ++i){
    int a,b,c;
    cin >> a >> b >> c;
    G[a].push_back(edge{b,c});
  }
  fill( d, d+V, INF);
  d[r] = 0;
  priority_queue< P, vector<P>, greater<P> > q;
  q.push( P(d[r],r));
  while(!q.empty()){
    P p = q.top();q.pop();
    int from = p.second;
    int cost = p.first;
    for( int i = 0; i < G[from].size(); ++i){
      edge e = G[from][i];
      int next = e.to;
      int newCost = e.cost + cost;
      if( d[next] > newCost){
        d[next] = newCost;
        q.push( P(newCost, next));
      }
    }
  }

  for( int i = 0; i <V; ++i){
    if( d[i] == INF ) cout << "INF" << endl;
    else cout << d[i] << endl;
  }
}

Measured memory_bytes: 13164
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <sstream>
#include <iterator>
#include <sstream>
#include <iomanip>
#include <istream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a, b;
    for(int i = 0; i < m; i++) {
        int x,y;
        cin >> x >> y;
        a.push_back(x);
        b.push_back(y);
    }

    int ans = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 0; j < m; j++) {
            if(a[j] == i || b[j] == i) ans++;
        }
        cout << ans << endl;
        ans = 0;
    }
}


Measured memory_bytes: 256
N = int(input())
An = list(map(int, input().split()))

count = 0
while True:
    for i in range(N):
        q, mod = divmod(An[i], 2)
        if mod != 0:
            break
        An[i] = q
    else:
        count += 1
        continue
    break

print(count)


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

int main() {
  int n, s = 1;
  string a, b;
  cin >> a >> b;
  n = stoi(a + b);

  while (s * s <= n) {
    if (s * s == n) {
      cout << "Yes" << endl;
      return 0;
    }
    ++s;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

int main(){

    int A, B;
    cin >> A >> B;
    cout << max(0, A - 2 * B) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 2e9;
int main(){ 
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<vector<int>> g(n);
  rep(i,n - 1) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    g[u].emplace_back(v);
    g[v].emplace_back(u);
  }
  vector<int> res(n,0);
  vector<int> dp(n+1, INF);
  auto dfs = [&](auto&& f, int p = -1, int u = 0)->void{
    int k = lower_bound(dp.begin(), dp.end(), a[u]) - dp.begin();
    int tmp = dp[k];
    dp[k] = a[u];
    res[u] = lower_bound(dp.begin(), dp.end(), INF) - dp.begin();
    for (auto v : g[u]) {
      if (v == p) continue;
      f(f,u,v);
    }
    dp[k] = tmp;
  };
  dfs(dfs);
  for (int i = 0; i < n; i++) {
    cout << res[i] << endl;
  }
  return 0;
} 

Measured memory_bytes: 30984
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	ll k, a, b; cin>>k>>a>>b;
	if(k<=a-1){
		cout<<k+1<<endl;
		return 0;
	}
	if(b<=a+2){
		cout<<k+1<<endl;
		return 0;
	}
	k-=(a-1);
	cout<<a+(b-a)*(k/2)+(k%2)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>

typedef long long ll;
using std::vector;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

int main() {
    //std::ifstream in("0_normal_2");
    //std::cin.rdbuf(in.rdbuf());
    
    std::string S;
    std::cin >> S;
    
    bool f = true;
    for (int i = 0; i < S.size(); i++) {
        if (i%2 == 0) {
            if (S[i] == 'L') {
                f = false;
                break;
            }
        } else {
            if (S[i] == 'R') {
                f = false;
                break;
            }
        }
    }
    
    if (f) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
    
    return 0;
}


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

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

	if(a < b){
		swap(a,b);
	}if(b < c){
		swap(b,c);
	}if(a < b){
		swap(a,b);
	}
	cout << c <<" "<< b <<" "<< a << endl;
	return 0;
}

Measured memory_bytes: 1164
n,m = map(int,input().split())
if abs(n-m) > 1:
  print(0)
  exit()
  
mod = 10**9+7

if n==m:
    ans = 2
    a = 1
    for i in range(1,n+1):
        a *= i
        a %= mod
    print(ans*a**2%mod)
  
else:
    if m > n:
        n,m = m,n
    ans = 1
    
    for i in range(1,m+1):
        ans *= i
        ans %= mod
      
    ans = ans**2*n
    ans %= mod
    print(ans)
      
    
    


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
using namespace std;
int main() {
	int n, k, s;
	cin >> n >> k >> s;
	for (int i = 0; i < k; i++) {
		cout << s;
		if (i != k - 1) {
			cout << " ";
		}
	}
	for (int j = 0; j < n - k; j++) {
		if (s == 1000000000) {
			cout << " " << s - 1;
			continue;
		}
		cout << " " << s + 1;
	}
	cout << endl;
	return 0;
}

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

const int MAXN = 1<<17;

bool win[MAXN];




int main () {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n, k; cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int x = 1; x <= k; ++x) {
    for (int i = 0; i < n; ++i) {
      if (x - a[i] >= 0) win[x] |= !win[x - a[i]];
    }
  }
  cout << (win[k] ? "First" : "Second") << '\n';
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define pii pair<int,int>
#define int long long
using namespace std;
pair<int,int> a[101];
int f[100001];
int n,w;

main()
{
    cin>>n>>w;
    for(int i=0;i<n;i++)
    {
        cin>>a[i].first>>a[i].second;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=w;j>=a[i].first;j--)
        {
            f[j]=max(f[j-a[i].first]+a[i].second,f[j]);
        }

    }

    cout<<f[w];
}


Measured memory_bytes: 1024
using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        var a = sc.NextDecimal();
        var b = sc.NextDecimal();

        Console.WriteLine((long)(a * b));
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

typedef long long ll;

bool compare(pair<int,int> a, pair<int,int> b)
{
    return a.first<b.first;
}
int main()
{
  ll r,d,x;
  cin>>r>>d>>x;
  
  for(ll index=0;index<10;index++)
  {
      x=r*x-d;
      cout<<x<<endl;
  }
    
    
    
    
    return 0;
}


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


N,M=[int(i) for i in input().rstrip().split()]
ab_list=[[int(j) for j in input().split()] for i in range(M)]
#-----

vertex_dic={}  # dic{int:set()}

for va,vb in ab_list:
    vertex_dic.setdefault(va,set())
    vertex_dic[va].add(vb)
    vertex_dic.setdefault(vb,set())
    vertex_dic[vb].add(va)


def check(vertex_dic :dict, passed :set, start :int, cnt :int):
    if cnt >= len(vertex_dic) and len(vertex_dic) == len(passed):
        return 1
    
    next_set = vertex_dic[start] - passed # :set
    cnt += 1
    
    ans=0
    for i_next in next_set:
        next_passed = passed | {i_next}
        ans += check(vertex_dic, next_passed, i_next, cnt)
    
    return ans
    
result=check(vertex_dic, {1}, 1 ,1 )
print(result)


Measured memory_bytes: 3064
/*
ID: rajiv
TASK: test
LANG: C++14
*/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>
#include<sstream>
#include<iterator>
#include<random>
#include<chrono>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ONLINE_JUDGE

using namespace std;

#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cout << '\n';}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << '[' << *it << " = " << a << "]  ";
    err(++it, args...);
}
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
int rnd(int a, int b){ // including a and b
	return a+(rng()%(b-a+1));
}
#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sortr(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb push_back
#define endl '\n'

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<lli, lli> tii;
typedef tuple<lli, lli, lli> tiii;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

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

void solve(){
	int x,n;
	cin>>x>>n;
	set<int> p;
	int h;
	rep(i,n){
		cin>>h;
		p.insert(h);	
	}
	h=0;
	while(1){
		//deb(h)
		if(p.find(x-h) ==p.end() ){
			cout<<(x-h)<<endl; return;
		}
		
		if(p.find(x+h) ==p.end()){
			cout<<(x+h)<<endl; return;
		}
		h++;
	}
}

int main(){
	fast_io
	#ifndef ONLINE_JUDGE
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
	#endif 
	int tc=1;
	//cin>>tc;
	while(tc--){solve();}
	return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A,B;
  cin >> A >> B;
  if(A>=10 || B>=10) {
    cout << -1 << endl;
  }
  else cout << A*B << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
using namespace std;
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }


int main() {
    int x,y;
    int ans=0;
    cin>>x>>y;

    if(x<4)
    ans+=(4-x)*100000;

    if(y<4)
    ans+=(4-y)*100000;

    if(y==1&&x==1)
    ans+=400000;

    Out(ans);
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
int main()
{
    int a,b,sqr,sum;
    int c,bw=1;
    scanf("%d%d",&a,&b);
    c=b;
    while(c>0)
    {
        bw*=10;
        c/=10;
    }
    sum=bw*a+b;
    sqr=sqrt(sum);
    if(sqr*sqr==sum)
        printf("Yes");
    else
        printf("No");
    return 0;
}


Measured memory_bytes: 128
#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(x) cout<<#x<<":";cout<<x<<endl;
#define debugs(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);
    
    ll x;cin>>x;

    ll n=100;
    ll ans=0;
    while(n<x){
        ans++;
        n=n+n/100;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
using namespace std;
		   
int main()
{
	int n = 0;
	for (; cin >> n, n != 0;)
	{
		string s = ""; 
		int	sum = 0;
		int u = 0;
		for (int i = 0;i<n; i ++)
		{
			cin >> s;
			if (s[1] == 'u')u++;
			else if (s[1] == 'd')u--;
			if (u == 2 || u==-2)
			{
				sum++;
				u = 0;
			}
		}
		cout << sum << endl;
	}
	return 0;
}			

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,m,x,mn=INT_MAX,s=0;
    cin>>n>>x;
    for(i=0;i<n;i++)
    {
        cin>>m;
        s+=m;
        mn=min(mn,m);
    }
    cout<<n+((x-s)/mn)<<endl;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <functional>
#include <array>
#include <iostream>
#include <cmath>


using namespace std;

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin>>N;
    vector<int> ds;
    int x;
    for (size_t i = 0; i < N; i++)
    {
        cin>>x;
        ds.push_back(x);
    }

    sort(ds.begin(), ds.end());

    int mid=N/2;
    cout << ds[mid]-ds[mid-1] << "\n";



    return 0;
    
}

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define rep(i,a,b) for(uint32 i = (a); i < (b); ++i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define ALL(x) (x).begin(),(x).end()
#define C(x) std::cout << #x << " : " << x << std::endl
#define scanf scanf_s

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;

struct edge {
	uint32 from, to;
	int64 cost;
};
#define N 1000
int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	uint32 n, m;
	std::cin >> n >> m;
	std::vector<int64> d(n, -(1e18));
	std::vector<edge> es;
	uint32 a, b;
	int64 c;
	rep(i, 0, m) {
		std::cin >> a >> b >> c;
		--a, --b;
		es.push_back({ a,b,c });
	}
	d[0] = 0;
	bool ch[N] = {};
	rep(i, 0, n) {
		rep(j, 0, m) {
			edge e = es[j];
			if (d[e.to] < d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				if (i == n - 1) {
					ch[e.to] = 1;
				}
			}
		}
	}
	rep(i, 0, n) {
		rep(j, 0, m) {
			edge e = es[j];
			ch[e.to] |= ch[e.from];
		}
	}
	if (ch[n - 1]) {
		std::cout << "inf";
	}
	else {
		std::cout << d[n - 1];
	}
	std::cout << "\n";
	return 0;
}

Measured memory_bytes: 384
from fractions import gcd
MOD = 10**9 + 7
H, W, T = map(int, input().split())
ga, gb = gcd(H, T), gcd(W, T)
H //= ga
W //= gb
ans = (pow(2, H, MOD) + pow(2, W, MOD) - 1 + pow(2, gcd(H, W), MOD) - 2) % MOD
print(pow(ans, ga*gb, MOD))


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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int max = -1000000;
        int min = 1000000;
        long sum = 0;
        String[] lines = br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(lines[i]);
            sum += a;

            if (a > max) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        }
        System.out.println(min + " " + max + " " + sum);
    }
}

Measured memory_bytes: 28312