akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;

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

	ll A, B, C, K;
	cin >> A >> B >> C >> K;

	ll k = 0;

	while (A >= B)
	{
		B *= 2;
		++k;
	}

	while (B >= C)
	{
		C *= 2;
		++k;
	}

	if (k <= K)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3612
import sys
sys.setrecursionlimit(10 ** 7)

MOD = 10 ** 9 + 7

N = int(input())

A = [tuple(map(int, input().split())) for _ in range(N)]

dp = [-1] * (1 << N)
dp[(1 << N) - 1] = 1

def dfs(group, count):
    if dp[group] != -1:
        return dp[group]
    res = 0
    for i in range(N):
        if (group >> i) & 1 == 0 and A[count][i] == 1:
            res += dfs(group + (1 << i), count + 1)
    dp[group] = res % MOD
    return dp[group]

tmp = dfs(0, 0)

print (tmp)

Measured memory_bytes: 63964
from collections import defaultdict
from math import gcd
nums = defaultdict(int)
for _ in range(int(input())):
  nums[gcd(round(float(input())*(10**9)),10**18)] += 1
nums = tuple(nums.items())
ans = 0
for i, (a,b) in enumerate(nums):
  if a*a%(10**18) == 0:
    ans += b*(b-1)//2
  for (c,d) in nums[i+1:]:
    if a*c%(10**18) == 0:
      ans += b*d
print(ans)

Measured memory_bytes: 75468
import math
n=int(input())
a=list(map(int,input().split(' ')))
l={}
fl={}
for i in a:
  l[i]=l.get(i,0)+1
  fl[i]=(l.get(i,0)*(l.get(i,0)-1))//2
s=sum(fl.values())
for i in a:
  buf = (l[i]-1)*(l[i]-2)//2
  print(s-fl[i]+buf)

Measured memory_bytes: 96084
using System;

class Problem {
    public static void Main() {
        var str = Console.ReadLine();
        foreach (var c in str)
            Console.Write(char.IsLower(c) ? char.ToUpper(c) :
                          char.IsUpper(c) ? char.ToLower(c) : c);
        Console.WriteLine();
    }
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	int n, k, ans = 0;
	cin >> n >> k;
	vector<int> a(n + 1, 0);
	for (int i = 1; i <= k; ++i) {
		int d; cin >> d;
		for (int j = 0; j < d; ++j) {
			int x; cin >> x;
			a[x]++;
		}
	}
	for (int i = 1; i <= n; ++i)
		if (!a[i])
			++ans;
	cout << ans;
}

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

void Main()
{
    int64_t N;
    cin >> N;
    
    vector<uint64_t> A(N);
    for(int64_t i = 0; i < N; ++i)
    {
        cin >> A[i];
        if(A[i] == 0)
        {
            cout << 0 << endl;
            return;
        }
    }

    uint64_t result = 1;
    for(int64_t i = 0; i < N; ++i)
    {
        uint64_t threashold = 1000000000000000000 / A[i];
        if(result > threashold)
        {
            cout << -1 << endl;
            return;
        }
        result *= A[i];
    }

    cout << result << endl;
}

int main()
{
    Main();
}


Measured memory_bytes: 3984
import heapq
N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
    a,b,c = map(int,input().split())
    edges[a].append((b,c))
    edges[b].append((a,c))
Q,K = map(int,input().split())

INF = 10**9 * N
distance = [INF for _ in range(N+1)]
distance[K] = 0
settled = set()
h = [(0,K)]
while len(h) > 0:
    d,v = heapq.heappop(h)
    if v in settled:
        continue
    settled.add(v)
    distance[v] = d
    for (w,a) in edges[v]:
        if distance[v] + a < distance[w]:
            distance[w] = distance[v] + a
            heapq.heappush(h,(distance[w],w))

for _ in range(Q):
    x,y = map(int,input().split())
    ans = distance[x] + distance[y]
    print(ans)

Measured memory_bytes: 51464
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n, mod = 1e9+7;
    cin >> n;
    ll p = 1;
    fore(i,1,n+1) {
        p = (p*i) % mod;
    }
    cout << p << endl;
}


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

#define INF 1e9 + 5

int frog2BU(vector<int> ar,int n, int k) {
    vector<int> dp(n+1);
    dp[0] = 0;
    dp[1] = 0;
    for(int i = 2; i <= n; i++) {
        dp[i] = INF;
        for(int j = i - 1;j >=1 && (i-j)<=k; j--) {
            dp[i] = min(dp[i], abs(ar[j] - ar[i]) + dp[j]);
        }
    }
    return dp[n];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int> ar(n+1);
    
    for(int i= 1; i <= n; i++) cin>>ar[i];

    cout<<frog2BU(ar,n,k)<<"\n";
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m,p;
	cin>>n>>m>>p;
	vector<vector<pll>> edge(n);
	vi sl(n,0);
	rep(i,m){
		ll a,b,c;
		cin>>a>>b>>c;
		a--; b--; c-=p; c=-c;
		// if(a==b and c<0){
		// 	sl[a]=1;
		// }else{
			edge[a].emplace_back(b,c);
		// }
	}
	// deque<pll> pq;
	// vb isvisit(n,false);
	// vl isV(n,0);
	// pq.emplace_back(0,sl[0]);
	// while(!pq.empty()){
	// 	ll p,c; tie(p,c)=pq.front();
	// 	pq.pop_front();
	// 	if(isvisit[p])continue;
	// 	isvisit[p]=true;
	// 	isV[p]=c;
	// 	for(auto&e:edge[p]){
	// 		if(!isvisit[e.fs]){
	// 			if(c+sl[e.fs]>0){
	// 				pq.emplace_front(e.fs,c+sl[e.fs]);
	// 			}else pq.emplace_back(e.fs,c+sl[e.fs]);
	// 		}
	// 	}
	// }
	// if(isV[n-1]){
	// 	puta(-1);
	// 	return 0;
	// }

	vl ans(n,LINF);
	ans[0]=0;
	rep(i,n*3){
		rep(cur,n)for(auto&e:edge[cur]){
			ll nxt,cst; tie(nxt,cst)=e;
			if(ans[nxt]>ans[cur]+cst){
				ans[nxt]=ans[cur]+cst;
				if(i>=n-1 and nxt==n-1){
					puta(-1);
					return 0;
				}
			}
		}
	}
	puta(max(0,-ans[n-1]));
	return 0;
}

Measured memory_bytes: 552
#include <bits/stdc++.h>
// #include "ane.cpp"

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 100005;
const int MMAX = 100005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
#define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> lp;
typedef pair<ll, ll> llp;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  int to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{       \
  printf("%s: ", #v);         \
  for (int i = 0; i < (c); ++i) \
  {                           \
  cout << (v)[i] << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


ll N,M,K,A[NMAX],B,C,D,E;
bool dp[8] = {};

string S;
vec v;

ll ans = {};

void solve(){
  // main algorithm
  for (int i = 0; i < N ; ++i)
  {
    if(A[i] >= 3200) C++;
    else dp[(int)A[i] / 400] = true;
  }

  for(int i = 0; i < 8; i++) ans += dp[i];

  if(ans) {
    cout << ans << " " << ans + C << endl;
  }
  else {
    cout << 1 << " " <<  C << endl;
  }
}
void debug(){
  // output debug information

}
void answer(){
  // output answer
  // cout << ans << endl;
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  cin >> N;
  for (int i = 0; i < N; ++i)
  {
    scanf("%lld", &A[i]);
  }
  solve();
  #ifdef DEBUG
  debug();
  #endif
  answer();

  return 0;
}

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,ans;
    cin >> n;
    if(n%2==0) ans=n/2;
    else ans = n/2+1; 
    cout << ans << "\n";
    
}    


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

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

  int x = n;
  int s = 0;
  while (x/10 != 0) {
    s += x%10;
    x /= 10;
  }

  if (n%(s+x) == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
    int n;
    cin >> n;
    int zero = 0;
    vector<int> num(n);
    vector<int> cnt(n + 1);
    mint ans = 1;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        num[a]++;
        cnt[a]++;
        if(a == 0){
            zero++;
            continue;
        }
        ans *= num[a-1];
        num[a-1]--;
    }
    for(int i = 0; i < n; i++){
        if(cnt[i] >= 4 || cnt[i] < cnt[i+1]){
            cout << 0 << endl;
            return 0;
        }
    }
    if(zero == 3) ans *= 6;
    if(zero == 2) ans *= 6;
    if(zero == 1) ans *= 3;
    cout << ans << endl;
}


Measured memory_bytes: 4016
#include <iostream>
#include <bits/stdc++.h>
#define ll long long int

using namespace std;

int main() {
    int n;
    cin>>n;
    int arr[n];
    for(int i = 0; i < n; i++) cin>>arr[i];
    int ans = 0, curMax = 0;
    int i = 0, j = 0;
    for(int i = 0; i < n - 1; i++)
    {
        if(arr[i] >= arr[i + 1])
            curMax++;
        else curMax = 0;
        ans = max(curMax, ans);
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
#pragma GCC optimize(2,3,"Ofast","unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define in inline
namespace fast_io
{
	char buf[1<<12],*p1=buf,*p2=buf,sr[1<<23],z[23],nc;int C=-1,Z=0,Bi=0,ny;
	in char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
	in ll read()
	{
		ll x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;Bi=1;if(nc<0)return nc;
		x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48),Bi++;return x*ny;
	}
	in db gf() {int a=read(),y=ny,b=(nc!='.')?0:read();return (b?a+(db)b/pow(10,Bi)*y:a);}
	in int gs(char *s) {char c,*t=s;while(c=gc(),c<=32);*s++=c;while(c=gc(),c>32)*s++=c;return s-t;}
	in void ot() {fwrite(sr,1,C+1,stdout);C=-1;}
	in void flush() {if(C>1<<22) ot();}
	template <typename T>
	in void write(T x,char t)
	{
		int y=0;if(x<0)y=1,x=-x;while(z[++Z]=x%10+48,x/=10);
		if(y)z[++Z]='-';while(sr[++C]=z[Z],--Z);sr[++C]=t;flush();
	}
	in void write(char *s) {int l=strlen(s);for(int i=0;i<l;i++)sr[++C]=*s++;sr[++C]='\n';flush();}
};
using namespace fast_io;
#define pb push_back
int main()
{
	int a;cin>>a;
	cout<<a+a*a+a*a*a<<endl;
	return ot(),0;
}
//Author: disangan233

Measured memory_bytes: 3636
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=1)
if a[0]!=a[1]:
  print("Impossible")
  exit()
m=[0]*n
for i in range(1,a[0]):m[max(i,a[0]-i)]+=1
for i in a:m[i]-=1
for i in m:
  if i>0:print("Impossible");exit()
if m[0--a[0]//2]!=0 and a[0]>1:print("Impossible");exit()
print("Possible")

Measured memory_bytes: 3064
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define repr(i, n, a) for (int i = (n)-1; i >= (a); i--)
#define repit(it, v) for (auto(it) = (v).begin(); (it) != (v).end(); (it)++)
#define sortt(v) sort((v).begin(), (v).end())
#define sortr(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vi>
#define vvvi vector<vvi>
#define co(x) cout << (x)
#define con(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define mkp make_pair
#define mkt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
// inline void fastio() { ios::sync_with_stdio(false), cin.tie(0); }
/******* Variable ************************************/
const int maxn = 1e6 * 50;
const int inf = 1e9 + 7;
const double pi = 3.141592653589;
/******* Function ************************************/
int SumOfNum(string s) {
  int sum = 0;
  for (char c : s) sum += c - '0';
  return sum;
}
/******* Main ****************************************/
void Main() {
  string s;
  int ans[30] = {};
  while (getline(cin, s)) {
    for (auto c : s) {
      if (isupper(c)) ans[c - 'A']++;
      if (islower(c)) ans[c - 'a']++;
    }
  }
  rep(i, 0, 26) {
    cout << (char)(i + 'a') << " : " << ans[i] << '\n';
  }
}

/******************************************************
  Smaile!
▕▔╲┊┊┊┊┊┊┊┊┊╱▔▏
┊╲┈╲╱▔▔▔▔▔╲╱┈╱┊
┊┊╲┈╭╮┈┈┈╭╮┈╱┊┊
┊┊╱┈╰╯┈▂┈╰╯┈╲┊┊
┊┊▏╭╮▕━┻━▏╭╮▕┊┊
┊┊╲╰╯┈╲▂╱┈╰╯╱
                      How`s it going?
                              |＼
                      　／￣＼　ヽ
                      ／　　　ヽ |_
                      ￣＼　　　　 ＼
                      ／￣　/|/| /ﾚ､ ヽ＿
                      ￣＼ Yヘ |/ヘ幺　∠
                      　＜_|(･> <･) 6) ／
                      　　 (ﾞ　_　ﾞ／＜
                      　　　＞､ーイ￣￣
                      　　／厂ヽ／￣/＼
                      　 ( ｜　(亀)(>　)▏

                            Take a rest before getting tired!
                                        　　 ●
                                        　　/⌒ヽ
                                        　 ｜ 　|/⌒ヽ(ヽ
                                        　 (｀　∥ー⌒) |
                                        　|￣||￣￣￣￣￣|
                                        　|―||―――――|
                                        　|　Ｕ　　　　　|
                                        　|￣￣￣￣￣￣￣|
                                        　|＿＿＿＿＿＿＿|
                                        　　|―――――|
                                        　　|―――――|
                                        ｗｗＷｗｗＷｗＷＷｗ

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


Measured memory_bytes: 3208
N = int(input())
D, X = list(map(int, input().split()))
A = []
for i in range(N):
    a = int(input())
    A.append(a)

cnt = 0
for i in range(N):
    a = A[i]
    j = 0
    while(True):
        if (j*a+1) <= D:
            cnt += 1
        else:
            break
        j += 1
print(cnt + X)


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

int main(void)
{
	int i, j;
	int a[4], b[4];
	char stra[5], strb[5];
	int hit, blow;
	
	while (1){
		scanf("%s", stra);
		getchar();
		scanf("%s", strb);
		getchar();
		if (strlen(stra) == 1){
			break;
		}
		
		for (i = 0; i < 4; i++){
			a[i] = stra[i] - '0';
			b[i] = strb[i] - '0';
		}
		
		hit = blow = 0;
		for (i = 0; i < 4; i++){
			for (j = 0; j < 4; j++){
				if (a[i] == b[j]){
					if (i == j){
						hit++;
					}
					else {
						blow++;
					}
				}
			}
		}
		
		printf("%d %d\n", hit, blow);
	}
	
	return (0);
}

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

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

using namespace std;

int main()
{

	int n;
	cin >> n;

	set<int> mochi;
	rep (i, n) {
		int tmp;
		cin >> tmp;
		mochi.insert(tmp);
	}

	cout << mochi.size() << endl;


	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func rcvInt() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n := rcvInt()

	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = rcvInt()
	}
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = rcvInt()
	}

	var max = 0
	for i := 0; i < n; i++ {
		var sum = 0
		for j := 0; j <= i; j++ {
			sum += a[j]
		}
		for j := i; j < n; j++ {
			sum += b[j]
		}
		if sum > max {
			max = sum
		}
	}
	fmt.Println(max)
}


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

int main() {
  string s, t;
  cin >> s >> t;
  cout << t << s << endl;
}

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

#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
//cout << fixed << setprecision(10) << ans << endl;
//int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main(){
    string s;
    cin >> s;
    if(s[s.size()-1] == 's'){
        cout << s << "es" << endl;
    }
    else{
        cout << s << "s" << endl;
    }



    return 0;
}

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

const int maxn=1000005;
int n,ans;
char s[maxn];
int a[maxn];

int main(){
	scanf("%d%s",&n,s);
	for(int i=0;i<n-1;i++){
		a[i]=abs(s[i]-s[i+1]);
		if(((n-2)&i)==i)ans^=(a[i]&1);
	}
	if(ans){
		puts("1");
		return 0;
	}
	ans=0;
	for(int i=0;i<n-1;i++){
		if(a[i]==1){
			puts("0");
			return 0;
		}
		if(((n-2)&i)==i)ans^=(a[i]==2);
	}
	if(ans)puts("2");
	else puts("0");
	return 0;
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

vi par,sz,vis,dis;
vector<vi> graph;
vector<vector<pair<li,li>>> wgraph;

void init(li n)
{
    par.resize(n);
    sz.resize(n);
    wgraph.resize(n);
    dis.resize(n);
    vis.resize(n);
    graph.resize(n);

    f(i,0,n-1)
    {
        par[i]=i;
        sz[i]=1;
        dis[i]=1e18;
    }
}

li root(li a)
{
    while(a!=par[a])
    {
        par[a]=par[par[a]];
        a=par[a];
    }

    return a;
}

void unio(li a,li b)
{
    li r_a=root(a);
    li r_b=root(b);

    if(par[r_a]!=r_b)
    { 
        if(sz[r_a]<sz[r_b])
        {
            par[r_a]=par[r_b];
            sz[r_b]+=sz[r_a];
            sz[r_a]=0;
        }
        else
        {
            par[r_b]=par[r_a];
            sz[r_a]+=sz[r_b];
            sz[r_b]=0;
        }
    }
}

int main()
{    
    

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

    li N=3;

    vector<vi> A(N,vi(N,0));

    f(i,0,N-1)
    {
        f(j,0,N-1)
        {
            cin>>A[i][j];
        }
    }

    li n;

    cin>>n;

    li b[n];

    map<li,li> m;

    for(li i=0;i<n;i++)
    {
        cin>>b[i];
        m[b[i]]++;
    }

    f(i,0,N-1)
    {
        li cnt=0;

        f(j,0,N-1)
        {
            if(m[A[i][j]])
                cnt++;
        }

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

    f(i,0,N-1)
    {
        li cnt=0;

        f(j,0,N-1)
        {
            if(m[A[j][i]])
                cnt++;
        }

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

    li cnt1=0,cnt2=0;

    f(i,0,N-1)
    {
        f(j,0,N-1)
        {
            if(i==j && m[A[i][j]])
                cnt1++;

            if(i+j==2 && m[A[i][j]])
            {   
                cnt2++;
            }
        }
    }

    if(cnt1==3 ||cnt2==3)
    {
        cout<<"Yes";
        return 0;
    }

    cout<<"No";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


const long long LIM = 1000000000000000000LL;
int main() {
	int N;
	while (cin >> N) {
		vector<long long> A(N);
		for (int i = 0; i < N; ++i) cin >> A[i];
		sort(A.begin(), A.end());
		if (A[0] == 0) {
			cout << 0 << endl;
		}
		else {
			long long res = 1;
			for (int i = 0; i < N; ++i) {
				if (res == -1) continue;
				else if (res > LIM / A[i]) res = -1;
				else res *= A[i];
			}
			cout << res << endl;
		}
	}
}

















Measured memory_bytes: 4052
#include <iostream>
#include <cstdio>
#include <vector>
#include <deque>
#include <algorithm>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

const int N_MAX = 310;

ull A[N_MAX][N_MAX];
ull d[N_MAX][N_MAX];
 
int main(){
    int N;
    cin >> N;
    REP(i,N){
        REP(k,N){
            ull inp;
            cin >> inp;
            A[i][k] = inp;
            d[i][k] = inp;
        }
    }

    REP(k,N) REP(i,N) REP(j,N) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

    bool judge = true;
    REP(i,N){
        REP(k,N){
            if(A[i][k] > d[i][k])
                judge = false;
        }
    }
    if(!judge){
        cout << -1 << endl;
        return 0;
    }

    //REP(i,N){
    //    REP(k,N){
    //        printf("%d ", d[i][k]);
    //    }
    //    printf("\n");
    //}

    ull path = 0;
    REP(i,N){
        REP(j,N){
            bool add = true;
            REP(k,N){
                if(k == i || k == j) continue;
                if(d[i][j] == d[i][k] + d[k][j])
                    add = false;
            }
            if(add) path += d[i][j];
        }
    }
    cout << path/2 << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
const long long mod=1e9+7; //10^9+7


int main() {
    int n;
    ll a[200001],b[200001];
    pair<ll, ll> p[200001];
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i]>>b[i];
        p[i] = make_pair(b[i], a[i]);
    }

    sort(p,p+n);

    ll time = 0;

    bool sw = true;
    for(int i=0; i<n; i++){
        ll tmp = p[i].first;
        p[i].first = p[i].second;
        p[i].second = tmp;

        time += p[i].first;
        if(time > p[i].second){
            sw = false;
            break;
        }
    }
    if(sw){
        cout << "Yes"<<endl;
    }else{
        cout << "No"<<endl;
    }


  return 0;
}


Measured memory_bytes: 6528
b=[]
c=[0]*9
for i in range(3):
  a=input().split()
  b.append(int(a[0]))
  b.append(int(a[1]))
  b.append(int(a[2]))
N=int(input())
for i in range(N):
  e=int(input())
  for j in range(9):
    if(e==b[j]):
      c[j]=1
if(c[0]==c[1]==c[2]==1):
  print('Yes')
elif(c[3]==c[4]==c[5]==1):
  print('Yes')
elif(c[6]==c[7]==c[8]==1):
  print('Yes')
elif(c[0]==c[4]==c[8]==1):
  print('Yes')
elif(c[2]==c[4]==c[6]==1):
  print('Yes')
elif(c[0]==c[3]==c[6]==1):
  print('Yes')
elif(c[1]==c[4]==c[7]==1):
  print('Yes')
elif(c[2]==c[5]==c[8]==1):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
local mod = 1000000007
local mfl = math.floor
local function bmul(x, y)
  local x0, y0 = x % 31623, y % 31623
  local x1, y1 = mfl(x / 31623), mfl(y / 31623)
  return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod
end
local n, m = io.read("*n", "*n")
local a, b = {}, {}
for i = 1, n do a[i] = io.read("*n") end
for i = 1, m do b[i] = io.read("*n") end
table.sort(a, function(x, y) return x > y end)
table.sort(b, function(x, y) return x > y end)
local ret = 1
for i = 1, n - 1 do if a[i] == a[i + 1] then ret = 0 break end end
for i = 1, m - 1 do if b[i] == b[i + 1] then ret = 0 break end end
local big_n, big_m = 0, 0
local bigused = 0
local cur_a, cur_b = 1, 1
for i = n * m, 1, -1 do
  if a[cur_a] == i and b[cur_b] == i then
    big_n, big_m = big_n + 1, big_m + 1
    bigused = bigused + 1
    cur_a = cur_a + 1
    cur_b = cur_b + 1
  elseif a[cur_a] == i then
    if big_m == 0 then
      ret = 0
      break
    else
      ret = bmul(ret, big_m)
      big_n = big_n + 1
      bigused = bigused + 1
      cur_a = cur_a + 1
    end
  elseif b[cur_b] == i then
    if big_n == 0 then
      ret = 0
      break
    else
      ret = bmul(ret, big_n)
      big_m = big_m + 1
      bigused = bigused + 1
      cur_b = cur_b + 1
    end
  else
    if big_n * big_m <= bigused then
      ret = 0
      break
    else
      ret = bmul(ret, big_n * big_m - bigused)
      bigused = bigused + 1
    end
  end
end
print(ret)


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	long long a, b, c;
	cin >> a >> b >> c;
	cout << b + min(c, a + b + 1) << endl;
	return 0;
}

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

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

    int k, t;
    cin >> k >> t;
    priority_queue<pair<int, int>> pq;
    rep(i, t){
        int a;
        cin >> a;
        pq.push(make_pair(a, i));
    }

    pair<int, int> tmp = pq.top();
    pq.pop();
    int prev = tmp.second;
    --tmp.first;
    if(tmp.first != 0) pq.push(tmp);
    
    int res = 0;
    rep(_, k-1){
        pair<int, int> tmp = pq.top();
        pq.pop();

        if(tmp.second == prev){
            if(pq.empty()){
                ++res;
                --tmp.first;
                if(tmp.first != 0) pq.push(tmp);
            }
            else{
                pair<int, int> tmp2 = pq.top();
                pq.pop();
                --tmp2.first;
                prev = tmp2.second;
                if(tmp.first != 0) pq.push(tmp);
                if(tmp2.first != 0) pq.push(tmp2);
            }
        }
        else{
            --tmp.first;
            prev = tmp.second;
            if(tmp.first != 0) pq.push(tmp);
        }

    }

    cout << res << endl;


    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main(){
    int c[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++)cin >> c[i][j];
    }
    bool chk = true;
    for(int i=0;i<2;i++){
        for(int j=i+1;j<3;j++){
            int tmp = c[i][0] - c[j][0];
            for(int k=1;k<3;k++){
                if(tmp != c[i][k] - c[j][k])chk=false;
            }
            tmp = c[0][i]-c[0][j];
            for(int k=1;k<3;k++){
                if(tmp != c[k][i]-c[k][j])chk=false;
            }
        }
    }
    if(chk)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
  var k int
  fmt.Scan(&k)
  var a, b int
  fmt.Scan(&a, &b)
  n := 0
  var ok bool
  for {
    n++
    l := k * n
    if l > b {
      break
    } else if l >= a && l <= b {
      ok = true
      break
    }
  }
  if ok {
    fmt.Println("OK")
  } else {
    fmt.Println("NG")
  }
}


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

int main(void) {
	char S[4];
	scanf("%s", S);
	if (strlen(S) == 2) printf("%s\n", S);
	else {
		char tmp = S[0];
		S[0] = S[2];
		S[2] = tmp;
		printf("%s\n", S);
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

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

int main() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int x = x2 - x1;
  int y = y2 - y1;


  int x3, y3, x4, y4;
  x3 = x2 - y;
  y3 = y2 + x;
  x4 = x1 - y;
  y4 = y1 + x;
  
  cout << x3 << " " << y3 << " " << x4 <<" "<< y4<< endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[4][2];

int main() {
  double e[2];
  while (cin >> e[0] >> e[1]) {
    for (int i = 0; i < 2; i++) {
      if (e[i] >= 1.1) a[0][i]++;
      else if (e[i] >= 0.6) a[1][i]++;
      else if (e[i] >= 0.2) a[2][i]++;
      else a[3][i]++;
    }
  }
  for (int i = 0; i < 4; i++) {
    cout << a[i][0] << " " << a[i][1] << "\n";
  }
}


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

vector<int> p;

void solve(int n){
	auto ub = upper_bound(p.begin(), p.end(), n);
	auto lb = lower_bound(p.begin(), p.end(), n);
	if(ub != lb) cout << 0 << "\n";
	else cout << *ub - *(ub-1) << "\n";
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	for(int i=2; i<=1299709; ++i){
		bool f = true;
		for(int j=0; j<p.size()&&p[j]*p[j]<=i; ++j)
			if(i % p[j] == 0){
				f = false;
				break;
			}
		if(f) p.push_back(i);
	}
	while(1){
		int n;
		cin >> n;
		if(n == 0) return 0;
		solve(n);
	}
}


Measured memory_bytes: 3340
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<String> weaters = new ArrayList<>(Arrays.asList("Sunny", "Cloudy", "Rainy"));
        int index = weaters.indexOf(sc.next());
        if (index == 2) {
            System.out.println(weaters.get(0));
        } else {
            System.out.println(weaters.get(index + 1));
        }
    }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std ;
#define An setprecision(16) 
int main(){
    int A,B,C,D;
    int a;
    int b;
    cin >> A >> B >> C >> D;
    if(A%D==0)a=A/D;
    else a= A/D+1;
    if(C%B==0)b=C/B;
    else b = C/B+1;
    if(b<=a)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3624
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define MOD 1000000007

ll inv[3000], fac[3000], finv[3000];

void comInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 3000; i++) {
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        fac[i] = fac[i-1] * (ll)i % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

ll com(int a, int b) {
    if (a < b) return 0;
    //cout << "a:" << a << " b:" << b << endl;
    //cout << fac[a] << " " << finv[b] << " " << finv[a-b];
    return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}

int main() {
    comInit();
    int N, K;
    cin >> N >> K;
    for (int batch = 1; batch <= K; batch++) {
        int all = N - K + 1;
        int ans = (int)((ll)(com(all, batch) % MOD) * (ll)(com(K-1, batch-1) % MOD) % MOD);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;

public class Main {

	public static void main(String args[]) {
		FastScanner cin = new FastScanner(System.in);
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(FastScanner cin, PrintWriter cout) {
		int n = cin.nextInt();
		int p = cin.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++)
			a[i] = cin.nextInt();

		long ans = solve(n, p, a);
		cout.println(ans);
	}

	private static long solve(int n, int p, int[] a) {
		int odds = Arrays.stream(a).map(val -> val % 2).sum();
		int evens = a.length - odds;
		long anse = 0;
		for (int i = p; i <= odds; i += 2)
			anse += ncr(odds, i);
		long anso = 0;
		for (int i = 0; i <= evens; i++)
			anso += ncr(evens, i);
		long ans = anse * anso;
		return ans;
	}

	private static long ncr(int n, int r) {
		long ans = 1;
		for (int i = 0; i < r; i++)
			ans = ans * (n - i) / (i + 1);
		return ans;
	}

	static class FastScanner {
		private final InputStream in;
		private final byte[] buf = new byte[1 << 14];
		private int bufs = 0;
		private final long[] num = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
		private int ptr = 0;

		public FastScanner(InputStream in) {
			super();
			this.in = in;
		}

		boolean hasNext() {
			while (hasNextByte() && !isMeaningful(buf[ptr]))
				ptr++;
			return hasNextByte();
		}

		private boolean hasNextByte() {
			if (ptr < bufs)
				return true;
			ptr = 0;
			try {
				bufs = in.read(buf);
			} catch (IOException e) {
				throw new IllegalArgumentException(e);
			}
			if (bufs <= 0)
				return false;
			return true;
		}

		private static boolean isMeaningful(int b) {
			return 33 <= b && b <= 126;
			// return b != -1 && !Character.isWhitespace(b);
		}

		String next() {
			if (!hasNext())
				throw new IllegalArgumentException();
			StringBuilder sb = new StringBuilder();
			int b = read();
			while (isMeaningful(b)) {
				sb.appendCodePoint(b);
				b = read();
			}
			return sb.toString();
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		int nextInt() {
			long nl = nextLong();
			int ni = (int) nl;
			if (ni != nl)
				throw new IllegalArgumentException();
			return ni;
		}

		long nextLong() {
			if (!hasNext())
				throw new IllegalArgumentException();
			long n = 0;
			int plus = 1;
			int b = read();
			if (b == '-') {
				plus = -1;
				b = read();
			}
			if ('0' > b || b > '9')
				throw new java.lang.IllegalArgumentException();
			while (true) {
				if (!isMeaningful(b))
					return plus * n;
				n *= 10;
				n += num[b - '0'];
				b = read();
			}
		}

		private int read() {
			if (hasNextByte())
				return buf[ptr++];
			else
				return -1;
		}

	}
}


Measured memory_bytes: 27732
import itertools,math,bisect,pprint,sys
n, a, b = map(int, raw_input().split())
v = sorted(map(int, raw_input().split()))[::-1]
res1 = sum(v[:a])*1.0/a
print '{0:.6f}'.format(res1)
res2 = 0
def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)
if a==v[:a].count(v[a-1]):
    res2 = 0
    for i in range(a,b+1):
        if i <= v.count(v[a-1]):
            res2 += nCr(v.count(v[a-1]),i)
    print res2
else:
    print nCr(v.count(v[a-1]),v[:a].count(v[a-1]))

Measured memory_bytes: 2696
// cout << "Case #" << k << ": ";
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> ab(m);
    for(int i = 0; i < m; i++) {
        cin >> ab[i].second >> ab[i].first;
        ab[i].second--;
        ab[i].first--;
    }
    sort(all(ab));
    for(int i = 0; i < m; i++) {
        swap(ab[i].first, ab[i].second);
    }
    // cout << endl;
    int prev = ab[0].second - 1;
    int ans = 1;
    for(int i = 1; i < m; i++) {
        if(ab[i].first > prev) {
            ans++;
            prev = ab[i].second - 1;
        }
        // cout << ans << " " << prev << endl;
    }
    cout << ans << endl;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll INF=1LL<<60;
const int MOD=998244353;
const int N=2e5+5;



int main(){
    int K, X; cin >> K >> X;
    bool ans=false;
    if(X <= 500*K) ans=true;
    cout << (ans ? "Yes":"No") << endl;
    return 0;
}

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

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

	vector<int>a;
	int x;
	int ans=0;

	for (int i = 0; i < N; i++){
		scanf("%d",&x);
		a.push_back(x);
	}
	
	for (int i = 0; i < N; i++){

		if (i == a[a[i]-1]-1){
			ans++;
		}
	}
	
	cout<<ans/2<<endl;
	return 0;
}

Measured memory_bytes: 892
#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;

void gen() {exit(0);}
int main() {
    #ifdef DEBUG
    freopen("input", "r", stdin);
//    freopen("output", "w", stdout);
//    gen();
    #endif
    string s;
    getline(cin, s);
    int a, b, c, d;
    a = s[0] - '0';
    b = s[1] - '0';
    c = s[2] - '0';
    d = s[3] - '0';
    vector<char> ops = {'+', '-'};
    int n = (int)ops.size();
    forn(i, 0, n) {
        forn(j, 0, n) {
            forn(k, 0, n) {
                int cur = a;
                if (ops[i] == '+') cur += b;
                else cur -= b;
                if (ops[j] == '+') cur += c;
                else cur -= c;
                if (ops[k] == '+') cur += d;
                else cur -= d;
                if (cur == 7) {
                    printf("%d%c%d%c%d%c%d=7\n", a, ops[i], b, ops[j], c, ops[k], d);
                    exit(0);
                }
            }
        }
    }
    return 0;
}


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

int n,k,a[100010];
bool dp[100010]; 

signed main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>a[i];
	dp[0]=0;
	for(int i=1;i<=k;i++){
		for(int j=1;j<=n;j++){
			if(i>=a[j]){
				if(dp[i-a[j]]==0){
					dp[i]=1;
					break;
				}
			}
		}
	}
	if(dp[k]==1) cout<<"First"<<endl;
	else cout<<"Second"<<endl;
	return 0;
}

Measured memory_bytes: 384
#                         author:  kagemeka 
#                         created: 2019-11-09 18:08:09(JST)
### modules
## from standard library
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## from external libraries
# import scipy.special   
# import scipy.misc      
# import numpy as np 

def main():
    k = int(sys.stdin.readline().rstrip())
    if k % 2 == 0:
        e_c, o_c = k // 2, k // 2
    else:
        e_c, o_c = k // 2, k // 2 + 1

    ans = e_c * o_c
    print(ans)


if __name__ == "__main__":
    # execute only if run as a script
    main()


Measured memory_bytes: 2940
N = int(input())
S = [input() for _ in range(N)]
 
s = {}
for i in S:
  if i in s:
    s[i] += 1
  else:
    s[i] = 1
 
max_val = max(s.values())
tmp = []
for key, value in s.items():
  if value == max_val:
    tmp.append(key)

for j in sorted(tmp):
  print(j)

Measured memory_bytes: 35216
#include <stdio.h>

int main(void) {

  int n,s;
  scanf("%d %d", &n, &s);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  long mod = 998244353;
  long dp[n][s+1][2];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= s; j++) {
      dp[i][j][0] = 0;
      dp[i][j][1] = 0;
    }
  }
  dp[0][0][0] = 1;
  dp[0][0][1] = 1;
  if (a[0] <= s) {
    dp[0][a[0]][0] = 1;
    dp[0][a[0]][1] = 1;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= s; j++) {
      dp[i][j][0] += dp[i-1][j][0];
      if (j+a[i] <= s) {
        dp[i][j+a[i]][0] += dp[i-1][j][0];
        dp[i][j+a[i]][0] %= mod;
      }
    }
    dp[i][0][0]++;
    if (a[i] <= s) {
      dp[i][a[i]][0]++;
      dp[i][a[i]][0] %= mod;
    }
    for (int j = 0; j <= s; j++) {
      dp[i][j][1] = dp[i-1][j][1]+dp[i][j][0];
      dp[i][j][1] %= mod;
    }
  }
  printf("%ld\n", dp[n-1][s][1]);

  return 0;
}

Measured memory_bytes: 140800
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    long long n, h, ans = 0;
    cin >> n >> h;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++){
        scanf("%d%d", &a[i], &b[i]);
    }

    sort(a.begin(), a.end()); sort(b.begin(), b.end());
    int i = n-1;
    while(i >= 0 && h > 0 && a[n-1] < b[i]){
        h -= b[i];
        ans++;
        i--;
    }

    cout << ans + (h > 0 ? (h + a[n-1] - 1) / a[n-1] : 0) << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	long long x, k, d;
	cin >> x >> k >> d;
	x = abs(x);
	long long n = (d ? x / d : 0), r = (d ? x % d : 0);
	if (n > k) cout << (x - k * d);
	else if ((k - n) % 2) cout << abs(d - r);
	else cout << r;
	return 0;
}

Measured memory_bytes: 3144
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
signed main(){
    
   int n,m;
   pair<int,int> a[111111];
   cin>>n>>m;
   rep(i,n)cin>>a[i].first>>a[i].second;
   sort(a,a+n);
   int ans=0,sum=0;
   rep(i,n){
       sum+=a[i].second;
       ans+=a[i].first*a[i].second;
       if(sum>=m){
          
           ans-=(sum-m)*a[i].first;
           break;
       }
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 1920
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,b[100010],a[100010];
    rep(i,100010) a[i]=LLINF;
    cin>>n;
    rep(i,n-1){
        cin>>b[i];
    }
    a[0]=b[0];
    a[n-1]=b[n-1-1];
    rep2(i,1,n-1){
        a[i]=min(b[i-1],b[i]);
    }
    ll ans=0;
    rep(i,n){
        ans+=a[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024