akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;
typedef vector<int> ivec;

const int MOD=998244353;
int INF=100100100100100;

const int MAX_COL=350;
const int MAX_ROW=350;

struct BitMatrix {
    int H, W;
    bitset<MAX_COL> val[MAX_ROW];
    BitMatrix(int m = 1, int n = 1) : H(m), W(n) {}
    inline bitset<MAX_COL>& operator [] (int i) {return val[i];}
};

int GaussJordan(BitMatrix &A, bool is_extended = false) {
    int rank = 0;
    for (int col = 0; col < A.W; ++col) {
        if (is_extended && col == A.W - 1) break;
        int pivot = -1;
        for (int row = rank; row < A.H; ++row) {
            if (A[row][col]) {
                pivot = row;
                break;
            }
        }
        if (pivot == -1) continue;
        swap(A[pivot], A[rank]);
        for (int row = 0; row < A.H; ++row) {
            if (row != rank && A[row][col]) A[row] ^= A[rank];
        }
        ++rank;
    }
    return rank;
}

int add(int a,int b){
  return (a+b)%MOD;
}
int prod(int a,int b){
  return (a*b)%MOD;
}

int beki(int a,int b)
{
	if(b==0)return 1;
	int x=beki(a,b/2);
	if(b%2==0)return (x*x)%MOD;
	else return (((a*x)%MOD)*x)%MOD;
}

int inv(int a)
{
	return beki(a,MOD-2);
}

int powe[1000];
signed main(){
  int n,m;cin>>n>>m;
  BitMatrix B(n+1, m+1);
  rep(i,n){
    rep(j,m){
      int po;cin>>po;
      B.val[i][j]=po;
    }
  }
  int rk=GaussJordan(B);
  
  rep(i,1000){
    if(i==0)powe[0]=1;
    else powe[i]=prod(powe[i-1],2);
  }
  cout<<prod(powe[m+n],prod(powe[rk]-1,inv(powe[rk+1])))<<endl;
  return 0;
}


Measured memory_bytes: 3708
#include<cstdio>
using namespace std;
int main(void)
{
	int w,h,n;
	int i,j,kyo,ky1;
	int x1,y1,x2,y2,xx,yy;
	scanf("%d %d %d",&w,&h,&n);
	kyo=0;
	scanf("%d %d",&x1,&y1);
	for(i=1;i<n;i++)	{
		scanf("%d %d",&x2,&y2);
		xx=x2-x1;	yy=y2-y1;
		if(xx*yy<0)	{
			if(xx<0)	xx=-xx;
			if(yy<0)	yy=-yy;
			ky1=xx+yy;
			kyo+=ky1;
		}
		else {
			if(xx<0)	xx=-xx;
			if(yy<0)	yy=-yy;
			if(xx>yy)	ky1=xx;
			else 	ky1=yy;
			kyo+=ky1;
		}
		x1=x2;	y1=y2;
	}
	printf("%d\n",kyo);
	return 0;
}


Measured memory_bytes: 1024
#n=int(input())
n,k=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
ans=0
import fractions
newval=n%k
if n>=k:
    if n%k==0:
        ans=0
    else:
        #ans=fractions.gcd(n,k)
        ans=n%k
        templ=[]
        ans=min(ans,abs(ans-k))
else:
    #ans=fractions.gcd(n,k)
    ans=n%k
    ans=min(ans,abs(ans-k))
print(ans)



Measured memory_bytes: 5688
#include <bits/stdc++.h>
using namespace std;
typedef long long int l1;
typedef vector <int> vi;
typedef vector <long long int> v1;
#define pb push_back
#define mp make_pair
#define iter(i,a,b) for(i=a;i<b;i++)

l1 bin(v1 vec, l1 l, l1 r, l1 x)
{
    sort(vec.begin(),vec.end());
 	
    if (r >= l) { 
        l1 mid = l + (r - l) / 2; 
 		if (vec[mid] == x) 
            return mid;       
        if (vec[mid] > x) 
            return bin(vec, l, mid - 1, x);         
        return bin(vec, mid + 1, r, x); 
    } 
    return -1; 
    //index of first equal element returned;
    
}


int main()
{
    ios_base::sync_with_stdio(false);      //for fast cin and cout streams
    cin.tie(NULL);
    cout.tie(NULL);
    
    //THINK..THINK..THINK..nope..EVEN THOSE CORNER CASES
    //DONE ??..NO.!...GO BACK AGAIN NOW..dumbass
    //ALL RIGHT..GOOD TO GO..
    //MAKE IT SYNTACTICALLY CORRECT..though
    
    
    l1 n;
  cin>>n;
  if(n>=30)
    cout<<"Yes";
  else
    cout<<"No";
    
    

return 0;
}






Measured memory_bytes: 3612
#include <iostream>
#include <vector>
using namespace std;
#define rep(n) for (int i = 0; i < (n); ++i)

int main()
{
    int N;
    cin >> N;
    vector<int> P(N);
    rep(N)
    {
        cin >> P[i];
    }
    int cnt = 0;
    rep(N)
    {
        if (P[i] != i + 1)
        {
            cnt++;
        }
    }
    if (cnt == 0 || cnt == 2)
    {
        cout << "YES\n";
    }
    else
    {
        cout << "NO\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n); i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)	
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define REVSORT(c) SORT(c);REVERSE(c)
#define ALL(x) (x).begin(),(x).end()
#define LOOP while(true)
#define INF 1e9
const long long MOD = 1000000007;
typedef long long ll;

int main(void){
	int N, M, X;
	cin >> N >> M >> X;
	vector<int> C(N + 1, 0);
	rep(i, M){
		int a;
		cin >> a;
		C[a]++;
	}
	int cost0 = 0;
	int costN = 0;
	for(int i = 0; i < X; i++) cost0 += C[i];
	for(int i = X; i < N; i++) costN += C[i];
	cout << min(cost0, costN) << endl;
}

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

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

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

//動的計画法で役に立つ関数
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; }

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

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

vector<vector<long long> > comb(int n) {
  vector<vector<long long> > v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll N,M;cin>>N>>M;
    VP A(N+M);
    REP(i,N)
    {
        int a;cin>>a;
        A[i]=paired(a,1);
    }
    REP(i,M)
    {
        int b,c;cin>>b>>c;
        A[i+N]=paired(c,b);
    }
    RSORT(A);
    ll ans=0;
    int N_=N;
    REP(i,N_)
    {
        ans+=(ll)A[i].first*(ll)A[i].second;
        N-=A[i].second;
        if (N<0)
        {
                ans-=(ll)A[i].first*(ll)(-N);
            break;
        }
        // dump(N);
        // dump(ans);
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 1792
#include<cstdio>
using namespace std;
#define N 21
#define M 150001
#define mod 1000000007
int dp1[M],dp2[M],edg[M],f[N][N],a,b,tmp=1,pw[M],n,m;
int main()
{
	scanf("%d%d",&n,&m);
	pw[0]=1;for(int i=1;i<=m;i++)pw[i]=pw[i-1]*2%mod;
	for(int i=1;i<=m;i++)
	scanf("%d%d",&a,&b),f[a][b]=f[b][a]=1,tmp=tmp*2%mod;
	for(int i=0;i<1<<n;i++)
	for(int j=1;j<=n;j++)
	if(i&(1<<j-1))
	for(int k=j+1;k<=n;k++)
	if(i&(1<<k-1))
	if(f[j][k])
	edg[i]++;
	for(int i=1;i<1<<n;i++)
	{
		if(!(i&1))continue;
		dp1[i]=pw[edg[i]];
		for(int j=i-1;j;j=(j-1)&i)
		{
			if(!(j&1))continue;
			dp1[i]=(dp1[i]-1ll*pw[edg[i^j]]%mod*dp1[j])%mod;
		}
	}
	for(int i=1;i<1<<n;i++)
	{
		if(!(i&2))continue;
		dp2[i]=pw[edg[i]];
		for(int j=i-1;j;j=(j-1)&i)
		{
			if(!(j&2))continue;
			dp2[i]=(dp2[i]-1ll*pw[edg[i^j]]%mod*dp2[j])%mod;
		}
	}
	for(int i=1;i<1<<n;i++)
	for(int j=((1<<n)-1)^i;j;j=(j-1)&(((1<<n)-1)^i))
	if(edg[((1<<n)-1)^i]+edg[((1<<n)-1)^j]-edg[((1<<n)-1)^i^j]==m)
	tmp=(tmp-1ll*dp1[i]*dp2[j]%mod*pw[edg[((1<<n)-1)^i^j]]%mod+mod)%mod;
	printf("%d\n",tmp);
}

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

#define int long long
const int MOD = 1000000007LL;

signed main(){

    int n, k; cin >> n >> k;
    vector<vector<int> > dp(n + 1, vector<int> (3 * k + 1, 0LL));
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    dp[0][0] = 1LL;

    for(int i = 0; i < n; i++){
        for(int j = 0; j <= k; j++){

            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j] %= MOD;            
            dp[i + 1][j + a[i] + 1] -= dp[i][j];
            dp[i + 1][j + a[i] + 1] = (dp[i + 1][j + a[i] + 1] + MOD) % MOD;            

        }

        for(int j = 1; j <= 2*k; j++){
            dp[i + 1][j] += dp[i + 1][j - 1];
            dp[i + 1][j] %= MOD;            
        }
    }

    cout << dp[n][k] % MOD << endl;
    return 0;
}

Measured memory_bytes: 239360
#include <iostream>
#include <stack>
#include <unordered_map>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <functional>
#include <iterator>
#include <tuple>
#include <set>

using namespace std;

struct slim {
  int left_split_count;
  int max_value_can_be_used;
};

int main() {
  int n;
  cin >> n;
  vector<int> ss(pow(2,n));

  for (int i = 0; i < pow(2,n); i++) {
    cin >> ss[i];
  }
  sort(ss.begin(), ss.end(), greater<>());

  vector<priority_queue<int>> current_slims(n+1, priority_queue<int>());
  current_slims[n].push(pow(10, 9));

  bool result = true;

  for (const auto& s : ss) {
    bool is_set_s = false;
    // cout << "s: " << s << endl;
    for (int i = n; i >= 0; i--) {
      // cout << "i: " << i << endl;
      if (current_slims[i].empty()) {
        // cout << "continue because empty" << endl;
        continue;
      }

      if (current_slims[i].top() < s) {
        // cout << "continue because too small" << endl;
        continue;
      }
      // cout << "can_set" << endl;

      int value = current_slims[i].top();
      current_slims[i].pop();

      for (int j = 0; j < i; j++) {
        current_slims[j].push(s-1);
      }

      if ((i == current_slims.size()-1) && current_slims[i].empty()) {
        current_slims.pop_back();
      }

      is_set_s = true;
      break;
    }

    if (!is_set_s) {
      result = false;
      break;
    }
  }

  cout << (result ? "Yes" : "No") << endl;
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const string YES = "Yes";
const string NO = "No";
const ll mod = 1e9+7;


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

    ll n,m; cin >> n >> m;
    ll ans = 0;
    priority_queue<ll> que;
    vector<pair<ll,ll>> a(n);
    REP(i,n){
        ll p,q;
        cin >> p >> q;
        a[i] = {p-1,q};
    }
    sort(ALL(a));
    ll j = 0;
    REP(i,m){
        
        while(j<=n-1 && a[j].first <= i){
            que.push(a[j].second);
            j++;
        }
        if(!que.empty()){
            ans += que.top();
            que.pop();
        }
        
    }
    cout << ans;

    return 0;
    
}



Measured memory_bytes: 2936
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define INF 999999999999999997;
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	LL A, B, C;
	cin >> A >> B >> C;
	LL ans = INF;

	LL a1 = A / 2;
	LL a2 = A - a1;
	ans = min(ans, abs(a1*B*C - a2*B*C));
	LL b1 = B / 2;
	LL b2 = B - b1;
	ans = min(ans, abs(A*b1*C - A*b2*C));
	LL c1 = C / 2;
	LL c2 = C - c1;
	ans = min(ans, abs(A*B*c1 - A*B*c2));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define rep(i, n) for (int i = 0; i < n; i = i + 1)
#define MAX 10010
#define MAX_INT 9223372036854775807

int main() {
  long long X[5];
  rep(i, 5) {
    scanf("%lld", X + i);
  }

  short output = 0;
  rep(i, 5) {
    if (X[i] == 0) {
      output = i + 1;
      break;
    }
  }

  printf("%hd\n", output);
  return 0;
}


Measured memory_bytes: 1732
/*
 *   
 *   Date: 07 September 2019
 *   Time: 01:03:00
*/
import java.io.*; 
import java.util.*;


   
 class Main
{   

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int x=sc.nextInt();
        int t=sc.nextInt();
        long a=(long)Math.ceil((double)n/x);
        long b=a*t;
        System.out.println(b);
     
        
       

       
    } 
} 
 
 
 


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

using namespace std;
#define endl "\n"

const int MOD = 1e9 + 7;

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


	int N,M;
	cin >> N >> M;
	if(N > M)
		cout << "No\n";
	else
		cout << "Yes\n";


	return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import qualified Data.Map.Strict             as Map
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

main = do
  n <- getInt

  let readInputs :: Int -> Set.Set Int -> IO (Set.Set Int)
      readInputs i set | i == n = return set
                       | otherwise = do
        a <- getInt
        let set' = if Set.member a set
              then Set.delete a set
              else Set.insert a set
        readInputs (i+1) set'

  set <- readInputs 0 Set.empty

  print $ length $ Set.toList set

Measured memory_bytes: 29052
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    string s;
    cin>>s;
    for(int i=2;i<s.size();i+=2){
        for(int j=0;j<(s.size()-i)/2;j++){
            if(s[j]!=s[j+((s.size()-i)/2)]){
                break;
            }
            if(j==(s.size()-i)/2-1){
            cout<<s.size()-i;
            return 0;
            }
        }
    }
    return 0;
}


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

const int N = 110000;

int a[N];

int main() {
	
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	int n, k; cin >> n >> k;
	for (int i = 1; i <= n; i++) cin >> a[i];
	
	int ans = INT_MAX;
	for (int i = 1; i + k - 1 <= n; i++) {
		int l = i, r = i + k - 1;
		if (a[r] <= 0) ans = min(ans, -a[l]);
		else if (a[l] >= 0) ans = min(ans, a[r]);
		else {
			assert(a[l] <= 0 && a[r] >= 0);
			ans = min(ans, min(-2 * a[l] + a[r], -a[l] + 2 * a[r]));
		}
	}
	cout << ans << "\n";
	
	return 0;
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
long long ans[100005], n;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i=1; n>=i*i; i++){
	for (int j=1; n>=j*j; j++){
		for (int k=1; n>=k*k; k++){
			ans[i*i+j*j+k*k+i*j+i*k+j*k]++;
		}
	}	
}
for (int i=1; i<=n; i++)
	cout << ans[i] << endl;
return 0;
}


Measured memory_bytes: 4068
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int main() {
  int a,b;
  cin>>a>>b;
  double a2 = a;
  double b2 = b;
  printf("%d %d %lf\n",a/b,a%b,a2/b2);
}


Measured memory_bytes: 3224
s=input()
n=len(s)
l=[[] for _ in range(2**(n-1))]
for b in range(2**(n-1)):
    x=b
    for i in range(n-1):
        if x%2==1:
            l[b].append(1)
        else:
            l[b].append(0)
        x//=2
#print(l)
indexes=[[] for _ in range(2**(n-1))]
for k in range(2**(n-1)):
    indexes[k]=[i for i, x in enumerate(l[k]) if x == 1]
#print(indexes)
SUM=0
for j in range(2**(n-1)):
    L=len(indexes[j])
    if L==0:
        SUM+=int(s)
        #print(SUM)
    else:
        SUM+=int(s[:indexes[j][0]+1])
        #print(SUM)
        SUM+=int(s[indexes[j][L-1]+1:])
        #print(SUM)
        if L>1:
            for h in range(L-1):
                SUM+=int(s[indexes[j][h]+1:indexes[j][h+1]+1])
                #print(SUM)
print(SUM)

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
const LL INF = 1e15;

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

  int H, W, N;
  cin >> H >> W >> N;
  vector<vector<PLL>> G(H+W);
  REP(i,N){
	int y, x, a;
	cin >> y >> x >> a;
	--x;
	--y;
	G[y].EB(H+x, a);
	G[H+x].EB(y, a);
  }

  VL dist(H+W, INF);
  function<bool(int,LL&,LL&)> dfs = [&](int u, LL& mx, LL& my){
	if(u < H) mini(my, dist[u]);
	else mini(mx, dist[u]);
	
	for(auto& e: G[u]){
	  if(dist[e.FF] == INF){
		dist[e.FF] = e.SS - dist[u];
		if(!dfs(e.FF, mx, my)) return false;
	  }
	  else{
		if(dist[e.FF] + dist[u] != e.SS)
		  return false;
	  }
	}
	return true;
  };
  
  REP(i,H+W){
	if(dist[i] != INF) continue;
	dist[i] = 0;
	LL mx = INF, my = INF;
	if(!dfs(i, mx, my) || mx+my < 0){
	  cout << "No" << endl;
	  return 0;
	}
  }
  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 21120
#define A[302][602]
W,d A,a,i,j,v,L A;char C A;main(H){for(scanf("%d%d ",&H,&W);W--;a+=v)for(i=1;++j>H?j=i++<H:1;v=d[i][j]=fmin(d[i][j-1],d[i-1][j])+(L[W][i-j+H]+=C[i][W]==C[j][W+1]))i-1||gets(C+j);printf("%d",a);}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <bitset>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(int argc, char **argv){
	int n, s;
	std::bitset<10> b;
	std::vector<int> k;
	int counter = 0;
	int max_num_subset = pow(2, 10);

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif
#if INPUT_FROM_FILE
	while(ifs >> n >> s){
#else
	while(std::cin >> n >> s){
#endif
		counter = 0;
		for(int i = 0; i < max_num_subset; i++){
			b = std::bitset<10>(i);
			if(b.count() == n){
				k.clear();
				for(int j = 0; j < 10; j++){
					if(b.test(j)){
						k.push_back(j);
					}
				}

				do{
					int sum = 0;
					for(int j = 0; j < n; j++){
						sum += (j + 1) * k[j];
					}
					if(sum == s){ counter++; }
				} while(std::next_permutation(k.begin(), k.end()));
			}
		}
		std::cout << counter << std::endl;
	}

 
#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> v;
    string s1, s2;
    cin >> s1 >> s2;
    for(int i = 0; i < n; i++){
        if(s1[i] == s2[i])
            v.push_back(1);
        else {
            v.push_back(2);
            i++;
        }
    } //for(int i = 0; i < v.size(); i++) cout << v[i] << " ";
    const int MOD = 1000000007;
    long long ans = v[0]*3;
    for(int i = 1; i < v.size(); i++){
        if(v[i] != v[i-1]){
            ans = (ans * v[i])%MOD;
        }
        else{
            if(v[i] == 1)ans = (ans * 2)%MOD;
            else ans = (ans * 3)%MOD;
        }
    }
    cout << ans;
}


Measured memory_bytes: 3604
/*
				C++
				encoding: UTF-8
				Last Modified: 29/Aug/20 05:36:43 PM
*/

#include <bits/stdc++.h>
#ifdef H4wk3ye
#	include <prettypr.hpp>
#endif

using namespace std;

#define int int64_t

template < typename T > void print (const T& t) {
	cout << t << '\n';
}

template < typename T, typename U, typename... ARGS >
void print (const T& t, const U& u, const ARGS&... args) {
	cout << t << " ";
	print (u, args...);
}

const int N = 1e3 + 5;
int dp[N][N];
string s, t;

int solve (int i, int j) {
	if (j == t.size ()) return 0;
	if (i == s.size ()) return 1e9;
	int& ans = dp[i][j];
	if (ans != -1) return ans;

	// either make this character same or start from beginning

	if (s[i] == t[j]) {
		ans = min (solve (i + 1, j + 1), solve (i + 1, 0));
	} else {
		ans = min (solve (i + 1, j + 1) + 1, solve (i + 1, 0));
	}
	return ans;
}

signed main () {
	ios_base::sync_with_stdio (false), cin.tie (nullptr);

	cin >> s >> t;
	memset (dp, -1, sizeof dp);

	print (solve (0, 0));

	return 0;
}

Measured memory_bytes: 11572
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    

#define bp __builtin_popcountll
#define inf 1e15
    
const int N=1e6+5;
const int M=1e9+7;
void solve()
{
	int m1,d1,m2,d2;
	cin>>m1>>d1>>m2>>d2;
	int a[]={31,28,31,30,31,30,31,31,30,31,30,31};
	int pp=a[m1-1];
	if(d1>=pp) cout<<1;
	else cout<<0;
}
signed main()  
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": ";
    	solve();
    }
}


Measured memory_bytes: 256
N, M = map(int, input().split())
student = [list(map(int, input().split())) for _ in range(N)]
check = [list(map(int, input().split())) for _ in range(M)]

for s in student:
    dist = float('inf')
    ans = 0
    for i, c in enumerate(check):
        tmp = abs(s[0]-c[0]) + abs(s[1]-c[1])
        if tmp<dist:
            ans = i+1
            dist = tmp
    print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int main()
{
    char num;
    int sum, i;

    for (;;)
    {
        sum = 0;
        for (;;)
        {
            int tmp;
            scanf("%c", &num);
            if (num == '\n')
            {
                printf("%d\n", sum);
                break;
            }
            else
            {
                tmp = num - '0';
                sum += tmp;
            }
            if (sum == 0)
            {
                return 0;
            }
        }
    }
    return (0);
}


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

int main(void){
    int n,K; cin>>n>>K;
    int ans = 0;
    vector <int> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    for(int i=0;i<=min(K,n);i++){
        for(int j=0;j<=(min(K,n)-i);j++){
            int cnt =0,done = 0;
            priority_queue <int, vector <int>, greater <int> > q;
            int k=-1;
            //if(i==1&&j==2) cout<<"ilove"<<endl;
            for( k=0;k<i;k++){
                q.push(v[k]);
                done++;
                //cout<<'+'<<v[k]<<endl;
            }
            k--;
            for(int l=0;l<j;l++){
                if(v.size()-1-l==k) break;
                q.push(v[v.size()-1-l]);
                done++;
                //cout<<'+'<<v[v.size()-1-l]<<endl;
            }
            int rest = K-i-j;
            while(rest>0&&q.size()!=0){
                int a = q.top(); q.pop();
                if(a>=0) { q.push(a); break;}
                rest--; done++; //cout<<a<<endl;
            }
            //cout<<"nonnon"<< done<<endl;
            while(!q.empty()){
                int a = q.top(); q.pop();
                cnt+= a;
            }
            //cout<<cnt<<endl;
            ans = max(ans,cnt);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

const int MAX_V = 1e5;
vector<int> es[MAX_V];
int flag = 0;
vector<int> path;
bool used[MAX_V];

//gとnowを結ぶパスをpathに収納
void dfs1(int now, int g, int par){
    if(now == g){
        flag++;
        path.pb(now);
    }
    else{
        for(auto &e: es[now]){
            if(e != par){
                dfs1(e, g, now);
                if(flag){
                    path.pb(now);
                    break;
                }
            }
        }
    } 
}

int dfs2(int now){
    used[now] = true;
    int sum = 1;
    for(auto &e: es[now]){
        if(used[e]) continue;
        sum += dfs2(e);
    }
    return sum;
}

int main(){
    int N;
    cin >> N;
    rep(i, N-1){
        int u, v; cin >> u >> v; u--, v--;
        es[u].pb(v), es[v].pb(u);
    }
    fill(used, used+N, false);
    dfs1(N-1, 0, -1);
    for(auto &e: path) used[e] = true;
    int n = path.size();
    int F = 0, S = 0;
    rep(i, (n+1)/2){
        F += dfs2(path[i]);
    }
    rep2(i, (n+1)/2, n-1){
        S += dfs2(path[i]);
    }
    //cout << F << ' ' << S << endl;
    if(F > S) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;
}

Measured memory_bytes: 12668
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static long x = sc.nextLong();
    //65まで持っていればいい
    //65の5乗が10の9乗を超えとこ
    static long num[] = new long[123];

    public static void main(String[] args) {
        int i = -1;
        while (++i < num.length){
            if (i == 0) {
                num[0] = 0;
                continue;
            }
            num[i] = (long)Math.pow(i, 5);
        }
        for (int j = 0; j < num.length; j++){
            for (int k = 0; k < num.length; k++){
                if (num[j] - num[k] == x){
                    System.out.println(j + " " + k);
                    return;
                } else if ( - num[j] - num[k] == x){
                    System.out.println(-j + " " + k);
                    return;
                } else if ( num[j] + num[k] == x){
                    System.out.println(j + " " +  -k);
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 38604
#include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<set>
#include<stack>
#include<cstring>
#include<map>
#include<vector>
#define ll long long int
using namespace std;
const ll mod=1000000007;
ll powx(ll a,ll b)
{
    ll ans=1,base=a;
    while(b)
    {
        if(b%2==1)
            ans=(ans*base)%mod;
        base=(base*base)%mod;
        b/=2;
    }
    return ans;

}
int main()
{
 set<ll> s;
 ll sum=0,n;
 cin>>n;
 ll i,t,check=0;
 for(i=0;i<n;i++)
 {
     cin>>t;
     if(t!=0&&s.find(t)!=s.end())
        sum++;
    else if(t!=0)
        s.insert(t);
    else
        check=1;
 }
 if(n%2==0)
 {
     if(sum!=s.size())
     {
         cout<<0;
     }
     else
     {
         cout<<powx(2,sum);

     }
 }
 else
 {
     if(check==1&&sum==n/2)
     {
         cout<<powx(2,sum);
     }
     else
        cout<<0;
 }
}


Measured memory_bytes: 3200
#include <bits/stdc++.h> 
using namespace std; 
#define MODULO 1000000007
#define ull long long int
int f;
#define  forn(i, n)  for (int i = 0; i < int(n); i++)
int main(){
    int n,a;
    cin>>n>>a;
    n<a?cout<<"0":cout<<10;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define RI register int

using namespace std;

typedef long long LL;
typedef vector < pair <LL, LL> > vpii;

int const MAXN = 2e5 + 5;
vpii V[MAXN], G[MAXN];
LL l, r = 1e11, mid, ans;

inline bool cmpb(const pair <LL, LL> &a, const pair <LL, LL> &b) { return a.second < b.second; }
inline bool cmpa(const pair <LL, LL> &a, const pair <LL, LL> &b) { return a.first < b.first; } 

inline void Merge(vpii &nw, vpii &lc, vpii &rc) {
  nw.clear();
  if (lc.size() > rc.size()) swap(lc, rc);
  LL sizel = lc.size(), sizer = rc.size(), now, Min;
  sort(lc.begin(), lc.end(), cmpb);
  sort(rc.begin(), rc.end(), cmpa);
  now = 0, Min = 0x7f7f7f7f7f7f7f7f;
  for (RI i = sizel - 1; ~i; --i) {
  	while (now < sizer && lc[i].second + rc[now].first <= mid)
  	  Min = min(Min, rc[now].second), ++now;
  	if (now) nw.push_back(make_pair(lc[i].first, Min));
  }
  sort(lc.begin(), lc.end(), cmpa);
  sort(rc.begin(), rc.end(), cmpb);
  now = 0, Min = 0x7f7f7f7f7f7f7f7f; 
  for (RI i = sizel - 1; ~i; --i) {
  	while (now < sizer && lc[i].first + rc[now].second <= mid)
	   Min = min(Min, rc[now].first), ++now;
  	if (now) nw.push_back(make_pair(Min, lc[i].second));
  }
  lc.clear(), rc.clear();
}

void Dfs(int now) {
  if (G[now].empty())
    return V[now].push_back(make_pair(0, 0)), void();
  Dfs(G[now][0].first), Dfs(G[now][1].first);
  for (auto &i : V[G[now][0].first])
    i.first += G[now][0].second, i.second += G[now][0].second;
  for (auto &i : V[G[now][1].first])
    i.first += G[now][1].second, i.second += G[now][1].second;
  Merge(V[now], V[G[now][0].first], V[G[now][1].first]);
}

bool Check(LL k) {
  Dfs(1);
  return !V[1].empty();
}

int main() {
  
  ios :: sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n; cin >> n;
  for (RI i = 2, x, y; i <= n; ++i) {
    cin >> x >> y;
    G[x].push_back(make_pair(i, y));
  }
  while (l <= r) {
    mid = (l + r) >> 1;
    if (Check(mid)) r = mid - 1, ans = mid;
    else l = mid + 1;
  }
  cout << ans << endl;
    
  return 0;
}

Measured memory_bytes: 32760
#include <vector>
#include <iostream>
#include <algorithm>
#define INF (1LL << 60)
using namespace std;
int n, u[2], mode, tar; long long d, x[30], y[30], ret, seg[16777216], val[14348907]; pair<long long, long long> t[2][14348907];
inline void rec(int pos, long long a, long long b) {
	if (pos == tar) {
		if(b <= 0) t[mode][u[mode]++] = make_pair(a, b);
		return;
	}
	rec(pos + 1, a + x[pos], b + y[pos]);
	rec(pos + 1, a - x[pos], b - y[pos]);
	rec(pos + 1, a, b);
}
inline long long query(int a, int b, int k, int l, int r) {
	if (r <= a || b <= l) return INF;
	if (a <= l && r <= b) return seg[k];
	long long lch = query(a, b, k << 1, l, (l + r) >> 1);
	long long rch = query(a, b, (k << 1) + 1, (l + r) >> 1, r);
	return min(lch, rch);
}
int main() {
	scanf("%d%lld", &n, &d);
	for (int i = 0; i < n; i++) scanf("%lld%lld", &x[i], &y[i]);
	mode = 0; tar = n / 2; rec(0, 0, 0);
	mode = 1; tar = n; rec(n / 2, 0, 0);
	sort(t[1], t[1] + u[1]);
	for (int i = 0; i < u[1]; i++) val[i] = t[1][i].first;
	for (int i = 0; i < u[1]; i++) seg[i + 8388608] = t[1][i].second;
	for (int i = u[1]; i < 8388608; i++) seg[i + 8388608] = INF;
	for (int i = 8388608; i >= 1; i--) seg[i] = min(seg[2 * i], seg[2 * i + 1]);
	for (int i = 0; i < u[0]; i++) {
		int pl = lower_bound(val, val + u[1], -t[0][i].first - d) - val;
		int pr = upper_bound(val, val + u[1], -t[0][i].first + d) - val;
		long long res = query(pl, pr, 1, 0, 8388608);
		ret = max(ret, -t[0][i].second - res);
	}
	printf("%lld\n", ret);
	return 0;
}

Measured memory_bytes: 414528
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {

    string s;
    cin>>s;

    rep(i,s.size()-1){
        if(s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2<<endl;
            return 0;

        }else if(i+2<s.size()&&s[i]==s[i+2]){
            cout<<i+1<<" "<<i+3<<endl;return 0;
        }
    }
    cout<<-1<<" "<<-1<<endl;

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
using namespace std;
typedef vector<vector<int>> graph;

int dfs(int v, vector<bool> visited, graph& g) {
  visited[v] = true;

  bool flag = true;
  for (int b : visited) {
    if (!b) flag = false;
  }
  if (flag) return 1;

  int res = 0;
  for (int u : g[v]) {
    if (!visited[u]) {
      res += dfs(u, visited, g);
    }
  }
  return res;
}

int main() {
  int n, m;
  cin >> n >> m;
  graph g(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vector<bool> visited(n, false);
  cout << dfs(0, visited, g) << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = 10**9

n = int(input())
ok = False
for i in range(1, 10):
    for j in range(1, 10):
        if n == i*j:
            ok = True
if ok:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
const int INF = 1e9;
const int MODk = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    int N;cin >> N;
    vector<int> vec;
    for(int a = 0;a < N;a++){
        int b;cin >> b;
        vec.push_back(b);
    }
    vector<int> ruiseki;
    ruiseki.push_back(0);
    for(int a = 0;a < N;a++){
        ruiseki.push_back(ruiseki.back()+vec.at(a));
    }
    int ans = INF;
    ruiseki.erase(ruiseki.begin());
    for(int a = 0;a < N-1;a++){
        ans = min(ans, abs(ruiseki.back()-ruiseki.at(a)-ruiseki.at(a)));
     //   cout<<a<<" "<<ans<<endl;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

int main(void)
{
    //string a,b;
    int a,b,c,d;
    //char a,b,c;
    int i=0;
    //char a,b='.';
    cin>>a>>b>>c>>d;
    if(abs(c-a)<=d||(abs(c-b)<=d&&abs(b-a)<=d)) cout<<"Yes";
    else cout<<"No";
    return 0;
}



Measured memory_bytes: 888
#include <iostream>
using namespace std;
int main(){
  string s;cin>>s;
  int a = 0;
  int b = 0;
  for(int i = 0; s.size() > i; i++){
    a = a*10 + s[i]-'0';
    b += s[i]-'0';
  }
  if(a%b){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a[3],i,j;
  for(i=0;i<3;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<2;i++){
    for(j=0;j<2-i;j++){
      if(a[j]>a[j+1]){
	int temp =a[j];
	a[j]=a[j+1];
	a[j+1]=temp;
      }
    }
  }
  printf("%d %d %d\n",a[0],a[1],a[2]);
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string s;cin >> s;
  sort(all(s));
  YesNo(s[2] != 'A' && s[0] != 'B');
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <cstring>

using namespace std;

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

int add[1000];
int notz[1000];
vector<char> cs;
bool used[10];

int dfs(int k, int cur){
    if(k==(int)cs.size()){
        return cur==0 ? 1 : 0;
    } else {
        int ans = 0;
        rep(i,10){
            // if(used[i] || (notz[(int)cs[k]]) continue;
            if(used[i] || (notz[(int)cs[k]] && i==0)) continue;
            used[i] = true;
            ans += dfs(k+1, cur + i*add[(int)cs[k]]);
            used[i] = false;
        }
        return ans;
    }
}

int main(){
    int n;
    while(cin >> n && n){
        rep(i,1000) add[i] = notz[i] = used[i] = 0;
        cs.clear();
        rep(i,n){
            string s;
            cin >> s;
            int dig = 1;
            rep(j,s.size()){
                int c = s[s.size()-1-j];
                add[c] += dig*(i==n-1 ? -1 : 1);
                dig *= 10;
                cs.push_back(c);
            }
            if(s.size()!=1) notz[(int)s[0]] = true;
        }
        sort(cs.begin(), cs.end());
        cs.erase(unique(cs.begin(), cs.end()), cs.end());
        int ans = dfs(0,0);
        cout << ans << endl;
    }
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; //intじゃ扱えないことに注意！
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意！

int main() {
  ll X;
  cin >> X;

  
  for(int i = X; i <= 100003; i++){
    bool flag = true;
    for(int j = 2; j*j <= i; j++){
      if(i % j == 0){
        flag = false;
        break;
      }
    }
    if(flag){
      cout << i << endl;
      break;
    }
  }

}

Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    rep(i,3){
        if(s[i]=='1'){
            cout << 9;
        }
        else{
            cout << 1;
        }
    }


    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long s = Long.parseLong(sc.next());
        int a = 1000000000;

        System.out.println("0 0 " + a + " 1 " + (a-s%a)%a + " " + ((s-1) / a + 1));
	}
}


Measured memory_bytes: 21972
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        struct Process_t
        {
            internal string name;
            internal int time;
        }

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int n = int.Parse(input[0]);
            int q = int.Parse(input[1]);
            
            Queue<Process_t> processes = new Queue<Process_t>();
            Process_t temp;

            for(int i = 0; i < n; i++)
            {
                input = Console.ReadLine().Split(' ');

                temp.name = input[0];
                temp.time = int.Parse(input[1]);
                processes.Enqueue(temp);
            }

            StringBuilder sb = new StringBuilder();
            int sumTime = 0;

            while (processes.Count > 0)
            {
                temp = processes.Dequeue();

                if (temp.time > q)
                {
                    sumTime += q;
                    temp.time -= q;
                    processes.Enqueue(temp);
                }
                else
                {
                    sumTime += temp.time;
                    sb.AppendLine(temp.name + " " + sumTime);
                }
            }

            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 18608
# coding: utf-8
N, M = list(map(int, input().split()))
l = [0 for _ in range(M)]
for _ in range(N):
    s = list(map(int, input().split()))
    for i in s[1:]:
        l[i - 1] += 1
ans = 0
for i in l:
    if i == N:
        ans += 1
print(ans)


Measured memory_bytes: 3060
import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    -- 文字列の入力
    s <- filter (`elem` ['0'..'9']) <$> getLine
    let ps = subsequences [1..(length s - 1)]
    -- 出力
    putStrLn . show $ solve s ps

solve :: String -> [[Int]] -> Integer
solve s = sum . map (sum . map read . mulSplit s)

mulSplit :: String -> [Int] -> [String]
mulSplit s [] = [s]
mulSplit s (i:ix) = (take i s) : (mulSplit (drop i s) (map (subtract i) ix))


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
int main() {
    string S; cin>>S;
    int size=S.size();
    int s1,s2,s3;
    int minimum=999999;
    for(int i=0;i<size-2;i++){
        int sa=0;
        s1=S[i]-'0';
        s2=S[i+1]-'0';
        s3=S[i+2]-'0';
        sa=abs(753-(s1*100+s2*10+s3));
        minimum=min(sa,minimum);
    }
    cout<<minimum;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

/***
 * 0S1 - 13... 0 - 12 ... + -1
 * 1H1 - 13... 13 - 25 ... + 12
 * 2C1 - 13... 26 - 38 ... + 25
 * 3D1 - 13... 39 - 51 ... + 38
 */

public class Main {
    public static void main(String[] args) {
        boolean[] findedCard = new boolean[52];
        Scanner scan = new Scanner(System.in);
        int num = Integer.parseInt(scan.next());

        for (int i = 0; i < 52; i++) {
            findedCard[i] = false;
        }

        for (int i = 0; i < num; i++) {
            String suit;
            int buf1, buf2;

            suit = scan.next();
            buf1 = Integer.parseInt(scan.next());

            if (suit.equals("S")) {
                buf2  = buf1 - 1;
            } else if (suit.equals("H")) {
                buf2 = buf1 + 12;
            } else if (suit.equals("C")) {
                buf2 = buf1 + 25;
            } else {
                buf2 = buf1 + 38;
            }
            findedCard[buf2] = true;
        }

        for (int i = 0; i < 52; i++) {
            if (!findedCard[i]) {
                int div, mod;
                div = i / 13;
                mod = i % 13 + 1;
                if (div == 0) {
                    System.out.println("S " + mod);
                } else if (div == 1) {
                    System.out.println("H " + mod);
                } else if (div == 2) {
                    System.out.println("C " + mod);
                } else {
                    System.out.println("D " + mod);
                }
            }
        }

    }
}



Measured memory_bytes: 26160
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int K;
	bool flag[1000000]={0};
	int ans=1;
	int sur;
	cin>>K;
	sur=7%K;
	while(true){
		if(sur==0)break;
		if(flag[sur]){ans=-1;break;}
		flag[sur]=true;
		sur=(sur*10+7)%K;
		ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4652
a,b,x = map(int,input().split())
import math

if a*a*b/2 >= x:
  c = 2 *x/(a*b)
  rad = math.atan(b/c)
else:
  x = a*a*b-x
  c = 2*x/(a*a)
  rad = math.atan(c/a)

print(rad * 180 / math.pi)

Measured memory_bytes: 3060