akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

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

  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  int oddCnt = 0;
  rep(i, n) {
    if(a[i]%2 != 0) oddCnt++;
  }
  bool flag = false;
  if(oddCnt%2 == 0) flag = true;

  cout << (flag ? "YES" : "NO") << '\n';
  return 0;
}


Measured memory_bytes: 1024
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("a.in","r",stdin);
#endif
    int n,m;
    cin>>n>>m;
    vector <pii> a;
    int left = 0, right = 1;
    int now=0;
    a.pb(mp(left,right));
    if (n%2==1) {
        for (int i = 0; i < (n - 1) / 2 - 1; i++)
            a.pb({(left - 1 + n) % n, (right + 1 + n) % n}), now += 2, left--, right++;
    }
    else
    {
        while (now+3<=(n-1)/2)
            a.pb({(left - 1 + n) % n, (right + 1 + n) % n}), now += 2, left--, right++;
        left--;
        now=1;
        while (now+2<=(n-1)/2+1)
            a.pb({(left - 1 + n) % n, (right + 1 + n) % n}), now += 2, left--, right++;
    }
    for (int i=0;i<m;i++) {
        if (a[i].fi!=0&&a[i].se!=0)
            cout << a[i].fi << " " << a[i].se << '\n';
        else
        {
            if (a[i].fi==0)
                cout<<n<<" "<<a[i].se<<'\n';
            else
                cout<<a[i].fi<<" "<<n<<'\n';
        }
    }
//    set <int> s;
//    for (int i=0;i<a.size();i++)
//        s.insert(abs((a[i].fi-a[i].se)%n));
//    cout<<s.size()<<'\n';





}


Measured memory_bytes: 4240
#include <stdio.h>

int A[500001],n;

void maxHeapify(int i){
  int l = i*2;
  int r = i*2+1;
  int lar,tmp;
  
  if(l<=n && A[l]>A[i])lar=l;
  else lar=i;
  if(r<=n && A[r]>A[lar])lar=r;
  // printf("aaaaaaaaaaaaaa\n");
  if(i!=lar){
    tmp = A[i];
    A[i] = A[lar];
    A[lar] = tmp;
  maxHeapify(lar);
  }
}


int main(){

  int i;
  scanf("%d",&n);
for(i=1;i<=n;i++)scanf("%d",&A[i]);
  
  for(i=n/2;i>=1;i--)maxHeapify(i);
  
  for(i=1;i<=n;i++)printf(" %d",A[i]);
  printf("\n");
  
  return 0;
}



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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  string o, e;
  cin >> o >> e;

  string res = "";
  for (int i = 0; i < o.size(); i++) {
    res.push_back(o.at(i));
    if (i < e.size()) {
      res.push_back(e.at(i));
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		int k = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = in.nextInt();
		System.out.println(solve(n, k, a));
	}

	private static int solve(int n, int k, int[] a) {
		int t = 0;
		for (int i = 0; i < n; i++)
			t += a[i];
		for (int i = 1;; i++) {
			int r = t / i;
			if (r < 2)
				break;
			if (t % i != 0)
				continue;
			if (isPossible(n, k, a, r))
				return r;
		}
		return 1;
	}

	private static boolean isPossible(int n, int k, int[] a, int r) {
		int[] m = new int[n];
		for (int i = 0; i < n; i++)
			m[i] = a[i] % r;
		Arrays.sort(m);
		int d = 0;
		int u = n - 1;
		int down = m[d];
		int up = r - m[u];
		while (d < u) {
			if (down > k || up > k)
				return false;
			if (down > up) {
				u--;
				up += r - m[u];
			} else {
				d++;
				down += m[d];
			}
		}
		return true;
	}
}


Measured memory_bytes: 25952
#include<iostream>
#include<map>
#include<algorithm>

int main(void){
    int n;
    long long m;
    std::cin >> n >> m;

    long long cost = 0;

    std::map<int, long long> list;

    for(int i = 0; i < n; i++){
        int a, b;
        std::cin >> a >> b;

        if(list.count(a)){
            list.at(a) += b;
        }
        else{
            list[a] = b;
        }
    }

    for(auto shop : list){
        long long amount = std::min(m, shop.second);
        long long buy = amount * shop.first;
        cost += buy;
        m -= amount;
    }

    std::cout << cost << std::endl;
    return 0;

}

Measured memory_bytes: 6528
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void print_YES_NO(bool answer){cout<<(answer?"YES":"NO")<<endl;}
void print_Yes_No(bool answer){cout<<(answer?"Yes":"No")<<endl;}
void print_POSSIBLE_IMPOSSIBLE(bool answer){cout<<(answer?"POSSIBLE":"IMPOSSIBLE")<<endl;}

int main(){
	int a,b,c;
	int i,j,k;
	int s=0;
	int n,m;
	cin>>a>>b>>c>>n;
	for(i=0;a*i<=n;i++){
		for(j=0;a*i+b*j<=n;j++){
			k=n-a*i-b*j;
			if(k%c==0)s++;
		}
	}
	cout<<s<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    string s[100];
    rep(i, 100) {
        rep(j, 100) {
            if (i < 50) s[i].push_back('.');
            else s[i].push_back('#');
        }
    }
    
    int cnt = 0;
    for (int i = 0; i < 50; i += 2) {
        if (cnt == b - 1) break;
        for (int j = 0; j < 100; j+= 2) {
            if (cnt == b - 1) break;
            s[i][j] = '#';
            cnt++;
        }
    }
    
    cnt = 0;
    for (int i = 51; i < 100; i += 2) {
        if (cnt == a-1) break;
        for(int j = 0; j < 100; j+= 2) {
            if (cnt == a-1) break;
            s[i][j] = '.';
            cnt++;
        }
    }
    
    cout << 100 << " " << 100 << endl;
    for (int i = 0; i < 100; i++) {
        cout << s[i] << endl;
        
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define LENGTH 1001

int main(void)
{
  char st[LENGTH];
  int i, j, count;

  while(scanf("%s",st)!=EOF)
    {
      i = 0;
      //printf("%s",st);
      while(1)
	{
	  if(st[i]==0)
	    break;
	  else if(st[i]=='@')
	    {
	      count = st[i+1] - '0';
	      for(j=0;j<count;j++)
		{
		  printf("%c",st[i+2]);
		}
	      i = i + 3;
	    }
	  else
	    {
	      printf("%c",st[i]);
	      i++;
	    }	  
	}
      printf("\n");
    }
  return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    int ans=0;
    for(int i=0;i<n;i++){
        int h;
        cin>>h;
        if(h>=k) ans++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n=0, i;
    char c[5];
    scanf("%s", &c);

    for(i=0; i<4; i++)
    {
        if(c[i]=='+')
            n++;
        else
            n--;
    }
    printf("%d\n", n);
    return 0;
}

Measured memory_bytes: 128
array = []

input = gets.chomp

array = input.split("/")

year = array[0].to_i
month = array[1].to_i
day = array[2].to_i

if year < 2019
  puts "Heisei"
elsif year == 2019 && month < 4
    puts "Heisei"
  elsif year == 2019 && month == 4 && day <=30
      puts "Heisei"
  else
    puts "TBD"
  end


Measured memory_bytes: 1788
/*スタック*/

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

class Stack{
    int idx = 0;
    int a[100] = {0};
public:
    char c[100000];
    void push(int n){       
        a[idx++] = n;
    }

    int pop(){
        return a[--idx];
    }
};

int main()
{
    Stack s;
    while(scanf("%s", s.c) != EOF){
        if(s.c[0] == '+'){
            int tmp = s.pop() + s.pop();
            s.push(tmp);
        }
        else if(s.c[0] == '-'){
            int tmp1 = s.pop();
            int tmp2 = s.pop();
            s.push(tmp2-tmp1);
        }
        else if(s.c[0] == '*'){
            int tmp = s.pop() * s.pop();
            s.push(tmp);
        }
        else{
            s.push(atoi(s.c));
        }
    }
    
    cout << s.pop() << endl;
    
    return 0;
}


Measured memory_bytes: 3168
N,M,C = map(int, input().split())
A = list()
B = list(map(int, input().split()))
cnt = 0

for n in range(N):
    A.append(list())
    A[n] = list(map(int, input().split()))

for n in range(N):
    ans = 0
    for i in range(len(A[n])):
        ans += A[n][i] * B[i]
    ans += C
    if ans > 0:
        cnt += 1

print(cnt)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	ll n; cin >> n;
	vl p(n),q(n);
	rep(i,n) cin >> p[i];
	rep(i,n) cin >> q[i];
	vl nxt(n); rep(i,n) nxt[i] = i+1;
	map<vl,ll> mp;
	ll index = 0;
	do{
		mp[nxt] = index;
		index++;
	}while(next_permutation(all(nxt)));
	cout << abs(mp[q] - mp[p]) << endl;
}

Measured memory_bytes: 6528
#include "bits/stdc++.h"

using namespace std;

int main() {
    int p[20];
    int n; cin >> n;
    for (int i = 0; i < n; ++i) cin >> p[i];
    int answer = 0;
    for (int i = 1; i < n - 1; ++i) {
        if ((p[i - 1] < p[i] && p[i] < p[i + 1]) ||
            (p[i - 1] > p[i] && p[i] > p[i + 1])) {
                ++answer;
            }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
//atcoder
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<int> v[100003];
bool used[100003];
void dfs(int root){
//	if(used[root]==true) return;  
	used[root]=true;
	for(auto x: v[root]){
		if(used[x]==false) dfs(x);
	}
	return;
}
int main(){
	int n,m,u,w;
	
	cin>>n>>m;
	while(m>0){
		cin>>u>>w;
		v[u].push_back(w);
		v[w].push_back(u);
	m--;	
	}
	
	int road=0;
	memset(used,false,sizeof(used));
	for(int i=1; i<=n; i++){
		if(!used[i]){
			dfs(i);
			road++;
		   	
		}
	}

	cout<<road-1;
	
	
	
	
	return 0;
}

Measured memory_bytes: 9724
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <fstream>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = (1 << 30);
const ll inf = (1LL << 60LL);
const int  maxn = 1e5 + 5;
int n, m, c;
int b[maxn], a[maxn];
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    cin >> n >> m >> c;
    for(int i = 0; i < m; i ++){
        cin >> b[i];
    }
    int ret =0 ;
    for(int i = 0; i < n; i ++){
        int rr = 0;
        for(int j = 0; j < m; j ++){
            cin >> a[j];
            rr += b[j] * a[j];
        }
        rr += c;
//        cout << rr << endl;
        if(rr > 0) ret ++;
    }
    printf("%d\n", ret);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>
#include <set>
#include <tuple>
#include<map>
#include<queue>

using namespace std;

int main() {
	char A, B;
	cin >> A >> B;

	if (A == B) {
		cout << "=" << endl;
	}
	else if (A < B) {
		cout << "<" << endl;
	}
	else {
		cout << ">" << endl;
	}
}

Measured memory_bytes: 3664
s = t = input()
a = 'dream'
b = 'dreamer'
c = 'erase'
d = 'eraser'

while t:
    if t[-7:] == b:
        t = t[:-7]
    elif t[-6:] == d:
        t = t[:-6]
    elif t[-5:] in (a, c):
        t = t[:-5]
    else:
        break

if t:
    print('NO')
else:
    print('YES')


Measured memory_bytes: 3444
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int a, int b) {

    int height(int n) { return n * (n + 1) / 2; }

    for (int i = 1; i < 999; i++) {
        int x = height(i);
        int y = height(i + 1);

        int dx = x - a;
        int dy = y - b;
        if (dx == dy && dx > 0)
            return dx;


        /*

        if (a >= x || b >= y) continue;
        if (x < a || y < b) continue;
        int s = x + y - (a + b);
        if (s > 1 && s % 2 == 0) {
            return s / 2;
        }
        */
    }
    assert(false);
}

void main() {
    auto ab = readints;
    int a = ab[0], b = ab[1];

    auto ans = calc(a, b);
    writeln(ans);
}


Measured memory_bytes: 256
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


# A
def A():
    s=input()
    if s=='SUN':
        print(7)
    if s=="MON":
        print(6)
    if s=="TUE":
        print(5)
    if s=="WED":
        print(4)
    if s=="THU":
        print(3)
    if s=="FRI":
        print(2)
    if s=="SAT":
        print(1)
    return


# B
def B():
    return


# C
def C():
    return


# D
def D():
    return


# E
def E():
    return


# F
def F():
    return


# Unittest
def resolve():
    A()
    return


# Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 38384
#include<stdio.h>

int main(void){
	int a,b,d,r;
	double A,B,f;
	
	scanf("%d %d",&a,&b);
	
	d=a/b;
	r=a%b;
	
	A=a;
	B=b;
	f=A/B;
	
	printf("%d %d %.5lf\n",d,r,f);
	
return 0;
}	


Measured memory_bytes: 2720
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i, a, b) for (int i = (a); i <= (b); ++i)
#define FD(i, b, a) for (int i = (b); i >= (a); --i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;
 
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < 10; ++i) {
    for (int j = 1; j < 10; ++j) {
      if (i * j == n) return !printf("Yes\n");
    }
  }
  printf("No\n");
}


Measured memory_bytes: 256
eval'H,W='+gets.split*?,
s=$<.read.tr".#
","10"
c=s.count ?1
W+=t=1
c,t=c-1,(t<<1|t>>1|t<<W|t>>W|r=t)&s.to_i(2)while t!=r&&t<1<<H*W-1
p r<t ?c:-1

Measured memory_bytes: 2044
#include <iostream>
#include <map>
#include <string>
using namespace std;

int main(void) {
    int N;cin>>N;
    map<int, int> mp;
    for (int i = 1; i <= N; i++) {
        int A;cin>>A;
        mp[A] = i;
    }
    string result = "";
    for (map<int, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
        result += " " + to_string(it->second);
    }
    cout << result.substr(1, result.size() - 1) << endl;
    return 0;
}

Measured memory_bytes: 6776
s=list(input())
mod=10**9+7
for i in range(len(s)):
    if s[i]=='?':
        s[i]=-1
    else:
        s[i]=int(s[i])

dp=[[0]*13 for i in range(len(s)+1)]
s.reverse()
dp[0][0]=1
y=[]
x=1
for i in range(len(s)):
    if s[i]!=-1:
        z=s[i]*x

        for j in range(13):
            dp[i+1][(j+z)%13]+=dp[i][j]%mod
    else:
        for j in range(10):
            y.append(x*j)

        for k in range(13):
            for l in range(len(y)):
                dp[i+1][(k+y[l])%13]+=dp[i][k]%mod
        y=[]
    x=(x*10)%13
        
print(dp[len(s)][5]%mod)
            
        
        


     

    


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

int main(){
	while(1){
		int N;
		cin>>N;
	
		if(N==0)
			break;

		int cnt0=0;
		int cnt1=0;

		for(int i=0;i<N;i++){
			int k;
			cin>>k;

			if(k==0)
				cnt0++;
			else if(k==1)
				cnt1++;
		}
	
		if(cnt0+cnt1==N){
			cout<<"NA"<<endl;
		}
		else{
			cout<<N-cnt0+1<<endl;
		}
	}

		return 0;
}

Measured memory_bytes: 3092
#include<cstdio>
#include<algorithm>
using namespace std;
int w[101000], n, Mn = 2e9, r;
int main() {
	int i;
	scanf("%d", &n);
	for (i = 1; i <= n; i++)scanf("%d", &w[i]);
	sort(w + 1, w + n + 1);
	for (i = 1; i < n; i++) {
		if (abs(w[n] - w[i] * 2) < Mn)Mn = abs(w[n] - w[i] * 2), r = w[i];
	}
	printf("%d %d\n", w[n], r);
}

Measured memory_bytes: 512
a, b = map(int, input().split())

if a < 0 and 0 < b:
    ans ='Zero'
elif b < 0:
    cnt = abs((b-a))+1
    if cnt%2 == 0:
        ans = 'Positive'
    else:
        ans = 'Negative'
elif 0 < a:
    ans = 'Positive'

print(ans)

Measured memory_bytes: 9092
#include<bits/stdc++.h>
#include<numeric>
#define int long long
#define ld long double
#define all(x) x.begin(),x.end()
const int maxn=1000000;
#define what_is(x) cerr << #x << " is " << x << endl;
const int MOD = 1e9 + 7;
using namespace std;
string abc="abcdefghijklmnopqrstuvwxyz";
int powmod(int a, int b, int MOD = MOD){
    if(!a and !b)    return 1ll;
    if(!a)    return a;
    int res = 1ll;
    b %= (MOD - 1ll), a %= MOD;
    while(b){
        if(b%2 == 1)    res = (res * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }
    return res;
}
int popcount(uint32_t n)
{
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
bool check(int n) {return (((double)sqrt(n)-floor((double)sqrt(n)))==0);}
vector<bool> sieve(maxn + 1, true);
void fillprime() {
    sieve[0] = sieve[1] = false;
    for (int i = 2; i <= maxn; ++i) {
        if (sieve[i] && (int) i * i <= maxn) {
            for (int j = i * i; j <= maxn; j += i) {
                sieve[j] = false;
            }
        }
    }
}
const int nn=1e5+5;
bool isPowerOfTwo(int n)
{
    if(n==0)
        return false;

    return (ceil(log2(n)) == floor(log2(n)));
}
void solve() {
    int n;
    cin>>n;
    string s;
    int x=(int)floor(log(25*(n+1))/log(26));
    for(int i=x-1;i>=0;--i)
    {
        n--;
        s+=(char)('a'+n%26);
        n/=26;
    }
    reverse(all(s));
    cout<<s;

}
int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    //int t;cin>>t;while(t--)
    solve();
}


Measured memory_bytes: 3928
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;



int main(){


ll X,Y;
cin>>X>>Y;
int count=0;
while(X<=Y){
    count++;
    X*=2;

}
cout<<count<<endl;

return 0;
}

Measured memory_bytes: 3540
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <functional>

int main()
{
    long N;
    std::cin >> N;
    double temp;
    long result=0;
    for(long i=1;i<N;i++){
        result+=i;
    }
    std::cout << result << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main()
{
    int h,w;
    cin>>h>>w;
    while(h!=0)
    {
        int i,j;
        for(i=0; i<h; i++)
        {
            for(j=0; j<w; j++)
                if(i%2==0&&j%2==0||i%2==1&&j%2==1)
                    cout<<"#";
                else
                    cout<<".";
            cout<<endl;

        }
        cin>>h>>w;
        cout<<endl;

    }
    return 0;
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    int x, y; cin >> x >> y;

    rep(turu, 0, 100) {
        rep(kame, 0, 100) {
            if (turu + kame == x && turu * 2 + kame * 4 == y) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


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

int main() {
    string r, g, b; cin >> r >> g >> b;
    string s = g + b;
    int val = stoi(s);
    if (val%4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <algorithm>
#include <math.h>
#include <string>
#define pi 3.1415926535897932384626
#include <cmath>
#define test(t) while(t--)

#define ll  long long int

#define in  cin>>
#define out cout<<
#define en "\n"
#define sp " "
#define pb push_back
#define fast()  ios_base::sync_with_stdio(false);cin.tie(0);
#define double long double

using namespace std;
ll form(ll n){
return (n*(n+1))/2;
}
ll exponent(ll base, ll power){
   ll res = 1;
  ll m = 1000000007;
   while(power){
    if(power&1)
        res = (res*base)%m;
    base= (base*base)%m;
    power=power>>1;
   }
return res;}
bool count_one(ll n){
    ll cnt = 0;
    while(n>0){
            cnt+=1;
       n= n&(n-1);

    }
    if(cnt>1)
        return true;
    return false;
}
void solve()
{
  char c;
   in c;
    if(isupper(c))
        out "A"<<en;
    else
        out "a"<<en;
}




int main(){ fast()
             //freopen("input.txt","r",stdin);
             //freopen("output.txt","w",stdout);
             ll t=1;
            //cin>>t;
            test(t){
            solve();
            }
return 0;}


Measured memory_bytes: 3608
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
    vector<int> cnt(10,0);
    for(int i=0; i<4; i++){
        int n;
        cin >> n;
        cnt[n]++;
    }
    if(cnt[1]==1 && cnt[4]==1 && cnt[7]==1 && cnt[9]==1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
//ProblemB

//#define USE_STDIO
//#define USE_LOG
//#define FILE_ERR

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#ifndef debug
#define debug(...)
#endif // !LOG

//include
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iomanip>

using namespace std;

//for
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define forbe(i, begin, end) for(decltype(begin) i = (begin); i != (end); ++i)
#define forbes(i, begin, end, step) for(decltype(begin) i = (begin); i != (end); i += (step))

//int
using ll = long long;
using ull = unsigned long long;
using uint = unsigned;

//pair
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
#define fi first
#define se second

//vector
template <typename Value>
static inline void fillv(Value& x, const Value& val) { x = val; }
template <typename Vector, typename Value>
static inline void fillv(Vector& v, const Value& val) { for (auto& x : v) fillv(x, val); }

static inline void Solve();

int main(int argc, char* argv[]) {
#ifdef REDIRECT_STDIO
	REDIRECT_STDIO;
#endif // REDIRECT_STDIO

	Solve();
	return 0;
}

constexpr int MAXN = 200000;
int p[MAXN];
int q[MAXN];
int m[MAXN];
int n;

//ProblemB
void Solve() {
	cin >> n;
	forn(i, n) {
		cin >> p[i];
		p[i] --;
		q[p[i]] = i;
	}

	int maxcnt = 1;
	m[0] = 1;
	forbe(i, 1, n) {
		m[i] = 1;
		if (q[i] > q[i - 1]) {
			m[i] = m[i - 1] + 1;

			maxcnt = max(maxcnt, m[i]);
		}
	}
	cout << n - maxcnt << endl;
}


Measured memory_bytes: 2560
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define     FAST        ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     int 	    long long
#define 	pb 	        push_back
#define     pop         pop_back
#define 	mp 	        make_pair
#define 	pi 	        2*acos(0.0)
#define     scan(i)     scanf("%lld",&i)
#define     scann(i,j)  scanf("%lld%lld",&i,&j)
#define     print(i)    printf("%lld\n",i)
#define     printt(i,j) printf("%lld %lld\n",i,j)
#define     loop(i,n) 	for(int i = 0 ; i <n ; i++)
#define     loopp(i,n) 	for(int i = 1 ; i <n ; i++)
#define     rep(i,n)    for(int i=n-1;i>=0;i--)
#define 	vect 	    vector<int>
#define 	vec_it 	    vector<int>::reverse_iterator vi
#define     sorta(v)    sort(v.begin(),v.end())
#define     sortd(v)    sort(v.begin(),v.end(),greater<>())
#define     sorted      is_sorted(v.begin(),v.end())
#define 	mapp 	    map<int,int>
#define 	pairr 	    pair<int,int>
#define 	sett	    set<int>
#define 	set_it 	    set<int>::reverse_iterator si
#define     map_it      map<int,int> :: reverse_iterator mi
#define     digit(n)    floor(log10(n)+1)
#define 	yes 	    cout<<"YES"<<endl
#define 	no 	        cout<<"NO"<<endl
#define 	ff 	        first
#define 	ss 	        second
#define     mx          INT_MAX
#define     lmx         LLONG_MAX
#define     mn          INT_MIN
#define     lmn         LLONG_MIN
#define     GCD         __gcd(a,b)
#define     LCM         (a/GCD)*b
template <typename T> T gcd(T a,T b){return (b==0)?a:gcd(b,a%b);}
template <typename T> T lcm(T a,T b) {return a*(b/gcd(a,b));}
int modulo (int a, int b) { return a >= 0 ? a % b : ( b - abs ( a%b ) ) % b; }

void solve()
{
   // freopen ("(input).txt" , "r",  stdin) ;
    string st,stt ;
    int low=0,high=0;
    int l,r; char ch;
    int n,k,t,b,c,x,y,z,d=0,temp=0,cnt=0,sum=0,f=0;
    cin>>n ; vect v(n) ,a  ; sett s; mapp m,mm ; pairr p;
    loop(i,n) cin>>v[i];
    for(int i=0;i<n-2;i++)
    {
        for(int j=i+1;j<n-1;j++)
        {
            for(int q=j+1;q<n;q++)
            {
                temp=max({v[i],v[j],v[q] });
                if(v[i]!=v[j]&&v[j]!=v[q]&&v[q]!=v[i]&&v[i]+v[j]+v[q]-temp>temp)
                {
                    cnt++;

                }
            }
        }
    }
    cout<<cnt<<endl;

}

main()
{
    int t;
  //  cin>>t;
  //  while(t--)
        solve();
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0 ; i<(n) ; ++i)
typedef long long ll;
using namespace std;
const ll MAX = 2500LL;
typedef pair <ll, ll> P;

int main(){
  int K;
  int A,B;

  cin >> K;
  cin >> A >> B;
  int flag = 0;
  for(int i=A; i<=B; i++){
    if(i%K!=0){
      continue;
    }else{
      cout<< "OK" << endl;
      flag = 1;
      break;
    }
  }

  if(flag == 0){
    cout << "NG" << endl;
  }

  return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    string T;
    cin >> T;

    rep(i, T.length()) {
        if (T[i] == '?') {
            cout << 'D';
        } else {
            cout << T[i];
        }
    }
    cout << endl;

    return 0;
}


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

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

const int mod = 998244353;
const int MAX = 1e7+1;
long long fc[MAX];
long long fci[MAX];
long long p2[MAX];

long long modpow(long long a, long long b) {
    if (a == 2 && b < MAX && p2[b]) return p2[b];
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        long long t = modpow(a, b/2);
        return (t * t) % mod;
    }
    return (a * modpow(a, b-1)) % mod;
}

void init() {
    p2[0] = 1;
    for (int i=1; i<MAX; ++i) {
        p2[i] = (p2[i-1] * 2) % mod;
    }
    fc[0] = fc[1] = 1;
    for (int i=2; i<MAX; ++i) {
        fc[i] = (fc[i-1] * i) % mod;
    }
    fci[1] = 1;
    for (int i=2; i<MAX; ++i) {
        fci[i] = (fci[i-1] * modpow(i, mod-2)) % mod;
    }
}

long long comb(long long n, long long k) {
    if (k == 0 || n == k) return 1;
    return (fc[n] * fci[k] % mod) * fci[n-k] % mod;
}

int main() {
    init();

    long long N;
    cin >> N;

    long long res = modpow(3, N);
    
    for (int i=N/2+1; i<=N; ++i) {
        long long t = (comb(N, i) * modpow(2, N-i)) % mod;
        t = (t * 2) % mod;
        res = (res - t + mod) % mod;
    }
    cout << res << endl;

    return 0;
}

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

main(){
	int t ;
	while( cin >> t , t ){
		int n,s,f,sum=0 ;
		cin >> n ;
		for( int i=0 ; i<n ; i++ ){
			cin >> s >> f ;
			sum += f - s ;
		}
		if( sum >= t ) cout << "OK" << endl ;
		else cout << t - sum << endl ;
	}	
}

Measured memory_bytes: 1160
import copy

def bit_all(n,k,nn):
    ans = float("inf")
    for i in range(2 ** n):
        m = 0
        cnt = 0
        num = copy.deepcopy(nn)
        kind = 0
        for j in range(n):
            # 順に右にシフトさせ最下位bitのチェックを行う
            if ((i >> j) & 1):
                # フラグが立っていた時の処理
                if m >= num[j]:
                    cnt += 1 + m - num[j]
                    num[j] = m+1
                m = max(m,num[j])
                kind += 1
            else:
                #フラグがたっていなかった時の処理
                if num[j] > m:
                    m = num[j]
                    kind += 1
        if kind >= k:
            ans = min(ans,cnt)
            #print(ans,num)
    return ans
n,k = map(int,input().split())
num = list(map(int,input().split()))
print(bit_all(n,k,num))

Measured memory_bytes: 3572
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    n = int(input().strip())
    a = list(map(int, input().strip().split()))
    C = Counter()
    ans = 0
    for i in range(n):
        C[a[i]] += 1
        C[a[i]+1] += 1
        C[a[i]-1] += 1
        ans = max([C[a[i]], C[a[i]+1], C[a[i]-1], ans ])
    print(ans)

if __name__ == '__main__':
    main()


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

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define ABS(x, y) ((x) > (y) ? ((x) - (y)) : ((y) - (x)))

#define DIVUP(x, y) (((x) + ((y) - 1)) / (y))
#define DIVOFF(x, y) (((x) + ((y) / 2)) / (y))
#define REMAINDER(x, y) ((x) % (y))

int main() {
  set<int> N{1, 9, 7, 4};
  int n;
  for (int i{}; i < 4; ++i) {
    scanf("%d", &n);
    N.erase(n);
  }

  printf(N.size() ? "NO\n" : "YES\n");

  return 0;
}


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

typedef long long ll;
#define mod 1000000007

int main()
{
    ll n;
    cin >> n;
    vector<ll> dp(n+1);

    dp[0] = 1;

    for(ll i = 3; i <= n; i++){
        ll cur = 0;
        for(ll j = 3; j <= i; j++){
            cur = (cur + dp[i-j]) % mod;
        }
        dp[i] = cur;
    }

    cout << dp[n] << "\n";
    
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
void chmin(int &a, int b) {if(a > b) a = b;}

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};

bool palindrome(string s){
    bool flag = true;
    rep(i,0,s.length()/2){
        if(s[i] != s[s.length() - i]) flag = false;
    }
    return flag;
}


int main(){
    string s;
    cin >> s;
    int nx = 0;
    int i = 0;
    int j = s.length()-1;
    while(i != j){
        if(s[i] == s[j]){
            if(i == j-1)break;
            i++;j--;
        }else if(s[i] == 'x'){
            i++;nx++;
        }else if(s[j] == 'x'){
            j--;nx++;
        }else{
            cout << -1;
            return 0;
        }
    }
    cout << nx;
    
}

Measured memory_bytes: 512
import java.util.Scanner;
import java.util.stream.IntStream;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        System.out.println(solve(a, b, c));

        sc.close();
    }

    static int solve(int a, int b, int c) {
        return (int) IntStream.of(a, b, c).distinct().count();
    }
}

Measured memory_bytes: 26068
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n;
    cin >> n;
    vector<pair<int, int>> a, b;
    vector<bool> seen(n, false);
    repi(i, n, 0)
    {
        int aa, bb;
        cin >> aa >> bb;
        a.push_back({aa, bb});
    }
    repi(i, n, 0)
    {
        int cc, dd;
        cin >> cc >> dd;
        b.push_back({cc, dd});
    }
    // cout << endl;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    int ans = 0;
    for (auto bb : b)
    {
        int index = 0, mx = INF, my = INF, p = INF;
        // cout << bb.first << " " << bb.second << " " << p << endl;
        for (auto aa : a)
        {
            if (seen[index])
            {
                index++;
                continue;
            }
            if (aa.first >= bb.first || aa.second >= bb.second){
                index++;
                continue;
            }
            if (mx >= abs(aa.first - bb.first) && my >= abs(aa.second - bb.second))
            {
                mx = abs(aa.first - bb.first);
                my = abs(aa.second - bb.second);
                p = index;
            }
            index++;
        }
        if (p != INF)
        {
            // cout << bb.first << " " << bb.second << " " << a[p].first << " " << a[p].second << endl;
            seen[p] = true;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int N, K;
    cin >> N >> K;
    int l[N];
    for(int i = 0; i < N; ++i) cin >> l[i];
    sort(l, l + N, greater<int>());
    int res = 0;
    for(int i = 0; i < K; ++i) res += l[i];
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main (void) {
  int a[10000]={0}, b[10000]={0};
  int c,i=0,asum=0,bsum=0;
 
  while(1){
    scanf("%d",&c);
    if(c==0) break;
    for(i=0;i<c;i++) {
      scanf("%d%d",&a[i] ,&b[i]);
      if(a[i]>b[i])  asum=asum+a[i]+b[i];
      else if(a[i]<b[i])  bsum=bsum+a[i]+b[i];
      else {
	asum=asum+a[i];
	bsum=bsum+b[i];
      }
    }
    printf("%d %d\n",asum ,bsum);
    asum=0;
    bsum=0;
  }
  return 0;
}

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

#define endl '\n'
typedef long long ll;
typedef unsigned long long llu;

int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    llu n;
    cin >> n;
    cout << n+pow(n,2)+pow(n,3) << endl;

    return 0;
}



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

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

    vector<int> C(N - 1);
    vector<int> S(N - 1);
    vector<int> F(N - 1);
    for (int i = 0; i < N - 1; i++) {
        cin >> C[i] >> S[i] >> F[i];
    }

    for (int i = 0; i < N - 1; i++) {
        int time = 0;
        for (int j = i; j < N - 1; j++) {
            if (time < S[j]) {
                time = S[j];
            } else if ((time - S[j]) % F[j] != 0) {
                time += F[j] - (time - S[j]) % F[j];
            }
            time += C[j];
        }
        cout << time << endl;
    }
    cout << 0 << endl;

    return 0;
}


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

int main() {
  string A ;
  cin >> A ;

  if((A >= "a") && (A <="z")){
    cout << "a" << endl ;
  }
  else if((A >= "A") && (A <= "Z")){
    cout << "A" << endl ;
  }
}

Measured memory_bytes: 3624
// https://atcoder.jp/contests/abc072/tasks/arc082_a

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

ll N, ai;
vector<ll> a;

int main()
{
  REP(i, 100003)
  {
    a.push_back(0);
  }

  cin >> N;
  REP(i, N)
  {
    cin >> ai;
    a[ai]++;
    a[ai + 1]++;
    a[ai + 2]++;
  }

  sort(ALL(a));

  cout << a.back() << '\n';

  return 0;
}


Measured memory_bytes: 1400
#include<cstdio>
#include<utility>
#include<algorithm>
using namespace std;
typedef pair<int, int> P;
const int MAX_N = 100000;
const int MAX_V = 1000000000;
int N;
int X[MAX_N];
int L[MAX_N];
void input(){
scanf("%d", &N);
for(int i = 0; i < N; ++i){
scanf("%d%d", X + i, L + i);
}
}
P ps[MAX_N];
int solve(){
for(int i = 0; i < N; ++i){
ps[i] = P(X[i] + L[i], X[i] - L[i]);
}
sort(ps, ps + N);
int cur = -MAX_V;
int ans = 0;
for(int i = 0; i < N; ++i){
if(cur <= ps[i].second){
ans++;
cur = ps[i].first;
}
}
return ans;
}
int main(){
input();
int ans = solve();
printf("%d\n", ans);
return 0;
}


Measured memory_bytes: 1664
N = int(input())
S = []
for i in range(N):
	S.append(input())

M = 0
A = 0
R = 0
C = 0
H = 0
for s in S:
	if s[0] == 'M':
		M += 1
	elif s[0] == 'A':
		A += 1
	elif s[0] == 'R':
		R += 1
	elif s[0] == 'C':
		C += 1
	elif s[0] == 'H':
		H += 1
res = 0
if M * A * R != 0:
	res += M * A * R
if M * A * C != 0:
	res += M * A * C
if M * A * H != 0:
	res += M * A * H
if M * R * C != 0:
	res += M * R * C
if M * R * H != 0:
	res += M * R * H
if M * C * H != 0:
	res += M * C * H

if A * R * C != 0:
	res += A * R * C
if A * R * H != 0:
	res += A * R * H
if A * C * H != 0:
	res += A * C * H
if R * C * H != 0:
	res += R * C * H

print(res) 

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

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector<int> sum(n);
		for(int a = 0; a < n; ++a)
		{
			for(int i = 0; i < 5; ++i)
			{
				int temp;
				cin >> temp;
				sum[a] += temp;
			}
		}
		sort(sum.begin(), sum.end());
		cout << sum[sum.size() - 1] << " " << sum[0] << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
using System;

namespace ABC149B
{
    class Program
    {
        static void Main(string[] args)
        {
            double a, b, k;
            string[] ss = Console.ReadLine().Split(' ');
            a = double.Parse(ss[0]);
            b = double.Parse(ss[1]);
            k = double.Parse(ss[2]);
            
            if (a + b <= k)
                Console.WriteLine("0" + " " + "0");
            else if (a + b >= k && a <= k)
                Console.WriteLine("0" + " " + (b - (k - a)));
            else if (a + b >= k && a > k)
                Console.WriteLine((a - k) + " " + b);
            Console.ReadKey();
        }
    }
}


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

int main(){
  int n; cin >> n; int a=1;
  if(n<82){
    rep(i,9){
      if(n%(i+1)==0 && n/(i+1)<10){
      cout << "Yes" << endl; a=0;
	break;
      }
  }
  }
  if(a) cout << "No" << endl;
 return 0;
}


Measured memory_bytes: 256
/*
出てない(f=0)
押したら(f=1)T[sec]出る
T[sec]過ぎたら止まる
出てるとき(f=1)押したらそのタイミングからT[sec]出る

T<=ti
(t2-t1)>=TならT加算
//出終わってから少ししてor出終わった瞬間
T>ti
(t2-t1)<Tならt2-t1加算
//出てるとき押したら

一つ前出たところまで加算

*/
#include<stdio.h>
int main(void){
	int N;//人数
	int T;//一回押して出る時間
	int ti[2];//ディレイ
	int i;
	
	int sum=0;//出る時間の総和
	
	scanf("%d %d",&N,&T);
	for(i=0;i<N;i++){
		if(i!=0){
			//最初の入力ではないなら
			//前の時間を保存
			ti[1]=ti[0];
		}
		scanf("%d",&ti[0]);
		if(i!=0){
			//最初の入力でないなら
			//差分から一つ前までの時間を出す
			if(ti[0]-ti[1]>=T){
				sum+=T;
			}
			else{
				sum+=ti[0]-ti[1];
			}
		}
	}
	printf("%d\n",sum+T);//最後出る分を合わせて
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#define N 1000

int main(void)
{
  int i, j, size;
  int a[N][3];

  scanf("%d", &size);

  for(i = 0 ; i <= size-1 ; i++)
    {
      for(j = 0 ; j <= 2 ; j++)
	{
          scanf("%d", &a[i][j]);
	}  
    }

  for(i = 0 ; i <= size-1 ; i++)
    {
      if(a[i][0] > a[i][1]&&a[i][0] > a[i][2])
	{
	  if(a[i][0]*a[i][0] == a[i][1]*a[i][1] + a[i][2]*a[i][2])
	    {
	      printf("YES\n");
	    }

	  else
	    {
	      printf("NO\n");
	    }
	}

      else if(a[i][1] > a[i][0]&&a[i][1] > a[i][2])
	{
	  if(a[i][1]*a[i][1] == a[i][0]*a[i][0] + a[i][2]*a[i][2])
	    {
	      printf("YES\n");
	    }

	  else
	    {
	      printf("NO\n");
	    }

	}

      else if(a[i][2] > a[i][0]&&a[i][2] > a[i][1])
	{
	  if(a[i][2]*a[i][2] == a[i][0]*a[i][0] + a[i][1]*a[i][1])
	    {
	      printf("YES\n");
	    }

	  else
	    {
	      printf("NO\n");
	    }
	}

      else
	{
	  printf("NO\n");
	}  
    }
  return 0;
}

Measured memory_bytes: 588
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def main():
  n, k = na()
  h = list(na())
  cnt = 0
  for hh in h:  
    if hh >= k:
      cnt += 1
  print(cnt)

main()

Measured memory_bytes: 11892
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P	  = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

constexpr ll INF = 1e16;
constexpr ll INM = 114514;
constexpr ll MOD = 1e9 + 7;
constexpr ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};

ll ans[302][302] = {};

int main() {
	IOS();
	ll h, w, k;
	cin >> h >> w >> k;
	vector<string> s(h);
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}
	int previ = 0, prevj = 0;
	int itmp = 0;
	ll cnt	 = 1;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') {
				//dump(prevj);
				for (int j2 = prevj; j2 <= j; j2++) {
					for (int i2 = previ; i2 <= i; i2++) {
						ans[i2][j2] = cnt;
					}
				}
				for (int j2 = j; j2 < w; j2++) {
					if (j2 != j && s[i][j2] == '#') {
						prevj = j2;
						break;
					}
					for (int i2 = previ; i2 <= i; i2++) {
						ans[i2][j2] = cnt;
					}
				}
				itmp = i + 1;
				cnt++;
			}
		}
		previ = itmp;
		prevj = 0;
	}
	if(previ != h){
		for (int j = 0; j < w;j++) {
			for (int i = previ; i < h;i++) {
				ans[i][j] = ans[previ - 1][j];
			}
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if(j) cout << " ";
			cout << ans[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1536