akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef pair<int, int> pii;
    typedef map<int, int> mii;
    typedef map<char,int> mci;
    typedef vector<int> vi;
    typedef vector<vi> vvi;
    typedef vector<ll> vll;
    typedef vector<pair<int,int>> vii;
    typedef vector<char> vc;
    typedef vector<vc> vcc;
    #define all(x) (x).begin(), (x).end()
    #define rall(x) (x).rbegin(), (x).rend()
    #define pb push_back
    #define F first
    #define S second
    #define in insert
    #define mina(a,b) (a)=min((a),(b));
    #define maxa(a,b) (a)=max((a),(b));
    const int INF = 1e9 + 7;
    void solve(){
        int n; cin>>n;
        vi a(n+1);
        int ans=0;
        for(int i = 0; i < n-1; i++){
            int t; cin>>t;
            if(!i){
                a[0]=t;
                a[1]=t;
            }
            else{
                a[i]=min(t,a[i]);
                a[i+1]=t;
            }
        }
        for(int i = 0; i < n; i++){
            ans+=a[i];
            //cout<<a[i];
        }
        cout<<ans;


    }
    int main(){
        int T=1;
        //cin>>T;
        for(int i = 0; i < T; i++) solve(); 
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int main() {
    int n; cin >> n;
    vint a(n), b(n);
    rep(i,n) cin >> a[i] >> b[i];
    sort(all(a));
    sort(rall(b));
    if (n&1) {
        int l = a[n/2]; int r = b[n/2];
        cout << r-l+1 << endl;
    } else {
        int l = a[n/2-1]; int r = b[n/2-1];
        int l_2 = a[n/2]; int r_2 = b[n/2];
        int x_1 = r-l+1;
        int x_2 = r_2-l_2+1;
        cout << x_1+x_2-1 << endl;
    }
}

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

#ifdef DEBUG
#define debug(...) __VA_ARGS__
#else
#define endl '\n'
#define debug(...)
#endif
#define debugf(...) debug(printf(__VA_ARGS__))

const int N = 1e5 + 5;



int (((((main)))))() <%
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

    int a; cin >> a;
    cout << a + a*a + a*a*a << endl;

	return 0;
%>

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
ll a[20];   
ll dp[200005][20];
string s;
ll digit_dp(ll pos,ll sum){
  ll res=0;
  if(pos>=s.size()){
    if(sum%13==5)
    return 1;
    else 
    return 0;
  }
  if(dp[pos][sum]!=-1)
  return dp[pos][sum];
  if(s[pos]=='?'){
    for(ll i=0;i<=9;i++){
      ll temp=(i*a[(s.size()-1-pos)%6])%13;
      ///if(pos==s.size()-1)
      res=(res+digit_dp(pos+1,(sum+temp)%13))%mod;
      ///else{
    ////  ll kola=(digit_dp(pos+1,(sum+temp)%13))%mod;
      ////  if(kola!=0){
          ///if(res==0)
          ////res=kola%mod;
          ///else
          ///res=((res%mod)*(kola%mod))%mod;
      //}   
       }
    }
 /// }
  else{
    ll temp=((s[pos]-'0')*a[(s.size()-1-pos)%6])%13;
    ///if(pos==s.size()-1)
    res=(res+digit_dp(pos+1,(sum+temp)%13))%mod;
    ////else{
      ////ll kola=(digit_dp(pos+1,(sum+temp)%13))%mod;
       //// if(kola!=0){
          ////if(res==0)
          ////res=kola%mod;
          ///else
          ////res=((res%mod)*(kola%mod))%mod;
      ///}   
   /// }
  }
  ///cout<<res<<endl;
  return dp[pos][sum]=res;
}
int main()
{
    fastread;
    a[0]=1;
    a[1]=10;
    a[2]=9;
    a[3]=12;
    a[4]=3;
    a[5]=4;
    ll i,j,k,l,n,m;
    for(i=0;i<=200000;i++){
      for(j=0;j<=15;j++)
      dp[i][j]=-1;
  }
  cin>>s;
  cout<<digit_dp(0,0);
    return 0;
}

Measured memory_bytes: 39504
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)

/*
void solve(){
  string s; cin >> s; int n = s.size();
  bool flg = true;
  FOR(i,0,n/2){
    if(s[i] != s[n/2-1-i]) flg = false;
  }
  FOR(i,0,n/2){
    if(s[n/2+1+i] != s[n-1-i]) flg = false;
  }
  if(flg) cout << "Yes";
  else cout << "No";
}
*/
ll comb(ll a, int b){
  ll ans = 1;
  //if(b > a/2) b = a - b;
  if(b==2){
    ans = a*(a-1)/2;
  }
  return ans;
}


void solve(){
  int n; cin >> n;
  vector<int> a(n); vector<int> num(n,0); ll cmbsum = 0;
  RPT(i,0,n) {cin >> a[i]; --a[i]; num[a[i]]++;}
  RPT(i,0,n) { if(num[i]>=2) cmbsum += comb(num[i],2);}
  RPT(i,0,n){
    ll ans = cmbsum;
    if(num[a[i]]>=2) ans -= comb(num[a[i]],2);
    if(num[a[i]]>=3) ans += comb(num[a[i]]-1,2);
    cout << ans << endl;
  }
}

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

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;

#define pf(n) cout << n << endl
#define ps() cout <<" ";
#define sf(n) cin >> n
//#define in(i,n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vp vector<pair<int, int>>
#define graph vector< vector<int> >
#define vs vector<string>
#define mn -
#define pls +
#define mod %
#define E =
#define EE ==
#define le <=
#define ge >=
int mx=9999999;
/**  '' "\n" - ^ **/

    void yes()
    {
        cout<<"yes\n";
    }

    void no()
    {
        cout<<"no\n";
    }
    void YES()
    {
        cout<<"YES\n";
    }

    void NO()
    {
        cout<<"NO\n";
    }

    void Case(int i,int n)
    {
        cout<<"Case:"<<i<<" "<<n<<endl;
    }
    /**  '' "\n" x ^ **/
    /** printf("\n") */
inline int inc(int i,int j)
{
	return i + j;
}
inline int dec(int i,int j)
{
	return i - j;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a,b;
    cin>>a>>b;
    int mx E 0;
    for(int i E 0;i le a.length() mn b.length();i E i pls 1)
    {
    	int c E 0;
    	for(int j E 0,k E i;j<b.length();j E inc(j,1),k E inc(k,1))
    	{
    		if(b[j] EE a[k])c E inc(c,1);
		}
		if(c > mx)
		mx E c;
	}
	pf(b.length() mn mx);
}


Measured memory_bytes: 3572
#include <iostream>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const string YES = "Possible";
const string NO = "Impossible";

void solve(long long A, long long B){
    if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0)
        cout << YES << '\n';
    else
        cout << NO << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


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

long long n, s;

long long calc(long long b) {
	if(b==1) return -1;
	long long x = n, res=0;
	while(x) {
		res+=x%b;
		x/=b;
	}
	return res;
}

int main() {
	cin>>n>>s;
	if(s>n) {
		cout<<-1<<endl;
		return 0;
	}
	if(s==n) {
		cout<<n+1<<endl;
		return 0;
	}
	long long res = n+1;
	for(long long i=2; i<=n+1&&i<=333333;i++) {
		if(calc(i) == s)
			if(res>i) res = i;
	}
	for(long long i=1;i*i<=n-s;i++) {
		if ((n-s)%i) continue;
		long long x=(n-s)/i+1;
		if(calc(x)==s && res > x) res=x;
		x=i+1;
		if(calc(x)==s && res > x) res=x;
	}
	if(calc(res)==s) cout<<res<<endl;
	else cout<<-1<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    string a;
    cin >> a;
    if (a[0] == a[2]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")

# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;



int main () {
   SpeedForce;
	cin >> n;
	ll ans = 0;
	for (int i = 1, x; i <= n; i ++) {
		cin >> x;
		cur += x;
		a[i] = x;
	}

	for (int i = 1; i <= n; i ++) {
		cur -= a[i];
		ans += cur * (ll)a[i];
	}

	cout << ans << '\n';
   return Accepted;
}

// B...a

Measured memory_bytes: 18688
#include<stdio.h>

double sp(double v){
  return v/9.8;
}

double hi(double t){
  return 4.9*t*t;
}

int main(){

  double h,i,j,t,v,N;

  while(scanf("%lf",&v)!=EOF){
    h=sp(v);
    h=hi(h);
    N=(h+5)/5;
    printf("%d\n",(int)N+1);
  }
  return 0;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
#include <iostream>
#include <string> 
using namespace std;
int main(){
  int N;
  cin >> N;
  int P1=N%3600;
  int P2=P1%60;
  cout << (N-P1)/3600 << ":" << (P1-P2)/60 << ":" << P2 << endl;
}


Measured memory_bytes: 3092
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <list>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

#define xx first
#define yy second
#define $1 first
#define $2 second

void solveCase() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int a, b; cin >> a >> b;
	cout << a*b;
}

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	solveCase();
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

using lap_time_t = int64_t;

lap_time_t solve(const std::vector<lap_time_t>& ts) {
  lap_time_t ret = 1;
  for (auto const t : ts) {
    ret = boost::math::lcm(t, ret);
  }
  return ret;
}

int main() {
  int n;
  std::cin >> n;
  std::vector<lap_time_t> ts(n);
  for (auto& t : ts) {
    std::cin >> t;
  }
  std::cout << solve(ts) << std::endl;
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    
    vector<int> A(N+1);
    
    for (int i = 0; i < N-1; i++) {
        int a;
        cin >> a;
        A.at(a)++;
    }
    for (int i = 1; i <= N; i++) {
        cout << A.at(i) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int sum=0;
	string s,t;
	cin>>s;
	cin>>t;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]==t[i])
		sum++;
	}
	cout<<sum;
}

Measured memory_bytes: 256
s = input()
l = len(s)
cases = 2 ** (l - 1)
ans = 0

for i in range(cases):
    tmp = int(s)
    adjust = str(format(i, 'b').zfill(l-1))
    k = 0
    for j in range(l-1):
        if adjust[j] == '1':
            ans += tmp % (10 ** (k+1))
            tmp //= 10 ** (k+1)
            k = 0
        else:
            k += 1
    ans += tmp

print(ans)

Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main() {
    while(1){
      int n;
      cin >> n;
      if(n==0) break;
      int min = 1000000;
      int fee;
      for(int a=0;a<=n/200+1;a++){
	for(int b=0;b<=n/300+1;b++){
	  for(int c=0;c<=n/500+1;c++){
	    if(a*200+b*300+c*500==n){
	      fee=a*380+b*550+c*850;
	    if(a>=5) fee+=((a/5)*5*380)*0.8-(a/5*5*380);
	  if(b>=4) fee+=((b/4)*4*550)*0.85-(b/4*4*550);
	if(c>=3) fee+=((c/3)*3*850)*0.88-(c/3*3*850);
	//cout <<a<<"*"<<b<<"*"<<c<<"="<<fee<<endl;
      if(min>fee) min=fee;
	    }
	  }
	}
      }	
      cout << min <<endl;
     } 
   return 0;
    }



Measured memory_bytes: 3080
# 解説 imos
n, C = map(int, input().split())
L = [tuple(map(int, input().split())) for _ in range(n)]
m = 2 * 10 ** 5 + 2
S = [0] * m
for x in range(1, C + 1):
    T = [0] * m
    for s, t, c in L:
        if c == x:
            # 始点を奇数, 終点を偶数にするのうまい
            T[2 * s - 1] += 1
            T[2 * t] -= 1
    for i in range(1, m):
        T[i] += T[i - 1]
    for i in range(m):
        if T[i] > 0:
            S[i] += 1
print(max(S))

Measured memory_bytes: 135036
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  string s;
  cin>>s;
  bool type,odd;
  bool turn_odd;
  int len=s.size();
  if(len%2==1){
    odd = true;
  }else{
    odd = false;
  }
  
  if(s[0]==s[len-1]){
    type = true;
  }else{
    type = false;
  }
  
  if(type){
    if(odd){
      turn_odd = false;
    }else{
      turn_odd = true;
    }
  }else{
    if(odd){
      turn_odd = true;
    }else{
      turn_odd = false;
    }
  }
  
  if(turn_odd){
    cout<<"First"<<endl;
  }else{
    cout<<"Second"<<endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define N 10005
using namespace std;
int a[N],b[N],c[N],d[N],e[N],f[N];
char s[10010];
int n,ans1=1,m,ans2=1;
int hashs(char *str)
{
	unsigned int hash=0;
    while(*str)
        hash=(*str++)+(hash<<6)+(hash<<16)-hash;
    return(hash&0x7FFFFFFF);
}
main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
    {
        scanf("%s",s);
        a[i]=hashs(s);
    }
    sort(a+1,a+n+1);
    int cnt1=0,k=1;
    for (int i=2;i<=n+1;i++)
        if (a[i]!=a[i-1])
        {
        	cnt1++;
        	f[cnt1]=a[i-1];
        	c[cnt1]=k;
        	k=1;
		}else k++;
    scanf("%d",&m);
    for (int i=1;i<=m;i++)
    {
        scanf("%s",s);
        b[i]=hashs(s);
    }
    sort(b+1,b+m+1);
    int cnt2=0;k=1;
    for (int i=2;i<=m+1;i++)
        if (b[i]!=b[i-1])
        {
        	cnt2++;
        	d[cnt2]=b[i-1];
        	e[cnt2]=k;
        	k=1;
		}else k++;
	int i=1,j=1,ans=0;
	while(i<=cnt1&&j<=cnt2)
	{
		if(f[i]==d[j])
		{
			ans=max(ans,c[i]-e[j]);
			i++;j++;
		}else
		if(f[i]>d[j])j++;else
		{
			ans=max(ans,c[i]);
			i++;
		}
	}
	for(int k=i;k<=cnt1;k++)
		ans=max(ans,c[k]);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import qualified Data.Array.IO as A
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord

--import qualified Data.IntSet as S
import qualified Data.Sequence as S

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

rp :: IO (Int,Int)
rp  = toTup . unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

toTup [a,b] = (a,b)

main :: IO ()
main = do
    n <- readLn :: IO Int
    (v:vs) <- sort <$> r' :: IO [Int]
    print $ foldl ave (fromIntegral v) vs



ave x y = (x + (fromIntegral y)) / 2



Measured memory_bytes: 508
#include <stdio.h>

int main(void){
	int x[1024] = {0},y[2048] = {0},z[4096] = {0},w[4096] = {0},i,j,n;
	for(i = 0;i <= 1000;i++){
		x[i]++;
	}
	for(i = 0;i <= 1000;i++){
		for(j = 0;j <= 1000;j++){
			y[i + j] += x[i];
		}
	}
	for(i = 0;i <= 2000;i++){
		for(j = 0;j <= 1000;j++){
			z[i + j] += y[i];
		}
	}
	for(i = 0;i <= 3000;i++){
		for(j = 0;j <= 1000;j++){
			w[i + j] += z[i];
		}
	}
	while(scanf("%d",&n) != EOF){
		printf("%d\n",w[n]);
	}
	return 0;
}

Measured memory_bytes: 648
//BISMILLAHIR RAHMANIR RAHIM
//ALLAH HU AKABR
#include<bits/stdc++.h>
using namespace std;
#define MAX 1005
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  int n,m,sum=0;
  cin>>n>>m;
  int a[m];
  for(int i=0;i<m;i++)
  {
      cin>>a[i];
      sum+=a[i];
  }
  if(sum>n)
  {
      cout<<-1<<endl;
  }
  else
    cout<<(n-sum)<<endl;
}


Measured memory_bytes: 3684
from sys import exit, setrecursionlimit
setrecursionlimit(10**6)

def array2D(row, col ,val=0):
    return [[val]*col for i in range(row)]

s = input()
n = len(s)

t = s[:(n-1)//2]
k = s[(n+3)//2-1:]
if s==s[::-1] and t==t[::-1] and k==k[::-1]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
namespace io{
    const int L = (1 << 20) + 1;
     
    char buf[L], *S , *T, c;
      
    char getchar() {
        if(S == T) {
            T = (S = buf) + fread(buf, 1, L, stdin);
            return (S == T ? EOF : *S++);
        }
        return *S++;
    }
     
    int inp() {
        int x = 0, f = 1; char ch;
        for(ch = getchar(); !isdigit(ch); ch = getchar())
            if(ch == '-') f = -1;
        for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
        return x * f;
    }
     
    ll inp_ll() {
        ll x = 0; int f = 1; char ch;
        for(ch = getchar(); !isdigit(ch); ch = getchar())
            if(ch == '-') f = -1;
        for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
        return x * f;
    }
     
    char B[25], *outs=B+20, *outr=B+20;
    template<class T>
    inline void print(register T a,register char x=0){
        if(x) *--outs = x, x = 0;
         
        if(!a)*--outs = '0';
        else
            while(a)
                *--outs = (a % 10) + 48, a /= 10;
         
        if(x)
            *--outs = x;
         
        fwrite(outs, outr - outs , 1, stdout);
        outs = outr;
    }
};
  
using io :: print;
using io :: inp;
using io :: inp_ll;
const int INF = 1e9 ;
const int maxN = 1e6 + 10; 

vector<pii> v[maxN];
int n,m;
char b[maxN][10];
char c[maxN][10];
void read(char a[10],int x)
{
	int len = 6;
	while(x)
	{
		a[len] = x%10 + 48;
		x /=10;
		len--; 
	}
	for(int i=1;i<=len;i++)
		a[i] = '0';
}
int main()
{
	n = inp();
	m = inp();
	for(int i=1;i<=m;i++)
	{
		int p,y;
		p = inp();
		y = inp();
		v[p].push_back(pii(y,i));
	}
	for(int i=1;i<=n;i++)
	{
		sort(v[i].begin(),v[i].end());	
	} 
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<v[i].size();j++)
		{
			int num = v[i][j].second;
			read(b[num],i);
			read(c[num],j+1);
		}
	}
	for(int i=1;i<=m;i++)
	{
		printf("%s%s\n",b[i]+1,c[i]+1);
	}
    return 0;
}

Measured memory_bytes: 35328
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define INF 1000000000000000;
#define MOD 1000000007LL;
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

int N; cin >> N;
VI x(N), y(N), h(N); rep(i, 0, N) cin >> x[i] >> y[i] >> h[i];


rep(Cx, 0, 101) rep(Cy, 0, 101){
    int64_t H;
    rep(i, 0, N)
        if (h[i]) {
            H = h[i] + abs(Cx - x[i]) + abs(Cy - y[i]);
            break;
        }

    bool flag = true;
    rep(i, 0, N)
        if (h[i] != max(H - abs(Cx - x[i]) - abs(Cy - y[i]), (int64_t)0)) {
            flag = false;
            break;
        }
    if (flag) {
        cout << Cx << ' ' << Cy << ' ' << H << endl;
        return 0;
    }
}


}
// 書いて考える
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 256
/* include */
#include <stdio.h>

/* define */
#define MAX 1000
#define INFTY -1

/* prototype define */
void bfs(int);
// queue
void push(int);
int pop();
int isEmpty();
int isFull();

/* struct */
struct Queue{
  int vertex;
};

/* global */
int n, MATRIX[MAX][MAX], DEG[MAX];
// queue
struct Queue Q[MAX];
int head=0,tail=0;


int main(){
  int from, to, deg, i, j;

  /* input size */
  scanf("%d", &n);

  /* initialize */
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      MATRIX[i][j] =0;
    }
  }
  
  /* create matrix */
  for(i=0;i<n;i++){
    scanf("%d %d", &from, &deg);
    from--;
    for(j=0;j<deg;j++){
      scanf("%d", &to);
      to--;
      MATRIX[from][to] = 1;
    }
  }
  bfs(0);
  return 0;
}

/* Breadth First Search */
void bfs(int root){
  int from, to, i;
  push(root); //root????????\??????????´?

  /* initialize */
  for(i=0;i<n;i++){
    DEG[i] = INFTY;
  }
  DEG[root] = 0; //root????¬???°???0
  
  /* scanning */
  while(!isEmpty()){ //?????\???????????§????????????
    from = pop();
    for(to=0;to<n;to++){
      if(MATRIX[from][to]==0) { //????????????????????????
        continue;
      }
      if(DEG[to]!=INFTY){ //????????¶???(????¨????)?????¨??????DEG[to]????¬???°????¨??????????(continue????¬????while????????£????????????)
        continue;
      }
      DEG[to] = DEG[from] + 1; //++??§????????????
      push(to);
    }
  }
  
  /* print */
  for(i=0;i<n;i++){
    printf("%d ", i+1); //1?????????????????´???
    if(DEG[i]==INFTY){ //??°??????????????????
      printf("-1");
    }else{
      printf("%d",DEG[i]);
    }
    printf("\n");
  }
}


/* QUEUE (alds1-3-C.c)*/
/* the method of enqueue */
void push(int new){ 
  //????´??????£??\
  Q[tail].vertex = new;

  if(tail + 1 == MAX){ //???????????????????????????????????°
    tail = 0;
  }else{
    tail++;
  }
}

/* the method of dequeue */
int pop(){
  struct Queue x;

  x = Q[head];
  if(head + 1 == MAX){ //?¬????????´???´????????¢????????´????????????????????????
    head = 0;
  }else{
    head++;
  }

//  printf("dequeue: %s %d\n",x.name, x.time); //@@

  return x.vertex;
}

 /**
  * Judge the queue is if Empty or not 
  * 1: is Empty
  * 0: is not Empty
  */
int isEmpty(){
  if(head==tail){
//    printf("Error: Underflow\n");
    return 1;
  }else{
    return 0;
  }
}

 /**
  * Judge the queue is if Full or not 
  * 1: is Full
  * 0: is not Full
  */
int isFull(){
  if(head == (tail+1)%MAX){ //%MAX??????????????¨???head==0, tail==MAX-1?????????head==tail+1??§Full??¨??????????????????
//    printf("Error: Overflow\n");
    return 1;
  }else{
    return 0;
  }
}

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

//関数
int gcd(int a,int b){
    while(a!=0 && b!=0){
        if(a>b){
            a%=b;
        }else{
            b%=a;
        }
    }
    
    return max(a,b);
}
    
    
    
//main関数
int main() {
    
    
    
    //入力
    long N,K;
    cin>>N>>K;
    vector<long> A(N);
    for(int i=0;i<N;i++){
        cin>>A.at(i);
    }
     
    
    
    
    
    
    
    
    
    //計算
    long mi=A.at(0);
    long ma=A.at(0);
    for(int i=1;i<N;i++){
        mi=gcd(mi,A.at(i));
        ma=max(ma,A.at(i));
    }
    
    //出力
    if(K%mi==0 && K<=ma){
        cout<<"POSSIBLE"<<endl;
    }else{
        cout<<"IMPOSSIBLE"<<endl;
    }
    //cout<<gcd(100,75);

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()

int main(){
  int n,m,c,ans=0;
  cin >> n >> m >> c;
  int b[m];
  for(int i=0;i<m;i++)cin >> b[i];

  int a[n][m];
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin >> a[i][j];
    }
  }
  for(int i=0;i<n;i++){
    int count = 0;
    for(int j=0;j<m;j++){
      count += a[i][j]*b[j];
      //cout << count << "\n";
    }
    if(count + c > 0)ans++;
  }
  cout << ans ;
}


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

//typedef pair<int, int> P;
const int _ = 300 + 10;
const int __ = 1000000 + 10;
int n, m, l, g[_][_];
//vector<P> E[_];

int tot, head[_], to[__], edge[__], nxt[__];
void add(int x, int y, int z) {
	to[++tot] = y;
	edge[tot] = z;
	nxt[tot] = head[x];
	head[x] = tot;
}

inline void read() {
	cin >> n >> m >> l;
	memset(g, 0x3f, sizeof(g));
	for (int i = 1; i <= n; ++i) g[i][i] = 0;
	for (int i = 1; i <= m; ++i) {
		int x, y, z;
		cin >> x >> y >> z;
		add(x, y, z); add(y, x, z);
	}
}

typedef pair<int, int> P;
priority_queue<P, vector<P>, greater<P> > Q;
int d[_], vis[_];

void dijkstra(int s) {
	memset(d, 0x3f, sizeof(d));
	memset(vis, 0, sizeof(vis));
	d[s]=0;
	Q.push(make_pair(d[s], s));
	while (Q.size()) {
		int x=Q.top().second; Q.pop();
		if (vis[x]) continue;
		vis[x]=1;
		for (int i=head[x]; i; i=nxt[i]) {
			int y=to[i], z=edge[i];
			if (d[y]>d[x]+z) {
				d[y]=d[x]+z;
				Q.push(make_pair(d[y], y));
			}
		}
	}
}

/*void dfs(int from, int x, int d) {
	vis[x] = 1;
	if (d <= l) g[from][x] = g[x][from] = 1;
	for (int i = head[x]; i; i = nxt[i]) {
		int y = to[i], z = edge[i];
		if (vis[y]) continue;
		dfs(from, y, d + z);
	}
	vis[x] = 0;
}*/

inline void floyd() {
	for (int k = 1; k <= n; ++k)
		for (int i = 1; i <= n; ++i)
			for (int j = 1; j <= n; ++j)
			g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
}

int main() {
	read();
	memset(g, 0x3f, sizeof(g));

	for (int i = 1; i <= n; ++i) {
//		g[i][i] = 0;
//		memset(vis, 0, sizeof(vis));
//		dfs(i, i, 0);
		dijkstra(i);
		for (int j = 1; j <= n; ++j)
			if (d[j] <= l) g[i][j] = g[j][i] = 1;
	}
	
	floyd();
	
	int Q; cin >> Q;
	while (Q--) {
		int x, y;
		cin >> x >> y;
		if (g[x][y] == 0x3f3f3f3f) puts("-1");
		else printf("%d\n", g[x][y] - 1);
	}
	return 0;
}

Measured memory_bytes: 7296
import sys, math
from collections import deque

readline = sys.stdin.readline

N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))

ans = 0

for i in range(N):
    if A[i] > B[i]:
        ans += B[i]
    else:
        ans += A[i]
        B[i] -= A[i]
        ans += min(B[i], A[i + 1])
        A[i + 1] -= min(B[i], A[i + 1])

print(ans)

Measured memory_bytes: 73572
import Data.List
import qualified Data.Vector.Unboxed as V
main=print.solve.V.unfoldr uncons=<<getLine
solve=(\(_,_,_,c)->c).V.foldl f(1,0,0,0)
f(r,a,b,c)v=case v of
  'A'->(r, g$a+r, b, c)
  'B'->(r, a, g$b+a, c)
  'C'->(r, a, b, g$c+b)
  '?'->(g$r*3, g$a*3+r, g$b*3+a, g$c*3+b)
g x=x`mod`(10^9+7)

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;

const string YES = "Yes";
const string NO = "No";

void solve(std::string S)
{
    rep(i, S.length())
    {
        if (i % 2 == 0)
        {
            if (S[i] == 'R' || S[i] == 'U' || S[i] == 'D')
                continue;
            else
            {
                cout << "No" << endl;
                return;
            }
        }
        else
        {
            if (S[i] == 'L' || S[i] == 'U' || S[i] == 'D')
                continue;
            else
            {
                cout << NO << endl;
                return;
            }
        }
    }
    cout << YES << endl;
}

int main()
{
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 1000000
using namespace std;
typedef long long ll;
const int MAXN=1e5+10;
const int MAX=1e5+10;
const double eps=1e-6;



int main(){
    #ifdef ONLINE_JUDGE
    #else
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    #endif

    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<s.size();i++){
    	if(s[i]=='1')
    		ans++;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int main() {
	LL N;
	cin >> N;
	LL ans = 0;
	for (LL X = 1; (X - 1) * (X - 1) <= N; ++X) {
		if (N % X == 0) {
			LL m = N / X - 1;
			if (X < m) {
				ans += m;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = int.Parse(ReadLine());
			var line = ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();
			var colors = new int[9];
			foreach(var point in line)
			{
				var i = point / 400;
				if(point >= 3200)
				{
					i = 8;
				}
				colors[i]++;
			}

			var count = 0;
			for(var i = 0; i < colors.Length; i++)
			{
				if(i != colors.Length - 1)
				{
					count += colors[i] > 0 ? 1 : 0;
				}
				else
				{
					if (count != 0)
					{
						Write($"{count} ");
					}
					else
					{
						Write("1 ");
					}
					WriteLine(count + colors[i]);
				}
			}
		}
	}
}


Measured memory_bytes: 11348
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>
#include <unordered_set>

int main()
{
    int N;
    std::cin >> N;
    int L[N];
    for (int i = 0; i < N; ++i) {
        std::cin >> L[i];
    }

    std::sort(L, L+N);

    int sum = 0;
    for (int i = 0; i < N -1; ++i) {
        sum += L[i];
    }

    if (L[N-1] < sum) {
        std::cout << "Yes\n";
    } else {
        std::cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!(a: i64, b: i64);
    if (a + b) % 2 != 0 {
        puts!("IMPOSSIBLE\n");
    } else {
        puts!("{}\n", (a + b) / 2);
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

int main() {
	llint a, b, c;
	cin >> a >> b >> c;
	rep(i, 10) {
		c *= a;
		c -= b;
		cout << c << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<vector<int>> A;
int main() {
	cin >> N >> M;
	A.resize(N, vector<int>(M));
	for (auto& x : A) for (auto& y : x) cin >> y;
	int r = 1<<30;
	int m = M;
	vector<int> B(N);
	vector<bool> C(M);
	for (;;) {
		map<int,int> cnt;
		for (int i = 0; i < N; ++ i) ++ cnt[A[i][B[i]]];
		int maxcnt = 0;
		for (const auto& p : cnt) maxcnt = max(maxcnt, p.second);
		r = min(r, maxcnt);
		for (const auto& p : cnt) if (p.second == maxcnt) {
			C[p.first] = true;
			-- m;
		}
		if (m == 0) break;
		for (int i = 0; i < N; ++ i) {
			while (B[i] < M && C[A[i][B[i]]]) ++ B[i];
		}
	}
	cout << r << endl;
}


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


	int main() {
		int n, r;
		cin >> n>>r;
		int x;
		if (n < 10)x = r + 100 * (10-n);
		else x = r;
		cout << x << endl;
	}



Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int h = in.nextInt();
        int w = in.nextInt();
        int m = in.nextInt();
        int[] row = new int[h];
        int[] col = new int[w];
        ArrayList<Pair> list = new ArrayList<>(m);
        HashMap<Integer, Integer> map = new HashMap<>();
        for(int i=0; i<m; i++) {
            int x = in.nextInt() - 1;
            int y = in.nextInt() - 1;
            list.add(new Pair(x, y));
            row[x]++;
            col[y]++;
            map.put(convert(x, y, w), 1);
        }
        int max = 0, colIndex = 0, rowIndex = 0, colMax = 0, rowMax = 0;
        for(int i=0; i<h; i++) {
            if(row[i] > rowMax) {
                rowIndex = i;
                rowMax = row[i];
            }
        }
        for(int i=0; i<w; i++) {
            if(col[i] > colMax) {
                colMax = col[i];
                colIndex = i;
            }
        }
        for(int i=0; i<w; i++) {
            if(map.containsKey(convert(rowIndex, i, w)))
                max = Math.max(max, row[rowIndex] + col[i] - 1);
            else
                max = Math.max(max, row[rowIndex] + col[i]);
        }
        for(int i=0; i<h; i++) {
            if(map.containsKey(convert(i, colIndex, w)))
                max = Math.max(max, row[i] + col[colIndex] - 1);
            else
                max = Math.max(max, row[i] + col[colIndex]);
        }
        System.out.println(max);
        in.close();
    }

    static int convert(int i, int j, int w) {
        return i*w + j;
    }

    static class Pair {
        Integer i, j;

        Pair(int i, int j) {
            this.i = i;
            this.j = j;
        }

        Pair() {}

        public int hashCode() {
            return 31 * i.hashCode() + j.hashCode();
        }
    }
}

Measured memory_bytes: 89976
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

#define MAX 987654321

int n;
long res = MAX;
vector<pair<int, int>> p;

bool cmp(const pair<int, int> a, const pair<int, int> b) {
	if (a.first == b.first)
		return a.second < b.second;
	return a.first < b.first;
}

bool cmp2(const pair<int, int> a, const pair<int, int> b) {
	if (a.second == b.second)
		return a.first < b.first;
	return a.second < b.second;
}

long dist(int a, int b, vector<pair<int, int>>& p) {
	return (p[a].first - p[b].first) * (p[a].first - p[b].first) + (p[a].second - p[b].second) * (p[a].second - p[b].second);
}

long solve(int first, int last) {
	// 점이 3개 이하면 최소 거리계산
	if ((last - first) < 3) {
		for (int i = first; i < last; i++) {
			for (int j = i + 1; j < last + 1; j++) {
				res = min(res, dist(i, j, p));
			}
		}
		return res;
	}

	// 분할정복
	int mid = (first + last) / 2;
	res = min(solve(first, mid), solve(mid + 1, last));

	// left, right 중 최소값과 중간 선 경계 사이의 최소값 비교
	vector<pair<int, int>> promising_p;
	long mid_line = (p[mid].first + p[mid + 1].first) / 2;

	// x축에 대하여 가지치기
	for (int i = first; i < last + 1; i++) {
		long buf = (p[i].first - mid_line) * (p[i].first - mid_line);

		if (buf < res)
			promising_p.push_back(make_pair(p[i].first, p[i].second));
	}

	// y축 오름차순 정렬
	sort(promising_p.begin(), promising_p.end(), cmp2);

	int p_size = promising_p.size();
	for (int i = 0; i < p_size - 1; i++) {
		for (int j = i + 1; j < p_size; j++) {
			long y1 = promising_p[i].second;
			long y2 = promising_p[j].second;
			long y_dist = (y2 - y1) * (y2 - y1), res_dist;

			if (y_dist > res) break;

			res_dist = dist(i, j, promising_p);
			res = min(res, res_dist);
		}
	}
	return res;
}

int main() {
	scanf("%d", &n);

	// x, y좌표 입력
	for (int i = 0; i < n; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		p.push_back(make_pair(x, y));
	}

	// 오름차순 정렬
	sort(p.begin(), p.end(), cmp);

	long res = solve(0, n - 1);
	printf("%ld\n", res);
}


Measured memory_bytes: 6496
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, L, T;
int X[100000], W[100000];
int F[100000];
int ans[100000];
vector<int> G[2];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> L >> T;
  vector<int> fs;
  rep(i, N) {
    cin >> X[i] >> W[i];
    W[i]--;
    G[W[i]].pb(X[i]);
    int d = 1;
    if (W[i] == 1) d = -1;
    F[i] = (((X[i]+d*T) % L) + L) % L;
    fs.pb(F[i]);
  }
  sort(all(fs));

  rep(i, 2) sort(all(G[i]));
  int n = 0;
  for (int x : G[W[0]^1]) {
    int dist = x - X[0];
    if (W[0] == 1) dist = (L - dist) % L;
    assert(dist >= 0 && dist < L);
    int t = 2*T - dist;
    if (t >= 0) {
      n++;
      n += t / L;
      n %= N;
    }
  }
  if (W[0] == 1) n = (N-n) % N;

  //cout<<"F[0]="<<F[0]<<", n="<<n<<"\n";
  int pos = lower_bound(all(fs), F[0]) - fs.begin();
  if (W[0] == 0 && fs[(pos+1)%N] == fs[pos]) pos = (pos+1)%N;
  // pos = ans[n]
  for (int i=n; i<n+N; i++) {
    ans[i%N] = fs[pos];
    pos++; pos %= N;
  }
  assert(F[0] == ans[n]);
  rep(i, N) cout << ans[i] << "\n";
  return 0;
}


Measured memory_bytes: 3828
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)














int main(){
    ll n;
    cin >> n;
    multiset<ll> st;
    REP(i, n){
        ll a;
        cin >> a;
        if(st.empty()){
            st.insert(a);
        }
        else{
            auto itr = st.lower_bound(a);
            if(itr == st.begin()){
                st.insert(a);
            }
            else{
                itr--;
                st.erase(itr);
                st.insert(a);
            }
        }
    }
    cout << st.size() << endl;
}


Measured memory_bytes: 4992
#ifdef xay5421
#define D(...) fprintf(stderr,__VA_ARGS__)
#else
#define D(...) ((void)0)
#define NDEBUG
#endif
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
const int N=150,P=1e9+7;
int n,m,top,ans,st[N],fac[N],ifac[N],inv[N],beg[N];
char s[N];
bool vis[N];
int C(int k1,int k2){
	if(k1<0||k2<0||k1-k2<0)return 0;
	return 1LL*fac[k1]*ifac[k2]%P*ifac[k1-k2]%P;
}
bool chk(){
	rep(i,1,m)vis[i]=0;
	int ntop=top;
	rep(i,1,ntop)beg[i]=0;
	for(int i=1;i<=ntop;++i){
		beg[i]=max(beg[i],beg[i-1]+1);
		while(beg[i]<=m&&s[beg[i]]!='r')++beg[i];
		if(beg[i]>m)return 0;
		vis[beg[i]]=1;
		beg[i]=beg[i];
	}
	while(ntop&&st[ntop]==1)--ntop;
	for(int i=1;i<=ntop;++i){
		beg[i]=max(beg[i],beg[i-1]+1);
		while(beg[i]<=m&&s[beg[i]]!='b')++beg[i];
		if(beg[i]>m)return 0;
		vis[beg[i]]=1;
	}
	for(int i=1;i<=ntop;++i){
		beg[i]=max(beg[i],beg[i-1]+1);
		rep(_,1,st[i]-2){
			while(beg[i]<=m&&vis[beg[i]])++beg[i];
			if(beg[i]>m)return 0;
			vis[beg[i]]=1;
		}
	}
	return 1;
}
void dfs(int num,int mn,int mx,int ntop){
	if(!num){
		if(!chk())return;
		rep(i,1,top){
			D("%d ",st[i]);
		}
		D("\n");
		D(">>> %d %d\n",mn,mx);
		int ans=C(n-mn+mx-1,mx-1);
		while(ntop){
			int x=st[ntop];
			int t=0;
			while(st[ntop]==x)++t,--ntop;
			ans=1LL*ans*C(ntop+t,t)%P;
		}
		(::ans+=ans)%=P;
		return;
	}
	while(1){
		dfs(num-1,mn,mx,ntop);
		top=ntop;
		mn+=(num==1?1:2*num-3)+!!mn;
		if(mn>n)return;
		mx+=2*num;
		st[++top]=num;
		++ntop;
	}
}
int main(){
	fac[0]=fac[1]=inv[0]=inv[1]=ifac[0]=ifac[1]=1;
	for(int i=2;i<N;++i)fac[i]=1LL*fac[i-1]*i%P,inv[i]=1LL*(P-P/i)*inv[P%i]%P,ifac[i]=1LL*ifac[i-1]*inv[i]%P;
	scanf("%d%d%s",&n,&m,s+1);
	dfs(n+3,0,1,0);
	printf("%d\n",ans);
	return 0;
}

/*
1 35
rbrbrbrbrbrbrbrbrbrbrbrbrbrbrbrbrbr

3
*/

/*
30 35
rrrrrrrrrrrrrrrrrbbbbbbbbbbbbbbbbbb

130653412
*/

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

ll gcd(ll a, ll b)
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

int main()
{
    ll a, b;
    cin >> a >> b;
    int ans_cnt = 1;

    ll gcd_ab = gcd(a, b);
    for (ll i = 2; i*i<=gcd_ab; i++)
    {
        if (gcd_ab%i) continue;
        ans_cnt++;
        while (gcd_ab % i == 0)
        {
            gcd_ab /= i;
        }
    }
    if(gcd_ab!=1) ans_cnt++;
    cout << ans_cnt << endl;
}

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

using namespace std;

#define pb push_back
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ina(x, n) rep(x_i,n) cin>>x[x_i]
#define outa(x, n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;

int main() {
  ll n, k; cin >> n >> k;
  vl a(n), sums; ina(a,n);
  rep(i,n) {
    ll sum = 0;
    REP(j,i,n) {
      sum += a[j];
      sums.pb(sum);
    }
  }
  ll ans = 0, N = sums.size();
  for (int i = 40; i >= 0; i--) {
    ll t = (1LL<<i), cnt = 0;
    rep(j,N) {
      cnt += ((ans+t)&sums[j]) == (ans+t);
    }
    if (cnt >= k) ans += t;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6516