akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll dist[100005][5];
vector<ll> G[100005];
using Item = tuple<ll,ll,ll>;

template<class Type>
Type solve(Type res = Type()){
    fill(*dist,*dist+100005*5,INF);
    ll N,M; cin >> N >> M;
    for(int i = 0; i < M;i++){
        ll u,v; cin >> u >> v; u--; v--;
        G[u].push_back(v);
    }
    int S,T; cin >> S >> T; S--; T--;

    priority_queue<Item> pq;
    pq.push(Item(0,S,0));
    while(pq.size()){
        ll cost,n,dep; tie(cost,n,dep) = pq.top(); pq.pop();
        if(dist[n][dep] < cost) continue;
        cost *= -1;
        dist[n][dep] = cost;
        for(auto next:G[n]){
            if(dist[next][(dep+1)%3] > dist[n][dep] + (dep==2)){
                dist[next][(dep+1)%3] = dist[n][dep] + (dep==2);
                pq.push(Item(-dist[next][(dep+1)%3],next,(dep+1)%3));
            }
        }
    }
    
    res = dist[T][0];
    if(res == INF) res = -1;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 10356
#include<stdio.h>
int main(){
    int A , B ;

    scanf("%d%d",&A,&B);
    if(A==1 && B!=1){
        printf("Alice");
    }else if(B==1 && A !=1){
        printf("Bob");
    }else if(A>B){
        printf("Alice");
    }else if(A==B){
        printf("Draw");
    }else{
        printf("Bob");
    }


}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;
import java.lang.*;

class Output extends PrintWriter {

    public Output(PrintStream io) {
        super(io);
    }

    public void printArray(int[] array, String space, String end) {
        int N = array.length;
        for(int n=0; n<N-1; n++){
            super.print(array[n]);
            super.print(space);
        }
        super.print(array[N-1]);
        super.print(end);
        super.flush();
    }
    public void printArray(int[] array){
        this.printArray(array, " ", "\n");
    }
    public void printArray(long[] array, String space, String end) {
        int N = array.length;
        for(int n=0; n<N-1; n++){
            super.print(array[n]);
            super.print(space);
        }
        super.print(array[N-1]);
        super.print(end);
        super.flush();
    }
    public void printArray(long[] array){
        this.printArray(array, " ", "\n");
    }
    public void printArray(double[] array, String space, String end) {
        int N = array.length;
        for(int n=0; n<N-1; n++){
            super.print(array[n]);
            super.print(space);
        }
        super.print(array[N-1]);
        super.print(end);
        super.flush();
    }
    public void printArray(double[] array){
        this.printArray(array, " ", "\n");
    }
    public void printArray(char[] array, String space, String end) {
        int N = array.length;
        for(int n=0; n<N-1; n++){
            super.print(array[n]);
            super.print(space);
        }
        super.print(array[N-1]);
        super.print(end);
        super.flush();
    }
    public void printArray(char[] array){
        this.printArray(array, " ", "\n");
    }
    public void printArray(Object[] array, String space, String end) {
        int N = array.length;
        for(int n=0; n<N-1; n++){
            super.print(array[n]);
            super.print(space);
        }
        super.print(array[N-1]);
        super.print(end);
        super.flush();
    }
    public void printArray(Object[] array){
        this.printArray(array, " ", "\n");
    }

}

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

        String forecast = sc.next();
        String weather = sc.next();
        int match = 0;
        for(int d=0; d<3; d++) if(forecast.charAt(d)==weather.charAt(d)) match++;
        out.println(match);


        out.flush();
    }
}


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

using namespace std;

int main()
{
  int N, W, w, v;

  cin >> N >> W;

  vector<vector<int64_t>> dp(N + 1, vector<int64_t>(W + 1, -1));
  dp[0] = vector<int64_t>(W + 1, -1);
  dp[0][0] = 0;

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

  int64_t out = *max_element(dp[N].begin(), dp[N].end());
  cout << out << endl;
}


Measured memory_bytes: 82700
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <climits>
#include <iomanip>

using namespace std;

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

	int n, k, q;
	cin >> n >> k >> q;
	vector<int> member(n, k-q);
	for (int i = 0; i < q; i++) {
		int a;
		cin >> a;
		member[a - 1]++;
	}
	for (int i = 0; i < n; i++) {
		if (member[i] <= 0) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1024
import scala.io.StdIn._
object Main extends App{
  val arg = readLine().split(' ').map {_.toInt}
  val w = arg(0)
  val h = arg(1)
  val x = arg(2)
  val y = arg(3)
  val r = arg(4)

  if (x - r < 0 || x + r > w) println("No")
  else if (y - r < 0 || y + r > h) println("No")
  else println("Yes")
}

Measured memory_bytes: 44008
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static String I = "IMPOSSIBLE";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 数値
		int n = sc.nextInt();
		int x = sc.nextInt();

		if ((n + x) % 2 == 0) {
			int hei = (n + x) / 2;
			out(hei);
		} else {
			out(I);
		}

	}

	/*
	 * 以下メソッド集
	 */
	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5;
int main(){
  int n;
  scanf("%d",&n);
  int x=0,y=0,lt=0;
  while(n--){
    int t,xx,yy;
    scanf("%d %d %d",&t,&xx,&yy);
    if(t-lt<abs(xx-x) + abs(yy-y)){
      puts("No");
      return 0;
    } else if(t-lt==abs(xx-x) + abs(yy-y)){
      x=xx;
      y=yy;
      lt=t;
      continue;
    } else {
      int r = t - lt - (abs(xx-x) + abs(yy-y));
      if(r&1){
        puts("No");
        return 0;
      }
      x=xx;
      y=yy;
      lt=t;
    }
  }
  puts("Yes");
  return 0;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); i++)
typedef long long ll;
const int INF = 1e9;

int n, a[16][16];
ll dp[1 << 16];
ll cost[1 << 16];

int main() {
  cin >> n;
  rep(i, n) rep(j, n) cin >> a[i][j];

  rep(i, 1 << n) rep(j, n) for (int k = j + 1; k < n;
                                ++k) if ((i & (1 << j)) && (i & (1 << k)))
      cost[i] += a[j][k];

  rep(i, 1 << n) for (int j = i; j > 0; j = (j - 1) & i) dp[i] =
      max(dp[i], dp[i - j] + cost[j]);

  cout << dp[(1 << n) - 1] << endl;

  return 0;
}


Measured memory_bytes: 1280
from collections import defaultdict
N,T = map(int,input().split())
a_ls = list(map(int,input().split()))
# 初期のa_lsにおける高橋くんのりんご一個あたりの最大利益を求める
Min = float('inf')
max_profit = 0
for i in range(N):
    if a_ls[i] < Min:
        Min = a_ls[i]
    else:
        max_profit = max(max_profit,a_ls[i]-Min)

#print(max_profit)

pair_dict = defaultdict(int)
Min = float('inf')
num_Min = 0
num_Max = 0
for i in range(N):
    #print(Min)
    #print(a_ls[i])
    #print('---')
    if a_ls[i] < Min:
        if num_Max > 0:
            pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)
        Min = a_ls[i]
        num_Min = 1
        num_Max = 0
    elif a_ls[i] == Min:
        num_Min += 1
    elif a_ls[i] - Min == max_profit:
        num_Max += 1

if num_Max > 0:
    pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)

ans = 0
#print(pair_dict)
for v in pair_dict.values():
    ans += v
print(ans)


Measured memory_bytes: 22036
#include<bits/stdc++.h>
using namespace std;
 
#define ll                 long long
#define ull                unsigned long long
#define pii                pair<int, int>
#define pll                pair<ll, ll>
#define mp                 make_pair
#define ff                 first
#define ss                 second
#define sz(x)              (int) x.size()
#define all(v)             v.begin(), v.end()

template <typename T> inline void smin(T &a, T b) {a = a < b ? a : b;}
template <typename T> inline void smax(T &a, T b) {a = a > b ? a : b;}
 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << ", ";
	err(++it, args...);
}
 
template <typename T> inline void Int(T &n) {
	n = 0; int f = 1; register int ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
	for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
	n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l); }

const int mod = (int) 1e9 + 7;
 
inline int add(int a, int b) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b) {return (ll) a * b % mod;}
 
const int inf = (int) 2e9 + 5;
const ll  Inf = (ll) 2e18 + 5;
const int N   = (int) 2e5 + 5;



int solve() {
   int n; Int(n);
   cout << (n + 1) / 2 << endl;
	return 0;
}
 
int main() {
	//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int test = 1, tc = 0;
	//Int(test);
	//cin >> test;
	while (test--) {
		//printf("Case %d: ", ++tc);
		solve();
	}
	return 0;
}


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

#define upto(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define MOD 2019

int main(){
  int l,r; cin>>l>>r;
  int min = 0;
  if(r-l<MOD){ // 1周すれば余り0となる数が必ずある
    int a = l%MOD, b = r%MOD;
    min = MOD;
    upto(i,a,b,1){
      upto(j,i+1,b+1,1){
        int x = (i*j)%MOD;
        if(min>x) min = x;
        if(min==0) break;
      }
      if(min==0) break;
    }
  }
  cout<<min<<endl;
}

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

typedef vector<int> vi;
#define ll long long
#define loop(i,n) for(int i=0; i<n; i++)
#define loop1(i,n) for(int i=1; i<=n; i++)
#define loopi(i,s,e) for(int i=s; i < e; i++)
#define loopiRev(i,s,e) for(int i=s; i >= e; i--)
#define PI 3.14159265359
#define x first
#define y second
#define point pair<int,int>
#define len(s)   (int)s.length()
#define sz(v)    (int)v.size()
#define all(a)   a.begin(),a.end()
#define clr(x, val)	memset((x), (val), sizeof(x))

//you don't know math, unless you can do math!
ll pow_(ll b, ll p){
    if(p == 0) return 1;

    if(p&1) return b * pow_(b*b, p/2);
    else return pow_(b*b, p/2);
}

ll co[1000000];
ll values[1000000];

ll evaluate(int val, int n){
    ll res=0;
    loop(i, n){
        res += co[i] * pow_(val, n-i-1);
    }

    return res;
}

int main() {
    //freopen("input.txt" , "r" , stdin) ;
    //freopen("output.txt" , "w" , stdout) ;

    //cin.tie(0);
    //cin.sync_with_stdio(0);

    int val; cin>>val;
    int ans = (val/500) * 1000;
    val%= 500;

    ans+= (val/5) * 5;

    cout<<ans;
}



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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

bool add(int *a, int n, int m){
	for(int i = n - 1; i >= 0; i--){
		if(a[i] != m - 1){
			int v = a[i] + 1;
			for(int j = i; j < n; j++){
				a[j] = v;
			}
			return true;
		}
	}
	return false;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, m, q;
	cin>>n>>m>>q;
	int a[q], b[q], c[q], d[q];
	for(int i = 0; i < q; i++){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		a[i]--;
		b[i]--;
	}
	int arr[n]; memset(arr, 0, sizeof(arr));
	int ans = 0;
	while(true){
		int tmp = 0;
		for(int i = 0; i < q; i++){
			if(arr[b[i]] - arr[a[i]] == c[i])tmp += d[i];
		}
		ans = max(ans, tmp);
		// for(int i = 0; i < n; i++){
		// 	cout<<arr[i]<<" ";
		// }
		// cout<<'\n';
		if(!add(arr, n, m))break;
	}
	cout<<ans<<'\n';


	return 0;
}

Measured memory_bytes: 3584
/*
  kadai4_3 stone_monument
  unomi
*/
#include <stdio.h>
#include <math.h>

int convert_snow_height(int diff_height, int east_height){
    int east_tower_height=0;
    // (east_height - west_height)本目(東側)と(east_height - west_height - 1)本目(西側)の間で高さ測定
    // 1 ~ nまでの和を計算 -> 東側の(east_height - west_height)本目の塔の高さ
    east_tower_height = diff_height*(1+diff_height)/2;
    // 積雪の高さ = 東側の塔の高さ - 東側の雪に埋もれていない部分の高さ
    return east_tower_height - east_height;
}

int main(void){
    int west_height=0,east_height=0;
    // west_height(a), east_height(b) の入力を取得
    scanf("%d %d",&west_height, &east_height);

    printf("%d\n",convert_snow_height(east_height-west_height, east_height));

    return 0;
}


Measured memory_bytes: 128
from collections import Counter
N = int(input())
A = Counter(map(int, input().split()))
B = [0, 0]
for i in A.keys():
    if A[i] >= 2:
        B.append(i)
    if A[i] >= 4:
        B.append(i)
B.sort()
print(B[-1]*B[-2])

Measured memory_bytes: 24104
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[200010];
    rep(i, N) cin >> A[i];
    int right = 0;
    int ans = 0;
    int sum = 0;
    int sumX = 0;
    rep(left, N) {
        while(right < N && sum + A[right] == (sumX ^ A[right])) {
            sum += A[right];
            sumX ^= A[right];
            right++;
        }
        ans += (right - left);
        if(right == left) right++;
        else {sum -= A[left]; sumX ^= A[left];}
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5216
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = Integer.parseInt(sc.next());
    int x00 = x % 100;
    int x3  = (x - x00) / 100;
    
    if(x<100) {
      System.out.println("0");
      return;
    }
    
    int m5 = 0;
    int m1 = 0;
    int m0 = 0;

    m1 = x00 % 5;
    m5 = (x00 - m1) / 5;
    
    if(m1 != 0){
      m1 = 1;
    } else {
      m1 = 0;
    }
      
    if(x3 < m5 + m1) {
      System.out.println("0");
      return;
    }
    
    System.out.println("1");
    
  }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ALL(a) (a.begin(), a.end())
using ll = long long;
template<typename T> void Out(T x) { cout << x << endl; }
const int maxn = 1e5 + 1;
int red[maxn], gr[maxn], none[maxn];


int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  for (int i = 0; i < A; i++) cin >> red[i];
  for (int i = 0; i < B; i++) cin >> gr[i];
  for (int i = 0; i < C; i++) cin >> none[i];
  vector<int> P;
  sort(red, red + A, greater<int>());
  for (int i = 0; i < X; i++) P.pb(red[i]);
  sort(gr, gr + B, greater<int>());
  for (int i = 0; i < Y; i++) P.pb(gr[i]);
  sort(none, none + C, greater<int>());
  for (int i = 0; i < min(X+Y, C); i++) P.pb(none[i]);
  sort(P.begin(), P.end(), greater<int>());
  ll res = 0;
  for (int i = 0; i < X+Y; i++) res += P[i];
  cout << res << endl;
  return 0;

}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
int main(void){
    vector<string> YN={"NO","YES"};
    vector<string> yn={"No","Yes"};
    string s;
    cin>>s;
    cout<<(s[0]+s[1]+s[2]-'0'-'0'-'0')<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
//    for(auto& it : m)
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
//  priority_queue<ll int> pq;
//  priority_queue <ll int, vector<ll int>, greater<ll int> > pq;
//  vector<ll int> v;
//  vector< pair<ll int,ll int> > v;
//  set<ll int>::iterator it=s.begin();
//  unordered_map<  pair<ll int,ll int>, ll int> mp;

 

ll int power(ll int x, ll int y, ll int p)  
{  
    ll int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
 
int main()
{
  fastio();

 
ll int T;
T=1;
while(T--)
{
int n,m,i;cin>>n>>m;
vector<int>graph[n+1];int x,y;

int ans[n+1]={INT_MIN},vis[n+1]={0};
for(i=0;i<=n;i++)
ans[i]=INT_MIN;
ans[0]=0;
for(i=0;i<m;i++)
{
	cin>>x>>y;
	graph[x].push_back(y);
	graph[y].push_back(x);
}
queue<int> q;
q.push(1);
vis[1]=0;
ans[1]=0;
int cnt=0;
while(!q.empty())
{cnt++;
	int tt=q.size();
	while(tt--)
	{
		auto tp=q.front();
		for(i=0;i<graph[tp].size();i++)
		{
			//cout<<tp<<" "<<graph[tp][i]<<endl;
			if(ans[graph[tp][i]]!=INT_MIN)
			{
				if(vis[tp]+1<vis[ans[graph[tp][i]]]+1)
					ans[graph[tp][i]]=tp;
			}
			if(ans[graph[tp][i]]==INT_MIN)
			{
				q.push(graph[tp][i]);
				
					vis[graph[tp][i]]=vis[tp]+1;
					ans[graph[tp][i]]=tp;
					
				
			}
		}
		q.pop();
	}
}

for(i=2;i<=n;i++)
if(ans[i]==INT_MIN)
{
	cout<<"No"<<endl;
	return 0;
}
cout<<"Yes"<<endl;
for(i=2;i<=n;i++)
cout<<ans[i]<<endl;
}
    return 0;
}


Measured memory_bytes: 10940
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class BThin {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int h = in.nextInt(), w = in.nextInt();
            for (int i = 0; i < h; i++) {
                String s = in.next();
                out.println(s);
                out.println(s);
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map> // STL
#include <string> 
#include <vector>
#include <queue>
#include <stack>
#define mpr make_pair
#define debug() puts("okkkkkkkk")

using namespace std;

typedef long long LL;

const int inf = 1 << 26;

int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size()-1;i++)if(s[i]=='A'&&s[i+1]=='C'){puts("Yes");return 0;}
	puts("No");

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

//int size=1010;
int a[1010][1010];

int H,W;
ll dp[1010][1010];
bool used[1010][1010];

int dfs(int s,int t){
  if(s==H && t==W){
    return 1;
  }
  //if(s<1||t<1) return 0;
  /*if(a[s][t]==0){
    dp[s][t]=0;
    return 0;
  }*/
  if(used[s][t]) return dp[s][t];
  used[s][t]=true;
  ll p=0,q=0;
  //int ret=0;
  if(s<H+1 && a[s+1][t]==1){
    p=dfs(s+1,t);
  }
  if(t<W+1 && a[s][t+1]==1){
    q=dfs(s,t+1);
  }
  dp[s][t]=(p+q)%MOD;
  return dp[s][t];
}


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

  char k;

  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cin >> k;
      if(k=='#'){
        a[i][j]=0;
        dp[i][j]=0;
      }else{
        a[i][j]=1;
        /*if(i==1 || j==1){
          dp[i][j]=1;
        }*/
      }
    }
  }
  dp[1][1]=1;
  ll ans=dfs(1,1);

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

Measured memory_bytes: 13312
# include<iostream>
# define N 10000000
# define INF 1000000000
using namespace std;

int n, S[N], cnt=0;
void merge(int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int L[n1], R[n2];

  for(int i=0; i<n1; i++) L[i] = S[left+i];
  for(int i=0; i<n2; i++) R[i] = S[mid+i];
  L[n1] = INF;
  R[n2] = INF;
  
  for(int k=left, i=0, j=0; k<right; k++){
    if(L[i] <= R[j]){
      S[k] = L[i];
      i++;
    }else{
      S[k] = R[j];
      j++;
    }
    cnt++;
  }
  return;
}
void merge_sort(int left, int right){
  if(left+1 < right){
    int mid = (left + right)/2;
    merge_sort(left, mid);
    merge_sort(mid, right);
    merge(left, mid, right);
  }
  return;
}
int main(){
    cin >> n;
    for(int i=0; i<n; i++) scanf("%d",&S[i]);
    merge_sort(0, n);
    for(int i=0; i<n-1; i++) printf("%d ",S[i]);
    printf("%d\n",S[n-1]);
    printf("%d\n",cnt);
    return 0;
}



Measured memory_bytes: 7076
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());

        var A = Console.ReadLine().Split(' ').Select(x => float.Parse(x)).ToArray();

        float denominator = 0.0f;

        for (var i = 0; i < N; i++)
        {
            denominator = denominator + 1.0f / A[i];
        }

        Console.WriteLine(1 / denominator);
    }
}


Measured memory_bytes: 13396
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

#include <queue>
//https://cpprefjp.github.io/reference/queue/priority_queue/pop.html
priority_queue<ll> que;
//que.push(val);
//ll getv = que.top();
//que.pop();
//typedef pair<ll,ll> P;  
//priority_queue<P,vector<P>, greater<P> > que;
//que.push(P(0,base_index));

ll N;
vll G[base10_6];
vll leng[base10_6];

ll visited[base10_6]={};
ll node_belong[base10_6];

int main(){

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

    cin >> N;

    for( ll ni = 1 ; ni <=N-1 ; ni++ ){
        ll u,v,w;
        cin >> u;
        cin >> v;
        cin >> w;

        G[u].push_back(v);
        leng[u].push_back(w);

        G[v].push_back(u);
        leng[v].push_back(w);
    }
    ll index = 1;
    visited[index]=1;
    node_belong[index]=0;
    que.push(index);

    while(que.size()>0){
        ll base_index = que.top();
        que.pop();

        rep(gi,G[base_index].size()){
            ll ni = G[base_index][gi];
            ll li = leng[base_index][gi];

            if(visited[ni]==0){
                que.push(ni);
                ll bi = (node_belong[base_index] + li % 2 ) % 2;
                //cout << "ni " << ni << endl;
                //cout << "bi " << bi << endl;
                node_belong[ni]=bi;
                visited[ni]=1;
            }

        }
    }    


    for( ll ni = 1 ; ni <=N ; ni++ ){
        cout << node_belong[ni] << endl;
    }    





}

Measured memory_bytes: 59280
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
 
n = int(input())
 
count = 0
a = factorization(n)
if n == 1:
  print(0)
  exit()
  
for i in range(len(a)):
  a[i][1] -= 1
  count += 1
  b = 2
  while a[i][1] > 0:
    a[i][1] -= b
    if a[i][1] >= 0:
      count += 1
    b += 1
 
print(count)

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

int main(void)
{
	char str[4];
	scanf("%s", str);
	if (strcmp(str,"abc")==0|| strcmp(str, "acb") == 0 || strcmp(str, "bac") == 0 || strcmp(str, "bca") == 0 || strcmp(str, "cab") == 0 || strcmp(str, "cba") == 0)
	{
		printf("Yes\n");
	}
	else printf("No\n");
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  map<char,ll> temp;
  for(ll i=0;i<s.size();i++) {
    temp[s[i]]++;
  }
  ll ans=s.size()*(s.size()-1)/2+1;
  for(auto p:temp) {
    ll n=p.second;
    ans-=n*(n-1)/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 1e5 + 5;
 
int n;
string s[N];
 
int get(string &x)
{
	int ans = 0;
	for(int i = 0; i + 1 < x.size(); i++)
		if(x[i] == 'A' && x[i + 1] == 'B')
			ans++;
	return ans;
}
 
int32_t main()
{
	IOS;
	cin >> n;
	int ans = 0;
	int endA = 0, startB = 0;
	bool check = 1;
	int extra = 0;
	for(int i = 1; i <= n; i++)
	{
		cin >> s[i];
		ans += get(s[i]);
		endA += (s[i].back() == 'A');
		startB += (s[i][0] == 'B');
		if(s[i].back() != 'A' && s[i][0] != 'B')
			continue;
		bool cur = (s[i].back() == 'A');
		cur &= (s[i][0] == 'B');
		if(cur)
		{
			extra++;
			endA--;
			startB--;
		}
	}
	ans += max(0LL, extra - 1);
	if(extra > 0)
	{
		if(endA > 0)
			ans++, endA--;
		if(startB > 0)
			ans++, startB--;
	}
	int store = min(endA, startB);
	ans += store;
	endA -= store;
	startB -= store;
	cout << ans;
	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;


int n, p, a[101];

ll ans(int m, int s, int b){
	if(m == 0){
		if((b-s)%2 == p) return 1;
		return 0;
	}
	if(m <= s){
		return ans(m-1, s, b) + ans(m-1, s-1, b);
	}
	return ans(m-1, s, b)*2;
}

int main(){
	cin >> n >> p;
	int cnt = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(a[i] % 2) cnt++;
	}
	
	cout << ans(n, cnt, cnt) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265358979

using namespace std;
typedef pair<long long int, long long int> P;

int main(void) {
	long long int n;
	long long int count = 0;
	long long int total = 0;
	
	cin >> n;
	vector<long long int>a(n), b(n);

	FOR(i, 0, n - 1) {
		cin >> a[i];
		total -= a[i];
	}
	FOR(i, 0, n - 1) {
		cin >> b[i];
		total += b[i];
	}
	FOR(i, 0, n - 1) {
		if (a[i] < b[i]) {
			count += (b[i] - a[i] + 1) / 2;
		}
	}
	if (count <= total) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
  int minpa=2000,minju=2000,sum;
  int n;
  for(int i=0;i<3;i++){
    cin >> n;
    if(n<minpa)minpa=n;
  }
  for(int i=0;i<2;i++){
    cin >> n;
    if(n<minju)minju=n;
  }
  sum=(minpa+minju)-50;
  cout << sum << endl;
  return 0;
}

	 

Measured memory_bytes: 1160
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

ll gcd(ll a, ll b) {
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    string S, T;
    in >> S;
    in >> T;
    map<char, char> m{};
    map<char, char> l{};
    REP(i, S.size()) {
        if ((m.count(S[i]) != 0 && m[S[i]] != T[i]) ||
                (l.count(T[i]) != 0 && l[T[i]] != S[i])) {
            out << "No" << endl;
            return 0;
        }
        m[S[i]] = T[i];
        l[T[i]] = S[i];
    }
    out << "Yes" << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 776
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <sstream>

int main()
{
	int Q;
	std::priority_queue<long, std::vector<long>, std::less<long>> L; // 中央値より小さい a_i
	std::priority_queue<long, std::vector<long>, std::greater<long>> R; // 中央値より大きい a_i;

	std::cin >> Q;
	std::stringstream ss;

	long bsum = 0;
	long lsum = 0;
	long rsum = 0;
	for (int i = 0; i < Q; ++i) {
		int qtype;
		std::cin >> qtype;
		if (qtype == 1) {
			// update
			long a, b;
			std::cin >> a >> b;
			bsum += b;

			if (L.empty()) {
//std::cout << ":case 1\n";
				L.push(a);
			} else if (R.empty()) {
//std::cout << ":case 2\n";
				if (L.top() > a) {
					R.push(L.top());
					L.pop();
					L.push(a);
				} else {
					R.push(a);
				}
				rsum = R.top() - L.top();
			} else if (L.size() == R.size()) {
				if (L.top() > a) {
//std::cout << ":case 3c\n";
					lsum += (L.top() - a);
					L.push(a);
				} else if (R.top() > a){
//std::cout << ":case 3a\n";
					lsum += L.size() * (a - L.top());
					rsum -= (a - L.top()) * R.size();
					L.push(a);
				} else {
//std::cout << ":case 3b\n";
					rsum -= (R.top() - L.top());
					long x = R.top();
					R.pop();

					lsum += L.size() * (x - L.top());
					rsum -= (x - L.top()) * R.size();
					L.push(x);

					rsum += (a - L.top());
					R.push(a);
				}
			} else {
				if (L.top() > a) {
//std::cout << ":case 4a\n";
					long x = L.top();
					L.pop();
					lsum -= L.size() * (x - L.top());
					rsum += (x - L.top()) * R.size();

					lsum += (x - L.top());
					R.push(x);

					lsum += L.size() * (a - L.top());
					rsum -= (a - L.top()) * R.size();
					L.push(a);
				} else {
//std::cout << ":case 4b\n";
					rsum += (a - L.top());
					R.push(a);
				}
			}
		} else {
			ss << L.top() << " " << (lsum + rsum + bsum) << "\n";
		}
	}

	std::cout << ss.str();
}


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

int main() {
	int i, j;
	int ans = 0;
	int N;

	scanf("%d", &N);
	if (N < 4) {
		printf("No\n");
		return 0;
	}
	for (i = 0;i < 26; i++) {
		for (j = 0; j < 15; j++) {
			if (4 * i + 7 * j == N) {
				printf("Yes\n");
				return 0;
			}
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pi 3.141592653589793
#define mod 1000000007
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, greater_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;

int main() {
	fast_io;
	int a, b, c;
	cin >> a >> b >> c;
	cout << c << ' ' << a << ' ' << b << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 15
#define N 100005
using namespace std;

int x,y,n,m,q,vv[N],d[N],c[N],color[N],dp[N][MAX];
vector<int> v[N];

void dfs(int node,int dist,int colo) {

  if(dp[node][dist]) return ;
  if(!color[node]) {
    color[node]=colo;
  }
  dp[node][dist]=1;
  if(!dist) return ;
  for(int i=0;i<v[node].size();i++) {
    dfs(v[node][i],dist-1,colo);
  }
  dfs(node,dist-1,colo);

}

int main() {

  scanf("%d %d",&n,&m);
  for(int i=1;i<=m;i++) {
    scanf("%d %d",&x,&y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  scanf("%d",&q);
  for(int i=1;i<=q;i++) {
    scanf("%d %d %d",&vv[i],&d[i],&c[i]);
  }
  for(int i=q;i>=1;i--) {
    dfs(vv[i],d[i],c[i]);
  }
  for(int i=1;i<=n;i++) {
    printf("%d\n",color[i]);
  }

}


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

int main(){
  int n,at=0;
  cin>>n;
  int m=n;
  while(m>0){
    at+=m%10;
    m/=10;
  }
  if(n%at==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


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

template <class T, class seq_t = std::vector<T>>
class Z_algorithm
{
    seq_t key;
    const size_t len;
    std::vector<size_t> z;
    bool is_built;
  public:
    Z_algorithm(const seq_t &_key) : key(_key), len(_key.size()), is_built(false) {}

    void build()
    {
        assert(len);
        is_built = true;
        z.assign(len, 0);
        for(size_t i{1}, j{0}; i != len; ++i)
        {
            if(z[i - j] + i < z[j] + j)
            {
                z[i] = z[i - j];
            }
            else
            {
                size_t k{z[j] + j > i ? z[j] + j - i : 0};
                while(k + i < len && key[k] == key[k + i]) ++k;
                z[i] = k;
                j = i;
            }
        }
        z.front() = len;
    }

    size_t size() const { return z.size(); }
    size_t operator[](size_t i) const { return build(), z[i]; }

    std::vector<size_t> pattern_search(const seq_t &str) const
    {
        seq_t tmp(key);
        tmp.insert(end(tmp), begin(str), end(str));
        Z_algorithm other(tmp);
        other.build();
        std::vector<size_t> res(other.z.begin() + len, other.z.end());
        for(size_t &x : res) if(x > len) x = len;
        return res;
    }
};

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

    int n; cin>>n;
    vector<int> a(n),b(n);
    for(int i=0; i<n; ++i)
    {
        cin>>a[i];
    }
    for(int i=0; i<n; ++i)
    {
        cin>>b[i];
    }
    vector<int> aa(n*2),bb(n);
    for(int i=0; i<n; ++i)
    {
        bb[i]=b[i]^b[(i+1)%n];
    }
    for(int i=0; i<n*2; ++i)
    {
        int ii=i%n;
        aa[i]=a[ii]^a[(ii+1)%n];
    }

    Z_algorithm<int> z(bb);

    auto pref(z.pattern_search(aa));

    for(int k=0; k<n; ++k)
    {
        if(pref[k]==bb.size())
        {
            cout << k << " " << (b[0]^a[k]) << "\n";
        }
    }
}

Measured memory_bytes: 17520
#include <cstdio>
#include <cstring>

int main(){
    char num[1001];
    
    while(1){
        scanf("%s", &num);
        if (num[0]=='0') break;
        int cnt=0;
        for(int i=0; i<strlen(num); i++){
            int number = num[i]-'0';
            cnt += number;
        }
        printf("%d\n", cnt);
    }
    return 0;
}


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

long long gcd(long long x, long long y){
	if(y == 0) return x;
	return (gcd(y,x%y));
}

int main(){
	long long l,r,a,b;	
	cin >> l >> r >> a >> b;
		
	long long dba = (r/a) - ((l-1)/a);
	long long dbb = (r/b) - ((l-1)/b);
	long long c = (a*b) / gcd(a,b);
	long long dbab = (r/c) - ((l-1)/c);

	cout << (r-l+1) - (dba+dbb-dbab);
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  int n;
  cin >> n;
  string s;
  cin >> s;
  bool dp[11][11][11],ndp[11][11][11];
  
  rep(l,11)rep(i,11)rep(j,11) dp[i][j][l]=ndp[i][j][l]=false;
  dp[10][10][10]=ndp[10][10][10]=true;
  rep(l,n){
    int num=s[l]-'0';
    //    cout << num << endl;
    //    ndp[10][10][num]=true;
    rep(i,11){
      rep(j,11){
	ndp[i][j][num] = dp[10][i][j];
      }
    }
    rep(k,11)rep(i,11)rep(j,11) dp[i][j][k]=ndp[i][j][k];
  }
  ll ans=0;
  rep(l,10)rep(i,10)rep(j,10){
    if(dp[l][i][j]){
      ans++;
      //      cout << l << i << j << endl;
    }
  }

  cout << ans << endl;

  
  return 0;
    

}


Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
@SuppressWarnings("resource")
public static void main(String[] args) {
	Scanner sc =new Scanner(System.in);
	int N=sc.nextInt();
	String S=sc.next();
	String S2[]=S.split("");
	String before=S2[0];
	int ans=1;
	for(int i=1;i<N;i++) {
		if(before.equals(S2[i])) {
			continue;
		}else {
			ans++;
			before=S2[i];
		}
	}
	System.out.println(ans);
}
}

Measured memory_bytes: 33152
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

int main(){
    string s; cin >> s;
    ll k_ini = (s.size() + 1) / 2;
    ll k = k_ini;
    ll l = s.size() - k;
    ll r = k - 1;
    bool ok = true;
    FOR(i, k_ini, s.size()+1){
        if(!ok) break;
        if(l >= r){
            l--; r++;
            continue;
        }
        if(s[l] == s[l+1] && s[r-1] == s[r] && s[l] == s[r]){
            ok = true;  l--; r++; k++;
        }
        else{
            ok = false; break;
        }
    }
    cout << k << endstr;
    return 0;
}


Measured memory_bytes: 512
import sys
import math
import copy
from typing import Tuple, List, Union
input = sys.stdin.readline

class Area:
    def __init__(self, startidx: int, area: int):
        self.startidx = startidx
        self.area = area
    def __repr__(self):
        return "{}".format(self.area)


def main():
    edgeStack = []
    areaStack = []
    line = input()
    for idx, item in enumerate(line):
        if item is "\\":
            edgeStack.append(idx)
        elif item is "_":
            pass
        elif item is "/":
            if len(edgeStack) < 1:
                continue
            prevarea = 0
            previdx = edgeStack[-1]
            while (len(areaStack) > 0
                   and len(edgeStack) > 0
                   and areaStack[-1].startidx > edgeStack[-1]):
                area = areaStack.pop(-1)
                prevarea += area.area
            areaStack.append(Area(edgeStack.pop(-1), prevarea + idx - previdx))
    return areaStack


if __name__ == '__main__':
    areaStack = main()
    print(sum([area.area for area in areaStack]))
    if len(areaStack):
        print(len(areaStack), end=" ")
    else:
        print(len(areaStack), end="")
    print(" ".join([str(area) for area in areaStack]))



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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> v = {a,b,c};
    sort(v.begin(),v.end());
    int d = v[0]-v[1];
    int e = v[1]-v[2];
    if(d*e == 0 && d*d+e*e != 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;
 
int main(){
  	int n, k, q;
  	cin >> n >> k >> q;
  	vector<int> a(n, k-q);
  	rep(i, q){
    	int x;
      	cin >> x;
      	x--;
      	a[x]++;
    }
  
  	rep(i, n){
    	if(a[i] <= 0) puts("No");
        else puts("Yes");
    }
}

Measured memory_bytes: 3776
n = int(input())

m = n
p = 2
res = 0
st = [0 for i in range(100)]
for i in range(100):
    if i * (i + 1) // 2 >= 100:
        break
    st[i * (i + 1) // 2] = i
for i in range(1, 100):
    st[i] = st[i - 1] if st[i] == 0 else st[i]
#print(st)
while p * p <= n:
    l = 0
    while m % p == 0:
        m //= p
        l += 1
    res += st[l]
    #print(p, res, l)
    p += 1
res += m > 1
print(res)


Measured memory_bytes: 63204
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int ans=0;
  string s;
  cin >> s;
  rep(i,s.size()){
    if(s[i]=='+')ans++;
    else ans--;
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 256