akhauriyash/Code-Regression huggingface dataset:
public class Main {


  private static void solve() {
    long n = ni();
    
    long now = 0;
    long ret = 0;
    for (int i = 0; i < 40; i ++) {
      long b = (1L << i) * (i % 2 == 0 ? 1 : -1);
      long c = (1L << (i + 1)) * (i % 2 == 0 ? -1 : 1);
      long k = 1L << (i + 1);
      if ((now + b) % k == n % k || (now + b + c) % k == n % k) {
        now += b;
        ret |= 1L << i;
      }
    }
    
    StringBuilder sb = new StringBuilder();
    boolean flg = false;
    for (int i = 40; i >= 0; i --) {
      if ((ret & (1L << i)) != 0) {
        sb.append(1);
        flg = true;
      } else if (flg) {
        sb.append(0);
      }
    }
    if (sb.length() == 0) {
      sb.append(0);
    }
    System.out.println(sb);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
 
int main(void){ 
  int n;
  int i,j;
  string s ="No";
  vector<int> a(9);
  vector<bool> t(9,false);
  rep(i,9){
    cin>>a.at(i);
  }
  cin>>n;
  int b;
  rep(i,n){
    cin>>b;
    rep(j,9){
      if(a.at(j)==b)t.at(j)=true;
    }
  }
  
  rep(i,3)if((t.at(i*3)&&t.at(i*3+1))&&t.at(i*3+2)){s="Yes";}
  rep(i,3)if((t.at(i)&&t.at(i+3))&&t.at(i+6)){s="Yes";}
  if((t.at(0)&&t.at(4))&&t.at(8)){s="Yes";}
  if((t.at(2)&&t.at(4))&&t.at(6)){s="Yes";}
  cout<<s;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;


void yes(){
   cout<<"Yes";
   // exit(0);
}

void no(){
   cout<<"No";
   // exit(0);
}


int n, m;
string s, t;
map<pair<int, int>, int> M;

int32_t main(){_
   
   cin >> n >> m;

   vector<pair<int, int>> rows(n), cols(m);

   for (int i = 0; i < n; ++i)
   {
      rows[i].second = i;
   }

   for (int i = 0; i < m; ++i)
   {
      cols[i].second = i;
   }

   int q;
   cin >> q;
   for (int i = 0; i < q; ++i)
   {
      int x, y;
      cin >> x >> y;
      --x, --y;
      M[{x, y}] = 1;
      rows[x].first++;
      cols[y].first++;
   }

   sort(rows.rbegin(), rows.rend());
   sort(cols.rbegin(), cols.rend());

   int ans = 0;
   for(auto i: rows){
      for(auto j: cols){
         int d = M.count({i.second, j.second});
         smax(ans, i.first + j.first - d);
         if(d == 0)
            break;
      }
   }

   cout<<ans;

   return 0;
}

Measured memory_bytes: 31424
n = int(input())
v = list(map(int,input().split()))

v_e_cnt = [0 for i in range(10**6)]
v_o_cnt = [0 for i in range(10**6)]
for x in range(n):
	if x % 2 == 0:
		v_e_cnt[v[x]] += 1
	else:
		v_o_cnt[v[x]] += 1

max_e = [(0,0),(0,0)]
max_o = [(0,0),(0,0)]
for i in range(10**5+1):
	if max_e[1][0] < v_e_cnt[i]:
		if max_e[0][0] < v_e_cnt[i]:
			max_e[1] = max_e[0]
			max_e[0] = (v_e_cnt[i], i)
		else:
			max_e[1] = (v_e_cnt[i], i)
	if max_o[1][0] < v_o_cnt[i]:
		if max_o[0][0] < v_o_cnt[i]:
			max_o[1] = max_o[0]
			max_o[0] = (v_o_cnt[i], i)
		else:
			max_o[1] = (v_o_cnt[i], i)

ans = n - max_e[0][0] - max_o[0][0]
if max_e[0][1] == max_o[0][1]:
	ans = n - max(max_e[0][0] + max_o[1][0], max_e[1][0] + max_o[0][0])

print(ans)


Measured memory_bytes: 26468
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;
const int INF = 1e9;
const int MXN = 0;
const int MXV = 0;
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define FOR(i, L, R) for (int i = L; i != (int)R; ++i)
#define FORD(i, L, R) for (int i = L; i != (int)R; --i)
#define IOS                                                                    \
    cin.tie(nullptr);                                                          \
    cout.tie(nullptr);                                                         \
    ios_base::sync_with_stdio(false);

int main()
{
    IOS;
    int n, x;
    cin >> n;
    bool ok = true;
    FOR(i, 0, n)
    {
        cin >> x;
        if (x % 2 == 0 && x % 3 != 0 && x % 5 != 0)
        {
            ok = false;
        }
    }
    if (ok)
    {
        cout << "APPROVED\n";
    }
    else
    {
        cout << "DENIED\n";
    }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

N = int(input())
count = 0
for i in range(N+1):
    if i % 2 == 1:
        count += 1

print(count / N)

Measured memory_bytes: 3316
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val H, W = sc.nextInt()
  val canvas = List.fill(H)(sc.next().toCharArray)
  val udlr = Seq((0, 1), (0, -1), (-1, 0), (1, 0))

  def hasContinuation(x: Int, y: Int): Boolean = {
    udlr.collect {
      case (i, j) if 0 <= i + x && i + x < H && 0 <= j + y && j + y < W => (i + x, j + y)
    }.exists { case (x, y) => canvas(x)(y) == '#' }
  }

  val hasContinuationAll = (for {
    x <- 0 until H
    y <- 0 until W
  } yield x -> y).forall { case (x, y) =>
    if (canvas(x)(y) == '.') true
    else hasContinuation(x, y)
  }
  println(if (hasContinuationAll) "Yes" else "No")
}


Measured memory_bytes: 55488
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
int main(){
  int n, ans=0;
  cin >> n;
  for(int i = 1; i <= n; i++){
    ans+=i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> n;
	i=0;
	while(n>0) {
		n--;
		s += 'a' + n%26; 
		n /=26;
	}
	for(i=s.size()-1;i>=0;i--)
	cout << s[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 3624
#define PI 3.14159265
 
#include <stdio.h>
#include <math.h>
 
int main() 
{
	double a,b,C,c;
	double S,L,h;


	scanf("%lf %lf %lf",&a,&b,&C);

	C=C*PI/180;
	S=a*b*sin(C)/2;
	c=sqrt(a*a+b*b-2*a*b*cos(C));
	L=a+b+c;
	h=b*sin(C);

	printf("%f\n%f\n%f\n",S,L,h);

	return  0;
}

Measured memory_bytes: 672
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#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-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353; constexpr int MAX = 2000020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;


void solve() {
	ll N; cin >> N;
	ll ans = 1e18;
	for (int i = 1; i*i <= N; i++) {
		if (N%i == 0) {
			chmin(ans, i + N / i - 2);
		}

	}
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 256
/* ~created by Roh@n M@he$hwari~ */

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	int n,i,j,k;
	cin>>n>>k;
	int dp[n],h[n];
	for(i=0;i<n;i++) {
		cin>>h[i];
		dp[i]=INT_MAX;
	}
	dp[0]=0,dp[1]=abs(h[1]-h[0]);
	for(i=2;i<n;i++)
		for(j=k;j>0;j--)
		{
			if(i-j>=0) 
				dp[i]=min(dp[i-j]+abs(h[i]-h[i-j]),dp[i]);
		}
//	for(i=0;i<n;i++) cout<<dp[i]<<" ";
	cout<<dp[n-1]<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define repf(i, x, n) for (int i = (int)(x); i < (int)(n); i++)
#define repfr(i, x, n) for (int i = (int)(x)-1; i >= (int)(n); i--)
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline void in(T &a) { cin >> a; }
template <class T, class U> inline void in(T &a, U &b) { cin >> a >> b; }
template <class T, class U, class V> inline void in(T &a, U &b, V &c) {
  cin >> a >> b >> c;
}
template <class T> inline void out(T a) { std::cout << a << endl; }
template <class T, class U> inline void out(T a, U b) {
  cout << a << ' ' << b << endl;
}
template <class T, class U, class V> inline void out(T a, U b, V c) {
  cout << a << ' ' << b << ' ' << c << endl;
}
#define inf 1e9
using ll = int64_t;

void Main() {
  int x;
  in(x);
  out(x * x * x);

  return;
}

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



Measured memory_bytes: 3112
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
void print(vector<int>vec,int n){
    for(int i=0;i<n;i++){
        cout<<vec[i]<<" ";
    }
}

bool isPrime(int n){
    
    int i;
    for( i=2;i<=sqrt(n);i++){
        if(!(n%i)){
            break;
        }
    }
    if(i<=sqrt(n)){
        return 0;
    }
    return 1;
}

int nextPrime(int N){
    bool x = 0;
    int i=1;
    while(!x){
        if(isPrime(N+i)){
            x=1;
        }
        i++;
    }
    return N+i-1;
}

int main()
{
    int n;
    cin>>n;
    bool a = isPrime(n);
    if(a){
        cout<<n<<endl;
    }
    else{
        cout<<nextPrime(n)<<endl;
    }
    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;
using namespace std;

#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl

ll n, cnt, ans, a[ohara], b[ohara], c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k;
ld doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge
{
    int to, cost;
};
vector<ll> g[ohara];
map<pair<ll,ll>,ll> mp;

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>m;
    rep(i,m)cin>>a[i]>>b[i];
    rep(i,m){
        a[i]--;b[i]--;
        mp[{a[i],b[i]}]=1;
        mp[{b[i],a[i]}]=1;
    }
    vector<ll> p(n);
    rep(i,n)p[i]=i;
    do{
        if(p[0]!=0)continue;
        int ok=0;
        rep(i,n-1){
            if(mp[{p[i],p[i+1]}]==0)ok=1;
        }
        int kazo[n+10]={};
        rep(i,n)kazo[p[i]]++;
        rep(i,n){
            if(kazo[i]!=1)ok=1;
        }
        if(ok)continue;
        tmp=mp[{0,1}];
        ans++;
    }while(next_permutation(all(p)));
    Cout(ans);
    return 0;
}


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

int main() {
	string x;
	int t=0;
	cin>>x;
	int ccc=0;
	long long int sum=0;
	for(int i=0;i<x.size();i++){
		if(x[i]=='B'){
			ccc=1;
			break;
		}
	}
	if(ccc==1){
		for(int j=0;j<x.size();j++){
			if(x[j]=='W'){
				sum+=j-t;
				t++;
			}
		}
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する

int main(){
    string sa,sb,sc;
    cin>>sa>>sb>>sc;
    int turn = 0;
    int na,nb,nc;
    na = sa.length();
    nb = sb.length();
    nc = sc.length();
    int ta=0,tb=0,tc=0;
    while(1){
        
        
       
        if(turn==0){
            if(ta==na){cout<<'A'<<endl;return 0;}
            turn = sa[ta]-'a';
            ta++;
        }
        else if(turn==1){
            if(tb==nb){cout<<'B'<<endl;return 0;}
            turn = sb[tb]-'a';
            tb++;
        }
        else{
            if(tc==nc){cout<<'C'<<endl;return 0;}
            turn = sc[tc]-'a';
            tc++;
        }
    }
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int m;
    std::cin >> m;
    int w[] { 0, 8, 9, 2, 11, 12, 3, 14, 15 };
    i64 ret = 0;
    std::deque<int> v;
    for (int i = 0; i < m; i++) {
        int d;
        i64 c;
        std::cin >> d >> c;
        if (d == 0) {
            ret += c - 1;
            v.push_back(0);
        } else if (d == 9) {
            ret += 2 * (c - 1);
            v.push_back(9);
        } else if (d % 3 == 0) {
            i64 b = c / 3;
            if (b) ret += b * w[d] + 2 * (b - 1);
            i64 rem = c % 3;
            if (b) v.push_back(9);
            for (int i = 0; i < rem; i++) v.push_back(d);
        } else {
            i64 b = c / 9;
            if (b) ret += b * w[d] + 2 * (b - 1);
            i64 rem = c % 9;
            if (b) v.push_back(9);
            for (int i = 0; i < rem; i++) v.push_back(d);
        }
    }
    while (v.size() > 1) {
        int a = v.front();
        v.pop_front();
        int b = v.front();
        v.pop_front();
        int c = a + b;
        if (c >= 10) {
            v.push_front(c % 10);
            v.push_front(c / 10);
        } else {
            v.push_front(c);
        }
        ret++;
    }

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 3200
//ID:computerbox --> Hajiyev Huseyn
#include <bits/stdc++.h>
#define FAST_READ ios_base::sync_with_stdio(false);
#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define COUT(n, a) cout<< fixed << setprecision(a) << n<<endl
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl
#define DTIME(ccc) __begin = clock(); ccc; cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<endl;
#define MAXN 200010

using namespace std;

ll X,t;

int main(){
FAST_READ;
cin>>X>>t;
if(X>t)
{
	cout<<X-t<<endl;
}
else if(X==t)
{
	cout<<0<<endl;
}
else
{
	cout<<0<<endl;
}






return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

int N, M, K, Q, W, H, R, C;
vector<int> p;
vector<int> podd;
int dp[1100000], dp2[1100000];

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

    int id = 1;
    int v = id * (id + 1) * (id + 2) / 6;
    while (v < 1010000) {
        p.push_back(v);
        if (v % 2 == 1) podd.push_back(v);
        id++;
        v = id * (id + 1) * (id + 2) / 6;
    }

    REP(i, 1010000) { dp[i] = INF; }
    dp[0] = 0;
    REP(i, 1010000) {
        REP(j, (int)p.size()) {
            if (i - p[j] < 0) break;
            chmin(dp[i], dp[i - p[j]] + 1);
        }
    }

    REP(i, 1010000) { dp2[i] = INF; }
    dp2[0] = 0;
    REP(i, 1010000) {
        REP(j, (int)podd.size()) {
            if (i - podd[j] < 0) break;
            chmin(dp2[i], dp2[i - podd[j]] + 1);
        }
    }

    while (true) {
        int n;
        cin >> n;
        if (n == 0) break;
        cout << dp[n] << " " << dp2[n] << endl;
    }
    return 0;
}



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

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

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

/*他のライブラリを入れる場所*/
constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,m;
    cin>>n>>m;
    
    Yn(n==m);
}


Measured memory_bytes: 256
using System;
namespace inonoa{
    class INo{
        static void Main(){
            string[] n_k = Console.ReadLine().Split();
            int n = int.Parse(n_k[0]);
            int k = int.Parse(n_k[1]);
            string[] sa = Console.ReadLine().Split();
            int[] kosuu = new int[n+1];
            int[] kosuugotonosyurui = new int[n+1];
            int syurui = 0;
            int ai;
            for(int i=0;i<n;i++){
                ai = int.Parse(sa[i]);
                kosuu[ai] ++;
                if(kosuu[ai]==1){syurui++;}
                kosuugotonosyurui[kosuu[ai]]++;
                kosuugotonosyurui[kosuu[ai]-1]--;
            }

            /*
            for(int i=0;i<n+1;i++){
                Console.Write(kosuu[i].ToString()+",");
            }
            Console.Write("\n");
            for(int i=0;i<n+1;i++){
                Console.Write(kosuugotonosyurui[i].ToString()+",");
            }
            Console.Write("\n");
            Console.WriteLine(syurui);*/

            if(syurui<=k){Console.WriteLine(0);return;}
            int ans = 0;
            for(int i=1;i<n+1;i++){
                if(syurui - kosuugotonosyurui[i]>k){
                    ans += kosuugotonosyurui[i]*i;
                    syurui-=kosuugotonosyurui[i];
                }else{
                    while(true){
                        ans += i;
                        syurui--;
                        if(syurui==k){Console.WriteLine(ans);return;}
                    }
                }
            }

        }
    }
}

Measured memory_bytes: 36060
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    string s,t,tmp,ans="No";
    cin>>s>>t;
    REP(i,s.size()){
        if(s==t){
            ans="Yes";
            break;
        }
        s=s.back()+s.substr(0,s.size()-1);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
a, b = map(int, input().split())
"""
bit ごとにみる
b-a = even and a%2 == 0 => 1
else: 0

（0 ~ b madeno 個数）－　（0 ~ a-1 madeno 個数）
1の位は (b+1)/2
10の位は (b+1)/4 + max((b+1)%4-2,0)
100の位
"""

ans = 0
# 0からbまでのxor
if b % 2 == 1:
    ans = (b + 1) // 2 % 2
else:
    ans = b ^ (b // 2 % 2)

# 0からa-1までのxorを掛ける
if a == 0:
    print(ans)
else:
    tmp = 0
    if (a - 1) % 2 == 1:
        tmp = a // 2 % 2
    else:
        tmp = (a - 1) ^ ((a - 1) // 2 % 2)
    ans = ans ^ tmp
    print(ans)


Measured memory_bytes: 9052
#include<cstdio>
#include<algorithm>
using namespace std;
static const int MAX_A = 10000000;

int m, n;
bool A[MAX_A + 1];

int main(){
	for(;;){
		scanf("%d %d", &m, &n);
		if(m == 0 && n == 0) break;
		fill(A, A + MAX_A, false);
		int cnt = 0;
		int i = m;
		while(cnt < n){
			while(A[i] == true) i++;
			for(int j = 1; j * i <= MAX_A; j++) A[j * i] = true;
			cnt++;
		}
		for(int j = m; j <= MAX_A; j++){
			if(A[j] == false){
				printf("%d\n", j);
				break;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 12480
n = int(raw_input().rstrip())

for i in xrange(n):
  a = 0
  b = 0
  is_ok = True
  l = raw_input().rstrip().split(" ")
  for e in l:
    ball = int(e)
    if ball-a <= ball-b and ball-a > 0:
      a = ball
    elif ball-b > 0:
      b = ball
    else:
      is_ok = False
  if is_ok:
    print "YES"
  else:
    print "NO"

Measured memory_bytes: 6256
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static String line;
	public static void main(String[] args) {
		read();
		slove();

	}
	static boolean read(){
		line = sc.nextLine();
		return true;
	}
	static void slove(){
		String Upperline = line.toUpperCase();
		System.out.println(Upperline);
	}
}

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

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

void solve(void) {
  ll N, M, X; cin >> N >> M >> X;

  vector<ll> price(N, 0);
  vector<vector<ll>> textbook(N, vector<ll>(M, 0));
  for(ll i = 0; i < N; ++i) {
    cin >> price[i];
    for(ll j = 0; j < M; ++j) cin >> textbook[i][j];
  }

  ll res = 10000000;
  for(ll bit = 0; bit < (1 << N); ++bit) {

    ll cost = 0;
    vector<ll> exp(M, 0);
    ll count = 0;
    for(ll i = 0; i < N; ++i) {
      if(bit & (1 << i)) {
        cost += price[i];
        for(ll j = 0; j < M; ++j) exp[j] += textbook[i][j];
      }
    } 
    for(ll mi = 0; mi < M; ++mi) {
      if (exp[mi] >= X) count++;
    }
    if(count == M) res = min(res, cost); 
  }


  if (res < 10000000) cout << res << endl;
  else cout << "-1" << endl;
}

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

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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e18+7;
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

ll N;
ll a[200005],s[200005];
ll ans=mod;

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>N;
rep(i,N) cin>>a[i];

s[0]=a[0];
rep1(i,N){
	s[i]=s[i-1]+a[i];
}

rep1(i,N){
	ll x=s[i-1]; 
	ll y=s[N-1]-x;
	ans=min(ans,abs(x-y));
}

cout<<ans<<endl;



}
	


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
typedef long long ll;
int main(){

	string s;
	cin >> s;

	if (s[0] == 'S')	cout << "Cloudy" << endl;
	else if (s[0] == 'C')	cout << "Rainy" << endl;
	else cout << "Sunny" << endl;

	return 0;
}


Measured memory_bytes: 760
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define pi 3.14
using namespace std;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef pair<long long,int> pli;
typedef pair<int,long long> pil;
const int INF=1000000007;
const int MOD=1000000007;
const int nmax=401234;

int n,a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main()
{
    scanf("%d",&n);
    printf("%d\n",a[n-1]);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<math.h>
#include<vector>
#include<algorithm>

using namespace std;
int main(void)
{
	int n, m, X, Y;
	int i, j,t;
	int flag = 0;
	cin >> n >> m >> X >> Y;
	vector<int> x(n);
	vector<int> y(m);
	for (i = 0; i < n; i++)
	{
		cin >> x[i];
	}
	for (j = 0; j < m; j++)
	{
		cin >> y[j];
	}
	for (i = X + 1; i <= Y; i++)
	{
		flag = 0;
		for (j = 0; j < n; j++)
		{
			if (x[j] >= i)
			{
				flag = 2;
				break;
			}
         }
		if (flag == 2)
		{
			continue;
		}
		for (t = 0; t < m; t++)
		{
			if (y[t] < i)
			{
				flag = 3;
				break;
			}
		}
		if (flag == 3)
		{
			continue;
		}
		flag = 1;
		break;
	}
	if (flag == 1)
	{
		cout << "No War" << endl;
	}
	else
	{
		cout << "War" << endl;
	}
	return 0;
}


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

vector<string> M;
int H,W;
int c_to_int[26];
char int_to_c[7];
int num;

vector<vector<vector<char> > > E;

bool pre_check(){
	E.clear();
	E.resize(H,vector<vector<char> > (W,vector<char>()));

	for(int k=0;k<num;k++){
		char now=int_to_c[k];
		int minx=100,maxx=0,miny=100,maxy=0;
		for(int y=0;y<H;y++){
			for(int x=0;x<W;x++){
				if(M[y][x]==now){
					maxx=max(maxx,x);minx=min(minx,x);
					maxy=max(maxy,y);miny=min(miny,y);
				}
			}
		}
		for(int y=miny;y<=maxy;y++){
			for(int x=minx;x<=maxx;x++){
				if(M[y][x]=='.') return false;
				E[y][x].push_back(now);
			}
		}
	}

	return true;
}

bool check(vector<int> perm){

	for(int y=0;y<H;y++){
		for(int x=0;x<W;x++){
			if(M[y][x]=='.') continue;
			int top=c_to_int[M[y][x]];
			for(int i=0;i<E[y][x].size();i++){
				if(E[y][x].size()<2) continue;
				int now=c_to_int[E[y][x][i]];
				if(perm[top]>perm[now]) return false;
			}
		}
	}


	return true;
}

bool solve(){
	cin>>H>>W;
	M.clear();
	set<char> S;
	num=0;

	for(int i=0;i<H;i++){
		string s; cin>>s; M.push_back(s);
		for(int k=0;k<s.size();k++){
			if(!S.count(s[k]) && s[k]!='.'){
				S.insert(s[k]);
				c_to_int[s[k]]=num;
				int_to_c[num]=s[k];
				num++;
			}
		}
	}


	if(!pre_check()) return false;
	if(num<2) return true;
	vector<int> perm;
	for(int i=0;i<num;i++) perm.push_back(i);
	sort(perm.begin(),perm.end());

	while(next_permutation(perm.begin(),perm.end())){
		if(check(perm)) return true;
	}
	return false;
}


int main()
{
	int n;cin>>n;
	for(int i=0;i<n;i++){
		if(solve()) cout<<"SAFE\n";
		else cout<<"SUSPICIOUS\n";
	}
	return 0;
}

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

bool isIntger(double x) { return floor(x) == x; }

int main() {
    int n, d, cnt = 0;
    int x[10][10];

    cin >> n >> d;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            cin >> x[j][i];
        }
    }
    for (int h = 0; h < n; h++) {
        for (int i = h + 1; i < n; i++) {
            double sum = 0;
            for (int j = 0; j < d; j++) {
                sum += pow((x[j][h] - x[j][i]), 2);
            }
            if (isIntger(sqrt(sum))) {
                cnt++;
            }
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;

ll modpow(ll x,ll p){
	if(p == 0)return 1;
	ll y = 1;
	while(p > 1){
		if(p&1)y = x * y % MOD;
		x = x * x % MOD;
		p>>=1;
	}
	return x * y % MOD;
}

ll mul(ll x, ll y){return x * y % MOD;}

int main(){
	ll n,a,b,c,d;
	scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
	ll knap[n+1] = {};
	knap[0] = 1;
	ll fac[n+1],inv[n+1];
	fac[0] = inv[0] = 1;
	fu(i,1,n){
		fac[i] = fac[i-1] * i % MOD;
		inv[i] = modpow(fac[i], MOD - 2);
	}
	fu(i,a,b){// fix
		fd(cur,n,0){
			fu(j,c,d){
				if(i * j + cur > n)break;
				int tar = i * j + cur;
				ll mult = mul(mul(fac[tar],modpow(inv[i],j)), mul(inv[cur],inv[j]));
				knap[tar] = (knap[tar] + mul(mult,knap[cur])) % MOD;
			}
		}
	}
	cout << knap[n] << '\n';
}



Measured memory_bytes: 256
#include<stdio.h>

int main() {
  int A, B, T;
  int time = 0;
  int biscuit_num = 0;

  scanf("%d %d %d", &A, &B, &T);

  while(time + A <= T + 0.5) {
    biscuit_num += B;
    time += A;
  }

  printf("%d\n", biscuit_num);

  return 0;
}


Measured memory_bytes: 128
/*
	0063:Palindrome
*/
#include	<iostream>
#include	<string>

using namespace std;

int main(void) {
	int count = 0; 
	while(1) {
		string str, rstr;
		
		cin >> str;
		if( cin.eof() ) { break; }
		
		string::reverse_iterator it = str.rbegin();
		while(it != str.rend()) {
			rstr += *it;
			++it;
		}
		
		if(str == rstr) {
			count++;
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <vector>
#include <bitset>

using namespace std;
using ll = long long;
const ll MOD = (ll)1e9 + 7; 

int main() {
	ll N; cin >> N;
	bitset<60> bs(N);
	vector<vector<long long>> dp(61, vector<long long>(3, 0));
	dp[60][0] = 1;
	for (int i = 59; i >= 0; --i) {
		if (bs[i]) {
			dp[i][0] = dp[i + 1][0];
			dp[i][1] = dp[i + 1][0] + dp[i + 1][1];
			dp[i][2] = 2 * dp[i + 1][1] + 3 * dp[i + 1][2];
		}
		else {
			dp[i][0] = dp[i + 1][0] + dp[i + 1][1];
			dp[i][1] = dp[i + 1][1];
			dp[i][2] = dp[i + 1][1] + 3 * dp[i + 1][2];
		}
		dp[i][0] %= MOD;
		dp[i][1] %= MOD;
		dp[i][2] %= MOD;
	}
	cout << (((dp[0][0] + dp[0][1]) % MOD) + dp[0][2]) % MOD << endl;
	return 0;
}


Measured memory_bytes: 256
h,w=gets.split.map(&:to_i)
w+=1
src=$<.read
s=src.tr("#.\n","10").to_i 16
mask=src.tr("#.\n","f0").to_i 16
tmp=s
res= (t = (tmp << 4) + tmp + (tmp >> 4))+ ( t << 4*w) + (t >> 4*w)
res &=~tmp
res |= mask

puts sprintf("%0#{w*(h+2)}x\n",res).to_s.scan(/.{#{w}}/)[2..-1].map{|x|x.chop.tr(?f,?#)}


Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt(); //1-200
		int ans = 0;
		for (int i = 1; i <=N; i+=2) {
			int divisor = 0;
			for (int j = 1; j <= i; j+=2) {
				if (i%j==0) {
					divisor++;
				}
			}
			if(divisor==8) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
require 'matrix'

n, m, = gets.split.map(&:to_i)

a = n.times.map do
      gets.split.map(&:to_i)
    end

b = m.times.map do
      gets.split.map(&:to_i)
    end

ma = Matrix.rows(a)
mb = Matrix.rows(b)
mc = ma * mb

puts mc.to_a.map {|r| r.join ' ' }.join ?\n



Measured memory_bytes: 7760
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int d[100];
int main()
{
	string s;
	cin >> s;
	for (int i = s.size() - 1; i >= 1; i--)
	{
		if (i % 2 == 1)continue;
		bool f = true;
		for (int j = 0; j < i / 2; j++)if (s[j] != s[j + i / 2])f = false;
		if (f)
		{
			cout << i << endl;
			return 0;
		}
	}
}

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

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

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

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

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

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

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

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

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

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input!{
        source = src,
        n: usize,
        k: usize,
        hn: [usize; n]
    }

    let mut hn2 = hn;
    hn2.sort_by(|a, b| b.cmp(a));
    
    let mut res:usize = 0;
    for i in k..hn2.len() {
        res += hn2[i];
    }

    return res.to_string();
}


Measured memory_bytes: 9464
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define mod 1000000007
#define maxn 100009
#define maxr 100009
const ll MAX = 1000100;

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


void combint()
{
	fac[0]=fac[1]=1;
	finv[0]=finv[1]=1;
	inv[1]=1;
	fr(i,2,MAX+1)
	{
		fac[i]=fac[i-1]*i%mod;
		inv[i]=mod-inv[mod%i]*(mod/i)%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
ll comb(ll n,ll r)
{
	if(n<r)
		return 0;
	if(n<0||r<0)
		return 0;

	return fac[n]*(finv[r]*finv[n-r]%mod)%mod;
}
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	ll x,y;
	rl2(x,y);
	combint();
	if((x+y)%3!=0)
	{
		cout<<0<<endl;
		return 0;
	}
	ll n=(2*y-x)/3;
	ll m=(2*x-y)/3;
	if(n<0||m<0)
	{
		cout<<0<<endl;
		return 0;
	}
	ll ans=0;
	ll cnr=comb(n+m,n);
	ans+=cnr;
	cout<<ans<<endl;
	return 0;
}

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

long long C[20];

// vector< vector<int> > arr(20, vector<int>(20));
ll arr[20][20];
long long N,M,X;
ll mi = 100000000;

void dfs(ll i, ll sum, bool b, ll* A);

int main() {
    
    cin >> N >> M >> X;
    for(int i=0;i<N;i++){
        cin >> C[i];
        for(int j=0;j<M;j++){
            cin >> arr[i][j];
            // cout << arr[i][j] << endl;
        }
    }
    long long A[20] = {0};
    dfs(0,0,false,A);
    dfs(0,C[0],true,A);
    if(mi == 100000000) cout << -1 << endl;
    else cout << mi << endl;
	return 0;
}

void dfs(ll i, ll sum, bool b, ll* A){
    long long B[20];
    if(b == true){
        for(int j=0;j<M;j++){
            B[j] = A[j] + arr[i][j]; 
        }
    }else{
        for(int j=0;j<M;j++){
            B[j] = A[j]; 
        }
    }
    if(i == N - 1){
        int flag = 1;
        for(int j=0;j<M;j++){
            // cout << B[j] << endl;
            if(B[j] < X){
                flag = 0;
            } 
        }
        // cout << sum << endl;
        if(flag == 1){
            // cout << i << endl;
            // cout << b << endl;
            if(mi > sum){
                // cout << i << endl;
                mi = sum;
            }
        }
        return;
    }

    dfs(i + 1, sum, false, B);
    dfs(i + 1, sum + C[i+1], true, B);
}

Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    double w,h,x,y;
    scanf("%lf%lf%lf%lf",&w,&h,&x,&y);
    printf("%lf ",w*h/2);
    if  (w/2==x&&h/2==y)    puts("1");
    else    puts("0");
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace TrainingApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Stack<int> s = new Stack<int>();
            Stack<int[]> a = new Stack<int[]>();

            // 入力
            string str = Console.ReadLine();

            for (int i = 0; i < str.Length; i++)
            {
                var cha = str[i];

                if (s.Any() && cha == '/')
                {
                    var x = s.Pop();
                    var y = i - x;

                    while (a.Any() && x < a.Peek()[0])
                    {
                        y += a.Pop()[1];
                    }

                    a.Push(new int[] { x, y });
                }

                if (cha == '\\')
                {
                    s.Push(i);
                }
            }

            var A = a.Select(e => e[1]).Reverse().ToArray();

            if (!A.Any())
            {
                Console.Write("0\n0\n");
                return;
            }

            Console.Write("{0}\n{1} {2}\n", A.Sum(), A.Length, string.Join(" ", Array.ConvertAll(A, e => e.ToString())));
        }
    }
}



Measured memory_bytes: 18992
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.par = [-1] * (n + 1)
        self.size = [1] * (n + 1)

    def root(self, idx):
        if self.par[idx] == -1:
            return idx

        self.par[idx] = self.root(self.par[idx])
        return self.par[idx]

    def unite(self, idx1, idx2):
        idx1_par = self.root(idx1)
        idx2_par = self.root(idx2)

        if idx1_par == idx2_par:
            return

        if self.size[idx1_par] >= self.size[idx2_par]:
            self.size[idx1_par] += self.size[idx2_par]
            self.par[idx2_par] = idx1_par
        else:
            self.size[idx2_par] += self.size[idx1_par]
            self.par[idx1_par] = idx2_par

    def same(self, idx1, idx2):
        return self.root(idx1) == self.root(idx2)


n, q = map(int, input().split())

uf = UnionFind(n)

for i in range(q):
    com, x, y = map(int, input().split())
    if com == 0:  # unite
        uf.unite(x, y)
    else:  # same
        if uf.same(x, y):
            print(1)
        else:
            print(0)



Measured memory_bytes: 5812
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define FOR(a, b, c) for (int (a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (int (a) = (c) - 1; (a) >= (b); --(a))
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))

int main() {
    // A:
    /*char c;
    cin >> c;
    cout << char(c + 1) << endl;*/

    // B:
    /*int n, k, m;
    cin >> n >> k >> m;
    int s = 0;
    REP (i, n - 1) {
        int x; cin >> x; s += x;
    }
    int ans = (m * n) - s;
    if (ans >= 0 && ans <= k) cout << ans << endl;
    else if (ans < 0) cout << 0 << endl;
    else cout << -1 << endl;*/

    // C:
    /*int ac = 0, wa = 0, prob, subs;
    cin >> prob >> subs;
    vi completed;
    bool present = false;
    REP (i, subs) {
        int p;
        string S;
        cin >> p >> S;
        REP (j, completed.size()) {
            if (p == completed[j]) {
                present = true;
                break;
            }
        }
        if (!present) {
            if (S == "WA") {
                wa += 1;
            } else {
                ac += 1;
                completed.push_back(p);
            }
        }
        present = false;
    }
    cout << ac << " " << wa << endl;*/

    int n, m;
    cin >> m >> n;
    vi cnt(m);
    vector<bool> found(m);
    int WA = 0, AC = 0;
    REP (i, m) {
        cnt[i] = 0;
        found[i] = false;
    }
    REP (i, n) {
        int val; string S;
        cin >> val >> S;
        val--;
        if (S == "AC" && !found[val]) {
            found[val] = true;
            WA += cnt[val];
            AC += 1;
        } else {
            cnt[val]++;
        }
    }
    cout << AC << " " << WA << endl;
    return 0;
}


Measured memory_bytes: 3708