akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    ll n; cin >> n;
    vl x(n); rep(i,n) cin >> x[i];
    ll l,q; cin >> l >> q;
    vvl nxt(20,vl(n+1,inf));
    rep(i,n){
        nxt[0][i] = upper_bound(all(x),x[i]+l) - x.begin();
        nxt[0][i]--;
    }
    rep(k,20) nxt[k][n] = n;
    rep(k,19){
        rep(i,n){
            nxt[k+1][i] = nxt[k][nxt[k][i]];
        }
    }
    while(q--){
        ll a,b; cin >> a >> b; a--; b--;
        if(a > b) swap(a,b);
        ll now = a, ans = 0;
        for(int lg=19; lg>=0; lg--){
            if(nxt[lg][now] < b){
                ans += 1<<lg;
                now = nxt[lg][now];
            }
        }
        cout << ans + 1 << endl;
    }
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }

    vector<int> ans(n);
    int cnt = 0;
    for (int i = n; i >= 1; i--) {
        int index = n / i * i;
        int sum = 0;
        while (index >= 1) {
            sum += ans.at(index - 1);
            index -= i;
        }
        if (sum % 2 != a.at(i - 1)) {
            ans.at(i - 1) = 1;
            cnt++;
        }
    }
    
    cout << cnt << endl;
    for (int i = 0; i < n; i++) {
        if (ans.at(i) == 1) cout << i + 1 << " ";
    }
    cout << endl;
}   

Measured memory_bytes: 2432
#include<bits/stdc++.h>
#include<string>
 
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
     
    int a[3];
     
    for(int i=0; i<3; i++) cin>>a[i];
     
    sort(a,a+3);
     
    printf("%d %d %d\n",a[0],a[1],a[2]);
     
    return 0;
     
}


Measured memory_bytes: 3196
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
 
using namespace std;
 
int main(){
    long long h,w;
    cin>>h>>w;
    long long ans=0;
    for(long long i=1;i<=h;i++){
        if(i%2==1){
            if(w%2==0) ans+=w/2;
            else ans+=1+w/2;
        }else{
            ans+=w/2;
        }
    }
    
    if(h==1 || w==1) ans=1;
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int i, hand[6]={};
    
    while(1){
    int x[4]={0, 0, 0, 0};
    for(i=1; i<=5; i++){
        scanf("%d", &hand[i]);
        if(hand[i] == 1) x[1]=1;  //グー
        else if(hand[i] == 2) x[2]=1; //チョキ
        else if(hand[i] == 3) x[3]=1; //パー
        else return 0;
    }
    
    if(x[1] == 1){ //グーが出た
        if(x[2] == 1){ //チョキが出た
            if(x[3] == 1){ //パーが出た
                //あいこ
                for(i=1; i<=5; i++){
                    printf("3\n");
                }
            }
            else{   //グーとチョキだけ
                for(i=1; i<=5; i++){
                    if(hand[i] == 1) printf("1\n"); //勝ち
                    else printf("2\n"); //負け
                    }
            }
        }
        else{ //チョキは出ない
            if(x[3] == 1){ //グーとパーだけ
                for(i=1; i<=5; i++){
                    if(hand[i] == 3) printf("1\n"); //勝ち
                    else printf("2\n"); //負け
                }
            }
            else{ //パーも出ない＝グーだけ
                for(i=1; i<=5; i++){
                    printf("3\n"); //あいこ
                }
            }
        }
    }
    else{ //グーは出ない
        if(x[2] == 1){ //チョキが出た
            if(x[3] == 1){ //パーが出た
                for(i=1; i<=5; i++){
                    if(hand[i] == 2) printf("1\n"); //勝ち
                    else printf("2\n"); //負け
                }
            }
            else{ // パーが出ない＝チョキだけ
                for(i=1; i<=5; i++){
                     printf("3\n"); //あいこ
                }
            }
        }
        else{ //チョキもでない＝パーだけ
            for(i=1; i<=5; i++){
                 printf("3\n"); //あいこ
            }
        }
    }
    }
    return 0;
}



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

using namespace std;

int main()
{
   int a, b, max = 0;

   cin >> a >> b;

   for(int i=0;i<2;i++){
      if(a >= b){
         max += a;
         a--;
      }else{
         max += b;
         b--;
      }
   }

   cout << max << endl;

   
   return 0;
}



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

template<class T> inline bool chmax(T &a, T b)
{
    if(a < b)
    {
        a = b;
        return true;
    }
    return false;
}

std::mt19937 mt{ std::random_device{}() };

int randint(int lower, int upper)
{
    std::uniform_int_distribution<int> dist(lower, upper);
    return dist(mt);
}

int calc_score(int M, int D, vector<vector<int>> &S, vector<int> &T, vector<int> &C)
{
    int ans = 0;
    vector<int> last(M, -1);
    for(int i=0; i<D; i++)
    {
        ans += S[i][T[i]];
        last[T[i]] = i;
        for(int j=0; j<M; j++)
        {
            ans -= C[j] * (i - last[j]);
        }
    }
    return ans;
}

int main()
{
    int tstart = clock();
    ios::sync_with_stdio(false);
    cin.tie(0);
    int D;
    cin >> D;
    const int M = 26;
    vector<int> C(M);
    for(int i=0; i<M; i++) cin >> C[i];
    vector<vector<int>> S(D, vector<int>(M));
    for(int i=0; i<D; i++)
    {
        for(int j=0; j<M; j++)
        {
            cin >> S[i][j];
        }
    }
    vector<int> T(D);
    for(int i=0; i<D; i++)
    {
        int naxj = 0;
        int nax = S[i][0];
        for(int j=1; j<M; j++)
        {
            if(chmax(nax, S[i][j]))
            {
                naxj = j;
            }
        }
        T[i] = naxj;
    }
    int score = calc_score(M, D, S, T, C);
    while(1.0 * (clock() - tstart) / CLOCKS_PER_SEC < 1.8)
    {
        // cout << 1.0 * (clock() - tstart) / CLOCKS_PER_SEC << endl;
        int H = randint(0, D-1);
        int Q = randint(0, M-1);
        int tmp = T[H];
        T[H] = Q;
        int nscore = calc_score(M, D, S, T, C);
        if(score < nscore)
        {
            score = nscore;
        }
        else
        {
            T[H] = tmp;
        }
    }
    for(int i=0; i<D; i++)
    {
        cout << T[i] + 1 << '\n';
    }
    return 0;
}


Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 1e5;
struct FordFulkerson{
  struct edge {
    int to, rev;
    ll cap;
  };
  int n;
  vector<vector<edge>> G;
  vector<bool> used;
  void init(int m){
    n = m;
    G.resize(n);
    used.resize(n);
  }
  void add_edge(int a, int b, ll c, bool undirected=false){
    G[a].push_back((edge){b, (int)G[b].size()  , c});
    G[b].push_back((edge){a, (int)G[a].size()-1, undirected ? c : 0ll});
  }
  ll solve(int s,int t){
    ll ret = 0;
    function<ll (int, int, ll)> dfs = [&](int v, int t, ll f){
      if (v==t) return f;
      used[v] = true;
      for(int i=0; i<G[v].size(); ++i) {
        edge &e = G[v][i];
        if (used[e.to] || !e.cap) continue;
        ll d = dfs(e.to, t, min(f, e.cap));
        if (d) {
          e.cap -= d;
          G[e.to][e.rev].cap += d;
          return d;
        }
      }
      return 0ll;
    };
    while(true){
      fill(used.begin(), used.end(), false);
      ll f = dfs(s, t, 1e18);
      if(!f) return ret;
      ret += f;
    }
  }
}f;
int h, w;
string s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> w;
  f.init(h+w+2);
  FOR(i, 0, h){
    cin >> s;
    FOR(j, 0, w) switch(s[j]){
      case 'S':
        f.add_edge(h+w,   i, 1000);
        f.add_edge(h+w, h+j, 1000);
        break;
      case 'T':
        f.add_edge(  i, h+w+1, 1000);
        f.add_edge(h+j, h+w+1, 1000);
        break;
      case 'o':
        f.add_edge(i, h+j, 1, true);
        break;
    }
  }
  ll ans = f.solve(h+w, h+w+1);
  cout << (ans>=1000 ? -1 : ans) << endl;
}

Measured memory_bytes: 768
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;
static class Extensions
{
    public static int ToInt(this string s) => int.Parse(s);
    public static long ToLong(this string s) => long.Parse(s);
    public static char ToChar(this string s) => char.Parse(s);
    public static double ToDouble(this string s) => double.Parse(s);
    public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray();
    public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray();
    public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray();
}

class Program
{
    static string[] ReadLines(int n) => Enumerable.Range(0, n).Select(s => Console.ReadLine()).ToArray();

    static void Main()
    {
        long xxxx = 1000000007;

        var nm = Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        long N = nm[0];
        long M = nm[1];

        long[] memo = new long[N + 2];
        //長さiの区間を移動するための組み合わせを先に求める
        memo[0] = 0;
        memo[1] = 1;
        memo[2] = 1;

        for (int i = 3; i < memo.Length; i++)
        {
            memo[i] = memo[i - 1] % xxxx + memo[i - 2] % xxxx;
            memo[i] %= xxxx;
        }

        var aList = Enumerable.Range(0, (int)M).Select(n => Console.ReadLine().ToLong()).Distinct().ToArray();


        for(int i = 0; i < aList.Length - 1; i++)
        {
            if (aList[i + 1] - aList[i] == 1)
            {
                Console.WriteLine(0);
                return;
            }
        }


        long current = 0;
        List<long> safeAreaList = new List<long>();

        for(int i = 0; i < aList.Length; i++)
        {
            //現在居る区画の最小
            var first = current;

            //現在居る区画の最大
            var last = aList[i] - 1;

            //現在居る区画の長さ
            var len = last - first + 1;

            safeAreaList.Add(len);
            current = aList[i] + 1;
        }
                

        //最後、N段目までがある        
        safeAreaList.Add(N - current + 1);

        long ans = 1;

        foreach(var x in safeAreaList)
        {
            ans *= memo[x];
            ans %= xxxx;
        }

        Console.WriteLine(ans);

    }
}

Measured memory_bytes: 24544
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#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(int argc, char* argv[]) {
    int n;
    cin >> n;
    double x[n],y[n];
    long double ave = 0;
    int array[n];
    rep(i,n) array[i] = i;
    rep(i,n) cin >> x[i] >> y[i] ;
    do{
        for(int i=0; i<n-1; i++){
            long double s = pow(x[array[i]]-x[array[i+1]],2) + pow(y[array[i]]-y[array[i+1]],2);
            ave += sqrtl(s);
        }
    }while(next_permutation(array,array+n));    

    double a =1;
    for(int i =1; i<=n;i++) a*=i;
    ave = ave / a ;
    cout << setprecision(10)<< ave << endl;
        


    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		try {
			while (input.ready()) {
				String[] dataStr = input.readLine().split(" ");
				int[] dataInt = new int[dataStr.length];
				for (int i = 0; i < dataStr.length; i++) {
					dataInt[i] = Integer.valueOf(dataStr[i]);
				}
				System.out.println(getGCD(dataInt[0], dataInt[1]) + " " + getLCM(dataInt[0], dataInt[1]));
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	/***
	 * ?????§??¬?´???°
	 */
	public static int getGCD(int a, int b) {
		if (a == b)
			return a;
		int d = 1;
		if (a < b) {
			if (b % a == 0)
				return a;
			d = a / 2;
		} else {
			if (a % b == 0)
				return b;
			d = b / 2;
		}
		for (int i = d; i > 0; i--) {
			if ((a % i == 0) & (b % i == 0)) {
				return i;
			}
		}
		return 0;
	}

	/***
	 * ????°???¬?????°
	 *
	 * @param a
	 * @param b
	 * @return
	 */
	public static int getLCM(int a, int b) {
		int productA = a;
		int productB = b;
		while (productA <= 2000000000) {
			if (productA == productB) {
				return productA;
			}
			if (productA < productB) {
				productA += a;
			} else {
				productB += b;
			}
		}
		return 0;
	}
}

Measured memory_bytes: 25028
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ",debug(__VA_ARGS__);
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os,pair<T,S>a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}
vector<int>solve(int n,int a,int b){
    if(n==1)return {a,b};
    int t = -1;
    rep(i,n){
        if((a&(1<<i))^(b&(1<<i))){
            t = i;
        }
    }
    int na=0,nb=0;
    for(int i = 0; i < t; i++){
        if(a&(1<<i))na^=1<<i;
        if(b&(1<<i))nb^=1<<i;
    }
    for(int i = t + 1; i < n; i++){
        if(a&(1<<i))na^=1<<(i-1);
        if(b&(1<<i))nb^=1<<(i-1);
    }
    auto p = solve(n-1,na,na^1);
    auto q = solve(n-1,na^1,nb);
    show(p);
    show(q);
    vector<int>res(1<<n);
    show(t);
    for(int i = 0; i < (1<<(n-1)); i++){
        for(int j = 0; j < t; j++){
            res[i] ^= (p[i]>>j&1)<<j;
        }
        res[i] ^= (a>>t&1)<<t;
        for(int j = t + 1 ; j < n; j++){
            res[i] ^= (p[i]>>(j-1)&1)<<j;
        }
    }
    for(int i = 1<<(n-1); i < 1<<n; i++){
        for(int j = 0; j < t; j++){
            res[i] ^= (q[i-(1<<(n-1))]>>j&1)<<j;
        }
        res[i] ^= (b>>t&1)<<t;
        for(int j = t + 1 ; j < n; j++){
            res[i] ^= (q[i-(1<<(n-1))]>>(j-1)&1)<<j;
        }
    }
    return res;
}
int main(){
    int n,a,b;
    cin >> n >> a >> b;
    if(__builtin_popcount(a)%2==__builtin_popcount(b)%2){
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
    auto ans = solve(n,a,b);
    rep(i,1<<n){
        cout << ans[i];
        if(i != (1<<n)-1)cout << " ";
    }
    cout << endl;
}

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

int main(){
    //入力
    string S;
    cin>>S;
    ll K;
    cin>>K;
    string Sp=S+S.at(0);
    Sp=Sp+'A';
    ll sizeS=Sp.length();
    //cout<<Sp<<endl;
    vector<ll> R(0);
    ll mmr=-1;
    for(ll i=0;i<sizeS-1;i++){
        if(Sp.at(i)==Sp.at(i+1)){
            //mp[i]=0;
        }
        else{
            //mp[i]=1;
            R.push_back(i-mmr);
            mmr=i;
        }
    }
    if(R.size()>1){
        ll mmrys=0;
        if(S.at(0)==S.at(S.length()-1) && R.at(0)%2==0 && R.at(R.size()-1)%2==0){
            R.at(R.size()-1)-=1;
        }
        vector<ll> p(R.size());
        for(ll i=0;i<R.size();i++){
            //cout<<R.at(i)<<endl;
            p.at(i)=R.at(i)/2;
            //cout<<p.at(i)<<endl;
        }
        ll ans=0;
        ans=accumulate(p.begin(),p.end(),0);
        //cout<<ans<<endl;
        ll mmry=0;
        if(S.at(0)==S.at(S.length()-1)){
            if(R.at(R.size()-1)%2==0){
                mmry=1;
            }
        }
        cout<<ans*K-mmry<<endl;
    }
    else{
        ll answer=0;
        answer=S.length()*K;
        answer/=2;
        cout<<answer<<endl;
    }
}

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

int a[101010],f[101010];
int n,k;

main()
{
    cin >> n;
  	k=2;
    for(int i=1; i<=n; i++) cin >> a[i];
    f[1]=0;
    f[2]=abs(a[2]-a[1]);
    for(int i=3; i<=n; i++)
    {
        int kq=INT_MAX;
        for(int j=i-1; j>=i-k; j--)
            kq=min(kq,f[j]+abs(a[i]-a[j]));
        f[i]+=kq;
    }
    cout << f[n];
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

vector<vector<long long>> dp;
vector<int> w;
vector<long long> v;

int main(void){
    int N,W;
    cin >> N >> W;

    dp = vector<vector<long long>>(N+2,vector<long long>(W+2));
    w = vector<int>(N);
    v = vector<long long>(N);

    for(int i=0;i<N;i++){
        cin >> w[i] >> v[i];
    }
    dp[0][0] = 0;
    for(int i=0;i<N;i++){
        for(int wi=0;wi<=W;wi++){
            if(wi >= w[i]){
                dp[i+1][wi] = max(dp[i][wi],dp[i][wi-w[i]] + v[i]);
            }else{
                dp[i+1][wi] = dp[i][wi];
            }
        }
    }

    cout << dp[N][W] << endl;
    return 0;

}

Measured memory_bytes: 81024
import sys
from itertools import accumulate

# functions used
r = lambda: sys.stdin.readline().strip() #single: int(r()), line: map(int, r().split())
R = lambda: list(map(int, r().split())) # line: R(), lines: [R() for _ in range(n)]
Rmap = lambda: map(int, r().split())
# set inputs
N, C = R()
STC = [R() for _ in range(N)]
#  0.5sec as one unit
tbl = [[0]*(2*(10**5)+5) for _ in range(C)]

for s, t, c in STC:
    c -= 1
    # if we can record the programms continuously (ver1)
    if tbl[c][2*s] != 0 and tbl[c][2*t-1] != 0:
        tbl[c][2*s] = 0
        tbl[c][2*t-1] = 0
    # if we can record the programms continuously (ver2)
    elif tbl[c][2*s] != 0:
        tbl[c][2*s] += 1
        tbl[c][2*t] -= 1
    # if we can record the programms continuously (ver3)
    elif tbl[c][2*t-1] != 0:
        tbl[c][2*t-1] -= 1
        tbl[c][2*s-1] += 1
    # else:
    else:
        tbl[c][2*s-1] = 1
        tbl[c][2*t] = -1

tbl2 = [list(accumulate(a)) for a in tbl]

ans = max([sum(x) for x in zip(*tbl2)])
print(ans)


Measured memory_bytes: 178516
#include<bits/stdc++.h>
#define mp(a,b) make_pair(a, b)
#define pb(a) push_back(a)
#define INF INT_MAX
#define fi first
#define se second
using namespace std;
#define N 100005

vector<int> adj[N];
vector<int> col[N];
int n;
vector<pair<int, int> > ed;
map<pair<int, int>, int>  m;

void dfs(int u, int pc = 0, int p=0) {
//	cout << u << " " << pc << " " << p << endl;
	int c = 0;
	for (int i=0; i<adj[u].size(); i++) {
		int v = adj[u][i];
		if (v==p)
			continue;
		c++;
		if (c==pc) c++;
		m[mp(u,v)] = c;
		m[mp(v,u)] = c;
		dfs(v, c, u); 
	}	
} 

int main() 
{
	cin >> n;
	for (int i=1; i<=n; i++) {
		adj[i].clear();
		col[i].clear();
	}
	ed.clear();
	for (int i=1; i<n; i++) {
		int u, v; 
		cin >> u >> v;
		adj[u].pb(v);
		adj[v].pb(u);
		ed.pb(mp(u,v));
	}
	dfs(1);
	int k = 0;
	for (int i=1; i<=n; i++) {
		k = max(k, (int)adj[i].size());
	}
	cout << k << endl;
	
	for (int i=0; i<ed.size(); i++ ) {
		pair<int,int> e = ed[i];
		int u = e.fi, v = e.se;
		int val = m[mp(u, v)];
		int val1 = m[mp(v, u)];
		cout << max(val, val1) << endl;
	}
	return 0;
}


Measured memory_bytes: 22776
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------

class BIT {
	int size;
	int dat[500002];
public:
	BIT() {}
	void init(int n) {
		size = n;
		for (int i = 1; i <= n; i++) {
			dat[i] = 0;
		}
	}
	void add(int i, int x) {
		i++;
		while (i <= size) {
			dat[i] += x;
			i += i & -i;
		}
	}//0-indexed
	int query(int i) {
		i++;
		int sum = 0;
		while (i > 0) {
			sum += dat[i];
			i -= i & -i;
		}
		return sum;
	}//0-indexed
};//size, 0-indexed
BIT bit;
int b[200000];
signed main() {
	int n, k;
	cin >> n >> k;
	vector<int>a, c;
	for (int i = 0; i < n; i++) {
		a.push_back(read() - k);
		b[i] = (i > 0 ? b[i - 1] : 0) + a[i];
		c.push_back(b[i]);
	}
	c.push_back(0);
	crdcomp(c);
	bit.init(n);
	bit.add(lower_bound(all(c), 0) - c.begin(), 1);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int k = lower_bound(all(c), b[i]) - c.begin();
		ans += bit.query(k);
		bit.add(k, 1);
	}
	cout << ans << endl;
}


Measured memory_bytes: 6328
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

main(){
  int i,j,n,h,m;
  double rh,rm,ans;
  cin >> n;
  for(int z=0;z<n;z++){
    scanf("%d:%d",&h,&m);
    rh = rm = 0.0;
    for(i=0;i<h;i++) rh += 30.0;
    for(i=0;i<m;i++) rm += 6.0;
    rh += (double)m * 0.5;
    if(rh >= rm) ans = rh - rm;
    else ans = rm - rh;
    if(ans > 180.0) ans = 360.0 - ans;

    if(ans >= 90.0 && ans <= 180.0) cout << "safe" << endl;
    else if(ans >= 0.0 && ans < 30.0) cout << "alert" << endl;
    else cout << "warning" << endl;
  }
  return 0;
}

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

using namespace std;
int main (){
    int date;
    cin >> date;
    int te = date%100;
    int da = (date-te)/100;
    if((da==0&&te==0)||(da==0&&te>12)||(da>12&&te==00)||(da>12&&te>12)) cout << "NA\n";
    else if(da>0 && da<=12 && te>0 && te<=12) cout << "AMBIGUOUS\n";
    else if(da>0 && da<=12) cout << "MMYY\n";
    else cout << "YYMM\n";
}

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

int main(){
    string s1,s2,s3;
    cin >> s1 >> s2 >> s3;
    int sa = 'A'-'a';
    cout << char(s1[0]+sa) << char(s2[0]+sa) << char(s3[0]+sa) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int N;
    std::cin >> N;
    int result = 0;
    int digit = 1;
    int tmp = 1;
    
    while (N >= tmp) {
      if (digit % 2 == 1) {
          if (N >= tmp * 10) {
              result += tmp * 10 - tmp;
          } else {
              result += N - tmp + 1;
          }
      }
      tmp *= 10;
      digit += 1;
    }
    std::cout << result << std::endl;
}

Measured memory_bytes: 888
import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            FastScanner fs = new FastScanner();

            final String O = fs.next();
            final String E = fs.next();

            int i = 0;
            while (true) {
                if (i < O.length()) System.out.print(O.charAt(i));
                else break;

                if (i < E.length()) System.out.print(E.charAt(i));
                else break;

                i++;
            }

            System.out.println();
        }
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if(b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 22484
#入力
N, M = map(int, input().split())

AB = []
AB_append = AB.append
C = []
C_append = C.append
for _ in range(M):
    a, b = map(int, input().split())
    AB_append((a, b))
    c = list(map(int, input().split()))
    C_append(c)


ans = [10 ** 18] * (2 ** (N + 1))
ans[0] = 0
for i in range(M):
    tmp = 0
    for j in C[i]:
        tmp += 2 ** (j - 1)
    # print ('tmp', tmp)
    for j in range(2 ** N):
        # print (j, '-->', j | tmp)
        if ans[j] == 10 ** 18:
            pass
        else:
            ans[j | tmp] = min(ans[j | tmp], ans[j] + AB[i][0])

if ans[2 ** N - 1] == 10 ** 18:
    print (-1)
    exit()
print (ans[2 ** N - 1])

Measured memory_bytes: 3440
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

vector<ll> zalgo(vector<int> s){
  vector<ll> ret(s.size());
  ll c=0;
  FOR(i,1,s.size()){
	if(i+ret[i-c]<c+ret[c]) ret[i]=ret[i-c];
	else{
	  ll j=max(0ll,c+ret[c]-i);
	  while(i+j<s.size() && s[j]==s[i+j]) j++;
	  ret[i]=j;
	  c=i;
	}
  }
  ret[0]=s.size();
  return ret;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<int> a(2*n),b(2*n),A(2*n),B(2*n);
	rep(i,n){
		cin>>a[i];
		a[i+n]=a[i];
	}
	rep(i,n){
		cin>>b[i];
		b[i+n]=b[i];
	}
	rep(i,n){
		A[i]=a[i]^a[i+1];
		B[i]=b[i]^b[i+1];
	}
	vector<int> x(3*n);
	rep(i,n){
		x[i]=B[i];
		x[i+n]=x[i+2*n]=A[i];
	}
	vector<ll> ret=zalgo(x);
	rep(k,n){
		if(ret[k+n]>=n){
			cout<<k<<' '<<(b[0]^a[k])<<endl;
		}
	}
}

Measured memory_bytes: 16728
import math
import bisect
def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
    return data

N=int(input())
L=get_sieve_of_eratosthenes(10**5+10)
print(L[bisect.bisect_left(L,N)])

Measured memory_bytes: 47408
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^18 -> 18回
// double pi = M_PI or acos(-1)

int main() {
    int k;
    cin >> k;

    int cnt = 0;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                int tmp;
                cnt += __gcd(__gcd(a, b), c);
            }
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3600
N,M = map(int,input().split())
c1 = [False]*N
c2 = [False]*N
for _ in [0]*M:
    a,b = map(int,input().split())
    if a == 1 : c1[b-1] = True
    if b == N : c2[a-1] = True
for i in range(1,N-1):
    if c1[i] and c2[i]:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 7668
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n,m,a,b,c,d,e;
	long double z,w;
	string str;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>n;
	if(n==2){
		cin>>a>>b;
	cout<<a+b;
	}
	else{cout<<"Hello World";}





	cout<<endl;
} 


Measured memory_bytes: 256
#include<iostream>
typedef long long ll;
ll Isprime(ll x) {
	ll i;
	if (x < 2)return 0;
	else if (x == 2) return 1;
	if (x % 2 == 0) return 0;
	for (i = 3; i*i <= x; i += 2) {
		if (x%i == 0) return 0;
	}
	return 1;
}
using namespace std;
int main() {
	string S;
  	cin>>S;
  	string x="yes";
  	for(ll i=0; i<S.size(); ++i){
      for(ll j=i+1; j<S.size(); ++j){
		if(S[i]==S[j])
          x="no";
      }
    }
  cout<<x<<endl;
}
	
	

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

int gcd(int x, int y);

const int INF = 1001001001;

//mint�p�̕ϐ� (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    ll n, a, b, c, d, e;
    cin >> n >> a >> b >> c >> d >> e;
    ll min = a;
    if (min > b)
        min = b;
    if (min > c)
        min = c;
    if (min > d)
        min = d;
    if (min > e)
        min = e;

    ll ans = (n - 1) / min + 5;

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

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}


Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var a=sc.La;
		Console.WriteLine(a.Sum()>=s[0]?"Yes":"No");
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 20300
N, M, C = map(int, input().split())

B = list(map(int, input().split()));

answer=0;

for i in range(N):
    A = list(map(int, input().split()));
    testAnswer = 0;
    for j in range(M):
        testAnswer += B[j]*A[j];
    if testAnswer + C > 0:
        answer += 1;

print(answer);


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int64_t lcm(int64_t x,int64_t y){
  if (x>y) swap(x,y);
  int64_t b=y;
  int64_t a=x;
  int64_t r=b%a;
  while(r>0){
    b=a;
    a=r;
    r=b%a;
  }
  return x*y/a;
}
int main(){
  int64_t n,m,i,p,c,l;
  cin>>n>>m;
  vector<int64_t> a(n);
  for(i=0;i<n;i++) {
    cin>>a.at(i);
    if(i==0) l=a.at(i)/2;
    c=0;
    while(a.at(i)%2==0){
      a.at(i)/=2;
      c++;
    }
    if(i==0) p=c;
    else{
      if(c!=p) break;
      l=lcm(l,a.at(i));
      if(l>m) break;
    }
  }
  if (i<n) cout<<0<<endl;
  else cout<<(m+l)/(2*l)<<endl;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
void func(int,int);
int s,n,sum,cnt;
int main(void)
{
	int i,j;
	while(1)	{
		scanf("%d %d",&n,&s);
		if(n==0 && s==0)	break;
		sum=0;	cnt=0;
		func(0,0);
		printf("%d\n",cnt);
	}
	return 0;
}
void func(int nn,int x)
{
	int i;
	if(n==nn)	{
		if(sum==s)	cnt++;
	}
	else {
		for(i=x;i<=9;i++)	{
			sum+=i;
			func(nn+1,i+1);
			sum-=i;
		}
	}
}
		


Measured memory_bytes: 2600
n,m = map(int, input().split())
xy = [map(int,input().split()) for _ in range(m)]
x,y = [list(i) for i in zip(*xy)]
l = x + y


d = {}#辞書同士の追加はupdate

for i in range(1,n+1):
    d[i] =0
for i in l:
    if i not in d:
        d[i] = 0
    d[i] += 1

for j in range(1,n+1):
    print(d[j])





Measured memory_bytes: 3064
#include<stdio.h>
int main(){
    int n, x, i, j, k, count;
    while(1){
        scanf("%d %d", &n, &x);
        if(n == 0 && x == 0)break;
        count = 0;
        for(i=1;i<=n;i++){
            for(j=i+1;j<=n;j++){
                for(k=j+1;k<=n;k++){
                    if(i+j+k > x) break;
                    if(i+j+k == x) count++;
                }
            }
        }
        printf("%d\n", count);
    }
return 0;
}



Measured memory_bytes: 2040
#include <iostream>
#include <vector>

uint32_t pow_mod(uint32_t base, uint32_t exp, uint32_t mod) {
  if (exp == 0) return 1;

  uint64_t half = pow_mod(base, exp / 2, mod);
  uint64_t ans = (half * half) % mod;
  return (ans * (exp % 2 == 0 ? 1ll : base)) % mod;
}

uint32_t inv_mod(uint32_t x, uint32_t mod) { return pow_mod(x, mod - 2, mod); }

uint32_t comb_mod(uint32_t n, uint32_t k, const std::vector<uint64_t>& fact_mod,
                  uint32_t mod) {
  if (n < k) return -1;
  return (fact_mod[n] * inv_mod((fact_mod[n - k] * fact_mod[k]) % mod, mod)) %
         mod;
}

int main() {
  const uint32_t mod = 998'244'353;
  uint32_t N = 0, M = 0, K = 0;
  std::cin >> N >> M >> K;

  std::vector<uint64_t> fact_mod(N, 1);
  for (size_t i = 1; i < fact_mod.size(); i++)
    fact_mod[i] = (i * fact_mod[i - 1]) % mod;

  uint32_t ans = 0;
  for (size_t k = 0; k < K + 1; k++) {
    uint64_t pow = pow_mod(M - 1, N - 1 - k, mod);
    pow = (pow * M) % mod;
    uint64_t comb = comb_mod(N - 1, k, fact_mod, mod);
    ans = (ans + (pow * comb) % mod) % mod;
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 4788
#include <stdio.h>
int main(void){
  int n,m,e[100000],a[200001],f[200001]={0},i;
  scanf("%d %d",&n,&m);
  for(i=1;i<=n;i++)
    a[i]=1;
  for(i=0;i<m;i++){
    scanf("%d",&e[i]);
    a[e[i]]=0;
    f[e[i]]=1;
  }
  for(i=m-1;i>=0;i--)
    if(f[e[i]]){
      printf("%d\n",e[i]);
      f[e[i]]=0;
    }
  for(i=1;i<=n;i++)
    if(a[i])
      printf("%d\n",i);
  return 0;
}

Measured memory_bytes: 2556
import java.util.*;

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

    int n = sc.nextInt();
    int[] a = new int[n + 1];
    int[] b = new int[n + 1];
    int[] c = new int[n];

    String dm = "";
    for (int i = 1; i <= n; i++) {
      a[i] = sc.nextInt();
    }
    for (int i = 1; i <= n; i++) {
      b[i] = sc.nextInt();
    }
    for (int i = 1; i < n; i++) {
      c[i] = sc.nextInt();
    }
    
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      ans += b[a[i]];
      if (i < n && a[i+1] == a[i] + 1) ans += c[a[i]];
    }
    
    System.out.println(ans);
  }
}


Measured memory_bytes: 23252
#include<stdio.h>

void swap(int *a, int *b ){
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp; 
}

int main(void){
    int a, b;
    
    while(1){
        scanf("%d %d", &a, &b);
        if(a == 0 && b == 0){
            break;
        }
        
        printf("%d %d\n", a>b?b:a, a>b?a:b);
        
    }
    return 0;
}

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

int main() {
  int N, K;
  string S;
  
  cin >> N >> K >> S;
  for(int i = 0;i < N; i++){
    if(i == K-1){
      if(S.at(i) == 'A'){
        cout << 'a';
      }else if(S.at(i) == 'B'){
        cout << 'b';
      }else{
        cout << 'c';
      }
    } else {
      cout << S.at(i);
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
import sys

total = 0
input = sys.stdin.readline

N = int(input())
point_list = [int(x) for x in input().split()]

for i in range(N):
  sub_total = 0
  M = point_list.pop()
  for p in point_list:
    sub_total += M * p
  total += sub_total

print(total)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << -1 << endl;return 0
#define int ll
#define Endl endl


signed main(void){
    int M,K;
    cin >> M >> K;
    if(M==0){
        if(K==0){
            cout << "0 0" << endl;
            return 0;
        }else{
            GOODBYE;
        }
    }
    if(M==1){
        if(K==0){
            cout << "0 0 1 1" << endl;
            return 0;
        }else{
            GOODBYE;
        }
    }
    int N=1<<M;
    if(N<=K){
        GOODBYE;
    }
    
    for(int i=N-1;i>=0;i--){
        if(i!=K)cout << i << " ";
    }
    cout << K << " ";
    for(int i=0;i<N;i++){
        if(i!=K)cout << i << " ";
    }
    cout << K << endl;
    return 0;
}


Measured memory_bytes: 1792
import math
from collections import Counter
def solve():
    N = int(input())
    primeFac = prime_factorize(N)
    counter = Counter(primeFac)
    divisors = []
    for key, val in counter.items():
        for i in range(1,val+1):
            divisors.append(pow(key,i))

    divisors.sort()
    now = N
    ans = 0
    for d in divisors:
        if now % d == 0:
            ans += 1
            now //= d
    
    print(ans)

def prime_factorize(n):
    prime_numbers = []
    for p in range(2, int(math.sqrt(n)+1)):
        if n % p != 0:
            continue
        while n % p == 0:
            n /= p
            prime_numbers.append(p)

    if n != 1:
        prime_numbers.append(n)
    return prime_numbers
    
if __name__ == '__main__':
    solve()

Measured memory_bytes: 68320
#include<stdio.h>
int main(void)
{
  int N,i,M,j;
  scanf("%d",&N);
  int X[N];
  for(i=0;i<N;i++)
    {
      scanf("%d",&X[i]);
    }
  scanf("%d",&M);
  int A[M];
  for(i=0;i<M;i++)
    {
      scanf("%d",&A[i]);
    }
  for(i=0;i<M;i++)
    {
      int count,flag;
      count=X[A[i]-1]+1;
      if(count>2019)
	{
	  count=2019;
	}
      for(j=0;j<N;j++)
	{
	  if(count==X[j])
	    {
	      flag=1;
	      break;
	    }
	  else
	    {
	      flag=0;
	    }
	}
      //printf("%d",flag);
      if(flag==0)
	{
	  X[A[i]-1]=count;
	}
    }
  for(i=0;i<N;i++)
    {
      printf("%d\n",X[i]);
    }
  
  return 0;
}



Measured memory_bytes: 2076
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long int;
using ULL = unsigned long long;
const LL MOD = 1e9 +7;
int main() {
    LL n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    LL res = 0;
    rep(i, n - 1) {
        loop(j, i + 1, n) {
            if (a[i] > a[j]) res++;
        }
    }
    LL cnt = 0;
    rep(i, n) {
        rep(j, n) {
            if (i == j) continue;

            if (a[i] < a[j]) {
                cnt++;
                cnt = cnt % MOD;
            }
        }
    }
    LL ans = (res * (k % MOD)) + ( ((k *(k - 1)) / 2) % MOD) * cnt;
    cout << ans % MOD << endl;
    return 0;
}


Measured memory_bytes: 888