akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

// Range Sum Query by LazySegmentTree
struct LazySegTree {
  private:
    int n;
    vector<ll> node, lazy;

  public:
    LazySegTree(vector<ll> v) {
        int sz = (int)v.size();
        n = 1;
        while(n < sz)
            n *= 2;
        node.resize(2 * n - 1);
        lazy.resize(2 * n - 1, 0);

        for(int i = 0; i < sz; i++)
            node[i + n - 1] = v[i];
        for(int i = n - 2; i >= 0; i--)
            node[i] = node[i * 2 + 1] + node[i * 2 + 2];
    }

    // k番目のノードについて遅延評価
    void eval(int k, int l, int r) {
        // 遅延配列を見て空でなかったら値を伝播
        if(lazy[k] != 0) {
            node[k] += lazy[k];
            // 最下段かどうかチェック
            // 伝播
            if(r - l > 1) {
                lazy[2 * k + 1] += lazy[k] / 2;
                lazy[2 * k + 2] += lazy[k] / 2;
            }
        }

        // 伝播の終了
        lazy[k] = 0;
    }

    ll at(int k) { return getsum(k, k + 1); }

    // [a,b)区間加算
    void add(int a, int b, ll x, int k = 0, int l = 0, int r = -1) {
        if(r < 0)
            r = n;
        // まず評価
        eval(k, l, r);
        // 範囲外なら何もしない
        if(b <= l || r <= a)
            return;

        // 完全に被覆 遅延配列に値を入れ評価
        if(a <= l && r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
        }
        // そうでないとき 子コードの値を再帰的に計算して計算済みの値をもってくる
        else {
            add(a, b, x, 2 * k + 1, l, (l + r) / 2);
            add(a, b, x, 2 * k + 2, (l + r) / 2, r);
            node[k] = node[2 * k + 1] + node[2 * k] + 2;
        }
    }

    // [a,b)区間取得
    ll getsum(int a, int b, int k = 0, int l = 0, int r = -1) {
        if(r < 0)
            r = n;
        if(b <= l || r <= a)
            return 0;

        // まず評価
        eval(k, l, r);
        if(a <= l && r <= b)
            return node[k];
        ll vl = getsum(a, b, 2 * k + 1, l, (l + r) / 2);
        ll vr = getsum(a, b, 2 * k + 2, (l + r) / 2, r);
        return vl + vr;
    }
};

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    rep(i, K) {
        vector<ll> imos(N + 1, 0);
        rep(j, N) {
            imos[max(0, j - A[j])]++;
            imos[min(N, j + A[j] + 1)]--;
        }
        rep(j, N) imos[j + 1] += imos[j];
        int ok = 1;
        rep(j, N) {
            if(imos[j] != N)
                ok = 0;
        }
        rep(i, N) A[i] = imos[i];
        if(ok)
            break;
    }
    rep(i, N) { cout << A[i] << (i == N - 1 ? "\n" : " "); }
    return 0;
}

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

void swap(int *x, int *y)
{
    int tmp;
    if(*x > *y)
    {
        tmp = *x;
        *x = *y;
        *y = tmp;
    }
}

int main()
{
    int x, y;

    while(true)
    {
        cin >> x >> y;
        if(x == 0 && y == 0)
            break;
        swap(&x, &y);
        cout << x << " " << y << endl;
    }

    return 0;
}

Measured memory_bytes: 3076
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

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

  int amin = 100'000, bmin = 100'000;
  vector<int> a(A), b(B);
  rep(i, A) {
    cin >> a[i];
    chmin(amin, a[i]);
  }
  rep(i, B) {
    cin >> b[i];
    chmin(bmin, b[i]);
  }

  int result = amin + bmin;
  rep(i, M) {
    int x, y, c;
    cin >> x >> y >> c;
    x--;
    y--;
    chmin(result, a[x] + b[y] - c);
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
const double PI = 3.14159265358979323846;
int vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance(vec.begin(), itr);
  if (index != vec.size()) {  // 発見できたとき
    return 1;
  } else {  // 発見できなかったとき
    return 0;
  }
}
int main() {
  char s;
  cin >> s;

  if (isupper(s)) {
    cout << "A";
  } else {
    cout << "a";

    return 0;
  }
}

Measured memory_bytes: 3588
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include<unordered_map>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
void vdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) {
		if (i == da.size() - 1) std::cout << da[i];
		else std::cout << da[i] << ' ';
	}
	std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
	for (int i = 0;i < da.size();i++) vdeb(da[i]);
	std::cout << std::endl;
}

typedef std::complex<double> V;

template<>
inline bool chmax(V &a, V b){
	if(norm(a) < norm(b)){
		a = b;
		return true;
	}
	return false;
}

using namespace std;

int main(){
	int n; cin >> n;
	vector<V> da(n);
	rip(i,n,0){
		int x,y; cin >> x >> y;
		da[i].real(x); da[i].imag(y);
	}
	sort(da.begin(), da.end(), [](const V &x, const V &y){return arg(x) < arg(y);});
	vector<V> daa = da;
	// vdeb(da);
	// cout << arg(da[0]) MM arg(da[1]) << endl;
	rip(i,n,0) daa.push_back(da[i]);
	V ans;
	rip(i,n,0){
		V now;
		rip(j,n,0){
			now += daa[(i+j)%n];
			chmax(ans, now);
		}
	}
	printf("%.10lf\n", sqrt((double)norm(ans)));
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>


int main(void)
{
	long int n, l;
	long int i, j;
	long int min_abs = 1000;
	long int min;
	char s[5];
	
	scanf("%s", s);
	
	for(i = 0; i < 3; i++) {
		if(s[i] == s[i + 1]) {
			printf("Bad\n");
			return 0;
		}
	}
	
	
	printf("Good\n");
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  //配列宣言と流し込み
  vector<int> vec(N);
  for (int j = 0; j < N; j++){
    cin >> vec.at(j);
  }
    
  //ソート
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  //計算（Bobはマイナスがかかる）
  int sum;
  sum = 0;
  
  for (int i = 0; i < N; i++){
  sum = sum + vec.at(i) * pow(-1,i);
  }
  
  //出力
  cout << sum << endl;
  
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n, y;
	cin >> n >> y;
	if(y == 45000) cerr << "y == 45000" << endl;

	rep(i, 2000+1)
	{
		rep(j, 2000+1){
			if(i + j > n) break;
			int k = n - i - j;
			int sum = 10000*i + 5000*j + 1000*k;
			if(sum == y){
				printf("%d %d %d\n", i, j, k);
				return 0;
			}
		}
	}
	printf("-1 -1 -1\n");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a;
	int b;
	int i;
	int leap;
	
	scanf("%d%d", &a, &b);
	while(a != 0 || b != 0){
		leap = 1;
		for (i = a; i <= b; i++){
			if (i % 400 == 0){
				printf("%d\n", i);
				leap = 0;
			}
			else if((i % 4 == 0) && (i % 100 != 0)){
				printf("%d\n", i);
				leap = 0;
			}
		}
		if(leap != 0){
			printf("NA\n");
		}
		scanf("%d%d", &a, &b);
		if(a != 0 && b != 0){
			printf("\n");
		}
	}
	return (0);
}

Measured memory_bytes: 0
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>
#include <map>   
#include <stdio.h>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ull unsigned long long
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;

int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if ((e - a) > k)
		cout << ":(" << endl;
	else
		cout << "Yay!" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,b) for(int i=1;i<=b;i++)
#define drep(i,b) for(int i=b;i>=1;i--)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pr pair<int,int>
#define ff first
#define ss second
#define int long long
#define endl '\n'
using namespace std;
const int N=2e5+5;
const int mod=1e9+7;
int n,m,k,t,x,y,z;

void solve(int ans=0) {
    string s,s2;
    cin>>s>>s2;
    rep(i,s.size()) if(s[i-1]!=s2[i-1]) {
        cout<<"No"<<endl;
        return ;
    }
    cout<<"Yes"<<endl;
}

#undef int
int main() {
    ios::sync_with_stdio(false);
    //int T;cin>>T;
    //while(T--)
        solve();
}


Measured memory_bytes: 3640
import collections
n=int(input())
a=list(map(int, input().split())) 

a.sort()
x=0
count=0
b=set(a)
b=list(b)

c = collections.Counter(a)
c=c.most_common()
for i in range(len(c)):
    if c[i][1]!=1:
        x+=c[i][1]-1
    else:
        break
y=len(b)
if x%2==0:
    print(y)

else:
    print(y-1)
    



    

    
    
    





Measured memory_bytes: 26844
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define it vector<int>::iterator
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
using namespace std;
int main(){
	int m;
	cin>>m;
	while(m--){
		int n;
		cin>>n;
		vector<vector<char> >in(n+4,vector<char>(n+4,' '));
		rep(i,n+4)rep(j,n+4)
		if(!i||!j||i==n+3||j==n+3)in[i][j]='#';
		int x=n+2,y=2;
		int dx[]={-1,0,1,0};
		int dy[]={0,1,0,-1};
		int co=-1;
		rep(k,n){
			co++;
			if(co==4)co=0;
			while(1){
				int xx=x+dx[co];
				int yy=y+dy[co];
				bool q=true;
				rep(i,4){if(co!=(i+2)%4&&in[xx+dx[i]][yy+dy[i]]=='#')q=false;}
				if(!q)break;
				x=xx;y=yy;
				in[x][y]='#';
			}
		}
		rep(i,n){rep(j,n)cout<<in[i+2][j+2];cout<<endl;}
		if(m)cout<<endl;
	}
}

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


def solve(A: int, B: int, C: int, K: int):
    if K <= A:
        print(K)
    elif K <= A + B:
        print(A)
    else:
        print(A - (K - A - B))
    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()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(A, B, C, K)

if __name__ == '__main__':
    main()

Measured memory_bytes: 61728
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
 
using namespace std;
 
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;
 
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;

char c;
int ans = 0;

int main(){
	REP(i,4){
		cin >> c;
		
		if (c == '+') ans++;
		else ans--;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def prime_table(n):
    t = [True] * (n + 1)
    t[0] = False
    t[1] = False

    i = 2
    while i * i <= n:
        for ii in range(2 * i, n + 1, i):
            t[ii] = False
        i += 1
    return [x for x, i in enumerate(t) if i == True]


def solve(N: int):
    t = prime_table(100)

    ds = defaultdict(int)
    for i in range(1, N+1):
        for j in t:
            while i % j == 0:
                ds[j] += 1
                i = i // j

    ret = 0
    fs = list(ds.keys())
    for pi in range(len(fs)):
        p = ds[fs[pi]]
        if 74 <= p:
            ret += 1
        for qi in range(pi + 1, len(fs)):
            q = ds[fs[qi]]
            for cs in [[14, 4], [24, 2]]:
                if cs[0] <= p and cs[1] <= q:
                    ret += 1
                if cs[1] <= p and cs[0] <= q:
                    ret += 1
            for ri in range(qi + 1, len(fs)):
                r = ds[fs[ri]]
                if 2 <= p and 4 <= q and 4 <= r:
                    ret += 1
                if 4 <= p and 2 <= q and 4 <= r:
                    ret += 1
                if 4 <= p and 4 <= q and 2 <= r:
                    ret += 1
    return ret


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
    result = solve(N)
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5376
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
//printf("%.12Lf\n",c);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int primes[200];
int prime[1000000];
int pr[100000];
int el[314514],wl[314514];
int er[314514],wr[314514];
int a[114514];
string s[214514];
int ans[214514];
int sa[214514];
signed main(){
	ic(n)
	rep(0,i,n)cin>>s[i];
	sort(s,s+n);
	ans[0]=0;
	int sum=0;
	int renzoku=1;
	rep(0,i,n){
		if(s[i]!=s[i+1]){
			ans[sum]=i;
			sa[sum]=renzoku;
			sum++;
			renzoku=1;
		}
		else renzoku++;
	}
	int max=maxi(sa,0,sum);
	rep(0,i,sum){
		if(sa[i]==max){
			c(s[ans[i]])
		}
	}
}	

Measured memory_bytes: 18688
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            A.Add(0);
            var sum = 0;
            var last = 0;
            foreach (var a in A)
            {
                sum += Math.Abs(last - a);
                last = a;
            }

            A.Insert(0, 0);
            for (int i = 1; i < N + 1; i++)
            {
                var diff = Math.Abs(A[i + 1] - A[i - 1]) - (Math.Abs(A[i + 1] - A[i]) + Math.Abs(A[i] - A[i - 1]));
                Console.WriteLine(sum + diff);
            }
        }
    }
}


Measured memory_bytes: 27740
# include <stdio.h>

 int main(){

	 int a, b;
	 scanf("%d %d", &a, &b);
	 int c = 0;
	 int var = 0;

	 for (int i = a; i <= b; ++i){
		 int divv[5];
		 var = i;
		 for (int j = 0; j< 5; ++j){
			 divv[j] = var%10;
			 var = var/10;
		}
		if ((divv[0] == divv[4]) && (divv[1] == divv[3]))
			c += 1;
	 }
	 printf("%d\n", c);



	 return 0;
 }


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}

int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  ll A; string B; cin >> A >> B;
  ll D = (B[0] - '0') * 100 + (B[2] - '0') * 10 + (B[3] - '0');
  ll tmp = A * D;
  cout << tmp / 100 << endl;
}

Measured memory_bytes: 3628
while True:
    a,op,b = input().split()
    if op == '?': break
    elif op == '+': print(int(a)+int(b))
    elif op == '-': print(int(a)-int(b))
    elif op == '*': print(int(a)*int(b))
    elif op == '/': print(int(a)//int(b))



Measured memory_bytes: 5596
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m;

	cin >> x >> y;
	cout<<x*y<<endl;
}

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int main(void){
    int c1, c5, c10, c50, c100, c500;
    cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;
    
    if(c1*1 + c5*5 + c10*10 + c50*50 + c100*100 + c500*500 >= 1000){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 3112
#include <iostream>
#include <cmath>

using namespace std;


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

	long long root = (long long)sqrt((double)N);
	for (long long i = root; i > 0; i--) {
		long long j = N / i;
		if (i*j == N) {
			cout << (i-1)+(j-1) << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
typedef long long ll;
using namespace std;
void solve()
{
	int k;
	cin>>k;
	string s;
	cin>>s;
	if (s.size()<=k)
		cout<<s;
	else
		cout<<s.substr(0,k)<<"..."<<endl;
}
int main() 
{
	ios::sync_with_stdio(false);
	solve();
	return 0;
}

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


int Num,Wei;
vector<int> W;
vector<int> V;
 
long long cal(int n,int w){
   vector<vector<int>> vec(n+1,vector<int>(w+1));
   for(int i=0;i<Num;i++) vec[i][0]=0;
   for(int i=0;i<Wei;i++) vec[0][i]=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=w;j++){
            if(j-W[i-1]<0){
                vec[i][j]=vec[i-1][j];
            }else{
                vec[i][j]=max(vec[i-1][j-W[i-1]]+V[i-1],vec[i-1][j]);
            } 
        }
    }
    return vec[n][w];
}

int main(void){
    cin >> Num >> Wei;
    W.assign(Num,0);
    V.assign(Num,0);
    
   
    for(int i=0;i<Num;i++){
        int v,w;
        cin >> v >>w;
        W[i] = w;
        V[i] = v;
        }
    cout << cal(Num,Wei) <<endl;
}





Measured memory_bytes: 6844
/*
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vvll vector<vll>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define pii pair<int, int>
#define vpli vector<pair<long long, int>>
#define deb(x) cout << "deb " << #x << " " << x << endl
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define endl "\n"
template <typename T>
void printvec(vector<T> &v, int n, int start = 0)
{
    //cout << "\nprinting vector\n";
    for (int i = start; i < n; i++)
    {
        cout << v[i] << " ";
    }
    cout << "done printing";
    cout << endl;
}
const int mod = 1e9 + 7;
vi r,g,b;
int s,t,u;
int dp(int l,int m,int n)
{
    int cnt = (bool)(l==s) + (bool)(l==t) + (bool)(c==u);
    if(cnt>=2)
    {
        return 0;
    }
    if(a == s)
    {
        return g[b]*b[]
    }
}
void solve()
{
    
    cin>>s>>t>>u;
    r.resize(s);
    g.resize(t);
    b.resize(u);
    for(int &x : r) cin>>x;
    for(int &x : g) cin>>x;
    for(int &x : b) cin>>x;
    sort(all(r),greater<int>());
    sort(all(g),greater<int>());
    sort(all(b),greater<int>());
    cout<<dp(0,0,0)<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }

    return 0;
}
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vvll vector<vll>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define pii pair<int, int>
#define vpli vector<pair<long long, int>>
#define deb(x) cout << "deb " << #x << " " << x << endl
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define endl "\n"
template <typename T>
void printvec(vector<T> &v, int n, int start = 0)
{
    //cout << "\nprinting vector\n";
    for (int i = start; i < n; i++)
    {
        cout << v[i] << " ";
    }
    cout << "done printing";
    cout << endl;
}

void solve()
{
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    ll bsteps = x / d;
    if (bsteps >= k)
    {
        cout << (x - k * d) << endl;
    }
    else
    {
        k = k -bsteps;
        ll ans = x-bsteps*d;
        if(k%2)
        {
            cout<<min(abs(ans+d),abs(ans-d))<<endl;
        }
        else
        {
            cout<<ans<<endl;
        }
    }
    
}

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

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

int a, b, c;
int i;
int x;
int n = 0;

int main() {
    cin >> a >> b >> c;
    x = a;
    for (i = 0; i < b - a + 1; i++) {
        if (c % x == 0) {
            n++;
            x++;
        } else {
            x++;
        }
    }
    cout << n << endl;
    return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


bool cx[60000], cy[60000];

int main(){
    string s;
    cin >> s;
    int x, y;
    cin >> x >> y;
    int n = s.size();
    int m = 0, tmp = 0;

    vector<int> even, odd;

    rep(i, n){
        if (s[i] == 'F') tmp++;
        else {
            if (m%2 == 0) even.push_back(tmp);
            else odd.push_back(tmp);
            tmp = 0;
            m++;
        }
    }

    if (m%2 == 0) even.push_back(tmp);
    else odd.push_back(tmp);


    // rep(i, even.size()) cout << even[i] << " ";
    // cout << endl;
    // rep(i, odd.size()) cout << odd[i] << " ";
    // cout << endl;

    x += 30000, y += 30000;
    cx[30000+even[0]] = 1, cy[30000] = 1;

    for (int i = 1; i < even.size(); i++){
        bool ncx[60000] = {};
        rep(j, 60000){
            if (cx[j]) ncx[j+even[i]] = 1, ncx[j-even[i]] = 1;
        }
        memcpy(cx, ncx, sizeof(ncx));
    }

    for (int i = 0; i < odd.size(); i++){
        bool ncy[60000] = {};
        rep(j, 60000){
            if (cy[j]) ncy[j+odd[i]] = 1, ncy[j-odd[i]] = 1;
        }
        memcpy(cy, ncy, sizeof(ncy));
    }

    // rep(i, 60000) if (cx[i]) cout << i << " ";
    // cout << endl;
    // rep(i, 60000) if (cy[i]) cout << i << " ";
    // cout << endl;

    if (cx[x] && cy[y]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3820
N = int(input())
Xs = list(map(int, input().split()))

min_cost = float('inf')
for i in range(min(Xs), max(Xs)+1):
    cost = 0
    for x in Xs:
        cost += (x-i)**2
    if cost < min_cost:
        min_cost = cost

print(min_cost)


Measured memory_bytes: 3060
n = int(input())
a = list(map(int,input().split()))
b = [[0,0] for i in range (n)]
c = []
for i in range(n):
    b[i][1] = a[i]
    b[i][0] = i+1
b.sort(key=lambda x:x[1])
for i in range(n):
    c.append(b[i][0])
print(*c)



Measured memory_bytes: 23616
a=int(input())
lis=sorted([sorted([f for f in input()]) for i in range(a)])
lis+=["w"]
kari=""
ans=0
cou=1
for i in lis:
  if kari!=i:
    ans+=cou*(cou-1)/2
    cou=1
    kari=i
  else:
    cou+=1
print(int(ans))

Measured memory_bytes: 25448
/**
 * @author: Jun
 * @date  : 03-14-2019
 **/
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define el '\n'
#define MOD 1000000007

int n, m;
int dp[10005][10];
const int c[10] = {0,2,5,5,4,5,6,3,7,6};
int a[10];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    cin >> n >> m;
    for(int i = 1; i <= m; i++){
        cin >> a[i];
        dp[c[a[i]]][a[i]] = 1;
    }

    sort(a+1, a+m+1);

    for(int i = 2; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(dp[i][a[j]]){
                for(int k = 1; k <= m; k++){
                    dp[i+c[a[k]]][a[k]] = max(dp[i+c[a[k]]][a[k]], dp[i][a[j]]+1);
                }        
            }
        }
    }

    int idx = 0;
    for(int i = n; i; i -= c[a[idx]]){
        idx = 0;
        for(int j = 1; j <=m; j++){
            if(dp[i][a[j]] && dp[i][a[idx]] <= dp[i][a[j]]){
                idx = j;
            }
        }
        cout << a[idx];
    }
    cout << el;

    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
 
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
 
#define INF 1000000000
 
using namespace std;
 
int main() {
    string s;
    cin >> s;
 
    int K;
    cin >> K;
 
    vector<string> res;
 
    for (int i = 0; i < s.size(); i++) {
        res.push_back(s.substr(i));
    }
 
    sort(ALL(res));
 
    for (int i = 0; i < res.size(); i++) {
        int offset = 0;
        if (i > 0) {
            for (int k = 0; k < min(res[i - 1].size(), res[i].size()); k++) {
                if (res[i - 1][k] == res[i][k]) {
                    offset++;
                } else {
                    break;
                }
            }
        }
 
        if (K <= (res[i].size() - offset)) {
            cout << res[i].substr(0, K + offset) << endl;
            return 0;
        } else {
            K -= res[i].size() - offset;
        }
    }
 
    return 0;
}

Measured memory_bytes: 16128
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n, k;
    cin >> n >> k;
    vll a(n);
    rep(i, n) cin >> a[i];
    vb ans;
    for(ll i = 0; i + k < n; i++) {
        if(a[i + k] > a[i]) ans.push_back(true);
        else ans.push_back(false);
    }
    for(auto b : ans) cout << (b ? "Yes" : "No") << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int n, h;
  cin >> n >> h;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i) >> b.at(i);
  }
  sort(a.begin(), a.end());
  int p = a.at(n-1);
  sort(b.begin(), b.end());
  vector<bool> c(n, false);
  for (int i = 0; i < n; i++) {
    if (b.at(i) >= p) c.at(i) = true;
  }
  int ans = 0, q = n-1;
  while (h > 0 && q >= 0) {
    if (c.at(q)) {
      h -= b.at(q);
      q--;
      ans++;
    }
    else break;
  }
  if (h > 0) {
    if (h%p == 0) ans += h/p;
    else ans += h/p+1;
  }
  cout << ans << endl;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}
//long long int ruizyo(long long int aa, long long int bb){
  //  if(aa==0){
    //    return 1;
    //}
    //else if(aa%2==0){
      //  long long int tt=ruizyo(aa/2,bb);
        //return (tt*tt)%MOD;
    //}
    //else{
      //  return (ruizyo(aa-1,bb)*bb)%MOD;
    //}
//}フェルマ－のア


//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

//visited=vector<vector<bool>>(10,vector<bool>(10,false));アを全部falseに


long long int n,cnt=0,ans=0,a,b,c,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;

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

       cin >> n>>m;
       ans=(n-2)*(m-2);
       if(ans<0){
           if(n-2<0&&m-2>0){
               Cout(m-2);
           }
           else if(n-2>0&&m-2<0){
               Cout(n-2);
           }
           else{
               Cout(0);
           }
       }
       else{
           Cout(ans);
       }
      
return 0;
}


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

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

    double ans = 0;
    for(int i = 1; i <= N; i++){
        int score = i;
        double poss = 1;

        while(score < K){
            poss *= 0.5;
            score *= 2;
        }
        ans += poss;
    }

    printf("%.10f\n", ans / N);

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		String data;
		while ((data = reader.readLine()) != null) {
			double a = Double.parseDouble(data);
			double y = Math.pow(a / 9.8, 2) * 4.9;
			System.out.println((int)(Math.ceil((y + 5) / 5)));
		}
	}
}

Measured memory_bytes: 15076
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int> 

int main(){
  int N; cin >> N;
  int a;
  vector<int> A(N); 
  rep(i,N) {
    cin >> a;
    A[a-1] = i+1;
  }
  rep(i,N) {
    cout << A[i];
    if (i!=N-1) cout << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;


int main(){
    vector<int> v(5);
    for(int i=0;i<5;i++)cin>>v[i];
    int ans=0,cur=10;
    for(int i=0;i<5;i++){
        if(v[i]%10){ans+=(v[i]/10+1)*10;cur=min(cur,v[i]%10);}
        else ans+=v[i];
    }
    cout<<ans-(10-cur);
}

Measured memory_bytes: 256
//
//  main.cpp
//  1234
//
//  Created by Moha Jain on 14/04/20.
//  Copyright © 2020 Moha Jain. All rights reserved.
//

#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<stack>
#include<algorithm>
#include<string>
#include<math.h>
#include <iomanip>
#include <numeric>
#define _USE_MATH_DEFINES

using namespace std;




int main()
{
     int n;cin>>n;
     int a[n];
    
    unordered_map<int,int>mp;
    unordered_map<int,int>mark;
    int maxm = -1 , count=0;
   
    for(int i=0;i<n;i=i+1)
    {cin>>a[i];mp[a[i]]++;maxm=max(maxm,a[i]);}
    
    for(auto i : mp)
    {
      
            for(int j=2*i.first;j<=maxm;j+=i.first)
            {
                if(mp.find(j)!=mp.end()) mark[j]++;
            }
        
    }
    
    for(int i=0;i<n;i=i+1)
    {
        if(mp[a[i]]==1)
        {
            //count++;
            if(mark[a[i]]==0)count++;
        }
    }
    cout<<count<<endl;
    //cout<<maxm<<endl;
    
}




Measured memory_bytes: 20608
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main() {

    int N;
    cin >> N;

    vector<double> as;
    double a;

    double s = 0;

    for (int i = 0; i < N; ++i) {
        cin >> a;
        s = s + ((double) 1 / a);
    }


    cout << fixed << setprecision(10) << 1 / s << "\n";


    return 0;
}


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

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

int vector_finder(std::vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

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

  VI v(0);
  FOR(i,1,9){
    FOR(j,1,9){
      v.push_back(i*j);
    }
  } 

  if(vector_finder(v,n)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
import sys
from math import gcd

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def main():
    A, B = map(int, readline().split())

    g = gcd(A, B)
    factors = prime_factorize(g)

    print(len(set(factors)) + 1)
    return


if __name__ == '__main__':
    main()


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

int main() {
  string X,Y;
  cin >> X >> Y;
  int count = 0;
  for (int i = 0; i < X.size(); i++) {
    if (X.at(i) != Y.at(i))
      count++;
  }
  cout << count << endl;
}



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

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

	#ifdef LOCAL_DEFINE
	freopen("input.txt", "rt", stdin);
	#endif

	int n, m;
	cin >> n >> m;

	pair<int, int> P[m];
	
	for(int i = 0; i < m; i++) cin >> P[i].second >> P[i].first;
	sort(P, P + m);
	for(int i = 0; i < m; i++) swap(P[i].first, P[i].second);	

	int pos = -1, ans = 0;
	for(int i = 0; i < m; i++) {
		if(P[i].first >= pos) {
			ans++;
			pos = P[i].second;
		}
	}
	
	cout << ans << endl;

	#ifdef LOCAL_DEFINE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
	#endif	

	return 0;
}

Measured memory_bytes: 1024
s=int(input())
a=s//100
b=s-a*100
if a<13 and b<13 and a>0 and b>0:
    print("AMBIGUOUS")
elif a<13 and a>0:
    print("MMYY")
elif b<13 and b>0:
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>


#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  ll b;
  while(cin >> b, b){
    ll N = 0, A = 0;
    for(ll n = 1; n <= sqrt(2 * b); n++){
      ll a = ((2 * b) / n -n + 1) / 2;
      if(2 * b == n * (n + 2 * a - 1)){
	if(N < n){
	  N = n;
	  A = a;
	}
      }
    }
    cout << A << " " << N << endl;
  }
  return 0;
}



Measured memory_bytes: 3036
N, M = gets.chomp.split.map(&:to_i)
Submit = Struct.new(:task, :result)
submits = Array.new(M) { Submit.new(*gets.chomp.split) }

corrects = {}
errors = Hash.new {|h, k| h[k] = 0 }

submits.each do |submit|
  case submit.result
  when 'AC'
    corrects[submit.task] = true
  when 'WA'
    next if corrects[submit.task]
    errors[submit.task] += 1
  end
end

error = corrects.keys.map {|key| errors[key].to_i}.reduce(:+).to_i

puts "#{corrects.size} #{error}"


Measured memory_bytes: 36476
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 1e5
#define INF 1<<30
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;
int main() {
	ll r, d, x;
	cin >> r >> d >> x;
	for (int i = 0; i < 10; i++) {
		x = r * x - d;
		cout << x << endl;
	}
}


Measured memory_bytes: 256
//??-2015-11-1
/*
?意：
在H * W的矩形果?里有苹果、梨、蜜柑三?果?， 相?（上下左右）的同?果?属于同一个区域，?出果?的果?分布，求?共有多少个区域。 （原?的??中苹果?リ，梨?カ，蜜柑?ミ， ?中共10个区域）
?入：
多?数据，??数据第一行??个整数H，W（H <= 100, W <= 100）， H = 0 且 W = 0代表?入?束。以下H行W列表示果?的果?分布， 苹果是@，梨是#， 蜜柑是*。
?出：
?于??数据，?出其区域的个数。
*/
# include <cstdio>
# include <algorithm>
# include <stack>
# include <string>
# include <iostream>
# include <cstring>

using namespace std;
int direction[4][2] = { { -1, 0 }, { 1, 0 }, { 0, -1 }, {0,1} };             //方向，上下左右
int H, W;
int vis[105][105];
string s[105];
struct node
{
	int w, h;
}node1[10005];
void DFS(int i, int j)
{
	stack<node>S;
	int k, z;
	char c = s[i][j];
	node temp;
	temp.h = i;
	temp.w = j;
	vis[temp.h][temp.w] = 1;
	S.push(temp);

	while (!S.empty())                            //?不空的?
	{
		node temp1 = S.top();
		S.pop();
		for (k = 0; k < 4; k++)
		{
			if (temp1.h + direction[k][0] >= 0 && temp1.h + direction[k][0] < H&&temp1.w + direction[k][1] >= 0 && temp1.w + direction[k][1] < W &&!vis[temp1.h + direction[k][0]][temp1.w + direction[k][1]] && s[temp1.h + direction[k][0]][temp1.w + direction[k][1]] == c)   //没有越界，并且没有???，和原来的符号一??，就入?
			{
				node temp2;
				temp2.h = temp1.h + direction[k][0];
				temp2.w = temp1.w + direction[k][1];
				vis[temp2.h][temp2.w] = 1;                              //在入?的?候就??
				S.push(temp2);
			}
		}
	}
}
int main(void)
{
	//freopen("in.txt", "r", stdin);
	
	while (scanf("%d%d", &H, &W) != EOF&&H&&W)
	{
		memset(vis, 0, sizeof(vis));
		int i, j,count_number = 0;
		getchar();
		for (i = 0; i < H; i++)
		{
			cin >> s[i];
		}
		for (i = 0; i < H; i++)
		{
			for (j = 0; j < W; j++)
			{
				if (!vis[i][j])
				{
					DFS(i, j);
					count_number++;
				}
			}
		}
		printf("%d\n", count_number);
	}
	return 0;
}

Measured memory_bytes: 1364
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Pair = pair<int, int>;
using Vec = vector<int>;
using Graph = vector<Vec>;

int n;
Vec x;
Vec y;
Vec perm;

ld		calc_distance(int a, int b)
{
	return (sqrt(pow(x[a]-x[b], 2) + pow(y[a]-y[b], 2)));
}

int		factorial(int num)
{
	if (num <= 0)
		return (1);
	return (factorial(num - 1) * num);
}

int		main(void)
{
	cin >> n;
	x = Vec(n);
	y = Vec(n);
	perm = Vec(n);
	for (int i = 0; i < n; i++)
	{
		cin >> x[i] >> y[i];
		perm[i] = i;
	}
	bool f = true;
	ld average = 0;
	int factn = factorial(n);
	while (f)
	{
		ld distance = 0;
		for (int i = 1; i < n; i++)
			distance += calc_distance(perm[i-1], perm[i]);
		average += distance / factn;
		f = next_permutation(perm.begin(), perm.end());
	}
	cout << setprecision(10) <<  average << endl;
}




Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i=0;i<=n/4;i++){
        if((n-4*i)%7==0) {
            yes;
            return 0;
        }
    }
    no;
}

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

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

  double L;
  cin >> L;
  double ans = 0;
  double d = 0.1;
  if(L == 1) d = 0.0001;
  if(1 < L && L <= 10) d = 0.001;
  if(10 < L && L <= 100) d = 0.01;

  for (double i = 0; i < L; i+=d)
  {
    for (double j = 0; j < L - i; j+=d)
    {
      double v = i*j*(L - i - j);
      ans = max(ans, v);
    }
  }
  cout << fixed << setprecision(10);
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i=(a); i<(b); i++)

int main() {
  int N;
  cin >> N;
  int64_t temp = 1;
  FOR(i,0,N) temp = (temp * (i+1)) % 1000000007;
  cout << temp << endl;
  return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

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


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll N, T; std::cin >> N >> T;
  std::vector<int> a(N); rep(i,N) std::cin >> a[i];

  int a_max = -1, a_diff_max = -1, res = 0;
  for (int i = N - 1; i >= 0; i--) {
    a_max = std::max(a_max, a[i]);

    if (a_diff_max < a_max - a[i]) {
      a_diff_max = a_max - a[i];
      res = 1;
    } 
    else if (a_diff_max == a_max - a[i]) res++;
  }

  std::cout << res << std::endl;
  return 0;
}


Measured memory_bytes: 640