akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <stack>
#include <vector>
#include <numeric>
using namespace std;

int main()
{
	string input;
	struct water
	{
		pair<int, int> endpoints;
		int size;
	};
	vector<water> floods;
	stack<int> hills;
	getline(cin, input);

	for (int i = 0; i < input.length(); i++)
	{
		if (input[i] == '\\')
		{
			hills.push(i);
			continue;
		}

		else if (input[i] == '/')
		{
			if (!hills.empty())
			{
				water w;
				w.size = i - hills.top();
				w.endpoints.first = hills.top();
				w.endpoints.second = i;
				hills.pop();
				floods.push_back(w);
				continue;
			}
			continue;
		}
		continue;
	}
	for (int i = 0; i < floods.size(); i++)
	{
		for (int p = 0; p < floods.size(); p++)
		{
			if (i < floods.size()) {
				if (floods[p].endpoints.first < floods[i].endpoints.first && floods[p].endpoints.second > floods[i].endpoints.second)
				{
					floods[i].endpoints = floods[p].endpoints;
					floods[i].size += floods[p].size;
					floods.erase(floods.begin() + p);
					p -= 1;
				}
			}
		}
	}
	int size = 0;
	for (water w : floods)
	{
		size += w.size;
	}
	cout << size << endl;
	cout << floods.size();
	for (water w : floods)
	{
		cout << ' ' << w.size;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3332
using System;

namespace AtCoder{
    public static class AtCoder{
        public static void Main(){
            int n = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split(' ');
            var vals = new ulong[n];
            decimal ans = 1;
            for(int i = 0; i < n; i++){
                vals[i] = ulong.Parse(input[i]);
                if(vals[i] == 0){
                    Console.WriteLine("0");
                    return;
                }
            }

            for(int i = 0; i < n; i++){
                if(Math.Log((double)ans, 10) + Math.Log(vals[i], 10) > 18){
                    Console.WriteLine("-1");
                    return;
                }
                ans = ans * vals[i];
                if(ans > 1000000000000000000){
                    Console.WriteLine("-1");
                    return;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 40956
#import numpy as np

N = int(input())
A = list(map(int, input().split()))
A.sort()#わるほう

#kouho = sorted([x for x in set(A) if A.count(x) == 1])
#maxA = 10**5

#target = kouho[:]
maxA = A[-1]
work=[0]*(A[-1]+1)

for i in range(len(A)):
    if work[A[i]]<=1:
        maxN = int(maxA/A[i])
        for n in range(1,maxN+1):
            buf = A[i]*n
            #remove_list.append(buf)
            work[buf]+=1
                #print(A[i]*n)

#target = kouho[:]
#kouho = list(set(kouho) - set(remove_list))

sm=0
for s in A:
    if work[s]==1: sm+=1
print(sm)

#print(len(kouho))

Measured memory_bytes: 33388
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
using namespace std;

int main() {

	long A;
	long B;
	cin >> A;
	cin >> B;

	long Amin = 25 * A / 2;
	if (A % 2 != 0) {
		Amin += 1;
	}
	long Amax = 25 * (A + 1) / 2;
	if (A % 2 != 0) {
		Amax -= 1;
	}

	long Bmin = 10 * B;
	long Bmax = 10 * B + 9;

	// 解が存在する場合
	if (Amax >= Bmin&& Bmax >= Amin) {
		long val = max(Amin, Bmin);
		cout << val << endl;
	}
	// 解が存在しない場合
	else {
		cout << -1 << endl;
	}


	return 0;
}



Measured memory_bytes: 256
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define ull unsigned long long
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
int INF = 1001001001;
const int MOD=1e9+7;

int main() {
  int n,a;
  in n>>a;


  cout<<n*a<<endl;
  return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>

using namespace std;
typedef long long ll;

int main()
{
	int N;
	char S[5000];
	
	cin >> N >> S;
	
	ll R = 0;
	ll G = 0;
	ll B = 0;
	
	for(int i = 0; i < N; i++){
		if(S[i] == 'R') { R++; }
		if(S[i] == 'G') { G++; }
		if(S[i] == 'B') { B++; }
	}
	
	int count = 0;
	
	for(int i = 0; i < N; i++){
		for(int l = 1; i + 2 * l < N; l++){
			if(S[i] != S[i+l] && S[i+l] != S[i+2*l] && S[i+2*l] != S[i]){
				count++;
			}
		}
	}
	
	ll ans = R*G*B - count;
	
	cout << ans << endl;
	
	return 0;
}


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

// Macros
#define F  first
#define S  second
#define PB push_back

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m, y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// HELPERS
//  Tedious Grid Movements
vector<pii> moves_grid = { {0,1} , {0,-1} , {1,0} , {-1,0} };
inline bool move_okay(int x, int y, int n, int m) { return 0 <= x and x < n and 0 <= y and y < m; }
//  Remember:
//   * vec.assign() GOOD; vec.resize() BAD
//   * comparator uses <

// Output, Common Containers
template <typename T> ostream& operator << (ostream& os, const vector<T>& v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream& os, const set<T>& v)    { for (T i : v) os << i << ' '; return os; }
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) { os << "(" << v.F << "=>" << v.S << ") "; return os; }
template <typename T, typename S> ostream& operator << (ostream& os, const map<T,S>& v)  { for (auto i : v) os << i << ' '; return os; }

// Debugging
#ifdef SANYAM1101
	#define trace(args...) do{ cerr << "TRACE ON! (Line: " << __LINE__ << ")\n"; auto _stream = istringstream{string{#args}}; d_f(_stream, args); } while(0)
	void d_f(__attribute__((unused)) istringstream& _stream) {}
	template<typename Head, typename... Tails> void d_f(istringstream& _stream, Head H, Tails... T) { string _name; _stream >> _name; if(_name.back() == ',') _name.pop_back(); cerr << "\t" << _name << " <=> [" << H << "]\n"; d_f(_stream, T...); }
#else
	#define trace(args...)
#endif


// CODE STARTS HERE

void solve(){
	int n, k;
	cin >> n >> k;

	vector<int> p(n);
	for(auto& i : p) cin >> i;
	sort(p.begin(), p.end());

	cout << accumulate(p.begin(), p.begin() + k, 0) << "\n";
}

signed main (void){
	// Fast_IO
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	// Set Fixed Notation (default sucks), High Precision for Floating-Point Output
	cout << fixed << setprecision(20);

	// Multiple TCs
	int tt = 1;
	// cin >> tt;
	while(tt--) solve();
}


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

int main() {
    int s,w; cin >> s >> w;
    if (w >= s){
        cout << "unsafe\n";
    }
    else{
        cout << "safe\n";
    }
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second

using Graph = vector<vector<int>>;

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

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

int main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    s.at(k - 1) -= ('A' - 'a');
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
using namespace std;

int main() {
	int X, Y;
	cin >> X >> Y;
	cout << X + Y/2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, k;
vector<int> a, f;

bool check(int mid){
   int ans = 0;
   for (int i = 0; i < n; ++i)
   {
      if(a[i] * f[i] <= mid)continue;
      int x = (a[i] * f[i] - mid + f[i] - 1) / f[i];
      ans += x;
   }

   tr(mid, ans);
   return ans <= k;
}

int32_t main(){_

   cin>>n>>k;
   a.resize(n);
   f.resize(n);

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

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

   sort(a.begin(), a.end());
   sort(f.rbegin(), f.rend());

   // for (int mid = 1; mid <= 28; ++mid)
   // {
   //    check(mid);
   // }
   
   int low = 0, high = 1e12 + 100, ans = 0;
   while(low <= high){
      int mid = (low + high) >> 1;
      if(check(mid)){
         ans = mid;
         high = mid - 1;
      }
      else{
         low = mid + 1;
      }
   }
   
   cout<<ans;

   return 0;
}

Measured memory_bytes: 3328
a = int(input())
b = int(input())
if a > b:
    if a-1 == b and b > 1:
        print(a-b)
    elif a-1 == b:
        print(a+1)
    else:
        print(a-1)
else:
    if b-1 == a and a > 1:
        print(b-a)
    elif b-1 == a:
        print(b+1)
    else:
        print(b-1)

Measured memory_bytes: 3064
import java.util.Scanner;

class Main{

    private static int L;

    private static String Lstring(String s,String t){
        int Lt = L % s.length();
        while(Lt % t.length() != 0)Lt += s.length();
        int Ls = L - Lt;
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<Ls/s.length();++i)sb.append(s);
        for(int i=0;i<Lt/t.length();++i)sb.append(t);
        return sb.toString();
    }
    
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        L = scan.nextInt();
        String s = scan.next();
        String t = scan.next();

        String S = Lstring(s,t);
        String T = Lstring(t,s);

        if(S.compareTo(T)<0){
            System.out.println(S);
        }else{
            System.out.println(T);
        }

    }
}

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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
ll dp[100001][13];
int main() {
	string S;
	cin >> S;
	int N = S.size();
	dp[0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 13; j++) {
			if (S[i] == '?') {
				for (int k = 0; k < 10; k++) {
					(dp[i + 1][(j * 10 + k) % 13] += dp[i][j]) %= MOD;
				}
			}
			else {
				(dp[i + 1][(j * 10 + S[i] - '0') % 13] += dp[i][j]) %= MOD;
			}
		}
	}
	cout << dp[N][5] << endl;
}


Measured memory_bytes: 10624
#include <iostream>
#include <algorithm>

using namespace std;

class Solver {
public:
	static void solve() {
		int n;
		cin >> n;
		int ps[5005];
		for (int i = 0; i < n; i++)cin >> ps[i];

		int res = 1e9;
		for (int i = 0; i <= ps[0]; i++) {
			int tmp = i;
			int now = i;
			for (int j = 0; j < n - 1; j++) {
				int delta = ps[j] - now;
				if (delta > 0) {
					tmp += delta * 2;
					now = delta;
				}
				else {
					now = 0;
				}
			}
			if (ps[n - 1] - now > 0)tmp += ps[n - 1] - now;

			res = min(res, tmp);
		}

		cout << res<<endl;
	}
};

int main() {
	Solver::solve();
}


Measured memory_bytes: 3116
#!/usr/bin/env python3
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
if R - L < 2019 and r > l:
    print(
        min(i * j % 2019 for i in range(l, r + 1)
            for j in range(i + 1, r + 1)))
else:
    print(0)


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

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

  while (true) {
    c -= b;
    if (c <= 0) {
      cout << "Yes" << endl;
      break;
    }
    a -= d;
    if (a <= 0) {
      cout << "No" << endl;
      break;
    }
  }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#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 rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// const ll MOD = 1000000007;
const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();

    string s;
    cin >> s;
    cout << s.substr(0, 3) << endl;
    
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define endl "\n"
#define MOD 1000000007
#define inf -100000000
#define ordered_set tree<pair<ll int,ll int>, null_type,less<ll int>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
using namespace std;
using namespace __gnu_pbds; 
int main()
{
    fast;
   // #ifndef ONLINE_JUDGE
   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
   // #endif
    ll int n;
    cin>>n;
    ll int h[n+1];
    ll int i,count=0,z;
    map<ll int,ll int> f;
    for(i=1;i<=n;i++)
    {
    	cin>>h[i];
    }
    f[1+h[1]]++;
    ll int ans=0;
    for(i=2;i<=n;i++)
    {
    	z=i-h[i];
    	if(z<=0)
    	{
    		f[i+h[i]]++;
    		continue;
    	}
    	else
    	{
    		if(f[z]!=0)
    		{
    			ans=ans+f[z];
    		}
    		f[i+h[i]]++;
    	}
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 18964
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.valueOf(br.readLine());
		List<String> hoge = Arrays.asList(br.readLine().split(" "));
		int count=0;
		int currentIndex=1;
		for(String str: hoge){
			if(currentIndex==Integer.valueOf(hoge.get(Integer.valueOf(str)-1))){
				count++;
			}
			currentIndex++;
		}
		System.out.println(count/2);






	}

}

Measured memory_bytes: 31964
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod=1000000007;

vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
int main() {
  int N;
  cin>>N;
  vector<int>a(N+1);
  for(int i=1;i<=N;i++){
    cin>>a[i];
  }
  vector<int>d(N+1);
  int M=0;
  for(int i=N;i>=1;i--){
    int sum=0;
    for(int j=2;j<=N/i;j++){
       if(i*j<=N){sum+=d[i*j];}
    }
    if(sum%2!=a[i]){M++;d[i]=1;}
  }

  cout<<M<<endl;
  for(int i=1;i<=N;i++){
    if(d[i]==1){
      cout<<i;
      if(i<N){cout<<" ";}
    }
  }cout<<endl;
  return 0;
}

Measured memory_bytes: 4816
from scipy.sparse.csgraph import floyd_warshall
n,*a=map(int,open(0).read().split())
a,b=a[:n],a[n:]
for x,y in zip(a,b):
    if x==y:continue
    if y>x:
        print(-1)
        exit()
    if x-y<=y:
        print(-1)
        exit()
M=max(a)
d=[]
for k in range(M-1,-1,-1):
    s=set(a)
    e=[[0]*(M+1)for _ in range(M+1)]
    for i in range(M+1):e[i][i]=1
    for i in d+list(range(k,0,-1)):
        t=s.copy()
        for x in s:
            e[x][x%i]=1
            t|={x%i}
        s=t
    c=floyd_warshall(e)
    for x,y in zip(a,b):
        if c[x,y]==float('inf'):
            d+=k+1,
            break
print(sum(2**k for k in d))

Measured memory_bytes: 17176
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;

typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

long long int MOD = 1000000007;
int N,M;
int x[114514]={0};
ll bik[114514];
ll bikinv[114514];

ll extgcd(ll a, ll b, ll &x, ll &y) {
	ll g = a; x = 1; y = 0;
	if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
	return g;
}
ll invMod(ll a, ll m) {
	ll x, y;
	if (extgcd(a, m, x, y) == 1) return (x + m) % m;
	else                         return 0; // unsolvable
}
ll Comb(int a,int b){
	ll ret;
	ret=(((bik[a]*bikinv[b])%MOD)*bikinv[a-b])%MOD;
	return ret;
}
int main(){
	cin>>N;
	int mi;
	for(int i=0;i<N+1;i++){
		int a;
		cin>>a;
		if(x[a]>0){
			mi=i-x[a];
		}else{
			x[a]=i+1;
		}
	}
	bik[0]=(ll)1;
	bikinv[0]=(ll)1;
	for(int i=1;i<=N;i++){
		bik[i]=(bik[i-1]*(ll)i)%MOD;
		bikinv[i]=invMod(bik[i],MOD);
	}
	/*for(int i=1;i<=N;i++){
		cout<<Comb(N,i)<<" ";
	}*/
	//cout<<endl;
	for(int k=1;k<=N+1;k++){
		ll ans=0;
		if(k>=2){
			ans=(ans+Comb(N-1,k-2))%MOD;
		}
		if(k<=N-1){
			ans=(ans+Comb(N-1,k))%MOD;
		}
		if(k<=N){
			ans=(ans+2*Comb(N-1,k-1))%MOD;
		}
		if(k<=N-mi){
			ans=(ans-Comb(N-1-mi,k-1)+MOD)%MOD;
		}
		cout<<ans<<endl;
	}
	
}

Measured memory_bytes: 3200
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#define MOD 998244353
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,v0,v1,ans=1,max_n=0;
  cin >> n;
  map<ll,ll> mp;
  ll d[n];
  for(int i=0;i<n;i++){
    cin >> d[i];
    mp[d[i]]++;
    max_n = max(max_n,d[i]);
  }
  if(d[0]!=0||mp[0]!=1){
    cout << "0\n";
    return 0;
  }
  for(int i=1;i<=max_n;i++){
    v0 = mp[i-1];
    v1 = mp[i];
    for(int j=1;j<=v1;j++){
      ans *= v0;
      ans %= MOD;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 7296
#include <iostream>
#include <string>
using namespace std;
int main() {
    string str;
    cin >> str;
    bool n=false, w=false, s=false, e=false;
    for(int i=0; i<str.length(); i++) {
        if(str[i]=='N') n=true;
        else if(str[i]=='W') w=true;
        else if(str[i]=='S') s=true;
        else if(str[i]=='E') e=true;
    }

    if(n==s && w==e) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <tuple>
#include <utility>

using namespace std;

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

    tuple<int, int, int> data[M];
    for (int i = 0; i < M; ++i) {
        int p, y;
        cin >> p >> y;
        data[i] = make_tuple(y, p, i);
    }

    sort(data, data + M);

    int cnt[N+1];
    for(int i = 0; i < N+1; i++){
        cnt[i] = 0;
    }

    pair<int, int> id[M];
    for (int i = 0; i < M; ++i) {
        int y, p, idx;
        tie(y, p, idx) = data[i];
        cnt[p]++;
        id[idx] = make_pair(p, cnt[p]);
    }

    for (int i = 0; i < M; ++i) {
        printf("%06d%06d\n", id[i].first, id[i].second);
    }


    return 0;
}

Measured memory_bytes: 3840
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
            int a = s[0];
            int b = s[1];
            long lcm = Lcm((long)a, (long)b);
            WriteLine(lcm);

        }
        static long Gcd(long a, long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }
        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }
    }
}

Measured memory_bytes: 13396
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
print(sum(a) - n)

Measured memory_bytes: 5360
#include <iostream>

using namespace std;

int main() {
	//食べるリンゴの味の絶対値が最小のものを食べればよい
	int N, L;
	
	cin >> N >> L;

	int sum = 0;
	int min = 1000000;
	for (int i = 1; i <= N; i++)
	{
		sum += L + i - 1;
		if (abs(min) > abs(L + i - 1)) min = L + i - 1;
	}

	int ans = sum - min;

	cout << ans << endl;

	return 0;
}

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

using namespace std;

#define MAX_N 200000

string S, T;

bool solve( int H, int W, int N, int r, int c )
{
    // それぞれ、スタート地点 (sr, sc) から上下左右の境界へのマージン
    const int U = r - 1;
    const int D = H - r;
    const int L = c - 1;
    const int R = W - c;

    // 高橋くんの移動可能範囲
    int sl, sr, su, sd;
    sl = sr = su = sd = 0;

    // 青木くんの移動可能範囲
    int tl, tr, tu, td;
    tl = tr = tu = td = 0;

    for ( int n = 0; n < N; n++ )
    {
        if ( S[n] == 'L' ) sl++;
        if ( S[n] == 'R' ) sr++;
        if ( S[n] == 'U' ) su++;
        if ( S[n] == 'D' ) sd++;

        // 高橋くんの移動後に盤の外へ移動できるのなら、こまは残らない。
        if ( L < sl - tr ) return false;
        if ( R < sr - tl ) return false;
        if ( U < su - td ) return false;
        if ( D < sd - tu ) return false;

        // 青木くんは自分盤内に収まるように移動可能範囲を計算しないといけない。
        if ( T[n] == 'L' && tl - sr < L ) tl++;
        if ( T[n] == 'R' && tr - sl < R ) tr++;
        if ( T[n] == 'U' && tu - sd < U ) tu++;
        if ( T[n] == 'D' && td - su < D ) td++;
    }

    // 全ての文字を処理後にまだ盤の外へ出ていない。つまり、こまは残る。
    return true;
}

int main( int argc, char **argv )
{
    int H, W, N;
    cin >> H >> W >> N;

    int sr, sc;
    cin >> sr >> sc;

    cin >> S;
    cin >> T;

    bool ans = solve( H, W, N, sr, sc );

    if ( ans )
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 776
from heapq import heappush, heappop
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)

n, m, s, t = map(int, input().split())

uv = [[] for _ in range(n)]
for _ in range(m) :
    u, v, a, b = map(int, input().split())
    uv[u-1].append((v-1, a, b))
    uv[v-1].append((u-1, a, b))
    
q = [(0, s-1)]
ca = [float('inf')] * n
ca[s-1] = 0
while q :
    cco, cur = heappop(q)
    if cco > ca[cur] :
        continue
    for nex, nco, _ in uv[cur] :
        if cco + nco < ca[nex] :
            ca[nex] = cco + nco
            heappush(q, (cco + nco, nex))
            
q = [(0, t-1)]
cb = [float('inf')] * n
cb[t-1] = 0
while q :
    cco, cur = heappop(q)
    if cco > cb[cur] :
        continue
    for nex, _, nco in uv[cur] :
        if cco + nco < cb[nex] :
            cb[nex] = cco + nco
            heappush(q, (cco + nco, nex))

m = [(ca[i] + cb[i], i) for i in range(n)]
m.sort(reverse=True)

for i in range(n) :
    print(10 ** 15 - m[-1][0])
    while m and m[-1][1] <= i :
        m.pop()

Measured memory_bytes: 119372
#include<stdio.h> 
#include<stdlib.h>
#include<string.h>


int main ()  {
	int a,b,c ;
	
	scanf("%d %d %d",&a,&b,&c) ;
	
	while(a*c>b && c!=0) {
		c=c-1 ;
	} 
	
	printf("%d",c) ;
		
	return(0) ;
}

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

bool cpr(pair<int, pair<int,int> >& a, pair<int, pair<int, int> >& b){
    return a.first > b.first;
}

int main(){
    while(1){
        int n,m,a;
        cin >> n >> m >> a;
        if(n==0) break;

        vector<pair<int, pair<int,int> > > lines(m);
        for(int i=0; i<m; i++){
            int h,p,q;
            cin >> h >> p >> q;
            lines[i]= make_pair(h, make_pair(p,q));
        }
        sort(lines.begin(), lines.end(), cpr);

        for(int i=0; i<m; i++){
            pair<int,int> tmp=lines[i].second;
            if(tmp.first == a){
                a = tmp.second;
            }else if(tmp.second == a){
                a = tmp.first;
            }
        }

        cout << a << endl;
    }
    return 0;
}

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

using namespace std;

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

    int i = 0;
    int ans = pow(2, i);
    
    while (ans <= n) {
        i++;
        ans = pow(2, i);
    }

    ans = pow(2, i - 1);

    cout << ans << endl;
}

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

typedef long long ll;
typedef double keytype;

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

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

    scanf("%d %d %d", &a, &b, &c);

    printf("%d\n", (a * b) / 2);

    return 0;
}


Measured memory_bytes: 1708
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc134_d.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  vector<int> c(N + 1);
  rep(i, N) { cin >> c[i + 1]; }

  vector<int> a(N + 1, 0);
  ll tot;
  for (int i = N; i >= 1; i--) {
    if (i > N / 2) {
      a[i] = c[i];
    } else {
      int sum = 0;
      repi(j, 1, N / i + 1) { sum += a[j * i]; }
      a[i] = sum % 2 == c[i] ? 0 : 1;
    }
    tot += a[i];
  }

  cout << tot << endl;
  rep(i, N + 1) { 
    if (a[i]) cout << i << endl;
  }
}

Measured memory_bytes: 2560
fn evaluate(inputs_s: Vec<i32>, inputs_t: Vec<i32>) {
    let mut n = 0;
    for t in &inputs_t {
        for s in &inputs_s {
            if t == s {
                n += 1;
                break;
            }
        }
    }
    println!("{}", n);
}

fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();

    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();
    let inputs_s: Vec<i32> = line.split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect();

    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();

    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();
    let inputs_t: Vec<i32> = line.split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect();

    // println!("{:?}", inputs_s);
    // println!("{:?}", inputs_t);

    evaluate(inputs_s, inputs_t);
}



Measured memory_bytes: 5040
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto X = aryread();
    auto I = iota(N).array();
    zip(X, I).sort();
    auto ans = new long[](N);
    foreach (i; 0 .. N)
    {
        if (i < N / 2)
        {
            ans[I[i]] = X[N / 2];
        }
        else
        {
            ans[I[i]] = X[N / 2 - 1];
        }
    }
    foreach (i; 0 .. N)
        writeln(ans[i]);
}


Measured memory_bytes: 13164
def rmq(a, b, k, l, r)
  return MAX if r <= a || b <= l
  return $d[k] if $d[k]
  m = (l+r)/2
  vl = rmq(a, b, 2*k+1, l, m)
  vr = rmq(a, b, 2*k+2, m, r)
  return vl < vr ? vl : vr
end

def update(s, t, x, k, l, r)
  if s == l && t == r then
    $d[k] = x
  else
    if $d[k] then
      $d[2*k+1] = $d[2*k+2] = $d[k]
      $d[k] = nil
    end
    m = (l + r)/2
    if t <= m then
      update(s, t, x, 2*k+1, l, m)
    elsif m <= s then
      update(s, t, x, 2*k+2, m, r)
    else
      update(s, m, x, 2*k+1, l, m)
      update(m, t, x, 2*k+2, m, r)
    end
  end
end

MAX = 2**31-1
n, q = gets.split.map(&:to_i)

m = 1
while m < n
  m *= 2
end

$d = Array.new(2*m-1){MAX}
q.times{
  com, s, t, x = gets.split.map(&:to_i)
  case com
  when 0
    update(s, t+1, x, 0, 0, m)
  when 1
    p rmq(s, t+1, 0, 0, m)
  end
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

#include <bits/stdc++.h>
using namespace std;

static const ll INF = 1e15;

static const ll mod= 1e9 + 7;

int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<char> cs;
	cs.reserve(n);
	rep(i, n - 1) {
		if (s[i] == 'B' && s[i + 1] == 'C') {
			cs.push_back('D');
			i++;
			continue;
		}
		else {
			cs.push_back(s[i]);
		}
	}
	auto csSize = cs.size();
	ll total = 0;
	int aCount = 0;
	rep(i, csSize) {
		if (cs[i] == 'A') {
			aCount++;
		}
		else if (cs[i] == 'D') {
			if (aCount > 0) {
				total += aCount;
			}
		}
		else {
			aCount = 0;
		}
	}
	cout << total << endl;
	return 0;
}
	

Measured memory_bytes: 3832
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int X[9*9];
	int n=0;
	for (int i=1;i<=9;i++){
		for (int j=1;j<=9;j++){
			X[n++]=i*j;
		}
	}
	int N;
	cin>>N;
	for (int i=0;i<9*9;i++){
		if (X[i]==N){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
using namespace std;

int main() {
    ll N, K; cin >> N >> K;
    vi A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    ll temp1 = 0, temp2 = 0;

    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            if (A[i] > A[j]) {
                temp1++;
            }
            else if (A[i] < A[j]) {
                temp2++;
            }
        }
    }

    ll ans1, ans2;
    ans1 = K * (K + 1) / 2;

    ans1 %= MOD;
    ans1 *= temp1;

    ans2 = K * (K - 1) / 2;
    ans2 %= MOD;
    ans2 *= temp2;

    ll ans = ans1 + ans2;
    ans %= MOD;

    cout << ans << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

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

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

		int c = 0;
		for (int i = 1; i < b-a; i++) {
			c += i;
		}
		System.out.println(c-a);
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
void solve(){
	ll l,r,d;
	cin>>l>>r>>d;
	cout<<(r/d)-((l-1)/d);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++)
	solve();
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int n,k;
    cin>>n>>k;
    vi a(n,0);
    rep(i,0,k){
        int d;
        cin>>d;
        rep(j,0,d){
            int A;
            cin>>A;
            A--;
            a[A]++;
        }
    }
    int cnt=0;
    rep(i,0,n){
        if(a[i]==0)cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}




Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define LEN freq

struct WORD {
	unsigned int freq;
	char word[40];
	struct WORD* next;
};

struct WORD WordList[30];

struct WORD maxFreq = { 0," ",NULL };
struct WORD maxLen = { 0," ",NULL };

void Atoa(char target[]) {
	for (int i = 0; target[i] != '\0'; i++) {
		if ('A' <= target[i] && 'Z' >= target[i])target[i] += 32;
	}
}

struct WORD* Find(char target[]) {
	int hash = target[0] - 97;
	struct WORD* run_pos;
	for (run_pos = WordList[hash].next; run_pos != NULL; run_pos = run_pos->next) {
		if (!strcmp(target, run_pos->word))return run_pos;
	}
	return NULL;
}

void Add(char add[]) {
	int hash = add[0] - 97;
	struct WORD* buff_pos;
	struct WORD* addition = (struct WORD*)malloc(sizeof(struct WORD));
	strcpy(addition->word, add);
	addition->freq = 1;
	if (WordList[hash].next == NULL) {
		WordList[hash].next = addition;
		addition->next = NULL;
	}
	else {
		buff_pos = WordList[hash].next;
		WordList[hash].next = addition;
		addition->next = buff_pos;
	}

}



int main() {
	char inp_str[40];
	struct WORD* position;

	for (int i = 0; i < 30; i++) {
		WordList[i].next = NULL;
		WordList[i].freq = 0;
	}
	while (scanf("%s", inp_str) == 1) {
		Atoa(inp_str);
		if (strlen(inp_str) > maxLen.LEN) {
			maxLen.LEN = strlen(inp_str);
			strcpy(maxLen.word, inp_str);
		}
		position = Find(inp_str);
		if (position == NULL) Add(inp_str);
		else if (++position->freq > maxFreq.freq) {
			maxFreq.freq=position->freq;
			strcpy(maxFreq.word, inp_str);
		}
	}
	printf("%s %s\n", maxFreq.word, maxLen.word);

	return 0;
}


Measured memory_bytes: 2044
#include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define F first
#define S second
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

int main(){
	li dx[13]={ 0, -1,  1,  0,  0,  1,  1, -1, -1,  2, -2,  0,  0};
	li dy[13]={ 0,  0,  0, -1,  1,  1, -1,  1, -1,  0,  0,  2, -2};
	li lim[3]={ 5, 9, 13};
	
	li kami[10][10];
	rep(i,10)rep(j,10)kami[i][j]=0;
	
	int x,y,s;
	while(~scanf("%d,%d,%d", &x, &y, &s)){
		rep(i,lim[s-1]){
			li nx=x+dx[i];
			li ny=y+dy[i];
			if(min(nx,ny)>=0 && max(nx,ny)<10)kami[nx][ny]++;
		}
		
	}
	
	li siro=0;
	li ma=0;
	
	rep(i,10){
		rep(j,10){
			ma=max(ma,kami[i][j]);
			if(kami[i][j]==0)siro++;
		}
	}
	cout<<siro<<endl<<ma<<endl;
	
	return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint(), K = getint();
	int h[100000];
	rep(i, N) h[i] = getint();
	sort(h, h + N);

	int saishou = 1e9;
	rep(i, N - K + 1) {
		saishou = min(saishou, h[i + K - 1] - h[i]);
	}
	co(saishou);

	Would you please return 0;
}

Measured memory_bytes: 768
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    s = input()
    if s == 'Sunny':
        print('Cloudy')
    elif s == 'Cloudy':
        print('Rainy')
    elif s == 'Rainy':
        print('Sunny')

if __name__ == '__main__':
    main()


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


int main(){
    double w,h,x,y;
    cin>>w>>h>>x>>y;

    double ans=0;
    int ans2 = 0;
    ans = (w*h/2.0);
    if(x+x==w&&y+y==h){
        ans2 = 1;
    }

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

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n;
    int sum = 0;
    int tmp;

    scanf("%d", &n);
    tmp = n;
    while (tmp){
        sum += tmp % 10;
        tmp /= 10;
    }

    puts(n % sum ? "No" : "Yes");

    return 0;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		List<int>[] E = new List<int>[N];
		for(int i=0;i<N;i++){
			E[i] = new List<int>();
		}
		for(int i=0;i<N-1;i++){
			E[U[i]].Add(i);
			E[V[i]].Add(i);
		}
		
		int[] bw = new int[N];
		for(int i=0;i<N;i++) bw[i] = -1;
		
		var q = new Queue<int>();
		bw[0] = 0;
		q.Enqueue(0);
		while(q.Count > 0){
			var now = q.Dequeue();
			var clr = bw[now];
			foreach(var e in E[now]){
				int nxt = U[e] == now ? V[e] : U[e];
				if(bw[nxt] != -1) continue;
				int nclr = clr;
				if(W[e] == 1) nclr ^= 1;
				bw[nxt] = nclr;
				q.Enqueue(nxt);
			}
		}
		
		Console.WriteLine(String.Join("\n",bw));
		
		
		
		
	}
	int N;
	int[] U,V,W;
	public Sol(){
		N = ri();
		U = new int[N-1];
		V = new int[N-1];
		W = new int[N-1];
		for(int i=0;i<N-1;i++){
			var d = ria();
			U[i] = d[0] - 1;
			V[i] = d[1] - 1;
			W[i] = d[2] % 2;
			
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int main(){
  int n;
  cin >> n;
  vector<double> a(n);
  int i;
  double ans;
  for(i=0;i<n;++i){
    cin >> a[i];
    ans += 1.0/a[i];
  }
  ans = 1.0/ans;
  cout << ans;
}

Measured memory_bytes: 764
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

_ = input()
S = input()
stack = 0
made = ''
for ch in S:
    # print("ch, stack = ", ch, stack)
    if ch == '(':
        stack += 1
        made += '('
    elif ch == ')':
        if stack == 0:
            made = '(' + made + ')'
        else:
            made += ')'
            stack -= 1
made += ')' * stack
print(made)

Measured memory_bytes: 5460
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
数値の区切り位置を誤読しない
木はn-1ノード
関数単位で調べる
cout << fixed;
cout << setprecision(n) << ans;
 */

int main() {
    string s;
    cin >> s;
    if(s=="ABC")cout << "ARC";
    else cout << "ABC";


    
}

/*
*/



Measured memory_bytes: 3572