akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
const int N = 1e6 + 5 ;
const int MOD = 1e9+7;
typedef long long int ll;
vector< pair< ll , ll > > vp;
map<ll , ll > mp , mpp;
vector < ll > v , v1 , v2 ;
ll dp[N][5] , visit[N] ;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<"  ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
int a[N] , b[N] , c[N] , k , n  ;
ll go(int idx , int kon) {
	if(idx == n) return 0 ;
	//cout << n << endl ;
	if(dp[idx][kon] != -1) return dp[idx][kon] ;
	ll x = -1e9 , y = -1e9 , z = -1e9 ;
	if(kon != 1) x = a[idx] + go(idx + 1 , 1 ) ;
	if(kon != 2) y = b[idx] + go(idx + 1 , 2) ;
	if(kon != 3) z = c[idx] + go(idx + 1 , 3) ;
	return dp[idx][kon]= max(x , max(y , z)) ;
 }
int main()
{ fast;
   ll  m, val, d, mi=1e9, mx(0) ;
   ll sum(0), ct(0), p(0), q(0);
   string s ;
   cin >> n ;
   memset(dp , -1 , sizeof(dp)) ;
   for(int i = 0;  i < n; i++ ) cin >> a[i] >> b[i] >> c[i] ;
   cout << go(0 , 4) ;
}


Measured memory_bytes: 55296
#include <bits/stdc++.h>
#define prev someone_else_0
#define last someone_else_1
#define next someone_else_2

using namespace std;

const long double eps = 1e-9;

const int MaxN = 50 + 15;

long long a[MaxN];
long long A[MaxN];

int n;


bool trueCan(long long k)
{
    long long res = 0;
    if(k < 0)
        return false;
    for(int i = 1; i <= n; ++i)
    {
        a[i] = A[i];
        a[i] += k;
        if(a[i] >= n)
        {
            res = res + (a[i] - (n - 1)) / (n + 1);
            if((a[i] - (n - 1)) % (n + 1))
                ++res;
        }
        if(res > k)
            return false;
    }
    return true;
}

void solve(long long k)
{
    for(int delta = -1000; delta <= 1000; ++delta)
        if(trueCan(k + delta))
        {
            cout << k + delta << '\n';
            return;
        }
}

bool can(long long k)
{
    for(int delta = -1000; delta <= 1000; ++delta)
        if(trueCan(k + delta))
            return true;
    return false;
}

int main()
{
//    freopen("input.txt", "r", stdin);
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n;
    for(int i = 1; i <= n; ++i)
    {
        cin >> A[i];
    }
    long long l = 0;
    long long r = 50 * 1ll * 1e9 * 1ll * 1e7;
    long long ans = -1;
    //cout << can(0);
    while(l <= r)
    {
        long long mid = (l + r) / 2;
        if(can(mid))
        {
            ans = mid;
            r = mid - 1;
        }else
            l = mid + 1;
    }
    solve(ans);

    return 0;
}
/**
4 4
2 5
3 3
1 4
2 2
0 3
1 1
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(x) (((long long)x)%modulo)
bool check(string a){
	if(a[0]=='0'&&a[1]!='0')return true;
	else if(a[0]=='1'&&(a[1]=='0'||a[1]=='1'||a[1]=='2'))return true;
	
	return false;
}


int main(){
	int N,K;
	cin>>N>>K;
	double ans = 0;
	for(int i=1;i<=N;i++){
		int x = i;
		double p = 1.0;
		while(x<K){
			p/=2.0;
			x*=2;
		}
		ans+=p;
	}
	ans/=(double)N;
	
	cout<<fixed<<setprecision(20)<<ans<<endl;
	
	
	return 0;
}


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

color_list = []
anycolor = 0
for rate in a:
    if(rate >= 3200):
        anycolor+=1
        continue
    color = rate // 400
    if(color not in color_list):
        color_list.append(color)

minc = max(1, len(color_list))
maxc = len(color_list) + anycolor

print(minc, maxc)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.nextLine());

		int[][] map = new int[n][n];
		for (int i = 0; i < n; i++) {
			String[] nico = sc.nextLine().split(" ");
			for (int j = 0; j < n; j++) {
				map[i][j] = Integer.parseInt(nico[j]);
			}
		}
		
		int[][][] tmp = new int[n][n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < n; k++) {
					tmp[i][j][k] = 0;
				}
			}
		}
		
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				for (int sj = 0; sj <= j; sj++) {
					if (j > 0) tmp[i][sj][j] = tmp[i][sj][j - 1] + map[i][j];
					else tmp[i][sj][j] = map[i][j];
				}
			}
		}
		
		int max = Integer.MIN_VALUE;
		for (int si = 0; si < n; si++) {
			for (int ei = (si + 1); ei <= n; ei++) {

				for (int sj = 0; sj < n; sj++) {
					for (int ej = sj; ej < n; ej++) {
						
						int sum = 0;
						for (int i = si; i < ei; i++) {
							sum = sum + tmp[i][sj][ej];
						}
						if (max < sum) max = sum;
					}
				}
			}
		}
		
		System.out.println(max);
	}
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

// https://stackoverflow.com/questions/12991758/creating-all-possible-k-combinations-of-n-items-in-c
int main() {

    int n, k;
    cin >> n >> k;

    int combo = (1 << k) - 1;       // k bit sets
    while (combo < 1 << n) {

        unsigned long long ans = 0;
        for (int j = 0; j < n; j++) {
            if (((combo >> j) & 1) == 0)continue;
            ans |= (1ull << j);
        }

        printf("%lld:", ans);
        for (int j = 0; j < n; j++) {
            if (((combo >> j) & 1) == 0)continue;
            printf(" %d", j);
        }
        cout << endl;


        int x = combo & -combo;
        int y = combo + x;
        int z = (combo & ~y);
        combo = z / x;
        combo >>= 1;
        combo |= y;
    }
}



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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int a,b; cin>>a>>b;
  multiset<int> s;
  s.insert(a); s.insert(b);
  int ans = 0;
  ans += *s.rbegin();
  int x=*s.rbegin();
  s.erase(s.find(x));
  --x; s.insert(x);
  ans += *s.rbegin();
  out(ans);
  

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int X, Y;
const int MOD = 1000000007;
const int MAX = 2100000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k) {
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  COMinit();

  cin >> X >> Y;

  int N = 2 * Y - X;
  int M = 2 * X - Y;
  if (N % 3 != 0 || M % 3 != 0) {
    cout << "0" << endl;
    return 0;
  }
  N /= 3;
  M /= 3;

  cout << COM(N + M, min(N, M)) << endl;
  return 0;
}


Measured memory_bytes: 52832
def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)

def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max,mod=DIV):
    fac,finv,inv = [0]*max, [0]*max, [0]*max
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod -inv[mod%i] * (mod//i)%mod
        finv[i] = finv[i-1]*inv[i]%mod
    class CONV:
        def __init__(self):
            pass
        def ncr(self,n,k):
            if(n<k):
                return 0
            if(n<0 or k<0 ):
                return 0
            return fac[n]*(finv[k]*finv[n-k]%mod)%mod
    return CONV()


def main():
    n = iRaw()
    As = isRaw()
    for a in As:
        if a%2==0:
            if a%3!=0 and a%5!=0:
                return "DENIED"
    return "APPROVED"


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 38384
n=int(input())
a=list(map(int,input().split()))
cnt=[0]*(n+1)
ans=0
for i in range(n):
    cnt[a[i]]+=1
for j in range(n+1):
    ans+=(cnt[j]*(cnt[j]-1))//2
for k in range(n):
    print(ans-(cnt[a[k]]-1))


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

using namespace std;

int N;

int findSumOfDigits(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

void solve() {
    int min = 10000000;

    for (int i = 1; i < N; ++i) {
        if (min > findSumOfDigits(i) + findSumOfDigits(N - i)) {
            min = findSumOfDigits(i) + findSumOfDigits(N - i);
        }
    }
    printf("%d\n", min);
}

int main() {
    cin >> N;
    solve();
    return 0;
}

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

using namespace std;

#define ll long long

int main()
{
	ll N;
	cin >> N;

	vector < ll > A(N);
	for (ll i = 0; i < N; i++) {
		cin >> A[i];
	}

	sort(A.begin(), A.end());

	ll prod = 1;
	for (ll i = 0; i < N; i++) {
		if (A[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
		if (A[i] <= 1000000000000000000 / prod) {
			prod *= A[i];
		} else {
			cout << -1 << endl;
			return 0;
		}

	}

	cout << prod << endl;

	return 0;
}


Measured memory_bytes: 4016
#include <iostream>

using namespace std;

int N;
int a[200006];
int check[200006];
int pos[200006];
int L[200006], R[200006];

int main(void) {

	cin >> N;

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

	//=======================

	long long int ans = 0;

	for (int i = 1; i <= N; i++) {
		pos[a[i]] = i;
	}


	for (int k = N; k >= 1; k--) {

		int I = pos[k];

		check[I] = 1;
		if (check[I - 1] == 0 && check[I + 1] == 0) { L[I] = I; R[I] = I;  ans += k; }
		else if(check[I-1]==0 && check[I+1]==1){ 
			int p = 1;
			int q = R[I + 1] - I + 1;
			ans += (long long int)p*q*k;
			L[I] = I;
			R[I] = R[I + 1];
			L[R[I + 1]] = I;
		   }
		else if (check[I - 1] == 1 && check[I + 1] == 0) {
			int p = I - L[I - 1] + 1;
			int q = 1;
			ans += (long long int)p*q*k;
			R[I] = I;
			L[I] = L[I - 1];
			R[L[I - 1]] = I;
		}
		else {
			int p = I - L[I - 1] + 1;
			int q = R[I + 1] - I + 1;
			ans += (long long int) p*q*k;
			L[R[I + 1]] = L[I - 1];
			R[L[I - 1]] = R[I + 1];
		}
	}


	/*for (int i = 1; i <= N; i++) {
		int k = a[i];
		int p = 0, q = 0;
		while (a[i-p] >= k) { p++; }
		while (a[i+q] >= k) { q++; }
		//cout << "p= " << p << "  q= " << q << endl;
		ans += (long long int)p*q*k;
	}*/

	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 4096
integer(16) N,T
integer(16),allocatable,dimension(:)::times
integer(16) ans
read*,N,T
allocate(times(N))
read*,times
ans=0
do i=1,N-1
  ans=ans+min(T,times(i+1)-times(i))
end do
print"(i0)",ans+T
end

Measured memory_bytes: 3968
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
D = [(-1, 0), (1, 0), (0, -1), (0, 1)]
for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            # print('h, w', h, w)
            for dy, dx in D:
                ny = h + dy
                nx = w + dx
                if ny < 0 or ny < 0:
                    continue
                if nx >= W or ny >= H:
                    continue
                # print('ny, nx', ny, nx, S[ny][nx])
                if S[ny][nx] == '#':
                    break
            else:
                print('No')
                exit()
print('Yes')


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[100010];
int main ()
{
	int n,i;
	scanf("%d",&n);
	for(i=1;i<=n;++i) scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	int stand1=a[n]/2,stand2;
	if(a[n]%2==0) stand2=stand1;
	else stand2=stand1+1;
	int p=1,minn=min(abs(stand1-a[1]),abs(stand2-a[1]));
	for(i=2;i<n;++i)
	{
		int t=min(abs(stand1-a[i]),abs(stand2-a[i]));
		if(t<minn)
		{
			p=i;
			minn=t;
		}
	}
	printf("%d %d\n",a[n],a[p]);
} 

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>
#include <fstream>

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353;
constexpr int MAX = 5000000;

int main()
{

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

	ll n, m; cin >> n >> m;
	ll sum = 0;
	vector<ll> a(n); for (int i = 0; i < n; i++) cin >> a[i], sum += a[i];
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] * 4 * m >= sum) cnt++;
	}
	if (cnt >= m) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

int main(void){
    int a,b;
    cin >> a >> b;
    if (b == 1) {
        cout << 0 << endl;
        return 0;
    }
    int cnt = 1;
    b -= a;
    while (b > 0) {
        b -= a-1;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
// Problem : A - Payment
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define fastio                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
#define sz(a) (int)((a).size())
#define pb push_back
#define mp make_pair
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z)                                                       \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define dbp(x) \
  cout << #x << "= {" << (x.first) << ", " << (x.second) << "}" << endl;
#define dbv(v)                         \
  {                                    \
    cout << #v << " : ";               \
    for (auto x : v) cout << x << ' '; \
    cout << endl;                      \
  }
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rep2(i, a, b) for (int i = a; i >= b; i--)
#define die(x) return cout << x << '\n', 0;

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int32_t main() {
  fastio;
  //  freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
  int testcases;
  testcases = 1;
  // cin>>testcases;

  while (testcases--) {
    int n;
    cin >> n;
    if (n % 1000 == 0)
      cout << 0 << '\n';
    else
      cout << (1000 - (n % 1000)) << '\n';
  }

  return 0;
}


Measured memory_bytes: 3636
n, m = map(int, input().split())

S = [1] * (n + 1)
for _ in range(m):
    a = int(input())
    S[a] = 0

mod = 10**9 + 7
for i in range(2, n + 1):
    if S[i] != 0:
        S[i] = (S[i - 1] + S[i - 2]) % mod

ans = S[n]
print(ans)


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

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){return a/GCD(a,b)*b;}

const int INF=1e9;
const double eps=0.0000000001;


int main(){

  ll n,m;
  cin >> n >> m;
  if(n*2>m){
    cout << m/2 << endl;
  }else{
    cout << n+(m-2*n)/4 << endl;
  }
  
}

Measured memory_bytes: 256
import sys
def main():
    l= sys.stdin.readline()
    count = int(l.strip())
    l = sys.stdin.readline()
    nums = list(map(int, l.split()))
    check = dict()
    for n in nums:
        if n in check:
            return "NO"
            
        else:
            check[n] = True
    return "YES"
if __name__ == "__main__":
    print(main())

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

int main(){
  int a,b;
  cin>>a>>b;
  if(a<b){
    int j=0;
    for(int i=0;i<b;i++)
      j=j*10+a;
    cout<<j<<endl;
  }else{
    int j=0;
    for(int i=0;i<a;i++)
      j=j*10+b;
    cout<<j<<endl;
  }
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

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

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int main() {
	string a, b;
	cin >> a >> b;
	if (a[0] == b[0]) cout << "H" << endl;
	else cout << "D" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int64_t modpow(int x, int y, int m) {
    int64_t a = x, res = 1, ans;

    if (y == 0) {
        return 1;
    }
    if (y % 2 == 1) {
        res *= x;
    }
    a = a * a % m;
    ans = modpow(a, y / 2, m) * res % m;
    return ans;
}


int main() {
    int64_t N, ans = 0;
    cin >> N;
    vector<int64_t> A(N), B(60);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    for (int i = 0; i < N; i++) {
        int count = 0;
        while(A.at(i) > 0) {
            if (A.at(i) & 1) {
                B.at(count)++;
            }
            count++;
            A.at(i) >>= 1;
        }
    }
    for (int i = 0; i < 60; i++) {
        ans += (N - B.at(i)) * (B.at(i) * modpow(2, i, 1000000007) % 1000000007);
        ans %= 1000000007;
    }
    cout << ans << endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll xo(ll x,ll res){
  if(x==-1){
    return 0;
  }
  ll sum=0;
  x++;
  sum+=x/res*(res/2);
  x=x%res;
  sum+=max((ll)0,x-res/2);
  return sum;
}
int main(){
  ll a,b;
  cin >> a >> b;
  ll ans=0;
  ll res=2;
  for(int i=0;res<=b*2;i++){
    if((xo(b,res)-xo(a-1,res))%2==1){
      ans=ans|(ll)pow(2,i);
    }
    res*=2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4048
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>
#include <stack>
#include <bitset>

#define MAX_N 200001
#define INF   1000000000
#define p   1000000007

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

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

    ll N;
    string S;
    cin >> N;
    cin >> S;

    ll cr, cg, cb;
    cr = cg = cb = 0;
    for(ll i = 0; i < N; i++) {
      if(S[i] == 'R') cr++;
      if(S[i] == 'G') cg++;
      if(S[i] == 'B') cb++;
    }

    ll total = cr*cg*cb;
    for(ll i = 0; i < N; i++) {
      for(ll j = i + 1; j < N; j++) {
	if(S[i] == S[j]) continue;
	ll d = j - i;
	if (j + d < N) {
	  if (S[j + d] != S[i] && S[j + d] != S[j]) total--;
	}
      }
    }
    cout << total << endl;
    return 0;
}




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

# define REP(i,n) for (int i=0;i<(n);++i)
# define PER(i,n) for (int i=(N-1);i>=0;--i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class V> struct BIT {
    BIT() {}  // [L, R)
    int NV;vector<V> bit;
    
    BIT(int n){ init(n); }
    
    void init(int n) { NV = 1; while (NV < n)NV *= 2; bit.resize(NV); clear(); }
    
    V operator[](int e) { V s = 0; e++; while (e) s += bit[e - 1], e -= e&-e; return s; }
    
    void add(int e, V v) { e++; while (e <= NV) bit[e - 1] += v, e += e&-e; }
    
    int lower_bound(V val) { 
        V tv = 0; int i, ent = 0; for (i = NV - 1; i >= 0; i--)
        if(tv+bit[ent+(1<<i)-1]<=val)tv+=bit[ent+(1<<i)-1],ent += (1 << i);return ent;
    }

    V get(int L, int R) {
        assert(0 <= L); assert(R <= NV); assert(L <= R);
        V res = 0; if(R) res += operator[](R - 1); if (L) res -= operator[](L - 1);return res;
    }
    void clear() { rep(i, 0, NV) bit[i] = 0; }
};

// 二分探索する
// 中央値がx以上になる
// → 数列bにおいてx以上の値が過半数を占める
// → 各区間において、x以上の値を占める区間が過半数を占める
// → x以上の値を１、x未満の値を−１と変換して考えると、
//   区間(l,r)の総和が０以上であれば、１が過半数を占めている区間と判断できる
// → 変換した数列の累積和を考えると、S_l <= S_rとなるlとrの組み合わせの個数が
//   過半数を超えていれば、x以上が中央値になると判断できる
// → S_l <= S_rとなるlとrの組み合わせの個数は転倒数を求める手法にほぼ一致していて高速

int main() {
    ll N;
    cin >> N;

    vector<ll> a(N);
    REP(i, N) cin >> a[i];

    int low = 0, high = 1 << 30;

    const ll geta = N + 1;
    while(high - low > 1){
        ll mid = (low + high) / 2;

        BIT<ll> bit(N + 1 + geta);

        ll num = 0;
        ll sum = geta;

        const ll M = (N + 1) * N / 2;

        bit.add(sum, 1); // 累積和の初項
        REP(i, N) {
            sum += (a[i] >= mid ? 1 : -1);
            num += bit.get(0, sum + 1); // 開区間なので
            bit.add(sum, 1);
        }

        if (num >= (M + 1) / 2) low = mid;
        else high = mid;
    }

    cout << low << endl;

    return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;


void solve(long long N, long long K){
  if((N-1)*(N-2)/2<K){
    op(-1);
    return;
  }
  op(N-1+(N-1)*(N-2)/2-K)
  repf(i,1,N){
    cout<<1<<" "<<i+1<<endl;
  }
  ll cnt=0;
  repf(i,1,N){
    repf(j,i+1,N){
      if(cnt==((N-1)*(N-2)/2-K)){
        return;
      }
      cout<<i+1<<" "<<j+1<<endl;
      cnt++;
    }
  }
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M_PI       3.14159265358979323846
#define Speed_UP  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define 	pb	push_back 
#define 	ff	first 
#define 	ss	second 
#define sz(x) (int)x.size()
#warning Remeber to change t
using namespace std;
typedef long long ll;
inline void setIO(string name="") {
	#ifndef ONLINE_JUDGE 
	freopen((name+".in").c_str(), "r", stdin); 
	freopen((name+".out").c_str(), "w", stdout);
	#endif
	}

int main(){
	Speed_UP
	ll t;
	t=1;
	while(t--){
      double n,x,ti;
      cin>>n>>x>>ti;
      ll ans=ceil(n/x)*ti;
      cout<<ans;
		
		
		
	}





}


Measured memory_bytes: 3740
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main {
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        int m = in.nextInt();
        double[][] a = new double[n][m];
        for(int i = 0; i<n; i++){
            for(int j = 0; j<m; j++){
                a[i][j] = in.nextDouble();
            }
        }
        int count = 0;
        for(int i = 0; i<n-1; i++){
            double[] t1 = new double[m];
            for(int j = 0; j<m; j++){
                t1[j] = a[i][j];
            }
            for(int j = i+1; j<n; j++){
                double[] t2 = new double[m];
                double temp = 0;
                for(int k = 0; k<m; k++){
                    t2[k] = a[j][k];
                    temp += Math.pow(t2[k]-t1[k],2);
                }
                temp = Math.sqrt(temp);
                if(temp%1.0==0) ++count;
            }
        }
        out.println(count);
        out.close();
    }

    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());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public boolean hasNext() {
            String next = null;
            try {
                next = reader.readLine();
            } catch (Exception e) {
            }
            if (next == null) {
                return false;
            }
            tokenizer = new StringTokenizer(next);
            return true;
        }

        public BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
    }
}



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

int count = 0;

static void merge_sort(int* array, int size);
static void merge_sort_rec(int* array, int begin, int end, int* work);
static void merge(int* array, int begin, int end, int mid, int* work);
static void print_array(const int* array, int size);

int main(void)
{
  int i;
  int n;
  int array[500000];

  scanf("%d", &n);
  for(i=0; i<n; i++)
    scanf("%d", &array[i]);
  
  merge_sort( array, n);
  print_array( array, n);
  printf("%d\n", count);

  return 0;
}

void merge_sort(int* array, int size){

  int* work;
  work = malloc( sizeof(int) * size );
  merge_sort_rec( array, 0, size - 1, work );
  free( work );
  
}

void merge_sort_rec(int* array, int begin, int end, int* work){

  int mid;
  
  if( end <= begin ){
    return;
  }
	
  mid = (begin + end) / 2;
  merge_sort_rec( array, begin, mid, work );
  merge_sort_rec( array, mid + 1, end, work );

  merge( array, begin, end, mid, work );
}

void merge(int* array, int begin, int end, int mid, int* work){

  int i, j, k;

  for( i = begin; i <= mid; ++i){
    work[i] = array[i];
  }

  for( i = mid + 1, j = end; i <= end; ++i, --j){
    work[i] = array[j];
  }

  i = begin;
  j = end;
	
  for( k = begin; k <= end; ++k) {
    if( work[i] <= work[j] ){
      array[k] = work[i];
      ++i;
    }
    else{
      array[k] = work[j];
      --j;
    }
    count++;
  }
}

void print_array(const int* array, int  size){
  size_t i;

  for( i = 0; i < size; ++i ){
    if(i == size-1) printf( "%d", array[i] );
    else printf("%d ", array[i]);
  }
  printf( "\n" );
}



Measured memory_bytes: 5156
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        for (int i = 1; i <= n; i += 2) {
            int tmp = 0;
            for (int j = 1; j <= i; j++) {
                if (i % j == 0)
                    tmp++;
            }
            if (tmp == 8)
                ans++;
        }
        System.out.println(ans);

    }

}


Measured memory_bytes: 21844
import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
N = int(input())
mod = 998244353
rs = []
xs = []
for _ in range(N):
  x, d = map(int, input().split())
  rs.append((x, d))
  xs.append(x)
rs.sort()
xs.sort()

class SegTree:
  def segfunc(self, x, y):
    return max(x, y) #ここ判定関数（ただし結合則があるもの）
  def __init__(self, n, ide_ele, init_val):
    #####単位元######
    self.ide_ele = ide_ele
    #num:n以上の最小の2のべき乗
    self.num = 2 ** (n - 1).bit_length()
    self.seg = [self.ide_ele] * 2 * self.num
    #set_val
    for i in range(n):
      self.seg[i + self.num - 1] = init_val[i]    
    #built
    for i in range(self.num - 2, -1, -1) :
      self.seg[i] = self.segfunc(self.seg[2 * i + 1], self.seg[2 * i + 2]) 
  def update(self, k, x):
    k += self.num - 1
    self.seg[k] = x
    while k + 1:
      k = (k - 1) // 2
      self.seg[k] = self.segfunc(self.seg[k * 2 + 1], self.seg[k * 2 + 2]) 
  def query(self, p, q):
    if q <= p:
      return self.ide_ele
    p += self.num - 1
    q += self.num - 2
    res = self.ide_ele
    while q - p > 1:
      if p & 1 == 0:
        res = self.segfunc(res, self.seg[p])
      if q & 1 == 1:
        res = self.segfunc(res, self.seg[q])
        q -= 1
      p = p // 2
      q = (q - 1) // 2
    if p == q:
      res = self.segfunc(res, self.seg[p])
    else:
      res = self.segfunc(self.segfunc(res, self.seg[p]), self.seg[q])
    return res

seg = SegTree(N, 0, [0] * N)

for i in range(N - 1, -1, -1):
  j = bl(xs, rs[i][0] + rs[i][1])
  if j >= N: j -= 1
  else: j -= ((rs[i][0] + rs[i][1]) <= xs[j])
  seg.update(i, max(0, j, seg.query(i, j + 1)))
  #print((i, j), rs[i])

dp = [0] * (N + 1)
dp[0] = 1
for i in range(N):
  j = seg.query(i, i + 1)
  dp[i + 1] += dp[i]
  dp[i + 1] %= mod
  dp[j + 1] += dp[i]
  dp[j + 1] %= mod
  #print(rs[i], dp)
print(dp[-1])

Measured memory_bytes: 119132
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update>
#define standardVar ll n,m,k,num,num1,num2,flag=0
#define nn <<"\n"
#define __ <<" "<<
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define ittr(x,v) for(auto x=v.begin();x!=v.end();x++)                  //COMMON FOR LOOP (ITERATOR)
#define itr(x,n) for(int x=0;x<n;x++)                                   //COMMON FOR LOOP (VARIABLE)
#define itrab(x,a,b) for(int x=a;x<b;x++)                               //FOR LOOP WITH SPECIFIED START/END
#define itpr(v) ittr(x,v)cout<<*x<<" "; cout nn                         //PRINTS VECTOR,SET,MAP OF INTS
#define itppr(v) ittr(x,v)cout<<(*x).ff<<" "<<(*x).ss<<"  "; cout nn    //PRINTS VECTOR,SET,MAP OF PAIRS
#define sz(x) (ll)((x).size())

#define pi   3.14159265359
#define dTor(x) ((x)*pi)/180.0
#define INF  1000000000
#define INFF 1000000000000000000

typedef long long int ll;               //TYPEDEFS
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef map<ll,ll> ml;
typedef set<ll> sl;
typedef string str;
typedef pair<ll, ll> pl;
typedef vector< pl > vpl;
typedef map<pl,ll> mpl;
typedef set< pl > spl;
typedef vector<str> vst;
typedef vector<vl> vvl;
typedef vector<vb> vvb;

const ll M=1000000007;                  //COMMON MODULO PRIMES
const ll N=998244353;

ll power(ll x, ll y, ll p){             //MODULAR EXPONENTIATION
    ll res=1;
    x=x%p;
    if(x==0)
        return 0;
    while(y>0){
        if(y&1)
            res=(res*x)%p;
        y=y>>1;
        x=(x*x)%p;
    }
    return res;
}
ll inv(ll x, ll m){                     //FERMAT INVERSE
    return power(x,m-2,m);
}
ll nCr(ll n, ll r){                     //nCr MOD P  
    vl fac(10);
    if (r==0) 
        return 1;
    return (fac[n]*inv(fac[r],M)%M*inv(fac[n-r],M)%M)%M;
}
struct comp{                            //COMPARISON ON PAIRS
    template<typename T>        
    bool operator()(const T &a, const T &b){
        if (a.ff==b.ff)
            return (a.ss<b.ss);
        else
            return (a.ff<b.ff);
    }
};
bool mod(const pair<ll,ll> &a, const pair<ll,ll> &b){   //COMPARATOR FOR PAIRS (SORTING)
    if(a.ff!=b.ff)
        return (a.ff<b.ff);
    else
        return (a.ss>b.ss);
}
void sieve(){                           //SIEVE OF ERATOSTHENES
    vector<bool> pr(1000000+1,1);
    for(ll i=2;i*i<=1000000;i++)
        if(pr[i]==1)
            for(ll j=i*i;j<=1000000;j+=i)
                pr[j]=0;
}
bool isValid(ll i, ll j, ll n, ll m){   //CHECKS FOR OVERFLOW
    if(i>=0&&i<n&&j>=0&&j<m){
        return true;
    }
    return false;
}

//MAIN FUNCTION STARTS HERE

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    standardVar;
    str s;
    cin>>s;
    ll d=0;
    itr(i,sz(s)){
        d+=s[i]-'0';
    }
    cout<<(d%9?"No":"Yes");
    return 0;
}

Measured memory_bytes: 3776
n=int( input() )
a=[int(i)+1 for i in input().split()]

c=[0,0,0]
ans=1
mod=1000000007
out=0
for aa in a:
    if aa-1 in c:
        ans = ans*c.count(aa-1) %mod
        c[c.index(aa-1)]+=1
    else:
        out=1
        break
if out==1:
    print(0)
else:
    print(ans)

Measured memory_bytes: 52908
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int N, c;
vi chara, tmp;

int solve(){
  int f = 1;
  while(f && !tmp.empty()){
    f = 0;
    int n = tmp[0], c = 0;
    int i;
    for(i = 0; i < tmp.size(); i++){
      if(tmp[i] == n) c++;
      else{
	if(c >= 4){
	  f = 1;
	  break;
	}else{
	  n = tmp[i];
	  c = 1;
	}
      }
    }
    if(c >= 4){
      tmp.erase(tmp.begin()+i-c, tmp.begin()+i);
    }
  }
  return (int)tmp.size();
}

int main(){
  while(scanf("%d", &N) && N){
    chara.resize(N);
    rep(i, N){
      scanf("%d", &chara[i]);
    }

    tmp.resize(N);
    int res = N;
    rep(i, N) REP(j, 1, 4){
      if(chara[i] == j) continue;
      tmp = chara;
      tmp[i] = j;
      res = min(res, solve());
    }
    printf("%d\n", res);
  }
  return 0;
}

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

using namespace std;
typedef long long ll;

const int N = 3005, M = 998244353;
ll dp[N][N];

ll add(ll a, ll b) { return (a + b) % M; }

ll sub(ll a, ll b) { return (a - b) % M + (a >= b ? 0 : M); }

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    dp[a][b] = 1;
    for (int i = a; i <= c; i++) {
        for (int j = b; j <= d; j++) {
            dp[i][j] = add(dp[i][j], j * dp[i - 1][j]);
            dp[i][j] = add(dp[i][j], i * dp[i][j - 1]);
            dp[i][j] = sub(dp[i][j], (i - 1) * (j - 1) * dp[i - 1][j - 1]);
        }
    }
    cout << dp[c][d] << "\n";
}


Measured memory_bytes: 73852
// Copyright 2020 yaito3014
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  cout << char(toupper(s1[0])) << char(toupper(s2[0])) << char(toupper(s3[0])) << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String res = sc.next();
        if(n < 3200){
            res = "red";
        }
        System.out.println(res);
        sc.close();
    }
}

class io{
    public static void YesNo(boolean f) {
        System.out.println(f?"Yes":"No");
    }
    public static void YESNO(boolean f) {
        System.out.println(f?"YES":"NO");
    }
}

class Algo{
    public static boolean isOdd(int n){
        return n % 2 == 1;
    }
    public static boolean isEven(int n){
        return n % 2 == 0;
    }


}



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

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

typedef pair<int, int> P;



int main() {
    int n,d; cin >> n >> d;
    vector<vector<int>> X(n, vector<int>(d));
    rep(i, n) rep(j, d) {
        cin >> X[i][j];
    }

    int ans = 0;
    rep(i, n) {
        for(int j=i; j < n; j++) if(i != j) {
            int tmp = 0;
            rep(k, d) tmp += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            float t = sqrt(tmp);
            if (ceil(t) == floor(t)) ans++;
        }
    }

    cout << ans << endl;

    return 0;

}


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

const int N = 105;
int n;
char s[N];

int main() {
    scanf("%s", s + 1);
    n = strlen(s + 1);
    int res = 1e9;
    rep(c, 'a', 'z') {
        bool ff = 0;
        int ans = 1e9, lst;
        for (int j = n; j; --j) {
            if (s[j] == c) {
                if (!ff) {
                    ans = n - j, ff = 1;
                } else {
                    ans = max(ans, lst - 1 - j);
                }
                lst = j;
            }
        }
        ans = max(ans, lst - 1);
        res = min(res, ans);
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 3808
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+100;
typedef long long LL;
LL num[maxn];
int main()
{
    LL N,K;
    cin >> N >> K;
    for(int i= 0;i<N;++i)
        cin >>num[i];
    sort(num,num+N);
    LL ans = 0;
    for(int i = 0;i<N-K;++i)
    {
        ans+=num[i];
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
#include<utility>
#include<vector>

int main(void){
    int H,N;
    scanf("%d %d",&H,&N);
    int A[N];
    int sum = 0;
    for(int i=0;i<N;i++){
        scanf("%d",&A[i]);
        sum += A[i];
    }
    if(H<=sum){
        printf("Yes");
    }
    else{
        printf("No");
    }
return 0;

}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  string s;
  cin >> s;
  for(ll i=0;s.size()>0;i++) {
    s=s.substr(0,s.size()-2);
    if(s.substr(0,s.size()/2)==s.substr(s.size()/2)) {
      cout << s.size() << endl;
      return 0;
    }
  }
  cout << s.size() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,x,count=0;
  cin>>n;
  while(n--){
    cin>>x;
    if(x%2==1)
      count++;
  }
  if(count%2==1)
    cout<<"NO"<<endl;
  else
    cout<<"YES"<<endl;  
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <utility>
#include <string>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int iinf = 1 << 29;
const long long linf = 1ll << 61;

#define modp(x, y) (((y) + (x) % (y)) % (y))

int H, W;
int c[10][10];
int A[200][200];

int main(int argc, char* argv[])
{
	scanf("%d %d", &H, &W);
	for(int i = 0; i < 10; i++)
	{
		for(int j = 0; j < 10; j++)
		{
			scanf("%d", &c[i][j]);
		}
	}
	for(int i = 0; i < H; i++)
	{
		for(int j = 0; j < W; j++)
		{
			scanf("%d", &A[i][j]);
		}
	}

	int cost[10];

	for(int s = 0; s < 10; s++)
	{
		int d[10];
		priority_queue<pii, vector<pii>, greater<pii>> pq;
		fill(d, d + 10, iinf);
		d[s] = 0;
		pq.push(pii(0, s));
		while(!pq.empty())
		{
			pii p = pq.top(); pq.pop();
			int v = p.second;
			if(d[v] < p.first) continue;
			for(int i = 0; i < 10; i++)
			{
				if(i == v) continue;
				if(d[i] > d[v] + c[v][i])
				{
					d[i] = d[v] + c[v][i];
					pq.push(pii(d[i], i));
				}
			}
		}
		cost[s] = d[1];
	}

	ll ans = 0;
	for(int i = 0; i < H; i++)
	{
		for(int j = 0; j < W; j++)
		{
			if(A[i][j] != -1)
			{
				ans += cost[A[i][j]];
			}
		}
	}
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int n,a,b,ans=0;
int main(void){
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a>>b;
		ans+=b-a+1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
using namespace std;
 
int main(){
    
    int ans = 700;
    string s;

    cin >> s;

    for(int i=0;i<=2;i++){
        if(s[i]=='o'){
            ans += 100;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main()
{
	int N, M;
	int r, q;
	int t, n, m, s, ts, te;
	int sum;
	int ans[1260-540];

	while(true){
		cin >> N >> M;
		if(N==0 && M==0){return 0;}

		int* pc = new int[(N+1)*(1260-540)]; //pc毎のアクセス履歴
		int* in_time = new int[N+1]; //pc毎の直前のログイン情報(時間)
		int* in_m = new int[N+1]; //pc毎の直前のログイン情報(学生)
		fill_n(pc,(N+1)*(1260-540),0); fill_n(in_time,N+1,0); fill_n(in_m,N+1,0);

		cin >> r;
		for(int i=0; i<r; i++){
			cin >> t >> n >> m >> s;
			if(s==1){
				in_time[n] = t;
				in_m[n] = m;
			}
			else{
				for(int j= in_time[n]-540; j< t-540; j++){
					pc[n*(1260-540)+j] = m;
				}
				in_time[n] = 0;
				in_m[n] = 0;
			}
		}
		for(int i=1; i<=N; i++){
			if(in_time[i] != 0){
				for(int j= in_time[i]-540; j< 1260-540; j++){
					pc[i*(1260-540)+j] = in_m[i];
				}
				in_time[n] = 0;
				in_m[n] = 0;
			}
		}

		cin >> q;
		for(int i=0; i<q; i++){
			sum=0; fill_n(ans,1260-540,0);
			cin >> ts >> te >> m;
			for(int j=1; j<=N; j++){
				for(int k=0; k< 1260-540; k++){
					if(pc[j*(1260-540)+k]==m){
						ans[k]=1;
					}
				}
			}
			for(int k= ts-540; k< te-540; k++){
				if(ans[k]==1){
					sum++;
				}
			}
			cout << sum << endl;
		}

		delete[] pc;
		delete[] in_time;
		delete[] in_m;
	}
}

Measured memory_bytes: 5384