akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
const int N = 500010;
const int LOG = 21;
int pr[N][21], f[N][28], a[N];
char ch[N];
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
 
int main()
{
	scanf("%s", ch);
	int len = strlen(ch);
	for (int i = 0; i < len; i ++) a[i] = ch[i] - 'a';
	for (int j = 0; j <= 26; j ++) f[len][j] = -1;
	for (int i = len - 1; i >= 0; i --)
	{
		for (int j = 0; j <= 26; j ++)  f[i][j] = -1;
		f[i][a[i]] = i + 1;
		bool flag = false;
		for (int j = a[i] + 1; j <= 26; j ++)
		{
			int at = f[f[i][j - 1]][j - 1];
			if (at == -1)
			{
				flag = true;
				break;
			}
			f[i][j] = at;
		}
		if (!flag)
			for (int j = 0; j < a[i]; j ++)
				f[i][j] = f[f[i][26]][j];
	}
	for (int i = 0; i <= len; i ++) pr[i][0] = f[i][26];
	for (int j = 1; j < LOG; j ++)
		for (int i = 0; i <= len; i ++)
		{
			if (pr[i][j - 1] == -1) pr[i][j] = -1;
			else pr[i][j] = pr[pr[i][j - 1]][j - 1];
		}
 
	int T;
	T = read();
	for(int Case = 1; Case <= T; Case ++)
	{
		int x, y;
		x = read();
		y = read();
		x --;
		for(int i = LOG - 1; i >= 0; i --)
		{
			if(pr[x][i] == -1) continue;
			if(pr[x][i] <= y) x = pr[x][i];
		}
		if(x == y) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 98816
#define _LIBCPP_DEBUG 0

#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF = 1 << 30;

vector<vector<char >> MAP(52, vector<char>(52, '.'));

bool judge(int row, int column) {

    int axisX[4] = {0, 1, 0, -1};
    int axisY[4] = {1, 0, -1, 0};
    for (int i = 0; i < 4; ++i) {
        if (MAP[row + axisX[i]][column + axisY[i]] == '#') return true;
    }

    return false;
}

int main(void) {

    int H, W;
    cin >> H >> W;

    for (int i = 1; i < H + 1; ++i) {
        for (int j = 1; j < W + 1; ++j) {
            cin >> MAP[i][j];
        }
    }

    for (int i = 1; i < H + 1; ++i) {
        for (int j = 0; j < W + 1; ++j) {
            if(MAP[i][j]!='#') continue;
            if (!judge(i, j)) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter

a, b, ab, x, y = map(int, input().split())

if a+b >= ab*2:
    less = more = 0
    cost_l = cost_m = 0
    if x < y:
        less, more = x, y
        cost_l, cost_m = a, b
    else:
        less, more = y, x
        cost_l, cost_m = b, a
    
    cost = less*ab*2
    more -= less
    less = 0

    if cost_m < ab * 2:
        cost += more*cost_m
    else:
        cost += more*ab*2

    print(cost)
else:
    print(a*x+b*y)

Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
template<typename T>
bool all_same(vector<T> v1,vector<T> v2)
{
    sort(ALL(v1));
    sort(ALL(v2),greater<T>());
    return v1 == v2;
}
   
// g++ -std=c++11 prac.cpp
ll Max=-1e9,Min=1e9+1;

int main(){
    ll a,b,d,x=0,y=0,z,n,m,k,lank=1,w,sum=0,sum2=0,ans=0;
    string s,t;
    bool ok=true;
    cin >> s;   
    t = "CODEFESTIVAL2016";
    rep(i,s.size()){
        if(s[i]!=t[i]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#!python3

# input
A, B, C, X, Y = list(map(int, input().split()))


def main():
    if A + B < 2 * C:
        ans = A * X + B * Y
    else:
        x = min(X, Y)
        ans = x * (2 * C)
        y = max(X, Y) - x
        v = A if X > Y else B
        ans += min(y * v, y * (2 * C))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int T;
	final int m=3, n=9;
	String[] ss;

	void run(){
		T=sc.nextInt();
		for(int k=0; k<T; k++){
			ss=new String[n];
			for(int i=0; i<n; i++){
				ss[i]=sc.next();
			}
			solve();
		}
	}

	int[] is, rot;
	boolean[] used;
	int answer;

	void solve(){
		is=new int[n];
		rot=new int[n];
		used=new boolean[n];
		answer=0;
		dfs(0);
		println(answer+"");
	}

	void dfs(int index){
		if(index==n){
			answer++;
			return;
		}
		for(int j=0; j<n; j++){
			if(used[j]){
				continue;
			}
			is[index]=j;
			used[j]=true;
			for(int i=0; i<4; i++){
				rot[index]=i;
				if(check(index)){
					dfs(index+1);
				}
			}
			used[j]=false;
		}
	}

	boolean check(int index){
		int x=index%m;
		int y=index/m;
		if(x>0){
			int index2=y*m+(x-1);
			char c1=ss[is[index]].charAt((3+rot[index])%4);
			char c2=ss[is[index2]].charAt((1+rot[index2])%4);
			if(Character.toLowerCase(c1)==Character.toLowerCase(c2)&&c1!=c2){}else{
				return false;
			}
		}
		if(y>0){
			int index2=(y-1)*m+x;
			char c1=ss[is[index]].charAt((0+rot[index])%4);
			char c2=ss[is[index2]].charAt((2+rot[index2])%4);
			if(Character.toLowerCase(c1)==Character.toLowerCase(c2)&&c1!=c2){}else{
				return false;
			}
		}
		return true;
	}

	void debug(Object... os){
		System.err.println(deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}

}

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

vector<int> SieveOfEratosthenes(int n) {
	n++;
	vector<bool> list(n, true);
	for(int i = 2; i * i < n; ++i) {
		if(list[i]){
			for(int j = 2; i * j < n; ++j) {
				list[i * j] = false;
			}
		}
	}
	vector<int> ret;
	for(int i = 2; i < n; ++i) {
		if(list[i]) ret.push_back(i);
	}
	return ret;
}


int main() {
	vector<int> soe = SieveOfEratosthenes(1e6);
	int x; cin >> x;
	cout << *lower_bound(soe.begin(), soe.end(), x) << '\n';
	return 0;
}

Measured memory_bytes: 1020
#include <cstdio>
#include <cmath>


int main() {
	double x[300];
	double y[300];

	while (true) {
		int N;

		scanf("%d", &N);
		if (N == 0) break;

		for (int i = 0; i < N; i++) {
			scanf("%lf%lf", &x[i], &y[i]);
		}

		int max = 1;
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				double dx = x[i] - x[j];
				double dy = y[i] - y[j];
				double dist = hypot(dx, dy);
				if (dist > 2.0) continue;

				double mx = (x[i] + x[j]) / 2;
				double my = (y[i] + y[j]) / 2;
				double l = sqrt(1.0 - dist * dist / 4);
				double cx = mx + (-dy) * l / dist;
				double cy = my + dx * l / dist;
				int count = 0;
				for (int k = 0; k < N; k++) {
					if (k == i || k == j ||
						(cx - x[k]) * (cx - x[k]) + (cy - y[k]) * (cy - y[k]) <= 1.0) count++;
				}

				if (max < count) max = count;
			}
		}

		printf("%d\n", max);
	}
	return 0;
}

Measured memory_bytes: 1084
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x) - 1 * 100);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>

using namespace std;
int n, m;



int main(void) {
	ll H, W;
	cin >> H >> W;
	ll dif = 10000000005;
	ll choco[3];
	rep(h, H) {
		choco[0] = h*W;
		choco[1] = (H - h)*(W / 2);
		choco[2] = (H - h) * (W - W / 2);
		sort(choco, choco + 3);
		dif = min(choco[2] - choco[0], dif);
		choco[0] = h*W;
		choco[1] = (H - h) / 2 * W;
		choco[2] = (H-h-(H - h) / 2) * W;
		sort(choco, choco + 3);
		dif = min(choco[2] - choco[0], dif);

	}
	rep(w, W) {
		choco[0] = H*w;
		choco[1] = (W - w)*(H / 2);
		choco[2] = (W - w) * (H - H / 2);
		sort(choco, choco + 3);
		dif = min(choco[2] - choco[0], dif);
		choco[0] = H*w;
		choco[1] = (W - w) / 2 * H;
		choco[2] = (W - w - (W - w) / 2) * H;
		sort(choco, choco + 3);
		dif = min(choco[2] - choco[0], dif);
	}
	cout << dif << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	if n%2 == 1 {
		fmt.Println(0)
		return
	}
	n /= 2
	var cnt int
	mul := 5
	for i := 0; i <= 25; i++ {
		num := int(n / mul)
		if num > 0 {
			cnt += num
		}
		mul *= 5
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {
        System.out.println(process(readAll(System.in)));
    }

    protected static String process(String data) {
        final String[] lines = splitForLines(data);

        StringBuilder sb = new StringBuilder();

        for (String line : lines) {
            final int[] split = split(line);

            int height = split[0];
            int width = split[1];

            if (height == 0 && width == 0) {
                break;
            }

            if (sb.length() > 0) {
                sb.append("\n");
            }

            sb.append(rectangle(width, height));
        }

        return sb.toString();
    }

    static String rectangle(int width, int height) {
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < height; i++) {
            for (int j = 0; j < width; j++) {
                sb.append(symbol(i, j));
            }
            sb.append('\n');
        }

        return sb.toString();
    }

    static char symbol(int y, int x) {
        return (y + x) % 2 == 0 ? '#' : '.';
    }

    private static String readAll(InputStream is) {
        InputStreamReader r = null;
        BufferedReader br = null;

        try {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        }
    }

    private static int[] split(String s) {
        final String[] s0 = s.split(" ");
        int[] ia = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ia[i] = Integer.parseInt(s0[i]);
        }

        return ia;
    }

    private static String[] splitForLines(String lines) {
        return lines.split("\\n");
    }

}

Measured memory_bytes: 20752
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const ll INF = 1000000000000000000;

ll H, ans, temp=1;

int main() {
    cin >> H;
    while(H>0){
        ans += temp;
        H /= 2;
        temp *= 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long loli;

loli N;

int main() {
    scanf("%lld", &N);
    loli ans = 1e15;
    for(loli i = 1; i * i <= N; i++) {
        if(N % i == 0) {
            ans = min(ans, (N / i) + i - 2);
        }
    }
    printf("%lld\n", ans);
    return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

template <typename T>
struct RUQ //calculateはminimum
{
    int n;
    const T ex = 1ll << 60; //初期値
    vector<T> dat, lazy; //tree本体
    RUQ(vector<T> v){
        int x = 1;
        int i;
        n = v.size();
        while(x < n) x <<= 1;
        n = x; 
        dat.resize(2*n-1, ex);
        lazy.resize(2*n-1, ex);
        for(i = 0;i < v.size();++i){
            dat.at(i + n - 1) = v.at(i);
        }
        for(i = n-2;i >= 0;--i){
            dat.at(i) = calculate(dat.at(2*i+1), dat.at(2*i+2));
        }
    }
    
    T calculate(T a, T b){
        return min(a, b);
    }
    
    void eval(int now){
        if(lazy.at(now) == ex) return;
        if(now < n - 1){
            lazy.at(2*now + 1) = lazy.at(now);
            lazy.at(2*now + 2) = lazy.at(now);
        }
        dat.at(now) = lazy.at(now);
        lazy.at(now) = ex;
    }
    
    void update(int a, int b, T x, int now, int l, int r){
        eval(now);
        if(a <= l && r<= b){
            lazy.at(now) = x; //上から書き換える。
            eval(now);
        }else if(a < r && l < b){
            update(a, b, x, 2*now + 1, l, (l + r)/2);
            update(a, b, x, 2*now + 2, (l + r)/2, r);
            dat.at(now) = calculate(dat.at(2*now + 1), dat.at(2*now + 2));
        }
    }
    void update(int a, int b, T x){update(a, b, x, 0, 0, n);}
    
    T query(int a, int b){return query_sub(a, b, 0, 0, n);}
    T query_sub(int a, int b, int now, int l, int r){
        eval(now);
        if(r <= a || b <= l) return ex;
        else if(a <= l && r <= b) return dat.at(now);
        else{
            T vl = query_sub(a, b, 2*now + 1, l, (l + r)/2);
            T vr = query_sub(a, b, 2*now + 2, (l + r)/2, r);
            return calculate(vl, vr);
        }
    }
};

int main()
{
    ll i,j;
    ll n,q;
    cin >> n >> q;
    vector<ll> a(n,(1ll << 31) - 1);
    RUQ<ll> ruq(a);
    for(i = 0;i < q;++i){
        ll com;
        cin >> com;
        if(com == 0){
            ll s,t,x;
            cin >> s >> t >> x;
            ruq.update(s, t+1, x);
        }else{
            ll ind;
            cin >> ind;
            cout << ruq.query(ind, ind+1) << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 8444
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
int C[500], S[500], F[500];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N - 1; i++) {
		cin >> C[i] >> S[i] >> F[i];
	}
	for (int k = 0; k < N; k++) {
		int t = 0;
		for (int i = k; i < N - 1; i++) {
			if (t < S[i]) t = S[i] + C[i];
			else t = t + (F[i] - t%F[i]) % F[i] + C[i];
		}
		cout << t << endl;
	}
}

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


int main() {

  vector<int> A={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int K;
  cin>>K;

  cout<<A.at(K-1)<<endl;
  
  return 0;
}


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

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define pll pair<ll, ll>

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

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

    UnionFind tree(N);

    rep(i, M) {
        int a, b;
        cin >> a >> b;
        tree.merge(a-1, b-1); // xの木とyの木を併合する
    }

    int ans = 0;
    rep(i, N) {
        ans = max(ans, tree.size(i));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4052
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static int r;
    static void INPUT()
    {
        r = NextInt();
    }
    static void OUT()
    {
        Console.WriteLine(2*r*Math.PI);
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
}




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

int main(){
    int n;
    string ss;
    cin >> n >> ss;
    vector<int> s(n);
    for (int i = 0; i < n; i++) s[i] = ss[i] - '0';
    int ans = 0;
    int a, b, c;
    for (int x = 0; x < 1000; x++){
        int y = x;
        a = x / 100; x %= 100;
        b = x / 10; x %= 10;
        c = x;
        x = y;
        int id = 0;
        bool flag = false;
        for (int i = id; i < n; i++){
            if (s[i] == a){
                id = i + 1;
                flag = true;
                break;
            }
        }
        if (!flag) continue;
        flag = false;
        for (int i = id; i < n; i++){
            if (s[i] == b){
                id = i + 1;
                flag = true;
                break;
            }
        }
        if (!flag) continue;
        flag = false;
        for (int i = id; i < n; i++){
            if (s[i] == c){
                id = i + 1;
                flag = true;
                break;
            }
        }
        if (!flag) continue;
        ans++;
    }
    cout << ans << endl;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int cc[3][3];
  int maxi = 0;
  rep(i, 0, 3) {
    rep(j, 0, 3) {
      cin >> cc[i][j];
      maxi = max(maxi, cc[i][j]);
    }
  }

  bool ans = false;
  rep(i, 0, maxi+1) {
    rep(j, 0, maxi+1) {
      rep(k, 0, maxi+1) {
        int c[3][3];
        rep(a, 0, 3) {rep(b, 0, 3) c[a][b] = cc[a][b];}
        rep(l, 0, 3) {
          c[0][l] -= i;
          c[1][l] -= j;
          c[2][l] -= k;
        }
        int cnt = 0;
        rep(m, 0, 3) {
          if(c[0][m]==c[1][m] and c[1][m]==c[2][m]) cnt++;
        }
        if(cnt == 3) {
          ans = true;
          break;
        }
      }
    }
  }  
  cout << ( ans ?"Yes" :"No") << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define flash ios_base::sync_with_stdio(false); cin.tie(NULL)
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i,a,b,c) for (ll i=a;(c>0?i<b:i>b) and c!=0;i+= c)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define all(name) (name.begin(), name.end())
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod);
#define mod_in(a) power(a, mod-2)
#define ncr(n, r) ((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod)
#define deb(x) cout << #x << " " << x << endl;
ll digit(long long n) 
{ 
    return floor(log10(n) + 1); 
} 
vector<ll> ft(1, 1LL);
vector<bool> is_prime(1000000, 1);
void sieve(){
	is_prime[0] = is_prime[1] = 0;
	for(int i = 2; i*i <= 1000000; i++)
		if(is_prime[i])
			repc(j, i*i, 1000000, i)is_prime[j] = 0;
}
ll power(ll x, ll y);
ll gcd(ll a, ll b);
vector<ll> adj[10];
ll visited[10]={0};
int main()
{   flash;
    ll n,m;
    cin>>n>>m;
    ll r=2;
    cout<<n*(n-1)/2+m*(m-1)/2;
}
//
//
//
//
//kaam ke functions
ll power(ll x, ll y) {
    ll res = 1;x %= mod;
    while (y > 0) {
        if (y & 1)res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}

bool checkPalindrome(string s){
    string r=s;
    int i=0;
    for(auto itr=s.rbegin();itr!=s.rend();itr++){
        r[i]=*itr;
        i++;
    }
    if(r==s) return 1;
    return 0;
}
ll gcd(ll a,ll b){
    if(a==0)
        return b;
 
    return gcd(b%a,a);
    
}

Measured memory_bytes: 384
#include <stdio.h>
#include <vector>
#include <set>
#include <utility>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, j, k, n, m, x, y, ans = 0;
  scanf("%lld%lld", &n, &m);
  vector<ll> vec[n];
  ll cnt[n], dp[n];
  for(i = 0; i < n; ++i) cnt[i] = dp[i] = 0;
  for(i = 0; i < m; ++i) {
    scanf("%lld%lld", &x, &y);
    vec[--x].push_back(--y);
    cnt[y]++;
  }
  set< pair<ll, ll> > s;
  for(i = 0; i < n; ++i) s.insert(make_pair(cnt[i], i));
  while(s.size()) {
    ll t = (*s.begin()).second;
    s.erase(s.begin());
    for(j = 0; j < vec[t].size(); ++j) {
      if(dp[vec[t][j]] < dp[t] + 1) dp[vec[t][j]] = dp[t] + 1;
      pair<ll, ll> p = make_pair(cnt[vec[t][j]], vec[t][j]);
      cnt[vec[t][j]]--;
      s.erase(s.find(p));
      p.first--;
      s.insert(p);
    }
  }
  for(i = 0; i < n; ++i) if(dp[i] > ans) ans = dp[i];
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 13568
#include<stdio.h>

int main(void)
{
  int n,day,r,eat[100],i,counter=0,t,ans=0;
  scanf("%d %d %d",&n,&day,&r);
  for(i=0;i<n;i++)
    {
      scanf("%d",&eat[i]);
      t=1;
      while(day >= t)
	{
	  counter++;
	  t = t + eat[i];
	}
    }
  ans = r + counter;
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// *st.find_by_order(index), 0-based
// order_of_key(e)

vector<ll> eval(vector<int> &v) {
	int n=v.size();
	vector<ll> ret(n+1,INT_MIN);
	ret[0]=0;
	for (int i=0; i<n; i++) {
		ll cur=0; int ct=0;
		for (int j=0; j<n; j++)
			cur+=v[(i+j)%n], ct++, ret[ct]=max(ret[ct],cur);
	}
	for (int i=1; i<=n; i++)
		ret[i]=max(ret[i],ret[i-1]);
	return ret;
}

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N,K; cin>>N>>K;
	vector<int> P(N), C(N);
	for (int i=0; i<N; i++)
		cin>>P[i], P[i]--;
	for (int i=0; i<N; i++)
		cin>>C[i];
	vector<vector<ll>> pre;
	vector<int> period;
	vector<ll> val;
	vector<bool> done(N,false);
	for (int i=0; i<N; i++) {
		if(done[i]) continue;
		int cur=i;
		vector<int> v;
		ll x=0;
		while(!done[cur])
			done[cur]=true, v.push_back(C[P[cur]]), x+=C[P[cur]], cur=P[cur];
		int n=v.size();
		period.push_back(n);
		pre.push_back(eval(v));
		val.push_back(x);
	}
	ll ret=0;
	int n=pre.size();
	for (int i=0; i<n; i++) {
		int sz=period[i];
		int q=K/sz, r=K%sz;
		if(q) ret=max(ret,pre[i][sz]);
		if(r==0)
			q--, r+=sz;
		ret=max(ret,max(0LL,val[i])*q+pre[i][r]);
	}
	ll tmp=*max_element(C.begin(),C.end());
	if(tmp<0)
		ret=tmp;
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 3796
#include<stdio.h>
int main()
{
    int N,count=0;
    scanf("%d",&N);

    char S[100];
    scanf("%s",&S);

    for(int i=0; i<N; i++)
    {
        if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C')
        {
            count++;
        }
    }

    printf("%d\n",count);


}

Measured memory_bytes: 1724
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const int MAXM = 4e2 + 5;
const int MAXN = 26 + 5;
const ll linf = 0x3f3f3f3f3f3f3f3f;

int n=26, m;
int c[MAXN];
int a[MAXM][MAXN];

int p[MAXM];

ll solve(void)
{
	static int lst[MAXN];
	memset(lst,0,sizeof(lst));
	
	ll ans = 0;
	for(int k=1; k<=m; ++k)
	{
		ans += a[k][ p[k] ];
		for(int i=1; i<=n; ++i) if(i != p[k])
			ans -= c[i] * (k-lst[i]);
		lst[ p[k] ] = k;
	}
	return ans;
}

int main(void)
{
	srand(time(0));
	
	scanf("%d",&m);
	for(int i=1; i<=n; ++i) scanf("%d",&c[i]);
	for(int i=1; i<=m; ++i)
		for(int j=1; j<=n; ++j)
			scanf("%d",&a[i][j]);
	
	static int lst[MAXM];
	
	ll ans = 0;
	for(int k=1; k<=m; ++k)
	{
		ll mx = -linf;
		int mxi = -1;
		for(int i=1; i<=n; ++i)
		{
			ll res = a[k][i];
			for(int j=1; j<=n; ++j) if(j!=i)
				res -= c[j] * (k-lst[j]);
			
			if(mxi==-1 || mx < res)
				mxi = i, mx = res;
		}
		lst[mxi] = k;
		
		ans += mx;
		p[k] = mxi;
	}
	
	srand(time(0) ^ rand());
	
	int T = 1e4;
	while(T--)
	{
		int pos = rand()%m + 1;
		int x = rand()%n + 1;
		
		int old = p[pos];
		p[pos] = x;
		if(solve() < ans) p[pos] = old;
	}
	
	for(int i=1; i<=m; ++i)
		printf("%d\n",p[i]);
	return 0;
}

Measured memory_bytes: 1740
//package atcoder;
 
import java.util.*;
import java.math.BigDecimal;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		if(A==B&&B!=C||A==C&&A!=B||B==C&&B!=A) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21716
n = int(input())
A = list(map(int, input().split()))
counter = 0
for i in range(0, n):
  minj = i
  for j in range(i, n):
    if A[j] < A[minj]:
      minj = j
  A[i], A[minj] = A[minj], A[i]
  if i != minj:
    counter += 1
print(*A, sep=" ")
print(counter)


Measured memory_bytes: 5608
#include <iostream>
#include <math.h>
#include <fstream>
#include <bits/stdc++.h>
using namespace std;
ifstream fin("maxsubsum.in");
ofstream fout("submultimi.out");
int n;
vector<int> L;
int cautare_binara(int x,int st,int dr)
{
    int mij,ans=st-1;
    while(st<=dr){
        mij=(st+dr)/2;
        if(L[mij]<x){
            st=mij+1;
            ans=mij;
        }
        else{
            dr=mij-1;
        }
    }
    return ans;
}
int main()
{
    int i,j,nr,cnt=0,first_count;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>nr;
        L.push_back(nr);
    }
    sort(L.begin(),L.end());
    for(i=0;i<L.size()-1;i++)
     for(j=i+1;j<L.size();j++)
    {
        first_count=cautare_binara(L[i]+L[j],j,n-1);
        cnt=cnt+first_count-j;
    }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//macros
using namespace std;
typedef long long ll;
typedef pair<int, int > Pii;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
#define pb push_back
#define rs resize 
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define repll(i, a, b) for(ll i=(a); i<(b); i++)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define COUT(a) cout << a << endl
#define ALL(a) (a).begin(),(a).end()
const long long int mod = 1e9 + 7;

Vi A;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false); 
    int N,D,X;
    cin >> N >> D >> X;
    A.rs(N);
    rep(i,0,N) cin >> A[i];
    int choco=0;
    rep(i,0,N){
        int temp=1;
        while(temp<=D){
            temp += A[i];
            choco++;
        }
    }
    COUT(choco+X);
}

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

ans = 0
for i in range(n-1):
    if P[i] == i+1:
        P[i], P[i+1] = P[i+1], P[i]
        ans += 1
if P[-1] == n:
    ans += 1
print(ans)

Measured memory_bytes: 53036
#include <stdio.h>
int main() {
int H, W;
while (scanf("%d%d", &H, &W) == 2 && (H|W)) {
for (int i = 0; i < H; i++) {
	for (int j = 0; j < W; j++) putchar((i + j) % 2 == 0 ? '#' : '.');
			putchar('\n');}
		putchar('\n');}return 0;}


Measured memory_bytes: 2044
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int[] ints=new int[n];
        for(int i=0;i<n;i++){
            ints[i]=scanner.nextInt();
        }
        int result=bubbleSort(ints);
        for(int i=0;i<ints.length;i++){
            System.out.print(ints[i]);
            if(i!=ints.length-1){
                System.out.print(" ");
            }
        }
        System.out.println();
        System.out.println(result);
    }
    public static int bubbleSort(int[] ints){
        int result=0;
        for(int i=ints.length;i>1;i--){
            for(int j=ints.length-1;j>ints.length-i;j--){
                if(ints[j]<ints[j-1]){
                    int tmp=ints[j];
                    ints[j]=ints[j-1];
                    ints[j-1]=tmp;
                    result++;
                }
            }
        }
        return result;
    }

}



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

#define int long long 

using namespace std;

void solve()
{
	string s;
	cin >> s;
	int n=s.size(),sum=0;
	for(int i =0;i<n;i++){
		if(s[i]=='1')
			sum+=1;
		else if(s[i]=='2')
			sum+=2;
		else if(s[i]=='3')
			sum+=3;
		else if(s[i]=='4')
			sum+=4;

		else if(s[i]=='5')
			sum+=5;

		else if(s[i]=='6')
			sum+=6;

		else if(s[i]=='7')
			sum+=7;

		else if(s[i]=='8')
			sum+=8;
		else
			sum+=9;
	}
	if(sum%9==0)
		cout << "Yes";
	else
		cout << "No";
}


int32_t main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	
	//int t;cin >> t;while(t--)
		solve();

	return 0;
}

Measured memory_bytes: 3696
import sys
from sys import stdin
abcd = [int(c) for c in list(stdin.readline().rstrip())]
op = ['+', '-']
for i in op:
    for j in op:
        for k in op:
            result=abcd[0]
            if i == '+':
                result+=abcd[1]
            else:
                result-=abcd[1]
            if j == '+':
                result+=abcd[2]
            else:
                result-=abcd[2]
            if k == '+':
                result+=abcd[3]
            else:
                result-=abcd[3]
            if result == 7:
                print(abcd[0], end='')
                print(i, end='')
                print(abcd[1], end='')
                print(j, end='')
                print(abcd[2], end='')
                print(k, end='')
                print(abcd[3], end='')
                print('=7')
                sys.exit()

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<cstdlib>
using namespace std;

struct aaa {
  int value;
  int ans;
};

int main() {
  int a, b, num, max, ans;
  vector<aaa> c(1000);
  cin >> a >> b;
  for(int i = 0; i < a; i++) {
    cin >> c[i].value;
    c[i].ans = 0;
  }
  for(int i = 0; i < b; i++) {
    cin >> num;
    for(int j = 0; j < a; j++) {
      if(num >= c[j].value) {
        c[j].ans++;
        break;
      }
    }
  }
  max = c[0].ans;
  ans = 1;
  for(int i = 1; i < a; i++) {
    if(max < c[i].ans) {
      max = c[i].ans;
      ans = i + 1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3112
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#define MAX_N 100001
#define INF 2147483647
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

struct edge{
  int from,to,cost;
};
typedef vector<vector<edge> > AdjList;
AdjList graph;
typedef pair<int , int> P;
typedef long long int ll;
bool comp(const edge& e1, const edge& e2){
  return e1.cost < e2.cost;
}
int E,V;
edge es[100001];

int main()
{
  ll N,A[100001],res=0,x,d=0;
  cin >> N;
  fill(A,A+100001,0);
  REP(i,N){
    cin >> x;
    A[x]++;
  }
  REP(i,100001){
    if(A[i] == 0)
      continue;
    
    if(A[i] & 1)
      res++;
    else{
      d++;
    }
  }
  
  cout << res + (d & 1 ? d-1 : d) << endl;
  return 0;
}



Measured memory_bytes: 1024
/* long long or int & the MAX_INT or MIN_INT */
/* the size of a[] & inline */
/* xx 396 */

#include<bits/stdc++.h>
using namespace std;

const int MAX_N=1e5+10;

string s,t;
char input[MAX_N];
int N;

signed main(){
	scanf("%d",&N); scanf("%s",input); s=string(input);
	t=s[0];
	for(int i=1;i<N;i++) if(s[i]!=t[t.size()-1]) t+=s[i];
	printf("%d\n",(int)t.size());
	return 0;
}

Measured memory_bytes: 640
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean bucket[] = new boolean[105];
		for(int i = 0; i < 3; i ++) {
			bucket[sc.nextInt()] = true;
		}
		long count = 0;
		for(int i = 0; i < bucket.length; i ++) {
			if(bucket[i]) {
				count ++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 21332
n,m = map(int,input().split())
arr = []
for i in range(m):
    arr += [list(map(int,input().split())) + [i]]  

dic = {}
for j in range(n+1):
    dic[j] = 1

arr.sort(key = lambda x : x[1])


for k in range(m):
    arr[k] += [dic[arr[k][0]]]
    dic[arr[k][0]] += 1

arr.sort(key = lambda x : x[2])
    
for v in range(m):
    print("{:06d}{:06d}".format(arr[v][0],arr[v][3]))
    



Measured memory_bytes: 42032
#include <bits/stdc++.h>
using namespace std;
bool good[100000];

int main() {
  int N, M;
  cin >> N >> M;
  fill(good, good+N, true);
  int H[N], A, B;
  for (int i=0; i<N; i++)
    cin >> H[i];
  for (int i=0; i<M; i++) {
    cin >> A >> B;
    A--;
    B--;
    if (H[A] <= H[B])
      good[A] = false;
    if (H[B] <= H[A])
      good[B] = false;
  }
  int ans = 0;
  for (int i=0; i<N; i++)
    if (good[i])
      ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4084
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>

#define REP(i,n) for(int i=0; i<n; i++)
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
 
#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9

using namespace std;
typedef long long ll;

int main(){
	int n, m, largeQ, l, r, data[502][502];
	
	cin >> n >> m >> largeQ;
	
	REP(i,n+1){
		REP(j,n+1){
			data[i][j] = 0;
		}
	}
	
	REP(i,m){
		cin >> l >> r;
		data[l][r-l]++;
	}
	
	REP(i,n+1){
		for (int j=0; j<n; j++){
			data[i][j+1] += data[i][j];
		}
	}
	
	REP(i,largeQ){
		ll p, q, ans=0;
		cin >> p >> q;
		for (int k=p; k<=q; k++){
			ans += data[k][q-k];
/*			for (int l=0; l<=q-k; l++){
				//printf("(%d, %d) : ", k, l);
				//debug(data[k][l]);
				ans += data[k][l];
			}*/
		}
		cout << ans << endl;
	}
	
	return 0;
}


Measured memory_bytes: 1920
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    //int[] food = {100,101,102,103,104,105};
    int a = N/100;
    int b = N%100;
    
    if(b <= a*5){
        System.out.println(1);
    }else{
        System.out.println(0);
    }
    }
}

Measured memory_bytes: 25300
import java.util.*;
 
public class Main {
 
public static void main(String[] args){
  	int count5 = 0;
  	int count7 = 0;
	Scanner sc = new Scanner(System.in);
    String[] line = sc.nextLine().split(" ");
	for(String n:line){
    	if(n.equals("5")){
        	count5++;
        }
       	if(n.equals("7")){
        	count7++;
        }
    }
  if(count5==2 && count7==1){
  	System.out.println("YES");
  }else {
	System.out.println("NO");
  }
	
}
}

Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;
int main() {
	long long n, h;
	cin >> n >> h;

	vector<long long> a(n), b(n);

	for (int i = 0; i< n; i++) {
		cin >> a[i] >> b[i];
	}

	long long max_a = a[0];
	for (auto e : a) max_a = max(max_a, e);

	sort(b.begin(), b.end(), greater<long long>());

	long long ans = 0;
	for (auto e : b) {
		if (e < max_a) continue;

		ans++;
		h -= e;

		if (h <= 0) {
			cout << ans << endl;
			return 0;
		}
	}

	ans += h / max_a;
	if (h % max_a != 0) ans++;

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


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
void solve(ll);
ll ans=0,n;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n;
    solve(0);
    cout << ans<<endl;
    return 0;
}
void solve(ll t){
    bool a,b,c;
    a=b=c=false;
    ll maki=t;
    if(maki<=n){
        while(maki){
            if(maki%10==3){
                a=true;
            }
            else if(maki%10==5){
                b=true;
            }
            else{
                c=true;
            }
            maki/=10;
        }
        if(a==true&&b==true&&c==true){
            ans++;
        }
        solve(t*10+3);
        solve(t*10+5);
        solve(t*10+7);
    }
    return;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define debug(var) std::cout << #var << " : " << var;
using ll = long long;
using ull = unsigned long long;
ll mod = 1e9 + 7;

int main(){


	int N; std::cin >> N;
	std::vector<int> A(N), B(N);
	rep(i, N){
		std::cin >> A[i];
		B[i] = abs((N - (i + 1)) - i);
	}
	std::sort(A.begin(), A.end());
	std::sort(B.begin(), B.end());
	ull ans = 0;
	bool flag = true;
	rep(i, N){
		if(A[i] != B[i]){
			flag = false;
			break;
		}
	}
	if(flag){
		ans = 1;
		rep(i, N / 2){
			ans *= 2;
			ans %= mod;
		}
	}

	std::cout << ans;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e11;
typedef pair<int,int> P;
struct Node{
    vector<P> edges;
    int color;
    bool done;
};
int N,M;
vector<Node> nodes(100010);
vector<int> ans(100010);
queue<int> q;
void coloring(){
    while(!q.empty()){
        int c = 1;
        int index = q.front();
        q.pop();
        if (nodes[index].done){
            continue;
        }
        nodes[index].done = true;
        for(P v:nodes[index].edges){
            if (c == nodes[index].color){
                c++;
            }
            nodes[v.first].color = c;
            ans[v.second] = c;
            q.push(v.first);
            c++;
        }
        chmax(M,c-1);
    }
}
int main(){
    cin >> N;
    int a,b;
    rep(i,N-1){
        cin >> a >> b;
        nodes[a-1].edges.push_back(P(b-1,i));
        nodes[i].done = false;
    }
    nodes[N-1].done = false;
    nodes[0].color = 0;
    q.push(0);
    M = 1;
    coloring();
    PRINT(M);
    rep(i,N-1){
        PRINT(ans[i]);
    }
}


Measured memory_bytes: 5888
import java.io.IOException;
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) throws IOException {
             
       Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int c = sc.nextInt();
      
      if(a<b && b<c){
    	  System.out.println("Yes");
    
      } 
      
      else{
    	  System.out.println("No");
      }
      
    }
}

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

using namespace std;


int main(void) {
    constexpr long MOD = 1e9 + 7;

    long n;
    cin >> n;
    vector<unsigned long> a(n);
    for(auto &x: a) cin >> x;

    vector<unsigned long> b(62);
    for(long i=0; i<62; i++) {
        for(auto v: a)
            if((v>>i)&1ULL)
                b[i]++;
    }

    unsigned long r = 0;
    for(long i=0; i<62; i++) {
        unsigned long s = 1ULL<<i;
        unsigned long t = (b[i] % MOD) * ((n-b[i]) % MOD);
        r += ((s % MOD) * (t % MOD)) % MOD;
        r %= MOD;
    }
    cout << (r % MOD) << endl;
}


Measured memory_bytes: 2560
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;


int main ()
{
	string str;
	while( cin >> str )
	{
		int num = 1 , f = 0;
		for( auto x : str )
		{
			if( x == '@' )
			{
				f = 1;
			} else if( f == 1 )
			{
				num = x - '0';
				f = 2;
			} else if(f==2 )
			{
				for( size_t i = 0; i < num; i++ )
				{
					cout << x;
				}
				f = 0;
			} else
			{
				cout << x;
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 1176
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations,product#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def binr(x): return bin(x)[2:]
def bitcount(x): #xは64bit整数
    x= x - ((x >> 1) & 0x5555555555555555)
    x= (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x= (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f 
    x+= (x >> 8); x+= (x >> 16); x+= (x >> 32) 
    return x & 0x7f

def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    #N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    s=input()
    n=len(s)
    c=""
    gu=[0]*n
    cnt=[0]*2
    for i in range(n):
        
        if c=="R" and s[i]=="L":
            if i%2==0:
                gp=i
                kp=i-1
            else:
                gp=i-1
                kp=i

        elif c=="L" and s[i]=="R":
            gu[gp]=cnt[0]
            gu[kp]=cnt[1]
            cnt=[0]*2
        cnt[i%2]+=1
        c=s[i]
    gu[gp]=cnt[0]
    gu[kp]=cnt[1]
    cnt=[0]*2


    print(*gu)





if __name__ == "__main__":
    main()

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

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

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  string s;
  cin>>s;
  bool ans=false;
  for(int i=0;i<s.size()-1;i++){
    if(s[i]=='A'&&s[i+1]=='C')ans=true;
  }
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

map<string, int> memo;
int main()
{
        int n;
        cin >>n;
        for(int i = 0; i < n; i++)
        {
                string s;
                cin >> s;

                memo[s]+=1;
        }
        int max = 0;
        for(const auto & x :memo)
        {       
                int v = x.second;
                if(v> max)max = v;
        }
        for(auto it= memo.begin(); it != memo.end(); it++)
        {
                if(it->second==max) 
                {
                        cout<<it->first<<endl;
                }
        }

}


Measured memory_bytes: 25216
<?php

$nt = explode(' ', trim(fgets(STDIN)));

$c = [];
for($i=0; $i<$nt[0]; $i++){
  $ct = explode(' ', trim(fgets(STDIN)));
  if ($ct[1] <= $nt[1]){
    array_push($c, $ct[0]);
  }
}
echo count($c)>0? min($c) : 'TLE';
  
?>

Measured memory_bytes: 4604
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // 入力受取
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String line1 = input.readLine();

        String[] arr = line1.split(" ");
        int N = Integer.parseInt(arr[0]);
        int D = Integer.parseInt(arr[1]);

        // 1人が見れる本数
        int a = D * 2 + 1;
        // N本を見るために必要な監視員
        int b = N / a;
        if(N % a > 0) b++;

        System.out.println(b);
    }
}


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

int main(){
  int n;
  string s;
  cin >> n >> s;
  int r = 0;
  int w = 0;
  for(int i = 0; i < n; i++){
    if(s.at(i) == 'R') r++;
  }
  w = n - r;
  int ans = 0;
  for(int i = 0; i < r; i++){
    if(s.at(i) == 'W') ans++;
  }
  cout << ans << endl;
}
  

Measured memory_bytes: 3752