akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#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 <cstdlib>
#include <iostream>
#include <string>
#include <typeinfo>
#include <stdlib.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
#define PI 3.141592653589793


int main(){
    ll N,K,R,S,P;
    cin >> N >> K >> R >> S >> P;
    string T;
    cin >> T;
    ll ans=0;
    for(int i = 0; i < N; i++){
        if(i>=K){
            if(T[i]==T[i-K]){
                //cout << T[i] << endl;
                if(T[i]=='r'){
                    T[i]='n';
                }else if(T[i]=='s'){
                    T[i]='n';
                }else{
                    T[i]='n';
                }
                continue;
            }
        }
        if(T[i]=='r'){
            //cout << "P" << endl;
            ans+=P;
        }else if(T[i]=='s'){
            //cout << "R" << endl;
            ans+=R;
        }else{
            //cout << "S" << endl;
            ans+=S;
        }
    }
    cout << ans << endl;

}

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

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

	if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0){
		cout << "Possible" << endl;
	} else{
		cout << "Impossible" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

void solve(int N, int Q) {
    VI a(1000, 0);
    REP(i, N) {
        int m; cin >> m;
        while (m--) {
            int n;
            cin >> n;
            a[n]++;
        }
    }
    PII ans = MP(-1, -1);
    REP(i, 1000) {
        if (ans.first < a[i]) {
            ans.first = a[i];
            ans.second = i;
        }
    }
    if (ans.first < Q) {
        cout << 0 << endl;
    } else {
        cout << ans.second << endl;
    }
}

signed main(void) {
    int n, m, p, a, b, c, x, y, z, q;
    string s;
    while (cin >> n >> q) {
        if (n == 0 && q == 0) return 0;
        solve(n, q);
    }
}

Measured memory_bytes: 3060
import java.util.Arrays;
import java.util.Scanner;
class Main{
	   public static void main(String[] args){
	  Scanner scan =  new Scanner(System.in);
	   int a = scan.nextInt();
       int b = scan.nextInt();
       int c = scan.nextInt();
int d = b-a;
int e = c- b;
if (d==e){
System.out.println("YES");
}else{
System.out.println("NO");
}
}
}

Measured memory_bytes: 21844
import sys
 
stdin = sys.stdin

mod = 1000000007
inf = 1 << 60
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n = ni()
v = na()
c = na()

d = [v[i] - c[i] for i in range(n)]
ans = 0
for i in range(n):
    if d[i] > 0:
        ans += d[i]

print(ans)

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

int main(){
  while(true){
    string s1,s2;
    cin >> s1;
    if(s1[0]=='.')break;
    cin >> s2;
    int count=2;

    for(int i=0,j=0;true;i++,j++){
      if(s1[i]!=s2[j]){//そもそも違うコードだったら
        count=0;
        break;
      }
      if(s1[i]=='\0'||s2[j]=='\0')break;//コードが終わったら

      if(s1[i]=='\"'){//ダブルクオ見つけたら
        int m,n;
        for(m=i+1;s1[m]!='\"';m++){}
        for(n=j+1;s2[n]!='\"';n++){}
        //printf("i=%d j=%d m=%d n=%d\n",i,j,m,n);
        for(int p=i,q=j;p<=m;p++,q++){
          if(s1[p]!=s2[q]){
            count--;
            break;
          }
        }
        i=m;
        j=n;
      }
    }
    //出力
    if(count==2){
      cout<<"IDENTICAL"<<endl;
    }else if(count==1){
      cout<<"CLOSE"<<endl;
    }else{
      cout<<"DIFFERENT"<<endl;
    }
  }
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int main(){
    int n, k, ret=1;
    R n >> k;
    rep(i, n){
        if(ret < k){
            ret *= 2;
        }else{
            ret += k;
        }
    }
    co(ret);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;
vector< pair<int,int> >v;

int solve(int a,int b)
{
    return abs(a-b);
}
int main()
{
    //cout<<solve(1,2,3,4)<<endl;
   int n;cin>>n;
   string s;cin>>s;
   int ans = -1;
   for(int i =0;i<n;i++)
   {
       int cnt = 0;
       bool a[26]={false},b[26]={false};
       for(int j = 0;j<=i;j++)
       {
           a[s[j]-'a']=true;
       }
       for(int j=i+1;j<n;j++)
       {
           b[s[j]-'a']=true;
       }
       for(int j =0;j<26;j++)
       {
           if(a[j]&&b[j]) cnt++;
       }
        ans = max(cnt,ans);
   }
   cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to;
	ld cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y, h;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
ll fact(ll x, ll k) {//最大値、個数
	ll sum = 1;
	for (int i = 0; i < k; i++)
		sum *= (x--);
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}
#define int long long
const long long inf = 4523372036854775807;
const int iinf = 1500000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int n, m;
	cin >> n >> m;
	if (n%m == 0) cout << -1 << endl;
	else cout << n << endl;
	getchar(); getchar();
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<ctype.h>
#include<string>
#include<math.h>
#define pi 3.141592653589
#include<iomanip>
#include<vector>
using namespace std;
#include<algorithm>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 1e9
#define LINF 1e17
#define ll long long
#define MOD (int)(1e9+7)

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };



int main() {

	int a, b, x;

	cin >> x >> a >> b;
	if (abs(x - a) <= abs(x - b))cout << "A" << endl;
	else cout << "B" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <limits>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define fi(i, n) for( int i=0 ; i<n ; i++ )
#define f(i, a, b) for( int i=a ; i<b ; i++ )
#define vi vector<int>
#define pb push_back
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
ll fact(ll n)
{
    ll ans = 1e14;
    for(ll i = 1; i<=sqrt(n); i++)
    {
        if(n%i==0)
        {
            ll sol = (i - 1) + (n/i - 1);
            ans = min(ans,sol);
        }
    }
    return ans;
}
int main()
{
    ll n;
    cin>>n;
    ll mod = 1e9 + 7;
    ll arr[n];
    ll temp[n];
    temp[0] = 0;
    ll sum = 0;
    fi(i,n)
    {
        cin>>arr[i];
        sum += arr[i];
        if(i!=n- 1)
        {
            temp[i + 1] = sum;
        }
    }
    ll ans = 0;
    fi(i,n)
    {
        ans = (ans%mod + ((temp[i]%mod)*(arr[i]%mod)%mod))%mod;
    }
    cout<<ans%mod;


}


Measured memory_bytes: 6764
// ref: https://qiita.com/drken/items/ace3142967c4f01d42e9, v1: rec memo

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

//---

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

//---

int rec_memo(vector<int>& vMemo, int n){
    if(n==0){ return 0; }
    if(vMemo[n] != -1){ return vMemo[n]; }
    
    int steps=INT_MAX;
    
    for(int pow6=1; pow6<=n; pow6*=6){ steps=min(steps, rec_memo(vMemo, n-pow6)+1);}
    for(int pow9=1; pow9<=n; pow9*=9){ steps=min(steps, rec_memo(vMemo, n-pow9)+1);}
    
    return vMemo[n] = steps;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N; cin >> N;
    vector<int> vMemo(N+1, -1);
    
    cout << rec_memo(vMemo, N) << endl;
    
    return 0;
}

Measured memory_bytes: 5376
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <time.h>
#include <queue>
#include <list>
#include <map>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
#define LL long long
#define eps 1e-6
using namespace std;
const double pi = 3.1415926535;
/*
https://codeforces.com/contest/1106/problems
https://codeforces.com/contest/1106/submit
*/
int num = 0;
int a[10][10];
int n,m;
int dfs(int temp[10],int x){
    for(int i = 1; i <= n; i ++){
        if(temp[i] == 0){
            goto l;
        }else{

        }
    }
    num ++;
    return 0;
    l:0;
    for(int i = 1; i <= n; i ++){
        if(a[x][i] == 1 && temp[i] == 0){
            temp[i] = 1;
            dfs(temp,i);
            temp[i] = 0;
        }
    }
    return 0;
}

int main() {
    s(n) s(m)
    re(a,0);
    int x,y;
    for(int i = 0; i < m; i ++){
        s(x) s(y)
        a[x][y] = 1;
        a[y][x] = 1;
    }
    int temp[10];
    re(temp,0);
    temp[1] = 1;
    dfs(temp,1);
    p(num) pn
    return 0;
}



 //1 1 1 1 2 2 2 3 3 5 6 6 8 8 11


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define ele long long
using namespace std;
ele D,ans,now,pw10[20];
inline ele _abs(ele x){
	return (x<0)?-x:x;
}
void dfs(ele i,ele j,ele D){
	if (i<=j){
		if (!D)
			if ((i+j)&1) ans+=now;
			else ans+=now*10;
		return;
	}
	ele tmp=pw10[i]-pw10[j];
	ele t1=D/tmp*tmp,t2;
	if (t1<D) t2=t1+tmp; else t2=t1-tmp;
	ele m=10-_abs(t1/tmp);
	if (t1>=0 && !j) --m;
	if (m>0){
		now*=m;
		dfs(i-1,j+1,D-t1);
		now/=m;
	}
	m=10-_abs(t2/tmp);
	if (t2>=0 && !j) --m;
	if (m>0){
		now*=m;
		dfs(i-1,j+1,D-t2);
		now/=m;
	}
}
int main(){
	scanf("%lld",&D);
	ans=0;
	pw10[0]=1;
	for (int i=1; i<=17; ++i) pw10[i]=pw10[i-1]*10;
	for (int i=1; i<=17; ++i) now=1,dfs(i,0,D);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: June 29, 2019
 * 
 */

#include <bits/stdc++.h>

//#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(x) for(auto i=0 ; i<(x); ++i)
#define _rep(a,b) for(auto i=(a); i<(b); ++i)
#define endl '\n'
using namespace std;




auto SOLUTION_FUNCTION( void ) ->void {

    // your solution goes here 


    int n , w;

    cin >>n>>w;

    vl dp(w+1);

    for(int item = 0; item<n; ++item){
        int weight , value;

        cin>>weight >> value;

        for(int weight_already = w - weight; weight_already >=0 ; --weight_already){

            dp[weight_already+weight] = max(dp[weight_already+weight] , dp[weight_already] + value);

        }

    }

    bint ans =0;

    for(int weight = 0; weight <=w ; ++weight)
        ans = max(ans , dp[weight]);
    cout<<ans<<endl;

    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("din","r",stdin);
    freopen("dout","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}


Measured memory_bytes: 1024
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
//#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;

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

    ll a,b,c,n,maxi=0,f=0,mini=INF;
    ll sum=0;
    string str,sub;
    ll h,w;
    ll m;
    cin>>n>>a>>b;
    n=n-2;
    sum=a+b;
    c=sum+n*a;
    ll d=sum+n*b;
    if(d-c>=0)cout<<d-c+1<<endl;
    else cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;
class Graph 
{ 
    int V;    
    list<int> *adj;    
public: 
    Graph(int V);  // Constructor 
  
    // function to add an edge to graph 
    void addEdge(int v, int w);  
  
    // prints BFS traversal from a given source s 
    void BFS(int s);   
}; 
  
Graph::Graph(int V) 
{ 
    this->V = V; 
    adj = new list<int>[V]; 
} 
  
void Graph::addEdge(int v, int w) //How to add edge
{ 
    adj[v].push_back(w); 
} 
  
void Graph::BFS(int s) //BFS 
{ 
   
    bool *visited = new bool[V]; 
    for(int i = 0; i < V; i++) 
        visited[i] = false; 
 
    list<int> queue; 
    visited[s] = true; 
    queue.push_back(s); 
    list<int>::iterator i; 
  
    while(!queue.empty()) 
    { 
        s = queue.front(); 
        cout << s << " "; 
        queue.pop_front(); 
  
        for (i = adj[s].begin(); i != adj[s].end(); ++i) 
        { 
            if (!visited[*i]) 
            { 
                visited[*i] = true; 
                queue.push_back(*i); 
            } 
        } 
    } 
} //To create a graph
//Graph g(4); 
    //g.addEdge(0, 1); 
    //g.addEdge(0, 2); 
int gcd(int x, int y) {
        if (x == 0) {
            return y;
        }
        
        return gcd(y % x, x);
    }
ll factorial(ll a)
{
  ll fact[a+1];
  fact[0]=1;
  fact[1]=1;
  for(int i=2;i<=a;i++)
  fact[i]=fact[i-1]*i;
  return fact[a];
  
}
bool isPali(string s)
{
    string copy=s;
    reverse(s.begin(),s.end());
    if(s.compare(copy)!=0)
    return false;
    return true;
    
}


int main()
{
 ll n;
 cin>>n;
 //double x=n*1.0;
 printf("%.12f\n",(double)n*n*n/27);
 
}


Measured memory_bytes: 256
import java.util.Map.Entry;
import java.io.*;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		int N = sc.nextInt();
		long[] sum = new long[N+1];
		for(int i = 1; i <= N; i++){
			sum[i] = sum[i-1] + sc.nextLong();
		}
		
		HashMap<Long, Integer> map = new HashMap<Long, Integer>();
		for(long s : sum){
			Integer count = map.get(s);
			if(count == null) map.put(s, 1);
			else map.put(s, count+1);
		}
		
		long ans = 0;
		for(long key : map.keySet()){
			int n = map.get(key);
			ans += 1L * n * (n-1) / 2;
		}
		System.out.println(ans);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}

Measured memory_bytes: 49176
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        boolean ans = false;
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= 9; j++) {
                if (n == i * j) ans = true;
            }
        }

        System.out.println(ans ? "Yes" : "No");
    }
}


Measured memory_bytes: 21972
num_list = [int(i) for i in input().split()]

if num_list[0] == num_list[1] == 1:
    print(0)

else:
    ans = (num_list[0] * (num_list[0] - 1))/2 + num_list[1] * (num_list[1] - 1) / 2
    print(int(ans))

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define forin(in) for(int i=0; i<(int)in.size(); i++) cin>>in[i]
#define forout(out) for(int i=0; i<(int)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

int main() {
    int d, t, s; cin>> d >> t >> s;
    int a = t * s;
    if(d > a) cout<< "No" << endl;
    else cout<< "Yes" << endl;
}


Measured memory_bytes: 3576
mod=10**9+7
n,k=map(int,input().split())
arr=list(map(int,input().split()))
cnt1=[0]*n
cnt2=[0]*n
for i in range(n):
  for j in range(n):
    if arr[i]>arr[j]:
      cnt2[i]+=1
      if i<j:
        cnt1[i]+=1
ans=0
for val in cnt1:
  ans+=val*k
  ans%=mod
for val in cnt2:
  ans+=val*(k*(k-1)//2)
  ans%=mod
print(ans)

Measured memory_bytes: 3188
#include<stdio.h>

int main(void)
{
    int N,M,A,i,q;

    scanf("%d%d",&N,&M);
    q=0;
    for(i=0;i<M;i++){
        scanf("%d",&A);
        q=q+A;
    }
    if(N-q>=0)
    printf("%d\n",N-q);
    else printf("-1\n");
    return 0;
}

Measured memory_bytes: 1724
#include<set>
#include<map>
#include<stack>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<climits>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
LL read(){
	bool f=0;LL x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return !f?x:-x;
}
#define MAXN 200000
#define INF 0x3f3f3f3f
bool vis[MAXN+5];
int n,a[MAXN+5],val[MAXN+5],nxt[MAXN+5];
void Print(int p){
	while(p<=n){
		if(nxt[p]>n) printf("%d ",a[p]),p++;
		else p=nxt[p]+1;
	}
	puts("");
	exit(0);
}
int main(){
	//freopen("dnd.in","r",stdin);
	//freopen("dnd.out","w",stdout);
	n=read();
	LL k=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	for(int i=2*n;i>=n+1;i--)
		val[a[i-n]]=i;
	for(int i=n;i>=1;i--)
		nxt[i]=val[a[i]],val[a[i]]=i;
	int p=1;
	LL sum=0;
	while(!vis[p]){
		sum+=nxt[p]-p,vis[p]=1;
		if(nxt[p]>n)
			p=(nxt[p]-n)%n+1;
		else p=nxt[p]%n+1;
	}
	k%=(sum/n+1);
	while(k){
		if(!k) break;
		if(k==1) Print(p);
		if(nxt[p]>=n){
			k--;
			if(nxt[p]==2*n) k--;
			p=(nxt[p]-n)%n+1;
		}
		else p=nxt[p]+1;
	}
	puts("");
	return 0;
}


Measured memory_bytes: 4096
#!/usr/bin/perl
#= CPAN mocules =====================================================#
use strict;				# strictモード
use warnings;			# 警告有効

#= Global values ====================================================#
#= Local routines ===================================================#
sub main(){
	my $in = <>;
	chomp $in;
	my @data = split(/ /, $in);

	if (($data[0] <= 8) && ($data[1] <= 8)){
		print "Yay!\n";
	}else{
		print ":(\n";
	}


	return 0;
}

#----- 実行 -----#
exit( main() );




Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <utility>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef list<ll> listl;
typedef string str;

#define min(A, B) min(static_cast<ll>(A), static_cast<ll>(B))
#define max(A, B) max(static_cast<ll>(A), static_cast<ll>(B))
#define all(x) (x).begin(), (x).end()
#define mp make_pair

#define _rep(i, m)		for(ll i = 0, i_max = m; i < i_max; i++)
#define _erep(i, m)		for(ll i = 0, i_max = m; i <= i_max; i++)
#define _brep(i, b, m)	for(ll i = b, i_max = m; i < i_max; i++)
#define _ebrep(i, b, m)	for(ll i = b, i_max = m; i <= i_max; i++)
#define _rrep(i, m)		for(ll i = m; i >= 0; i--)
#define _rerep(i, b, e)	for(ll i = b; i >= e; i--)

#define rep(m)			_rep(i, m)
#define erep(m)			_erep(i, m)
#define brep(b, m)		_brep(i, b, m)
#define ebrep(b, m)		_ebrep(i, b, m)
#define rrep(m)			_rrep(i, m)
#define rerep(b, e)		_rerep(i, b, e)

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

void in(ll& I)
{
	cin >> I;
}

void in(vl& I)
{
	for (auto& i : I)
	{
		cin >> i;
	}
}

void in(listl& I)
{
	for (auto& i : I)
	{
		cin >> i;
	}
}

void in(str& s)
{
	cin >> s;
}

void out(ll O)
{
	cout << O;
}

void out(vl& O)
{
	for (auto& o : O)
	{
		cout << o;
	}
}

void rout(bool b, str True, str False)
{
	if (b) cout << True.c_str();
	else cout << False.c_str();
}

ll T[9] = { 0,1,2,6,24,120,720,5040,40320 };

int main()
{
	ll N;

	cin >> N;

	vl P(N), Q(N);

	in(P);
	in(Q);

	ll Pn, Qn;
	Pn = Qn = 1;

	listl Pl, Ql;
	Pl = Ql = { 1,2,3,4,5,6,7,8 };

	auto C = [](listl & L, ll i) -> ll
	{
		ll r = 1;
		for (auto l : L)
		{
			if (l == i)
			{
				return r;
			}
			r++;
		}
	};

	rep(N-1)
	{
		ll n;
		ll c;
		c = C(Pl, P[i]);
		n = max(C(Pl, P[i]) - 1, 0);
		Pn += T[N - i - 1] * n;
		Pl.remove(P[i]);

		c = C(Ql, Q[i]);
		n = max(C(Ql, Q[i]) - 1, 0);
		Qn += T[N - i - 1] * n;
		Ql.remove(Q[i]);
	}

	cout << abs(Pn - Qn);

	return 0;
}

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

int main(){
    int n, m; cin >> n >> m;
    vector<int> s(m), c(m);
    for(int i = 0; i < m; i++){
        cin >> s.at(i) >> c.at(i);
        s.at(i)--; 
    }
    bool ok;
    for(int i = 0; i < 1000; i++){
        ok = true;
        string S = to_string(i);
        if(S.size() != n){ 
          ok = false;
          continue;
        }
        for(int j = 0; j < m; j++){
            if(S.at(s.at(j)) != (char)(c.at(j) + '0')) ok = false;
        }
        if(ok){
            cout << S << endl;
            break;
        }
    }
    if(!ok) cout << -1 << endl;
}

Measured memory_bytes: 256
num = raw_input()
num_list = []
for i in range(int(num)):
        a = raw_input()
        num_list.append(int(a))

maxv = float("-inf")
minv = num_list[0]

for i in range(1, len(num_list)):
        maxv = max(maxv, num_list[i] - minv)
        minv = min(minv, num_list[i])

print maxv

Measured memory_bytes: 18976
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define MOD 1000000007
ll power(ll a, ll b) { //a^b
	ll res = 1;
	a = a % MOD;
	while (b > 0) {
		if (b & 1) {res = (res * a) % MOD; b--;}
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}

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

int main() {
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, d;
	cin >> n >> d;
	ll c = 0;
	for (ll i = 0; i < n; i++) {
		ll x, y;
		cin >> x >> y;
		if (x * x + y * y <= d * d)
			c++;
	}
	cout << c << "\n";
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cstdint>
using namespace std;

void solve() {
	int n, m;
	cin >> n >> m;
	struct Ques {
	bool ac;
	int wa;
};
vector<Ques> ques(n, Ques{false, 0});
for (int i = 0; i < m; ++i) {
		int pi;
		string si;
		cin >> pi >> si;
		Ques& q = ques[pi - 1];
		if (q.ac == false && si == "AC") {
			q.ac = true;
		} else if (q.ac == false && si == "WA") {
			q.wa++;
		}
}
int correct = 0, penalty = 0;
for (const auto& q : ques) {
	if (q.ac) {
		correct++;
		penalty += q.wa;
	}
}
cout << correct << " " << penalty << endl;
}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int H, W;
	int Ch, Cw, Dh, Dw;
	cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
	-- Ch; -- Cw; -- Dh; -- Dw;
	vector<string> S(H);
	for (auto& x : S) cin >> x;
	vector<vector<int>> dist(H, vector<int>(W, 1<<30));
	priority_queue<pair<int,pair<int,int>>> Q;
	Q.push({0, {Ch, Cw}});
	dist[Ch][Cw] = 0;
	while (!Q.empty()) {
		int d = -Q.top().first;
		int x = Q.top().second.first;
		int y = Q.top().second.second;
		Q.pop();
		if (x == Dh && y == Dw) {
			cout << d << endl;
			return 0;
		}
		if (dist[x][y] != d) continue;
		for (int dx = -2; dx <= 2; ++ dx) if (0 <= x+dx && x+dx < H) {
			for (int dy = -2; dy <= 2; ++ dy) if (0 <= y+dy && y+dy < W && S[x+dx][y+dy] == '.') {
				int dd = abs(dx)+abs(dy) == 1 ? d : d+1;
				if (dd < dist[x+dx][y+dy]) {
					dist[x+dx][y+dy] = dd;
					Q.push({-dd, {x+dx, y+dy}});
				}
			}
		}
	}
	cout << -1 << endl;
}


Measured memory_bytes: 9592
#include <bits/stdc++.h>
#define base 1000000007LL
#define ll long long
#define X first
#define Y second
#define ld double
#define pb push_back
#define EPS 1e-9
#define all(a) a.begin(),a.end()
#define sz(a) int((a).size())
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
using namespace std;
typedef pair<int, int> II;
typedef pair<II, int> III;

int f[55];

void solve(int n)
{
    if (n == 0) return;
    ll l = 0, r = 0;
    FOR(i,0,32) {
        if (i % 2) l -= (1LL<<i);
        else r += (1LL<<i);
        if (n >= l && n <= r) {
            f[i] = 1;
            if (i % 2) solve(n + (1LL<<i));
            else solve(n - (1LL<<i));
            return;
        }
    }

}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    //freopen("inp.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ll n;
    cin >> n;
    if (n == 0) {
        cout << 0;
        return 0;
    }
    solve(n);
    int vt = 0;
    FORE(i,50,0)
        if (f[i]) {
            vt = i;
            break;
        }
    FORE(i,vt,0) cout << f[i];
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<limits>
#include<ctime>
#include<stack>
#include<bits/stdc++.h>
#include<string>
#include<stdlib.h>
#include<stdio.h>
typedef long long ll;

using namespace std;

int main(){
	int n,d,x;
	cin>>n>>d>>x;
	int a[n],sum=n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		int m=1;
		while(m<=d){
			if(m+a[i]<=d){
				m+=a[i];
				sum++;
			}
			else{
				m+=a[i];
			}
		}
	}
	cout<<sum+x;
}



Measured memory_bytes: 3536
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)

const int INF = 1 << 24;
const int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

typedef unsigned long long ull;

std::vector<int> G[100];
int used[100];

static int tab = 0;

int rec(int v){
    // REP(i, tab){
    //     putchar(' ');
    // }
    // printf("%d\n", v);

    used[v] = 1;

    int res = 0;
    REP(i, G[v].size()){
        if(!used[G[v][i]]){
            tab += 2;
            res = std::max(res, 1 + rec(G[v][i]));
            tab -= 2;
        }
    }

    used[v] = 0;

    return res;
}

int main(){
    int N;
    while(std::cin >> N, N){
        REP(i, 100){
            G[i].clear();
        }

        REP(i, N){
            int a, b;
            std::cin >> a >> b;
            a--; b--;

            G[a].push_back(b);
            G[b].push_back(a);
        }

        REP(i, 100){
            used[i] = 0;
        }

        int res = 0;
        REP(i, 100){
            if(!G[i].empty()){
                res = std::max(res, rec(i) + 1);
            }
        }

        std::cout << res << std::endl;
    }
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
int arr[3],ind[3];
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  int a,b,c;
  rep(i,0,3) cin>>arr[i];
  rep(i,0,3) ind[i]=i;
  int ans=0;
  do {
    a=arr[ind[0]],b=arr[ind[1]],c=arr[ind[2]];
    ans=max(ans,a+b*10+c);
    ans=max(ans,a*10+b+c);
  } while(next_permutation(ind,ind+3));
  cout<<ans<<endl;
  return 0 ;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < k; i++) {
            int d = sc.nextInt();
            for (int j = 0; j < d; j++) {
                array[sc.nextInt() - 1]++;
            }
        }
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (array[i] == 0) {
                ans++;
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 46408
N, M, X = map(int, input().split())
A = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
i = X
j = X
while i <= N:
  if i in A:
    cnt1 += 1
  i += 1
while j >= 0:
  if j in A:
    cnt2 += 1
  j -= 1
print(min(cnt1, cnt2))



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

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

    if(A == B and B == C and A != 1) {
        cout << -1 << endl;
        return 0;
    }

    int cnt = 0;
    while(true) {
        if(A % 2 != 0 or B % 2 != 0 or C % 2 != 0) {
            break;
        }
        ll A_tmp = A / 2;
        ll B_tmp = B / 2;
        ll C_tmp = C / 2;
        A += B_tmp + C_tmp;
        B += A_tmp + C_tmp;
        C += A_tmp + B_tmp;
        cnt++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
main = do
  s <- getLine
  let n = (read :: String -> Int) s
  putStrLn $ (concat $ map aux [1..n])

aux :: Int -> String
aux n
  | n `mod` 3==0 = " " ++ (show n)
  | elem '3' (show n) = " " ++ (show n)
  | otherwise = ""                      

Measured memory_bytes: 3996
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int A,B,M,i,minim,j,sum,min2;
    cin>>A>>B>>M;
    int a[A+5],b[B+5],c[M+5],x[M+5],y[M+5],total[M+5];
    for(i=1; i<=A; i++)
        cin>>a[i];
    for(i=1; i<=B; i++)
        cin>>b[i];
    for(i=1; i<=M; i++)
    {
        cin>>x[i]>>y[i]>>c[i];
    }
    min2=a[x[1]]+b[y[1]]-c[1];
    for(i=1; i<=M; i++)
    {
        total[i]=a[x[i]]+b[y[i]]-c[i];
        if(total[i]<min2)
            min2=total[i];

    }
    sort(a+1,a+A+1);
    sort(b+1,b+B+1);
    minim=a[1]+b[1];

    cout<<min(minim,min2)<<endl;
    return 0;

}




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

int main(){
    int H,W; cin >> H >> W;
    vector<vector<char>> a(H,vector<char>(W));
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> a[i][j];
        }
    }

    bool flagW = true;
    for(int i=0;i<W;i++){
        flagW= true;
        for(int j=0;j<H;j++){
            if(a[j][i]=='#'){
                flagW = false;
                break;
            }
        }
        if(flagW){
            for(int k=0;k<H;k++){
                a[k][i] = '0';
            }
        }
    }

    bool flagH = true;
    for(int i=0;i<H;i++){
        flagH = true;
        for(int j=0;j<W;j++){
            if(a[i][j]=='#'){
                flagH = false;
                break;
            }
        }
        if(flagH){
            for(int k=0;k<W;k++){
                a[i][k] = '1';
            }
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(a[i][j]=='0'){
                if(j==W-1){
                    cout << endl;
                }
                continue;
            }else if(a[i][j]=='1'){
                    continue;
            }else{
                cout << a[i][j];
                if(j==W-1){
                    cout << endl;
                }
            }
        }
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
typedef vector<vp> vvp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>(b);--i)
const int MOD = 1000000007;
const int MAX = 510000;


int main(){
  ll n,m;cin>>n>>m;
  vb v1(n,false),v2(n,false);
  bool ok=false;
  rep(i,0,m){
    ll a,b;cin>>a>>b;
    if(a==1){v1[--b]=true;}
    if(b==1){v1[--a]=true;}
    if(a==n){v2[--b]=true;}
    if(b==n){v2[--a]=true;}
  }
  rep(i,1,n-1){
    if(v1[i]&&v2[i])ok=true;
  }
  if(ok){cout<<"POSSIBLE"<<endl;}
  else{cout<<"IMPOSSIBLE"<<endl;}
}




Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  string s,t,u;
  int a,b;
  cin>>s>>t;
  cin>>a>>b;
  cin>>u;
  if(s==u){
  cout<<a-1<<" "<<b;
  }else{
  cout<<a<<" "<<b-1;
  }
}

Measured memory_bytes: 256
x,y = map(int,input().split())

if abs(x) < abs(y):
    cnt = abs(y)-abs(x)
    if x*y == 0:
        if y < 0:
            cnt += 1
    elif x*y < 0:
        cnt += 1
    elif x < 0:
        cnt += 2
    print(cnt)
elif abs(x) > abs(y):
    cnt = abs(x)-abs(y)
    if x*y == 0:
        if x > 0:
            cnt += 1
    elif x*y < 0:
        cnt += 1
    elif x > 0:
        cnt += 2
    print(cnt)
else:
    print(1)


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main()
{
	int a,b,k,i,flag=0;
	scanf("%d",&k);
	scanf("%d %d",&a,&b);
	if(a==b&&a%k==0)
	{
		printf("OK");
		return 0;
	}
	for(i=a;i<=b;i++)
	{
		if(i%k==0)
		flag++;
	}
	if(flag==0)
	printf("NG");
	else printf("OK");
	return 0;
} 

Measured memory_bytes: 1732
#include <iostream>

using namespace std;

int main()
{
    int a , b ,c,d ,A1 ,A2 ;
    cin >> a>>b>>c>>d ;
    A1=a*b ;
    A2=c*d ;
    if (A1>A2)
    cout << A1 ;
    else if ( A1<A2)
    cout << A2 ;
    else if ( A1==A2)
    cout << A1 ;


    return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def digit_bin(n):
    cnt = 1
    while n > 1:
        n = n >> 1
        cnt += 1
    return cnt


def main():
    N, K = LI()
    A = LI()
    M = max(K, max(A))
    n = digit_bin(M)
    one_count = [0] * n
    pow2 = [1] * (n+1)

    for i in range(1, n+1):
        pow2[i] = pow2[i-1] * 2

    for a in A:
        i = 0
        while a:
            if a & 1 == 1:
                one_count[i] += 1
            i += 1
            a = a >> 1
    # import pdb
    # pdb.set_trace()
    cur = 0
    ans = 0
    for i in range(n)[::-1]:
        # zero is more
        b = 0
        if one_count[i] <= N - one_count[i]:
            b = 1
            if cur + pow2[i] > K:
                b = 0
        cur += pow2[i] * b
        if b == 1:
            ans += pow2[i] * (N-one_count[i])
        else:
            ans += pow2[i] * one_count[i]

    print(ans)


main()



Measured memory_bytes: 89628
import java.util.Scanner;
import java.util.Stack;
import java.util.TreeSet;

class Main{
	static boolean check(int x) {
		boolean check3 = false, check5 = false, check7 = false, checkother = false;
		while(x > 0) {
			int keta = x % 10;
			if(keta == 3) check3 = true;
			else if(keta == 5) check5 = true;
			else if(keta == 7) check7 = true;
			else checkother = true;
			x /= 10;
		}
		return (check3 && check5 && check7) && !(checkother);
	}
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt();
		/* Generating 753 number */
		TreeSet<Integer> set = new TreeSet<Integer>();
		Stack<Integer> st = new Stack<Integer>();
		st.add(7); st.add(5); st.add(3);
		while(!st.isEmpty()) {
			int now = st.pop();
			if(check(now)) set.add(now);
			if(Integer.toString(now).length() == 9) continue;
			st.push(now * 10 + 3);
			st.push(now * 10 + 5);
			st.push(now * 10 + 7);
		}

		/* Counting 753 number */
		int cnt = 0;
		for(int s : set) {
			if(s <= N) cnt++;
			else break;
		}
		System.out.println(cnt);

	}
}

Measured memory_bytes: 28852
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
    int data[10];
    int i, j, t, max;
 
    for (i = 0; i < 5; i++) scanf("%d", &data[i]);
    for (i = 0; i < 5; i++) {
        max = i;
        for (j = i + 1; j < 5; j++) {
            if (data[j] > data[max]) max = j;
        }
        if (max != i) t = data[i], data[i] = data[max], data[max] = t;
    }
    printf("%d", data[0]);
    for (i = 1; i < 5; i++) printf(" %d", data[i]);
    putchar('\n');
    return 0;
}


Measured memory_bytes: 2048