akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

ll gcd(ll x, ll y)
{
  if (x % y == 0)
  {
    return y;
  }
  return gcd(y, x % y);
}

int main()
{
  ll A;
  cin >> A;
  cout << A*800-A/15*200 << endl;
  return 0;
}

Measured memory_bytes: 384
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
x,y = readInts()
ans = float('inf')
if x <= y:
    ans = min(ans, y - x)
if x <= -y:
    ans = min(ans, 1 + -y - x)
if -x <= y:
    ans = min(ans, y + x + 1)
if -x <= -y:
    ans = min(ans, -y + x + 2)
print(ans)


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

using namespace std;

typedef long long ll;
const int mod = 1e9+7;


int main(){
	int n, k; cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; ++i) cin >> a[i];
	vector<ll> dp(k+1, 0);
	dp[0] = 1;
	for(int &i : a){
		vector<ll> fake(k+1, 0);
		for(int j = k; j >= 0; --j){
			int tmp = dp[j];
			int L = 1 + j;
			int R = min(k, j  + i);
			if(L <= R){
				fake[L] += tmp; fake[L] %= mod;
				if(R < k){
					fake[R+1] -= tmp; if(fake[R+1] < 0) fake[R+1] += mod;
				}
			}
		}
		ll sum = 0;
		for(int i = 0; i <= k; ++i){
			sum += fake[i]; sum %= mod;
			dp[i] += sum; dp[i] %= mod;
		}
	}
	cout << dp[k];
}

Measured memory_bytes: 4788
/**
 * @author torith
 * @date 2018-10-13
 */

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    string s,t;
    cin >> s;
    cin >> t;

    int ans = 2 * N;
    string tmp;
    for (int i = 1; i <= N; ++i) {
        tmp = s.substr(N-i,i);
        if (tmp == t.substr(0,i)){
            ans = 2 * N - i;
        }
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int len = s.size();
    if(len == 2)cout<<s;
    else if(len == 3){
        for(int i = len-1; i >=0 ; i--)cout<<s[i];
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

class UnionFind {
    struct UFNode {
        int par;
        int rank;
    };
    vector<UFNode> nodes;
public:
    UnionFind(int n): nodes(n) {
        for (int i = 0; i < n; i++) {
            nodes[i].par = i;
            nodes[i].rank = 0;
        }
    };
    int root(int x) {
        return nodes[x].par == x ? x : root(nodes[x].par);
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (nodes[x].rank < nodes[y].rank) {
            nodes[x].par = y;
        } else {
            nodes[y].par = x;
            if (nodes[x].rank == nodes[y].rank) nodes[x].rank++;
        }
    }
    //~UnionFind() {cout << nodes.size() << endl;}
};

void solve() {
    int n,m;
    cin >> n >> m;
    int a,b;
    UnionFind uf(n);
    REP(i,0,m) {
        cin >> a >> b;
        --a;--b;
        uf.unite(a,b);
    }
    VI cnt(n);
    REP(i,0,n) cnt[uf.root(i)]++;
    cout << *max_element(all(cnt)) << endl;
}

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

Measured memory_bytes: 5632
#include<stdio.h>
int main(){
	int n,m,i,maxN,max;
	for(i=0;scanf("%d %d",&n,&m)&&(n||m);i++){
		if(!(i%5))max=-1;
		if(n+m>max){
			max=n+m;maxN=i%5;}
		if(i%5==4)printf("%c %d\n",'A'+maxN,max);
	}return 0;}

Measured memory_bytes: 0
N = int(input())
A = list(map(int, input().split()))

for i in range(1,N+1):
    A[i-1] -= i
A.sort()

if N % 2 == 1:
    ans = 0
    for i in A:
        ans += abs(i - A[N//2])
else:
    ans = 0
    ansk = 0
    for i in A:
        ans += abs(i - A[N//2])
        ansk += abs(i - A[N//2-1])
    ans = min(ans, ansk)

print(ans)


Measured memory_bytes: 26016
#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;
template <typename T> using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //greater<T> for sorting decreasingly

#define ll         long long
#define pll        pair<ll,ll>
#define unique(a)  a.resize(unique(a.begin(), a.end()) - a.begin())
#define fill(v, p) memset(v,p,sizeof v)
#define all(x)     x.begin(), x.end()
#define at_(x,i)   x.find_by_order(i)
#define koto_(x,i) x.order_of_key(i)
#define PI         acos(-1.0)
#define EPS        0.000000001
#define INF        1LL<<62
#define MAX        300005
#define MOD        1000000007


signed int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(0);
	
	ll h, a,n;
	cin >> h >> n;
	
	ll x, sum=0;
	for(int i=0;i<n;i++)
	{
		cin >>x;
		sum+=x;
	}
	
	if(h-sum<=0) cout << "Yes\n";
	else cout << "No\n";
	
	return 0;
}


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

#define mod 1000000007

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

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	double a, b, x, ans = 0;
	
	cin >> a >> b >> x;
	
	double theta1 = atan(2 * (a*a*b - x) / (a*a*a)) * 180 / M_PI;
	double theta2 = (M_PI / 2 - atan(2 * x / (a*b*b))) * 180 / M_PI;
	
	if(a*a*b/2 <= x)
		printf("%.8f", theta1);
	else
		printf("%.8f", theta2);

	return 0;
}

Measured memory_bytes: 256
N=int(input())
import math
def keta_count(x):
    count=0
    while x>0:
        x=x//10
        count+=1
    return count
    
a=1
ans=10000000000000
while a<=math.sqrt(N):
    b=N//a
    if a*b != N:
        a+=1
        continue
    _=max(keta_count(a),keta_count(b))
    ans = _ if _<ans else ans
    a+=1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main()
{
    int W, a, b;
    cin >> W >> a >> b;
    int ans;
    if(a < b)
    {
        ans = b-(a+W);
        if(ans < 0)
            cout << 0;
        else cout << ans;
    }
    else if(a > b)
    {
        ans = a-(b+W);
        if(ans < 0)
            cout << 0;
        else cout << ans;
    }
    else cout << 0;
    return 0;
}


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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;


ll dp[2005][2005];



int main() {

	ll n, m;
	cin >> n >> m;

	ll ans = 0;

	dp[0][0] = 1;

	VI s(n);
	VI t(m);
	REP(i, n)cin >> s[i];
	REP(i, m)cin >> t[i];
	REP(i, 2005) {
		dp[i][0] = 1;
		dp[0][i] = 1;
	}

	REP(i, n) {
		REP(j, m) {
			dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j] - dp[i][j];
			if (s[i] == t[j])dp[i + 1][j + 1] += dp[i][j];
			dp[i + 1][j + 1] += mod;
			dp[i + 1][j + 1] %= mod;
		}
	}


	cout << dp[n][m] << endl;



}




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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;
const ll MOD = 1e9 + 7;


int main() {
    string s, t; cin >> s >> t;

    int n = s.size();

    map<char, int> m1, m2;
    for(int i = 0; i < n; i++){
        m1[s[i]]++;
        m2[t[i]]++;
    }

    if(m1.size() != m2.size()){
        cout << "No" << endl;
        return 0;
    }

    V<int> v1, v2;
    for(auto p : m1) v1.push_back(p.second);
    for(auto p : m2) v2.push_back(p.second);

    sort(ALL(v1));
    sort(ALL(v2));

    for(int i = 0; i < (int)v1.size(); i++){
        if(v1[i] == v2[i]) continue;
        else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

}


Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a;cin>>n;
  map<int, int>mp;
  for(int i=1;i<n;++i){
    cin>>a;
    ++mp[a];
  }
  for(int i=1;i<=n;++i){
    cout<<mp[i]<<endl;
  }
}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	int ans = 1e9;
	for (int i = 0; i < N; ++i) {
		int n;
		cin >> n;
		int count = 0;
		while (0 == n % 2) {
			count++;
			n /= 2;
		}
		ans = min(ans, count);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
#define INF 10000000000

int main() {
	int x, y, crane, turtle;
	string ans = "No";
	cin >> x >> y;

	for (int i = 0; i < x+1; i++) {
		crane = i;
		turtle = x - i;
		if (crane * 2 + turtle * 4 == y) {
			ans = "Yes";
			break;
		}
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 3636
import sys

input = sys.stdin.readline

def main():
    N = int(input())
    a = list(map(int, input().split()))
    if not 1 in a:
        print(-1)
        exit()
    f = a.index(1)
    c = 2
    ans = f-1
    for i in range(f,N):
        if a[i] == c:
            c += 1
        else:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

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

using namespace std;

int main(void){
  int n, t;
  long long sum;
  vector<pair<int, int> > v;

  while(cin >> n, n){
    v.clear();

    for(int i=0; i<n; i++){
      cin >> t;
      v.push_back(make_pair(t, 0));
    }
    sort(v.begin(), v.end());

    for(int i=1; i<n; i++){
      v[i].second = v[i-1].first + v[i-1].second;
    }

    sum = 0;
    for(int i=0; i<n; i++){
      sum += v[i].second;
    }

    cout << sum << endl;
  }

  return 0;
}

Measured memory_bytes: 1324
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

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



		for (int i = 0; i <= 9; i++) {
			int d = a * c - b;
			 c = d;

			 int p = a * c - b;



			System.out.println(d);
		}


	}

}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define pi acos(-1.0)
#define ms(a, x) memset(a, x, sizeof(a))
#define lowbit(x) ((x)&(-(x)))
#define pb push_back
#define binarycount __builtin_popcount(x)
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define debug(x) cout<<x<<'\n'
#define pii pair<ll,pair<ll,ll> >
using namespace std;
const int inf = 0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9+7;
const double eps = 1e-8;
ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}
ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}
ll powmod(ll a,ll b){
    ll ans = 1, pow = a;
    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }
    return ans;
}
ll mul(ll a,ll b){//大数取模乘法防止溢出
    ll ans=0;
    a%=mod,b%=mod;
    while(b) { if(b&1) ans = (ans+a)%mod; a = (a*2)%mod; b >>= 1; }
    return ans;
}
//(b/a)%p=b*a^(p-2)%p
int pr(ll num){//判断素数
     if(num == 1) return 0;
     if(num ==2|| num==3 ) return 1 ;
     if(num %6!= 1&&num %6!= 5) return 0 ;
     int tmp =sqrt( num);
     for(int i= 5;i <=tmp; i+=6 )
          if(num %i== 0||num %(i+ 2)==0 )return 0 ;
     return 1 ;
}
int Day(int y,int m, int d){
    if(m==1||m==2) { m+=12; y--; }
    int w=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7;
    return w+1;
}
inline int read() {
    int c = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        c = c * 10 + ch - '0';
        ch = getchar();
    }
    return c * f;
}

//#pragma comment(linker, "/STACK:1024000000,1024000000")//外挂开栈
//stable_sort 排序不处理相同元素
//map<int,int>::reverse_iterator rit;
//for(rit=mp.rbegin();rit!=mp.rend();rit++)
//vec动态二维数组
//vector<vector<int>> g(26,vector<int>(100005));
//初始化vec里面套了n个vec

//lower_bound(begin,end,num) 有序数列中返回第一个>=num的数字的地址
//upper_bound( begin,end,num) 返回第一个>num的数字的地址

const int maxn=1e5+5;
int h[maxn];
int v[maxn]={0};
int main(){
    int n,m;
    cin>>n>>m;
    int ans=0;
    for(int i=1;i<=n;++i) cin>>h[i];
    int a,b;
    for(int i=0;i<m;++i){
        cin>>a>>b;
        if(h[a]<h[b]) v[a]=1;
        else if(h[a]>h[b]) v[b]=1;
        else v[a]=v[b]=1;
    }
    for(int i=1;i<=n;++i){
        //cout<<v[i]<<" ";
        if(v[i]==0) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4408
a = 2, 3, 5

def f(n):
  m = memo.get(n)
  if m is None:
    m = d * n
    for p, c in zip(a, b):
      m = min(m, *(f(k) + abs(p * k - n) * d + c for k in {n // p, -(-n // p)}))
    memo[n] = m
  return m

t = int(input())
for _ in range(t):
  n, *b, d = map(int, input().split())
  memo = {0: 0, 1: d}
  print(f(n))


Measured memory_bytes: 11176
#include <stdio.h>
#include <inttypes.h>

int main(void) {
	uint64_t N;
	uint64_t a, sum = 0;
	if (scanf("%" SCNu64, &N) != 1) return 1;
	for (a = 1; a * a <= N; a++) {
		if (N % a == 0) {
			uint64_t m = N / a - 1;
			if (m > 0 && N % m == N / m) sum += m;
		}
		if (N % a == 0 && a != N % a) {
			uint64_t m = a - 1;
			if (m > 0 && N % m == N / m) sum += m;
		}
	}
	printf("%" PRIu64 "\n", sum);
	return 0;
}

/*

N = a * m + a

N = a * (m + 1)

m = N / a - 1


*/


Measured memory_bytes: 1720
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 1000000000
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, M, a[55], b[55], c[55], d[55];

  std::cin >> N >> M;

  for (int i = 0; i < N; i ++)
    std::cin >> a[i] >> b[i];

  for (int i = 0; i < M; i ++)
    std::cin >> c[i] >> d[i];

  for (int i = 0; i < N; i ++) {
    int dm = INF, jm = -1;
    
    for (int j = 0; j < M; j ++) {
      int dist = std::abs(c[j] - a[i]) + std::abs(d[j] - b[i]);

      if (dist < dm) {
        jm = j;
        dm = dist;
      }
    }

    std::cout << jm + 1 << std::endl;
  }
      
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
const ll mod=1e+9;
typedef pair<ll,ll> P;
#define fi first
#define se second

int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll n,m;
cin>>n>>m;
vector<P> a(n);
for(int i=0;i<n;i++){
cin>>a.at(i).fi>>a.at(i).se;
}
sort(a.begin(),a.end());
priority_queue<ll> q;
int j=0;
ll ans=0;
for(int i=0;i<=m;i++){
    while(1){
        if(j==a.size())break;
       if(a.at(j).fi<=i) q.push(a.at(j).se);
       else break;
       j++;
    }
    if(q.empty())continue;
    ans+=q.top();
    q.pop();
}
cout<<ans<<endl;
}


Measured memory_bytes: 2936
#include<bits/stdc++.h>
using namespace std;
char str[200010];
int main()
{
    scanf("%s", str);
    int A = -1, Z=0;
    for(int i=0;i<strlen(str);i++)
    {
         if(A==-1&&str[i]=='A') A = i;
         if(str[i]=='Z') Z=i;
    }
    printf("%d\n", Z-A+1);
} 

Measured memory_bytes: 384
N = int(input())
S = [input().strip() for i in range(N)]
T = input().strip()

lower = 1  # Tが入りうる番号の下限。先頭に入りうるので初期値1
upper = N + 1  # Tが入りうる番号の上限。末尾に入りうるので初期値N+
for s in S:
    # s中の'?'をすべて'a'に置き換えたものは先頭に来るし、
    # すべて'z'に置き換えたものは末尾に来る
    s_first = s.replace('?', 'a')
    s_last = s.replace('?', 'z')
    if T < s_first:
        upper -= 1  # sの取りうる最小値より小さい場合、上限が下がる
    if s_last < T:
        lower += 1  # sの取りうる最大値より大きい場合、下限が上がる

ans = ' '.join(map(str, range(lower, upper + 1)))
print(ans)

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll A[6] = {100, 101, 102, 103, 104, 105};
bool dp[100001];

bool solve(ll X){
    dp[0] = true;
    REP(i, 6){
        REP(j, 100001){
            if(j + A[i] > 100000) continue;
            dp[j + A[i]] |= dp[j];
        }
    }
    return dp[X];
}

signed main(){
    ll X;
    cin >> X;
    if(solve(X)) PRINT("1");
    else PRINT("0");
    return 0;
}

Measured memory_bytes: 3688
S = input()
n = 3

A,B,C,D = list(S)
import itertools
for ops in itertools.product(["+","-"],repeat=3):
    eq = A+ops[0]+B+ops[1]+C+ops[2]+D
    x = eval(eq)
    if x == 7:
        break
ans = eq+"=7"
print(ans)

Measured memory_bytes: 3060
let rec f () =
  let (x, y) = Scanf.scanf "%d %d\n" (fun x y -> x,y) in
  match (x, y) with
    (0, 0) -> ()
  | _ -> print_int @@ min x y; print_string " ";
    print_int @@ max x y; print_newline (); f ()

let () = f ()

Measured memory_bytes: 3284
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

const int MAX = 555;

int a[MAX][MAX];

int main(void) {
  int H, W, h, w;
  scanf("%d %d %d %d", &H, &W, &h, &w);

  if (H % h == 0 && W % w == 0) {
    puts("No");
    return 0;
  };

  REP(i, H) REP(j, W) a[i][j] = 1;
  for (int x = h-1; x < H; x += h)
    for (int y = w-1; y < W; y += w)
      a[x][y] = -h*w;

  while (true) {
    llint total = 0;
    REP(i, H) REP(j, W) total += a[i][j];
    
    if (total > 0) {
      puts("Yes");
      REP(i, H) {
        REP(j, W) printf("%d ", a[i][j]);
        printf("\n");
      }
      return 0;
    }

    REP(i, H) REP(j, W) a[i][j] *= 2;
    for (int x = h-1; x < H; x += h)
      for (int y = w-1; y < W; y += w)
        a[x][y]++;
  }
  return 0;
}


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


void solve(std::string S, std::string T){
  long long count = 0;
  for(long long i = 0; i < S.size(); i++){
    if(S[i] != T[i]) count++;
  }

  cout << count << endl;

}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
  std::cin >> S;
  std::string T;
  std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 4120
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long double PI = acos(-1.0);
// cout << fixed << setprecision(14);
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	int A[N];
	int sum = 0;
	rep(i,N){
		cin >> A[i];
		sum += A[i];
	}
	int ans = 0;
	sum %= MOD;
	rep(i,N){
		sum -= A[i];
		sum += MOD;
		ans += A[i] * sum;
		sum %= MOD;
		ans %= MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 5200
#include<bits/stdc++.h>
using namespace std;
signed main(){
  stack<int>a[10000];
  int b,c,d;
  int q,w;
  cin>>q>>w;
  for(int i=0;i<w;i++){
    cin>>b>>c;
    if(b==0) cin>>d,a[c].push(d);
    if(b==1) if(!a[c].empty()) cout<<a[c].top()<<"\n";
    if(b==2) if(!a[c].empty()) a[c].pop();
  }
}



Measured memory_bytes: 10440
S = input().strip()

T = "keyence"

if S.startswith(T) or S.endswith(T):
    print("YES")
    exit()

count = 0
j = 0
is_last = False
for i in range(0,len(S)):
    if j >= len(T):
        print("NO")
        exit()
    if T[j] == S[i]:
        j += 1
        continue
    elif T[j] != S[i]:
        print("YES" if S.endswith(T[j:]) else "NO")
        exit()

if j == len(T):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
#include<bits/stdc++.h> 
#define Pair pair<int, int>
#define MP(x, y) make_pair(x, y)
#define fi first
#define se second
//#define int long long 
#define LL long long 
#define Fin(x) {freopen(#x".in","r",stdin);}
#define Fout(x) {freopen(#x".out","w",stdout);}
//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)
char buf[(1 << 22)], *p1 = buf, *p2 = buf;
using namespace std;
const int MAXN = 2e5 + 10, mod = 998244353, INF = 1e9 + 10;
const double eps = 1e-9;
template <typename A, typename B> inline bool chmin(A &a, B b){if(a > b) {a = b; return 1;} return 0;}
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 LL add(A x, B y) {if(x + y < 0) return x + y + mod; return x + y >= mod ? x + y - mod : x + y;}
template <typename A, typename B> inline void add2(A &x, B y) {if(x + y < 0) x = x + y + mod; else x = (x + y >= mod ? x + y - mod : x + y);}
template <typename A, typename B> inline LL mul(A x, B y) {return 1ll * x * y % mod;}
template <typename A, typename B> inline void mul2(A &x, B y) {x = (1ll * x * y % mod + mod) % mod;}
template <typename A> inline void debug(A a){cout << a << '\n';}
template <typename A> inline LL sqr(A x){return 1ll * x * x;}
inline int read() {
    char c = getchar(); int x = 0, f = 1;
    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
LL N, E, T, a[MAXN], f[MAXN];
int main() {
	N = read(); E = read(); T = read();
	memset(f, 0x3f, sizeof(f));
	for(int i = 1; i <= N; i++) a[i] = read();
	f[0] = 0; f[1] = T;
	LL mn = 1e18, j = 0;
	for(int i = 2; i <= N; i++) {
		while(T <= 2 * (a[i] - a[j + 1])) chmin(mn, f[j] - 2 * a[j + 1]), j++;
		chmin(f[i], mn + 2 * a[i]);
		chmin(f[i], f[j] + T);
	}
	cout << f[N] + E;
    return 0;
}
/*
3 9 23333
1 3 8
*/

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>

using namespace std;


void devide_the_problems()
{
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; ++i) cin >> d[i];

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

  cout << d[n / 2] - d[n / 2 - 1] << "\n";
}


void remainder_minimization()
{
  long long int l, r;
  cin >> l >> r;

  if (r - l >= 2019)
  {
    cout << 0 << "\n";
    return;
  }

  int v_min = 2019;
  for (long long int i = l; i <= r - 1; ++i)
  {
    for (long long int j = l + 1; j <= r; ++j)
    {
      int tmp = (i * j) % 2019;
      if (v_min > tmp) v_min = tmp;
    }
  }

  cout << v_min << "\n";
}


void exeption_handling()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];

  vector<int> a_copy(a.size());
  for (int i = 0; i < a.size(); ++i) a_copy[i] = a[i];
  sort(a_copy.begin(), a_copy.end(),greater<int>());
  int v_max = a_copy[0], v_max_second = a_copy[1];

  for (int i = 0; i < n; ++i)
  {
    if (a[i] == v_max) cout << v_max_second << "\n";
    else cout << v_max << "\n";
  }
}


//skip
void city_savers()
{
  int n;
  cin >> n;
  vector<int> a(n + 1);
  vector<int> b(n);
  for (int i = 0; i < n + 1; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];


}


void build_stairs()
{
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) cin >> h[i];

  for (int i = n - 1; i > 0; --i)
  {
    if (h[i - 1] - h[i] > 1)
    {
      cout << "No" << "\n";
      return;
    }
    else if (h[i - 1] - h[i] == 1)
    {
      --h[i - 1];
    }
  }
  cout << "Yes" << "\n";
}


void green_bin()
{
  int n;
  cin >> n;
  map<string, int> S;
  for (int i = 0; i < n; ++i) 
  {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    S[s]++;
  }

  long long int ana_num = 0;
  for (auto value : S)
    for (int cnt = value.second - 1; cnt > 0; --cnt) 
      ana_num += cnt;
 
  cout << ana_num << "\n";
}


void alchemist()
{
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];

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

  double v_sum = v[0];
  for (int i = 1; i < n; ++i) v_sum = (v_sum + v[i]) / 2;

  cout << v_sum << "\n";
}


void lower_atc()
{
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) cin >> h[i];


  int tmp = 0, v_max = 0;
  for (int i = 0; i < n; ++i)
  {
    if ((i != n - 1) && h[i] >= h[i + 1]) ++tmp;
    else
    {
      v_max = max(v_max, tmp);
      tmp = 0;
    }
  }

  cout << v_max << "\n";
}


void maximal_value()
{
  int n;
  cin >> n;
  vector<int> b(n - 1);
  for (int i = 0; i < n - 1; ++i) cin >> b[i];

  vector<int> a(n);
  for (int i = 0; i < n; ++i)
  {
    if (i == 0)          a[i] = b[i];
    else if (i == n - 1) a[i] = b[i - 1];
    else                 a[i] = min(b[i - 1], b[i]);
  }

  cout << accumulate(a.begin(), a.end(), 0) << "\n";
}


int main()
{
  devide_the_problems();
  //remainder_minimization();
  //exeption_handling();
  //city_savers();
  //build_stairs();
  //green_bin();
  //alchemist();
  //lower_atc();
  //maximal_value();
}


Measured memory_bytes: 640
//Atcoder Biginner Contest 172 B問題

#include <stdio.h>

#define LENGTH 300000

int main(void) {
    char n[LENGTH];
    char m[LENGTH];
    int count = 0;

    scanf("%s", n);
    scanf("%s", m);

    for (int i = 0; n[i] != '\0'; i++) {
        if (n[i] != m[i]) {
            count += 1;
        }
    }

    printf("%d\n", count);

    return 0;
}


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

int main(){
  int64_t A, B, M; cin >> A >> B >> M;
  vector<int> a(A);
  vector<int> b(B);
  int c[M][3];
  for(int i=0;i<A;i++){
    cin >> a[i];
  }
   for(int i=0;i<B;i++){
    cin >> b[i];
  }
  for(int i=0;i<M;i++){
    cin >> c[i][0] >> c[i][1] >> c[i][2];
  }
  vector<int> m(M);
  for(int i=0;i<M;i++){
    m[i]=a[c[i][0]-1]+b[c[i][1]-1]-c[i][2];
  }
  sort(m.begin(),m.end());
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  cout << min(m[0],a[0]+b[0]) << endl;
  return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>

int main(void) {
  int N,i,count[2]={0,0};
  short int s[100000];
  char S[100001];
    scanf("%s",&S);
  for(i=0;i<100001;i++) {
    if(S[i]=='0')s[i]=0;
    else if(S[i]=='1')s[i]=1;
    else{
      N = i;
      i = 100001;
    }
  }
  for(i=0;i<N;i++) {
    count[s[i]]++;
  }
  if(count[0]<count[1])printf("\n%d\n",count[0]*2);
  else printf("\n%d\n",count[1]*2);
}

Measured memory_bytes: 512
K = int(input())
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]
print(a[K-1])

Measured memory_bytes: 3316
#include <stdio.h>

int main() {
	int n;
	int a[5000];
	long temp;
	long max;
	
	int i, j;

	scanf("%d", &n);

	while(n) {
		max = -100000;
		for(i = 0; i < n; i++)
			scanf("%d", &a[i]);

		for(i = 0; i < n; i++) {
			temp = 0;
			for(j = i; j < n; j++) {
				temp += a[j];
				
				if(temp > max)
					max = temp;
			}
		}

		printf("%ld\n", max);
		
		scanf("%d", &n);
	}

	return 0;
}

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

double cross(complex< double > a, complex< double > b){
	return a.real() * b.imag() - a.imag() * b.real();
}

int main() {
	int n,x,y,convex;
	vector< complex< double > > vertex;
	
	cin >> n;
	vertex.resize(n);
	for(int i=0;i<n;++i){
		cin >> x >> y;
		vertex[i] = complex< double >(x, y);
	}
	
	convex = 1;
	for(int i=0;i<n;++i){
		if(cross(vertex[(i+1)%n]-vertex[i], vertex[(i+2)%n]-vertex[(i+1)%n]) < 0){
			convex = 0;
			break;
		}
	}
	cout << (convex ? 1 : 0) << endl;
	
	return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i,n)
    cin >> h[i];
  vector<int> dp(n);
  dp[1]=abs(h[1]-h[0]);
  for(int i=2; i<n; i++)
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
  cout << dp[n-1] << endl;
  return 0;
}


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

int main(){
  int S;
  cin >> S;
  if (S <= 9 ){
  cout << S;
  }else if (10 <= S && S <=99){
  cout << "9";
  }else if (100 <= S && S <= 999){
  cout << S - 90;
  }else if (S >= 1000 && S <= 9999 ){
  cout << 909;
  }else if (10000 <= S && 99999 >= S){
  cout << S - 9090;
  }else{
  cout << 90909;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
          int H,W,i,j,k;

          for(k=0;;k++)
          {
                    scanf("%d %d",&H,&W);
           if(H==0&&W==0)
                    {
                              break;
                    }
          for(i=1;i<=H;i++)
          {
                    for(j=1;j<=W;j++)
                    {
                              if((i%2==0)&&(j%2==0)||((i%2==1)&&(j%2==1)))
                              printf("#");
                              else
                                        printf(".");
                    }
                    printf("\n");
          }
          printf("\n");
          }
          return 0;
}



Measured memory_bytes: 2096
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
    static long mod=1000000007;
    
    public static void main(String[] args) {        
        new Thread(null, new Main(), "", 200 * 1024 * 1024).start();        
    }

    public void run() {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n=sc.nextInt();
        long n=sc.nextLong();
        long a=sc.nextLong();
        long b=sc.nextLong(),q,r;
        q=n/(a+b);
        r=n-n/(a+b)*(a+b);
        

        out.println(q*a+min(r,a));
     	out.flush();
    }
    
    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }

    static void ret(long ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x,y; double d;
//	P(int  x, int y, double d) {
//	  this.x=x;
//	  this.y=y;
//	  this.d=d;
//	}
//}


class P implements Comparable<P>{
    int p,h,f; long m;
    P(int p,int h, int f, long m) {
    	this.p=p;
    	this.h=h;
    	this.f=f;
    	this.m=m;
    }

    public int compareTo(P p){
    	if(this.p==p.p) {
    		if(this.f==-1) return 1;
    		return -1;
    	}
        return this.p-p.p;
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString()
    {
        while( st==null || !st.hasMoreTokens() )
			try {
				st = new StringTokenizer(x.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        return st.nextToken();
    }
    public int nextInt()
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) {
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) {
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() {
        return this.nextString().toCharArray();
    }    
    public long nextLong()
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


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

using namespace std;

typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long double ld;

const int inf = 1e9;
const ll inf64 = 1e18;

int main() {

#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif

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

    int h1, m1, h2, m2, k;

    cin >> h1 >> m1 >> h2 >> m2 >> k;

    int t1 = h1 * 60 + m1;
    int t2 = h2 * 60 + m2;
    int dist = t1 <= t2 ? t2 - t1 : 24 * 60 - t1 + t2;

    cout << max(0, dist - k) << "\n";

    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n, c=0, m;
        bool flag = 0;
  	cin >> n;
        int k=(int)sqrt(n)+2;
	vector<int> a(k);
	m = n;
	for(int i=0;i<k;i++){
		a[i] = 0; 
	}
	while(n!=1){
                if(flag){
                         break;
                }
		for(int i=2;i<=n;i++){
                        if(m < i*i){
                                a[c+1] = n;
                                flag = 1;
                                break;
                         }
                        
                         
			if(n%i==0){
				n /= i;
				c++;
				a[c] = i;
				break;
			}
		}
	}
	cout<< m<<":";
	for(int i=0;i<k;i++){
		if(a[i]!=0){
			cout<< " "<<a[i];
		}
		
	}
	cout<<endl;
}


Measured memory_bytes: 3212
// #define STOPIT
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

void debug_impl() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
    #define debug(...)\
    do {\
        cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        cerr << std::noboolalpha;\
    } while (false)
#else
    #define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr>
istream& operator>> (istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr >
ostream& operator<< (ostream& os, Container const& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}
int main()
{
    int N, K, S;
    cin >> N >> K >> S;

    int not_S = (S==1000000000)? S-1: S+1;
    rep(i, 0, N)
    {
        if (i<K) cout << S << ' ';
        else cout << not_S << ' ';
    }
    cout << endl;

    return 0;
}


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

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	int n, co0 = 0;
	while (cin >> n && n != 0) {
		vector<int> k(n);
		int co0 = 0;
		for (int i = 0; i < n; ++i) {
			cin >> k[i];
			if (k[i] == 0) co0++;
		}
		sort(all(k));
		if (k[n-1] < 2) {
			cout << "NA" << endl;
			continue;
		}
		cout << n + 1 - co0 << endl;
	}

	return 0;
}

Measured memory_bytes: 3188
result=[]
while True:
    m, f, r=(int(x) for x in input().split())
    if(m==f==r==-1):
        break
    if m<0 or f<0:
        result.append("F")
    elif(m+f>=80):
        result.append("A")
    elif(m+f>=65):
        result.append("B")
    elif(m+f>=50):
        result.append("C")
    elif(m+f>=30):
        if(r>=50):
            result.append("C")
        else:
            result.append("D")
    else:
        result.append("F")
for grade in result:
    print(grade)


Measured memory_bytes: 5600
#include "iostream"

using namespace std;

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

	int x, y = 0, z = 0, ans;
	for (int i = 1; i <= n; i++) {
		x = i;
		while (x % 2 == 0) {
			x /= 2;
			y++;
		}
		if (z <= y) {
			z = y;
			ans = i;
		}
		y = 0;
	}

	printf("%d", ans);
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	ll n;cin>>n;
	ll ans=0;
	for(ll i=1;i<=n;i++){
		ll p = n/i;
		ll k = (p*((p+1)*i))/2;
		ans += k;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3648
<?php
# 入力部
// fscanf(STDIN, "%s", $n);
fscanf(STDIN, "%d %d %d", $x, $y, $z);
// $s1 = fgets(STDIN); //"\n"の2文字
// $s2 = fgets(STDIN);
// fscanf(STDIN, "%d", $n);
// fscanf(STDIN, "%s", $s);
// fscanf(STDIN, "%s", $s2);

# 処理部
// $arr1 = str_split($s1);
// $arr2 = str_split($s2);
// $arr1 = explode(" ", $s1);
// $arr2 = explode(" ", $s2);
// for ($i = 0; $n > $x * $i; $i++) {
// }
// if (strpos($s, 'RRR') !== false) {
//   $r = 3;
// } elseif (strpos($s, 'RR') !== false) {
//   $r = 2;
// } elseif (strpos($s, 'R') !== false) {
//   $r = 1;
// } else {
//   $r = 0;
// }
// $s = "No";
// if ($x >= 30) {
//   $s = "Yes";
// }
// for ($i = 0; $i * 1000 < $n; $i++) {
// }
// $c = "a";
// if (ctype_upper($a)) {
//   $c = "A";
// }
// $s = "Yes";
// echo count($arr1);
// for ($i = 0; $i < strlen($s1); $i++) {
//   if ($arr1[$i] != $arr2[$i]) {
//     $s = "No";
//   }
// }
// $unit;
// switch ($n % 10) {
//   case 0:
//   case 1:
//   case 6:
//   case 8:
//     $unit = "pon";
//     break;
//   case 3:
//     $unit = "bon";
//     break;
//   default:
//     $unit = "hon";
//     break;
// }
// if ($s == "ABC") {
//   $r = "ARC";
// } else {
//   $r = "ABC";
// }
// $r = "NG";
// for ($i = $a; $i <= $b; $i++) {
//   if ($i % $k == 0) {
//     $r = "OK";
//   }
// }
// $r = "safe";
// if ($s <= $w) {
//   $r = "unsafe";
// }
// $r = "No";
// if (strpos($n, "7") !== false) {
//   $r = "Yes";
// }

# 出力部
// echo $r . "\n";
echo $z . " " . $x . " " . $y . "\n";
// echo ($i * 1000) - $n . "\n";

Measured memory_bytes: 15464
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        a: [i64;3]
    }

    let mut ret = 0;
    for i in 0..3 {
        if a[i] != a[(i+1)%3] && a[i] != a[(i+2)%3] {
            ret = a[i];
        }
    }
    println!("{}", ret);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
using ll = long long;
using P = pair<int, int>;
/* ------------------------------------------------ */
ll fact(int i) {       //階乗(i <= 20 まで)
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ------------------------------------------------ */

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<char>> mp(h, vector<char> (w));
    vvi ans(h,vi(w,-1));
    int x = 1;
    rep(i, h) {
        rep(j, w) {
            cin >> mp[i][j];
            if(mp[i][j] == '#') {
                ans[i][j] = x;
                x++;
            }
        }
    }
    
    rep(q, 1000){
        rep(i, h) {
            rep(j, w) {
                if(ans[i][j] == -1) {
                    if(j>0&&ans[i][j-1] != -1) ans[i][j] = ans[i][j-1];
                    else if(j<w-1&&ans[i][j+1] != -1) ans[i][j] = ans[i][j+1];
                }
            }
        }
    }
    rep(q,1000){
        rep(i, h) {
            rep(j, w) {
                if(ans[i][j]==-1) {
                   if(i>0&&ans[i-1][j]!=-1) ans[i][j]=ans[i-1][j];
                   else if(i<h-1&&ans[i+1][j]!=-1)ans[i][j] = ans[i+1][j];
                }
            }
        }
    }
    rep(i, h) {
        rep(j, w) {
            cout << ans[i][j];
            if(j==w-1)cout << endl;
            else cout << ' ';
        }
    } // 確認済
    return 0;
}

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

using namespace std;
typedef long long ll;

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

    ll gcd = __gcd(a,b);
    set<ll> divs;
    divs.insert(1);
    divs.insert(gcd);

    for(int i=2; i <= sqrt(gcd); i++) {
        if(gcd % i == 0) {
            divs.insert(i);
            divs.insert(gcd/i);
        } 
    }

    set<ll> chosen;
    for(auto val : divs) {
        bool found = false;
        for(auto k : chosen) {
            if(val%k == 0 && k != 1) {
                found = true;
                break;
            }
        }
        if(!found) chosen.insert(val);
    }

    cout << chosen.size();
}

Measured memory_bytes: 512
/*3.3 hightierra*/
#include <stdio.h>
#include <math.h>
 
int main(void){
    int N,K; //変数の定義
    scanf("%d %d",&N,&K); //入力
 
    int count = 1; //カウンターを定義
 
    /*K^(i-1)<=N<K^iのとき、NはK進法でi桁*/
    while(pow((double)K,(double)count)<=N){
      	count++;
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AIZUproject08
{
    /*class Data
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public int Evaluation { get; set; }
    }
    class Program
    {
        static void Main()
        {
            List<Data> datalist = new List<Data>();
            Data data;
            int N = int.Parse(Console.ReadLine());
            for (int i=0;i< N;i++)
            {
                var temp = Console.ReadLine().Split(' ');
                data = new Data();
                data.ID = i + 1;
                data.Name = temp[0];
                data.Evaluation = int.Parse(temp[1]);
                datalist.Add(data);
            }
            datalist = datalist.OrderBy(n => n.Name).ThenByDescending(n => n.Evaluation).ToList();
            foreach (var ans in datalist)
            {
                Console.WriteLine(ans.ID);
            }
        }
    }*/
    class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int r = input[0];
            int D = input[1];
            int X = input[2];
            for (int i=0;i<10;i++)
            {
                var ans = r * X - D;
                Console.WriteLine(ans);
                X = ans;
            }
        }
    }
}


Measured memory_bytes: 13268