akhauriyash/Code-Regression huggingface dataset:
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, q, last, cnt, sum[2000000], ans, dp[2000000], a[2000000],b[2000000];
string str,ss;
bool f;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ -1,0 } ,{ 0,-1 } };
struct Edge { LL to, cost; };
vector<Edge>vec[1000000];
vector<Pll>v;
map<string, LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> n >> k;
	rep(i, k) {
		cin >> a[i];
	}
	while (1) {
		LL cnt = n;
		while (cnt > 0) {
			rep(i, k)
				if (cnt % 10 == a[i])
					goto aaa;
			cnt /= 10;
			if (cnt == 0) {
				cout << n << endl;
				return 0;
			}
		}
	aaa:
		n++;
	}
	return 0;
}


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

int main()
{
  int H, N;
  cin >> H >> N;
  int A, total = 0;
  for (int i = 0; i < N;i++){
    cin >> A;
    total += A;
  }
  cout << (H <= total? "Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

long long v[60];

int main()
{
    //freopen("file.in","r",stdin);
    //freopen("file.out","w",stdout);
    long long k;
    scanf("%lld",&k);
    long long n=50;
    for(int i=1;i<=n;i++) v[i]=i-1;
    long long c=k/n;
    for(int i=1;i<=n;i++)
    {
        v[i]+=c*n;
        v[i]-=c*(n-1);
    }
    c=k%n;
    for(int i=1;i<=c;i++)
    {
        v[i]+=n;
        v[i]-=c-1;
    }
    for(int i=c+1;i<=n;i++)
        v[i]-=c;
    printf("%d\n",n);
    for(int i=1;i<=n;i++)
        printf("%lld ",v[i]);
    return 0;
}


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



int main() {
    int n;
    cin >> n;
    
    vector<int> ans(10005);
    
    for(int x = 1; x <= 100; x++) {
        for(int y = 1; y <= 100; y++) {
            for(int z = 1; z <= 100; z++) {
                int total;
                total = x*x + y*y + z*z + x*y + y*z + z*x;
                if(total <= n)
                    ans[total]++;
            }
        }
    }
    
    for(int i = 1; i <= n; i++) {
        cout << ans[i] << endl;
    }
    
    return 0;
}




Measured memory_bytes: 3664
A, B, M = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
mina = min(a)
minb = min(b)

ans = mina + minb

for i in range(M):
    x,y,c = map(int, input().split())
    x -= 1
    y -= 1
    ans = min(ans, a[x] + b[y] - c)

print(ans)






Measured memory_bytes: 18488
#include <bits/stdc++.h>
using namespace std;
//関数
const long INF=1000000000000000;

int main(void){
    string S;
    cin>>S;
    
    vector<long> pya(26,0);
    for(int i=0;i<4;i++){
        pya.at(S.at(i)-'A')++;
    }
    
    for(int i=0;i<26;i++){
        if(pya.at(i)!=0 && pya.at(i)!=2){
            cout<<"No"<<endl;
            return 0;
        }
    }
    
    cout<<"Yes"<<endl;
}


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

int main() {
	int n;
	cin >> n;
	int act[n][3];
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < 3; j++) {
			cin >> act[i][j];
		}
	}
	int dp[n][3];
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < 3; j++) {
			dp[i][j] = 0;
		}
	}
	dp[0][0] = act[0][0];
	dp[0][1] = act[0][1];
	dp[0][2] = act[0][2];
 	for(int i = 0; i < n - 1; i++) {
		for(int j = 0; j < 3; j++) {
			for(int k = 0; k < 3; k++) {
				if(j == k) {
					continue;
				}else {
					dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + act[i + 1][j]);
				}
			}
		}
	}
	cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <functional>
#include <cassert>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define ALL(a) (a).begin(),(a).end()

#define pb push_back

using namespace std;
typedef unsigned long ul;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;

char conv(char s, int n) {
    int i = s - 'a';
    i = (i+n) % 26;

    return (char)('a' + i);
}

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

    for (int i = 0; i < s.size(); i++) {
        ll d;
        if (s[i] != 'a' && (d = 'z' - s[i] + 1) <= K) {
            s[i] = 'a';
            K -= d;
        }
    }
    if (K > 0) {
        s[s.size()-1] = conv(s[s.size()-1], K);
    }
    cout << s << endl;
}


Measured memory_bytes: 576
#include <iostream>
#include <string>
#include<vector>
#include<cmath>
#define NMAX 105
#define KMAX 10005
using namespace std;

int n, k;
struct Item {
  int value, weight;
};

Item items[NMAX];
int C[NMAX][KMAX];
int maxValue;

void compute(){
  for(int w = 0; w <= k; w++) {
    C[0][w] = 0;
  }

  for(int i = 1; i <= n; i++){
    C[i][0] = 0;
  }

  for(int i = 1; i <=n; i++){
    for(int w = 1; w <= k; w++){
      C[i][w] = C[i-1][w];
      if(items[i].weight > w) continue;
      if (items[i].value + C[i-1][w - items[i].weight] > C[i-1][w]){
        C[i][w] = items[i].value + C[i-1][w - items[i].weight];
      }
    }
  }

  maxValue = C[n][k];

}

int main() {
  cin >> n >> k;
  for(int i = 1; i <= n; i++){
    cin >> items[i].value >> items[i].weight;
  }

  

  compute();
  
  cout << maxValue << endl;

  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

void intarrayinput(int sz,int a[]){for(int ___=0;___<sz;++___)scanf("%d",a+___);}
void intarrayoutput(int sz,int a[]){for(int ___=0;___<sz;++___)printf("%d ",a[___]);printf("\n");}
template<class T>T emin(T& t1,T t2){if(t1>t2)return t1=t2;else return t1;}
template<class T>T emax(T& t1,T t2){if(t1<t2)return t1=t2;else return t1;}
template<class T1,class T2>ostream& operator<<(ostream& out,pair<T1,T2> _p){out<<_p.first<<" "<<_p.second;return out;}
template<class T>ostream& operator<<(ostream& out,vector<T> _v){for(int i=0;i<_v.size();++i)out<<_v[i]<<(i+1==_v.size()?"":" ");return out;}
template<class T>void byebye(T t){cout<<t<<endl;exit(0);}

int k,x;

void print(int st,int e){
	for(int i=st;i<=e;++i)cout<<i<<' ';
}

int main(){
	cin>>k>>x;
	print(x-k+1,x+k-1);
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
 int64_t n,a,b;
  cin>>n>>a>>b;
  int64_t ans=0;
  ans+=a*(n/(a+b));
    if(n%(a+b)<=a){
      ans+=n%(a+b);
    }
  else{
    ans+=a;
  }
  cout<<ans<<endl;
    
}


Measured memory_bytes: 256
void main()
{
    long n = readln.chomp.to!long;
    long[] a = readln.split.to!(long[]);

    long x, y;
    long r;
    long result;
    foreach (l; 0 .. n)
    {
        while (r < n && (x ^ a[r]) == (y + a[r]))
        {
            x ^= a[r];
            y += a[r];
            ++r;
        }

        result += r - l;

        if (l == r)
        {
            ++r;
        }
        else
        {
            x ^= a[l];
            y -= a[l];
        }
    }

    result.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 11612
#include <cmath>
#include<iostream>
#include<vector>
/*#include<algorithm>
#include<functional>
#include<queue>
#include<set>
#include<tuple>
#include<bitset>*/
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
vector<P> prime_factorize(long long N) {
	vector<pair<long long, long long> > res;
	for (long long a = 2; a * a <= N; ++a) {
		if (N % a != 0) continue;
		long long ex = 0;
		while (N % a == 0) {
			++ex;
			N /= a;
		}
		res.push_back({ a, ex });
	}
	if (N != 1) res.push_back({ N, 1 });
	return res;
}

int main(void) {
	int n;
	cin >> n;
	ll count = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 2 == 0)continue;
		vector<P>p;
		p = prime_factorize(i);
		ll index = 1;
		for (auto id : p) {
			index *= id.second + 1;
		}
		if (index == 8) {
			count++;
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3616
class Dice
  def initialize(ary)
    @ary = ary
  end

  def roll(way)
    case way.downcase
    when 'e'
      tmp = @ary[0]
      @ary[0] = @ary[3]
      @ary[3] = @ary[5]
      @ary[5] = @ary[2]
      @ary[2] = tmp
    when 'w'
      tmp = @ary[0]
      @ary[0] = @ary[2]
      @ary[2] = @ary[5]
      @ary[5] = @ary[3]
      @ary[3] = tmp
    when 's'
      tmp = @ary[0]
      @ary[0] = @ary[4]
      @ary[4] = @ary[5]
      @ary[5] = @ary[1]
      @ary[1] = tmp
    when 'n'
      tmp = @ary[0]
      @ary[0] = @ary[1]
      @ary[1] = @ary[5]
      @ary[5] = @ary[4]
      @ary[4] = tmp
    end
  end

  def top
    @ary[ 0 ]
  end
end

dice = Dice.new(gets.chomp.split(/\s/).map(&:to_i))
order = gets.chomp.split('')
order.each{ |way| dice.roll(way) }
puts dice.top

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

const int INF = 1001001001;

int main()
{
  int n,x,y;
  cin >> n >> x >> y;
  --x; y--;

  //グラフを持たない。陽に持たない。変数にグラフの構造作らずにやる
  vector<int> ans(n);
  rep(sv, n) {
    vector<int> dist(n, INF);
    queue<int> q;
    //ラムダ式。vに距離dで到達できるときqに突っ込む。
    //距離が確定してるときはとばす。
    auto push = [&](int v, int d){
      if (dist[v] != INF) return;
      dist[v] = d;
      q.push(v);
    };
    push(sv, 0);
    while(!q.empty()){
      int v = q.front(); q.pop();
      int d = dist[v];
      if(v-1 >= 0) push(v-1, d+1);
      if(v+1 < n)push(v+1, d+1);
      if(v == x) push(y, d+1);
      if(v == y) push(x, d+1);
    }
    rep(i,n) ans[dist[i]]++;
  }
  rep(i,n) ans[i] /= 2;
  for(int i = 1; i <= n-1; ++i){
    cout << ans[i] << endl;
  }
  return 0;
}

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

#define int long long
#define pii pair<int, int>
#define pb push_back

signed main(){

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

    int n;
    cin >> n;
    int res = 0;
    for(int i = 1; i <= n; i++){
        if(i%3==0) continue;
        if(i%5==0) continue;
        res += i;
    }
    cout << res << endl;  

    return 0;
}

Measured memory_bytes: 3640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N, A, B; cin >> N >> A >> B;
    
    cout << min(N*A, B) << endl;
    
    return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
int mod_pow(int x,int n,int m){
    int res=1;
    while(n>0){
        if(n&1)res=res*x%m;
        x=x*x%m;
        n>>=1;
    }
    return res;
}
signed main(void) {
    int M,N;cin>>M>>N;
    cout<<mod_pow(M,N,mod)<<endl;
}



Measured memory_bytes: 3108
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int a[maxn],n,L,f;

int main()
{
	n=read(),L=read(); rep(i,1,n) a[i]=read();
	if(n==1) return puts("Possible"),0;
	rep(i,1,(n-1)) if(a[i]+a[i+1]>=L) {f=i; break;}
	if(!f) puts("Impossible");
	else
	{
		puts("Possible");
		rep(i,1,(f-1)) printf("%d\n",i);
		per(i,(n-1),(f+1)) printf("%d\n",i); printf("%d\n",f);
	}
	return 0;
}

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



int main(){
	queue<int> ans,tmp,tmp2;
	int n,r;
	while(cin>>n>>r,n||r){
		for(int i=0;i<n;i++){
			ans.push(n-i);
		}
		int p,c;
		for(int i=0;i<r;i++){
			cin>>p>>c;
			for(int j=0;j<n;j++){
				if(j<p-1){
					tmp.push(ans.front());ans.pop();
				}else if(j<p+c-1){ 
					tmp2.push(ans.front());ans.pop();
				}else{
					tmp.push(ans.front());ans.pop();
				}
			}
			while(tmp2.empty()!=true){
				ans.push(tmp2.front());tmp2.pop();
			}
			while(tmp.empty()!=true){
				ans.push(tmp.front());tmp.pop();
			}
		}
		cout<<ans.front()<<endl;
		while(ans.empty()!=true){
			//cout<<ans.front();
			ans.pop();
		}
	}
	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
typedef long long ll;
typedef pair<ll,ll> P;
#define se second
#define fi first
struct PP{ll fi;ll se;ll th;};
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}
void outvi(vi v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
void outvvi(vvi v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    int n;cin>>n;
    ll ans=0;
    vector<vector<P>> g(n);
    rep(i,n){
        int a;cin>>a;
        rep(j,a){
            int k,t;cin>>k>>t;
            g[i].eb(k,t);
        }
    }
    rep(i,(1<<n)){
        bool b=true;
        int cnt=0;
        vi v;
        int k=i;
        rep(j,n){
            v.pb(k%2);
            k/=2;
        }
        rep(j,n){
            if(v[j]){
                cnt++;
                for(auto x:g[j])if(v[x.fi-1]!=x.se)b=false;
            }
        }
        if(b)chmax(ans,cnt);
    }
    cout<<ans<<endl;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	cin >> N;
	int odd = 0, two=0,four = 0;
	int A;
	rep(i, 0, N)
	{
		cin >> A;
		if (A % 2 == 1) {
			odd++;
		}
		else if (A % 4 == 0)
		{
			four++;
		}
		else
		{
			two = min(1LL, two + 1);
		}
	}

	if (odd + two - 1 <= four)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
s1 = input().split('"')
while s1[0]!='.':
  miss = 0
  ans = "IDENTICAL"
  s2 = input().split('"')
  if len(s1) != len(s2):
    ans="DIFFERENT"
  else :
    for i in range(len(s1)):
      if i % 2 == 0 and s1[i] != s2[i]:
        ans="DIFFERENT"
        break
      if i % 2 == 1 and s1[i] != s2[i]:
        if ans == "CLOSE":
          ans="DIFFERENT"
          break
        else:
          ans = "CLOSE"
  print(ans)
  s1=input().split('"')


Measured memory_bytes: 5576
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
4 5
0 1 2
0 2 1
1 2 1
1 3 1
2 3 2

output:
3
"""

import sys
from collections import deque


def graph_bfs(source, target, parent):
    visited = [False] * vertices
    queue = deque()
    queue.append(source)
    visited[source] = True

    while queue:
        current = queue.popleft()
        for adj, cp in adj_table[current].items():
            if cp and not visited[adj]:
                queue.append(adj)
                visited[adj] = True
                parent[adj] = current

    return True if visited[target] else False


def graphFordFulkerson(source, sink):
    parent = [-1] * vertices
    max_flow = 0

    while graph_bfs(source, sink, parent):
        path_flow = float('inf')

        bk_1 = sink
        while bk_1 is not source:
            path_flow = min(path_flow, adj_table[parent[bk_1]][bk_1])
            bk_1 = parent[bk_1]

        max_flow += path_flow

        bk_2 = sink
        while bk_2 is not source:
            parent_bk_2 = parent[bk_2]
            adj_table[parent_bk_2].setdefault(bk_2, 0)
            adj_table[bk_2].setdefault(parent_bk_2, 0)

            # print(bk_2, parent_bk_2, path_flow, bk_1, parent[bk_1], parent, adj_table)
            adj_table[parent_bk_2][bk_2] -= path_flow
            adj_table[bk_2][parent_bk_2] += path_flow
            bk_2 = parent[bk_2]

    return max_flow


def generate_adj_table(v_table):
    for each in v_table:
        source, target, cp = map(int, each)
        init_adj_table[source][target] = cp

    return init_adj_table


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices, edges = map(int, _input[0].split())
    v_info = map(lambda x: x.split(), _input[1:])

    init_adj_table = [dict() for _ in range(vertices)]
    adj_table = generate_adj_table(v_info)
    ans = graphFordFulkerson(source=0, sink=vertices - 1)
    print(ans)

Measured memory_bytes: 8208
#include <bits/stdc++.h>
using namespace std;
#define QOEINDIEDIS freesteed
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
void solve(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min(a*b,c); 
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}






Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
int n;
int a[111111],nxt[111111];
inline int gcd(int x,int y)
{int r=y;while(r)r=x%y,x=y,y=r;return x;}
int g[2222][2222],fa[2222];
bool vis[2222];
void dfs(int x)
{
	vis[x]=1;
	for(register int i=1;i<=n;i++)
	{
		if(vis[i])continue;
		if(g[x][i]==1)continue;
		fa[i]=x,dfs(i);
	}
}
#include<queue>
std::priority_queue<int>q;
int main()
{
	scanf("%d",&n);
	register int i,ii;
	for(i=1;i<=n;i++)
		scanf("%d",a+i);
	std::sort(a+1,a+n+1);
	for(i=1;i<=n;i++)
		for(ii=i+1;ii<=n;ii++)
			g[i][ii]=g[ii][i]=gcd(a[i],a[ii]);
	for(i=1;i<=n;i++)
		if(!vis[i])dfs(i);
	for(i=1;i<=n;i++)if(!fa[i])q.push(i);
	for(i=1;i<=n;i++)
	{
		int t=q.top();q.pop();
		printf("%d%c",a[t],(i^n)?' ':'\n');
		for(ii=1;ii<=n;ii++)if(fa[ii]==t)q.push(ii);
	}
}

Measured memory_bytes: 18944
#define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double EPS = 1e-8;

int main(){
  int N;
  while(~scanf("%d",&N)){
    if(N == 0) break;
    char cards[101];
    scanf("%s",cards);
    
    int card_idx = 0;
    int players[11];
    memset(players,0,sizeof(players));

    int field = 0;
    for(int round=0;round < 100; round++){
      for(int player_idx=0;player_idx < N; player_idx++){

	if(cards[card_idx] == 'M'){
	  players[player_idx]++;
	}
	else if(cards[card_idx] == 'S'){
	  field += (players[player_idx] + 1);
	  players[player_idx] = 0;
	}
	else if(cards[card_idx] == 'L'){
	  players[player_idx] += (field + 1);
	  field = 0;
	}
	card_idx++;
	if(card_idx >= 100) goto game_over;
      }
    }
    
  game_over:;

    sort(players,players + N);
    for(int player_idx=0;player_idx<N;player_idx++){
      printf("%d ",players[player_idx]);
    }
    printf("%d\n",field);
  }
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N; cin >> N;
	if(N % 2 == 0){
		cout << "0.5000000000" << endl;
	}else{
	double s = (N + 1)/ 2;
	double ans = s / N;
	cout << ans << endl;
	}

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repX(i, n ,x) for (int i = x; i < (int)(n); ++i)
#define repBack(i, n) for (int i = n; i >= 0; --i)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    string S;
    cin >> S;
    if(S[0]=='S')cout << "Cloudy" << endl;
    if(S[0]=='C')cout << "Rainy" << endl;
    if(S[0]=='R')cout << "Sunny" << endl;
    
    return 0;
}

Measured memory_bytes: 256
import numpy as np

N,M = map(int,input().split())
A = np.array([list(input()) for _ in range(N)])
B = np.array([list(input()) for _ in range(M)])

bl = False
for i in range(N-M+1):
  for j in range(N-M+1):
    if (A[i:i+M,j:j+M] == B).all():
      bl = True

answer = 'Yes' if bl else 'No'
print(answer)

Measured memory_bytes: 12440
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main() {
    int n, m, k;
    cin >> n >> m >> k;

    vector<ll> A(n+1, 0);
    rep(i, n) {
        ll a;
        cin >> a;
        A[i+1] = A[i] + a;
    }

    vector<ll> B(m+1, 0);
    rep(i, m) {
        ll b;
        cin >> b;
        B[i+1] = B[i] + b;
    }

    int ans = 0;
    int j = m;

    rep(i, n+1) {
        if (A[i] > k) break;
        while (B[j] > k - A[i])
        {
            j--;
        }
        ans = max(ans, i + j);
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N;
  cin >> N;
  string ans = "";
  while(N != 0) {
    int k = abs(N) % 2;
    ans = (char)(k + '0') + ans;
    N -= k;
    N = N / -2;
  }
  if(ans == "") {
    cout << "0" << endl;
    return 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int card[4][14] ={0};
    char S[]="SHCD";
    int n, m, i, j;
    char s;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf(" %c %d", &s, &m);
         switch (s) {
         case 'S': card[0][m] = 1; break;
         case 'H': card[1][m] = 1; break;
         case 'C': card[2][m] = 1; break;
         case 'D': card[3][m] = 1; break;
         }
    }
    for (i = 0; i < 4; i++) {
        for (j = 1;  j < 14; j++) {
            if (card[i][j] == 0) {
                printf("%c %d\n", S[i], j);
             }
         }
    }
}




Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
const int maxn=112345;
int n,x[maxn],l,q,f[maxn][20];
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i) scanf("%d",&x[i]);
    scanf("%d%d",&l,&q);
    for (int i=1;i<=n;++i) {
        int t=upper_bound(x+1,x+1+n,x[i]+l)-x-1;
        f[i][0]=t;
    }
    for (int i=1;i<20;++i)
        for (int j=1;j<=n;++j)
            f[j][i]=f[f[j][i-1]][i-1];
    while (q--) {
        int a,b;scanf("%d%d",&a,&b);
        if (a>b) swap(a,b);
        int num=0;
        for (int i=19;i>=0;--i)
            if (f[a][i]<b) {
                num+=1<<i;
                a=f[a][i];
            }
        printf("%d\n",num+1);
    }
    return 0;
}


Measured memory_bytes: 11944
#include <cstdio>
#include <cstdlib>

const int MAX = 8;

int solve(int num[])
{
        char max[MAX + 1], min[MAX + 1];

        for (int i = 0; i < MAX - 1; i++) {
                for (int j = MAX - 1; j > i; j--) {
                        if (num[j - 1] > num[j]) {
                                int tmp = num[j - 1];
                                num[j - 1] = num[j];
                                num[j] = tmp;
                        }
                }
        }
        for (int i = 0; i < MAX; i++) {
                min[i] = num[i] + '0';
                max[i] = num[MAX - 1 - i] + '0';
        }

        return atoi(max) - atoi(min);
}

int main()
{
        int n;
        char str[MAX + 1];
        int num[MAX];

        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
                scanf("%s", str);
                for (int j = 0; j < MAX; j++) {
                        num[j] = str[j] - '0';
                }
                int ans = solve(num);
                printf("%d\n", ans);
        }

        return 0;
}

Measured memory_bytes: 2684
#include<bits/stdc++.h>
using namespace std;
	string A[100001];
int main()
{
	long long N,total=0;
	cin>>N;
	map<string,bool>number;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		number[A[i]]=false;
	}
	for(int i=0;i<N;i++)
	{
		if(number[A[i]]==false)
		{
			number[A[i]]=true;
			total+=1;
		}
		else
		{
			number[A[i]]=false;
			total-=1;
		}
	}
	cout<<total<<endl;
}

Measured memory_bytes: 13312
#include<stdio.h>
#include<stdlib.h>

struct num{
	int b;
	long long c;
};

int compare_int(const void *a,const void *b){
	return *(long long*)a-*(long long*)b;
}

int compare_intt(const void *a,const void *b){
	struct num aa=*(struct num*)a;
	struct num bb=*(struct num*)b;
	return bb.c-aa.c;
}

int main(){
	int n,m,i,j,c=0;
	long long a[100000];
	struct num bc[100000];
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)scanf("%lld",&a[i]);
	for(i=0;i<m;i++)scanf("%d%lld",&bc[i].b,&bc[i].c);
	qsort(a,n,sizeof(long long),compare_int);
	qsort(bc,m,sizeof(struct num),compare_intt);
	for(i=0;i<m;i++){
		for(j=0;j<bc[i].b;j++){
			if(bc[i].c<=a[c])break;
			a[c++]=bc[i].c;
		}
	}
	long long ans=0;
	for(i=0;i<n;i++)ans+=a[i];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4084
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N,M = MI()
A = [0]*(N+2)

for i in range(M):
    l,r = MI()
    A[l] += 1
    A[r+1] -= 1

from itertools import accumulate

A = list(accumulate(A))
print(sum(A[i] == M for i in range(1,N+1)))


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

using namespace std;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef pair<int,int> pii;
typedef long long ll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    vvi g;
    int n, m , i, j , u, v;
    cin >> n >> m;
    g.resize(n);
    for(i=0;i<m;i++){
        cin >> v >> u;
        u--;v--;
        g[v].push_back(u);
        g[u].push_back(v);
    }
    vb clr(n, 0);
    queue<int> q;
    vi ans(n, -1);
    q.push(0);
    clr[0] = 1;
    while(!q.empty()){
        int v = q.front();
        q.pop();
        for(auto u : g[v]){
            if(clr[u] == 0){
                clr[u] = 1;
                ans[u] = v;
                q.push(u);
            }
        }
    }
    if(accumulate(all(clr), 0) == n){
        cout << "Yes\n";
        for(i=1;i<n;i++){
            cout << (ans[i]+1) << "\n";
        }
    }else{
        cout << "No\n";
    }
    
    return 0;
}

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

#define INF (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define N 100005
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795


//vl a(1001);

ll powM(ll a,ll b, ll m)
{ 
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans%m;
}



int main()
{

string s,t;cin>>s>>t;
t.erase(t.end()-1);
if(s==t)cout<<"Yes"<<"\n";
else cout<<"No"<<"\n";


  return 0;
}






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

/*                        [Template]                        */
#define async ios_base::sync_with_stdio(false); cin.tie(NULL);
#define int long long int
#define let auto
#define of :
#define all(y) y.begin(), y.end()
#define present( x, y ) x.find( y ) != x.end()
#define _matrix(T) vector<vector<T>>
template<class T>
auto matrix( int r, int c, T v ){
	return vector<vector<T>>( r, vector<T>( c, v ) ) ;
}
int mod = (int)1e9 + 7 ;

/************************************************************/

vector<bool> isPrime( (int)1e6 + 1, true ) ;

void seive(){
	isPrime[0] = false ;
	isPrime[1] = false ;
	isPrime[2] = true ;
	int to = sqrt( (int)1e6 ) ;
	for( int i = 2 ; i <= to ; i++ ){
		if( isPrime[i] ){
			for( int j = i * i ; j <= (int)1e6 ; j += i ){
				isPrime[j] = false ;
			}
		}
	}
}

vector<bool> fac((int)1e6, false) ;

bool func( int a ){
	// cerr << "calling for :" << a << endl ;
	for( int i = 2 ; i*i <= a ; i++ ){
		if( a % i == 0 && fac[i] ) return false ;
		while( a % i == 0 ){
			a /= i ;
			fac[i] = true ;
		}
	}
	if( a > 2 ) {
		if( fac[a] ) return false ;
		fac[a] = true ;
	}
	return true ;
}

int gcd( int a, int b ){
	if( b == 0 ) return a ;
	return gcd( b, a % b ) ;
}

signed main(){
	int n ; cin >> n ;
	vector<int> a(n) ;
	for( int i = 0 ; i < n ; i++ ) cin >> a[i] ;
	bool type1 = true ;
	for( int i = 0 ; i < n ; i++ ){
		if( !func(a[i]) ){
			// cout << i << endl ;
			type1 = false ;
			break ;
		}
		// for( int j = 0 ; j <= 5 ; j++ ) cout << fac[j] << " " ;
		// cout << endl ;
	}
	if( type1 ){
		cout<< "pairwise coprime" ;
		return 0 ;
	}
	else if( !type1 ) {
		int g = a[0] ;
		for( int i = 0 ; i < n ; i++ ){
			g = gcd( g, a[i] ) ;
		}
		if( g == 1 ){
			cout << "setwise coprime" ;
			return 0 ;
		}
	}
	cout << "not coprime" ;
	return 0 ;
}

Measured memory_bytes: 11436
// last edited at 23/8/2015 by charis

#include<iostream>
using namespace std;

class Dice{
public:
	int f[6];
	Dice(){}
	
	int aa(int i, int j, int x, int y, int z, int w){
		return (i==x && j==y) || (i==y && j==z) || (i==z && j==w) || (i==w && j==x);
	}
	void right(int i, int j){
		if( aa(i, j, 0, 1, 5, 4) ) cout << f[2] << endl;
		else if( aa(i, j, 4, 5, 1, 0) ) cout << f[3] << endl;			
		else if( aa(i, j, 0, 3, 5, 2) ) cout << f[1] << endl;
		else if( aa(i, j, 2, 5, 3, 0) ) cout << f[4] << endl;
		else if( aa(i, j, 1, 2, 4, 3) ) cout << f[0] << endl;
		else if( aa(i, j, 3, 4, 2, 1) ) cout << f[5] << endl;
		} 
	int c(int a, int b){
		for (int i=0; i<6; i++){
			for (int j=0; j<6; j++){
				if (f[i]==a && f[j]==b) right(i, j);			
			}
		}
	}
};

int main(){
	
	Dice d;
	int q;
	for (int n=0; n<6; n++){
		cin >> d.f[n] ;
	}
	
	cin >> q ;
	int a, b;
	for (int m=0; m<q; m++){
		cin >> a >> b ;
		d.c(a, b);
	}
	
	return 0;
}

Measured memory_bytes: 1160
def main():

  # S = list(map(int, input().split()))
  S = list(map(int, list(input())))

  for bit in range(1 << len(S)-1):
    ans = S[0]
    list_ = [str(S[0])]
    for i in range(len(S)-1):
      mask = (1 << i)
      if bit & mask:
        ans += S[i+1]
        list_.append('+')
        list_.append(str(S[i+1]))
      else:
        ans -= S[i+1]
        list_.append('-')
        list_.append(str(S[i+1]))
      # print(f'bit:{bit}, mask:{mask}, list_:{list_}')

    if (ans == 7):
      list_.append('=7')
      print("".join(list_))
      return


if(__name__ == '__main__'):
  main()

Measured memory_bytes: 9148
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
int main(){
int n,i,j,k,p,count=0;
set<int>::iterator it;
vector<int>x,y;
cin>>n;
for(i=0;i<n;i++){
    cin>>p;
    x.push_back(p);
}
sort(x.begin(),x.end());

for(i=0;i<n;i++){
        if(x[i]==x[i+1]){
    x[i]=0;
    x[i+1]=0;
}
}
for(i=0;i<n;i++){
    if(x[i]!=0){
        count++;
    }
}
cout<<count;
}

Measured memory_bytes: 3904
package main

import "fmt"

// W ..
var W int

var v []int
var w []int
var dp [][]int

func main() {
	var N int
	fmt.Scan(&N, &W)
	w = make([]int, N)
	v = make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&w[i], &v[i])
	}

	dp = make([][]int, N+1)
	for i := 0; i <= N; i++ {
		dp[i] = make([]int, 1000000)
	}

	fmt.Println(dfs(N, 0))
}

func dfs(i, sw int) int {
	if dp[i][sw] > 0 {
		return dp[i][sw]
	}

	if i == 0 {
		return 0
	}

	r := dfs(i-1, sw)
	if sw+w[i-1] <= W {
		r1 := dfs(i-1, sw+w[i-1]) + v[i-1]
		if r < r1 {
			r = r1
		}
	}

	dp[i][sw] = r
	return r
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int n;
string s[55];
int cnt[55][55];

int main(){
	cin.sync_with_stdio(false);
  cin>>n;
  rep(i,n){
    cin>>s[i];
    rep(j,s[i].length())cnt[i][s[i][j]-'a']++;
  }
  string res;
  rep(i,27){
    int hoge=INF;
    rep(j,n)minch(hoge,cnt[j][i]);
    rep(j,hoge)res+=('a'+i);
  }
  cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  cin >> n >> m;
  print(n * n - m);
  return 0;
}

Measured memory_bytes: 256
N , T = map(int,input().split())
roots = [list(map(int,input().split())) for _ in range(N)]
min_cost = float("inf")
ans = "TLE"
for key , val in enumerate(roots):
    if val[0] < min_cost and val[1] <= T:
        min_cost = val[0]
        ans = val[0]
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int l[n];
    int i = 0;
    while(i<n){
        cin >> l[i];
        i++;
    }
    sort (l, l + n);
    int count = 0;
    for(int i=n-1; i>=2; i--){
        for(int j=i-1; j>=1; j--){
            if(l[j]==l[i]) continue;

            for(int k=j-1; k>=0; k--){
                if(l[k]==l[j]) continue;
                if(l[i]<l[j]+l[k]) count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#define itrout(x) for(int i=0;i<x.size();i++) {cout << x[i] << (i==x.size()-1 ? "\n" : " ");}
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define debugbit(x, n) cerr << #x << " = " << bitset<n>(x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define debugbit(x, n)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, long long K, std::vector<long long> A){
    ll left = 0, right = 1e9+1;
    while (right - left > 1) {
        ll mid = (right + left) / 2;
        int k = 0;
        rep(i,0,N) {
            k += (A[i]-1) / mid;
        }
        if (k <= K) {
            right = mid;
        } else {
            left = mid;
        }
    }
    cout << right << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, K, std::move(A));
    return 0;
}


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

int func(int x)
{
    if(x%2==0)
    {
        return x/2;
    }
    else
    {
        return 3*x+1;
    }
}
int main()
{
    int n;
    cin>>n;
    int k;
    cin>>k;
    int q;
    cin>>q;
    vector <int> p(n); //ポイント
    for(int i=0;i<n;i++)
    {
        p[i]=k-q; //初期化
    }
    for(int i=0;i<q;i++)
    {
        int ans;
        cin>>ans;
        p[ans-1]++;
    }

    for(int i=0;i<n;i++)
    {
        if(p[i]>0)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)
const long double PI = (acos(-1));

int gcd(int ,int);

int main() {

	int n;
	cin >> n;

	vector<int> a(n);
	rep(i, 0, n) cin >> a[i];
	
	int g = gcd(a[0], a[1]);
	rep(i, 2, n) g = gcd(g, a[i]);

	cout << g << endl;

	return 0;
}

int gcd(int m, int n) {
	ll temp;
	while (m % n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

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

int main(){
    string s;
    cin>>s;
    set<char>f;
    set<char>::iterator ff;
    sort(s.begin(),s.end());
    for(long i=0;i<s.length();i++){
        f.insert(s[i]);
    }
//    long len=f.size();
 //   char sa=s[len-1];
    vector<char>g;
    vector<char>::iterator gg;
    for(char i='a';i<='z';i++){
        g.push_back(i);
    }
    long clock=0;
    gg=g.begin();
    ff=f.begin();
    while(gg!=g.end() && ff!=f.end()){
        if(*gg==*ff){
            clock++;
            gg++,ff++;
        }
        else if(*gg<*ff){
            gg++;
        }
        else ff++;
    }
    if(clock==g.size()) cout<<"None"<<endl;
    else{
        vector<long> z;
        vector<long>::iterator zz;
        vector<long>x;
        vector<long>::iterator xx;
        vector<long> y;
        vector<long>::iterator yy;
        for(ff=f.begin();ff!=f.end();ff++){
            z.push_back(*ff);
        }
      for(gg=g.begin();gg!=g.end();gg++){
          x.push_back(*gg);
      }
      long len=x.size()-z.size();
      for(xx=x.begin(),zz=z.begin();xx!=x.end(),zz!=z.end()+len;xx++,zz++){
        if(*xx!=*zz){
            y.push_back(*xx);
        }
      }
      char sg;
      for(yy=y.begin();yy!=y.end();yy++){
        sg=*yy;
        cout<<sg;
        exit(0);
      }
    }
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int s2i(int s) {
	switch (s) {
		case 'S': return 0;
		case 'H': return 1;
		case 'C': return 2;
		case 'D': return 3;
		default: return 4;
	}
}

int i2s(int i) {
	if (i < 0 || 3 < i) return '?';
	return "SHCD"[i];
}

int main(void) {
	char aru[5][14] = {{0}};
	int asumi_kana, kitamura_eri;
	if (scanf("%d", &asumi_kana) != 1) return 1;
	for (kitamura_eri = 0; kitamura_eri < asumi_kana; kitamura_eri++) {
		char hayami_saori[4];
		int hanazawa_kana;
		if (scanf("%1s%d", hayami_saori, &hanazawa_kana) != 2) return 1;
		if (hanazawa_kana < 1 || 13 < hanazawa_kana) return 1;
		aru[s2i(hayami_saori[0])][hanazawa_kana] = 1;
	}
	for (asumi_kana = 0; asumi_kana < 4; asumi_kana++) {
		for (kitamura_eri = 1; kitamura_eri <= 13; kitamura_eri++) {
			if (!aru[asumi_kana][kitamura_eri]) {
				printf("%c %d\n", i2s(asumi_kana), kitamura_eri);
			}
		}
	}
	return 0;
}




Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin>>n;
  n%=1000;
  if(n!=0){
    cout <<1000-n<<endl;
  }else{
    cout <<0<<endl;
  }
  
}

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

#define endl '\n'
#define int ll
typedef long long ll;

const int MAX_N = 100 + 87;
const int MAX_sum_v = 1e5 + 87;

int w[MAX_N] = {}, v[MAX_N] = {};
int sum_v = 0;
int dp[MAX_sum_v] = {}, dp_new[MAX_sum_v] = {};

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

    int N, W;
    cin >> N >> W;
    for (int i = 1; i <= N; i++) {
        cin >> w[i] >> v[i];
    }

    for (int i = 1; i <= N; i++) {
        sum_v += v[i];
    }
    for (int j = 1; j <= sum_v; j++) {
        dp[j] = 1e15;
    }

    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= sum_v; j++) {
            if (j >= v[i]) {
                dp_new[j] = min(dp[j], dp[j - v[i]] + w[i]);
            } else {
                dp_new[j] = dp[j];
            }
        }
        for (int j = 0; j <= sum_v; j++) {
            dp[j] = dp_new[j];
        }
    }

    for (int j = sum_v; j >= 0; j--) {
        if (dp[j] <= W) {
            cout << j;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
static const int MAX = 1000;

void trace(int A[], int N) {
    int i;
    for (i = 0; i < N; i++) {
        if (i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl;
}

void insertionSort(int A[], int N) {
    int i, j, v;
    for (i = 1; i < N; i++) {
        v = A[i];
        j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        trace(A, N);
    }
}

int main() {
    int A[MAX], N, v;

    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];

    trace(A, N);
    insertionSort(A, N);

    return 0;
}


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

int main()
{
    int n;
    cin >>n;
    int f=0;
    int i;
    int nc=n;

    while(nc>0){
        f+=nc%10;
        nc/=10;
    }

    if(n%f==0){
        puts("Yes");
    }else{
        puts("No");
    }
}

Measured memory_bytes: 764