akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
using ll = long long;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    rep(i,m) cin >> x[i];
    sort(x.begin(),x.end());
    if (m == 1) {
        cout << 0 << endl;
        return 0;
    }
    vector<int> interval(m-1);
    rep(i,m-1) interval[i] = x[i+1] - x[i];
    sort(interval.begin(),interval.end());
    ll ans = 0;
    for (int i = 0; i < m-n; i++) {
        ans += interval[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import sys
input = sys.stdin.readline
N, M = [int(x) for x in input().strip().split()]
A = set([int(input()) for _ in range(M)])
s = [0 for _ in range(N + 1)]
s[0] = 1
if 1 not in A:
  s[1] = 1

for n in range(2, N+1):
  if n in A:
    continue
  else:
    s[n] = s[n-1] + s[n-2]
print(s[-1] % (10 ** 9 + 7))


Measured memory_bytes: 460056
n, y = map(int, input().split())

ans = '-1 -1 -1'

for i in range(n+1):
    for j in range(n-i+1):
        k = n - i - j
        if i*10000 + j*5000 + k*1000 == y:
            ans = str(i) + ' ' + str(j) + ' ' + str(k)

print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
#define N 5005
inline int read(){
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
int n,m,p;
int e_cnt=0,head[N];
int cnt[N],vis[N],dis[N],ok[N],g[N][N],g2[N][N];
queue<int> q;
struct Edge{
	int to,nxt,val;
}edge[N<<2];
void add(int a,int b,int c){
	e_cnt++;
	edge[e_cnt].to=b;
	edge[e_cnt].nxt=head[a];
	edge[e_cnt].val=c;
	head[a]=e_cnt;
}
bool SPFA(int s){
	memset(dis,-0x3f,sizeof(dis));
	dis[s]=0;
	vis[s]=1;
	q.push(s);
	while(!q.empty()){
		int u=q.front();
		q.pop();
		vis[u]=0;
		for(int i=head[u];i;i=edge[i].nxt){
			int v=edge[i].to;
			if(!ok[v])continue;
			if(dis[v]<dis[u]+edge[i].val){
				dis[v]=dis[u]+edge[i].val;
				if(!vis[v]){
					cnt[v]++;
					vis[v]=1;
					q.push(v);
				}
				if(cnt[v]>n){
					return true;
				}
			}
		}
	}
	return false;
}
void dfs(int u){
	if(ok[u])return;
	ok[u]=1;
	for(int i=1;i<=n;i++){
		if(g[u][i]){
			dfs(i);
		}
	}
}
int main(){
	n=read(),m=read();p=read();
	for(int i=1;i<=m;i++){
		int u=read(),v=read(),w=read();
		add(u,v,w-p);
		g[v][u]=1;
	}
	dfs(n);
	if(SPFA(1)){
		cout<<-1<<endl;
	}
	else{
		cout<<max(0,dis[n])<<endl;
	}
	return 0;
}


Measured memory_bytes: 51584
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
int main() {
    int N;
    cin >> N;
    map<string, int>mp;
    rep(i, 0, N){
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }
    long long ans = 0;
    for (auto& s : mp){
        long long Scount = s.second;
        ans += (Scount*(Scount-1))/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll N, Q, K;
vector<pll> adj[100010];
ll dist[100010];

void dfs(ll i, ll d){
    if(dist[i] != -1) return;
    dist[i] = d;
    for(pll p : adj[i]){
        dfs(p.first, d + p.second);
    }
}

signed main(){
    cin >> N;
    ll a, b, c;
    REP(i, N - 1){
        cin >> a >> b >> c;
        a--; b--;
        adj[a].push_back({b, c});
        adj[b].push_back({a, c});
    }
    cin >> Q >> K;
    K--;
    REP(i, N) dist[i] = -1;
    dfs(K, 0);
    REP(i, Q){
        cin >> a >> b;
        a--; b--;
        PRINT(dist[a] + dist[b]);
    }
    return 0;
}

Measured memory_bytes: 14532
#include<iostream>
using namespace std;
int main()
{
    int n, m, l, a[100][100] = { 0 }, b[100][100] = { 0 },s=0;
    long long c[100][100] = { 0 };
    cin >> n >> m >> l;
    for (int i = 0;i<n;i++){
        for (int k = 0;k<m;k++){
            cin >> a[i][k];
        }
    }
    for (int k = 0; k < m; k++){
        for (int j = 0;j < l; j++){
            cin >> b[k][j];
        }
    }
    for (int i = 0;i<n;i++){
        for (int j = 0; j < l; j++){
            for (int k = 0; k<m; k++){
                c[i][j] +=a[i][k]*b[k][j];
            }
        }
    }
    for (int i = 0; i < n; i++){
        for (int j = 0; j < l; j++){
            if (s == 1){
                cout << " ";
            }
            cout << c[i][j];
            s = 1;
        }
        cout << endl;
        s = 0;
    }
    return 0;
}

Measured memory_bytes: 3252
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#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 <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{int to,cost;};
typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)&&islower(c));}
void print(vector<int> v){rep(i,0,v.size()){if(i)cout<<" ";cout<<v[i];}cout<<endl;}
void printl(vector<int> v){rep(i,0,v.size()){cout<<v[i]<<endl;}}


signed main (){
    int a,b;
    cin>>a>>b;
    if(a<=b)cout<<a<<endl;
    else cout<<a-1<<endl;

}
/*
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
 vector<int> vi[maxii];
 vector<int>:: iterator child;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int arr[maxii];
int arr2[maxii];
bool check[maxii];

bool dfs(int node,int c)
{
    check[node]=true;
    arr2[node]=c;
    for(int child=0;child<vi[node].size();child++)
    {
        if(check[vi[node][child]]==false)
        {
            if(dfs(vi[node][child],c^1)==false)
            {
                return false;
            }
        }
        else if(arr2[node]==arr2[vi[node][child]])
        {
            return false;
        }
        //else if()
    }
    return true;
}

int main()
{
    int arrrr[4];
    cin>>arrrr[0]>>arrrr[1]>>arrrr[2];
    sort(arrrr,arrrr+3);
    if(arrrr[0]==5 && arrrr[1]==5 && arrrr[2]==7  )
    {
        printf("YES\n");
    }
    else printf("NO\n");

}

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

int main(){
    int N,K;
    cin >> N >> K;
    
    double n = 1.0/(double)N;
    double A[N - 1];
    for(int i = 1;i <= N;i++){
        int a = 1;
        for(int j = 0;j < K;j++){
            if(a*i < K) a *= 2;
            else break;
        }
        double b = 1.0/(double)a;
        A[i - 1] = n*b;
    }
    
    double ans = 0.0;
    
    for(int i = 0;i < N;i++){
        ans += A[i];
    }
    
    cout << setprecision(11) << ans << endl;
}

Measured memory_bytes: 1024
def main():
    N = int(input())

    W = [""] * N

    for i in range(N):
        W[i] = input()

    set_W = set(W)

    if len(set_W) != N:
        print('No')
        exit()

    for i in range(N-1):
        if W[i][len(W[i]) - 1] != W[i+1][0]:
            print('No')
            exit()

    print('Yes')


main()

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

int main(){
  int count=0;
  long N;
  cin>>N;
  vector<pair<int,int>>a(N);
  rep(i,N){
    cin>>a[i].first;
    a[i].second=i+1;
  }
  sort(a.begin(),a.end());
    rep(i,N){
    cout<<a[i].second<<" ";
  }
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
    VECCIN(head);
    VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
    seco[head]=IN();
    VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair
 
int main(){
    /*
    CIN(n,m);VC2(x,y,z,n);
 
    vector<V> dp(n+1,V(0,-LINF));
 
    REP(i,n){
 
    }
    */
   CIN(a,b);
   if(a<b)swap(a,b);
 
 
    bool flag = !(a > 8);
    COUT((flag?"Yay!":":("));
    
 
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

    string s;
    cin >> s;
    int ans = s.size();
    for (char c = 'a'; c <= 'z'; ++c) {
        vector <int> pos;
        for (int i = 0; i < s.size(); ++i) {
            if (s[i] == c)
                pos.app(i);
        }   
        if (pos.empty())
            continue;
        int nn = 0;
        nn = max(nn, pos[0]);
        nn = max(nn, (int)s.size() - pos.back() - 1);
        for (int i = 0; i + 1 < pos.size(); ++i)    
            nn = max(nn, (pos[i + 1] - pos[i] - 1));
        ans = min(ans, nn);
    }
    cout << ans << endl;

}

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

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> a(M), c(M);
    for(int i = 0; i < M; i++) {
        int b;
        cin >> a[i] >> b;
        int d = 0;
        for(int j=0; j < b; j++){
            int k;
            cin >> k;
            d += (1 << (k-1));
        }
        c[i] = d;

    }

    vector<int> dp(1 << N ,1e9);
    dp[0] = 0;
    rep(i,M){
        rep(j,dp.size()){
            int num = j|c[i];
            if(dp[num] > dp[j] + a[i])
                dp[num] = dp[j] + a[i];            
        }
    }
    if(dp[(1 << N) - 1] == 1e9)cout << -1 <<endl;
    else cout << dp[(1 << N) - 1] << endl;
}

Measured memory_bytes: 256
n = int(input())
A = map(int, input().split())
q = int(input())
BC = [None for i in range(q)]
for i in range(q):
    b,c = map(int, input().split())
    BC[i] = (b,c)

count = [0 for i in range(10**5+2)]
for a in A:
    count[a]+=1

ans = 0
for i in range(10**5+2):
    ans+=(i*count[i])

for i in BC:
    ans+=count[i[0]]*(i[1]-i[0])
    count[i[1]]+=count[i[0]]
    count[i[0]]=0
    print(ans)


Measured memory_bytes: 31504
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {


    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        String word1= s.next(),word2=s.next(),word3=s.next();
        Queue<Character>q1 = new ArrayDeque<>();
        Queue<Character>q2 = new ArrayDeque<>();
        Queue<Character>q3 = new ArrayDeque<>();
        for(int i=0;i<word1.length();i++)q1.add(word1.charAt(i));
        for(int i=0;i<word2.length();i++)q2.add(word2.charAt(i));
        for(int i=0;i<word3.length();i++)q3.add(word3.charAt(i));
        char  g = 'a';
        while(true){
            if(g=='a'){
                if(q1.isEmpty()){
                    System.out.println('A');
                    break;
                }
                else{
                    g = q1.poll();
                }
            }
            else if(g=='b'){
                if(q2.isEmpty()){
                    System.out.println('B');
                    break;
                }
                else{
                    g = q2.poll();
                }
            }
            else{
                if(q3.isEmpty()){
                    System.out.println('C');
                    break;
                }
                else{
                    g = q3.poll();
                }
            }
        }




    }

}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

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

int main() {
  int N;
  cin >> N;
  set<int> S;
  for (int i = 0; i < N; i++) {
    int d;
    cin >> d;
    S.insert(d);
  }
  cout << S.size() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll n;
    cin>>n;
    vector<ll>a(n);
    rep(0,i,n)cin>>a[i];
    sort(a.begin(),a.end());
    cout<<a[n/2]-a[n/2-1];
}


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

int main(){
    int n,x,y,temp,ans;
    cin >> n >> x >> y;
    int distance;
    int dist[n];
    for(int i = 0; i < n; i++){
        dist[i] = 0;
    }
    int count = 0;
    for(int i = 1; i < n; i++){
        for(int j = i+1; j <= n; j++){
            distance = (int)min({j-i, abs(y-j) + 1 + abs(x-i), abs(y-i) + 1 + abs(x-j)});
            //if(distance == k) count++;
            dist[distance] += 1;
        }
    }
    for(int i = 1; i < n; i++){
        cout << dist[i] << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#include<iomanip>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;


struct edge
{
    ll to;
    ll cost;
};

int main()
{
    ll k,n;
    cin>>k>>n;
    vector<ll> a(n);
    vector<ll> e(n);
    rep(i,n)
    {
        cin>>a[i];
    }
    rep(i,n-1)
    {
        e[i]=a[i+1]-a[i];
    }
    e[n-1]=a[0]+k-a[n-1];
    sort(e.begin(),e.end());
    ll ans=0;
    for(ll i=0;i<n-1;i++)
    {
        ans+=e[i];
    }
    cout<<ans;
}

Measured memory_bytes: 3456
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}



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

	vector<string> a(2);

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

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

	cout << a[0] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main()	{
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n) cin>>a[i];
  sort(a.begin(),a.end());
  rep(i,n-1){
    if(a[i]==a[i+1]){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repp(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

signed main(){
    int n;
    vector<int> d;
    rep(i, 1, 1111) rep(j, 1, 1111){
        d. push_back(i*i*i + j*j*j);
    }
    sort(all(d));
    while(cin >> n, n){
        int z3 = n*n*n;
        int ind = upper_bound(all(d), z3) - 1 - d.begin();
        cout << z3 - d[ind] << endl;
    }
}

Measured memory_bytes: 19080
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
    long long n, ans;
    while(~scanf("%lld",&n))
    {
        ans = (n/11)*2;
        n = n%11;
        if(n>6) ans +=2 ;
        //if(n == 0) ;
        if(n>0 && n <=6) ans++;
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vi>;

string s, t;
vvi dp;

string dfs(int i, int j){
    if(i == 0) return "";
    if(dp[i][j] == dp[i-1][j]) {
        return dfs(i-1, j);
    }
    if(dp[i][j] == dp[i][j-1]) {
        return dfs(i, j-1);
    }
    return dfs(i-1, j-1) + t[j-1];
}

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

    int nums = s.size(), numt = t.size();

    dp.assign(nums+1, vi(numt+1));
    rep(i, nums) {
        rep(j, numt) {
            if(s[i] == t[j]) {
                dp[i+1][j+1] = dp[i][j]+1;
            }
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1]);
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j]);
        }
    }

    cout << dfs(nums, numt) << endl;
}

Measured memory_bytes: 35968
import math.max
object Main extends App {
    val Array(a,b,c,x,y) = io.StdIn.readLine.split(" ").map(_.toInt)

    val c_up_limit = max(2*x, 2*y)
    
    val prices = for {
        countC <- 0 to c_up_limit by 2

        val countA = max(0, x-countC/2)
        val countB = max(0, y-countC/2)

    } yield countA*a + countB*b + countC*c

    val result = prices.min
    println(result)
}

Measured memory_bytes: 58648
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
    char a[2][3];
  cin>>a[0][0]>>a[0][1]>>a[0][2];
  cin>>a[1][0]>>a[1][1]>>a[1][2];
  if(a[0][0]==a[1][2]&&a[0][1]==a[1][1]&&a[1][0]==a[0][2]){
    cout<<"YES";
  }else{
cout<<"NO";
  }
    return 0;
}


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

#define S_MAX 100000

int main(void)
{
	int i;
	char tmp[S_MAX+2];

	fgets(tmp, S_MAX+2, stdin);
	tmp[strlen(tmp)-1] = '\0';

	i = 0;
	while(1) {
		if(tmp[i] == '\0') break;
		if(i % 2 == 0) printf("%c", tmp[i]);
		i++;
	}

	printf("\n");

	return 0;
}


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

int main() {
  int X,Y,A,B,C; cin>>X>>Y>>A>>B>>C;
  vector<ll> p(A),q(B),r(C);
  rep(i, A) cin>>p[i];
  rep(i, B) cin>>q[i];
  rep(i, C) cin>>r[i];

  priority_queue<pair<ll, int> > que;
  rep(i, A) que.push(make_pair(p[i], 0));
  rep(i, B) que.push(make_pair(q[i], 1));
  rep(i, C) que.push(make_pair(r[i], 2));

  ll res=0;
  int xcnt=0;
  int ycnt=0;
  int zcnt=0;
  while (1) {
    if ((xcnt+ycnt+zcnt)==(X+Y)) break;
    pair<ll, int> tmp=que.top();
    que.pop();
    int num=tmp.second;
    if ((num==0)&&(xcnt==X)) continue;
    if ((num==1)&&(ycnt==Y)) continue;
    res+=tmp.first;
    if (num==0) xcnt++;
    else if (num==1) ycnt++;
    else zcnt++;
  }
  cout<<res<<endl;
}


Measured memory_bytes: 12652
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        var n = int.Parse(RL());
        var h = int.Parse(RL());
        var w = int.Parse(RL());

        var count = 0;
        for (int i = 0; i < n - h + 1; i++)
        {
            for (int j = 0; j < n - w + 1; j++)
            {
                count++;
            }
        }

        Console.WriteLine(count);
    }

    static string RL()
    {
        return Console.ReadLine();
    }

    static void WL(string str)
    {
        Console.WriteLine(str);
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main(){
	int N;
	cin >> N;
	int mochi[N];
	for(int i = 0; i < N; i++){
		cin >> mochi[i];
	}
	for(int i = N-1; i >= 0; i--){
		for(int j = 0; j < i; j++){
			if(mochi[j] > mochi[j+1]){
				int tmp = mochi[j];
				mochi[j] = mochi[j+1];
				mochi[j+1] = tmp;
			}
		}
	}
	int tmp = mochi[0];
	int cnt = 1;
	for(int i = 1; i < N; i++){
		if(mochi[i] != tmp){
			cnt++;
			tmp = mochi[i];
		}
	}
	cout << cnt << "\n";
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::cmp::{max, min, Ordering};

struct Input {
    data: Vec<String>,
}

impl Input {
    pub fn new() -> Input {
        Input{data: Vec::new()}
    }

    fn read(&mut self) {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        self.data = line.split_whitespace().rev().map(|s| s.parse::<String>().unwrap()).collect::<Vec<_>>();
    }

    pub fn get<T: core::str::FromStr>(&mut self) -> T {
        if self.data.len() == 0 {
            self.read();
        }
        return self.data.pop().unwrap().parse::<T>().ok().unwrap();
    }
}

impl<T: core::str::FromStr> std::ops::Shr<&mut T> for Input {
    type Output = Input;

    fn shr(mut self, rhs: &mut T) -> Input {
        *rhs = self.get::<T>();
        return self;
    }
}

fn main() {
    let mut cin = Input::new();

    let (N, M) = (cin.get::<i32>(), cin.get::<usize>());

    let mut A = vec![0; M];

    for i in 0..M {
        cin = cin >> &mut A[i];
    }

    let mut S = 0;
    for a in A {
        S += a;
    }

    let ans = max(-1, N - S);
    println!("{}", ans);
}


Measured memory_bytes: 2568
from collections import deque

s = input()
q = int(input())

reverse = False
count = 0
mae = deque()
ushiro = deque()
for i in range(q):
    qu = input()
    if qu[0] == "1":
        count += 1
        if reverse:
            reverse = False
        else:
            reverse = True
    else:
        _, f, c = qu.split()
        if reverse:
            if f == "1":
                ushiro.append(c)
            else:
                mae.appendleft(c)
        else:
            if f == "1":
                mae.appendleft(c)
            else:
                ushiro.append(c)

s = "".join(mae) + s + "".join(ushiro)

if count % 2:
    print(s[::-1])
else:
    print(s)


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  ll b=mod, u=1, v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a, b);
    u-=t*v; swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  string S;
  cin >> S;
  ll cnt = 0;
  rep(i, S.size()){
    cnt = mod(cnt + (ll)(S[i]-'0'), 9);
  }

  if(cnt==0){
    cout << "Yes";
  }else{
    cout << "No";
  }
  
  return 0;

}


Measured memory_bytes: 3748
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        n: usize,
        v: [usize;n],
    }

    let mut v_tmp: Vec<usize> = Vec::new();
    for i in 0..n {
        v_tmp.push(v[i]);
    }

    v_tmp.sort();
    let mut ave: f64 = v_tmp[0] as f64;
    for i in 1..n {
        ave = (ave + v_tmp[i] as f64) / 2.0;
    }

    println!("{}", ave);

}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define DISP1(as)		for(auto it : as) cout<<it.f<<" "<<it.s<<") ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	2e+5 + 99;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, k, l, q, x, y;
string s;
ll prime[200];

ll dp[100][100][2600];

// < ----------- func eh ---------------- ? //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> x;
	vll a(n + 1);
	for (ll i = 1; i <= n; i++) cin >> a[i];
/*
	for (ll j = 0; j <= n; j++) {
		for (ll k = 0; k <= 2500; k++) {
			dp[0][j][k] = 1;
		}
	}*/
		dp[0][0][0] = 1;
	dline;
	for (ll i = 1; i <= n; i++) {
		for (ll j = 0; j <= n; j++) {
			for (ll k = 0; k <= 2500; k++) {
				dp[i][j][k] = (dp[i - 1][j][k]) ; 
				if (i && j && k - a[i] >= 0) {
					dp[i][j][k] += (dp[i - 1][j - 1][k - a[i]]);
				}

				//deb3(i, j, k);
				//deb1(dp[i][j][k]);
			}
		}
	}
	dline;
	ll ans = 0;
	for (ll t = 1; t <= n; t++) {
		ans += dp[n][t][x * t];
		deb3(n,t,x*t);
		deb1(dp[n][t][x*t]);
	}

	cout << ans;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


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

int main()
{
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  while (true)
  {
    C -= B;
    if (A <= 0)
    {
      cout << "No";
      break;
    }
    A -= D;
    if (C <= 0)
    {
      cout << "Yes";
      break;
    }
  }
  cout << endl;
}


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

static const int MAX = 100000;
vector<int> adjGraph[MAX];
list<int> ans;
bool check[MAX];
int N;
int indeg[MAX];

void bfs(int start){
  queue<int> que;
  que.push(start);
  check[start] = true;
  while(!que.empty()){
    int u = que.front(); 
    que.pop();
    ans.push_back(u);
    rep(i,adjGraph[u].size()){
      int v = adjGraph[u][i];
      indeg[v]--;
      if(indeg[v] == 0 && !check[v]){
        que.push(v);
        check[v] = true;
      }
    }
  }
}

void tpSort(){
  rep(i,N) indeg[i] = 0;
  rep(u,N){
    rep(i,adjGraph[u].size()){
      int v = adjGraph[u][i];
      indeg[v]++;
    }
  }
  
  rep(u,N){
    if(indeg[u] == 0 && !check[u])bfs(u);
  }
  for(auto itr = ans.begin();itr != ans.end(); itr++){
    cout << *itr << endl;
  }
  
}


int main(){

  int s,t ,M;
  cin >> N >> M;

  rep(i,N) check[i] = false;

  rep(i,M){
    cin >> s >> t;
    adjGraph[s].push_back(t);
  }
  tpSort();

  return 0;
}


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

const int maxN = 3010;

int n;
double p[maxN], f[maxN][maxN], ans = 0;

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
        cin >> p[i];
    f[0][0] = 1;
    for (int i = 1; i <= n; ++i)
    {
        f[i][0] = f[i - 1][0]*(1 - p[i]);
        for (int j = 1; j <= n; ++j)
            f[i][j] = f[i - 1][j]*(1 - p[i]) + f[i - 1][j - 1]*p[i];
    }
    for (int i = (n >> 1) + 1; i <= n; ++i)
        ans += f[n][i];
    printf("%.10f", ans);
}

Measured memory_bytes: 70784
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

int main()
{
	int i, j, count=0, max=0, x, y, size, p[14][14] = {0};

	while(scanf("%d,%d,%d",&x,&y,&size) != EOF){
		if(size == 1){
			p[x+2][y+1]++;
			p[x+1][y+2]++;
			p[x+2][y+2]++;
			p[x+3][y+2]++;
			p[x+2][y+3]++;
		} else if(size == 2){
			for(i=x+1; i<=x+3; i++){
				for(j=y+1; j<=y+3; j++){
					p[i][j]++;
				}
			}
		} else if(size == 3){
			for(i=x+1; i<=x+3; i++){
				for(j=y+1; j<=y+3; j++){
					p[i][j]++;
				}
			}
			p[x+2][y]++;
			p[x][y+2]++;
			p[x+4][y+2]++;
			p[x+2][y+4]++;
		}

	}

	for(i=2; i<=11; i++){
		for(j=2; j<=11; j++){
			if(p[j][i] == 0)
				count++;
			if(p[j][i] > max)
				max = p[j][i];
		}
	}
	printf("%d\n%d\n", count, max);

	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int64_t gcd(int64_t x,int64_t y){
    if(x%y==0) return y;
    return gcd(y,x%y);
}

int64_t lcm(int64_t x, int64_t y){
    return x/gcd(x,y)*y;
}

int64_t CntMulti(int64_t x, int64_t a, int64_t b){
    int64_t val=x;
    val-=x/a+x/b;
    val+=x/lcm(a,b);

    return val;
}

int main(){
    int64_t A,B,C,D; cin>>A>>B>>C>>D;

    int64_t ans=CntMulti(B,C,D)-CntMulti(A-1,C,D);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

int a,b,c,d[100005] = {},n,m;
string s,t;

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

    P(min(n*a, b));

    
    return  0;
}


Measured memory_bytes: 256
N = int(input())
S = [input() for i in range(N)]

def check(A, B):
    for i in range(N):
        for j in range(i+1, N):
            if S[(A+i)%N][(B+j)%N] != S[(A+j)%N][(B+i)%N]:
                return 0
    return 1

ans = 0
for i in range(N):
    ans += N*check(0, i)
print(ans)


Measured memory_bytes: 41072
n, m = map(int, input().split())
counter = [0, 0]
ac = [False] * n
wa = [0] * n
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if ac[p] == True:
        continue
    if s == 'AC':
        ac[p] = True
    else:
        if not ac[p]:
            wa[p] += 1
for i in range(len(ac)):
    if ac[i]:
        counter[0] += 1
        counter[1] += wa[i]

print(counter[0], counter[1])

Measured memory_bytes: 45528
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main() {
  vector<ll> a(5);
  ll n,min = 0;
  cin >> n;
  rep(i,5) cin >> a[i];
  sort(all(a));
  min = a[0];
  ll ans = (n+min-1)/min + 4;
  cout << ans << endl;
  return 0;
}

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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<lint> v(3);
    cin>>v[0]>>v[1]>>v[2];
    sort(all(v));
    lint ans;
    if((v[0]*v[1]*v[2])%2==0) ans = 0;
    else ans = v[0]*v[1];
    print(ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		int[] a = new int[N + 1];
		int max = 0;
		int max_i = 0;
		for (int i = 1; i <= N; i++) {
			a[i] = sc.nextInt();
			if (i >= 2) {
				if (a[i - 1] + a[i] > max) {
					max = a[i - 1] + a[i];
					max_i = i - 1;
				}
			}
		}

		if (max < L) {
			System.out.println("Impossible");
		} else {
			System.out.println("Possible");
			StringBuffer buf = new StringBuffer();
			for (int i = 1; i < max_i; i++) {
				buf.append(i + "\n");
			}
			for (int i = N - 1; i >= max_i; i--) {
				buf.append(i + "\n");
			}
			System.out.println(buf.toString());
		}
	}
}


Measured memory_bytes: 26024
//(・ω・)
#include <stdio.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, atoi
#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
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
#include <sstream> //istringstream
#include <stdlib.h>
#include <list>
#include <iterator>//std::advance()
using namespace std;
int main(){
    vector<int> a(3);
    for(int i=0; i<3; i++) cin >> a[i];
    sort(a.begin(),a.end());
    cout  << a[0] << ' ' << a[1] << ' ' << a[2] << endl;
}



Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std;
const int N=100100;
char a[101];
int zpyz[N];
int ans;
int main()
{//YAKI
	cin>>a;
	if(a[0]=='Y'&&a[1]=='A'&&a[2]=='K'&&a[3]=='I') cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  vector<int>a(26,0);
  for(int i=0;i<s.size();i++){
    a[s[i]-'a']++;
  }
  bool f=true;
  for(int i=0;i<26;i++){
    if(a[i]%2!=0)f=false;
  }
  if(f) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <vector>
#define llint long long
#define mod 1000000007

using namespace std;

llint n, m;
vector<llint> G[55];
llint s[25], t[25];
llint lca[25];
llint dif[55], sum[55];
int Prev[55][7];
int depth[55];

void predfs(int v, int p, int d)
{
	depth[v] = d;
	Prev[v][0] = p;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		predfs(G[v][i], v, d+1);
	}
}

int getLCA(int u, int v){
	int x = u, y = v;
	if(depth[y] > depth[x]) swap(x, y);
	
	for(int i = 6; i >= 0; i--){
		if(depth[x] - (1<<i) >= depth[y]) x = Prev[x][i];
	}
	if(x == y) return x;
	for(int i = 6; i >= 0; i--){
		if(Prev[x][i] != Prev[y][i]){
			x = Prev[x][i];
			y = Prev[y][i];
		}
	}
	x = Prev[x][0];
	return x;
}

llint dfs(llint v, llint p)
{
	sum[v] = dif[v];
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		sum[v] += dfs(G[v][i], v);
	}
	return sum[v];
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	llint u, v;
	for(int i = 1; i <= n-1; i++){
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	cin >> m;
	for(int i = 0; i < m; i++) cin >> s[i] >> t[i];
	
	predfs(1, 0, 0);
	for(int i = 1; i < 7; i++){
		for(int j = 1; j <= n; j++){
			Prev[j][i] = Prev[Prev[j][i-1]][i-1];
		}
	}
	for(int i = 0; i < m; i++) lca[i] = getLCA(s[i], t[i]);
	
	llint ans = 0, M = 1 << m;
	for(int i = 0; i < M; i++){
		for(int j = 1; j <= n; j++) dif[j] = 0;
		llint pop = 0;
		for(int j = 0; j < m; j++){
			if((i & (1<<j)) == 0) continue;
			pop++;
			dif[s[j]]++, dif[t[j]]++, dif[lca[j]]-=2;
		}
		dfs(1, -1);
		llint cnt = 0;
		for(int i = 2; i <= n; i++){
			if(sum[i] > 0) cnt++;
		}
		cnt = n-1 - cnt;
		if(pop%2) ans -= 1LL<<cnt;
		else ans += 1LL<<cnt;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256