akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); if (n == 0) cout << endl; REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

template<typename D, class... A> class BinarySearch {
    D left;
    D right;
    function<bool(D, A...)> func;

    public:
        BinarySearch(D l, D r, function<bool(D, A...)> f) {
            left = l;
            right = r;
            func = f;
        }

        D calc(A... args) {
            while (abs(right - left) > 1) {
                D middle = (left + right) / 2;
                if (func(middle, args...)) {
                    right = middle;
                } else {
                    left = middle;
                }
            }
            return right;
        }
};

void solve() {
    int n, k;
    cin >> n >> k;
    vi a(n);
    REP(i, n) cin >> a[i];

    if (k == 0) {
        SORT(a);
        cout << a[n - 1] << endl;
        return;
    }

    auto f = [&](ld mid) {
        int c = 0;
        REP(i, n) c += (a[i] + mid - 1) / mid - 1;
        return c <= k;
    };

    BinarySearch<int> bs(0, INF, f);
    cout << bs.calc() << endl;
}


Measured memory_bytes: 3968
from fractions import gcd
import heapq

a,b = (int(i) for i in input().split())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

D = make_divisors(gcd(a,b))
j = {d:True for d in D}

heapq.heapify(D)
ans = []
ans.append(heapq.heappop(D))

for _ in range(len(D)):
    tmp = heapq.heappop(D)
    if j[tmp] == True:
        for d in D:
            if gcd(tmp,d) != 1: j[d] = False
        ans.append(tmp)

print(len(ans))


Measured memory_bytes: 5984
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner(os.Stdin)
	a, b, c := sc.ScanInt(), sc.ScanInt(), sc.ScanInt()

	if a+b >= c {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner(r io.Reader) *Scanner {
	s := &Scanner{bufio.NewScanner(r)}
	s.sc.Split(bufio.ScanWords)
	return s
}

func (s *Scanner) ScanInt() int {
	s.sc.Scan()
	i, e := strconv.Atoi(s.sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 640
package main
 
import (
	"bufio"
	"fmt"
	"os"
	"strings"
)
 
var stdin = bufio.NewReaderSize(os.Stdin, 1000000)
 
func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := stdin.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}
 
func nextStr() []string {
	line := readLine()
	line_ := strings.Split(line, "")
	return line_
}
func moveWhite(s []string) int {
	ans := 0
	whiNext := 0
	for i := 0; i < len(s); i++ {
		if s[i] == "W" {
			ans += i - whiNext
			whiNext++
		}
	}
	return ans
}
func main() {
	str := nextStr()
	ans := moveWhite(str)
	fmt.Println(ans)
}

Measured memory_bytes: 4864
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<ll> a(n);
	REP(i, n) cin >> a[i];
	REP(i, n) {
		if(a[i] % 2) {
			cout << "first" << endl;
			return 0;
		}
	}
	cout << "second" << endl;
	return 0;
	return 0;
}
/* --------------------------------------- */


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

vector<int> b;

int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	int n; cin >> n;
	
	b.assign(n-1, 0);
	
	for(int i = 0; i < n-1; ++i) cin >> b[i];
	//B0  min(B0,B1)  B1  min(B1,B2)  B2  ...
	int sum = 0;
	
	for(int i = 0; i < n-1; ++i){
		
		if(i == 0) sum += b[0];
		else
		    sum += min(b[i-1], b[i]);
	}
	sum += b[n-2];
	cout << sum;	
	
    return 0;
}

Measured memory_bytes: 256
N=int(input())
blue={}
for _ in range(N):
    s=input()
    if s in blue.keys():
        blue[s]+=1
    else:
        blue[s]=1
M=int(input())
red={}
for _ in range(M):
    t=input()
    if t in red.keys():
        red[t]+=1
    else:
        red[t]=1
ans=0
for k in blue.keys():
    tmp=blue[k]
    if k in red.keys():
        tmp-=red[k]
    ans=max(ans,tmp)
print(ans)

Measured memory_bytes: 3064
def read():
	return [int(i) for i in input().split(' ')]
W, H, N = read()
x = [0] * N
y = [0] * N
a = [0] * N
for i in range(N):
	x[i], y[i], a[i] = read()
new_x = [0] + x + [W]
new_y = [0] + y + [H]
for inx in range(N):
	if(a[inx] == 1):
		new_x = [num for num in new_x if num >= x[inx]] 
	elif(a[inx] == 2):
		new_x = [num for num in new_x if num <= x[inx]] 
	elif(a[inx] == 3):
		new_y = [num for num in new_y if num >= y[inx]] 
	else:
		new_y = [num for num in new_y if num <= y[inx]] 
if(not(new_x) or not(new_y)):
	print(0)
	exit()
area = (max(new_x) - min(new_x)) * (max(new_y) - min(new_y))
print(area)


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

int main() {
  int n;cin>>n;
  vector<int> l(n);
  rep(i,n)cin>>l[i];
  int cnt=0;
  sort(all(l));
  rep(i,n-2)for(int j=i+1;j<n-1;j++)for(int k=j+1;k<n;k++){
    if(l[i]!=l[j]&&l[j]!=l[k]&&l[k]!=l[i]&&l[i]+l[j]>l[k])cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 3616
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  ll ans = 100000;
  for(int i=0;i<N;++i){
    ans = ans*105/100;
    if(ans%1000>0){
      ans -= ans%1000;
      ans += 1000;
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3060
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

int maxi[10010];

int main(int argc, char** argv)
{
  int h, n; cin >> h >> n;
  vector<pair<int, int>> v;
  for (int i = 0; i < n; i++) {
    int a, b; cin >> a >> b;
    v.emplace_back(a, b);
  }

  for (int i = 0; i < 10010; i++) maxi[i] = 1000000000;

  maxi[h] = 0;
  for (int k = h; k > 0; k--) {
  	for (auto p : v) {
      int t = max(0, k - p.first);
      maxi[t] = min(maxi[t], maxi[k] + p.second);
    }
  }
  
  cout << maxi[0] << endl;
  
  return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T>
inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T>
inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T>
T GCD(T a, T b) {if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }
template<class T>
inline T upper(T a, T b) {return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	vi a(n - 1);
	map<int, int> mp;
	rep(i, n - 1) {
		cin >> a[i];
		mp[a[i]]++;
	}

	for (int i = 1; i <= n; i++) {
		cout << mp[i] << endl;
	}
}

Measured memory_bytes: 13508
#include "bits/stdc++.h"
using namespace std;

#define ul unsigned long int
#define ull unsigned long long
#define li long long int

int main()
{
  ul n;
  cin>>n;
  int x[100],y;
  for (ul i = 0; i < n; i++)
    cin >> x[i];
  double d[4] = {0.0, 0.0, 0.0, 0.0},cd=0.0;
  for (ul i = 0; i < n; i++)
  {
    cin >> y;
    cd = abs(x[i] - y);
    d[0] += cd;
    d[1] += cd*cd;
    d[2] += cd*cd*cd;
    d[3] = max(d[3],cd);
  }
  d[1] = sqrt(d[1]);
  d[2] = cbrt(d[2]);
  cout<<fixed<<setprecision(16);
  for (ul i=0;i<4;i++) cout <<d[i]<<endl;


  return 0;
}



Measured memory_bytes: 3448
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>
#include <array>
#include <string>
#include <map>
#include <cmath>
//#include <iomainp>
using namespace std;

#define DB(x)
#define rep(i, n) for(int i = 0;i < n;i++)
typedef uint64_t LL;





int main()
{
    std::string str;
    cin >> str;

    int num = 0;
    rep(i,3)
    {
        if (str[i]=='S')
        {
            num++;
        }
    }

    if (num==1)
    {
        if(str[1]=='S'){
            num++;
        }
    }
    cout << 3 - num << endl;
    
    return 0;
}



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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 100005;

int q;

bool p[N];

void sieve () {
	memset(p, true, sizeof(p));
	for (int i = 2; i * i < N; i ++) {
		if (p[i]) {
			for (int j = i + i; j < N; j += i) {
				p[j] = false;
			}
		}
	}
}

int pref[N];

int main() {

	FAST;
	
	sieve();
	p[1] = false;
	for (int i = 1; i < N; i ++) {
		pref[i] = pref[i - 1];
		if (p[i] && (i % 2) && p[(i + 1) / 2]) pref[i] ++;
	}
	cin >> q;
	while (q -- ) {
		int l, r;
		cin >> l >> r;
		cout << pref[r] - pref[l - 1] << '\n';
	}
	return 0;
}

Measured memory_bytes: 1152
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, V: "List[int]"):

    sum_l = []
    for lk in range(min(N+1, K+1)):
        rk = min(N-lk, K - lk)
        if rk>0:
            q = V[:lk][::-1] + V[-rk:]
        else:
            q = V[:lk][::-1]
        
        m = 0
        sum_=0
        mn = K - (lk+rk)


        for i in range(len(q)):
            q_ = q[i:]
            m = i+mn
            q_s = sorted(q_)
            for x in range(len(q_s)):
                if (q_s[x]<0)&(m>0):
                    m-=1
                else:
                    break
            sum_ = sum(q_s[i+mn-m:])
            sum_l.append(sum_)

    
    print(max(sum_l))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    V = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, V)

if __name__ == '__main__':
    main()


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

int64_t p5(int64_t a)
{
	return a * a * a * a * a;
}

int main()
{
	int64_t X;
	cin >> X;

	int64_t maxA = 0;
	while (true)
	{
		if (p5(maxA+1) - p5(maxA) > X)
		{
			break;
		}
		++maxA;
	}

	for (int64_t a = maxA; a >= 0; --a)
	{
		for (int64_t b = a-1; b >= -maxA; --b)
		{
			if (p5(a) - p5(b) == X)
			{
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;

const int maxn = 1e5 + 10;
int n;
string z;

void calc(string s)
{
	for(int i=1;i<=n;i++)
	{
		if(s[i] == 's')
		{
			if(z[i] == 'o')
			{
				if(s[i-1] == 's') s += 's';
				else s += 'w';
			}
			else
			{
				if(s[i-1] == 's') s += 'w';
				else s += 's';
			}
		}
		else
		{
			if(z[i] == 'o')
			{
				if(s[i-1] == 's') s += 'w';
				else s += 's';
			}
			else
			{
				if(s[i-1] == 's') s += 's';
				else s += 'w';
			}
		}
	}
	if(s[n] == s[0] && s[n+1] == s[1])
	{
		for(int i=0;i<n;i++) cout << char(s[i] - 32);
		exit(0);
	}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(NULL);
	cin >> n >> z;
	z += z[0];
	calc("ws");
	calc("sw");
	calc("ss");
	calc("ww");
	cout << -1;
}

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

int main() {
  int N;
  cin >> N;
  
  int ans = INT_MAX;
  for (int i = 0; i < N; ++i) {
    int A;
    cin >> A;
    
    int j = 0;
    while (true) {
      if (A % 2 == 0) {
        A /= 2;
        j++;
      } else {
        break;
      }
    }
    if (j <= ans) {
      ans = j;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define mod 1000000007
#define maxn 100009
#define maxr 100009


int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	string str;
	cin>>str;
	if(str=="Sunny")
		cout<<"Cloudy"<<endl;
	else if(str=="Cloudy")
		cout<<"Rainy"<<endl;
	else
		cout<<"Sunny"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll A,B,H,M;
  cin>>A>>B>>H>>M;
  double pi = 3.14159265358979;
  double k=cos((60*H-11*M)*pi/360);
  cout<<fixed<<setprecision(10);
  cout<<sqrt(A*A+B*B-2*A*B*k)<<endl;
}
  

Measured memory_bytes: 4184
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S, Si;
  int N;
  long long sum, total;
  cin >> S;
  N = S.size();
  sum = 0; total = 0;
  
  vector<int> num(N);  
  for(int i = 0;i < N;i++){
  Si = S.at(i);
  num.at(i) = stoi(Si);
  }
  
  for (int tmp = 0; tmp < (1 << N - 1); tmp++) {
  bitset<9> p(tmp);  

    for(int i = 0;i < N;i++){
      if(sum == 0){
      sum = num.at(i);
      }
      else{
      sum = sum * 10 + num.at(i);  
      }
      
      if(i + 1 == N){
      total = total + sum;
      sum = 0;
      }
      else if(p.test(i)){
      total = total + sum;
      sum = 0;
      }
    }
  }
  cout << total << endl;
}

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

int main(){
    int n;
    cin >> n;
    bool check = false;

    for(int i=0; i<100/7; i++){
        for(int j=0; j<100/4; j++){
            if(n == (i*7 + j*4)){
                check = true;
            }
        }
    }
    if(check){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
import math
N,D = map(int,input().split())
X = []
for i in range(N):
    X.append(list(map(int,input().split())))
ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        total = 0
        for k in range(D):
            total += (X[i][k]-X[j][k])**2
        total = math.sqrt(total)
        if total%1 == 0:
            ans += 1
print(ans)

Measured memory_bytes: 62452
def pow2count(n):
	cnt = 0
	m = n
	while m%2 == 0:
		cnt += 1
		m /= 2
	return cnt

N = int(raw_input())
A = map(int, raw_input().split())
sum = 0
for i in range(0, N):
	sum += pow2count(A[i])
print sum

Measured memory_bytes: 37612
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define pb push_back
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = 1; i <= n; ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define rng(x) x.begin(),x.end()
#define sz(x) int((x).size())
using namespace std;
typedef vector<int> vi;

const int MX = 100005;
const int INF = 1001001001;

int n, a, df, q, p;
vi x, l, r;

int main() {
  scanf("%d%d%d%d",&n,&a,&df,&q);
  x = l = r = vi(q);
  rep(i,q) {
    scanf("%d%d%d",&x[i],&l[i],&r[i]);
  }
  scanf("%d",&p);
  vi d;
  drep(i,q) {
    if (x[i] == 0) {
      if (l[i] <= p && p <= r[i]) p = r[i]-(p-l[i]);
    } else if (x[i] == 1) {
      if (l[i] <= p && p <= r[i]) d.pb(1);
    } else {
      if (l[i] <= p && p <= r[i]) d.pb(0);
    }
  }
  reverse(rng(d));
  int ans = a+df*p-df;
  for (int k : d) {
    if (k) ans++; else ans /= 2;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 5316
N = int(input())
A = list(map(int,input().split()))
maxA = max(A)
half = maxA/2
t = 10000000000
for i in range(N):
    if A[i] != maxA and abs(A[i]-half) < abs(t-half):
        t = A[i]
print(maxA,t)

Measured memory_bytes: 14428
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#define LEN 100005
typedef struct a{
    char name[100];
    int time;
}Q;
int head;
int tail;
Q A[LEN];

void enqueue(Q x){
    A[tail] = x;
    tail = (tail + 1) % LEN;
}

Q denqueue(){
    Q x;
    x = A[head];
    head = (head + 1) % LEN;
    return x;
}

int min(int a ,int  b){
    return a < b ? a : b;
}

int main(){
    int i, n,q, minn;
    int timer = 0;
    Q x;

    scanf("%d %d", &n, &q);
    head = 0; tail = n;
    for(i = 0; i < n; i++){
        scanf("%s %d", A[i].name, &A[i].time);
    }

    while(head != tail){
        x = denqueue();
        minn = min(x.time, q);
        x.time -= minn;
        timer += minn;
        if(x.time <= 0){
            printf("%s %d\n", x.name, timer);
        }else{
            enqueue(x);
        }
    }
    return 0;
}


Measured memory_bytes: 11828
using System;

namespace atcorder
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string s=Console.ReadLine();
            int x = 700;
            foreach(char c in s){
                if (c == 'o') x += 100;
            }
            Console.WriteLine(x);
        }
    }
}

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


// 最大公約数を求める
// 計算量O(logn)
template<class T>
T gcd(T a, T b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

// 最小公倍数を求める
// 計算量O(logn)
template<class T>
T lcm(T a, T b){
    return a/gcd(a,b)*b;
}

// 素数判定
// 計算量O(√n)
template<class T>
bool isPrime(T n){
    if(n < 2) return false;
    for(T i = 2; i*i < n; ++i) if(n % i == 0) return false;
    return true;
}

// 素数列挙
// nまでの素数をEratosthenesの篩で列挙する
// 計算量O(nloglogn)
template<class T>
vector<T> prime_list(T n){
    vector<T> ret;
    vector<T> isPrime(n+1,1);
    isPrime[0] = isPrime[1] = 0;
    for(long long i = 2; i <= n; ++i){
        if(isPrime[i] == 0) continue;
        ret.push_back(i);
        for(long long j = i*i; j <= n; j += i) isPrime[j] = 0;
    }
    return ret;
    // return isPrime;  // 状況によってはこっちを返す
}

// 素因数分解
// nを素因数分解してmapに記録
// 計算量O(√nlogn),必要ならmapではなくvectorにすると計算量を落とせる
template<class T>
map<T,int> prime_factor(T n){
    map<T,int> ret;
    if(n <= 0){
        cout << "Prime_factor Error" << "\n";
        return ret;
    }
    for(long long i = 2; i*i <= n; ++i){
        while(n%i== 0){
            ++ret[i];
            n /= i;
        }
    }
    if(n != 1) ret[n]++;
    return ret;
}


// 関数名：pow
// 概要：modつき指数関数
// 第一引数a：指数の底
// 第二引数b：指数
// 第三引数mod：法となる値
// 戻り値：a^b(m mod)
// 計算量O(log b)
template<class T>
T pow(T a, int b){
    if(b == 0) return 1;
    if(b%2){
        T ret = pow(a,(b-1)/2); 
        return ret*ret*a;
    }else{
        T ret = pow(a,b/2);
        return ret*ret;
    }
}

template<class T>
T pow(long long a, long long b, T mod){
    if(b == 0) return 1;
    if(b % 2 == 0){
        T d = pow(a,b/2,mod);
        return (d*d)%mod;
    }else return a%mod*pow(a,b-1,mod)%mod;
}

//関数名：comb
//概要：二項係数
//第一引数n：組み合わせの全体
//第二引数r：何個取り出すか
//第三引数mod：法となる値
//戻り値：nCr(m mod)
// 計算量O(r), 第三引数まで指定するとO(rlogmod)
template<class T>
T comb(T n, T r){
    if(r > n) return 0;
    if(n == r || r == 0) return 1;
    T ret = 1;
    for(T i = 1; i <= r; ++i){
        ret *= n--;
        ret /= i;
    }
    return ret;
}

template<class T>
T comb(long long n,long long r,T mod){
    if(r > n) return 0;
    if(n == r || r == 0) return 1;
    long long fact1 = 1,fact2 = 1;
    for(long long i = n; i >= n-r+1; --i) fact1 = fact1*i%mod;
    for(long long i = r; i >= 1; --i) fact2 = fact2*i%mod;
    return fact1*pow(fact2,mod-2,mod)%mod;
}

const ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    // 入出力
    ll n; cin >> n;
    vector<int> a(n); rep(i,n) cin >> a[i];
    
    // 上手く行くかの判定
    map<int,int> m;
    bool flag = false;
    rep(i,n){
        if((n-1-a[i])%2){
            cout << 0 << endl;
            return 0;
        }
        int l = (n-1-a[i])/2, r = (n-1+a[i])/2;
        if(m[l] == 0) m[l] = 1;
        else if(m[l] != 0 && m[r] == 0) m[r] = 1;
        else{
            cout << 0 << endl;
            return 0;
        }
    }

    // 答えの計算
    ll ans = pow(2,n/2,MOD);
    cout << ans << "\n";
}

Measured memory_bytes: 5376
# encoding:utf-8
def needs(n_row, n_col):
	if n_row % 2 + n_col % 2 == 0:
		return [(n_row // 2) * (n_col // 2), 0, 0]
	elif n_row % 2 + n_col % 2 == 2:
		return [(n_row // 2) * (n_col // 2), (n_row // 2) + (n_col // 2), 1]
	elif n_row % 2 == 1:
		return [(n_row // 2) * (n_col // 2), n_col // 2, 0]
	else:
		return [(n_row // 2) * (n_col // 2), n_row // 2, 0]

def alphabetCount(input_lines):
	alphabet = "abcdefghijklmnopqrstuvwxyz"
	counter = [0, 0, 0]
	for i in range(26):
		count = input_lines.count(alphabet[i])
		counter[0] += count // 4
		counter[1] += (count % 4) // 2
		counter[2] += count % 2
	return counter

def judge(needs, counter):
	if needs[0] <= counter[0] and needs[2] == counter[2]:
		return "Yes"
	else:
		return "No"


def main():
	nums = list(map(int, input().split()))
	input_lines = "".join([input() for _ in range(nums[0])])
	print(judge(needs(nums[0], nums[1]), alphabetCount(input_lines)))


if __name__ == '__main__':
	main()

Measured memory_bytes: 3064
// inputに入力データ全体が入る
function Main(input) {
    input = input.trim();
    input = input.split(" ");
    var N = input[0];
    var K = input[1];

    console.log(N-K+1);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

class State{
public:
  int v, c;
  State(int _v, int _c)
    :v(_v), c(_c) {}

  bool operator < (const State& st) const{
    return this->c > st.c;
  }
};


int main(){
  int n, m, k;
  const int INF = 1 << 30;

  while(cin >> n >> m){
    if((n|m) == 0) break;

    vector<vector<vector<int> > > score(2, vector<vector<int> >(m, vector<int>(m, 0)));
    int a, b, cost, time;

    for(int i=0; i<n; i++){
      cin >> a >> b >> cost >> time;
      a--;
      b--;
      score[0][a][b] = score[0][b][a] = cost;
      score[1][a][b] = score[1][b][a] = time;
    }


    int p, q, r;

    cin >> k;
    while(k--){
      cin >> p >> q >> r; 
      vector<int> d(m, INF);
      --q;
      --p;
      priority_queue<State> req;
      req.push(State(p, 0));
      d[p] = 0; 
	while(! req.empty()){
	  State st = req.top();
	  req.pop();

	  if (st.v == q) {
	    cout << st.c << endl;
	    break;
	  }

	  if (d[st.v] < st.c)
	    continue;

	  for(int i=0; i<m; i++){
	    if(score[r][st.v][i] != 0){
	      if(st.c + score[r][st.v][i] < d[i]){
		d[i] = st.c + score[r][st.v][i];
		req.push(State(i, d[i]));
	      } 
	    }
	  }
	}

    }
  }
    return 0;
}

Measured memory_bytes: 1032
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int dp[1000+1][1000+1];

int main() {
    int n; 
    cin >> n;
    while(n--) {
        string s, t; cin >> s >> t;
        int N = s.length();
        int M = t.length();
        dp[0][0] = 0;
        for(int i = 0; i < N; i++) {
            for(int j = 0; j < M; j++) {
                if(s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
                else dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
            }
        }
        cout << dp[N][M] << endl;
    }
    return 0;
}


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

int main(){
int n,k;
cin >> n >> k;
vector<int> p(n);
rep(i,n) cin >> p[i];
sort(p.begin(), p.end());
int ans=0;
rep(i,k){
    ans += p[i];
}
cout << ans << endl;
}

Measured memory_bytes: 3636
from math import atan, degrees

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

v = a * a * b
if x <= v / 2:
    c = 2 * x / (a * b) # x = 1/2 * c * b * a
    theta = atan(b / c)
else:
    c = 2 * (v - x) / (a * a) # v - x = 1/2 * a * c * a
    theta = atan(c / a)

print(degrees(theta))


Measured memory_bytes: 3316
N, W = map(int, input().split())
v = [0] * N
w = [0] * N
for i in range(N):
    v[i], w[i] = map(int, input().split())

dp = [[0] * (W+1) for _ in range(N)]

for i in range(N):
    for j in range(1, W+1):
        if w[i] > j:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j], v[i]+dp[i][j-w[i]])

print(max(dp[N-1]))



Measured memory_bytes: 15640
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let n: usize;
    input!(n);
    println!("{}", n / 3);
}


Measured memory_bytes: 4352
/*
[abc123] A - Five Antennas
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

int a, b, c, d, e;
int k;

bool solve() { return (e - a) <= k; }

int main() {
    cin >> a >> b >> c >> d >> e;
    cin >> k;

    cout << (solve() ? "Yay!" : ":(") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <climits>
#include <sstream>

using namespace std;

int num;
long long int num_inverse;


void merge(int *a, int left, int mid, int right){

  int n1 = mid-left;
  int n2 = right-mid;

  int *L = new int[n1+1];
  int *R = new int[n2+1];

  for(int i=0;i<n1;i++){
    L[i] = a[left+i];
  }

  for(int i=0;i<n2;i++){
    R[i] = a[mid+i];
  }

  L[n1] = INT_MAX;
  R[n2] = INT_MAX;

  int i = 0;
  int j = 0;

  for(int k = left;k<right;k++){
    num++;
    if(L[i] < R[j]){
      a[k] = L[i];
      i += 1;
    }else{
      a[k] = R[j];
      num_inverse += (n1 - i);
      j += 1;
    }
  }
  return;
}

void mergeSort(int *a, int left, int right){
  int num=0;
  int num_inverse = 0;
  if(left+1<right){
    int mid = (left + right)/2;
    mergeSort(a, left, mid);
    mergeSort(a, mid, right);
    merge(a, left, mid, right);
  }
  return;
}


int main(){
  num = 0;
  int n;
  cin >> n;
  int *S = new int[n];

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


  mergeSort(S, 0, n);

  for(int i=0;i<n;i++){
    // if(i!=0){cout<<" ";}
    // cout << S[i];
  }
  // cout << endl;

  // cout << num << endl;
  cout << num_inverse << endl;
}

Measured memory_bytes: 25388
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
#include<deque>
#include<iomanip>
#include<ctime>
using namespace std;

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

	vector<int> a = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	cout << a[K - 1] << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
A = [input() for _ in range(n)]
# AT = list(map(''.join,zip(*A)))
count = 0
for a in range(n):
    arr = A[a:][:] + A[:a][:]
    arrT = list(map(''.join, zip(*arr)))
    for i in range(n):
        if arr[i][i+1:] != arrT[i][i+1:]:
            break
    else:
        count += n
print(count)

Measured memory_bytes: 3316
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef vector<vector<ll> >vvi;
ll mod = 1000000007;
#define SIZE 100000
ll inv[SIZE + 1];
ll kai[SIZE + 1];
ll invkai[SIZE + 1];
void invinit()
{
	inv[1] = 1;
	for (int i = 2; i <= SIZE; i++)
	{
		inv[i] = mod - (mod / i)*inv[mod%i] % mod;
	}
	kai[0] = invkai[0] = 1;
	for (int i = 1; i <= SIZE; i++)
	{
		kai[i] = kai[i - 1] * i%mod;
		invkai[i] = invkai[i - 1] * inv[i] % mod;
	}
}
ll com(ll a, ll b)
{
	if (b < 0 || a < b)return 0;
	return (invkai[b] * invkai[a - b]) % mod*kai[a] % mod;
}
ll po[111][11111];
vvi calc(int x, int y, int tim)
{
	vvi r;
	r.resize(x + 1);
	for (int i = 0; i < r.size(); i++)r[i].resize(y + 1);
	r[0][0] = 1;
	for (int i = 0; i < x; i++)
	{
		for (int j = 0; j <= y; j++)
		{
			for (int k = 0; k <= y - j; k++)
			{
				for (int l = 0; l <= j; l++)
				{
					if (k + l == 0)continue;
					r[i + 1][j + k] += r[i][j] * com(j + k, k) % mod*com(j, l) % mod*po[tim][k + l];
					r[i + 1][j + k] %= mod;
				}
			}
		}
	}
	return r;
}
ll get2d(int a, int b, int na, int nb)
{
	return (po[a][nb - 1] + po[b][na - 1] - 1)*a*b%mod;
}
ll get1(int a, int b, int c, int na, int nb, int nc)
{
	ll s = get2d(a, b, na, nb);
	ll r = 1;
	for (int i = 0; i < nc; i++)r = r*s%mod;
	return r*c%mod;
}
ll get2(int a, int b, int c, int na, int nb, int nc)
{
	return po[c][na*nb] * a*b%mod;
}
ll getusual(int a, int b, int c, int na, int nb, int nc)
{
	ll s = get1(a, b, c, na, nb, nc) + get1(b, c, a, nb, nc, na) + get1(c, a, b, nc, na, nb);
	ll t = get2(a, b, c, na, nb, nc) + get2(b, c, a, nb, nc, na) + get2(c, a, b, nc, na, nb);
	return (s + mod - t%mod + a*b*c) % mod;
}
int main()
{
	int a, b, c, na, nb, nc;
	scanf("%d%d%d%d%d%d", &a, &b, &c, &na, &nb, &nc);
	if (na%a != 0 || nb%b != 0 || nc%c != 0)
	{
		printf("0\n");
		return 0;
	}
	invinit();
	na /= a, nb /= b, nc /= c;
	for (int i = 0; i < 111; i++)
	{
		po[i][0] = 1;
		for (int j = 1; j < 11111; j++)po[i][j] = po[i][j - 1] * i%mod;
	}
	ll ans = getusual(a, b, c, na, nb, nc);
	if (a == 1 || b == 1 || c == 1)
	{
		printf("%lld\n", ans);
		return 0;
	}
	vvi ma = calc(na, nc, b - 1), mb = calc(nb, nc, a - 1), mc = calc(na, nb, c - 1);
	ll add = 0;
	for (int i = 1; i <= na - 1; i++)
	{
		for (int j = 1; j <= nb - 1; j++)
		{
			ll tim = mc[i][j] * com(na, i) % mod*com(nb, j) % mod*a*b*c%mod;
			vector<ll>s;
			s.push_back(0);
			for (int k = 1; k <= nc - 1; k++)
			{
				ll sum = 0;
				for (int l = 1; l <= na - i; l++)
				{
					sum += ma[l][k] * com(na - i, l);
					sum %= mod;
				}
				s.push_back(sum);
			}
			vector<ll>t;
			t.push_back(0);
			for (int k = 1; k <= nc - 1; k++)
			{
				ll sum = 0;
				for (int l = 1; l <= nb - j; l++)
				{
					sum += mb[l][k] * com(nb - j, l);
					sum %= mod;
				}
				t.push_back(sum);
			}
			ll ss = 0;
			for (int k = 1; k <= nc - 1; k++)
			{
				for (int l = 1; l <= nc - k; l++)
				{
					ll x = s[k] * t[l] % mod;
					ll y = com(nc, k)*com(nc - k, l) % mod;
					ss = (ss + x*y) % mod;
				}
			}
			add = (add + ss*tim) % mod;
		}
	}
	printf("%lld\n", (ans + add) % mod);
}

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

using namespace std;

int
main(void){
	int n; cin >> n;
	vector<int> vec(n);
	for(int i = 0; i < n; i++) cin >> vec[i];
	int Min = 10000;
	
	int ans = 0;
	for(int i = 0; i < n; i++){
		ans += vec[i];
		if(vec[i]%10 != 0){
			Min = min(Min , vec[i]);
		}
	}
	if(ans%10 == 0 && Min == 10000) cout << 0;
	else if(ans%10 == 0) cout << ans - Min;
	else cout << ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;


map<ll ,ll > res;
void prime_factor(ll n){
    for(ll i=2;i*i<=n;i++){
        while(n%i==0){
            res[i]++;
            n/=i;
        }
    }
    if(n!=1) res[n]++;
    return;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin>>n;
    prime_factor(n);
    cout<<n<<":";
    for(auto i:res){
        rep(j,i.second){
            cout<<" "<<i.first;
        }
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll                long long int
#define ld                long double
#define pb                push_back
#define mk                make_pair
#define in(i,a,n)         for(ll i=0;i<n;++i) cin>>a[i];
#define out(i,a,n)        for(ll i=0;i<n;++i) cout<<a[i]<<" ";
#define sz                size()
#define all(c)            c.begin(), c.end()
#define rall(c)           c.rbegin(), c.rend()
#define loop(i,a,b)       for(ll i=a;i<b;i++)
#define rloop(i,a,b)      for(ll i=a;i>b;i--)
#define T                 int t;scanf("%lld",&t);while(t--)
#define F                 first
#define S                 second
#define deb(x) cout << #x << " " << x << endl
#define inf INT_MAX
const ll N = 200010;
const ll MOD = 998244353;
ll mod(ll n) {
    return (n % MOD + MOD) % MOD;
}
 

 
 
int main(){
//T{
  
    ll n;
    cin >> n;
    string s;
    cin >> s;
    if(s.sz <= n) cout << s << endl;
    else{
        string k = "";
    	for(ll i=0;i<n;i++){
    		k += s[i];
    	}
    	cout << k << "...";
    }

    
//}

}

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

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
 
using namespace std;
 
#define li long long int
#define FOR(i, a, b) for (li (i) = (a) ; (i) < (b) ; ++(i))
#define REP(i, n) FOR(i, 0, n)

int main(void) {
    int A, B;
    cin >> A >> B;
    string S;
    cin >> S;

    string answer = "Yes";
    if ( S[A] != '-' ) {
        answer = "No";
    } else {
        FOR(index, 0, S.size()) {
            if (index == A) {
                continue;
            }
            if (S[index] == '-') {
                answer = "No";
            }
        }
    }
    
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


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

    if (s[s.size() - 1] != 's') {
        std::cout << s << "s" << std::endl;
    }
    else{
        std::cout << s << "es" << std::endl;
    }


    return 0;
}

Measured memory_bytes: 3656
function Main(input) {
    var N = parseInt(input[0], 10);
    var H = input.slice(1).map(h => parseInt(h, 10));

    var max = 0;
    var len = 0;

    for (i = 1; i < N; i++) {
        if (H[i - 1] >= H[i]) {
            len++;
            max = max < len ? len : max;
        } else {
            len = 0;
        }
    }
    console.log(max);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

Measured memory_bytes: 26816
package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	count := 0
	var counter []int

	if s == "" {
		return
	}
	counter = append(counter, 0)
	li := strings.Split(s, "")

	for _, s := range li {
		if s == "A" || s == "C" || s == "G" || s == "T" {
			count++
		} else {
			counter = append(counter, count)
			count = 0
		}
	}

	counter = append(counter, count)
	sort.Ints(counter)
	fmt.Println(counter[len(counter)-1])
}


Measured memory_bytes: 640
-- https://github.com/minoki/my-atcoder-solutions
import Data.Char (isSpace)
import Data.List (unfoldr)
import qualified Data.ByteString.Char8 as BS

main = do
  [k,x] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  putStrLn $ unwords $ map show [x-k+1..x+k-1]


Measured memory_bytes: 508
#include<iostream>
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int dp[200009][4], n;
string s ;
int solve(int i, int last)
{
    if(i>n)
        return -2*n;
    if(i==n)
        return 0 ;
    int &ans=dp[i][last];
    if(ans!=-1)
        return ans;
    ans=0;
    if(last==0)
        ans=1+max(solve(i+1,1),solve(i+2,2));
    else if(last==1)
    {
        if(s[i]!=s[i-1])
            ans=1+solve(i+1,1);
        ans=max(ans,1+solve(i+2,2));
    }
    else if(last==2)
    {
        ans=1+solve(i+1,1);
        if(s[i]!=s[i-2] && s[i+1]!=s[i-1])
            ans=max(ans,1+solve(i+2,2));
    }
    return ans;
}
int main()
{
    IO
    cin>>s;
    n=s.size();
    s+='*';
    memset(dp,-1,sizeof dp);
    cout<<solve(0,0);
}


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

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
clock_t startTime;
long double getTime(){
	return (long double)(clock()-startTime)/CLOCKS_PER_SEC;
}

int main(){
	startTime=clock();
	ll a,b,n;
	cin >> n;
	ll x[n],y[n],h[n];
	for(int i=0;i < n;i++){
		cin >> x[i] >> y[i] >> h[i];
	}
	for(int i=0;i <=100;i++){
		for(int j=0;j <=100;j++){
			int t=0;
			while(h[t]==0)t++;
			if(h[t] > 0){
				ll ans=h[t]+abs(x[t]-i)+abs(y[t]-j);
				if(ans >0){
					int k=0;
					while(k < n && h[k]==max(ans-abs(x[k]-i)-abs(y[k]-j),0LL))
						k++;
					if(k==n){
						cout << i <<" " << j <<" "<< ans;
						return 0;
					}
				}
			}
		}
	} 	

	return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>
int main(){
	int x,y,a,f,i;
	while(scanf("%d %d",&x,&y)!=EOF){
		if(x==0 && y==0)break;
		a=x+y;f=0;
		for(i=1;i<5;i++){
			scanf("%d %d",&x,&y);
			if(a<x+y)a=x+y,f=i;
		}
		printf("%c %d\n",65+f,a);
	}
	
	return 0;
}

Measured memory_bytes: 0
import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var kotlin=scan.nextLine().toInt()

    var x = kotlin%10
    if(x==2 || x==5 || x==4 || x==7 || x==9)
        println("hon")
    else if(x==0 || x==1 || x==6 || x==8)
        println("pon")
    else
        println("bon")
}


Measured memory_bytes: 36368
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=(j); i<=(k); i++)
#define FFOR(i, j, k) for(int i=(j); i<(k); i++)
#define DFOR(i, j, k) for(int i=(j); i>=(k); i--)
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'
#define pb push_back
#define mp make_pair
#define setbit(s, i) (s|=(1LL<<(i)))
#define bit(s, i) (((s)>>(i))&1LL)
#define mask(i) ((1LL<<(i)))
#define builtin_popcount __builtin_popcountll
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "D"
int n, k;
int b[2001][2001];
int w[2001][2001];
int sum(int s[][2001], int x, int y, int u, int v){
    return s[u][v]-s[u][y-1]-s[x-1][v]+s[x-1][y-1];
}
int main(){
    #ifdef Kanikou
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Kanikou
    read(n);
    read(k);
    {
        int x, y;
        char c;
        FOR(i, 1, n){
            read(x);
            read(y);
            x++;
            y++;
            x%=k*2;
            if(x==0) x=k*2;
            y%=k*2;
            if(y==0) y=k*2;
            while(!isalpha(c=getchar()));
            if(c=='B') b[x][y]++;
            else w[x][y]++;
        }
    }
    FOR(i, 1, k*2) FOR(j, 1, k*2) w[i][j]+=w[i-1][j]+w[i][j-1]-w[i-1][j-1];
    FOR(i, 1, k*2) FOR(j, 1, k*2) b[i][j]+=b[i-1][j]+b[i][j-1]-b[i-1][j-1];
    int ans=0;
    FOR(i, 1, k) FOR(j, 1, k){
        int sumb=sum(b, 1, 1, i-1, j-1)+sum(b, i, j, i+k-1, j+k-1)+sum(b, i+k, 1, k*2, j-1)+sum(b, 1, j+k, i-1, k*2)+sum(b, i+k, j+k, k*2, k*2);
        int sumw=sum(w, 1, 1, i-1, j-1)+sum(w, i, j, i+k-1, j+k-1)+sum(w, i+k, 1, k*2, j-1)+sum(w, 1, j+k, i-1, k*2)+sum(w, i+k, j+k, k*2, k*2);
        ans=max(ans, w[k*2][k*2]-sumw+sumb);
        ans=max(ans, b[k*2][k*2]-sumb+sumw);
    }
    writeln(ans);
}

Measured memory_bytes: 31488
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    Numbers = []
    def iter(s, i, n):
        if i == n:
            if ( s.find('3') >= 0 and s.find('5') >= 0 and s.find('7') >= 0 ):
                Numbers.append(int(s))
        else:
            iter(s+"3", i+1, n)
            iter(s+"5", i+1, n)
            iter(s+"7", i+1, n)

    N = int(lines.pop(0))
    for digit in range(3, len(str(N))+1):
        iter("",0, digit)

    print(len(list((filter(lambda x: x <= N, Numbers)))))
    #print(Numbers)

#
# main
#

# 1. use list instead of stdin

#contents = '''\
#575\
#'''
#lines = contents.split('\n')

# 2. use stdin

lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Measured memory_bytes: 4340