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

using namespace std;

int mod = 1000000007;

int main()
{
	int n, k;
	cin >> n >> k;
	vector<pair<long long, long long>> a(n);
	int t = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i].second;

		if (a[i].second < 0) {
			a[i].first = -a[i].second;
		}
		else {
			a[i].first = a[i].second;
			t++;
		}
	}
	if (n == k) {
		long long ans = 1;
		for (int i = 0; i < k; i++) {
			ans *= a[i].second;
			ans = (ans % mod + mod) % mod;
		}
		cout << ans << endl;
		return 0;
	}
	if (t == 0) {
		if (k % 2 == 0) {
			sort(a.rbegin(), a.rend());
			long long ans = 1;
			for (int i = 0; i < k; i++) {
				ans *= a[i].second;
				ans = (ans % mod + mod) % mod;
			}
			cout << ans << endl;
			return 0;
		}
		else {
			sort(a.begin(), a.end());
			long long ans = 1;
			for (int i = 0; i < k; i++) {
				ans *= a[i].second;
				ans = (ans % mod + mod) % mod;
			}
			cout << ans << endl;
			return 0;
		}
	}
	sort(a.rbegin(), a.rend());

	if (a[k - 1].first == 0) {
		cout << 0 << endl;
		return 0;
	}

	int sum = 0;
	int it1 = -1, it0 = -1; //0 => -, 1 => +
	for (int i = 0; i < k; i++) {
		if (a[i].second < 0) {
			sum++;
			it0 = i;
		}
		else {
			it1 = i;
		}
	}
	if (sum % 2 == 0) {
		long long ans = 1;
		for (int i = 0; i < k; i++) {
			ans *= a[i].first;
			ans %= mod;
		}
		cout << ans << endl;
	}
	else {
		if (it1 == -1) {
			long long ans = 1;
			for (int i = 0; i < k - 1; i++) {
				ans *= a[i].second;
				ans = (ans % mod + mod) % mod;
			}
			for (int i = k - 1; i < n; i++) {
				if (a[i].second >= 0) {
					ans *= a[i].second;
					ans = (ans % mod + mod) % mod;
					cout << ans << endl;
					return 0;
				}
			}
		}
		else {
			int it2 = -1, it3 = -1; //2 => -, 3 => +
			for (int i = k; i < n; i++) {
				if (a[i].second < 0) {
					if (it2 == -1) {
						it2 = i;
					}
				}
				else {
					if (it3 == -1) {
						it3 = i;
					}
				}
			}

			if (it2 == -1) {
				long long ans = 1;
				for (int i = 0; i < k; i++) {
					if (i != it0) {
						ans *= a[i].second;
						ans = (ans % mod + mod) % mod;
					}
				}
				ans *= a[it3].second;
				ans = (ans % mod + mod) % mod;
				cout << ans << endl;
			}
			else if (it3 == -1) {
				long long ans = 1;
				for (int i = 0; i < k; i++) {
					if (i != it1) {
						ans *= a[i].second;
						ans = (ans % mod + mod) % mod;
					}
				}
				ans *= a[it2].second;
				ans = (ans % mod + mod) % mod;
				cout << ans << endl;
			}
			else {
				if (a[it0].second * a[it2].second < a[it1].second * a[it3].second) {
					long long ans = 1;
					for (int i = 0; i < k; i++) {
						if (i != it0) {
							ans *= a[i].second;
							ans = (ans % mod + mod) % mod;
						}
					}
					ans *= a[it3].second;
					ans = (ans % mod + mod) % mod;
					cout << ans << endl;
				}
				else {
					long long ans = 1;
					for (int i = 0; i < k; i++) {
						if (i != it1) {
							ans *= a[i].second;
							ans = (ans % mod + mod) % mod;
						}
					}
					ans *= a[it2].second;
					ans = (ans % mod + mod) % mod;
					cout << ans << endl;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 6392
import sys
cs = { c : 0 for c in list("abcdefghijklmnopqrstuvwxyz")}
for c in list(sys.stdin.read()):
    c = c.lower()
    if c in cs.keys():
        cs[c] = cs[c] + 1
for (c,cnt) in sorted(list(cs.items())):
    print('{0} : {1}'.format(c,cnt))


Measured memory_bytes: 5572
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>

using namespace std;

int64_t n, a, b;
int64_t ans = 0;

int main(int argc, char const *argv[])
{
    cin >> n >> a >> b;
    if ((b - a) % 2 == 0)
    { //2人のテーブルが奇数個離れている
        ans = (b - a) / 2;
    }
    else if ((b - a) % 2 == 1)
    {
        ans = min(a - 1, n - b) + 1 + (b - a - 1) / 2;
    }

    cout << ans << endl;
    return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

#define MAXN 4000

ll dp[MAXN+1][MAXN+1];

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

  bool f = n%2;
  rep(l, n)rep(i, n-l+1){

    // n奇数かつ今見ている長さが奇数なら先手番
    // n偶数かつ今見ている長さが偶数なら先手番
    bool isFirst = (f && !(l%2)) || (!f && (l%2));
    if(isFirst){
      dp[i][i+l] = max<ll>(dp[i][i+l-1] + a[i+l], dp[i+1][i+l] + a[i]);
    }else{
      dp[i][i+l] = min<ll>(dp[i][i+l-1] - a[i+l], dp[i+1][i+l] - a[i]);
    }
  }

  cout<<dp[0][n-1]<<endl;

  return 0;

  rep(i, n){
    rep(j, n)cout<<dp[i][j]<<' ';
    cout<<endl;
  }

  return 0;
}


Measured memory_bytes: 50784
// Problem : D - Friends
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORR(i,n) for(int i=n;i>=0;i--)
#define pb push_back
#define vint vector<int>
#define sint set<int>
#define mint map<int,int>
#define pint pair< int,int >
#define int long long int 
#define test int tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define SI(a,n) int a[n];FOR(i,n) cin>>a[i];
#define input(a,n) int n;cin>>n; SI(a,n)
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define precision(x) cout<<fixed<<setprecision(x);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element)!=container.end())
#define fint fast;test
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define ft first
#define se second
#define MOD 1000000007
using namespace std;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }
vector<vint>adj;
vector<bool>vis;
int dfs(int node){
	int temp=0;
	vis[node]=true;
	for(auto child:adj[node]){
		if(!vis[child]){
			temp+=dfs(child);
		}
	}
	return temp+1;
}
void solve(){
	int n,m;
	rd(n,m);
	adj.resize(n+1,vint());
	vis.resize(n+1,false);
	map<pair<int,int>,bool>ch;
	FOR(i,m){
		int u,v;
		rd(u,v);
		if(ch[{u,v}])continue;
		adj[u].pb(v);
		adj[v].pb(u);
		ch[{u,v}]=true;
		ch[{v,u}]=true;
	}
	int ans=0;
	rep(i,1,n+1){
		if(!vis[i]){
			ans=max(ans,dfs(i));
		}
	}
	pp(ans);
	return;	
}


int32_t main() {
    // fint{
    	fast;
    	solve();
    // }
    return 0;
}


Measured memory_bytes: 48600
import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().toInt
  val a = StdIn.readLine().split(" ").map(_.toLong)

  // println(a.max - a.min)
  /* NG */
  val r = a.foldLeft((a(0), a(0))){ (acc, ai) =>
    val min = scala.math.min(acc._1, ai)
    val max = scala.math.max(acc._2, ai)
    (min, max)
  }
  println(r._2 - r._1)
  
}


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

using namespace std;

void A_Station_and_Bus(void) {

	string S;

	cin >> S;

	cout << ((S[0] == S[1] && S[0] == S[2]) ? "No" : "Yes");

	return;
}

void B_Count_Balls(void) {

	long n;
	//int a, b;
	long a, b;
	
	//long count = 0;

	cin >> n >> a >> b;

	//count = (n - (n % (a + b))) / (a + b);
	long count = long(n / (a + b));

	/*
	if (n % (a + b) <= a) {

		cout << n % (a + b) + count * a;
	}
	else {

		cout << a + count * a;
	}
	*/
	cout << ((n % (a + b) <= a) ? count * a + n % (a + b) : a * (count + 1));

	return;
}

void C_Tax_Increase(void) {

	int a, b;

	int pa[1000] = { -1 };
	int pb[1000] = { -1 };

	int flag = 0;

	int re = 0;

	cin >> a >> b;

	for (int loop = 1; loop < 1400; loop++) {

		if ((int)(loop * 0.08) == a && flag < 1000) {
			pa[flag] = loop;
			flag++;
		}
	}

	flag = 0;
	for (int loop = 1; loop < 1400; loop++) {

		if ((int)(loop * 0.1) == b && flag < 1000) {
			pb[flag] = loop;
			flag++;
		}
	}

	for (int xloop = 0; xloop < 1000; xloop++) {

		for (int yloop = 0; yloop < 1000; yloop++) {

			if (pa[xloop] != -1 && pa[xloop] == pb[yloop]) {

				re = pa[xloop];
			}
		}
	}

	for (int xloop = 0; xloop < 1000; xloop++) {

		for (int yloop = 0; yloop < 1000; yloop++) {

			if (pa[yloop] != -1 && pa[yloop] == pb[xloop]) {

				if (re > pa[yloop]) re = pa[yloop];
			}
		}
	}

	if (re > 0) {

		cout << re << flush;
	}
	else {

		cout << -1 << flush;
	}

	return;
}

void D_String_Formation(void) {

	string S;
	int Q;

	cin >> S;
	cin >> Q;

	int T;
	int F;
	char C;

	int max = 0;
	char sBuff;

	int loop1 = 0;
	int loop2 = 0;

	for (loop1 = 0; loop1 < Q; loop1++) {

		cin >> T;

		if (T == 1) {

			max = (int)(S.size() * 0.5);

			for (loop2 = 0; loop2 < max; loop2++) {

				sBuff = S[loop2];
				S[loop2] = S[S.size() - loop2 - 1];
				S[S.size() - loop2 - 1] = sBuff;
			}
		}
		else {

			cin >> F >> C;

			if (F == 1) {

				S = C + S;
			}
			else {

				S = S + C;
			}
		}
	}

	cout << S;

	return;
}

int main(void) {

	//A_Station_and_Bus();
	B_Count_Balls();
	//C_Tax_Increase();
	//D_String_Formation();

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int x, y, z, a;
    cin >> x >> y >> z;
    if(x > y){
        a = x;
        x = y;
        y = a;
    }
    if(y > z){
        a = y;
        y = z;
        z = a;
    }
    if(x > y){
        a = x;
        x = y;
        y = a;
    }
    cout << x << " " << y << " " << z <<endl;

    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;

const int INF = 2e9;
pii A[100009];

int main() {
	int N; scanf("%d", &N);
	for(int i=0; i<N; i++) {
		int x, r; scanf("%d%d",&x,&r);
		A[i] = {x-r, x+r-1};
	}
	sort(A, A+N, [&](pii P, pii Q) {
		return P.second < Q.second;
	});
	int ans = 0, mr = -INF;
	for(int i=0; i<N; i++) {
		if(mr < A[i].first) {
			mr = A[i].second;
			++ans;
		}
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<x<<endl
#define all(v) v.begin(), v.end()
using namespace std;
//型エイリアス
using vi = vector<int>;
using ll = long long;
using P = pair<int,int>;
using Mat = vector<vector<int>>;
const ll inf = 1e18;
const int N = 2e5+10;

int main(){
    int n;
    cin >> n;
    //桁の数字を獲得
    int d = n;
    int sum = 0;
    while(d!=0){
        sum += d%10; 
        d /= 10;
    }
    if(n%sum==0) cout("Yes");
    else cout("No");

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int product = a * b;
		if (product % 2 == 0)
			System.out.println("Even");
		else
			System.out.println("Odd");
		in.close();
	}

}


Measured memory_bytes: 21460
mod=10**9+7
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
def main():
  a,b=mi()
  l=list(mi())
  dp=[0]*a
  dp[0]=0
  for i in range(1,a):
    dp[i]=min(abs(l[i]-l[i-j-1])+dp[i-j-1] for j in range(min(i,b)))
  print(dp[-1])
main()

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

typedef long long ll;
typedef unsigned long long ull;

int main(){
    map<char,int> cnt;
    string s;
    while(cin >> s){
        for(int i=0;i<s.size();i++){
            cnt[s[i]]++;
        }
    }

    for(int i=0;i<='z'-'a';i++){
        cout << (char)('a'+i) << " : " << cnt['a'+i]+cnt['A'+i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3168
import java.util.*;
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();
	if(a==b+c){
	System.out.println("Yes");
	}else if(b==a+c){
	System.out.println("Yes");
	}else if(c==a+b){
	System.out.println("Yes");
	}else{
	System.out.println("No");
	}
	}
	}


Measured memory_bytes: 20948
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

int main() {
    string s;
    while (cin >> s, s != "#") {
        auto check = [&](bool lft) -> int { 
            int ans = 0;
            int FootL = -1, FootR = -1;
            bool fst = true;
            REP (i, 0, s.size()) {
                int step = s[i] - '1';
                if (lft) {
                    if (fst) FootL = step;
                    else {
                        if (step % 3 > FootR % 3) {
                            ans++;
                            FootR = step;
                            lft = !lft;
                        } else {
                            FootL = step;
                        }
                    }
                } else {
                    if (fst) FootR = step;
                    else {
                        if (FootL % 3 > step % 3) {
                            ans++;
                            FootL = step;
                            lft = !lft;
                        } else {
                            FootR = step;
                        }
                    }
                }
                lft = !lft;
                fst = false;
            }
            return ans;
        };
        cout << min(check(0), check(1)) << endl;
    }
    return 0;
}


Measured memory_bytes: 3240
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	int a,b,c,d;
	int ans=0;
	
	cin>>a>>b>>c>>d;
	if(a<b)
	{
		ans+=a;
	}else{
		ans+=b;
	}
	if(c<d)
	{
		ans+=c;
	}else{
		ans+=d;
	}
	cout<<ans<<endl;
	return 0;
}

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

#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define eb emplace_back
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)
#define mmst(v) memset(v, 0, sizeof(v))

template<typename T1,typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 & a, T2 b) { if (a < b) a = b; }

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kMax9 = 1000000010;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;
const long long kMod = 1000000007;

const long long kMAX = 1000000000;

using namespace std;
using ll = long long;

inline int readInt() {
  char c = getchar();
  while(!isdigit(c) && c != '-') c = getchar();
  int sigma = 1;
  if (c == '-') {
    sigma = -1;
    c = getchar();
  }
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * sigma;
}

template <class T>
void PrintVector(const vector<T> & v) {
  for (const auto & e: v) {
    cout << e << endl;
  }
}

template <class T>
void PrintVector(const vector<T> & v, int n) {
  rep(i, 0, n - 1) {
    cout << v[i] << endl;
  }
}

double dist(double lhs, double rhs) {
  return sqrt(lhs * lhs + rhs * rhs);
}

int main() {
  long n, m, k, t;
  string s;
  ll ans = 0;
  vector<long> a, b;

  cin >> n >> m >> k;

  if (n + m + k >= 22) cout << "bust\n";
  else cout << "win\n" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード
 
//ループ
#define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ
 
//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;
const double PI = acos(-1); //π
 
using namespace std;
 
//ソート
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 
//#include "./lib/generic/search.h"

//文字列入力した小数値を小数点なくして返す
int changeDoubleToInt(string decimal){ 
    decimal.erase(1, 1); //小数点削除
    int n_decimal = atoi(decimal.c_str()); //c_strでchar*に変換後、atoiでintに変換
    return n_decimal;
}

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

//素数判定(True/Falseを返却)
int IsPrime_tf(ll num){
    if (num < 2) return false; //0、1は素数でない
    else if (num == 2) return true; //2は素数
    else if (num%2==0) return false; // 偶数はあらかじめ除く
    for (ll i = 3; i*i <= num; i += 2){ //チェックは2～√nで十分
        if (num % i == 0) return false; //素数でない
    }
    return true; //素数である
}

//素数判定(割れる値を返却)
ll IsPrime_value(ll num){
    if (num < 2) return -1; //0、1は素数でない
    else if (num == 2) return 2; //2は素数
    for (ll i = 2; i*i <= num; i += 1){ //チェックは2～√nで十分
        if (num % i == 0) return i; //素数でない
    }
    return num; //素数である
}

int main(){
   int a, b, c;
   cin >> a >> b >> c;
   if(a<b && b<c) cout << "Yes" << endl;
   else cout << "No" << endl;
   return 0;
}


Measured memory_bytes: 3096
import java.util.*;
//import java.lang.Math;
public class Main{
    public static boolean chk(int a,int b,int c,char d,char e,char f){
        if(d!=e || e!=f) return false;
        if(a==b && b==c) return true;
        int B[];
        B=new int[3];
        B[0]=a;
        B[1]=b;
        B[2]=c;
        Arrays.sort(B);
        if(B[2]-B[1]==1 && B[1]-B[0]==1) return true;
        return false;
    }
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        for(int i=0;i<N;i++){
            int A[];
            char C[];
            String S="";
            A=new int[9];
            for(int j=0;j<9;j++) A[j]=sc.nextInt();
            for(int j=0;j<9;j++){
                String s=sc.next();
                S+=s;
            }
            C=S.toCharArray();
            boolean ans=false;
            int all=(int)Math.pow(3,9);
            for(int j=0;j<all;j++){
                int bit[]=new int[9];
                int now=j;
                for(int k=8;k>=0;k--){
                    bit[k]=now%3;
                    now/=3;
                }
                int cnt[]=new int[3];
                for(int k=0;k<9;k++) cnt[bit[k]]++;
                if(cnt[0]!=3 || cnt[1]!=3 || cnt[2]!=3) continue;
                int one[]=new int[3];
                int two[]=new int[3];
                int three[]=new int[3];
                int plc[]=new int[3];
                for(int k=0;k<9;k++){
                    if(bit[k]==0){
                        one[plc[0]]=k;
                        plc[0]++;
                    }
                    if(bit[k]==1){
                        two[plc[1]]=k;
                        plc[1]++;
                    }
                    if(bit[k]==2){
                        three[plc[2]]=k;
                        plc[2]++;
                    }
                }
                if(chk(A[one[0]],A[one[1]],A[one[2]],C[one[0]],C[one[1]],C[one[2]])){
                    if(chk(A[two[0]],A[two[1]],A[two[2]],C[two[0]],C[two[1]],C[two[2]])){
                        if(chk(A[three[0]],A[three[1]],A[three[2]],C[three[0]],C[three[1]],C[three[2]])) ans=true;
                    }
                }
            }
            System.out.println(ans?"1":"0");
        }
    }
}


Measured memory_bytes: 62684
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
//        Int N;
//        cin >> N;
//        vector<Int> A(N);
//        set<Int> B;
//        for (int i = 0; i < N; ++i) {
//            Int tmp;
//            cin >> tmp;
//            A[i] = tmp;
//            B.insert(tmp);
//        }
//        if (A.size() == B.size()) {
//            cout << "YES" << endl;
//        } else {
//            cout << "NO" << endl;
//        }
//

//        string S, T;
//        cin >> S >> T;
//        Int A, B;
//        cin >> A >> B;
//        string U;
//        cin >> U;
//
//        if (S == U) A--;
//        if (T == U) B--;
//        cout << A << " " << B << endl;

        string S;
        cin >> S;
        for (auto e : S) {
            cout << "x";
        }
        cout << endl;
    }

};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n,k;
  string s;
  cin >> n >> k >> s;
  switch (s[k-1]) {
    case 'A':
      s[k-1]='a';
      break;
    case 'B':
      s[k-1]='b';
      break;
    case 'C':
      s[k-1]='c';
      break;
    default:
      break;
  }
  cout << s;
  return 0;
}


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

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

 int main() {
   string S;
   ll K;
   char ans = '1';
   cin >> S >> K;

   ll i = 0;
   while(i < min(K, (ll)100)) {
    if (S.at(i) != '1') {
      ans = S.at(i);
      break;
    }
    else i++;
   }

   cout << ans << endl;
 }


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

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

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int n;cin>>n;

    VL w(n);
    REP(i,n){
        cin>>w[i];
    }

    LL result = INF_LL;
    REP(i,n){
        LL s1=0;
        LL s2=0;
        REP(j,n){
            if(j<=i){
                s1 += w[j];
            }
            else{
                s2 += w[j];
            }
        }
        result = min(result, abs(s1-s2));
    }
    cout<<result<<endl;
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << min(c, b / a) << EOL;
}



Measured memory_bytes: 256
import math


def get_input():

    N = int(input())
    cities = [list(map(int, input().split())) for _ in range(N)]
    return N, cities


def distance(p1, p2):

    d = (p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2
    return math.sqrt(d)


def main():

    N, cities = get_input()
    dist = 0
    for i in range(N):
        for j in range(i+1, N):
            start = cities[i]
            goal = cities[j]
            dist += distance(start, goal) * 2

    print(dist / N)


main()


Measured memory_bytes: 3064
#include <stdio.h>
#define N 26

int p[N] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101};
int pc[N] = {0};

int main()
{		
	int n, i, x, t, c = 0, j, k, d = 0;
		
	scanf("%d", &n);
	for(i = 0; p[i] <= n; i++){
		x = p[i], t = n;
		while(t) pc[i] += (t /= x);	
	}
	
	for(i = 0; p[i] <= n; i++){
		if(pc[i] >= 74) c++;
		for(j = 0; p[j] <= n; j++){
			if(i == j) continue;
			if(pc[i] >= 4 && pc[j] >= 14) c++;
			if(pc[i] >= 24 && pc[j] >= 2) c++;
			for(k = 0; p[k] <= n; k++){
				if(i == k || j == k) continue;
				if(pc[i] >= 4 && pc[j] >= 4 && pc[k] >= 2) d++;
			}
		}
	}
	printf("%d\n", c + d / 2);
		
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>

const int N = 1300;

int main()
{
	char str1[N], str2[N];
	
	while(fgets(str1, N, stdin))
	{
		int s1 = strlen(str1) - 1, go = 0;
		
		for(int i = s1, j = 0; i < s1 * 2; i++, j++)
		{
			str1[i] = str1[j];
		}
		fgets(str2, N, stdin);
		for(int i = 0; i < strlen(str1); i++)
		{
			int k = 0;
			for(int j = 0; j < strlen(str2) - 1; j++)
			{
				if(str1[i + j] == str2[j])
				{
					k++;
				}
				else
				{
					break;
				}
			}
			if(k == strlen(str2) - 1)
			{
				go = 1;
				break;
			}
		}
		if(go)
		{
			printf("Yes\n"); 
		}
		else
		{
			printf("No\n");
		}
	}
	return 0;
}


Measured memory_bytes: 2088
#include <bits/stdc++.h>
using namespace std;
long long dp[3010][3010][4];
int R,C,K;
long long ans=0;
vector<vector<long long>> vec;
int main(){
  cin>>R>>C>>K;
  vec.resize(R,vector<long long>(C,0));
  for(int i=0;i<R;i++){
    for(int j=0;j<C;j++){
      for(int k=0;k<4;k++){
        dp[i][j][k]=0;
      }
    }
  }
  for(int i=0;i<K;i++){
    int r,c,v;
    cin>>r>>c>>v;
    vec.at(r-1).at(c-1)=v;
  }
  dp[0][0][1]=vec.at(0).at(0);
  for(int y=0;y<R;y++){
    for(int x=0;x<C;x++){
      if(x+1<C){
        for(int i=1;i<4;i++){
          dp[y][x+1][i]=max(dp[y][x][i],max(dp[y][x+1][i],dp[y][x][i-1]+vec.at(y).at(x+1)));
        }
        dp[y][x+1][0]=max(dp[y][x][0],max(dp[y][x+1][0],dp[y][x][0]));
      }
      if(y+1<R){
        for(int i=0;i<4;i++){
          dp[y+1][x][0]=max(dp[y+1][x][0],dp[y][x][i]);
          dp[y+1][x][1]=max(dp[y+1][x][1],dp[y][x][i]+vec.at(y+1).at(x));
        }
      }
    }
  }
  for(int i=0;i<4;i++){
    ans=max(ans,dp[R-1][C-1][i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 355768
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
  ll nt;
  cin >> nt;
  __int128 n = nt;
  if (n % 2 == 1) {
    // 奇数の場合明らかに、素因数に2があらわれない。
    cout << 0 << endl;
    return 0;
  }
  // 偶数の場合、どうみても素因数の数は5の方が少ないので、探す
  // 5^nの倍数の個数を探す
  __int128 power5[27];
  power5[0] = 1;
  for (int i = 0; i < 26; i++) {
    power5[i + 1] = 5 * power5[i];
  }
  ll ans = 0;
  for (int i = 1; power5[i] <= n; i++) {
    ans += n / power5[i] / 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        string input = Console.ReadLine();
        char[] n = input.ToCharArray();
        int r = 0;
        for (int i = 0; i < n.Length; i++)
        {
            int s = Convert.ToInt32(new string(n[i], 1));
            r += s;
        }

        if (r % 9 == 0)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 22388
from collections import deque

class Vertex:
    _id = -1
    _children = []
    _depth = -1

    def __init__(self, i, c):
        self._id = i
        self._children = c

    def getId(self):
        return self._id

    def getChildren(self):
        return self._children

    def getDepth(self):
        return self._depth

    def setDepth(self, d):
        self._depth = d

    def print(self):
        print("{} {}".format(self._id, self._depth))


n = int(input())
graph = [0 for i in range(n)]
queue = deque([])

# 頂点登録
for i in range(n):
    u = list(map(int, input().split(' ')))
    adj = []
    if u[1] > 0:
        adj = u[2:u[1]+2]
    graph[u[0]-1] = Vertex(u[0], adj)

# BFS
graph[0].setDepth(0)
queue.append(graph[0])
while queue:
    v = queue.popleft()
    for u_id in v.getChildren():
        u = graph[u_id-1]
        if u.getDepth() == -1:
            u.setDepth(v.getDepth()+1)
            queue.append(u)

# 回答を出力
for v in graph:
    v.print()



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

int main() {
  int N, M, k, a1, a2, b1, b2, c1, c2, d1, d2, e1, e2;
  cin >> N, 
  a1 = N + N * N + N * N * N;
  cout << a1 << endl;
  
  
  
  
 
}



Measured memory_bytes: 3628
#include "bits/stdc++.h"

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve(){
	int n,l;
	cin >> n >> l;
	vector<string> v;
	rep(i,n){
		string s;
		cin >> s;
		v.pb(s);
	}
	ssort(v);
	string ans = "";
	rep(i,n){
		ans = ans + v[i];
	}
	P(ans);
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
A, B, K = map(int, input().split())

if A == K:
    print(0, B)
elif A > K:
    print(A-K, B)
elif K > A:
    K -= A
    A = 0
    if B == K:
        print(A, 0)
    elif K > B:
        print(A, 0)
    elif B > K:
        print(A, B-K)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rint register int 
#define ll long long
using namespace std;
const ll Max=1e9;
int N,P[1010000];
ll Sum[1010000],A[1010000],B[1000000];
int main(){
	cin>>N;
	for(rint i=1;i<=N;++i) cin>>P[i];
	for(rint i=1;i<=N;++i) {
		Sum[P[i]]=Max-N+i;
	}
	A[1]=Max/2;B[1]=Sum[1]-A[1];
	for(rint i=2;i<=N;++i) {
		B[i]=B[i-1]-N;
		A[i]=Sum[i]-B[i];
	}
	for(rint i=1;i<=N;++i) cout<<A[i]<<" ";
	cout<<"\n";
	for(rint i=1;i<=N;++i) cout<<B[i]<<" ";
	cout<<"\n";
	return 0;
}

Measured memory_bytes: 4132
#include <stdio.h>

char s[100001];
int g, p, l;
int w;

int len(void) {
    int len=0;
    while(s[++len]);
    return len;
}

int main(void) {
    scanf("%s", s);
    
    l=len();

    for(int i=l-1; i>=0; i--)
        if(s[i]=='g') {
            if(g>p) {
                p++;
                w++;
            }
            else {
                g++;
            }
        }
        else {
            if(g>p) {
                p++;
            }
            else {
                g++;
                w--;
            }
        }
    
    printf("%d", w);

    return 0;
}

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

using namespace std;


int calc(vector<int> A, vector<int> B) {
    int ans = 0;
    for (int i = 0; i < A.size(); i++)
        ans += A[i] * B[i];
    return ans;
}

int main() {
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> W(M);
    for (auto &&i: W) cin >> i;

    int ans = 0;
    for (int i = 0; i < N; i++) {
        vector<int> V(M);
        for (int j = 0; j < M; j++) {
            cin >> V[j];
        }
        if (calc(V,W) + C > 0 ){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {
	

	char a;
	cin >> a;
	string s = "consonant";
	if (a  =='a'|| a == 'i'||a == 'u'||a == 'e' || a == 'o') {
		s = "vowel";
	}
	cout << s<< endl;
	
}


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

const int INF = 1001001001;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int>> to(n), dist(n, vector<int>(3, INF));
    for(int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        to[u].push_back(v);
    }
    int s, t;
    cin >> s >> t;
    s--;
    t--;
    queue<pair<int, int>> q;
    q.push({s, 0});
    dist[s][0] = 0;
    while(!q.empty()) {
        int u = q.front().first;
        int l = q.front().second;
        q.pop();
        for(auto&& v : to[u]) {
            int nl = (l + 1) % 3;
            if(dist[v][nl] != INF) continue;
            dist[v][nl] = dist[u][l] + 1;
            q.push({v, nl});
        }
    }
    if(dist[t][0] == INF) cout << -1 << endl;
    else cout << dist[t][0] / 3 << endl;
}


Measured memory_bytes: 14356
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <map>
#include <utility>
#include <queue>
#define ull unsigned long long
#define ll long long
#define mod 998244353
using namespace std;

int dp[3][100001];

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

    int niz[3][n];

    for (int i=0;i<n;i++){
        cin>>niz[0][i]>>niz[1][i]>>niz[2][i];
    }

    /*if ( n == 1 ){
        cout<<max(arr[0].a, max(arr[0].c, arr[0].b));
        return 0;
    }*/

    dp[0][0] = niz[0][0];
    dp[1][0] = niz[1][0];
    dp[2][0] = niz[2][0];

    for (int i=1;i<n;i++){
        dp[0][i] = max(dp[1][i-1] + niz[0][i], dp[2][i-1] + niz[0][i]);
        dp[1][i] = max(dp[0][i-1] + niz[1][i], dp[2][i-1] + niz[1][i]);
        dp[2][i] = max(dp[1][i-1] + niz[2][i], dp[0][i-1] + niz[2][i]);
    }

    cout<<max(dp[1][n-1], max(dp[0][n-1], dp[2][n-1]));
    return 0;
}


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

typedef long long ll;

namespace FFT {

typedef double dbl;
typedef complex<dbl> cplx;
const dbl pi = acos(-1);

const int W = 19, S = 1 << W;

int m, s;
int r[S];
void init(int n) {
    for (s = 0, m = 1; m < n; m <<= 1, ++s);
    for (int i = 0; i != m; ++i)
        r[i] = (r[i >> 1] >> 1) | ((i & 1) << (s - 1));
}

void fft(cplx* p, const int t) {
    for (int i = 0; i != m; ++i) if (i < r[i]) swap(p[i], p[r[i]]);
    for (int i = 1; i != m; i <<= 1) {
        cplx w0{ cos(pi / i), (t ? -1 : 1) * sin(pi / i) };
        for (int j = 0; j != m; j += (i << 1)) {
            cplx w{ 1, 0 };
            for (int k = 0; k != i; k++) {
                cplx u = p[j + k], v = w * p[i + j + k];
                p[j + k] = u + v; p[i + j + k] = u - v;
                w *= w0;
            }
        }
    }
}

void fft2(cplx* p, cplx* q, const int t) {
    for (int i = 0; i < m; ++i) p[i].imag(q[i].real());
    fft(p, t);
    for (int i = 0; i < m; ++i) q[i] = conj(p[i ? m - i : 0]);
    for (int i = 0; i < m; ++i) {
        cplx u = (p[i] + q[i]) / 2., v = (p[i] - q[i]) / 2.;
        p[i] = u; q[i] = cplx(0, -1) * v;
    }
}

cplx px[S], py[S], pz[S];
vector<ll> conv(const vector<int>& a, const vector<int>& b) {
    int n1 = a.size(), n2 = b.size(), n3 = n1 + n2 - 1; init(n3);
    for (int i = 0; i < m; ++i) px[i] = cplx(i < n1 ? a[i] : 0, 0);
    for (int i = 0; i < m; ++i) py[i] = cplx(i < n2 ? b[i] : 0, 0);
    fft2(px, py, 0);
    for (int i = 0; i < m; ++i) pz[i] = px[i] * py[i];
    fft(pz, 1);
    vector<ll> c(n3);
    for (int i = 0; i < n3; ++i) c[i] = round(pz[i].real() / m);
    return c;
}

}

using FFT::conv;

const int P = 200003;
int l[P], w[P];

int main(void) {
    for (int i = 0, q = 1; i < P - 1; ++i, q = (q + q) % P) l[q] = i, w[i] = q;
    vector<int> c(P - 1, 0);
    int n; scanf("%d", &n);
    vector<int> a(n);
    for (int& i : a) {
        scanf("%d", &i);
        if (i) c[l[i]]++;
    }
    vector<ll> d = conv(c, c);
    
    ll sum = 0;
    for (int i = 0; i < d.size(); ++i)
        sum += d[i] * w[i % (P - 1)];
    
    for (int i = 0; i < a.size(); ++i)
        sum -= 1ll * a[i] * a[i] % P;
    printf("%lld\n", sum / 2);    
    return 0;
}

Measured memory_bytes: 36628
// 
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

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

    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    int ok=0;
    map<int,int> kind;
    rep(i,n){
        if(kind.count(a[i])==1) kind[a[i]]++;
        else kind[a[i]]=1;
    }
    if(kind.count(1)!=1){
        rep(j,n){
            bool flag=true;
            for(int i=2;i<int(sqrt(a[j])+0.5)+1;i++){
                if(a[j]%i==0){
                    if(kind.count(i)==1){
                        flag=false;
                        break;
                    }
                    if(kind.count(a[j]/i)==1){
                        flag=false;
                        break;
                    }
                }
            }
            if(kind[a[j]]!=1){
                flag=false;
            }
            if(flag) ok++;
        }
        cout<<ok<<endl;
    }else{
        if(kind[1]==1) cout<<1<<endl;
        else cout<<0<<endl;
    }
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, A; cin >> N >> A;
    vector<ll> x(N); rep(i, N){cin >> x.at(i);}
    // dp[j][k][s] ~x_{j}の中からk枚選んで合計をsにするような選び方の総数
    ll X = max(A, *max_element(x.begin(), x.end()));
    ll dp[N + 1][N + 1][N * X + 1];
    rep(j, N + 1){rep(k, N + 1){rep(s, N * X + 1){dp[j][k][s] = 0;}}}
    dp[0][0][0] = 1;
    rep2(j, 1, N + 1){rep(k, N + 1){
        rep(s, N * X + 1){
            dp[j][k][s] += dp[j - 1][k][s];
            if (s - x.at(j - 1) >= 0){dp[j][k][s] += dp[j - 1][k - 1][s - x.at(j - 1)];}
        }
    }}
    ll ans = 0;
    rep2(k, 1, N + 1){ans += dp[N][k][k * A];}
    cout << ans << endl;
}

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


Measured memory_bytes: 54472
#include<cstdio>
#include<string>
#include<string.h>
using namespace std;
char str[100005];
int main(){
	int ans=0;
	scanf("%s",str);
	int N=strlen(str);
	for(int i=0;i<N;i++){
		if(i%2==0){
			if(str[i]=='p'){
				ans--;
			}
		}else{
			if(str[i]=='g'){
				ans++;
			}
		}
	}
	printf("%d\n",ans);
	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 REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int a,b,c,d; cin >> a >> b >> c >> d;
    cout << (a*b>c*d?a*b:c*d) << endl;
    return 0;
}

Measured memory_bytes: 3572
N=int(input())
K=list(map(int, input().split()))
from collections import Counter
ans = 0
C = Counter(K)
for k, v in C.items():
    ans += v*(v-1)//2

for a in K:
    e = C[a]
    print(ans-e*(e-1)//2+(e-1)*(e-2)//2)

Measured memory_bytes: 26268
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <stack>
#include <queue>

using namespace std;
#define Fill(a, b) memset(a, b, sizeof(a))
#define Debug(x) cout << #x << "=" << (x) << endl;
typedef long long LL;
const LL inf = 1LL << 61;
const LL mod = 1000000007;
#define DEBUG
#ifdef DEBUG
#endif
const int maxn = 1e5+10;


int n, m;
bool flag;
int type[maxn];
vector<int> tree[maxn];
void dfs(int u, int c)
{
	if(flag)return ;
	type[u] = c;
	int nxc = c==1?2:1;
	for(auto v: tree[u])
	{
		if(type[v]==c)
		{
			flag = true;
			return ;
		}
		if(type[v])continue;
		dfs(v, nxc);
	}
}
int main()
{
    std::ios::sync_with_stdio(false);
    int a, b;
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; i++)
    {
    	scanf("%d%d", &a, &b);
    	tree[a].push_back(b);
    	tree[b].push_back(a);
    }
    Fill(type, 0);
    flag = false;
    dfs(1, 1);
    LL ans = 0, nl = n, ml = m;
    if(flag)
    {

    	ans = nl*(nl-1)/2-m;
    }
    else
    {
    	LL b = 0, w = 0;
    	for(int i = 1; i <= n; i++)
    	{
    		if(type[i]==1)b++;
    		else w++;
    	}
    	ans = b*w-m;
    }
    printf("%lld\n", ans);






















    return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> pr;
void sieve(int n){
    bool prime[n+1];
    memset(prime, true, sizeof(prime));;
    prime[0] = false;
    prime[1] = false;
    for(int i = 2; i * i <= n; i++){
        if(prime[i]){
            for(int j = 2 * i; j <= n; j += i)
                prime[j] = false;
        }
    }
    for(int i = 2; i <= n; i++){
        if(prime[i])
            pr.push_back(i);
    }
    return;
}
int main() {
    ll n;
    cin >> n;
    if(n == 1){
        cout << 0;
        return 0;
    }
    sieve(n);
    
    ll count[pr.size()] = {0};
    for(int i = 2; i <= n; i++){      
        int num = i;
        for(int j = 0; j < pr.size(); j++){
            while(num % pr[j] == 0){
                count[j]++;
                num /= pr[j];
            }
        }
    }
    
    ll c = 0;
    for(int i = 0; i < pr.size(); i++){
        if(count[i] >= 74)
        c++;
    }
    
    ll ans = c;
    for(int i = 0; i < pr.size(); i++){
        for(int j = 0; j < pr.size(); j++){
            if(i == j)
            continue;
            if(count[i] >= 2 && count[j] >= 24)
                ans++;
            if(count[i] >= 4 && count[j] >= 14)
                ans++;
        }
    }
    unordered_map<int, int> mp;
    for(int i = 0; i < pr.size(); i++){
        for(int j = 0; j < pr.size(); j++){
            for(int k = 0; k < pr.size(); k++){
                if(i == j || i == k || j == k)
                continue;
                if(count[i] >= 2 && count[j] >= 4 && count[k] >= 4 && mp[pr[k]*pr[j]] != pr[i]){
                    ans++;
                    mp[pr[k]*pr[j]] = pr[i];
                }
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int ans = 0;
		for (int i = 0; i < N; i++) {
			int l = in.nextInt();
			int r = in.nextInt();
			ans += r - l + 1;
		}
		System.out.println(ans);
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
}

Measured memory_bytes: 25396
#include <iostream>
using namespace std;typedef long long ll;ll n,q,x,r,l,m,a[100000],t[100001],s[100001];int main(){cin>>n>>q;for(int i=0;i<n;i++){cin>>a[i];s[i+1]=s[i]+a[i];t[i+1]=(i?t[i-1]:0)+a[i];}while(q--){cin>>x;l=0;r=n+1;while(r-l>1){m=(r+l)/2;(abs(a[n-m]-x)>abs(a[n-(m+1)/2]-x)?r:l)=m;}cout<<s[n]-s[n-(l+1)/2]+t[max(n-l-(l&1),0LL)]<<endl;}}


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

int main(){
	double a,b,c,d,e,f;
	double x,y;
	double temp;
	while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
		temp = a*e - b*d;
		x = (c*e - b*f)/temp;
		y = (a*f - d*c)/temp;
		temp = x * pow(10, 4);
		temp = (double)(int)(temp + 0.5);
		x = temp * pow(10, -4);
		temp = y * pow(10, 4);
		temp = (double)(int)(temp + 0.5);
		y = temp * pow(10, -4);
		printf("%-.3f %-.3f\n",x,y);
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl '\n'
#define pb push_back
#define PI 3.14159265
int M = 1000000007;
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int A;
  cin >> A;
  string out = "";
  while (A)
  {
    int x = A % 26;
    if (x == 0)
    {
      x = 26;
      A--;
    }
    out += 'a' + x - 1;
    A = A / 26;
  }
  reverse(out.begin(), out.end());
  cout << out;
}

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

import sys, math, copy
# import fractions, itertools
# import numpy as np
# import scipy

HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    n, m = map(int, input().split())
    cnt = [0 for i in range(n)]
    for i in range(m):
        a, b = map(int, input().split())
        cnt[a - 1] += 1
        cnt[b - 1] += 1
    flag = True
    for i in range(n):
        if cnt[i] % 2 == 1:
            flag = False
            break
    print("YES" if flag else "NO")

main()


Measured memory_bytes: 4504