akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

signed main()
{
  int N; cin >> N;
  vector<int> v;
  REP(n,N) {
    int vv; cin >> vv; v.push_back(vv);
  }

  int ans = 0;
  REP(n,N) {
    FOR(nn,n+1,N) {
      ans += v[n] * v[nn];
    }
  }

  cout << ans << endl;

  return 0;
}


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

class Main{

	public static void main(String[] args){

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int l = in.nextInt();	
		
		String[] s = new String[n];
		
		for(int i = 0; i < n; i++){
			s[i] = in.next();	
		}
		
		Arrays.sort(s);
	
		for(int i = 0; i < n; i++){
			System.out.print(s[i]);
		}
		
		System.out.println();
		in.close();

	}

}

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

#define pii pair<int,int>
#define pll pair<ll,ll>
#define eb emplace_back
#define ll long long
#define nl '\n'
#define deb(x) cerr<<#x" = "<<x<<nl
#define in() ( { int a ; scanf("%d",&a); a; } )

const int N = 3e5 + 9;
const int mod = 1e9 + 7;

int a[N], cnt[16], dp[1<<16], pos[1<<16];
int32_t main()
{
    int n=in();
    for(int i=1; i<n; i++){
        int u=in(), v=in(), k=in();
        u++; v++;
        a[u]^=k; a[v]^=k;
    }
    int ans=0;
    for(int i=1; i<=n; i++) cnt[a[i]]++;
    ans+=cnt[0];
    for(int i=1; i<16; i++) ans+=cnt[i]>>1, cnt[i]%=2;
    cnt[0]=0;
    dp[0]=0;
    vector<int> v;
    for(int i=0; i<16; i++) if(cnt[i]) v.eb(i);
    int m=v.size();
    for(int mask=1; mask<(1<<m); mask++){
        int nw=0;
        for(int i=0; i<m; i++) if((mask>>i)&1) nw^=v[i];
        if(nw==0) pos[mask]=1;
    }
    for(int mask=1; mask<(1<<m); mask++){
        for(int sub=mask; sub; sub=(sub-1)&mask){
            if(pos[sub]) dp[mask]=max(dp[mask], dp[mask^sub]+1);
        }
    }
    ans+=dp[(1<<m)-1];
    cout<<n-ans<<nl;
    return 0;
}


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

int main(){
    int N, K;
    cin >> N >> K;

    map<int, int> m;
    for(int i = 0; i < N; ++i){
        int a;
        cin >> a;
        m[a]++;
    }

    vector<int> vec(N + 1);
    int sum = 0;
    for(int i = 0; i <= 200000; ++i){
        if(m[i] > 0){
            sum ++;
            vec[m[i]]++;
        }
    }
    if(sum <= K){
        cout << 0 << endl;
        return 0;
    }
    sum -= K;

    int ans = 0;
    for(int i = 1; i <= N; ++i){
        if(sum >= vec[i]){
            ans += vec[i] * i;
            sum -= vec[i];
        }
        else {
            ans += sum * i;
            sum = 0;
            break;
        }
    }
    cout << ans << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] -= i + 1;
  }

  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }

  sort(begin(a), end(a));
  for (int i = n - 1; i >= 0; i--) {
    a[i] -= a[0];
  }
  for (int i = 0; i < n - 1; i++) {
    a[i + 1] += a[i];
  }
  /*
  for (auto e : a) {
    cerr << e << " ";
  }
  cerr << endl;
  */
  ll m = 1e15;
  for (int i = 0; i < n - 1; i++) {
    m = min(m, ((i + 1) * (a[i + 1] - a[i]) - a[i]) + (a[n - 1] - a[i] - (n - i - 1) * (a[i + 1] - a[i])));
  }
  cout << m << endl;
}


Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 21:01:14 2020

@author: NEC-PCuser
"""

N = int(input())
A = list(map(int, input().split()))
MAX = 10 ** 18
ans = 1
zero_flg = False
for i in A:
    if (i == 0):
        print(0)
        zero_flg = True
        break
    
if (zero_flg == False):
    for i in A:
        ans *= i
        if (ans > MAX):
            print(-1)
            break
    else:
        print(ans)

Measured memory_bytes: 21712
#include <iostream>
#include <cmath>
#include <string>
#include <cstdlib>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cctype>
#include <map>
#include <cstring>
#include <typeinfo>
#include <utility>
#define REP(i,n) for(int i = 0;i < n ;i++)
#define FOR(i,m,n) for(int i= m ;i<n;i++)
using namespace std;

int main(void){
  int w,h,n;
  cin >> w >> h >> n;
  int xr=w,xl=0,yd=0,yu=h;
  vector<int> x(n+1),y(n+1),a(n+1);
  int i;
  for(i=1;i<n+1;i++){
    cin >> x[i] >> y[i] >> a[i];
    if(a[i]==1 && xl<=x[i])xl=x[i];
    else if(a[i]==2 && xr>=x[i])xr=x[i];
    else if(a[i]==3 && yd<=y[i])yd=y[i];
    else if(a[i]==4 && yu>=y[i])yu=y[i];
  }
  int men = (xr-xl)*(yu-yd);//ここでマイナス*マイナスになってsample2が通らなかった
  if((xr-xl)<0 || (yu-yd)<0)cout << 0 <<endl;
  else cout << men << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int abc[] = new int[]{111, 222, 333, 444, 555, 666, 777, 888, 999};
            int n = Integer.parseInt(in.next());

            int ans = 0;
            for (int i = 0; i < 9; i++) {
                if (n > abc[i]) {
                    continue;
                } else {
                    ans = abc[i];
                    break;
                }
            }

            // 出力
            out.println(ans);

        }

    }
}



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

int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> A(H + 2);
    cout << '#';
    rep(i, W)
    {
        cout << '#';
    }
    cout << '#' << endl;
    rep(i, H)
    {
        cin >> A.at(i + 1);
        cout << '#' + A.at(i + 1) + '#' << endl;
    }
    cout << '#';
    rep(i, W)
    {
        cout << '#';
    }
    cout << '#' << endl;
}

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

int main() {
  int n;
  cin >> n;
  
  vector<int>N(n);
  for (int i = 0; i < n ; i++) {
    cin >> N.at(i);
  }
  reverse(N.begin(), N.end());
  
  for (int i = 0; i < n ; i++) {
    cout << N.at(i);
    if (i == n - 1){
      cout << endl;
    }
    else {
      cout << ' ';
    }
  }
}
  


Measured memory_bytes: 3100
#include <iostream>
#define llint long long

using namespace std;

llint x;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> x;
	for(int i = 1; ; i++){
		x -= i;
		if(x <= 0){
			cout << i << endl;
			break;
		}
	}
	
	return 0;
}

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

int main()
{
  string s;
  for(;cin>>s,s!="0";)
    {
      int r=0,g=0,b=0;
      for(int i=1;i<3;i++)
	{
	  r*=16;
	  if(s[i]>='0'&&s[i]<='9')
	      r+=s[i]-'0';
	  else
	    r+=s[i]-'a'+10;
	}
      for(int i=3;i<5;i++)
	{
	  g*=16;
	  if(s[i]>='0'&&s[i]<='9')
	      g+=s[i]-'0';
	  else
	   g+=s[i]-'a'+10;
	}
      for(int i=5;i<7;i++)
	{
	  b*=16;
	  if(s[i]>='0'&&s[i]<='9')
	      b+=s[i]-'0';
	  else
	    b+=s[i]-'a'+10;
	}
      string color[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};
      int rk[]={0,0,0,0,0xff,0xff,0xff,0xff};
      int gk[]={0,0,0xff,0xff,0,0,0xff,0xff};
      int bk[]={0,0xff,0,0xff,0,0xff,0,0xff};
      
      int ans=0;
      for(int i=1;i<8;i++)
	{
	  int a1=(r-rk[i])*(r-rk[i])+(g-gk[i])*(g-gk[i])+(b-bk[i])*(b-bk[i]);
	  int a2=(r-rk[ans])*(r-rk[ans])+(g-gk[ans])*(g-gk[ans])+(b-bk[ans])*(b-bk[ans]);
	  // /cout<<a1<<endl;
	  //cout<<a2<<endl;
	  if(a1<a2)
	    ans=i;
	}
      cout<<color[ans]<<endl;
    }
}

Measured memory_bytes: 1180
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
typedef long long           ll;
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
#define INF                 (ll)1e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	ll N, M;
	string S;
	cin >> N >> M >> S;

	vector<ll> ans;
	reverse(ALL(S));
	for (int i = 0; i < N;) {
		ll zeroPos = 0;
		ll stepLim = min(N - i, M);
		REPN(j, 1, stepLim + 1) {
			if (S[i + j] == '0') {
				zeroPos = j;
			}
		}
		if (zeroPos == 0) {
			cout << -1 << endl;
			return 0;
		}
		ans.emplace_back(zeroPos);
		i += zeroPos;
	}

	reverse(ALL(ans));
	for (auto one : ans) {
		cout << one << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 1528
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int K, N;
  cin>>K>>N;
  int A[N];
  for(int i=0;i<N;++i) cin>>A[i];
  vector<int> sa(N);
  for(int i=0;i<N;++i) {
    if(i==N-1) sa[i] = K - (A[N-1] - A[0]);
    else sa[i] = A[i+1] - A[i];
  }
  sort(sa.begin(), sa.end(), greater<int>());
  cout<<K-sa[0]<<endl;
}



Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;


int main(){
    int N; cin >> N;
    vector<int> a(N), b(N), c(N);
    rep(i, N) cin >> a[i];
    rep(i, N) cin >> b[i];
    rep(i, N) cin >> c[i];
    sort(all(a));
    sort(all(b));
    sort(all(c));
    vector<ll> sum(N + 1);
    sum[0] = 0;
    for(int i = 0; i < N; i++){
        auto itr = upper_bound(all(c), b[i]);
        sum[i + 1] = sum[i] + N - (itr - c.begin());
    }
    //下準備終わり
    ll ans = 0;
    rep(i, N){
        auto itr = upper_bound(all(b), a[i]);
        ans += sum[N] - sum[itr - b.begin()];
    }
    // rep(i, N + 1)cout << sum[i] << endl;
    cout << ans << endl;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x ,n) for(int i = x; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    string s;
    cin >> s;
    int n=s.size()-2;
    cout << s[0] << n << s[n+1];
	return 0;
}

Measured memory_bytes: 3588
// #pragma warning(disable:4786)
#include <iostream>
// #include <set>
using namespace std;

int main(){
    int s, a[100000], i = 0, flag = 0;

    cin >> s;
    a[i] = s;
    while(1){
        i++;
        if(a[i - 1] % 2 == 0)
            a[i] = a[i - 1] / 2;
        else
            a[i] = (3 * a[i - 1]) + 1;
        
        for (int j = 0; j < i; j++){
            if(a[i] == a[j])
                flag = 1;
        }
        if(flag == 1)
            break;
    }
    cout << i + 1 << endl;

    return 0;

    /* int s, n;
    set<int> a;
    
    cin >> s;
    n = s;
    while(a.count(n) == 0){
        a.insert(n);
        if(n % 2 == 0)
            n /= 2;
        else
            n = 3 * n + 1;
    }
    cout << a.size() + 1 << endl;

    return 0; */
}

Measured memory_bytes: 256
program ABC095B
	integer(8)::N,X,i
	integer(8),allocatable,dimension(:)::M
	read(5,*)N,X
	allocate(M(N))
	
	do i=1,N
		read(5,*)M(i)
	end do
	
	print'(i0)',N+(X-sum(M))/minval(M)
end program ABC095B


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

#define WIDTH 3001
#define HEIGHT 51

int dp[HEIGHT * WIDTH];

int main(void)
{
	int i, j, k;
	int n, m, s;
	while(scanf("%d%d%d", &n, &m, &s), n){
		n *= n;
		memset(dp, 0, sizeof(dp));
		dp[0] = 1;

		for(i=1; i<=m; ++i){
			for(j=n; j>=0; --j){
				for(k=s; k>=0; --k){
					if(j && i <= k){
						dp[j*WIDTH + k] = (dp[j*WIDTH + k] + dp[(j-1)*WIDTH + k-i]) % 100000;
					}
				}
			}
		}

		printf("%d\n", dp[n*WIDTH + s]);
	}

	return 0;
}

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


void solve(long long N, long long C, long long K, std::vector<long long> T){
  sort(T.begin(), T.end());
  int dep = T[0]+K;
  int cnt = 0;
  int ans = 1;
  rep(i,N) {
    if(cnt < C and T[i]<=dep)
      cnt++;
    else {
      cnt = 1;
      dep = T[i]+K;
      ans++;
    }
  }
  std::cout << ans << std::endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long C;
    scanf("%lld",&C);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> T(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&T[i]);
    }
    solve(N, C, K, std::move(T));
    return 0;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
int main(){
 
  int A,B,X;
  cin >> A >> B >> X;
 if(A <= X){
    if((A+B) >= X){
    cout << "YES" << endl;
    }
    else if((A+B) < X){
    cout << "NO" << endl;
    }
  }
  else if(A > X){
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            var filePath = Path.Combine(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                $"{Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location)}.in");
            Console.SetIn(new StreamReader(filePath));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var line1 = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var H = line1[0];
            var W = line1[1];
            var K = line1[2];

            var matrix = new List<List<char>>();
            foreach (var i in Enumerable.Range(0, H))
            {
                var row = new List<char>();
                foreach (var c in Console.ReadLine())
                {
                    row.Add(c);
                }

                matrix.Add(row);
            }

            int answer = 0;
            for (int patternH = 0; patternH < (1 << H); patternH++)
            {
                for (int patternW = 0; patternW < (1 << W); patternW++)
                {
                    var work = matrix.Select(elem => elem.Select(elem2 => elem2).ToList()).ToList();
                    foreach (var h in Enumerable.Range(0, H))
                    {
                        foreach (var w in Enumerable.Range(0, W))
                        {
                            if ((patternH & (1 << h)) > 0)
                            {
                                foreach (var i in Enumerable.Range(0, W))
                                {
                                    work[h][i] = 'R';
                                }
                            }

                            if ((patternW & (1 << w)) > 0)
                            {
                                foreach (var i in Enumerable.Range(0, H))
                                {
                                    work[i][w] = 'R';
                                }
                            }
                        }
                    }

                    var count = work.Sum(elem => elem.Count(elem2 => elem2 == '#'));
                    if (count == K)
                    {
                        answer++;
                    }
                }
            }

            Console.WriteLine($"{answer}");
        }
    }
}


Measured memory_bytes: 23056
// i hope i get better                                                           
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int sz=2e5+9;
int dp[sz][3];
int n;
string s;

int solve(int idx,int prv){
	int &ret=dp[idx][prv];
	if(~ret) return ret;
	if(idx==n) return ret=0;
	ret=0;
	if(prv==1&&s[idx]=='.') return ret=solve(idx+1,prv)+1;
	ret=solve(idx+1,s[idx]=='#');
	if((prv==1&&s[idx]=='#')==0) ret=min(ret,1+solve(idx+1,s[idx]!='#'));
	return ret;
}

int main(){
	cin>>n>>s;
	memset(dp,-1,sizeof(dp));
	cout<<solve(0,2);
	return 0;
}

Measured memory_bytes: 12292
#include<iostream>

using namespace std;

int main(void){
  char a[4];
  int answer = 0;
  cin >> a;
  for(int i = 0; i < 4; ++i){
    if(a[i] == '+'){
      ++answer;
    }
    else{
      --answer;
    }
  }
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int count[26];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string str, tmp;
    int m, h;
    while(cin>>str) {
        if(str=="-") break;
        cin>>m;
        for(int i=0; i<m; i++) {
            cin>>h;
            tmp=str;
            str=tmp.substr(h)+tmp.substr(0, h);
        }
        cout<<str<<'\n';
    }
    return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n;
  cin>>n;
  int a[n];
  int b[n];
  rep(i,0,n) cin>>a[i]>>b[i];
  if(n%2!=0){
    sort(a,a+n);
    sort(b,b+n);
    cout<<b[n/2]-a[n/2]+1;
  }
  else{
    sort(a,a+n);
    sort(b,b+n);
    cout<<b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1]+1;
  }
}


Measured memory_bytes: 5200
#include <iostream>
#include <cstdio>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <string>
#include <ctype.h>

using namespace std;

void solve()
{
	int a, b, C;
	cin >> a >> b >> C;
	double S = 0.5 * a * b * sin(C * M_PI / 180);
	double h = 2 * S / a;
	double c = sqrt(a * a + b * b - 2 * a * b * cos(C * M_PI / 180));
	printf("%.6f\n%.6f\n%.6f\n", S, a + b + c, h);
}

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

Measured memory_bytes: 1200
public class Main {

	private static void solve() {
		int n = ni();
		int[] a = na(n);
		
		boolean flg = false;
		while (true) {
			int odd = 0;
			int even = 0;
			int oddIdx = 0;
			for (int i = 0; i < n; i ++) {
				if (a[i] % 2 == 0) {
					even ++ ;
				} else {
					odd ++;
					oddIdx = i;
				}
			}
			
			if (even % 2 == 1) {
				System.out.println(flg ? "Second" : "First");
				return;
			} else if (odd != 1 || a[oddIdx] == 1) {
				System.out.println(flg ? "First" : "Second");
				return;
			} else {
				// odd == 1 , even % 2 == 0
				a[oddIdx] --;
				int g = a[0];
				for (int i = 0; i < n; i ++) {
					g = gcd(a[i], g);
				}
				for (int i = 0; i < n; i ++) {
					a[i] /= g;
				}
			}
			flg = !flg;
		}
	}

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

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

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

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

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

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

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

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

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

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

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

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


Measured memory_bytes: 39320
N,X = map(int,input().split())
L = list(map(int,input().split()))
cnt = 0
D = [0]
for i in range(1,N+1):
    D.append(D[i-1] + L[i-1])
for i in range(len(D)):
    if D[i] <= X:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
#入力
day = input()


if day == "MON":
  answer = 6
  
if day == "TUE":
  answer = 5
if day == "WED":
  answer = 4
if day == "THU":
  answer = 3
if day == "FRI":
  answer = 2
if day == "SAT":
  answer = 1
if day == "SUN":
  answer = 7

print(answer)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define inlld(x) scanf("%lld", &x)
#define ind(x) scanf("%d", &x)
#define inlld2(x, y) scanf("%lld%lld", &x, &y)
#define inlld3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define ind2(x, y) scanf("%d%d", &x, &y)
#define ind3(x, y, z) scanf("%d%d%d", &x, &y, &z)

const int N=3e3+5;
const int MOD=1e9+7;

typedef long long ll;
typedef long double ld;

using namespace std;

ll n, arr[N], dp[N][N][2];

ll solve(ll i, ll j, ll mov)
{
    if(dp[i][j][mov]!=-1)
        return dp[i][j][mov];
    if(i==j && mov)
        return arr[i];
    else if(i==j)
        return -arr[i];
    if(mov)
        return dp[i][j][mov]=max(solve(i+1, j, 0)+arr[i], solve(i, j-1, 0)+arr[j]);
    else
        return dp[i][j][mov]=min(solve(i+1, j, 1)-arr[i], solve(i, j-1, 1)-arr[j]);
}

int main()
{
    inlld(n);
    for(ll a=1; a<=n; a++)
        inlld(arr[a]);
    memset(dp, -1, sizeof(dp));
    printf("%lld\n", solve(1, n, 1));
    return 0;
}

Measured memory_bytes: 141440
#include<cstdio>
#include<cstring>
const int N=1e5+10;
const int mod=1e9+7;
int f[N][13],n;
char s[N];
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	f[0][0]=1;
	for(int i=1;i<=n;i++)
		if(s[i]>='0'&&s[i]<='9')
		{
			for(int j=0;j<13;j++)
				f[i][(j*10+s[i]-'0')%13]=(f[i][(j*10+s[i]-'0')%13]+f[i-1][j])%mod;
		}
		else
		{
			for(int k=0;k<10;k++)
				for(int j=0;j<13;j++)
					f[i][(j*10+k)%13]=(f[i-1][j]+f[i][(j*10+k)%13])%mod;
		}
	printf("%d",f[n][5]);
	return 0;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

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

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

//main code
int main(int argc, char const* argv[])
{
	string s;
	cin >> s;
	LL ans = 0;
	int l = 0, r = s.size()-1;
	while (1) {
		if (l > r) break;
		if (s[l] != 'x' and s[r] != 'x') {
			if (s[l] != s[r]) {
				cout << -1 << endl;
				return 0;
			}
			l++;r--;
			continue;
		}
		if (s[l] == 'x' and s[r] == 'x') {
			l++;r--;
			continue;
		}
		if (s[l] == 'x') {
			l++;
			ans++;
			continue;
		}
		r--;
		ans++;
		continue;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 512
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

class BIT(n: Int) {
    private val _n = n
    private val data = LongArray(n) { 0 }

    fun add(i: Int, x: Long) {
        var p = i + 1
        while (p <= _n) {
            data[p - 1] += x
            p += p and -p
        }
    }

    fun sum(l: Int, r: Int): Long {
        return sum(r) - sum(l)
    }

    private fun sum(i: Int): Long {
        var r = i
        var s = 0L
        while(r > 0) {
            s += data[r - 1]
            r -= r and -r
        }
        return s
    }
}

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val q = sc.nextInt()
    val a = Array(n) { sc.nextLong() }
    val bit = BIT(n)
    for (i in 0 until n) {
        bit.add(i, a[i])
    }
    for (_i in 0 until q) {
        val t = sc.nextInt()
        if (t == 0) {
            val p = sc.nextInt()
            val x = sc.nextLong()
            bit.add(p, x)
        } else {
            val l = sc.nextInt()
            val r = sc.nextInt()
            println(bit.sum(l, r))
        }
    }
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 88452
#include <bits/stdc++.h>
using namespace std;
const int MOD=1000000007;
vector<long long> fact, fact_inv, inv;
void init_nCk(int n){
  fact.resize(n+5);
  fact_inv.resize(n+5);
  inv.resize(n+5);
  fact[0]=fact[1]=1;
  fact_inv[0]=fact_inv[1]=1;
  inv[1]=1;
  for(int i=2;i<n+5;i++){
    fact[i]=fact[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    fact_inv[i]=fact_inv[i-1]*inv[i]%MOD;
  }
}
long long nCk(int n,int k){
  assert(!(n<k));
  assert(!(n<0 || k<0));
  return fact[n]*(fact_inv[k]*fact_inv[n-k]%MOD)%MOD;
}
int main(){
    int N,K;
    cin>>N>>K;
    init_nCk(N+K);
    for(int i=1;i<=K;i++){//iこに分ける
        if(i==1){
            cout<<N-K+1<<endl;
            continue;
        }
        long long count=0;
        for(int j=(int)max(1,i-1);j<=N-K;j++){//青にjこ赤を混ぜる
            //K個のボールをj個の仕切りでi個のグループに分ける(i>=2)
            count+=(N-K-j+1)*nCk(K-1,i-1)%MOD*nCk(j-1,i-2)%MOD;
            count%=MOD;
        }
        cout<<count<<endl;
    }
}

Measured memory_bytes: 3724
N = int(input())
lis = [list(map(int, input().split())) for _ in range(N)]
dp = [[0]*3 for _ in range(N+1)]
for k in range(3):
    dp[1][k] = lis[0][k]
for i in range(2, N+1):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + lis[i-1][0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + lis[i-1][1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + lis[i-1][2]
print(max(dp[N]))

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

int main() {
  long n,c,k,ans=0;
  cin >> n >> c;
  vector<long> x(n);
  vector<long> v(n);
  vector<long> t(n+1);
  vector<long> t2(n+1);
  vector<long> h(n+1);
  vector<long> h2(n+1);
  for(long i=0;i<n;i++) cin >> x[i] >> v[i];
  k=0;
  for(long i=0;i<n;i++) {
    k+=v[i];
    t[i+1]=max(t[i],k-x[i]);
    t2[i+1]=max(t2[i],k-x[i]*2);
  }
  k=0;
  for(long i=n-1;i>=0;i--) {
    k+=v[i];
    h[i]=max(h[i+1],k-c+x[i]);
    h2[i]=max(h2[i+1],k-c*2+x[i]*2);
  }
  for(long i=0;i<=n;i++) ans=max(ans,max(t[i]+h2[i],t2[i]+h[i]));

  cout << ans << endl;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> ans(M);
    set<int> already;
    rep(i, M) {
        ans[i].first = i + 1;
        ans[i].second = N - i;

        while (already.count(ans[i].second - ans[i].first) > 0 ||
            (N % 2 == 0 && ans[i].second - ans[i].first == N / 2)) {
            ans[i].second--;
        }
        int x = ans[i].second - ans[i].first;
        already.insert(x);
        already.insert(N - x);
            
            
    }
    rep(i, M)
        cout << ans[i].first << " " << ans[i].second << endl;
    return 0;
}

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

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

    int cnt = 0, ans = 0;
    for (char c : X) {
        if (c == 'S') {
            ++cnt;
        } else {
            if (cnt == 0) {
                ++ans;
            } else {
                --cnt;
            }
        }
    }

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


Measured memory_bytes: 644
#include <stdio.h>

int a[200010],b[200010];
int main(){
	int n,m;
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	scanf("%d",&m);
	for(int i=0;i<m;i++)scanf("%d",b+i);
	a[n]=b[m]=2e9;
	for(int i=0,j=0;i!=n||j!=m;){
		if(a[i]<b[j])printf("%d\n",a[i++]);
		else if(a[i]>b[j])printf("%d\n",b[j++]);
		else i++,j++;
	}
}


Measured memory_bytes: 3308
def main():
    S = input()
    ans = 0
    g_st = 0
    for s in S:
        if g_st == 0:
            g_st += 1
            if s == "p":
                ans -= 1
        else:
            g_st -= 1
            if s == "g":
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39536
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

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

void Main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    int x = 0;
    int mx = 0;
    REP(i, N){
        if(S[i] == 'I'){
            x++;
            chmax(mx, x);
        }else{
            x--;
        }
    }
    cout << mx << el;
}



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

int main(){
    int n;cin>>n;
    int A[n],B[n];
    rep(i,n){
        cin>>A[i];
        B[i]=A[i];
    }
    for(int i=1;i<n;i++){
        if(A[i]<A[i-1])A[i]=A[i-1];
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        if(A[i]>B[i])ans+=A[i]-B[i];
    }
    cout<<ans<<endl;
    return 0;
}

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


int main(){
	
	string a;
	getline(cin,a);
	int i = 0;
	while(a[i] != '\0'){
		if('A' <= a[i] && a[i] <= 'Z'){	a[i] += 'a'-'A';	}
		else if('a' <= a[i] && a[i] <= 'z'){	a[i] -= 'a'-'A';	}
		i++;
	}
	
	cout << a <<"\n";
	return 0;
}

Measured memory_bytes: 3136
ans = []
while True:
    N, K, M = map(int, input().split())
    if not N and not K and not M:
        break
    
    remind = [i for i in range(N)]
    
    now = M - 1
    while len(remind) > 1:
        remind.pop(now)
        now = (now + K - 1) % len(remind)
    
    ans.append(remind[0])
                     
[print(i + 1) for i in ans] 



Measured memory_bytes: 5928
use std::io;
//use std::collections::HashMap;
//use std::collections::BinaryHeap;
//use std::collections::HashSet;
//use std::mem; // mem::swap(&mut x,&mut y);
use std::cmp; // cmp::max,cmp::min

// Rust memo: https://hackmd.io/i0lQY1OKTDW1t66TECOmiw?both

#[allow(dead_code)]
fn read_line() -> String{
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read_charvec() -> Vec<char>{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn read_ints() -> Vec<i64>{
    let s = read_line();
    let split:Vec<&str> = s.split(" ").collect();
    split.iter().map(|&x| x.to_string().parse().unwrap()).collect()
}

#[allow(dead_code)]
fn read_int() -> i64{
    read_ints()[0]
}

#[allow(dead_code)]
fn reverse(s: &String) -> String{
    s.chars().rev().collect::<String>()
}

#[allow(dead_code)]
fn read_lines(n:i64) -> Vec<String>{
    let mut xs = Vec::new();

    for _i in 0..n{
        xs.push(read_line());
    }

    xs
}

#[allow(dead_code)]
fn read_ints2(n:i64) -> Vec<i64>{
    read_lines(n).iter().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn arange(start:i64,end:i64,step:i64) -> Vec<i64>{
    let mut ret = Vec::new();
    let mut i = start;

    while i < end{
        ret.push(i);
        i += step;
    }

    ret
}

#[allow(dead_code)]
const DXS : [i64; 4] = [0,0,1,-1];
#[allow(dead_code)]
const DYS : [i64; 4]  = [1,-1,0,0];
#[allow(dead_code)]
const INF : i64 = 999999999;

////////////////////////////////////////////////


fn main(){
    let inputs = read_ints();
    let (a,b) = (inputs[0],inputs[1]);
    println!("{}",
             if a * b % 2 == 1{
        "Yes"
    }else{
        "No"
    }
    );
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <math.h>
#include <string>
typedef long long int ll;
#define pb(b) push_back(b)
#define sort(b) sort(b.begin(),b.end())
#define mp(a,b) make_pair(a,b)
#define sf(n) scanf("%d", &n)
#define sff(n,m) scanf("%d%d",&n,&m)
#define pf(n) printf("%d",n)
#define pfs(s) printf("%s",s)
vector<vector<int>> adjacencyList;
 
int main()
{
    
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    ll n,q,l,r,t,sum = 0,k,last = 0,d,m,no,ans = 0;
    std::vector<ll> a,b;    
		bool found;
 
  	cin>>n>>m;
		a.resize(n);
		vector<vector<ll>> adjacencyList;
		adjacencyList.resize(n);
		for(int i = 0; i < n; i++)
		{
			cin>>a[i];
		}
		for(int i = 0; i < m; i++)
		{
			cin>>l>>r;
			adjacencyList[l-1].pb(r-1);
			adjacencyList[r-1].pb(l-1);
		}
  	for(int i = 0; i < n; i++)
		{
			found = true;
			if (adjacencyList[i].size() == 0)
			{
				ans++;
				continue;
			}
			sort(adjacencyList[i]);
			auto it = std::unique (adjacencyList[i].begin(), adjacencyList[i].end()); 
  		adjacencyList[i].resize( std::distance(adjacencyList[i].begin(),it) );
			for(int j = 0; j < adjacencyList[i].size(); j++)
			{
				q = adjacencyList[i][j];
				if(a[q] >= a[i] )
				{
					found = false;
					break;
				}
			}
			if(found == true)
				ans++;
		}
		cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 9808
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<int,ll> p;
typedef pair<pii,int> P;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=2e18;
const ll MOD=1e9+7;

vector<int> prime(1e5+1,1);
vector<int> likenum(1e5+1,0);
void solve(){
    prime[0]=prime[1]=0;
    for(int i=2;i<=1e5;++i){
        if(prime[i]==1){
            for(int j=2*i;j<=1e5;j+=i){
                prime[j]=0;
            }
        }
    }
    for(int i=3;i<=1e5;++i){
        if(prime[i]==1&&prime[(i+1)/2]==1){
            likenum[i]=1;
        }
    }
    for(int i=1;i<=1e5;++i){
        likenum[i]+=likenum[i-1];
    }
}
int main(){
    int q;cin>>q;
    solve();
    while(q--){
        int l,r;cin>>l>>r;
        cout<<likenum[r]-likenum[l-1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3864
if __name__ == '__main__':
    # ??????????????\???
    num = int(input())
    data = []
    for _ in range(num):
        data.append(list(map(int, input().split(' '))))

    # ???????????????
    graph_table = [[0]*num for _ in range(num)]
    for d in data:
        node_id = d[0]
        num_of_e = d[1]
        for e in d[2:]:
            graph_table[node_id-1][e-1] = 1

    # ???????????????
    for row in graph_table:
        print(*row)

Measured memory_bytes: 8508
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>

using namespace std;	       

int main(){
  int N;
  string S;
  cin >> S;
  N = S.size();
  stack<char> cube;
  for(auto s : S){
    if(cube.empty()){
      cube.push(s);
    }else{
      if(cube.top() != s){
	cube.pop();
      }else{
	cube.push(s);
      }
    }
  }

  cout << N - cube.size() << endl;
  return 0 ;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Text;

namespace ALDS1_11_B {
    class Problem {
        Node[] _nodes;
        private int _vol, _time;

        public void Run() {
            SetNodes();

            StringBuilder sb = new StringBuilder();
            for (int i = 1; i <= _vol; i++) {
                if (_nodes[i].First == 0) {
                    DFS(i);
                }
                sb.Append(i + " ");
                sb.AppendLine(_nodes[i].ToString());
            }
            Console.Write(sb);
        }

        private void SetNodes() {
            _vol = int.Parse(Console.ReadLine());
            _nodes = new Node[_vol + 1];
            for (int i = 0; i < _vol; i++) {
                string[] input = Console.ReadLine().Split(' ');
                int u = int.Parse(input[0]);
                int k = int.Parse(input[1]);
                _nodes[u] = new Node();
                for (int j = 0; j < k; j++) {
                    _nodes[u].Children.Add(int.Parse(input[2 + j]));
                }
            }
        }

        private void DFS(int id) {
            _nodes[id].First = ++_time;
            foreach (int next in _nodes[id].Children) {
                if (_nodes[next].First == 0) {
                    DFS(next);
                }
            }
            _nodes[id].last = ++_time;
        }
    }

    class Node {
        public List<int> Children { get; set; }
        public int First { get; set; }
        public int last { get; set; }

        public Node() {
            Children = new List<int>();
        }

        public override string ToString() {
            return First + " " + last;
        }
    }

    class Program {
        static void Main(string[] args) {
            Problem p = new Problem();
            p.Run();
        }
    }
}

Measured memory_bytes: 9280
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

ll mod_pow(ll x, ll n, ll mod = MOD) {
  ll res = 1;

  while (n > 0) {
    if (n & 1) {
      res = res * x % mod;
    }

    x = x * x % mod;
    n >>= 1;
  }

  return res;
}

ll mod_inverse(ll x, ll mod = MOD) {
  return mod_pow(x, mod - 2, mod);
}

int main() {
  int N;
  string S;

  cin >> N;
  cin >> S;

  int L = S.size();
  int dp[N + 1][N + 1];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;

  for (int i = 0; i < N; ++i){
    for (int j = 0; j < N; ++j) {
      if (j > 0) {
        dp[i + 1][j - 1] += dp[i][j];
        dp[i + 1][j - 1] %= MOD;
      } else {
        dp[i + 1][j] += dp[i][j];
        dp[i + 1][j] %= MOD;
      }

      dp[i + 1][j + 1] += 2 * dp[i][j];
      dp[i + 1][j + 1] %= MOD;
    }
  }

  ll m = mod_pow(2, L);
  cout << (dp[N][L] * mod_inverse(m)) % MOD << endl;

  return 0;
}


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

using namespace std;
#define ll long long int 
#define MOD 1000000007

ll power(ll x,ll y){
    ll res=1;
    while(y>0){
        if(y%2==1){
            res=(res*x)%MOD;
        }
        y=y>>1;
        x=(x*x)%MOD;
    }
    return res;
}
ll binomialCoeff(ll n, ll k)  
{  
    ll res = 1;  
    if ( k > n - k )  
        k = n - k;  
    for (ll i = 0; i < k; ++i)  
    {  
        res = (res*(n - i))%MOD;  
        res=res*(power(i+1,MOD-2)%MOD)%MOD;
        // res /= (i + 1);  
    }  
  
    return res;  
}  
int main(){
    ll n,a,b;
    scanf("%lld%lld%lld",&n,&a,&b);
    ll ans=power(2,n)-1;
    ll t1=binomialCoeff(n,a);
    ll t2=binomialCoeff(n,b);
    ll final_ans=(ans-t1+MOD)%MOD;
    final_ans=(final_ans-t2+MOD)%MOD;
    printf("%lld\n",final_ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  int n = s.size();
  deque<char> q;
  int ans = 0;
  rep(i, n) {
    if(!q.empty() && q.back() != s[i]) {
      ans += 2;
      q.pop_back();
    } else {
      q.push_back(s[i]);
    }
  }
  cout << ans << "\n";
  return 0;
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved
int main(){
    int a,b;
    cin>>a>>b;
    if(a<b){
        rep(i,b){
            cout<<a;
        }
        cout<<endl;
    }
    else{
        rep(i,a){
            cout<<b;
        }
        cout<<endl;
    }
    return 0;

}
/*


*/


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)

	ans := 0
	for i := 1; i <= n; i++ {
		t := i
		sum := 0
		for t > 0 {
			sum += t % 10
			t /= 10
		}
		if sum >= a && sum <= b {
			ans += i
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
int a[32],n;

void dfs(int i,int remain, int rank){
    if(remain == 0){
        a[i]=remain;
        for(int j=0;j<=i;j++){
            if(a[j] > 0){
                if(j > 0){
                    std::cout<<" ";
                }
                std::cout<<a[j];
            }
        }
        std::cout<<std::endl;
        return;
    }

    for(int j=std::min(remain,rank);j>=1;j--){
        a[i]=j;
        dfs(i+1,remain-j,a[i]);
    }
    return;
}
int main(){
    while(std::cin >> n && n != 0){
        dfs(0,n,n);
    }
}

Measured memory_bytes: 2972
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] x = new int[5];
    
    for (int i=0; i<5; i++) {
      x[i] = sc.nextInt();
      if (x[i] == 0) {
        System.out.println(i+1);
        break;
      }
    }
  }
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> d(N);
  for(int i=0;i<N;i++){
    cin >> d.at(i);
  }
  
  sort(d.begin(),d.end());
  
  int ans=1;
  for(int i=0;i<N-1;i++){
    if(d.at(i)<d.at(i+1)){
      ans+=1;
    }
  }
  
  cout << ans << endl;
}
     

Measured memory_bytes: 256