akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.math.*;

class Main {
    void solve () {
	Scanner in = new Scanner(System.in);
	int n = in.nextInt(), m = in.nextInt(), r = in.nextInt();
	BigInteger a = BigInteger.ONE;
	int R = r - n * m;
	if(R < 0) {
	    System.out.println(0);
	    return ;
	}
	for(int i = 0; i < n-1; ++i) {
	    a = a.multiply(BigInteger.valueOf(R + n - i - 1)).divide(BigInteger.valueOf(i+1));
	}
	System.out.println(a.toString());
    }
    public static void main(String[] args) {
	(new Main()).solve();
    }
}

Measured memory_bytes: 61592
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int calc(int num){
	int ans=0;
	while(num>0){
		ans+=num%10;
		num/=10;
	}
	return ans;
}

int main() {
	int n; cin >> n;
	int ans=n;
	for(int i=1; i<n; i++){
		ans = min(ans, calc(i)+calc(n-i))	;
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
#!/usr/bin/env python3

H1, M1, H2, M2, K = map(int, input().split())

ans = 0
if M1 <= M2:
    ans = (H2-H1) * 60 + M2 - M1 - K
else:
    ans = (H2-H1-1) * 60 + (60-M1) + M2 - K

if ans < 0:
    print(0)
else:
    print(ans)


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

using namespace std;

int main() {
  char c;
  
  cin >> c;
  
  if ('A' <= c && c <= 'Z') {
    cout << 'A';
  } else {
    cout << 'a';
  }
  
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 3616
import itertools
import collections

n, m = map(int, input().split())
a=list(map(int,input().split()))
b =[0]+ list(itertools.accumulate(a))
count=0
for i in range(n+1):
    b[i]=b[i]%m

b=collections.Counter(b)
b=b.most_common()

for i in range(len(b)):
    if b[i][1]>=2:
        count+=b[i][1]*(b[i][1]-1)//2
    else:
        break
print(count)

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


int main() {
    int N, M;
    cin >> N >> M;
    vector<int> v(M);
    for (int i = 0; i < M; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    vector<int> dist(M-1);
    for (int i = 0; i < M - 1; i++) {
        dist[i] = v[i+1] - v[i];
    }
    sort(dist.begin(), dist.end());
    long long ans = 0;
    for (int i = 0; i < M - N; i++) {
        ans += dist[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4016
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

lint gcd(lint x, lint y)
{
    return x == 0 ? y : gcd(y % x, x);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    lint N, K;
    cin >> N >> K;
    cout << min(N % K, K - N % K) << endl;
    return 0;
};

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
  int N;
  std::cin >> N;
  std::vector<int> a(N);
  for(int i = 0; i < N; i++) std::cin >> a.at(i);
  std::sort(a.begin(), a.end());
  std::cout << a.at(N - 1) - a.at(0) << std::endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

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

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int main(){
    int k,n;cin>>k>>n;
    vector<int>a(2*n);
    rep(i,n){
        int b;cin>>b;
        a[i] = b;
        a[i+n] = b+k;
    }
    int res = INF;
    rep(i,n){
        res = min(res,a[i+n-1]-a[i]);
    }
    cout<<res;
}



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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

int main(){
	
	int n,m,x,y;cin >> n >> m >> x >> y;
	vector<int> a(n);
	REP(i,n)cin >> a[i];
	vector<int> b(m);
	REP(i,m)cin >> b[i];
	
	for(int i = -100;i <= 100;i++){
		bool flag = true;
		if(i <= x || i > y)continue;
		REP(j,a.size()){
			if(i <= a[j]){
				flag = false;
				break;
			}
		}
		if(!flag)continue;
		REP(j,b.size()){
			if(i > b[j]){
				flag = false;
				break;
			}
		}
		if(flag){
			cout << "No War" << endl;
			return 0;
		}
	}
	
	cout << "War" << endl;
	
	
	return 0;
}

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
const ll mod = 1000000007;

int main() {
    int n;
    cin >> n;
    int a[n];
    rep(i,n) cin >> a[i];
    int cnt = 0;
    rep(i,n-2) {
        if ((a[i] < a[i+1] && a[i+1] < a[i+2]) || (a[i] > a[i+1] && a[i+1] > a[i+2])) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3516
#define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <math.h>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 28;
const double EPS = 1E-10;

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

int n, k;
int cost[100][100];
int main(){
	int r, a, b, c, d, e;
	while(cin >> n >> k&& (n || k)){
		fill(&cost[0][0], &cost[99][99] + 1, INF);
		rep(i, n) cost[i][i] = 0;
		rep(cnt, k){
			cin >> r;
			if(r){
				cin >> c >> d >> e;
				c--, d--;
				cost[c][d] = min(cost[c][d], e);
				cost[d][c] = min(cost[d][c], e);
				rep(i, n)rep(j, n){
					cost[i][j] = min(cost[i][j],
						min(cost[i][c] + cost[c][d] + cost[d][j], cost[i][d] + cost[d][c] + cost[c][j]));
				}
			}else{
				cin >> a >> b;
				a--, b--;
				if(cost[a][b] == INF) cout << -1 << endl;
				else cout << cost[a][b] << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 904
import numpy as np
import math
N = int(input())
X = np.array(list(map(int, input().split())))

P_floor = math.floor(np.sum(X)/N)
P_ceil = math.ceil(np.sum(X)/N)

ans = min(np.sum((X-P_floor)**2), np.sum((X-P_ceil)**2))

print(ans)

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

int main(){
    int a,b;
    cin >> a >> b ;
    if (2*b > a)
    {
        cout << 0 << endl ;
    }else
    {
        cout << a - b*2 << endl ;
    }
    
    
    
}

Measured memory_bytes: 256
/*
* @Author: wxyww
* @Date: 2020-03-31 09:07:10
* @Last Modified time: 2020-03-31 09:20:33
*/
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int N = 300010,mod = 1e9 + 7;
ll read() {
	ll x=0,f=1;char c=getchar();
	while(c<'0'||c>'9') {
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
char s[N];
int e[9][2],f[10][N];
void add(int &x,int y) {
	(x = x + y) >= mod ? x -= mod : 0;
}
int main() {
	e[1][0] = 2;e[1][1] = 5;
	e[2][0] = 3;e[2][1] = 4;
	e[3][0] = 2;e[3][1] = 2;
	e[4][0] = 2;e[4][1] = 5;
	e[5][0] = 7;e[5][1] = 6;
	e[6][0] = 6;e[6][1] = 6;
	e[7][0] = 8;e[7][1] = 5;
	e[8][0] = 7;e[8][1] = 7;
	scanf("%s",s + 1);
	int n = strlen(s + 1);

	f[1][0] = 1;

	for(int i = 0;i < n;++i) {
		for(int j = 1;j <= 8;++j) {
			if(s[i + 1] == '1' || s[i + 1] == '?') 
				add(f[e[j][1]][i + 1],f[j][i]);
			if(s[i + 1] == '0' || s[i + 1] == '?')
				add(f[e[j][0]][i + 1],f[j][i]);
		}
	}

	cout<<(f[6][n] + f[5][n]) % mod;



	return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
  
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
 
#define pb emplace_back
#define fi first
#define se second

using namespace std;
 
typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
 
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-8;
const ll MOD = 1e9+7;

template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }
ll in(){ ll x; scanf( "%lld" , &x ); return x; }
 
// head

int n, k;
int mask;

int calc( int x ){
  int res = 0;
  while( x > 0 ){
    res |= PW(x%10);
    x /= 10;
  }
  return res;
}

int main(){

  scanf( "%d %d" , &n , &k );
  REP( i , k ) mask |= PW(in());

  FOR( i , n , INF ){
    if( ( calc(i) & mask ) == 0 ){
      printf( "%lld\n" , i );
      return 0;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = 1e5 + 5;
int p[N];
int q[N];
int ip[N];
int iq[N];
int w[30][N];
int A[N];
int B[N];
int E[N];
int iv[N];
int main(void) {
    int n,k;
    cin>>n>>k;
    --k;
    for (int i = 1;i <= n;++i)
        cin>>p[i],ip[p[i]] = i;
    for (int i = 1;i <= n;++i)
        cin>>q[i],iq[q[i]] = i;
    for (int i = 1;i <= n;++i)
        w[0][i] = q[ip[iq[p[i]]]];
    for (int t = 1;t < 30;++t)
        for (int i = 1;i <= n;++i)
            w[t][i] = w[t - 1][w[t - 1][i]];
    for (int i = 1;i <= n;++i) {
        A[i] = i;
        const int val[] = {p[i],q[i],q[ip[i]],ip[i],iq[i],iq[p[i]]};
        B[i] = val[k % 6];
    }
    for (int t = 0;t < 30;++t)
        if (((k / 6) >> t) & 1)
            for (int i = 1;i <= n;++i)
                A[i] = w[t][A[i]];
    for (int i = 1;i <= n;++i) {
        if (k % 6 == 3)
            E[i] = A[q[i]];
        else
        if (k % 6 == 4)
            E[i] = A[q[ip[i]]];
        else
        if (k % 6 == 5)
            E[i] = A[q[ip[i]]];
        else
            E[i] = A[i];
    }
    for (int i = 1;i <= n;++i)
        A[i] = E[i];
    for (int i = 1;i <= n;++i)
        iv[A[i]] = i;
    for (int i = 1;i <= n;++i)
        cout << A[B[iv[i]]] << " \n"[i == n];
    return 0;
}

Measured memory_bytes: 15616
#include <stdio.h>

int main(void){
	int i,b=0;
	char  a[3];
	scanf("%s",a);

	for (i = 0; i < 3; i++){
		if (a[i] - '0' == 1) b++;
	}
	printf("%d\n", b);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
  string a;
  cin >> a;
  if(a=="SUN"){
    cout << 7 << endl;
  }   
  else if(a=="MON"){
    cout << 6 << endl;
  }
  else if(a=="TUE"){
    cout << 5 << endl;
  }
  else if(a=="WED"){
    cout << 4 << endl;
  }
  else if(a=="THU"){
    cout << 3 << endl;
  }
  else if(a=="FRI"){
    cout << 2 << endl;
  }
  else{
    cout << 1 << endl;
  }
  return 0;
}
  
  
  

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

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

    // 'a' - 'a' = 0;
    // 'z' - 'a' = 25
    int al[26] = {0};

    for(int i = 0; i < s.length(); i++)
    {
        al[s[i] - 'a'] += 1;
    }

    bool flag = true;
    for(int i = 0; i < 26; i++)
    {
        if(al[i] % 2 != 0) flag = false;
    }

    if(flag == true) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Stack;
import java.util.Scanner;
import java.util.Queue;

/**
 * @author yoshikyoto
 */
class Main{
	static final boolean DEBUG = false;
	static Scanner sc = new Scanner(new InputStreamReader(System.in));
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public static void main(String args[]) throws Exception{
		String str = readLine();
		p(reverse(str));
	}

	public static String readLine() throws IOException{return br.readLine();}
	public static int readInt(){return sc.nextInt();}
	public static void pa(Object[] arr){System.out.println(Arrays.toString(arr));}
	public static void pa(int[] arr){System.out.println(Arrays.toString(arr));}
	public static void pa(double[] arr){System.out.println(Arrays.toString(arr));}
	public static void pa(boolean[] arr){System.out.println(Arrays.toString(arr));}
	public static void p(Object o){System.out.println(o.toString());}
	public static void d(Object o){if(DEBUG)System.out.println(o.toString());}
	public static void da(int[] arr){if(DEBUG)System.out.println(Arrays.toString(arr));}
	public static void sort(int[] a){Arrays.sort(a);}
	public static int[] parseInt(String[] arr){
		int[] res = new int[arr.length];
		for(int i = 0; i < arr.length; i++)res[i] = Integer.parseInt(arr[i]);
		return res;
	}
	public static int parseInt(Object o){return Integer.parseInt(o.toString());}
	public static int digit(int n){return String.valueOf(n).length();}
	public static String reverse(String s){
		StringBuffer sb = new StringBuffer(s);
		return sb.reverse().toString();
	}
}

class MyHashMap<E> extends HashMap<E, Integer>{
	ArrayList<E> keyArray = new ArrayList<E>();
	public void add(E key){add(key, 1);}
	public void add(E key, Integer value){
		if(containsKey(key)){
			value += get(key);
		}else{
			keyArray.add(key);
		}
		put(key, value);
	}
}

Measured memory_bytes: 17152
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector<Int> a(N);
	for (int i = 0; i < N; ++i) { cin >> a[i]; }
	vector<vector<int>> g(N);
	for (int i = 0; i < M; ++i) {
		int x, y;
		cin >> x >> y;
		g[x].emplace_back(y);
		g[y].emplace_back(x);
	}

	if (M == N - 1) {
		cout << "0\n";
		return 0;
	}
	if (2 * (N - M - 1) > N) {
		cout << "Impossible\n";
		return 0;
	}

	Int ans = 0;
	vector<Int> V;
	vector<bool> used(N, false);
	for (int i = 0; i < N; ++i) {
		if (used[i]) { continue; }
		
		deque<int> que;
		que.emplace_back(i);
		vector<Int> tmp;
		tmp.emplace_back(a[i]);
		while (!que.empty()) {
			int u = que.front(); que.pop_front();
			if (used[u]) { continue; }
			used[u] = true;
			
			for (auto v : g[u]) {
				if (used[v]) { continue; }
				que.emplace_back(v);
				tmp.emplace_back(a[v]);
			}
		}
		sort(tmp.begin(), tmp.end());
		ans += tmp[0];
		for (int i = 1; i < tmp.size(); ++i) {
			V.emplace_back(tmp[i]);
		}
	}

	sort(V.begin(), V.end());
	for (int i = 0; i < N - M - 2; ++i) { ans += V[i]; }
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 8952
#include"stdio.h"
#include"math.h"



int main() {
	int a,b,ans=0;
	scanf("%d %d", &a,&b);
	if (a == 1 && b == 2)ans = 3;
	if (a == 1 && b == 3)ans = 2;
	if (a == 2 && b == 1)ans = 3;
	if (a == 2 && b == 3)ans = 1;
	if (a == 3 && b == 2)ans = 1;
	if (a == 3 && b == 1)ans = 2;
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 128
def func(H,W):
    area = H * W

    half_H = int(H/2)
    half_W = int(W/2)  
    
    res = 10000000
    
    # よこ
    # T
    for x in range(1,W):
        S1 = H * x
        S2_T = (W - x) * half_H
        S3_T = area - S1 - S2_T
        
        S2_2 = H * int((W - x)/2)
        S3_2 = area - S1 - S2_2
        
        tmpres_T = max(S1, S2_T, S3_T) - min(S1, S2_T, S3_T)
        tmpres_2 = max(S1, S2_2, S3_2) - min(S1, S2_2, S3_2)
        
        if tmpres_T < res:
            res = tmpres_T
        if tmpres_2 < res:
            res = tmpres_2
    # たて
    # T
    for y in range(1,H):
        S1 = W * y
        S2_T = (H - y) * half_W
        S3_T = area - S1 - S2_T
        
        S2_2 = W * int((H - y)/2)
        S3_2 = area - S1 - S2_2
        
        tmpres_T = max(S1, S2_T, S3_T) - min(S1, S2_T, S3_T)
        tmpres_2 = max(S1, S2_2, S3_2) - min(S1, S2_2, S3_2)
        
        if tmpres_T < res:
            res = tmpres_T
        if tmpres_2 < res:
            res = tmpres_2
    
    return res

H, W = list(map(int, input().split()))
print(func(H,W))

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


using namespace std;


#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()


ll sum(int n);

void go(){
	int a,b,c;cin>>a>>b>>c;
	cout << min({a+b,a+c,b+c});
}
int main(){
   
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);

   go();

   return 0;
}

ll sum(int n){                
   if(n == 0){
      return n;
   }else{
      return sum(n/10) + n%10;
   }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <array>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

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

    int n, t;
    cin >> n >> t;

    int k = 0, l = 1, m = 1 << 30;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a < m) m = a;
        if (a - m >= l) {
            if (a - m == l) {
                k++;
            } else {
                l = a - m;
                k = 1;
            }
        }
    }
    cout << k << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;cin>>s;
  for(int i=0;i<3;++i){
    if(s[i]=='1')s[i]='9';
    else if(s[i]=='9')s[i]='1';
  }
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
    using namespace std;
    #define 	ll 			long long
    #define 	w(t)		int t; cin>>t; while(t--)  
	#define 	AsmShuvo()  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
			
    int main()
    {
    AsmShuvo()
    	
    	long long a, b, k;
		cin >> a >> b >> k;

		if(a>=k){
 		cout<<a-k<<' '<<b<<endl;
 		}
 		
		else if(a+b>=k){
 		cout<<0<<' '<<b-(k-a)<<endl;
 		}
 		
		else{
 		cout<<0<<' '<<0<<endl;
 		}

	}
	


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define vl vector<long long>
long long INF = 1e10;
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mod 1000000007
/******************************define**********************************/

/*****************************functions********************************/

/****************************main function*****************************/
int main(void){
    //priority_queue<int, vector<int>, greater<int> > q;
    ll n,m;cin>>n>>m;
    vector<ll> x(n);
    rep(n) cin>>x[i];
    vector<pii> b(m);
    rep(m) cin>>b[i].second>>b[i].first;
    sort(all(b));reverse(all(b));
    ll i = 0;
    ll j = 0;
    ll k = 0; // index of b[i]
    ll l = 0;
    vector<ll>c;
    while(true){
        c.pb(b[k].first);
        if(j == b[k].second - 1){
            j = 0,k++;
        }else j++;
        
        i++;
        if(i == n||k==m){l = i; break;}
    }
    for(ll i = 0;i < min(n,l);i++){
        x.pb(c[i]);
    }
    sort(all(x));reverse(all(x));
    ll sum = 0;
    for(int i = 0;i < n;i++) sum += x[i];
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4340
n = gets.strip.to_i
s = gets.strip.split('')

stack = []

s.each do |c|
  if stack.last == ?( && c== ?)
    stack.pop
    next
  end
  stack.push(c)
end

open_braces, close_braces = stack.partition {|c| c==?( }

result = []
result += [?(] * close_braces.length
result += s
result += [?)] * open_braces.length

puts result.join('')


Measured memory_bytes: 3836
#include <numeric>
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
using namespace std;
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
double pi = 3.141592653589793;
//ここから始めよう
signed main(){
    int n;cin>>n;
    int a[105];
    rep(i,0,n)cin>>a[i];
    int count=1,ans=0;
    rep(i,1,n){
        if(a[i]==a[i-1])count++;
        else {
            ans+=(count/2);
            count=1;
        }
    }
    ans+=count/2;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 764
N, M = map(int, input().split())
A = list(map(int, input().split()))

X = []
for _ in range(M):
    b, c = map(int, input().split())
    X.append((b, c))
X = sorted(X, key=lambda x: -x[1])
Y = []
for i in range(M):
    ly = len(Y)
    b, c = X[i]
    if ly + b < N:
        Y += [c] * b
    else:
        Y += [c] * (N-ly)
Z=A+Y 
print(sum(sorted(Z)[::-1][:N]))


Measured memory_bytes: 83864
n, m = map(int, input().split())
list_x = list(map(int, input().split()))
list_y = list(map(int, input().split()))

sum_x_pair = 0
for i in range(n):
  sum_x_pair += i * list_x[i] - (n - i - 1) * list_x[i]
sum_y_pair = 0
for j in range(m):
  sum_y_pair += j * list_y[j] - (m - j - 1) * list_y[j]

print((sum_x_pair * sum_y_pair) % (7 + 10**9))

Measured memory_bytes: 18576
#define _CRT_SECURE_NO_WARNINGS
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


class BIT {
	std::vector<int> bit;
public:
	BIT(int size) :bit(size + 1, 0) {}
	void add(int i, int x) {//i番目にx加える
		i++;//BIT添え字は1～ｎだから
		while (i<(int)bit.size()) {
			bit[i] += x;
			i += i&-i;
		}
	}
	int sum(int a)const {//[0,a]の和
		a++;
		int res = 0;
		while (0<a) {
			res += bit[a];
			a -= a&-a;
		}
		return res;
	}
	int sum(int a, int b)const {//[a,b]の合計
		return sum(b) - sum(a - 1);
	}
};



int ans[100000];


vector<pair<int,int>> query[100000];
vector<int> child[100000];
BIT bit(100000);



int N;
int x[100000];
int L, Q;

void dfs(int u) {
	for (auto p : query[u]) {
		ans[p.second] = bit.sum(p.first - 1) + 1;
	}

	bit.add(u, 1);
	for (int v : child[u]) {
		dfs(v);
	}
	bit.add(u, -1);
}


int main() {
	scanf("%d", &N);
	rep(i, N)scanf("%d", x + i);
	scanf("%d%d", &L, &Q);
	rep(i, Q) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--; b--;
		if (a > b)swap(a, b);
		query[a].emplace_back(b, i);
	}
	rep(i,N-1) {
		if (query[i].empty() && child[i].empty())continue;
		int nxt = upper_bound(x, x + N, x[i] + L) - 1 - x;
		child[nxt].push_back(i);
	}
	dfs(N - 1);
	rep(i, Q)printf("%d\n", ans[i]);

	return 0;
}

Measured memory_bytes: 14848
import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;
 
void main()
{
    int n;
    readf("%s", &n);
    readln;

    auto arr = readln.chomp.split.map!(to!int).array;
    
    auto s = arr.sum;
    auto ans = 0;
    foreach (e; arr) {
        s -= e;
        ans += e * s;
    }
    
    ans.writeln;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
 int X, Y, Z, x, H;
 cin >> X;
 Y = X / 500;
 x = X % 500;
 Z = x / 5;
 H = Y * 1000 + Z * 5;
 cout << H << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	string c;
	cin>>a;
	for(b=0;b<a;b++){
		cin>>c;
		if(c=="Y"){
			cout<<"Four"<<endl;
			return 0;
		}
	}
	cout<<"Three"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
using ll = long long;
using graph = std::vector<std::vector<ll>>;

using namespace std;

int main() {
    string s;
    cin >> s;
    int count = 0;
    for(int i = 0; i < s.size()/2; i++){
        if(s[i] != s[s.size() - 1 - i]){
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
import Control.Monad
import Data.List
main=do
  n<-readLn
  w<-replicateM n getLine
  putStrLn(if w==(nub w) then (f w n) else "No")
   where f w n = if n==1 then "Yes" else (if (last(w!!0))==(head(w!!1)) then (f (tail w) (n-1)) else "No")

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

int main(){
    int n; cin >> n;
    string s,t; cin >> s >> t;
    string ans = "";
    rep(i,n){
        ans = ans + s[i] + t[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map(String::toInt)
    val B = readLine()!!.split(" ").map(String::toInt)
    val C = readLine()!!.split(" ").map(String::toInt)

    var sum = 0
    var preIndex = -2
    for (a in A) {
        val curIndex = a - 1
        val point = B[curIndex]
        sum += point
        if (preIndex + 1 == curIndex) {
            sum += C[preIndex]
        }
        preIndex = a - 1
    }

    println(sum)

}

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

using namespace std;

typedef long long ll;
#define mod 1000000007
#define rep(i, a, b) for(int i = a; i < b; i++)
#define repc(i, a, b, c) for (int i = a; i < b; i += c)
#define mp make_pair
#define vec(type, name) vector< type > name
#define vecp(type1, type2, name) vector< pair < type1, type2 > >name
#define pb push_back
#define all(name) (name.begin(), name.end())
#define itt(name_con, name_it) auto name_it = name_con.begin()
#define repit(name_con, name_it)for(itt(name_con, name_it); name_it != name_con.end(); name_it++)

int main()
{
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	int t = 1;
	//cin >> t;
	while(t--)
	{
		string s;
		cin >> s;
		rep(i, 1, 4)if(s[i] == s[i-1]){cout << "Bad";return 0;}
		cout << "Good";
	}
}



Measured memory_bytes: 256
import re

key_string = raw_input()

if re.search('^.*keyence$', key_string) or re.search('^k.*eyence$', key_string) or re.search('^ke.*yence$', key_string) or \
   re.search('^key.*ence$', key_string) or re.search('^keye.*nce$', key_string) or re.search('^keyen.*ce$', key_string) or \
   re.search('^keyenc.*e$', key_string) or re.search('^keyence.*$', key_string):
  print("YES")
else:
  print("NO")

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

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

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	ll N; cin >> N;
	vll A(N); cin >> A;
	vll mov(N);
	for (int i = 0; i < N;) {
		if (A[i] == 0) {
			int pos = i;
			while (i < N && A[i] == 0) i++;
			while (pos < i) mov[pos++] = i;
			continue;
		}
		i++;
	}

	ll ans = 0;
	for (int i = 0; i < N; i++) {
		vll cnt(22, 0);

		ll j = i;
		for (ll loop = 0; j < N && loop < 22;) {
			if (A[j] == 0) {
				ans += mov[j] - j;
				j = mov[j];
				continue;
			}
			int b;
			for (b = 0; b < 22; b++) {
				cnt[b] += ((A[j]>>b)&1);
				if (cnt[b] > 1) break;
			}
			if (b == 22) ans++;
			else break;
			j++;
			loop++;
		}
	}
	cout << ans << endl;
}

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


Measured memory_bytes: 6328
// doesn't work
#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

const int MOD=1e9+7,MAX=1e5+100;

string S;

ll N,dp[MAX][15];

ll solve(int idx,int rem)
{
    int r_=rem;
    if(idx==N){
            if(rem==5)return 1LL;
            return 0;
    }
    if(dp[idx][r_]!=-1)return dp[idx][r_];
    ll res=0;
    if(S[idx]!='?'){
            rem = (rem*10 + (S[idx]-'0') ) %13;
            res += solve(idx+1,rem);
            res%=MOD;
    }
    else{
        for(int i=0;i<10;i++){
                res += solve(idx+1,(rem*10 + i)%13);
                res%=MOD;
            }
    }
    return dp[idx][r_]=res;
}

int main ()
{
    memset(dp,-1,sizeof dp);
    
    cin >> S;
    
    N=S.size();
    
    cout<<solve(0,0)<<endl;
    return 0;
}


Measured memory_bytes: 19968
#include <bits/stdc++.h>
using namespace std;
int main(){
    long n,a=5,ans=0;
    cin >> n;
    if(n%2){
        cout << 0 << endl;
        return 0;
    } 
    n/=2;
    while(a<=n){
        ans += n/a;
        a *= 5;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back


using namespace std;
ll ar[10000007];
ll ok(ll n)
{
    ll sum = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j * i <= n; j++)
            ar[i * j]++;
    }
    for (int i = 1; i <= n; i++)
        sum += (i * ar[i]);
  return sum;
}
int main()
{
    ll n;
    cin>>n;
    cout<<ok(n)<<"\n";
    return 0;
}


Measured memory_bytes: 81744
#include <bits/stdc++.h>
using namespace std;
#define INF pow(10, 5)
int main(){
    int N;
    cin >> N;
    vector<int> h(N), dp(N, INF);
    for(int i=0; i<N; i++) cin >> h[i];
    dp[0] = 0;
    for(int i=1; i<N; ++i){
        if(i==1){
            dp[i] = dp[i-1]+abs(h[i]-h[i-1]);
            continue;
        }
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] t = new int[n];
    int sum = 0;
    for (int i = 0; i < n; i++) {
      t[i] = sc.nextInt();
      sum += t[i];
    }

    int m = sc.nextInt();
    for (int i = 0; i < m; i++) {
      int p = sc.nextInt();
      int x = sc.nextInt();
      System.out.println(sum - t[p - 1] + x);
    }

  }
}

Measured memory_bytes: 36164
import java.util.*;

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

    int l = sc.nextInt();
    int r = sc.nextInt();
    int d = sc.nextInt();
    int ans;
    
    if(r % d == 0){
      ans = (r - l) / d + 1;
    } else {
      ans = (r - l) / d;
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 35656
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  lint d[N][N];
  REP(i,N)REP(j,N)cin>>d[i][j];
  lint ans=0;
  REP(i,N)FOR(j,i+1,N){
    bool f=true;
    REP(k,N){
      if(i==k or j==k)continue;
      if(d[i][j]>d[i][k]+d[k][j]){
        cout<<-1<<endl;
        return 0;
      }
      if(d[i][j]==d[i][k]+d[k][j])f=false;
    }
    if(f)ans+=d[i][j];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1144
N = int(input())
H = list(map(int, input().split()))

ans = "Yes"
h = 0

for n in range(N-1):
    if H[n] > H[n+1] + 1:
        ans = "No"
        break
    elif H[n] == H[n+1] + 1:
        if H[n+1] < h:
            ans = "No"
            break
        H[n] -= 1
        h = max(H[n], h)


print(ans)

Measured memory_bytes: 63984
#include <functional>
#include <iostream>
#include <vector>

#include <cstdint>

constexpr bool parity64(std::uint_fast64_t c) noexcept {
#ifdef _GNUC_
  return __builtin_parityll(c);
#else
  c ^= c >> 1;
  c ^= c >> 2;
  return ((c & 0x1111111111111111) * 0x1111111111111111 >> 60 & 0x1) != 0;
#endif
}

int main() {
  int n;
  std::cin >> n;
  std::vector<std::vector<int>> t(n);
  for (int i = 0; i != n - 1; i += 1) {
    int a, b;
    std::cin >> a >> b;
    a -= 1;
    b -= 1;
    t[a].push_back(b);
    t[b].push_back(a);
  }
  int m;
  std::cin >> m;
  const int s = 1 << m;
  std::vector<int> z(s, 0);
  {
    std::vector<int> x(n, 0);
    for (int i = 0; i != m; i += 1) {
      int u, v;
      std::cin >> u >> v;
      u -= 1;
      v -= 1;
      x[u] ^= 1 << i;
      x[v] ^= 1 << i;
    }
    std::function<void(int, int)> dfs = [&](int v, int p) {
      for (int e : t[v]) {
        if (e == p)
          continue;
        dfs(e, v);
        z[x[e]] += 1;
        x[v] ^= x[e];
      }
    };
    dfs(0, n);
  }
  for (int w = 1; w != s; w <<= 1) {
    for (int i = 0; i != s; i += w << 1) {
      const int end = i + w;
      for (int j = i; j != end; j += 1) {
        z[j + w] += z[j];
      }
    }
  }

  long long ans = 0;
  for (int i = 0; i != 1 << m; i += 1) {
    auto res = 1LL << z[s - 1 ^ i];
    if (parity64(i))
      res = -res;
    ans += res;
  }
  std::cout << ans << std::endl;
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <math.h>

int main() {
  int t[5];
  for(int i = 0; i<5; i++) {
    scanf("%d", &t[i]);
  }
  double d[5];
  double sum = 0;
  for(int i=0; i < 5; i++) {
    d[i] = ceil((double)(t[i])/10);
    sum += d[i];
  }
  int sum2 = (int)sum;
  int maxi = 0;
  for(int j = 0; j < 5; j++) {
    int a = (10 - (t[j] % 10)) % 10;
    if (a > maxi) {
     maxi = a;
   }
  }
  int ans = (sum2*10)-maxi;
  printf("%d\n", ans);
  return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N; cin >> N;
    int a[100010];
    for(int i = 1;i<=N;++i) cin >> a[i];
    int ans = 0;
    for(int i = 1;i<=N;++i)
        if(i == a[a[i]]) ++ans;
    cout << ans/2 << '\n';
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>

using namespace std;

string s;

int main(){
	int a = 0, b = 0, c = 0;
	cin >> s;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'a')
			a++;
		if(s[i] == 'b')
			b++;
		if(s[i] == 'c')
			c++;
	}
	if(abs(a-b) > 1 || abs(a-c) > 1 || abs(b-c) > 1)
		cout << "NO" << endl;
	else
		cout << "YES" << endl;
	
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    int n, m, k; cin >> n >> m >> k;
    rep(x, m + 1) {
        rep(y, n + 1) {
            int h = x * (n - y), w = y * (m - x);
            int sum = 0;
            if(h > 0) sum += h;
            if(w > 0) sum += w;
            if(sum == k) {
                //cout << x << " " << y << endl;
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	int n = 5;
	vi x(n); rep(i,n) cin >> x[i];
	int k; cin >> k;
	SORT(x);
	if(x[4]-x[0]>k) cout << ":(" << endl;
	else cout << "Yay!" << endl;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int N;

    scanf("%d", &N);

    int ans = 0;

    int l[N], r[N];

    for(int i = 0; i < N; i++){
        scanf("%d%d", &l[i], &r[i]);
        ans += (r[i] - l[i] + 1);
    }

    printf("%d\n", ans);

    return 0;
}

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

int main(){
	int N;
	cin >> N;
	vector<int> h(N);
	for(int i = 0; i < N; i++) cin >> h[i];
	vector<int> dp(N);
	dp[0] = 0;
	dp[1] = abs(h[1] - h [0]);
	
	for(int i = 2; i < N; i++) dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	
	cout << dp[N - 1] << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  ll n,a[110],s=0,m=1e10;
  cin>>n;
  fr(i,n){cin>>a[i];s+=a[i];}
  fr(i,n) m=min(m,abs(n*a[i]-s));
  fr(i,n) if(abs(n*a[i]-s)==m){cout<<i<<endl;return 0;}
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

using namespace std;
using Int = long long;
typedef pair<int,int> Pi; typedef pair<Int,Int> Pl;
constexpr int mod = 1e9+7;
constexpr int INF32 = numeric_limits<int>::max();
constexpr Int INF64 = numeric_limits<Int>::max();
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rer(i,l,r) for(int i=(l); i<(r); ++i)
#define rep(i,n) rer(i,0,n)
#define gnr(i,l,r) for(int i=(r)-1; i>=(l); --i)
#define pri(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(i,n-1)cout<<a[i]<<' '; if(n)cout<<a[n-1]<<'\n';}
#define prip(p) cout<<(p).fi<<' '<<(p).se<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

Int n,m,_,x,y,q;
string s,sb;
bool ok;
char cf,cb;

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

  cin>>n; Int ans=n/11*2; n%=11;
  if(n)ans+=1;
  if(n>6)ans+=1;
  END
}


Measured memory_bytes: 3588
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let a = read_vec::<i64>().into_iter().collect::<HashSet<_>>();
    if a.len() == n {
        println!("YES");
    } else {
        println!("NO");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 11440
import collections
N,K = map(int,input().split())
edge = collections.defaultdict(list)
for _ in range(N-1):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
q = collections.deque()
q.append((0,-1))
M = K
while q:
    p,root = q.pop()
    if root == -1:
        for k in range(K-1,K-1-len(edge[p]),-1):
            M *= k
            M %= 10 ** 9 + 7
    else:
        for k in range(K-2,K-1-len(edge[p]),-1):
            M *= k
            M %= 10 ** 9 + 7
    for e in edge[p]:
        if e != root:
            q.append((e,p))
print(M)

Measured memory_bytes: 76376
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,x = list(map(int, input().split()))
l = [None]*(n+1)
ps = [None]*(n+1)
v = 1
vp = 1
for i in range(n+1):
    l[i] = v
    ps[i] = vp
    v = 2*v + 3
    vp = 2*vp + 1
def sub(n,x):
    if n==0:
        if x==1:
            return 1
        else:
            return 0
    if x==1:
        return 0
    elif x==l[n]:
        return ps[n]
    elif x==l[n-1]+2:
        return ps[n-1]+1
    elif x<l[n-1]+2:
        return sub(n-1,x-1)
    else:
        return sub(n-1,x-2-l[n-1]) + ps[n-1] + 1
ans = sub(n,x)
print(ans)

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

long long int N, A, B;

int main(){
    scanf("%lld%lld%lld", &N, &A, &B);
    if(A < B){
        if(N ^ 1){
            cout << (B - A) * (N - 2) + 1 << endl;
        }else{
            puts("0");
        }
    }else{
        puts((A ^ B) ? "0" : "1");
    }
}


Measured memory_bytes: 256
// abc135a: Harmony
#include <bits/stdc++.h>
using namespace std;
#define upto(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define in(x) cin>>(x)
#define oute(x) cout<<(x)<<endl

int main(){
  int a,b;in(a);in(b);
  if(a>b) swap(a,b);
  upto(k,a,b+1,1){
    if(a+b==k*2){
      oute(k);
      return 0;
    }
  }
  oute("IMPOSSIBLE");
}

Measured memory_bytes: 256