akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int X, Y;
int a[15][15];
int b[16][15];

bool input() {
  cin >> X >> Y;
  if (!X && !Y) {
    return false;
  }
  for (int y = 0; y < Y; ++y) {
    for (int x = 0; x < X; ++x) {
      cin >> a[y][x];
    }
  }
  return true;
}

void solve() {
  for (int y = 0; y <= Y; ++y) {
    for (int x = 0; x < X; ++x) {
      b[y][x] = 0;
    }
  }
  for (int x = 0; x < X; ++x) {
    if (a[0][x] != 1) {
      b[0][x] = 1;
    }
  }

  for (int y = 0; y < Y - 1; ++y) {
    for (int x = 0; x < X; ++x) {
      if (!a[y][x]) {
        for (int dx = -1; dx <= 1; ++dx) {
          int nx = x + dx;
          if (nx >= 0 && nx < X && !a[y + 1][nx]) {
            b[y + 1][nx] += b[y][x];
          }
        }
        if (a[y + 1][x] == 2) {
          b[y + 1][x] += b[y][x];
        }
      } else if (a[y][x] == 2) {
        if (a[y + 2][x] != 1) {
          b[y + 2][x] += b[y][x];
        }
      }
    }
  }

  int ans = 0;
  for (int y = Y - 1; y <= Y; ++y) {
    for (int x = 0; x < X; ++x) {
      ans += b[y][x];
    }
  }
  cout << ans << endl;
}

int main() {
  while (input()) {
    solve();
  }
}

Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	int n;
	cin>>n;
	int l[100]={};
	fori(n){cin>>l[i];}
	sort(l,l+n);
	int sum=0;
	fori(n-1){sum+=l[i];}
	if(sum>l[n-1]){
		cout<<"Yes";
	}else{
		cout<<"No";
	}
}

Measured memory_bytes: 256
// C - Switches
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;

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

	vi S(M);
	for(int m=0; m<M; ++m){
		int k; cin>>k;
		while(k--){ int s; cin>>s; S[m] |= 1<<(s-1); }
	}

	vi P(M); for(int p=0; p<M; ++p) cin>>P[p];

	int all = 1<<N, unmatch_count = 0;
	for(int s=0; s<all; ++s){//s: sw all pattern
		int b,m;
		for(m=0; m<M; ++m){//S[m]: sw data matching
			int sw = s & S[m];
			b = 0; while(sw){ if(sw&1) b=++b%2; sw/=2; }//count bit '1'
			if(b!=P[m]) break;
		}
		if(m<M && b!=P[m]) ++unmatch_count;
	}
	cout<< all - unmatch_count <<endl;
}

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

int main() {

    int N;
    cin >> N;
    int total_number = 0;
    if (N < 10){
        cout << N << endl;
    }else{
        total_number += 9;
        if (N < 100){
            cout << total_number << endl;
            return 0;
        }
        if (N < 1000) {
            cout << N - 99 + total_number << endl;
            return 0;
        }
        total_number += 900;
        if (N < 10000){
            cout << total_number << endl;
            return 0;
        }
        if (N < 100000) {
            cout << N - 10000 + 1 + total_number << endl;
            return 0;
        }
        total_number += 90000;
        cout << total_number << endl;
    }
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from math import ceil

def solve(H: int, W: int):
    ans = 100000000000
    if(H%3 == 0 or W%3 == 0):
        ans = 0
    
    if(H%3):
        ans = min(ans, W)
    if(W%3):
        ans = min(ans, H)
    
    for i in range(1,W):
        if(H%2):
            l = [H*i, (W-i)*(H//2), (W-i)*(H//2+1)]
            l.sort()
            # print(l)
            ans = min(ans, abs(l[2]-l[0]))
        else:
            ans = min(ans, abs(H*i-(W-i)*(H//2)))

    for i in range(1,H):
        if(W%2):
            l = [W*i, (H-i)*(W//2), (H-i)*(W//2+1)]
            l.sort()
            # print(l)
            ans = min(ans, abs(l[2]-l[0]))
        else:
            ans = min(ans, abs(W*i-(H-i)*(W//2)))

    print(ans)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    solve(H, W)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3192
import java.util.Scanner;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		long n = stdIn.nextLong();
		long prd=1;
		
		while(n != 0)
			prd *= n--;
		
		System.out.println(prd);
	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;


int main(){
	ll n,m;
	cin>>n>>m;
    ll a[m],b[m];
    rep(i,0,m)cin>>a[i]>>b[i];
    vector <ll> s,e;
    bool p=false;
    rep(i,0,m){
        if(a[i]==1)s.push_back(b[i]);
        else if(b[i]==n)e.push_back(a[i]);
    }
    sort(s.begin(),s.end());
    sort(e.begin(),e.end());
    ll i=0,j=0;
    if(s.size()>0 && e.size()>0)while(i<s.size() && j<e.size()){
        if(s[i]<e[j])i++;
        else if(s[i]>e[j]) j++;
        else if(s[i]==e[j]){p=true;break;}
    }
    if(p)cout<<"POSSIBLE";
    else cout<<"IMPOSSIBLE";
}

Measured memory_bytes: 5084
#include <stdio.h>

int main(){
  int i,n,m=0;
  char s[105];
  scanf("%s",&s);
  for(n=0;s[n]!=0;n++);
  for(i=0;i<(n>>1);i++){
    if(s[i]!=s[n-i-1]) m++;
  }
  printf("%d",m);
  return(0);
}

Measured memory_bytes: 128
n = int(input())
ans = [0, 0, 0, 0]
for i in range(n):
    s = input()
    if s == "AC":
        ans[0] += 1
    elif s == "WA":
        ans[1] += 1
    elif s == "TLE":
        ans[2] += 1
    else:
        ans[3] += 1
for i in range(4):
    if i == 0:
        print(f"AC x {ans[i]}")
    elif i == 1:
        print(f"WA x {ans[i]}")
    elif i == 2:
        print(f"TLE x {ans[i]}")
    else:
        print(f"RE x {ans[i]}")



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

using namespace std;

int main()
{
	int n, q;
	string s;
	int dp[100010] = { 0 };

	cin >> n >> q;
	cin >> s;

	for (int i = 1; i < n; ++i)
	{
		dp[i] = dp[i - 1];
		if (s[i - 1] == 'A' && s[i] == 'C')
		{
			++dp[i];
		}
	}

	for (int i = 0; i < q; ++i)
	{
		int l, r;
		cin >> l >> r;

		cout << dp[r - 1] - dp[l - 1] << endl;

	}

	return 0;
}

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

int main() {
    int k;cin>>k;
    string s;cin>>s;
    if(s.length()>k) {
      string str = s.substr(0, k);
      string str1 = "...";
      string str2 = str + str1;
      cout<<str2<<endl;
    }else{
        cout<<s<<endl;
    }

}

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

def nprf(n):
    pf = {}
    for i in range(2, n+1):
        for j in range(2, i+1):
            while i % j == 0:
                if not j in pf:
                    pf[j] = 0
                pf[j] += 1
                i //= j
    return pf

pf = nprf(n)

def f(n):
    count = 0
    for v in pf.values():
        if v >= n-1:
            count += 1
    return count

f1 = f(75)
f2 = f(25) * (f(3)-1)
f3 = f(15) * (f(5)-1)
f4 = f(5) * (f(5)-1) //2 * (f(3)-2)

print(f1 + f2 + f3 + f4)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 212345
int a[N];

int main(){
	int k, n; scanf("%d%d", &k, &n);
	REP(i, n) scanf("%d", a+i);
	a[n] = a[0] + k;
	int mx = 0;
	REP(i, n) LAR(mx, a[i+1] - a[i]);
	printf("%d\n", k - mx);
}


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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

bool solve(void){
    int n;
    cin >> n;
    vector<lint> a(n), b(n);
    lint asum = 0, bsum = 0;
    rep(i, n){
        cin >> a[i];
        asum += a[i];
    }
    rep(i, n){
        cin >> b[i];
        bsum += b[i];
    }
    lint cnt = 0;
    rep(i, n){
        if(a[i] < b[i]){
            cnt += (b[i] - a[i] - 1) / 2 + 1;
        }
    }
    return cnt <= bsum - asum;
}

int main(){
    if(solve()){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 384
void main()
{
    int n = readln.chomp.to!int;
    int[] a = readln.split.to!(int[]);

    int m = round(a.sum / n.to!double).to!int;
    int cost;
    foreach (x; a)
    {
        cost += (x - m) ^^ 2;
    }

    cost.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 508
# -*- coding: utf-8 -*-
N, M = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
for Ai in A:
    k = 1/(4*M)
    if (sum(A))*k <= Ai:
        cnt += 1
if cnt >= M:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
	int a,b,c,t=0,h=0;
	
	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
		if(a+b<=c) continue;
		else if(a*a+b*b==c*c) t++;
		else if(a==b) h++;
	}
	
	printf("%d\n%d\n",t,h);
        return 0;
}

Measured memory_bytes: 596
/*


*/
#include <cstdio>
#include <cctype>
#include <algorithm>
#define gc() getchar()
#define mod 1000000007
#define inv2 500000004ll
typedef long long LL;
const int N=3005;

inline int read()
{
	int now=0;register char c=gc();
	for(;!isdigit(c);c=gc());
	for(;isdigit(c);now=now*10+c-48,c=gc());
	return now;
}
inline int FP(int x,int k)
{
	int t=1;
	for(; k; k>>=1,x=1ll*x*x%mod)
		if(k&1) t=1ll*t*x%mod;
	return t;
}

int main()
{
	static int A[N],f[N][N];
	const int n=read(),q=read();
	for(int i=1; i<=n; ++i) A[i]=read();
	for(int i=1; i<=n; ++i)
		for(int j=1; j<=n; ++j) f[i][j]=A[i]<A[j];
	for(int i=1; i<=q; ++i)
	{
		int x=read(),y=read();
		f[x][y]=f[y][x]=inv2*(f[x][y]+f[y][x])%mod;
		for(int j=1; j<=n; ++j)
			if(j!=x && j!=y)
				f[j][x]=f[j][y]=inv2*(f[j][x]+f[j][y])%mod,
				f[x][j]=f[y][j]=inv2*(f[x][j]+f[y][j])%mod;
	}
	LL ans=0;
	for(int i=1; i<=n; ++i)
		for(int j=1; j<i; ++j) ans+=f[i][j];
	printf("%lld\n",ans%mod*FP(2,q)%mod);

	return 0;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 112345
#define MOD 1'000'000'007LL
// ll a[N]; //count
ll b[N]={}; //factor
ll pw(ll a, ll b){
	ll c = 1;
	do {
		if(b&1) c = c*a % MOD;
		a = a*a % MOD;
	}while(b /= 2);
	return c;
}

int main(){
	FOR(i, 1, N){
		int a = i;
		b[i] = 1;
		for(int j = 2; j*j <= i; j++){
			if(a%j) continue;
			b[i] = -b[i];
			a /= j;
			if(a%j) continue;
			b[i] = 0;
			a = 1;
			break;
		}
		if(a > 1) b[i] = -b[i];
		// DEBUG("%d => %lld\n", i, b[i]);
	}

	ll n, k; scanf("%lld%lld", &n, &k);
	ll ans = 0;
	for(int i = k; i >= 1; i--){
		// DEBUG("i=%d\n", i);
		for(int j = 1; i*j <= k; j++){
			ans += MOD + pw(k / (i*j), n) * i % MOD * b[j];
			ans %= MOD;
			// DEBUG("  j=%d: %lld %lld^%lld\n", j, b[j], k/(i*j), n);
		}
	}
	printf("%lld\n", ans);
}





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

int main()
{
  string s;
  cin >> s;
  
  int ans = 0;
  
  for(int i = 0; i < s.size() / 2; i++){
    if(s.at(i) != s.at(s.size() - 1 - i))
      ans++;
  }

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

Measured memory_bytes: 256
#include <atcoder/convolution>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double

int main() {
    int N, M;
    scanf("%d %d", &N, &M);
    vector<ll> A(N), B(M);
    for (int i = 0; i < N; i++) scanf("%lld", &A[i]);
    for (int i = 0; i < M; i++) scanf("%lld", &B[i]);
    vector<ll> C = atcoder::convolution<998244353>(A, B);
    for (int i = 0; i < N+M-1; i++) {
        if (i < N+M-2) printf("%lld ", C[i]);
        else printf("%lld\n", C[i]);
    }
}


Measured memory_bytes: 27260
#include <bits/stdc++.h>
#include <vector>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define MININF -1e18L
using namespace std;
typedef long long ll;
typedef pair<int, int> intint;

int main(void)
{
    int n,m;
    cin >> n >> m;

    vector<int> cnt(m,0);
    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int num;
            cin >> num;
            cnt[num-1]++;
        }
    }   

    int ans = 0;
    for (int i = 0; i < m; i++) {
        if(cnt[i] == n){
            ans++;
        }
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 256
h, w = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))

CC = [[-1] * w for _ in range(h)]
col = 1
count = 0
dir = 0
x, y = 0, 0
cands = ((1, 0), (0, 1), (-1, 0), (0, -1))
for _ in range(h * w):
    CC[y][x] = col
    count += 1
    if count == A[col - 1]:
        count = 0
        col += 1
    dx, dy = cands[dir]
    nx, ny = x + dx, y + dy
    if nx < 0 or nx >= w or ny < 0 or ny >= h or CC[ny][nx] != -1:
        dir = (dir + 1) % 4
        dx, dy = cands[dir]
        nx, ny = x + dx, y + dy
    x, y = nx, ny

for C in CC:
    print(*C)


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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
    ll n;
    cin>>n;
    vec<ll> a(n),b(n);
    REP(i,n) cin>>a[i]>>b[i];
    ll con=0;
    REP2(i,n){
        ll x=a[i]+con;
        x%=b[i];
        if(x==0) continue;
        con += b[i]-x;
    }
    cout<<con<<en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>
    #include<cstdint>

    #define INF 1e7
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<int,int>;

    int main(){
       int n;cin>>n;
       cout<<n*n*n;
    }
    


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

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

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

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

	ullong s = 0;
	for (int i = 3 * n - 1; i >= n; i--)
	{
		if (n % 2 == 0 && i % 2 == 0)
		{
			s += a.at(i);
		}
		else if (n % 2 == 1 && i % 2 == 1)
		{
			s += a.at(i);
		}
	}
	cout << s << endl;
}

Measured memory_bytes: 2688
from math import ceil

N = int(input())

station = []
for i in range(N-1):
    station.append(tuple(map(int, input().split())))

for i in range(N-1):
    t = 0
    for j in range(i, N-1):
        c, s, f = station[j]
        if t <= s:
            # 始発前に着いたら始発に乗る
            t = s + c
        else:
            # 始発後に着いたら次の便に乗る
            x = ceil((t - s) / f)
            t = s + c + f * x
    print(t)
print(0)


Measured memory_bytes: 3188
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,ko;
    ll x,y,w,z;
    char hoge,fuga;
    cin>>n;
    set<ll> s;
    rep(i,n){
        cin>>a;
        s.insert(a);
    }
    cout<<s.size()<<endl;
    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
using namespace std;
bool judge(int a, int b, int c){
  if( a*a+b*b==c*c || a*a+c*c==b*b || b*b+c*c==a*a)return true;
  return false;
}

int main(){
  int a, b, c;
  int n;
  cin >> n;
  for(int i = 0 ; i < n ; i++){
    cin >> a >> b >> c;
    cout << (judge(a,b,c)?"YES":"NO") << endl;
  }
  return 0;
}

Measured memory_bytes: 1152
h,w,d = gets.split.map(&:to_i)
a = h.times.map{gets.split.map(&:to_i)}
m = Array.new(h*w).map{[0,0]}
h.times do |i|
  w.times do |j|
    m[a[i][j]-1] = [i,j]
  end
end
p = Array.new(h*w,0)
for i in d..h*w-1
  p[i] = (m[i][0]-m[i-d][0]).abs+(m[i][1]-m[i-d][1]).abs
  p[i] += p[i-d]
end

gets.to_i.times do
  l,r = gets.split.map(&:to_i)
  puts p[r-1]-p[l-1]
end

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

int main() {
    ll n;
    cin >> n;
    vector<long double> v(n);
    rep(i,n) cin >> v[i];
    vector<vector<ll>> vec(19,vector<ll>(19));
    for(long double d:v){
        d+=0.0000000001;
        ll x=d*1e9;
        ll b2=0,b5=0;
        while(x%2==0){
            b2++;
            x/=2;
        }
        while(x%5==0){
            b5++;
            x/=5;
        }
        b2=min(b2,18LL);
        b5=min(b5,18LL);
        vec[b2][b5]++;
    }
    ll ans=0;
    vector<vector<ll>> vec2(19,vector<ll>(19));
    rep(i,19)rep(j,19){
        rep(k,19)rep(l,19){
            if(k<i||l<j) continue;
            else vec2[i][j]+=vec[k][l];
        }
    }
    rep(i,19)rep(j,19){
        ll x=vec[i][j];
        ll y=vec2[18-i][18-j];
        ans+=x*y;
    }
    rep(i,10)rep(j,10){
        ans-=vec[9+i][9+j];
    }
    ans/=2;
    cout << ans << endl;

}


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using v = vector<T>;
template <class T>
using vv = v<v<T>>;
#define ALL(c) (c).begin(), (c).end()

int main()
{
    int x ;
    cin >> x;
    if(x==0)cout << "1" << endl;
    else cout << "0" << endl;
    return 0;
}

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

int main(void){
	int n,tm;
	while(cin >> n && n){
		vector<int> j;
		int m=31,p=0;
		for(int i=0;i<n;i++){
			cin >> tm;
			j.push_back(tm);
		}
		cout << m << endl;
		while(m){
			m -= j[p];
			if(m<=0){
				cout << 0 << endl;
				break;
			}
			cout << m << endl;
			m -= 5 - j[p++];
			cout << m << endl;
			if(p == j.size()) p=0;
		}
	}
}

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

int main() {
	int n,k,i,j;
	cin>>n>>k;
	int h[n],dp[n];
	
	for(int i=0;i<n;i++){
	    cin>>h[i];
	    dp[i]=1e9+5;
	}
	        dp[0]=0;
       for(i=0;i<n;i++){
           for(j=i+1;j<=(i+k);j++){
                 if(j<n){
                    dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));}
           }
       }
/*	for(int i=0;i<n;i++)
	    cout<<dp[i]<<" ";*/
	cout<<dp[n-1];
}


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

using namespace std;

#define int long long
#define rep(i,a,n) for(int i = a; i<n; i++)
#define per(i,a,n) for(int i = n-1; i>=a; i--)

const int INF = 1e9+7;

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin>>n;
  bool app = true;
  rep(i,0,n){
    int a;
    cin>>a;
    if(a %2 == 0 && (a %3 != 0 && a%5!=0))app = false;
  }
  if(app)cout<<"APPROVED\n";
  else cout<<"DENIED\n";

}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.stream.LongStream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();
            int[] H = in.nextIntArray(N);
            Arrays.sort(H);
            int index = N - 1;
            while (index >= 0 && K-- > 0) {
                H[index--] = 0;
            }
            long sum = Arrays.stream(H).asLongStream().sum();
            out.println(sum);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

    }
}



Measured memory_bytes: 54996
# coding: utf-8
# Your code here!
MOD = 10**9+7

from math import sqrt, floor

n,k = [int(i) for i in input().split()]
sn = floor(sqrt(n))+1

pre = [0]*sn
pre[1] = 1

cur = [1]*(sn)
cur[0] = 0

#big = n-sn+1

for _ in range(k-1):
#    print(cur)
    new = [sum(cur)%MOD]*(sn); new[0] = 0
    s = sum(pre)%MOD
    b=0
    res=0
    for j in range(sn-1,0,-1):
        a = n//j - (sn-1) #okな個数
        res += (a-b)*s
        res %=MOD
        new[j] += res
        if new[j] > MOD: new[j] -= MOD
        s -= pre[j]
        b=a
        
    pre,cur = cur,new


#print(pre,cur)
ans =0
for j in range(sn-1,0,-1):
    ans += pre[j]*(n//j - (sn-1))
    ans %=MOD


print((sum(cur)+ans)%MOD)





Measured memory_bytes: 127624
#include <stdio.h>

int main(void) {
	int p=0, q=0;

	scanf("%d", &p);
	scanf("%d", &q);

	int ans;
	if (q == 1) {
		ans = 0;
	}
	else {
		ans = p - q;
	}
	printf("%d", ans);
}

Measured memory_bytes: 128
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    for i in range(len(s)):
        if i % 2 == 0:
            if s[i] == "L":
                print("No")
                exit()
        else:
            if s[i] == "R":
                print("No")
                exit()
    print("Yes")


if __name__ == '__main__':
    slove()


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

int main()
{
    double N, M, sum=0, count=0;
    cin >> N >> M;
    vector<int> A(N);
    for (int i = 0; i < N;i++){
        cin >> A.at(i);
        sum += A.at(i);
    }
    for (int i = 0; i < N; i++)
    {
        if(A.at(i)<(sum/(4*M))){
            //count++;
        }
        else{
            count++;
        }
    }
    if(count>=M){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;
const ll LINF=1e18;

int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        if((int)(1.08*i)==n){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
xyz = [list(map(int,input().split())) for _ in range(N)]
ans = [[] for _ in range(8)]
for x,y,z in xyz:
    for i in range(8):
        ans[i].append(x*((-1)**i)+y*((-1)**(i//2))+z*((-1)**(i//4)))
out = []
for i in range(8):
    ans[i].sort(reverse=True)
    out.append(sum(ans[i][:M]))
print(max(out))

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

int main(){
int N;
cin>>N;
string city;
int rate;
using psi = tuple<string,int,int>;
vector<psi> vec;
for(int i = 0;i<N;i++){
cin>>city>>rate;
vec.push_back(make_tuple(city,100-rate,i+1));
}
sort(vec.begin(),vec.end());
for(int i=0;i<N;i++){
tuple t =vec.at(i);
int num = get<2>(t);
cout<<num<<endl;}
}




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

int main()
{
  int n;
  char s[128], t[128], r[256] = "";
  cin >> n >> s >> t;
  for (int i = 0; i < n; i++)
  {
    r[i * 2] = s[i];
    r[i * 2 + 1] = t[i];
  }
  cout << r << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int int64_t
signed main(){
  int n,k,a[100],sum,ans=-1,ma,q;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<(1<<(n));i++){
    sum=0;
    q=1;
    for(int j=0;j<n;j++){
      if(j==0) ma=a[0];
      if(i&(1<<j)&&j!=0){
	if(ma>=a[j]){
	  sum+=abs(a[j]-(ma+1));
	  ma+=1;
	  q++;
	}
	else{
	  q++;
	  ma=max(ma,a[j]);
	}
      }
      else{
	if(ma<a[j]){
	  q++;
	  ma=a[j];
	}
      }
    }
    //cout<<q<<"\n";
    if(ans==-1&&q>=k) ans=sum;
    if(q>=k) ans=min(ans,sum);
  }
  cout<<ans<<"\n";
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll k,q;
ll a[10010];
ll temp[10010];
int main(){
    scanf("%lld%lld",&k,&q);
    rep(i,0,k)scanf("%lld",a+i);
    while(q--){
        ll n,x,m;
        scanf("%lld%lld%lld",&n,&x,&m);
        ll pp=0;
        ll zero=0;
        rep(i,0,k){
            pp+=temp[i]=a[i]%m;
            zero+=!temp[i];
        }
        n--;
        ll sum=x+pp*(n/k);
        ll z=zero*(n/k);
        
        rep(i,0,n%k){
            sum+=temp[i];
            z+=!temp[i];
        }

        ll aaaaa=sum/m-x/m;
        
        printf("%lld\n",n-z-aaaaa);
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int check(char S[52][52],int h,int w){
	int i,j;

	for(i=1;i<=h;i++){
		for(j=1;j<=w;j++){
			if((S[i][j]=='#')&&((S[i][j-1]=='.')&&(S[i][j+1]=='.')&&(S[i-1][j]=='.')&&(S[i+1][j]=='.'))){
				return 0;
			}
		}
	}
	return 1;
}

int main(void){
		char S[52][52]={0};
		int h,w,i,j;

		scanf("%d %d",&h,&w);

		for(i=1;i<=h;i++){
			scanf("%s",S[i]);
		}

		printf(check(S,h,w)?"Yes\n":"No\n");

		return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int x=0,o=0;
    string mozi;
    while(1){
        cin>>mozi;
        if((int)mozi[0]==48){
            break;
        }
        x=0;
        o=0;
        
        x=mozi.size();
        for(int i=0;i<x;i++){
            o+=(int)mozi[i]-48;
        }
        cout<<o<<endl;
    }
    return 0;
}


Measured memory_bytes: 3148
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <string>
#include <map>
#include <unordered_map>
#include <fstream>
using namespace std;
#define MOD 1000000007 //10^9 + 7
#define MAX 200000001  //2 * 10^8 + 1

//#define ReadFromFile Y
#define FileName "read.txt"

int M, D;
unordered_map<int, int> mp; //d10,d1の積でd1,d10>=2のもの
int main()
{
    cin >> M >> D;
    int ans = 0;
    int d10 = 0;
    int d1 = 0;
    for (d10 = 2; d10 < D / 10; d10++)
    {
        for (d1 = 2; d1 <= 9; d1++)
        {
            if (d1 * d10 <= M)
                mp[d10 * d1]++;
        }
    }
    d10 = D / 10;
    for (d1 = 2; d1 <= D % 10; d1++)
    {
        if (d1 * d10 <= M)
            mp[d10 * d1]++;
    }
    for (auto &&i : mp)
    {
        ans += i.second;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int ans = (B-1) / (A-1);
        ans = (B-1) % (A-1) == 0 ? ans : ans+ 1;
        System.out.println(ans);
    }
}


Measured memory_bytes: 21972
import sys
from collections import Counter

n = int(input())
results = [input() for _ in range(n)]
cnt = Counter(results)
print(f'AC x {cnt["AC"]}')
print(f'WA x {cnt["WA"]}')
print(f'TLE x {cnt["TLE"]}')
print(f'RE x {cnt["RE"]}')


Measured memory_bytes: 16488
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <complex>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz size()
#define endl "\n"
#define print(X) cout << (X) << "\n"
#define input(X) getline(cin,X)
static const int INF = 1e+9+7;
static const ll INFL = 1e+18+7;
ll n,m,l;
int p;
string s,t;
ll d[200010],dp[300][300];
char field[200][200];

int main(){
  cin >> n;
  if(n < 1000)puts("ABC");
  else puts("ABD");
  return 0;
}

Measured memory_bytes: 256
<?php
$n=trim(fgets(STDIN));
if($n==1){
  echo "Yes";
}else{
  $h=explode(" ",trim(fgets(STDIN)));
  $l=$h[0];
  $i=1;
  while($i<$n){
    if($l<$h[$i]){
      $l=$h[$i]-1;
    }elseif($l>$h[$i]){
      echo "No";
      exit;
    }
    ++$i;
  }
  echo "Yes";
}


Measured memory_bytes: 14840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, m, x, sum;

inline ll read(){
    ll s = 0, w = 1; char ch = getchar();
    while(ch < '0' || ch > '9'){ if(ch == '-') w = -1; ch = getchar();}
    while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
    return s * w;
}

inline void print(ll x){
    if(x < 0) x = ~x + 1, putchar('-');
    if(x > 9) print(x / 10);
    putchar(x % 10 + '0');
}

int main(){
    n = read(); m = read();
    for(int i = 0; i < m; i++) x = read(), sum += x;
    if(sum <= n) print(n - sum);
    else print(-1);

    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
 int main(void)
 {
     int a,b,c,i=0;

     scanf("%d%d%d",&a,&b,&c);

     if(a==b) i++;
     if(a==c) i++;
     if(b==c) i++;

     if(i==3) printf("1\n");
     else printf("%d\n",3-i);

     return 0;
 }



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

int gcd(int p, int q) {
	if (p % q == 0)	return q;
	return gcd(q, p % q);
}


int main() {
	int K;
	int ans = 0;
	scanf("%d", &K);
	for (int i = 1; i <= K; i++)
		for (int j = 1; j <= K; j++)
			for (int h = 1; h <= K; h++)
				ans += gcd(gcd(i, j), h);
	cout << ans;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false

//素因数分解
std::vector<long long> prime_factorization(long long N){
  std::vector<long long> R;
  if(N<2)return R;
  for(long long i=2;i*i<=N;i++){
      while(N%i==0){
          R.push_back(i);
          N/=i;
      }
  }
  if(N!=1){
      R.push_back(N);
  }
  return R;
}

int main(void){
    long long N;
    cin >> N;
    vector<long long> P = prime_factorization(N);
    map<long long,long long> M;
    REP(i,P.size()){
        M[P[i]]++;
    }
    long long Ans=0;
    REP(i,P.size()){
        long long m = M[P[i]];
        long long B = m;
        if(m==0)continue;
        M[P[i]]=0;
        
        for(long long k=1;k<=B;k++){
            if(m>=k){
                Ans++;
                m-=k;
            }else{
                break;
            }
        }
        
    }
    cout << Ans << endl;
    return 0;
}




Measured memory_bytes: 3612
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class Main {

	int[] dice = new int[6];

	public Main(int[] nums, String order) {
		dice = nums;
	}

	public void move(String order) {

		for(Character s : order.toCharArray()) {
			int buf;
	        switch(s){
	            case 'N':{
	                buf = dice[0];
	                dice[0] = dice[1];
	                dice[1] = dice[5];
	                dice[5] = dice[4];
	                dice[4] = buf;
	                break;
	            }
	            case 'E':{
	                buf = dice[0];
	                dice[0] = dice[3];
	                dice[3] = dice[5];
	                dice[5] = dice[2];
	                dice[2] = buf;
	                break;
	            }
	            case 'W':{
	                buf = dice[0];
	                dice[0] = dice[2];
	                dice[2] = dice[5];
	                dice[5] = dice[3];
	                dice[3] = buf;
	                break;
	            }
	            case 'S':{
	                buf = dice[0];
	                dice[0] = dice[4];
	                dice[4] = dice[5];
	                dice[5] = dice[1];
	                dice[1] = buf;
	                break;
	            }
	        }
		}
	}

	public int[] checkRight(int upper, int front) {

		Random rnd = new Random();
		for(int i=0; i<10000; i++) {
			int r = rnd.nextInt(4);
			switch(r) {
				case 0:
					move("W");
					break;
				case 1:
					move("E");
					break;
				case 2:
					move("S");
					break;
				case 3:
					move("N");
					break;
				default:
					break;
			}
			if(dice[0] == upper && dice[1] == front) break;
		}

		return dice;

	}

	public int[] checkSurfaces() {
		return dice;
	}

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		Boolean sameFlag = false;

		int[] nums1 = new int[6];
		int[] nums2 = new int[6];
		for(int i=0; i<6; i++) {
			nums1[i] = sc.nextInt();
		}

		for(int i=0; i<6; i++) {
			nums2[i] = sc.nextInt();
		}

		Main dice1 = new Main(nums1, "");
		Main dice2 = new Main(nums2, "");

		// 共通の数値２つを取り出す
		int upper = -1;
		int front = -1;
		for(int i=0; i<6; i++) {
			for(int j=0; j<6; j++) {
				if(nums1[i] == nums2[j]) upper = nums1[i];
			}
		}
		for(int i=0; i<6; i++) {
			if(nums1[i] == upper) continue;
			for(int j=0; j<6; j++) {
				if(nums1[i] == nums2[j]) front  = nums1[i];
			}
		}

		sc.close();

		int[] surface1 = dice1.checkRight(upper, front);
		int[] surface2 = dice2.checkRight(upper, front);

		if(Arrays.equals(surface1, surface2)) sameFlag = true;
//		for(int i=0; i<6; i++) {
//			System.out.print(surface1[i] + " ");
//		}
//		System.out.println("");
//		for(int i=0; i<6; i++) {
//			System.out.print(surface2[i] + " ");
//		}
//		System.out.println("");

		if(sameFlag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 26436
n = int(input())
h = list(map(int, input().split()))
ans = True
m = h[0]
for i in range(1, len(h)):
    if h[i] + 1 < m:
        ans = False
    m = max(m, h[i])
if ans:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14252
import sys
readline = sys.stdin.readline
N, M, S = map(int, readline().split())

from heapq import heappop as hpp, heappush as hp
def dijkstra(N, s, Edge):
    # Edge は　(cost, vf) の形
    inf = 10**18
    dist = [inf] * N
    dist[s] = 0
    Q = [(0, s)]
    while Q:
        dn, vn = hpp(Q)
        if dn > dist[vn]:
            continue
        for df, vf in Edge[vn]:
            if dist[vn] + df < dist[vf]:
                dist[vf] = dist[vn] + df
                hp(Q, (dn + df,vf))
    return dist

geta = 2451
Edge = [[] for _ in range(N*geta)]
S = min(S, geta - 1)
for m in range(M):
    u, v, a, b = map(int, readline().split())
    u -= 1
    v -= 1
    for mon in range(a, geta):
        Edge[u*geta+mon].append((b, v*geta + (mon - a)))
        Edge[v*geta+mon].append((b, u*geta + (mon - a)))

for n in range(N):
    c, d = map(int, readline().split())
    for mon in range(geta):
        Edge[n*geta + mon].append((d, n*geta + min(geta-1, mon + c)))

dist = dijkstra(N*geta, S, Edge) 
INF = 10**18
ans = [INF]*N
for i in range(N*geta):
    ans[i//geta] = min(ans[i//geta], dist[i])
print('\n'.join(map(str, ans[1:])))

Measured memory_bytes: 113456
#include<bits/stdc++.h>
#define int long long
using namespace std;

const int mod = 1e9+7;

int32_t main(){

    string odd , even;
    cin >> odd >> even;

    int n = min(odd.size() , even.size());
    
    for(int x=0;x<n;x++){
        cout << odd[x];
        cout << even[x];
    }

    if(odd.size() > even.size()){
        cout << odd.back();
    }else if(even.size() > odd.size()){
        cout << even.back();
    }
    

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
	int h, w;
	char c[101][101];
	scanf("%d%d", &h, &w);
	for (int i = 0; i < h; i++) {
		scanf("%s", c[i]);
	}
	for (int i = 0; i < 2 * h; i++) {
		printf("%s\n", c[i / 2]);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
 
int d[200][200],s[200];
int main() {
	int n,m,r;scanf("%d%d%d",&n,&m,&r);
	memset(d,0x3f,sizeof(d));
	rep(i,n)d[i][i]=0;
	rep(i,r)scanf("%d",&s[i]),s[i]--;
	rep(i,m){
		int a,b,c;scanf("%d%d%d",&a,&b,&c);a--;b--;
		d[a][b]=d[b][a]=c;
	}
	rep(k,n)rep(i,n)rep(j,n)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	sort(s,s+r);
	int Min=INT_MAX;
	do{
		int cnt=0;
		rep(i,r-1)cnt+=d[s[i]][s[i+1]];
		Min=min(Min,cnt);
	}while(next_permutation(s,s+r));
	cout<<Min<<endl;
}


Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
void solve(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    if(s.size() % 2 == 0){
        for(int i = 0; i < s.size() / 2; i++){
            if(s[i] != s[s.size()/2 + i]){
                cout << "No";
                return;
            }
        }
        cout << "Yes";
        return;
    }
    cout << "No";
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    while(t--) solve();
}

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

int main(){
    long long int r,d,x,i;
    scanf("%lld %lld %lld",&r,&d,&x);
    for(i=0;i<10;i++)
    {
        x=r*x-d;
        printf("%lld\n",x);
    }
   }


Measured memory_bytes: 1668
import Control.Applicative
import Data.Function
import Control.Monad
import Data.List

f n x = length $ map head . group . sort $ map sort [[a,b,c] | a <- [1..n], b <- [1..n], c <- [1..n]
                 , a+b+c == x
                 , a/=b
                 , b/=c
                 , c/=a
                 ]

r n x = group $ map sort [[a,b,c] | a <- [1..n], b <- [1..n], c <- [1..n]
                 , a+b+c == x
                 , a/=b
                 , b/=c
                 , c/=a
                 ]

main :: IO ()
main = fix $ \loop -> do
    [n,x] <- map read . words <$> getLine
    unless ([n,x] == [0,0]) $ do
        putStrLn . show $ f n x
        loop


Measured memory_bytes: 7528
#include <iostream>
#include<string>
using namespace std;
int a(int b, int c) {
	int d = b*c;
	return d;
}
int  main() {
	
	
	int A, B, C,D;

	cin >> A >> B >> C>>D;

	if(a(A,B)>=a(C,D))
	{
		cout << a(A,B)<< endl;
	}else 
	{
		cout << a(C,D) << endl;
	}
	
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main()
{
    int N, sum = 0;
    cin >> N;
    int A[N], B[N];
    rep(i, N)
        cin >> A[i] >> B[i];
        
    rep(i, N)
        sum += (B[i] - A[i]) + 1;
    
    cout << sum << endl;
}

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

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9+7;
const int mod = 1e9+7;

int main(){
    int n,m,q,ans=0;
    cin>>n>>m>>q;

    vector<int>a(q),b(q),c(q),d(q),A(50);
    rep(i,q)cin>>a[i]>>b[i]>>c[i]>>d[i];

    for (int i1=1;i1<=m;i1++) {
        A[1]=i1;
        for (int i2=i1;i2<=m;i2++) {
            A[2]=i2;
            for (int i3=i2;i3<=m;i3++) {
                A[3]=i3;
                for (int i4=i3;i4<=m;i4++) {
                    A[4]=i4;
                    for (int i5=i4;i5<=m;i5++) {
                        A[5]=i5;
                        for (int i6=i5;i6<=m;i6++) {
                            A[6]=i6;
                            for (int i7=i6;i7<=m;i7++) {
                                A[7]=i7;
                                for (int i8=i7;i8<=m;i8++) {
                                    A[8]=i8;
                                    for (int i9=i8;i9<=m;i9++) {
                                        A[9]=i9;
                                        for (int i10=i9;i10<=m;i10++) {
                                            A[10]=i10;
                                            int sum=0;
                                            for(int i=0;i<q;i++){
                                                if(A[b[i]]-A[a[i]]==c[i]){
                                                    sum+=d[i];
                                                }
                                            }
                                            ans=max(sum,ans);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int gcd(int a,int b) {
  if(b==0) return a;
  else return gcd(b,a%b);
}

int main() {
  int K;
  cin>>K;
  int sum =0;
  
  for(int i=1;i<=K;i++) {
    for(int j=1;j<=K;j++) {
      for(int k=1;k<=K;k++) {
        sum += gcd(i,gcd(j,k));
      }
    }
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

typedef long long ll;
typedef vector<int> vi;

int main(){
	int n;
    cin >> n;
    string s[51];
    rep(i, n){
        cin >> s[i];
    }
    string ans;
    for(char c = 'a'; c <= 'z'; c++){
        int sml = 51;
        for(int i = 0; i < n; i++){
            int cnt = 0;
            for(int j = 0; j < s[i].length(); j++){
                if(s[i][j] == c)
                    cnt++;
            }
            sml = min(sml, cnt);
        }
        for(int j = 0; j < sml; j++)
            ans += c;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256