akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define DB(x){if(DEBUG)cerr<<__LINE__<<" "<<#x<<" " <<x<<endl;}
#define REP(i,b)for(LL i=(0);i<(b);++i)
#define FOR(i,a,b)for(LL i=(a);i<=(b);++i)
#define FORD(i,a,b)for(LL i=(a);i>=(b);--i)
#define ALL(x) (x).begin(),(x).end()
#define VV vector
template<typename X,typename Y>void MAX(X&a,Y b){a=(a>=b?a:b);}
template<typename X,typename Y>void MIN(X&a,Y b){a=(a<=b?a:b);}
typedef long long LL;typedef long double LD;
int DEBUG=0,MULTI=0,GCJ=0;

struct solver_t;solver_t *solver;
struct solver_t {


  void solve() {
    int N; cin >> N;
    cout << 0 << endl;
    cout.flush();

    string sex;
    cin >> sex;
    int fem = (sex == "Female");
    DB("");
    if (sex == "Vacant") return;
    int left = 1, right = N - 1;
    DB("");

    while (left < right) {
      DB("");

      int mid = (left + right) / 2;

      cout << mid << endl;
      cout.flush();
      int expected = (mid - 0 + fem) % 2;
      cin >> sex;
      if (sex == "Vacant") return;
      int cur_fem = (sex == "Female");
      if (cur_fem == expected) {
        left = mid + 1;
      }
      else right = mid - 1;
    }
    cout << left << "\n";
  }
  void gen() {}
  void brute() {}
};

int main(int argc,char** argv){
  FOR(i,1,argc-1)for(int j=0;argv[i][j];j++)if(argv[i][j]=='.')freopen(argv[i],"r",stdin);
  FOR(i,1,argc-1)if(argv[i]==string("q"))DEBUG=1<<30;
  FOR(i,1,argc-1)if(argv[i]==string("gen")){(solver=new solver_t())->gen();exit(0);}
  FOR(i,1,argc-1)if(argv[i]==string("brute")){(solver=new solver_t())->brute();exit(0);}
  ios::sync_with_stdio(false),cin.tie(0);
  cout.setf(ios::fixed),cout.precision(10);int t;if(MULTI||GCJ)cin>>t;else t=1;
  FOR(i,1,t){if(DEBUG)cerr<<__LINE__<<" "<<i<<endl;if(GCJ)cout<<"Case #"<<i<<": ";
    solver = new solver_t();
    solver->solve();
  }return 0;
}



Measured memory_bytes: 852
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

Graph G(60);
int dfs(int v,int from,int to,vector<bool>&seen){
    seen[v] = true;
    for(auto nv : G[v]){
        if(v == from && nv == to)continue;
        if(v == to && nv == from)continue;
        if(seen[nv])continue;
        dfs(nv,from,to,seen);
    }
}


int main(){
    int n,m;cin>>n>>m;
    vector<P>p;
    rep(i,m){
        int a,b;cin>>a>>b;
        a--;b--;
        p.emplace_back(a,b);
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int res = 0;
    rep(i,m){
        int from = p[i].first,to = p[i].second;
        int cnt = 0;
        vector<bool>seen(n,false);
        rep(j,n){
            if(seen[j])continue;
            cnt++;
            dfs(j,from,to,seen);
        }
        if(cnt!=1)res++;
    }
    cout<<res<<endl;
}



Measured memory_bytes: 256
#include<stdio.h>
int a[10][10],c[10][10];
void f(int x,int y){
  int ny,nx,i,j;
  int X[]={0,0,1,0,-1};
  int Y[]={0,1,0,-1,0};
  a[y][x]=1;
  for(i=0;i<5;i++){
    nx=x+X[i];
    ny=y+Y[i];
    if(nx<0||ny<0||9<ny||9<nx)continue;
    c[ny][nx]=1-c[ny][nx];
  }
}
int main(){
  int n,d[10][10],i,j,k,s;
  scanf("%d",&n);
  while(n--){
    for(i=0;i<10;i++){
      for(j=0;j<10;j++)scanf("%d",&d[i][j]);
    }
    for(i=0;i<1<<10;i++){
      for(j=0;j<100;j++){
	a[j/10][j%10]=0;
	c[j/10][j%10]=d[j/10][j%10];
      }
      for(j=0;j<10;j++){
	if(i&1<<j)f(j,0);
      }
      for(j=0;j<9;j++){
	for(k=0;k<10;k++){
	  if(c[j][k])f(k,j+1);
	}
      }
      for(j=s=0;j<10;j++)s+=c[9][j];
      if(s==0)break;
    }//printf("%d\n",i);
    for(i=0;i<10;i++){
      for(j=0;j<10;j++){
	if(j)printf(" ");
	printf("%d",a[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}

Measured memory_bytes: 604
#include <stdio.h>

int main(void)
{

	int a, b, c;
	int e;
	scanf("%d %d %d", &a, &b, &c);
	if (a >= b) {
		e = a;
		a = b;
		b = e;
	}
	if (b >= c) {
		e = b;
		b = c;
		c = e;
	}
	if (a >= b) {
		e = a;
		a = b;
		b = e;
	}
	printf("%d %d %d\n", a, b, c);

	return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//do {
//    print(v);
//  } while (std::next_permutation(v.begin(), v.end()));


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

	int A, B, K;
	cin >> A >> B >> K;
	int cnt = 0;
	int ans[100];
	eFOR(i, 1, max(A, B)) {
		if (A%i == 0 && B%i == 0) {
			ans[cnt] = i;
			cnt++;
			//cout << i << endl;
		}
	}
	cout << ans[cnt - K] << endl;
	return 0;
}



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

#define ll long long 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
#define push push_back
using namespace std;

int main(){
	fastio
	int a;
	cin >> a;
	ll int result = 0;
	result += a/500*1000;
	a%=500;
	result += a/5*5;
	cout << result;
}

Measured memory_bytes: 256
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var s = o.l();
  var ans = 0;
  var m = n>>1;
  for(var i = 1; i < m; i++){
    var set = new Set();
    var k = 0;
    for(var j = i; j < n-i; j += i){
      var t = n-j-1;
      if(set.has(j) || set.has(t) || j === t)break;
      k += s[j] + s[t];
      if(ans < k)ans = k;
      set.add(j);
      set.add(t);
    }
  }
  return ans;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

int D;
vector<int> down;
vector<vector<int>> up;

vector<int> ans;

void simulated_annealing() {
  constexpr double simulate_time = 2800000;
  constexpr double start_temp = 100;
  constexpr double end_temp = 10;

  clock_t s = clock(), f;

  ans.resize(D);
  for (int d = 0; d < D; ++d) {
    int maxi = 0;
    for (int i = 0; i < 26; ++i) {
      if (maxi < up[d][i]) {
        ans[d] = i;
        maxi = up[d][i];
      }
    }
  }

  // int now_score = all_calculation();
  // int max_score = now_score;
  // int changed_score;
  // int diff_score;
  // int before;
  // double temp;
  // double probability;
  // bool force;

  // while (f = clock(), f - s < simulate_time) {
  //   temp = start_temp + (end_temp - start_temp) * (f - s) / simulate_time;
  //   for (int &&i = 0; i < 100; ++i) {

  //     static int change_pos;
  //     static int change_num;
  //     do {
  //       change_pos = xor128();
  //       change_num = xor128();
  //     } while (!check(change_pos, change_num));
  //     before = state[change_pos];

  //     diff_score = calculation(change_pos);
  //     state[change_pos] = change_num;
  //     changed_score = now_score - diff_score + calculation_diff(change_pos);

  //     probability = exp((changed_score - now_score*1.0) / temp);
  //     force = probability > (xor128() % 1000 * 1.0 / 1000.0);
  //     if (changed_score > now_score || force) {
  //       now_score = changed_score;
  //       if (now_score > max_score) {
  //         max_score = now_score;
  //         ret_state = now_state;
  //       }
  //     } else {
  //       state[change_pos] = before_num;
  //     }
  //   }
  // }

  // return;
}


int main() {
  cin >> D;
  down.resize(26);
  up.resize(D, vector<int>(26));
  for (auto &in: down) {
    cin >> in;
  }
  for (auto &d: up) {
    for (auto &in: d) {
      cin >> in;
    }
  }

  simulated_annealing();
  for (auto a: ans) {
    cout << a + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define ll long long 
#define ull unsigned long long 
#define f(i,x,n) for(ll int i=x;i<n;i++) 
#define re(j,x,n) for(ll int j=x;j>=n;j--)
#define f1(k,x,n) for(ll int k=x;k<=n;k++)
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n;
    cin>>n;
    int a[n],sum=0;
    f(i,0,n)
    cin>>a[i];
    sort(a,a+n);
    f(i,0,n-1)
    sum+=a[i]; 
    if(sum>a[n-1])
    cout<<"Yes";
    else
    cout<<"No";
}

Measured memory_bytes: 256
d, n = map(int, input().split())

if d == 0:
    if n == 100:
        print(101)
    else:
        print(n)
elif d == 1:
    if n == 100:
        print(10100)
    else:
        print(n*100)
elif d == 2:
    if n == 100:
        print(1010000)
    else:
        print(n*10000)


Measured memory_bytes: 3060
#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;
#define PI  3.14159265358979323846
#define lp(i,n) for(int i = 0; i <n;i++)
#define range1(i,a,b,c) for(int i = int(a);i <= int(b);i+=int(c))
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define fr first
#define sc second
#define sz(v) ((int)((v).size()))
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef pair<int, int> pii;
template<class T> using ordered_set=tree<T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;
const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;
int dx[] = {0,0,-1,1};
int dy[] = {1,-1,0,0};
void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int val[26];
int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    ll num ;
    cin>>num;
    for(char a= 'a';a<='z';a++)val[a-'A']=a-'a';
    string ans ;
    while(num){
                num--;
                char c = char('a'+num%26);
                ans=c+ans;
                num/=26;
    }

    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n;
  cin >> n;
  ll a[n][3];
  rep(i,n){
    rep(j,3){
      cin >> a[i][j];
    }
  }
  ll dp[n+1][3];
  rep(i,n+1){
    rep(j,3){
      dp[i][j]=0;
    }
  }
  for(int i=1;i<=n;i++){
    rep(j,3){
      rep(k,3){
        if(k==j){
          continue;
        }
        dp[i][j]=max(dp[i][j],dp[i-1][k]+a[i-1][k]);
      }
    }
  }
  cout <<max(dp[n][0],max(dp[n][1],dp[n][2]));
}

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

int numberSize(string N) {
	int sum = 0;
	for (int i = 0; i < (int)N.size(); i++) {
		sum += N[i] - '0';
	}
	return sum;
}

int main() {
	string N; cin >> N;
	int sum = numberSize(N);
	int Max = N[0] - '0' + 9 * ((int)N.size() - 1);
	if (sum == Max) cout << sum << endl;
	else cout << Max - 1 << endl;
}

Measured memory_bytes: 3628
mod = 10**9+7
k = int(input())
s = input()
n = len(s)


def inv(a, mod):
    r = [1, 0, a]
    w = [0, 1, mod]
    while w[2] != 1:
        q = r[2]//w[2]
        r_new = [r[0]-q*w[0], r[1]-q*w[1], r[2]-q*w[2]]
        r = w
        w = r_new
    x, y = w[0], w[1]    # a*x+y*mod = 1
    return (mod+x % mod) % mod


max_num = 2*10**6+1
fact = [0 for _ in range(max_num)]
ifact = [0 for _ in range(max_num)]

fact[0] = fact[1] = 1
ifact[0] = ifact[1] = 1

for i in range(2, max_num):
    fact[i] = fact[i-1] * i % mod

ifact[max_num-1] = inv(fact[max_num-1], mod)

for i in range(2, max_num):
    ifact[max_num-i] = (ifact[max_num-i+1] * (max_num-i+1)) % mod


def comb(x, y):
    if x < 0 or y < 0 or x < y:
        return 0
    else:
        return fact[x] * ifact[y] * ifact[x-y] % mod


pow25 = [1]
pow26 = [1]
for i in range(10**6):
    pow25.append((pow25[-1]*25) % mod)
    pow26.append((pow26[-1]*26) % mod)

ans = 0
for i in range(k+1):
    tmp = comb(n-1+i, i)*pow25[i]
    tmp %= mod
    tmp *= pow26[k-i]
    tmp %= mod
    ans += tmp
    # ans += comb(n-1+i, i)*pow(25, i, mod)*pow(26, k-i, mod)
    ans %= mod

print(ans)


Measured memory_bytes: 201888
N, Y = map(int, input().split())

YUKICHI = 10000
ICHIYO = 5000
HIDEYO = 1000

def conf_N(N,Y):
    yukichi = Y//YUKICHI
    
    for y in range(yukichi+1):
        ichiyo = (Y-y*YUKICHI)//5000
        for i in range(ichiyo+1):
            hideyo = (Y-y*YUKICHI-i*ICHIYO)//1000
            
            if y+i+hideyo == N:
                return [y,i,hideyo]
    
    return [-1,-1,-1]


ans = conf_N(N,Y)
print(*ans)

Measured memory_bytes: 3064
import java.util.*;
//import java.io.*;
import java.util.stream.IntStream;

public class Main{
    static int minR = Integer.MAX_VALUE;
    static int maxL = 0;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
        int n = sc.nextInt();
        int m = sc.nextInt();
        int L[] = new int[m];
        int R[] = new int[m];
        //全ての区間[Li,Ri]に入っている数字の数+1が答え
        IntStream.range(0, m).forEach(i -> {
            L[i] = sc.nextInt();
            R[i] = sc.nextInt();
            minR = Math.min(R[i],minR);
            maxL = Math.max(L[i],maxL);
        });

        int ans= Math.max(0,minR - maxL + 1);
        System.out.println(ans);

    }
}

Measured memory_bytes: 65884
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  int I = -1;
  cin >> A >> B ;
  for(int i = 1;i <=1250;i++){
  	if(floor(i * 0.08) == A && floor(i * 0.1) == B){
    	I = i;
      	break;
    }
  }
  cout << I << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x) memset(x,0,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 110000
/*------------------------------------------------------------*/
//map<int,int>u;
int f[201][201];
int u[201];
int a[201];
int ans=INT_MAX;
int r;
void dfs(int x,int k,int b){
	if(x==r+1){
		ans=min(ans,k);
		return ;
	}
	FOR(j,1,r){
		int i=a[j];
		if(!u[i]&&(x==1||f[b][i])){
			u[i]=true;
			if(x==1)dfs(x+1,0,i);
		 	 else dfs(x+1,k+f[b][i],i);
		 	u[i]=false;
		}
	}
}
int main(){
	int n,m;
	in3(n,m,r);
	FOR(i,1,r)in(a[i]);
	FOR(i,1,m){
		int c1,c2,c3;
		in3(c1,c2,c3);
		f[c1][c2]=c3;
		f[c2][c1]=c3;
	}
	FOR(k,1,n)
		FOR(i,1,n)
			FOR(j,i+1,n)
				if(f[i][k]&&f[k][j]&&(!f[i][j]||(f[i][j]>f[i][k]+f[k][j]))){
					f[i][j]=f[i][k]+f[k][j];
					f[j][i]=f[i][k]+f[k][j];
				}
	dfs(1,0,0);
	out(ans);

}


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

typedef long long ll;
const int maxn=2e5+10;
int n,p[maxn],dsu[maxn],v[maxn],cnt0[maxn],cnt1[maxn];
ll ans;

struct node{
	int id,cnt0,cnt1;
	bool operator< (const node&o)const{
		return (ll)cnt0*o.cnt1<(ll)cnt1*o.cnt0;
	}
};
priority_queue<node> q;
int find(int x){
	if(dsu[x]==x)return x;
	return dsu[x]=find(dsu[x]);
}

int main(){
	cin>>n;
	for(int i=2;i<=n;++i)
		cin>>p[i];
	for(int i=1;i<=n;++i)
		cin>>v[i];
	for(int i=1;i<=n;++i){
		if(v[i])
			++cnt1[i];
		else
			++cnt0[i];
		q.push((node){i,cnt0[i],cnt1[i]});
		dsu[i]=i;
	}
	while(!q.empty()){
		int pos=q.top().id;q.pop();
		if(dsu[pos]!=pos)
			continue;
		if(find(p[pos])){
			int fa=find(p[pos]);
			ans+=(ll)cnt1[fa]*cnt0[pos];
			cnt0[fa]+=cnt0[pos];
			cnt1[fa]+=cnt1[pos];
			dsu[pos]=fa;
			q.push((node){fa,cnt0[fa],cnt1[fa]});
		}
		else{
			ans+=(ll)cnt1[0]*cnt0[pos];
			cnt0[0]+=cnt0[pos];
			cnt1[0]+=cnt1[pos];
			dsu[pos]=0;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

const int N=5e4,M=110;



void smain() {

    int n;
    string s;
    cin>>n>>s;
    int cnt=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R')
            cnt++;
    }
    if(cnt>n-cnt)
        cout<<"Yes";
    else
        cout<<"No";


}

Measured memory_bytes: 3612
import java.util.Scanner;

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

        int out = 0;
        for(int i = 1; i < k + 1; i++){
            for(int j = 1; j < k + 1; j++){
                for(int h = 1; h < k + 1; h++){
                    out += gcd(i, gcd(j, h));
                }
            }
        }

        System.out.println(out);
        sc.close();
    }
    static int gcd(int a, int b){
        if(a < b) {
            int tmp = a;
            a = b;
            b = tmp;
        }
        if(b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }
}

Measured memory_bytes: 35804
#include <bits/stdc++.h>
using namespace std;
int main() {
	char a;
	cin>>a;
	if(a=='A'){
		cout<<'T'<<endl;
	}
	if(a=='T'){
		cout<<'A'<<endl;
	}
	if(a=='G'){
		cout<<'C'<<endl;
	}
	if(a=='C'){
		cout<<'G'<<endl;
}}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;
    return (y%2 == 0)? p : (x * p) % m;
}
signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{   
		int n;
		cin >> n;
		if(n%2) cout<<0;
		else{
			n /= 2;
			int two=1,five=0;
			int cur = n/2;
			int i=0;
			while(cur>0){
				two+=cur;
				cur/=2;

			}
			cur = n/5;
			i=0;
			while(cur>0){
				five+=cur;
				cur/=5;

			}
			cout<<min(two,five);
		}
	}   
}     

Measured memory_bytes: 256
h,w,K=map(int,input().split())
c=[input() for i in range(h)]
ans=0
for i in range(2**h):
    for j in range(2**w):
        d=[[c[z][v] for v in range(w)]for z in range(h)]
        for k in range(h):
            if (i>>k)&1:
                for l in range(w):
                    d[k][l]="x"
        for k in range(w):
            if (j>>k)&1:
                for l in range(h):
                    d[l][k]="x"
        cnt=0
        for k in range(h):
            for l in range(w):
                cnt+=(d[k][l]=="#")
        ans+=(cnt==K)
print(ans)

Measured memory_bytes: 9232
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<functional>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef queue<P> Q;

#define _CRT_SECURE_NO_WARNINGS

int N = 0;
string w[105];
int main() {
    bool f=true;
	cin >> N;
	for(int i=0;i<N;i++){
        cin >> w[i];
        if( i > 0 && w[i-1][w[i-1].size()-1] != w[i][0] ){
            f=false;
        }
    }
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            if(w[i]==w[j]){
                f=false;
            }
        }   
    }
    string ans=(f ? "Yes":"No");
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func divFloor(a, b int) int {
	return (a + (b - 1)) / b
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()

	nowT, nowA := 1, 1
	for i := 0; i < n; i++ {
		t, a := nextInt(), nextInt()
		k := max(divFloor(nowT, t), divFloor(nowA, a))
		nowT, nowA = k*t, k*a
	}

	puts(nowT + nowA)
}


Measured memory_bytes: 640
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto x = lread();
    if (x == 1)
    {
        writeln(0);
    }
    else
    {
        writeln(1);
    }
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <cmath>
#include <iterator>
#include <math.h>
#include <cstdio>
#include <map>

using namespace std;
using lli = long long int;

int main(void){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b>c+d){
        cout << "Left" << endl;
    }else if(a+b<c+d){
        cout << "Right" << endl;
    }else{
        cout << "Balanced" << endl;
    }
}


Measured memory_bytes: 256
/*input
13
strangeorange
*/

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

int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<vector<int>> dp(2, vector<int>(n));
    vector<int> cur = dp[0], nxt = dp[1];
    rep(i, n) {
        if (s[i] == s[n-1]) nxt[i] = 1;
    }
    int ans = 0;
    for (int j = n-2; j >= 0; j--) {
        for (int i = j; i >= 0; i--) {
            if (s[i] == s[j]) {
                cur[i] = nxt[i+1]+1;
                ans = max(ans, min(j-i, cur[i]));
            }
            else {
                cur[i] = 0;
            }
        }
        swap(cur, nxt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    int ac=0, wa=0, tle=0, re=0;
    while(N--) {
        string s;
        cin >> s;
        if(s == "AC") {
            ac++;
        } else if(s == "WA") {
            wa++;
        } else if(s == "TLE") {
            tle++;
        } else {
            re++;
        }
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}


Measured memory_bytes: 3624
/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define ld long double
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define el '\n'
#define N 1000000007
#define re return
#define F first
#define S second
#define L length
#define deb(x) cout<<#x<<" "<<x<<el;
#define mp make_pair
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n==1) return x;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                              //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

template<typename T>
T maxx(T a,T b)
{
  if(a<b) re b;
  re b;
}
template<typename T, typename... Args>
T maxx(T a,T b, Args... args)
{
    re(maxx(maxx(a,b),args...));
}

template<typename T>
T minn(T a,T b)
{
  if(a<b) re a;
  re b;
}
template<typename T, typename... Args>
T minn(T a,T b, Args... args)
{
    re(minn(minn(a,b),args...));
}

template<typename T>
void read(T& a)
{
  cin>>a;
}
template<typename T, typename... Args>
void read(T& a,Args&... args)
{
  cin>>a; read(args...);
}

template<typename T>
void write(T a)
{
  cout<<a<<' ';
}
template<typename T, typename... Args>
void write(T a,Args... args)
{
  cout<<a<<' '; write(args...);
}

inline ll min(ll a,ll b)
{
  if(a<b) re a;
  else re b;
}
inline ll max(ll a,ll b)
{
  if(a<b) re b;
  else re a;
}

ll gcd(ll a, ll b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=((ans*((n-i)%N))%N*modInverse(i+1,N))%N;
  }
  re ans;
}

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

  int t=1;
  //cin>>t;
  while(t--)
  {
    ll n,m,k;
    cin>>n>>m>>k;
    cout<<((n+m-1)/m)*k<<el;

  }


  return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30 ;
struct edge{
  int pos, strong ;
  int dp[77];

  edge(int pos, int strong): pos(pos), strong(strong){
    fill_n( dp, 77, INF);
  };
  edge(){};
};

int main(){
  int n; //行数 
  int m; //ジャンプの数

  vector< edge > node[152] ;

  while(scanf("%d %d", &n, &m), n){
    for(int i = 0; i < n; i++){
      int k;
      scanf("%d", &k);
      node[i].resize(k) ;
      for(int j = 0; j < k; j++){
        int x, d;
        scanf("%d %d", &x, &d);
        node[i][j] = edge( x, d);
      }
    }

    for(int i = 0; i < node[0].size(); i++){ //最初は普通にジャンプ
      node[0][i].dp[0] = 0;
    }
    for(int i = 0; i < node[1].size(); i++){ //最初はジャンプする
      node[1][i].dp[1] = 0 ;
    }
    for(int i = 0; i < n; i++){
      for(int j = 0; j < node[i].size(); j++){
        for(int k = 0; k <= m; k++){
          if(node[i][j].dp[k] != INF){
            if(k != m){
              for(int l = 0; l < node[i + 2].size(); l++){
                node[i + 2][l].dp[k + 1] = min( node[i + 2][l].dp[k + 1], node[i][j].dp[k] + (node[i + 2][l].strong + node[i][j].strong) * abs(node[i + 2][l].pos - node[i][j].pos));
              }
            }
            for(int l = 0; l < node[i + 1].size(); l++){
              node[i + 1][l].dp[k] = min( node[i + 1][l].dp[k], node[i][j].dp[k] + (node[i + 1][l].strong + node[i][j].strong) * abs(node[i + 1][l].pos - node[i][j].pos));
            }
          }
        }
      }
    }
    int ret = INF ;
    for(int i = 0; i < node[n - 1].size(); i++){
      for(int j = 0; j <= m; j++){
        ret = min( ret, node[n - 1][i].dp[j]);
      }
    }
    for(int i = 0; i < node[n - 2].size(); i++){
      for(int j = 0; j < m; j++){
        ret = min( ret, node[n - 2][i].dp[j]);
      }
    }
    printf("%d\n", ret);
  }
}

Measured memory_bytes: 1712
#include "bits/stdc++.h"
using namespace std;

int main(){

    char ch1,ch2;
    cin >> ch1 >> ch2;
    
    if(ch2 == 'D'){
        
        if(ch1 == 'H'){
            
            cout << 'D';
        }
        else{
            
            cout << 'H';
        }
    }
    else{
        
        cout << ch1;
    }
}

Measured memory_bytes: 256
a, b = map(int, input().split())
if a < 0:
    if b < 0:
        if (b - a) % 2 == 0:
            print('Negative')
        else:
            print('Positive')
    else:
        print('Zero')
elif a == 0:
    print('Zero')
else:
    print('Positive')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int N, M;
    cin >> N >> M;
    
    map<int,int> mp;
    rep(i, M) {
        int a,b;
        cin >> a >> b;
        --a,--b;
        ++mp[a];
        ++mp[b];
    }        
    rep(i,N){
        cout << mp[i] << endl;
    }
}


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

int main(){
    int A,B,C,X,sum=0;
    cin >> A >> B >> C >> X;
    for (int i=0;i<=A;i++){
        for(int j=0;j<=B;j++){
            for(int k=0;k<=C;k++){
                if (500*i+100*j+50*k==X){
                    sum++;
                }
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
  int a,b,c;

  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  
  if((a<b) && (b<c))
  printf("Yes\n");
  else
  printf("No\n");
 
  return 0;
}


Measured memory_bytes: 2112
#include <stdio.h>

int main() {

  char str[1001];
  scanf("%s", str);

  int w;
  scanf("%d", &w);

  int idx = 0;
  while(str[idx] != '\0') {
    if(idx % w == 0) {
      printf("%c", str[idx]);
    }
    idx++;
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 128
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return a-b;
}

const s: string = input[0];
const li: string[] = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];

for(let i = 0; i < 7; i++){
    if (li[i] === s){
        console.log(7-i)
    }
}


Measured memory_bytes: 7372
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)


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

	if(a >= b+c) cout << "0\n";
	else cout << c - (a-b);
	
	
	
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	string s;
	cin >> s;


	for (int ii = 0; ii < s.size(); ++ii){
		if (s[ii] == '?'){
			s[ii] = 'D';
		}
		cout << s[ii];

	}


	return 0;
}


Measured memory_bytes: 3724
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int[] AB = GetInts(2);
		for(int i = 1; i <= 3; i++)
		{
			if(!AB.Contains(i))
			{
				WriteLine(i);
				return;
			}
		}

	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 13396
def solve(n, a, b):
    v = sorted(zip(a, b), key=lambda x:x[0]+x[1], reverse=True)
    return sum(x+y for x, y in v[::2]) - sum(b)

n = int(input())
a = [0]*n
b = [0]*n
for i in range(n):
    a[i], b[i] = map(int, input().split())
print(solve(n, a, b))

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

typedef long long ll;
const ll mod = 1e9+7;
ll n, k;
ll Num[233333];
ll Sum[233333];
ll Out;

int main(){
	cin >> n >> k;
	for(int i = 1; i <= n; i++) Sum[i] = Sum[i - 1] + i;
	for(int i = k; i <= n; i++){
		ll R = Sum[n] - Sum[n - i];
		ll L = Sum[i - 1];
		Out += (R - L + 1) ;
		Out %= mod;
	}
	cout<< Out + 1;
	return 0;
	return 0;
}

Measured memory_bytes: 5008
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

// const i64 mod = 1'000'000'000ll + 7;
const i64 mod = 998244353ll;

//const i64 inf = mod;

const long double eps = 1e-8;

struct segtree {
    typedef i64 type;
    const type zero = 0;

    vector<type> st;

    void init(i64 size) {
        i64 n = 1;
        while (n < size) {
            n *= 2;
        }
        st.assign(n * 2, zero);
    }

    void add(i64 l, i64 r, type v, i64 x, i64 lx, i64 rx) {
        if (r <= lx || rx <= l) {
            return;
        }

        if (l <= lx && rx <= r) {
            st[x] += v;
            st[x] %= mod;
            return;
        }

        i64 mx = (lx + rx) / 2;
        add(l, r, v, 2 * x + 1, lx, mx);
        add(l, r, v, 2 * x + 2, mx, rx);
    }

    void add(i64 l, i64 r, type v) {
        add(l, r, v, 0, 0, st.size() / 2);
    }

    type get(i64 i, i64 x, i64 lx, i64 rx) {
        if (rx - lx == 1) {
            return st[x];
        }

        i64 mx = (lx + rx) / 2;
        if (i < mx) {
            return (get(i, 2 * x + 1, lx, mx) + st[x]) % mod;
        }
        else {
            return (get(i, 2 * x + 2, mx, rx) + st[x]) % mod;
        }
    }

    type get(i64 i) {
        return get(i, 0, 0, st.size() / 2);
    }
};


int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed); cerr.precision(15); cerr.setf(ios::fixed);

    i64 n, x, m;
    cin >> n >> x >> m;

    vector<i64> a;
    a.push_back(x);

    map<i64, i64> q;
    q[x] = 0;


    i64 i = 1;
    i64 s = x;

    i64 t = 0;
    i64 j = 0;

    while (i < n) {
        i64 v = sqr(a.back()) % m;
        if (q.count(v)) {
            t = i - q[v];
            j = q[v];
            break;
        }
        a.push_back(v);
        q[v] = i;
        s += a.back();
        i += 1;
    }

    if (t) {
        i64 st = 0;
        for (i64 i = j; i < a.size(); i++) {
            st += a[i];
        }

        i64 p = (n - i) / t;
        i += p * t;
        s += p * st;
    }


    while (i < n) {
        i64 v = sqr(a.back()) % m;
        a.push_back(v);
        s += a.back();
        i += 1;
    }

    cout << s << endl;
    

    return 0;
}

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

using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b;
	string s;
	cin >> a >> b;
	cin >> s;
	int k = 0;
	for (int i = 0; i < s.length(); ++i){
		if (s[i] == '-'){
			++k;
		}
	}
	cout << (k == 1 && s[a] == '-' ? "Yes":"No");	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;

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

ll lcm(ll a, ll b) { //最小公倍数
  return a * b / gcd(a, b);
}

ll digit_sum(ll a){ //10進桁和
  ll ans=0;
  while(a>0){
    ans+=a%10;
    a/=10;
  }
  return ans;
}



int main()
{
  ll a,b,x;
  cin>>a>>b>>x;
  rep(i,b+1){
    if(a+i==x){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 3608
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[][] c = new int[4][4];
        c[1][1]=scanner.nextInt();
        c[1][2]=scanner.nextInt();
        c[1][3]=scanner.nextInt();
        c[2][1]=scanner.nextInt();
        c[2][2]=scanner.nextInt();
        c[2][3]=scanner.nextInt();
        c[3][1]=scanner.nextInt();
        c[3][2]=scanner.nextInt();
        c[3][3]=scanner.nextInt();
        boolean b1 = c[2][1]-c[1][1]==c[2][2]-c[1][2]&&c[2][2]-c[1][2]==c[2][3]-c[1][3];
        boolean b2 = c[3][1]-c[2][1]==c[3][2]-c[2][2]&&c[3][2]-c[2][2]==c[3][3]-c[2][3];
        boolean b3 = c[1][2]-c[1][1]==c[2][2]-c[2][1]&&c[2][2]-c[2][1]==c[3][2]-c[3][1];
        boolean b4 = c[1][3]-c[1][2]==c[2][3]-c[2][2]&&c[2][3]-c[2][2]==c[3][3]-c[3][2];
        if (b1&&b2&&b3&&b4){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }

    }

}

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

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;
const int N = 100010;
const int MAX_V = 523;//0000;
const int mod = (int)1e9 + 7;
const int base = 1023456789;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

inline int in() {int x; scanf("%d",&x); return x;}
inline ll lin() {ll x; scanf("%lld",&x); return x;}

inline void fastScan(int &x){
    bool negative = false;
    register int c = getchar();
    x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-'){
        negative = true;
        c = getchar();
    }
    for(   ; (c > 47 && c < 58); c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(negative)
        x = -x;
}

int fx[]={1,-1,0,0};
int fy[]={0,0,-1,1};

int main(){
    int n, m;
    fastScan(n); fastScan(m);
    if(abs(n - m) == 1){
        int a = 1ll, b = 1ll;
        for(int i = 1; i <= n; i++) a = 1ll * a * i % mod;
        for(int i = 1; i <= m; i++) b = 1ll * b * i % mod;
        printf("%d\n", 1ll * a * b % mod);
    }else if(abs(n - m) == 0){
        int a = 1ll, b = 1ll;
        for(int i = 1; i <= n; i++) a = 1ll * a * i % mod;
        for(int i = 1; i <= m; i++) b = 1ll * b * i % mod;
        printf("%d\n", 2ll * a * b % mod);
    }else {
        printf("0\n");
    }
}


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

const int MAX_N = 1000005;
std::vector<ll> num_divisor(MAX_N, 0);

void init_num_divisor() {
    for (int i = 1; i < MAX_N; ++i) {
        for (int j = i; j < MAX_N; j += i) {
            num_divisor[j]++;
        }
    }
}

int main() {
    init_num_divisor();
    int N; cin >> N;
    ll cnt = 0;
    for (int c = 1; c < N; ++c) cnt += num_divisor[c];
    cout << cnt << endl;
    return 0;
}


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	map<string,ll>mp;
	string s,w;
	ll n;
	cin>>n;
	vector<ll>v(n);
	for(ll i=0;i<n-1;i++){
		cin>>w;
		mp[w]++;
	}
	for(auto p:mp){
		auto a=p.first;
		auto b=p.second;
		v.at(stoi(a)-1)=b;
	}
	for(ll i=0;i<n;i++){
		cout<<v.at(i)<<endl;
	}
}


Measured memory_bytes: 20304
#include<stdio.h>

int main(void) {
    int w, h, x, y, r;
    int tmp;
    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r );

    if(x >= 0 + r && y >= 0 + r && x <= w - r && y <= h - r) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }


    return 0;
}

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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int l = -1, r = -1;
    for (int i = 0; i+2 <= n; i++) {
        if (s[i] == s[i+1]) {
            l = i+1, r = i+2;
            break;
        } else if (i+3 <= n && (s[i+1] == s[i+2] || s[i+2] == s[i])) {
            l = i+1, r = i+3;
            break;
        }
    }

    cout << l << " " << r << endl;
}


Measured memory_bytes: 512