akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define ll long long
#define endl '\n'
#define vi vector<int>
#define rep(i, n) for (i = 0; i < n; i++)
#define rep1(i, n) for (i = 1; i <=n; i++)
#define rep2(i, n) for (i = 0; i < n-1; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend() //Sort in reverse,Vector.
#define present(v,x) (v.find(x)!=v.end()) //set/map etc.



int main()
{  ios_base::sync_with_stdio(false);cin.tie(NULL);
   #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif

   ll n;
    cin>>n;
    if(n%2 == 0)
    {
      cout<<"-1";
      return 0;
    }
                       
    ll k = 7;
    ll cnt = 1;
     while(true)
     {
       if(k%n == 0)
       {
            cout<<cnt;
            break;
       }
         if(cnt > n)
         {
          cout<<"-1";
             break;
          }
           k = (k%n)*10 +7;
               
               ++cnt;
      }


   

}  

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define all(a) (a).begin(),(a).end()

ll n;

vector<ll> calc(vector<ll> &a) {
    vector<ll> sum(n);
    stack<int> stack;
    ll cnt = 0;
    rep1(i,n-1){
        ll pre = a[i-1], cur = a[i];
        if (pre >= cur) {
            while (pre >= cur*4) {
                cur *= 4;
                stack.push(i);
            }
        } else {
            while (pre < cur) {
                if (stack.empty()) {
                    cnt += i*2;
                } else {
                    int k = stack.top(); stack.pop();
                    cnt += (i-k)*2;
                }
                pre *= 4;
            }
        }
        sum[i] = cnt;
    }
    return sum;
}

int main(void){
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    vector<ll> l = calc(a);
    reverse(all(a));
    vector<ll> r = calc(a);
    reverse(all(r));

    ll res = r[0];
    rep1(i,n-1){
        res = min(res, l[i-1] + i + r[i]);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4992
using System;
using System.Collections.Generic;

namespace Volume10_1000
{
	class Program
	{
		static void Main(string[] args)
		{
			List<int> sums = new List<int>();

			do {
				string str = Console.ReadLine();
				if(str == null) {
					break;
				}

				string[] vs = str.Split(' ');
				int a = int.Parse(vs[0]);
				int b = int.Parse(vs[1]);

				sums.Add(a + b);
			} while(true);

			foreach(int sum in sums) {
				Console.WriteLine(sum);
			}
		}
	}
}



Measured memory_bytes: 17960
from typing import  Any, Sequence

def linerSearch(A: Sequence, K: int) -> int:
    global cnt
    N = len(S)
    for i in range(N):
        if A[i] == K:
            cnt += 1
    return  0



n = int(input())
S = list(map(int, input().split()))
S = list(set(S))

q = int(input())
T = list(map(int, input().split()))

cnt = 0

for i in T:

    linerSearch(S, i)

print(cnt)


Measured memory_bytes: 8064
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,ans=0,maxx=1,minn=1e9,l[1000010],r[1000010];
struct Num{
	int x,y;
}a[1000010];
inline bool cmp(Num a,Num b){
	//return a.x<b.x||(a.x==b.x&&a.y>b.y);
	return a.y+b.x>a.x+b.y;
}
int main(){
	scanf("%d",&n);
	for(register int i=1;i<=n;i++){
		scanf("%d%d",&l[i],&r[i]);
		minn=min(minn,r[i]);
		maxx=max(maxx,l[i]);
	}
	for(register int i=1;i<=n;i++){
		ans=max(ans,max(minn-maxx+1,0)+r[i]-l[i]+1);
		a[i].x=r[i]-maxx+1;
		a[i].y=minn-l[i]+1;
	}
	sort(a+1,a+n+1,cmp);
	int res=a[1].y;
	for(register int i=2;i<=n;i++){
		ans=max(ans,a[i].x+res);
		res=min(res,a[i].y);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 7168
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();

    let mut ans = 0;
    for i in 1..n + 1 {
        if i.to_string().len() % 2 == 1 {
            ans += 1;
        }
    }

    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  int count=0;
 
  
  for (int i= 0 ; i < n; i++){
    int x;
    cin >> x;
    if(x > k - x){count += k - x;}
    else {count += x;}
  }
  cout << 2 * count << endl;
}



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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
#define mp            make_pair
template<class T, class S> inline bool minup(T& m, const S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, const S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-10;

class BipartiteMatching
{
private:
  int MAX_V;
  vector<int>* G;
  int* match;
  int* used;

  bool dfs(int v)
  {
    used[v] = true;
    rep(i, G[v].size()){
      int u = G[v][i], w = match[u];
      if(w < 0 || !used[w] && dfs(w)){
        match[v] = u;
        match[u] = v;
        return true;
      }
    }
    return false;
  }

public:
  BipartiteMatching(int MAX_V) : MAX_V(MAX_V)
  {
    G = new vector<int>[MAX_V];
    match = new int[MAX_V];
    used = new int[MAX_V];
  }

  ~BipartiteMatching()
  {
    delete[] G;
    delete[] match;
    delete[] used;
  }
  
  void addEdge(int u, int v)
  {
    G[u].pb(v);
    G[v].pb(u);
  }

  int matching()
  {
    int res = 0;
    rep(i, MAX_V) match[i] = -1;
    rep(v, MAX_V){
      if(match[v] < 0){
        rep(i, MAX_V) used[i] = 0;
        if(dfs(v)) res += 1;
      }
    }
    return res;
  }
};

int N, M, L;
int u, v, dd;
int d[111][111];
int p[1111];
int t[1111];

int main(int argc, char *argv[])
{
  while(cin >> N >> M >> L, N){
    BipartiteMatching bm = BipartiteMatching(2 * L);
    rep(i, N) rep(j, N) d[i][j] = INF;
    rep(i, N) d[i][i] = 0;
    rep(i, M){
      cin >> u >> v >> dd;
      d[u][v] = dd;
      d[v][u] = dd;
    }
    rep(k, N) rep(i, N) rep(j, N) minup(d[i][j], d[i][k] + d[k][j]);
    rep(i, L) cin >> p[i] >> t[i];
    rep(i, L) rep(j, L) if(i != j && t[i] + d[p[i]][p[j]] <= t[j]) bm.addEdge(i, j + L);
    cout << L - bm.matching() << endl;
  }
  
  return 0;
}

Measured memory_bytes: 6660
import sys
N, K, Q = map(int, input().split())
A = (int(x) for x in sys.stdin.read().split())
score = [K - Q] * (N + 1)
for a in A:
  score[a] += 1
print("\n".join('Yes' if s > 0 else 'No' for s in score[1:]))

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

int main()
{
  int n,m,sumN=0,sumM=0,ii=-1,jj=-1,flag=0;
  int N[100],M[100];

  while(1){
    cin>>n;
    cin>>m;
    if(n==0&&m==0)break;
    for(int i=0;i<n;++i){
      cin>>N[i];
      sumN+=N[i];
    }
    for(int i=0;i<m;++i){
      cin>>M[i];
      sumM+=M[i];
    }

    for(int i=0;i<n;++i){
      for(int j=0;j<m;++j){
        if(sumN-N[i]+M[j]==sumM-M[j]+N[i]&&flag==0){
          ii=i;
          jj=j;
          flag=1;
	}
        if(sumN-N[i]+M[j]==sumM-M[j]+N[i]&&flag==1&&N[ii]+M[jj]>N[i]+M[j]){
          ii=i;
          jj=j;
	} 
        
      }
    }
    if(ii!=-1 && jj!=-1){
    cout<< N[ii]<<" "<<M[jj]<<endl;
    }
    else cout<<"-1"<<endl;
    flag=0;
    sumN=0;
    sumM=0;
    ii=-1;
    jj=-1;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <math.h>
#include <chrono>
using namespace std;
//#pragma GCC optimize (-O3)
//#define endl tutaj n
#define mp make_pair
#define st first
#define nd second
#define pii pair<int, int>
#define pb push_back
#define _upgrade ios_base::sync_with_stdio(0), cout.setf(ios::fixed), cout.precision(10) //cin.tie(0); cout.tie(0);
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FWD(i, a, b) for (int i = (a); i < (b); ++i)
#define int long long

struct drzewo_przedzialowe //drzewo przedzial-przedzial dodaj
{
    int rozmiar;
    vector<int> modyfikator, S, L, P;

    int pot(int n)
    {
        int x = 1;
        while (n > x)
            x = x * 2;
        return x;
    }

    void deklaracja(int x) //x-rozmiar drzewa
    {

        rozmiar = pot(x);
        modyfikator.resize(2 * rozmiar, 0);
        L.resize(2 * rozmiar, 0);
        S = modyfikator;
        P = L;

        for (int i = rozmiar; i < 2 * rozmiar; i++)
            L[i] = P[i] = i - rozmiar;

        for (int i = rozmiar - 1; i > 0; i--)
        {
            L[i] = L[2 * i];
            P[i] = P[2 * i + 1];
        }
    }

    void zmien(int p, int q, int o_ile_zmienic, int wezel = 1) //dodaje o_ile_zmienic na przedziale [p,q]
    {
        if (p > q)
            return;

        if (p == L[wezel] && q == P[wezel])
        {
            modyfikator[wezel] = modyfikator[wezel] + o_ile_zmienic;
            S[wezel] += o_ile_zmienic;
            return;
        }
        zmien(p, min(P[2 * wezel], q), o_ile_zmienic, 2 * wezel);
        zmien(max(L[2 * wezel + 1], p), q, o_ile_zmienic, 2 * wezel + 1);

        S[wezel] = min(S[2 * wezel], S[2 * wezel + 1]) + modyfikator[wezel];
    }
    int mak(int p, int q, int wezel = 1) //zwraca maksa na przedziale [p,q]
    {
        if (p > q)
            return 1e18;
        if (p == L[wezel] && q == P[wezel])
            return S[wezel];

        return min(mak(p, min(P[2 * wezel], q), 2 * wezel), mak(max(L[2 * wezel + 1], p), q, 2 * wezel + 1)) + modyfikator[wezel];
    }

    void wypisz()
    {
        for (int i = 1; i < rozmiar * 2; i++)
            cout << i << ": " << modyfikator[i] << " " << S[i] << endl;
    }
};
const int MAXN = 2e5 + 100;
int n, m, suma = 0;
int dp[MAXN]; //dp, suma wszystkich ktore zaczynaja sie conajmniej w i
drzewo_przedzialowe D;
vector<pii> konce[MAXN]; //

void wyrzuc(int x)
{
    for (auto Y : konce[x])
        D.zmien(0, Y.st - 1, Y.nd);
}

void wczytywanie()
{
    cin >> n >> m;
    D.deklaracja(n + m + 10);
    REP(i, m)
    {
        int l, r, a;
        cin >> l >> r >> a;
        suma += a;
        konce[r].push_back(mp(l, a));
    }
    for (int i = 1; i <= n; i++)
    {
        dp[i] = D.mak(0, i - 1);
        D.zmien(i, i, dp[i]);
        wyrzuc(i);
    }
    cout << suma - D.mak(0, n) << endl;
}

main()
{
    _upgrade;
    wczytywanie();
}

Measured memory_bytes: 45568
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
using ll = long long;
using namespace std;

int main(){
    ll n;
    ll ans[10]={0,111,222,333,444,555,666,777,888,999};
    cin >> n;
    for(int i=1;i<10;i++){
        if(n<=ans[i]){
            cout << ans[i] << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cctype>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;

int main() {
    long long x, k, d;
    cin >> x >> k >> d;
    int hugo = 1;
    if (x < 0) {
        hugo = -1;
    }
    if ((hugo*x)/d >= k) {
        cout << hugo*x - d*k << endl;
    } else if ((k - (hugo*x)/d)%2 == 0) {
        cout << (hugo*x)%d << endl;
    } else {
        cout << d - (hugo*x)%d << endl;
    }
}

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

int main() {
	int N, K; cin >> N >> K;
	int chokudai=1;
	for(int i=0; i<N; ++i){
	    if(chokudai<K) chokudai *= 2;
	    else chokudai += K;
	}
	cout << chokudai << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

const int N = 20;

char str[N]; 

int main() {
	while (scanf("%s", str) != EOF) {
		int len = strlen(str);
		for (int i=len-1; i>=0; --i) putchar(str[i]);
		putchar('\n');
	}
	return 0;
}

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





int main(void){
    // 自分の得意な言語で
    // Let's チャレンジ！！
    int N,K;
    cin>>N>>K;
    if(N%K==0){
        cout << "0" << endl;
    }else{
        cout << "1" << endl;
    }
    


    


    return 0;
}

Measured memory_bytes: 256
n=int(input())
s=input()
if n==1:
    print(1)
else:
    slist=[]
    for i in range(len(s)):
        slist.append(s[i])
    
    for i in range(len(s)-1,0,-1):
        if slist[i-1]==slist[i]:
            del slist[i]

    print(len(slist))

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<string, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

int main() {
	llong N;
	map<P, int> m;

	cin >> N;
	string s;
	llong p;
	for (int i = 1; i <= N; i++) {
		cin >> s >> p;
		m[P(s,-p)] = i;
	}

	for (auto it = m.begin(); it != m.end(); it++)
		cout << it->second << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=1e6+10;
ll a[N],ans=1000000000000000000;

int main(){
	ll i,j,k,n,x=0,sum=0;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	for(i=1;i<n;i++){
		x+=a[i];
		ans=min(ans,abs(2*x-sum));
	}
	cout<<ans;
	return 0;
}


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

int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	std::vector<int> c(m);
	for (auto& e: c) scanf("%d", &e);
	using vi = std::vector<int>;
	vi dp(n + 1, 1 << 30);
	dp[0] = 0;
	for (int i{}; i < m; i++)
		for (int j{}; j + c[i] <= n; j++)
			dp[j + c[i]] = std::min(dp[j + c[i]], dp[j] + 1);
	printf("%d\n", dp[n]);
	return 0;
}


Measured memory_bytes: 3296
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
#define endl '\n'
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
int n, m;
vector<int>adj[10];
vector<bool>vis(10, false);
int ans;
bool checker() {
	for (int i = 0; i < n; i++) {
		if (!vis[i])return false;
	}
	return true;
}
void dfs(int node) {
	vis[node] = true;
	if (checker())ans++;
	for (auto k : adj[node]) {
		if (!vis[k]) {
			dfs(k);
		}
	}
	vis[node] = false;

}
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	dfs(0);
	cout << ans << endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int n,m,a[105],sum,num;
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	    {
		    cin>>a[i];
		    sum+=a[i];
		}
	double x=sum/(4.0*m);
	for(int i=1;i<=n;i++)
	    {
	        if(a[i]>=x)	
	            num++;
		}
	if(num>=m)
	    cout<<"Yes";
	else
	    cout<<"No";
	return 0;
}

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

using namespace std;

int main() {
  bool ans = false;
  string S, T;
  
  cin >> S >> T;
  
  for (int i = 0; i < T.length(); i++) {
    if (S == T) {
      ans = true;
      break;
    }
    
    S += S.front();
    S.erase(0, 1);
  }
  
  cout << (ans ? "Yes" : "No") << endl;
  
  return 0;
}

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

typedef long long LL;
typedef long double LD;
typedef string ST;


#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) for(auto (a): v )   cerr << a << endl
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl

LL N;
vector<LL> A;
void recusive(string S) {
  
  if (S.length() >= 10) {
    return;
  }
  if (S.find('3') != string::npos &&
      S.find('5') != string::npos &&
      S.find('7') != string::npos) {
    A.push_back(atoi(S.c_str()));
  }

  recusive(S + "3");
  recusive(S + "5");
  recusive(S + "7");

}

void func() {
  cin >> N;
  recusive("");
  sort(ALL(A));
  //cerr << A.size() << endl;

  //cout << lower_bound(ALL(A), N) - A.begin();
  cout << upper_bound(ALL(A), N) - A.begin();
  for (auto i = 0; i < 10; ++i) {
     //cerr << i << ":"<<A[i]<<  endl;
  }


}








#ifdef CALC_TIME 
#include <windows.h>
int main()
{
  LARGE_INTEGER freq;
  QueryPerformanceFrequency(&freq);
  LARGE_INTEGER start, end;
  QueryPerformanceCounter(&start);
  // 何かの処理
  func();
  QueryPerformanceCounter(&end);
  double time = static_cast<double>(end.QuadPart - start.QuadPart) * 1000.0 / freq.QuadPart;
  fprintf(stderr, "\n%lf[ms]\n", time);
  return 0;
}
#else 
int main()
{
  func();
  return 0;
}
#endif





Measured memory_bytes: 640
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
mod=10**9+7
dp=[0]*(n+1)
dp[0]=1
for i in range(m):
    dp[a[i]]=-1

for i in range(1,n+1):
    if dp[i]==-1:continue
    if dp[i-1]!=-1:
        dp[i]+=dp[i-1]
    if i>1 and dp[i-2]!=-1:
        dp[i]+=dp[i-2]
    dp[i]=dp[i]%mod
print(dp[-1]%mod)

Measured memory_bytes: 50008
#include <iostream>
#include <string>
#include <algorithm>

#define MAX 1001

using namespace std;

int lcs(string X, string Y);

int main()
{
	int n;
	cin >> n;
	string X, Y;
	for (int i = 0; i < n; i++)
	{
		cin >> X >> Y;
		cout << lcs(X, Y) << endl; 
	}
}


int lcs(string X, string Y)
{
	int c[MAX][MAX] = {0};
	X = ' ' + X;
	Y = ' ' + Y;
	for (int i = 1; i < X.length(); i++)
	{
		for (int j = 1; j < Y.length(); j++)
		{
			if (X[i] == Y[j])
				c[i][j] = c[i-1][j-1] + 1;
			else
				c[i][j] = max(c[i-1][j], c[i][j-1]);
		}
	}
	return c[X.length()-1][Y.length()-1];
} 


Measured memory_bytes: 7136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (m); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl


int main() {
    double W, H, x, y;  cin >> W >> H >> x >> y;

    double mid_x = W / 2;
    double mid_y = H / 2;
    double S = W * H;

    if (x == mid_x && y == mid_y) {
        //print(S/2 << ' ' << 1);
        cout << fixed << setprecision(10) << S/2;
        cout << ' ' << 1 << endl;
    } else {
        //print(S/2 << ' ' << 0);
        cout << fixed << setprecision(10) << S/2;
        cout << ' ' << 0 << endl;
    }
}


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

char caesar(char c){
  return (c+'X')%('Z'-'A'+1)+'A';
}

int main(void)
{
  char str[1111];
  scanf("%s",str);
  int len = strlen(str);
  for(int i = 0; i < len; i++){
    str[i] = caesar(str[i]);
  }
  printf("%s\n",str);
}

Measured memory_bytes: 948
#include<bits/stdc++.h>
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define N 200005

using namespace std;

int main()
{
    __

    int n;
    bool flag = true;

    cin >> n;

    for(int v,i=0;i<n;i++)
    {
        cin >> v;

        if(v%2==0 && v%3!=0 && v%5!=0) flag = false;
    }

    if(flag) cout << "APPROVED\n";
    else cout << "DENIED\n";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe



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

int n,d,renge,count;
cin >> n >> d;

renge = 2*d+1;

count = n / renge;

if (n%renge == 0)
{
    cout << count << endl;
}else
{
    cout << count+1 << endl;
}








//////////////////////////////////////////////////////
return 0;}

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

#define N 1000 //参加者の最大人数

int main(void) {
    bool p[N]; //trueは勝ち残っている人
    int n, m;
    
    while(cin >> n >> m) {
        if(n == 0 && m == 0) break;
        for(int i = 0; i < n; ++i) {
            p[i] = true;
        }
        
        int turn = 1;
        int loser = 0; //脱落者の人数
        while(loser < n) {
            for(int i = 0; i < n; ++i) {
                if(p[i]) {
                    if(turn == m) {
                        p[i] = false;
                        ++loser;
                        if(loser == n) {
                            cout << i + 1 << endl;
                        }
                        turn = 1;
                    } else {
                        ++turn;
                    }
                }
            }
        }
        
    }
}


Measured memory_bytes: 3100
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  long a, b, ans=0;
  cin >> a >> b;
  if(b<a){
    swap(a,b);
  }
  //cout << a << b << endl;
  while(1){
	ans += b;
    if(ans%a == 0){
      cout << ans << endl;
      break;
    }
    
  }
}

Measured memory_bytes: 256
import sys

def main():
    K, N = list(map(int, sys.stdin.readline().rstrip().split()))
    data = list(map(int, sys.stdin.readline().rstrip().split()))

    def iterate_difference(index):
        try:
            yield data[index + 1] - data[index]
        except IndexError:
            raise StopIteration

    difference = set()
    for x in range(N):
        try:
            difference.add(next(iterate_difference(x)))
        except StopIteration:
            continue
    else:
        difference.add(K - data[N - 1] + data[0])

    print(K - max(difference))

if __name__ == '__main__':
    main()

Measured memory_bytes: 129012
#include <bits/stdc++.h>
using namespace std;
#define MAX 100000

int a[MAX], x[MAX], y[MAX];
int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0;i < n;i++)scanf("%d", &a[i]);
	
	fill(x, x+MAX, -1);
	fill(y, y+MAX, -1);
	int ans = 0;
	for(int i = 0;i < n;i++){
		int p = i, cnt = 0;
		while(x[p] == -1){
			x[p] = cnt++;
			y[p] = i;
			p = (p+a[p])%n;
		}
		if(y[p] == i)ans += cnt-x[p];
	}
	printf("%d\n", ans);
	return 0;
}


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

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    for (int i=0; i<n; i++) cin >> s[i];
    sort(s.begin(), s.end());

    for (int i=0; i<n; i++) cout << s[i];
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int X, Y;
cin >> X >> Y; 
if(X == 1) X += 13; 
if(Y == 1) Y += 13; 
if(X > Y) cout << "Alice" << endl; 
else if(X < Y) cout << "Bob" << endl; 
else cout << "Draw" << endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  char n;
  
  cin >> s;
  n = s.back();
  if (n=='2' || n=='4' || n=='5' || n=='7' || n=='9'){
    cout << "hon" << endl;
  }
  if (n=='0' || n=='1' || n=='6' || n=='8'){
    cout << "pon" << endl;
  }
  if (n=='3'){
    cout << "bon" << endl;
  }
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#define N_MAX 1000000
#define M_MAX 10000

using namespace std;
long long N,M;
long long A[M_MAX];

void solve()
{
    long long sum = 0;
    long long res = 0;
    for(int i=0;i<M;i++)
    {
        sum += A[i];
    }
    res = N - sum;
    if(res < 0){
        cout << -1 << endl;
    }else{
        cout << res << endl;
    }
    return;
}

int main()
{
    cin >> N >> M;
    for(int i=0;i<M;i++){
        cin >> A[i];
    }
    solve();
    
    return 0;
}



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

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
const int INF = 1e9;

using namespace std;
int n;
int res = 0;
struct node {
    int id;
    int dist;
    bool searched;
};

node v[100];
int edge[100][100];

int main() {
    cin >> n;
    REP(i, n) {
        int u, k;
        cin >> u >> k;
        v[u].id = u;
        v[u].dist = INF;
        v[u].searched = false;
        REP(j, n) edge[i][j] = INF;
        REP(j, k){
            int to, cost;
            cin >> to >> cost;
            edge[i][to] = cost;
        }
    }
    v[0].dist = 0;
    int prev = 0;
    REP(i, n){
        int minimum = INF;
        REP(j, n){
            if(!v[j].searched && minimum >= v[j].dist){
                prev = j;
                minimum = v[j].dist;
            }
        }
        REP(j, n){
            if(!v[j].searched && edge[prev][j] != INF){
                v[j].dist = min(v[j].dist, v[prev].dist + edge[prev][j]);
            }
        }
        v[prev].searched = true;
    }
    REP(i, n) cout << i << " " << v[i].dist << endl;
    return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

typedef long long Int;
const Int mod = 1000000007;
const Int INF = mod * mod;

int main() {
	Int n, x;
	cin >> n >> x;
	vector<Int> L(n);
	for (Int i = 0; i < n; i++) {
		cin >> L[i];
	}
	Int res = 1, now = 0;
	for (Int i = 0; i < n; i++) {
		now += L[i];
		if (now <= x)res++;
	}
	cout << res << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <random>

#define int long long
#define x first
#define y second

using namespace std;

void solve() {
	int r;
	cin >> r;
	cout << r * r << endl;
}

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

	int n = 1;
	//cin >> n;
	while (n--)	solve();

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

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

#define int long long

int memo[100];

signed main() {
    string s;
    cin >> s;
    for(int i=0; i<s.size(); ++i) {
        char a = s[i];
        memo[a-'a']++;
    }
    for(int i=0; i<26; ++i) {
        if(memo[i]==0) {
            cout << (char)(i+'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
typedef long long ll;

using namespace std;

int gcd(ll a,ll b)
{
    if (a%b==0)
    {
        return(b);
    }
    else
    {
        return(gcd(b,a%b));
    }
}

int main() {
    ll a, b;
    cin >> a >> b;
    
    ll ans = a * b;
    ans /= gcd(a, b);
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{int n,sum=0;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{cin>>a[i];
}
for(int i=0;i<n;i++)
{for(int j=0;j<n&&j!=i;j++)
{sum+=a[i]*a[j];
}
}
cout<<sum<<endl;
return 0;
}

Measured memory_bytes: 384
using System;
class p0003
{
    static void Main(string[] args)
    {
        int cnt = int.Parse(Console.ReadLine());
        while (0 < cnt--)
        {
            var input = Console.ReadLine().Split(' ');
            var val = new[]{
                (int)Math.Pow(int.Parse(input[0]), 2), 
                (int)Math.Pow(int.Parse(input[1]), 2),
                (int)Math.Pow(int.Parse(input[2]), 2)
            };
            Array.Sort(val);
            Console.WriteLine(val[0] + val[1] == val[2] ? "YES" : "NO");
        }
    }
}

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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1000000000;
const ll LINF = (ll) 4000000000000000000;
const ll MOD = (ll) 1000000007;
const double PI = acos(1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define NP(v) next_permutation(v.begin(),v.end())
#define smaller_queue  priority_queue <ll, vector<ll>, greater<ll> >
//------------------------------------------------------

int main() {
    int d, n;
    cin >> d >> n;
    if (n == 100) n++;
    cout << n;
    rep(i, d) cout << "00";
    cout << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
int main() {
	int n, v;
	cin >> n;
	vector<int>even(100010, 0), odd(100010, 0);
	for (int i = 0; i < n/2; ++i) {
		cin >> v;
		even[v]++;
		cin >> v;
		odd[v]++;
	}
	vector<pii>even_pair, odd_pair;//count,index
	for (int i = 1; i <= 100010; ++i) {
		even_pair.push_back(make_pair(even[i], i));
		odd_pair.push_back(make_pair(odd[i], i));
	}
	sort(even_pair.begin(), even_pair.end(), greater<pii>());
	sort(odd_pair.begin(), odd_pair.end(), greater<pii>());
	if (even_pair[0].second != odd_pair[0].second) {
		cout << n - even_pair[0].first - odd_pair[0].first << endl;
	}
	else {
		cout << min(n - even_pair[0].first - odd_pair[1].first, n - even_pair[1].first - odd_pair[0].first);
	}
	return 0;
}


Measured memory_bytes: 2804
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] p = new int[N];
		for(int i=0; i<N; i++) {
			p[i] = sc.nextInt();
		}
		sc.close();
		int ans = 0;
		for(int i=0; i<N-1; i++) {
			if(i+1 == p[i]) {
				swap(p, i, i+1);
				ans++;
			}
		}
		if(p[N-1] == N) ans++;
		System.out.println(ans);
	}
	
	private static void swap(int[] a, int i, int j) {
		int temp = a[i];
		a[i] = a[j];
		a[j] = temp;
	}

}

Measured memory_bytes: 50904
using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;

namespace DigitsParades
{

    class Programk
    {
        static void Main(string[] args)
        {
            //var NMK = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            var S = Console.ReadLine();
            if(S == "AAA" || S== "BBB")
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
          //  var NM = Console.ReadLine();
        }
    }

    #region スキャナー
    class Scanner
    {
        public Scanner()
        {
            _pos = 0;
            _line = new string[0];
        }

        const char Separator = ' ';
        private int _pos;
        private string[] _line;

        #region スペース区切りで取得

        public string Next()
        {
            if (_pos >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _pos = 0;
            }

            return _line[_pos++];
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }

        #endregion

        #region 型変換

        private int[] ToIntArray(string[] array)
        {
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }

        private long[] ToLongArray(string[] array)
        {
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }

        private double[] ToDoubleArray(string[] array)
        {
            var result = new double[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = double.Parse(array[i]);
            }

            return result;
        }

        #endregion

        #region 配列取得

        public string[] Array()
        {
            if (_pos >= _line.Length)
                _line = Console.ReadLine().Split(Separator);

            _pos = _line.Length;
            return _line;
        }

        public int[] IntArray()
        {
            return ToIntArray(Array());
        }

        public long[] LongArray()
        {
            return ToLongArray(Array());
        }

        public double[] DoubleArray()
        {
            return ToDoubleArray(Array());
        }

        #endregion
    }
    #endregion  

}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long

const int N=100005;
const int MOD=1e9+7;
 

// lower_bound - which does not compare less than val
// upper_bound - which compares greater than val
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
 
int32_t main()
{
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  /* stuff you should look for
  * int overflow, array bounds
  * special cases (n=1?)
  * do smth instead of nothing and stay organized
*/


int n;
cin>>n;
int arr[N];
for(int i=1;i<=n;i++)
{
	cin>>arr[i];
}
int dp[N];
for(int i=1;i<=n;i++)
{
	if(i==1)
	{
		dp[i]=0;
	}
	if(i==2)
	{
		dp[i]=abs(arr[i]-arr[i-1]);
	}
	else if(i>=3)
	{
		dp[i]=min(abs(arr[i]-arr[i-1])+dp[i-1],abs(arr[i]-arr[i-2])+dp[i-2]);
	}
}

cout<<dp[n];




}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll m1,d1,m2,d2;

int main(){
  ll ans=0;
  cin >> m1>>d1>>m2>>d2;
  
  cout<<(m1!=m2)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j,K,n,t,count=0,mini;
  scanf("%d",&K);
  int N[K];
  for(i=0;i<K;i++)
    scanf("%d",&N[i]);
  for(i=0;i<K-1;i++){
    mini=i;
    for(j=i;j<K;j++){
      if(N[j]<N[mini]){
	mini=j;
      }
    }
    int t=N[i];
    N[i]=N[mini];
    N[mini]=t;
    if(mini!=i)
      count++;
  }
  for(n=0;n<K;n++){
    if(n == K-1)
      printf("%d",N[n]);
    else printf("%d ",N[n]);
  }
  printf("\n%d\n",count);
  return 0;
}

Measured memory_bytes: 600
// 問題の URL を書いておく
// 

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

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

using ll = int64_t;

int main(int, const char**)
{
    string s;
    cin >> s;
    if(*s.rbegin() == 's')
    {
        cout << s + "es" << endl;
    }
    else
    {
        cout << s + "s" << endl;
    }
    return 0;
}


Measured memory_bytes: 3628
w, h, n = list(map(int, input().split()))
ma1 = ma2 = ma3 = ma4 = 0
flag = flag1 = True
while(n):
	x, y, a = list(map(int, input().split()))
	if a == 1:
		if x > ma1:
			ma1 = x
	elif a == 2:
		if flag:
			ma2 = x
			flag = False
		if x < ma2:
			ma2 = x
	elif a == 3:
		if y > ma3:
			ma3 = y
	elif a == 4:
		if flag1:
			ma4 = y
			flag1 = False
		if y < ma4:
			ma4 = y
	n -= 1
 
if ma1 and ma2:
	if ma1 >= ma2:
		width = 0
	else:
		width = abs(ma1-ma2)
else:
	if ma1 == 0 and ma2 == 0:
		width = w
	elif ma1 == 0:
		width = ma2
	elif ma2 == 0:
		width = w - ma1
if ma3 and ma4:
	if ma3 >= ma4:
		height = 0
	else:
		height = abs(ma3-ma4)
else:
	if ma3 == 0 and ma4 == 0:
		height = h
	elif ma3 == 0:
		height = ma4
	elif ma4 == 0:
		height = h - ma3
 
print(width*height)

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int k = scanner.nextInt();
		String s = scanner.next();
		int count = 0;
		for (int i = 0; i < n - 1; i++) {
			if (s.charAt(i) == s.charAt(i + 1))
				count++;
		}
		System.out.println(Math.min(n - 1, count + 2 * k));
	}

}


Measured memory_bytes: 24272
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <unordered_map>
#include <memory.h>
#include <string>
#include <fstream>
#include <queue>
#include <random>
#include <ctime>
#include <array>

using namespace std;


bool Solve(int64_t a, int64_t b,int64_t c,int64_t d) {
    if (a < b) {
        return false;
    }
    if (d < b) {
        return false;
    }
    if (c >= b - 1) {
        return true;
    } else {
        auto ost = a % b;
        auto gc = __gcd(d, b);
        auto l = c + 1;
        auto r = b - 1;
        if (r - l + 1 >= gc) {
            return false;
        }
        auto ost_gc = ost % gc;
        l %= gc;
        r %= gc;
        if (r >= l) {
            if (ost_gc >= l && ost_gc <= r) {
                return false;
            }
        } else {
            if (ost_gc >= l || ost_gc <= r) {
                return false;
            }
        }
        return true;
    }
}



int main() {
    int t;
    std::cin >> t;
    while (t --> 0) {
        int64_t a, b, c, d;
        std::cin >> a >> b >> c >> d;
        auto res = Solve(a, b, c, d);
        std::cout << (res ? "Yes" : "No") << std::endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    long N = sc.nextLong();
        long A = sc.nextLong();
        long ans = (long)Math.ceil((double)N/A);
        for (int i=0; i<4; i++) {
            long num = (long)Math.ceil((double)N/sc.nextLong());
        	ans = (num > ans)? num: ans;
        }
	    System.out.println(ans+4);
	}
}

Measured memory_bytes: 36120
#include <bits/stdc++.h>
 
using namespace std;
 
#define BOOST        std::ios::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define sp           <<" "<<
#define ll           long long
#define ld           long double
#define For(i,k,n)   for(ll i=k;i<n;i++)
#define Ford(i,n)    for(ll i=n-1;i>=0;i--)
#define AZI(i,x)     for(auto i=x.begin();i!=x.end();i++)
#define AZ(x)        x.begin(),x.end()
#define P(x,y)       pair < x,y >
#define V(x)         vector < x >
#define fi           first
#define se           second
#define pb           push_back
#define mp           make_pair
#define PI           3.14159265358979323846264338327950288419716939937510
 
const ll mod=1e9+7,N=1e5+5;

int n,m;
V(int) v[N];
int dp[N] = {};

int dfs(int node)
{
    if(dp[node]!=-1)
        return dp[node];

    if(v[node].size()==0)
        return 0;

    int tmp=0;
    for(auto i : v[node])
        tmp = max(tmp, dfs(i));
    
    return dp[node] = 1 + tmp;
}

int main() 
{ 
    BOOST

    memset(dp,-1,sizeof(dp));

    cin>>n>>m;

    for(int i = 0; i < m; i++)
    {
        int x,y;
        cin>>x>>y;
        v[x].pb(y);
    }
    
    for(int i=1; i<=n; i++)
        dfs(i);
 
     cout<<*max_element(dp,dp+n+1)<<"\n";

    return 0; 
} 

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long  int a, b, n;
  cin >> a >> b >> n;
  long long int ans;
  if(b <= n) ans = a*(b-1)/b;
  else ans = a*n/b;
  cout << ans << endl;
}
  

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

int main() {
  int K, N, maxv = 0;
  int A[1000000];

  cin >> K >> N;

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

  maxv = K - A[N-1] + A[0];
  for (int i = 0; i < N; i++) {
    maxv = max(maxv, A[i+1] - A[i]);
  }

  cout << K - maxv << endl;
}


Measured memory_bytes: 3072
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main(void){
  int N;
  int D;
  cin >> N;
  cin >> D;
  int k;
  k = 2*D+1;
  if(N%k == 0) cout << N/k << endl;
  if(N%k != 0) cout << N/k + 1 << endl;
return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
 
int main() {
 
  int a,b,c;
  string s;
  cin >> a;
  cin >>b;
  for(int i=0;i<a;i++){
    for(int j=0;j<b;j++){
   		cin >>s;
      	if(s=="snuke"){
			cout << char('A'+j)<<i+1<<endl;
          return 0;
        }
    }
  }
   return 0;
}


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

#define ff first
#define ss second
#define endl '\n'

const int MAX = 1e5;
vector<int> adj[MAX];

void bfs(int root, int dist[]) {
	bool visited[MAX] = {0};
	visited[root] = 1;
	dist[root] = 0;

	queue<int> q;
	q.push(root);

	for (int u; !q.empty(); ) {
		u = q.front(); q.pop();

		for (int v : adj[u]) {
			if (!visited[v]) {
				q.push(v);
				visited[v] = 1;
				dist[v] = dist[u] + 1;
			}
		}
	}
}

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

	int n, t, a;
	cin >> n >> t >> a; --t; --a;

	for (int i = 0, u, v; i < n-1; ++i) {
		cin >> u >> v; --u; --v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	int distT[n], distA[n];
	bfs(t, distT);
	bfs(a, distA);

	int ans = 0;
	for (int i = 0; i < n; ++i) {
		if (distA[i] > distT[i]) {
			ans = max(ans, distA[i]-1);
		}
	}

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

Measured memory_bytes: 6784
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <climits>

using namespace std;

int DP[50001];
int val[21];

int main(){
    
    int n, m;
    scanf("%d", &n);
    scanf("%d", &m);

    for (int i = 0;i< m ; i++) {
        scanf("%d", &val[i]);
    }
    
    fill(DP, DP + 50001 , INT_MAX);
    DP[0] = 0;
    
    for (int i = 0; i < m; i++) {
        for (int j = 0; j + val[i] < 50001; j++) {
            if (DP[j + val[i]] > DP[j] + 1 )
                DP[j + val[i]] = DP[j] + 1;
        }
    }
    cout << DP[n] << endl;
    
    return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<string.h>
int main() {
	int i, j;
	char x[10], y[10], z[10];
	scanf("%s %s", x, y);
	scanf("%d %d", &i, &j);
	scanf("%s", z);

	if (strcmp(x,z) == 0) {
		i = i - 1;
		printf("%d %d", i, j);
	}
	else{
		j = j - 1;
		printf("%d %d",i,j);
	}
	return 0;
}

Measured memory_bytes: 128
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
  
n=int(input())
print(num2alpha(n).lower())

Measured memory_bytes: 9172
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̕ϐ� (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    if (c >= a && c <= b) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  vector<vector<char>> s(50,vector<char>(100,'#'));
  vector<vector<char>> t(50,vector<char>(100,'.'));
  int cnta=0;
  for(int i=0;i<50;i+=2){
    if(cnta==a-1){
      break;
    }
    for(int j=0;j<100;j+=2){
      if(cnta==a-1){
       break;
      }
      s[i][j]='.';
      cnta++;
    }
  }
  int cntb=0;
  for(int i=0;i<50;i+=2){
    if(cntb==b-1){
      break;
    }
    for(int j=0;j<100;j+=2){
      if(cntb==b-1){
        break;
      }
      t[i][j]='#';
      cntb++;
    }
  }
  cout << 100 << " " << 100 << endl;
  for(int i=0;i<50;i++){
    for(int j=0;j<100;j++){
      cout << s[i][j];
    }
    cout << endl;
  }
  for(int i=49;i>=0;i--){
    for(int j=0;j<100;j++){
      cout << t[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <string>
using namespace std;
long long ans = 0;
int main(void){
    long long N,H,W;
    cin >> N >> H >> W;
    for(long long i=0;i<N;i++){
        long long h,w;
        cin >> h >> w;
        if(H <= h && W <= w)ans++;
    }
    cout << ans;
}


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

int main() {
  int N, K; // 試行回数Nと加算数Kを定義
  int a = 1; // 演算結果を代入する変数の定義
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
    if ((a * 2) < (a + K)) { // aに２をかけた数とKを足した数を比較し、小さい方を採用
      a *= 2;
    }
    
    else
      a += K;
  }
  
  cout << a << endl;
}

Measured memory_bytes: 256