akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,b) for(int i=a;i>=b;i--)
//vector
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pp pop_back
//pair
#define pi pair<int ,int >
#define mk make_pair
#define ff first
#define ss second
//set
#define si set<int>
#define sit set<int>::iterator 
using namespace std;
int main()
{
fast;
ll n;cin>>n;
ll ans=n+(n*n)+(n*n*n);
  cout<<ans;
return 0;
}

Measured memory_bytes: 3640
import sys
readline = sys.stdin.readline

N = int(readline())
H = list(map(int,readline().split()))

INF = 10 ** 10
dp = [INF] * N
dp[0] = 0
dp[1] = abs(H[1] - H[0])
for i in range(2,len(dp)):
  dp[i] = min(dp[i - 2] + abs(H[i] - H[i - 2]), dp[i - 1] + abs(H[i] - H[i - 1]))
  
print(dp[N - 1])

Measured memory_bytes: 20408
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> h(n);
  for(int i=0;i<n;i++)
    cin>>h.at(i);
  vector<vector<int>> p(n,vector<int>(0));
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--;
    b--;
    if(h.at(a)<=h.at(b))
      p.at(a).push_back(b);
    if(h.at(b)<=h.at(a))
      p.at(b).push_back(a);
  }
  int c=0;
  for(auto x:p)
    if(x.empty())
      c++;
  cout<<c<<endl;
}

Measured memory_bytes: 7744
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
class Main{


	static final int MOD = 1000000007;


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
//		int N = sc.nextInt();
//		int M = sc.nextInt();
		String ss = sc.next();
		if(ss.equals("Sunny")){
			System.out.println("Cloudy");
		}else if(ss.equals("Cloudy")){
			System.out.println("Rainy");
		}else{
			System.out.println("Sunny");

		}



	}

	static void sieve(ArrayList<Long> list){
		int n = 50000000;
		boolean[] is_prime = new boolean[n+1];
		int[] prime = new int[n];
		for(int i= 0;i <=n;i++){
			is_prime[i] = true;
		}
		list.add((long) 1);
		for(int i = 2;i <= n;i++){
			if(is_prime[i]){
				list.add((long)i);
				for(int j = 2*i;j <= n;j+=i){
					is_prime[j] = false;
				}
			}
		}



	}




	static int upperbond(int k,int min,int[] data){		//kより小さい最大の値をdataの中から探し、返す二分探索
		int max = data.length;
		//		if(min == data.length-1){
		//			if(data[min] > k){
		//				return min;
		//			}
		//		}

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}

		return max;
	}

	static int lowerbond(int k,int min,int[] data){		//kより大きい最小の値をdataの中から探し、返す二分探索
		int max = data.length;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}
		return min;
	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



	static long lcm (long a, long b) {
		long g = gcd(a,b);
		return a/g*b;
	}




}


class Edge extends ArrayList<P>{

}

class P{
	int to;
	long cost;
	P(int to,long cost){
		this.to = to;
		this.cost = cost;
	}
}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return   from- otherpair.from;
	}








}






Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define DEC(x) fixed<<setprecision(x)
#define FAST ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);
const long long INF=2e18;

template<typename T,typename T1>void amax(T &a,T1 b){if(b>a)a=b;}
template<typename T,typename T1>void amin(T &a,T1 b){if(b<a)a=b;}

ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll modinv(ll a,ll m)
{
    return power(a,m-2,m);
}

// #define _NCR_

int TLE_TERROR()
{
 	ll int n,ans=0;
 	cin>>n;
 	ll int a[n],b[n];
 	for(ll int i=0;i<n;i++)
 	{
 		cin>>a[i];
 		b[i]=a[i];
 	}
 	for(ll int i=n-2;i>=0;i--)
 	{
 		a[i]+=a[i+1];
 		a[i]%=M;
 	}
 	for(ll int i=0;i<n-1;i++)
 	{
 		ans+=b[i]*a[i+1];
 		ans%=M;
 	}
 	cout<<ans;

 	return 0;   
}

int main()
{
    FAST
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ll int TESTS=1;
    // cin>>TESTS;
    #ifdef _NCR_
        initialvalues();
    #endif
    while(TESTS--)
        TLE_TERROR();
    return 0;
}

Measured memory_bytes: 6744
using System;
using System.Linq;

namespace _2824
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x.Max() == 0) break;
                int sand = 0;
                int ret = 0;
                for (int i = 0; i < x[0] - 1; i++)
                {
                    if (int.Parse(Console.ReadLine()) >= x[2]) sand = x[1];
                    if (sand > 0) ret++;
                    sand--;
                }
                Console.ReadLine();
                Console.WriteLine(ret);
            }
        }
    }
}

Measured memory_bytes: 9792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifdef LOCAL
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
#else
#define debug(x) ;
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

/* Starry Sky Tree */
//0-index

struct StarrySkyTree{
  typedef ll Type;
  int segn2;
  vector<Type> data, s_data;
  function<Type(Type, Type)> merge;

  StarrySkyTree(function<Type(Type, Type)> merge, int n): merge(merge)
  {
    for(segn2=1; segn2<n; segn2*=2);
    data.assign(segn2*2, 0);
    s_data.assign(segn2*2, 0);
  }

  StarrySkyTree(int n): //Original Ver.
    StarrySkyTree([](Type a, Type b){ return min(a, b); }, n) {}

  //get value of [a,b)
  Type query(int a, int b, int l = 0, int r = -1, int k = 0){
    if(r == -1) r = segn2;
    if(r <= a || b <= l) return LLINF; //大きさに注意
    if(a <= l && r <= b) return data[k] + s_data[k];
    return merge(query(a, b, l, (l+r)/2, k*2+1), query(a, b, (l+r)/2 , r, k*2+2)) + s_data[k];
  }

  //add x to [a,b)
  Type add(int a, int b, Type x, int l = 0, int r = -1, int k = 0){
    if(r == -1) r = segn2;
    if(a <= l && r <= b)
      s_data[k] += x;
    else if(a < r && l < b)
      data[k] = merge(add(a, b, x, l, (l+r)/2, k*2+1), add(a, b, x, (l+r)/2, r, k*2+2));

    return data[k] + s_data[k];
  }
};

int main(){
  int n, m;
  vector<pair<int,int> > vec[SIZE];
  ll sum = 0;

  scanf("%d%d", &n, &m);

  for(int i=0;i<m;i++){
    int l, r, a;
    scanf("%d%d%d", &l, &r, &a);
    l--; r--;
    vec[r].push_back({l,a});
    sum += a;
  }

  debug(n+2);
  StarrySkyTree seg(n+2);

  ll ans = 0;

  for(int i=0;i<n;i++){
    for(auto p : vec[i]){
      seg.add(0, p.first+1, p.second);
    }

    auto res = seg.query(0, i+2);
    ans = min(ans, res);
    seg.add(i+2, i+3, res);
  }

  for(int i=0;i<=n;i++){
    debug(i);
    debug(seg.query(i, i+1));
  }

  debug(ans);
  cout << max(0LL, sum - ans) << endl;

  return 0;
}


Measured memory_bytes: 19328
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD 998244353
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 long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}



int main() {
    ll n;
    cin >> n;
    if (n%1000==0){
        cout << 0 << endl;
        return 0;
    }
    cout << 1000-n%1000 << endl;
    return 0;
}

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

using namespace std;

void a()
{
    string s;
    cin >> s;
    int count = 0;
    for(auto e : s)
    {
        if(e == '1')
        {
            count++;
        }
    }
    cout << count << endl;
}

void b()
{
    int n;
    cin >> n;
    int maxa = 0;
    int b;
    for(int i = 0; i < n; i++)
    {
        int tempa, tempb;
        cin >> tempa >> tempb;
        if(tempa > maxa)
        {
            maxa = tempa;
            b = tempb;
        }
    }
    maxa += b;
    cout << maxa << endl;
}

void c()
{
    long long int N;
    cin >> N;
    for(int h = 1; h <= 3500; h++)
    {
       for(int n = 1; n <= 3500; n++)
       {
           long long int w;
           long long int up = N * h * n;
           long long int low = 4 * h * n - N * n - N * h;
           if(low == 0) continue;
           if(up % low == 0)
           {
               w = up / low;
               if(w > 0)
               {
                   cout << h << " " << n << " " << w;
                   return;
               }
           }
       }
    }
    return;
}

void d()
{

}

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


Measured memory_bytes: 384
# https://atcoder.jp/contests/abc125/tasks/abc125_d

n = int(input())
nums = [int(i) for i in input().split()]

# negativeがevenなら行ける、oddならどれか1個は残る？
neg = 0
MIN = float('inf')
ans = 0
for num in nums:
    if num < 0:
        neg += 1
    MIN = min(MIN, abs(num))
    ans += abs(num)

if neg % 2 == 1:
    ans -= MIN * 2
print(ans)

Measured memory_bytes: 64880
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second

void solve(){
    char ch;
    cin>>ch;
    if(isupper(ch)){
        cout<<"A";
    }else{
        cout<<"a";
    }
}
int main() {
    // int t; cin>>t;
    // while(t--){
        solve();
        // cout<<endl;
    // }
}

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

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 1e6+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 1e9+7;

char s[maxn];
int t[maxn];

int main() {
    scanf("%s",s+1);int n=strlen(s+1);ll ans=0;
    for(int i=n;i;i--)
        if(s[i]=='>') t[i]=t[i+1]+1;
        else t[i]=0;
    int pre=t[1];ans+=pre;
    for(int i=1;i<n;i++) {
        if(s[i]=='<') pre=max(pre+1,t[i+1]);
        else pre=min(pre-1,t[i+1]);
        ans+=pre;
    }if(s[n]=='<') ans+=pre+1;
    printf("%lld\n",ans);
    return 0;
}


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

using namespace std;

int e[1 << 26];

int main() {
    string s;
    cin >> s;
    int n = s.size();

    int conf = 0, ans = 0;
    e[0] = 1;
    for (int i = 0; i < n; i++) {
        conf ^= 1 << (s[i] - 'a');
        int x = n + 1;
        if (e[conf])
            x = e[conf];
        for (int j = 0; j < 26; j++)
            if (e[conf ^ (1 << j)] && e[conf ^ (1 << j)] < x)
                x = e[conf ^ (1 << j)];
        if (!e[conf] || x + 1 < e[conf])
            e[conf] = x + 1;
        ans = x;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 262404
N = int(input())
A,B = map(int, input().split())
P = list(map(int, input().split()))
q1,q2,q3 = 0,0,0

for x in P:
	if x<=A:
		q1 += 1
	elif x<=B:
		q2 += 1
	else:
		q3 += 1

print(min(q1,q2,q3))

Measured memory_bytes: 61924
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream> // cout, endl, cin
#include <iomanip>
#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 <math.h>
using namespace std;

int main(){
    double D, T, S;
    cin >> D >> T >> S;
    if(D / S > T) cout << "No" << endl;
    else cout << "Yes" << endl;
}

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

typedef long long int ll;
#define endl "\n"
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pair<int, int>>
#define mems(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define forn(i, s, e) for (int i = s; i < (e); ++i)
#define FASTIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define FILEIO                          \
    freopen("./input.txt", "r", stdin); \
    freopen("./output.txt", "w", stdout);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)                                                               \
    for (                                                                       \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second;                                                       \
        debug("%s : %lld ms\n ", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false)
const int M = 1e9 + 7;

template <class T>
T ABS(const T &x) { return x > 0 ? x : -x; }
ll gcd(ll n1, ll n2) { return n2 == 0 ? ABS(n1) : gcd(n2, n1 % n2); }
ll lcm(ll n1, ll n2) { return n1 == 0 && n2 == 0 ? 0 : ABS(n1 * n2) / gcd(n1, n2); }

int main()
{
    FASTIO
#ifdef LOCAL
    FILEIO
#endif
    int x, y;
    cin >> x >> y;
    float t = (y - 2 * x) / 2.0;
    bool ans = false;
    if (t == (int)t && t >= 0)
    {
        int c = x - (int)t;
        if (c >= 0)
        {
            ans = true;
        }
    }
    if (ans)
        cout << "Yes";
    else
    {
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
 
int main() {
	// your code goes here
int k;
cin>>k;
char s[100];
cin>>s;
int l,i;
l=strlen(s);
if(k<l)
{
    for(i=0;i<k;i++){
    cout<<s[i];
    }
    cout<<"."<<"."<<".";
}
else
{
    for(i=0;i<l;i++)
    {
        cout<<s[i];
    }
}
}

Measured memory_bytes: 3576
#include<iostream>
using namespace std;
int main(void){
  int a,b,c,d;
  string ans;
  cin >> a >> b >> c;
  if(a + b == c){
    ans = "Yes";
  }else if(a+c ==b){
    ans = "Yes";
  }else if(b+c ==a){
    ans = "Yes";
  }else {
    ans = "No";
  }
    
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

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

        int[] haiku = new int[3];
        for (int i = 0; i < 3; i++) {
            haiku[i] = Integer.parseInt(sc.next());
        }

        Arrays.sort(haiku);

        PrintWriter out = new PrintWriter(System.out);
        if (haiku[0] == 5 && haiku[1] == 5 && haiku[2] == 7) {
            out.println("YES");
        } else {
            out.println("NO");
        }

        sc.close();
        out.flush();
    }
}

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

#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define out(x) cout << x << "\n";
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;

int main(){
    string s;
    cin >> s;
    rep(i, (s.length()+1)/2){
        cout << s[i*2];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int count = 0;

void dfs(int ver, int v[][20], int seen[], int n, int m){
	int end = 1;
	for(int i=0; i < n; i++) {
		if(!seen[i] && i != ver)
			end = 0;
	}
	if(end) {
		count++;
		return;
	}

	seen[ver] = 1;
	for(int i=0; v[ver][i]; i++) {
		if(seen[v[ver][i]-1])
			continue;
		dfs(v[ver][i]-1, v, seen, n, m);
	}
	seen[ver] = 0;
}

int main(void){
	int n, m, a, b, idx[20] = {0};
	int v[20][20] = {{0}};
	int seen[20] = {0};

	scanf("%d%d", &n, &m);
	for(int i=0; i < m; i++) {
		scanf("%d%d", &a, &b);
		a--; b--;
		v[a][idx[a]++] = b+1;
		v[b][idx[b]++] = a+1;
	}

	dfs(0, v, seen, n, m);
	printf("%d", count);

	return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=1050;
//ここまでテンプレ
int main(){
	string S;
	cin>>S;
	int ans=0;
	for(int i=0;i<4;i++)
		if(S[i]=='+')
			ans++;
		else
			ans--;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
xn = list(map(int, input().split()))
xn_s = sorted(xn)
m1 = xn_s[n//2 - 1]
m2 = xn_s[n//2]
for x in xn:
    if x <= m1:
        print(m2)
    else:
        print(m1)

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

int main()
{
	int n, k, x, y;
	cin >> n >> k >> x >> y;

	if (n <= k)
	{
		cout << x * n << endl;
	}
	else
	{
		cout << x * k + y * (n - k) << endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#define ll long long

using namespace std;

int main(){
    string S;
    cin >> S;
    if(S[0]>S[1]){
        for(int i=0;i<3;i++){
            cout << S[0];
        }
        cout << endl;
        
    }
    else if(S[0]==S[1]&&S[1]>S[2]){
        for(int i=0;i<3;i++){
            cout << S[0];
        }
        cout << endl;
    }
    else if(S[0]<S[1]){
        char c;
        c=S[0];
        c+=1;
        for(int i=0;i<3;i++){
            cout << c;
        }
        cout << endl;
    }
    else if(S[0]==S[1]&&S[1]<S[2]){
        char c;
        c=S[0];
        c+=1;
        for(int i=0;i<3;i++){
            cout << c;
        }
        cout << endl;
    }
    else if(S[0]==S[1]&&S[1]==S[2]){
        for(int i=0;i<3;i++){
            cout << S[i];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

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

int main(){
    int array[11] = {0};rep(i,3){
        int tmp; cin>>tmp;
        array[tmp]++;
    }
    cout << ((array[5] == 2&&array[7]==1)?"YES":"NO")<<endl; return 0;
}

Measured memory_bytes: 256
M = 10**9 + 7
n, k = gets.split(" ").map {|x| x.to_i }

def f(n, k)
  mi = k * (k-1) / 2
  ma = k * n - k * (k-1) / 2
  #p [n, k, mi, ma, ma - mi + 1]
  ma - mi + 1
end

ans = 0
(k..n+1).each do |j|
  ans = (ans + f(n, j)) % M
end
puts ans


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

#define MAX 1000000000

typedef struct {
	long long x;
	long long y;
}posi_t;

int main(void) {
	long long s;
	posi_t posi[3] = { 0 };
	
	scanf("%lld", &s);
	posi[1].x = MAX, posi[1].y = 1;
	if (s % MAX == 0) {
		posi[2].x = 0;
		posi[2].y = s / MAX;
	}
	else {
		posi[2].y = 1 + s / MAX;
		posi[2].x = MAX - s % MAX;
	}
	printf("%lld %lld %lld %lld %lld %lld"
		, posi[0].x, posi[0].y, posi[1].x, posi[1].y, posi[2].x, posi[2].y);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
int main(){
  priority_queue < pair<int,int> > q;
  int n,p,a,v,N[1000001]={};
  cin>>n>>p;
  for(int i=1;i<=n;i++)q.push( make_pair(0,-i) );
  for(int i=0;i<p;i++){
    cin>>a>>v;
    N[a]+=v;
    q.push( make_pair(N[a],-a) );
    while(1){
      if(q.top().first!=N[-q.top().second]&&q.top().first!=0)q.pop();
      else break;
    }
    cout<<-q.top().second<<" "<<q.top().first<<endl;
  }
  return 0;
}

Measured memory_bytes: 23232
// finish date: 2018/03/14

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000
#define pii pair<int,int>


int main() {
    int N;
    cin >> N;
    vi p(N);
    rep(i, N) cin >> p[i];
    vi a(N), b(N);
    rep(i, N) {
        a[i] = 30000 * (i + 1);
        b[i] = 30000 * (N - i);
    }
    rep(i, N) {
        b[p[i] - 1] += i;
    }
    rep(i, N) cout << a[i] << " ";
    cout << endl;
    rep(i, N) cout << b[i] << " ";
    cout << endl;

    return 0;
}

Measured memory_bytes: 896
#include <cstdio>
#include <cmath>

int main()
{
    double x1, y1, x2, y2;

    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    
    printf("%lf\n", sqrt(pow((x2-x1),2)+pow((y2-y1),2)));

    return 0;
}

Measured memory_bytes: 1080
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;
import core.bitop;

alias H = Tuple!(int, "r", string, "s");

void main()
{
    auto N = readln.chomp.to!int;
    auto S = readln.chomp;

    long[H] ls, rs;
    foreach (b; 0..(1<<N)) {
        auto ll = new char[](N);
        auto rr = new char[](N);
        int j, k = N-1, l, m = N-1;
        foreach (i; 0..N) {
            if (b & (1<<i)) {
                ll[j++] = S[i];
                rr[m--] = S[2*N-i-1];
            } else {
                ll[k--] = S[i];
                rr[l++] = S[2*N-i-1];
            }
        }
        auto r = popcnt(b);
        ++ls[H(r, ll.to!string)];
        ++rs[H(r, rr.to!string)];
    }
    long r;
    foreach (k, v; rs) {
        auto l = H(N - k.r, k.s);
        if (l in ls) r += v * ls[l];
    }
    writeln(r);
}

Measured memory_bytes: 61160
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;


signed main() {
int X,ans;
cin >>X;
if(400<= X && X<=599) ans=8;
if(600<= X && X<=799) ans=7;
if(800<= X && X<=999) ans=6;
if(1000<= X && X<=1199) ans=5;
if(1200<= X && X<=1399) ans=4;
if(1400<= X && X<=1599) ans=3;
if(1600<= X && X<=1799) ans=2;
if(1800<= X && X<=1999) ans=1;




answer(ans);
return 0;
}


Measured memory_bytes: 3632
from typing import List


class DSU:
    def __init__(self, n: int = 0) -> None:
        self._n: int = n
        # root node: -1 * component size
        # otherwise: parent
        self.parent_or_size: List[int] = [-1] * n

    def merge(self, a: int, b: int) -> int:
        assert 0 <= a < self._n
        assert 0 <= b < self._n
        x, y = self.leader(a), self.leader(b)
        if x == y:
            return x
        if -self.parent_or_size[x] < -self.parent_or_size[y]:
            x, y = y, x
        self.parent_or_size[x] += self.parent_or_size[y]
        self.parent_or_size[y] = x
        return x

    def same(self, a: int, b: int) -> bool:
        assert 0 <= a < self._n
        assert 0 <= b < self._n
        return self.leader(a) == self.leader(b)

    def leader(self, a: int) -> int:
        assert 0 <= a < self._n
        if self.parent_or_size[a] < 0:
            return a
        self.parent_or_size[a] = self.leader(self.parent_or_size[a])
        return self.parent_or_size[a]

    def size(self, a: int) -> int:
        assert 0 <= a < self._n
        return -self.parent_or_size[self.leader(a)]

    def groups(self) -> List[List[int]]:
        leader_buf = [self.leader(i) for i in range(self._n)]
        group_size = [0] * self._n
        for i in range(self._n):
            group_size[leader_buf[i]] += 1
        result = [[] for _ in range(self._n)]
        for i in range(self._n):
            result[leader_buf[i]].append(i)
        return [row for row in result if row]


N, M, *AB = map(int, open(0).read().split())
d = DSU(N)
for a, b in zip(*[iter(AB)] * 2):
    d.merge(a - 1, b - 1)
print(len(d.groups()) - 1)


Measured memory_bytes: 32676
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    int N,W;
    cin>>N>>W;
    vector<ll> w(N);
    vector<ll> v(N);
    int sum =0;
    for(int i=0;i<N;i++){
        cin>>w[i]>>v[i];
        sum = sum + v[i];
    }
    ll ans=INT_MIN;
    vector<vector<ll>> dp(N+1,vector<ll>(sum+1,LONG_LONG_MAX));
    dp[0][0] = 0;
    for(int i=0;i<N+1;i++){
        dp[i][0] = 0;
    }
    for(ll i=1;i<=N;i++){
        for(ll j=1;j<=sum;j++){
            if(v[i-1]<=j){
            if(dp[i-1][j-v[i-1]]!=LONG_LONG_MAX){    
            dp[i][j] = min(dp[i-1][j],w[i-1]+dp[i-1][j-v[i-1]]);
              if(dp[i][j]<=W){
                  ans = max(ans,j);
              } }
              else{
                    dp[i][j] = dp[i-1][j];
              }
            }
            
            else{
                dp[i][j] = dp[i-1][j];
            }
        }
    }
  //  cout<<dp[3][140];
    cout<<ans;
}

Measured memory_bytes: 80256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    assert_eq!(!0usize, std::usize::MAX); //🙊
    assert!(0 == 0); //😇
    let (a, v) = (io.read::<isize>(), io.read::<isize>());
    let (b, w) = (io.read::<isize>(), io.read::<isize>());
    let t = io.read::<isize>();
    println!(
        "{}",
        if t * (v - w) >= (a - b).abs() {
            "YES"
        } else {
            "NO"
        }
    );
}

static MX: usize = 1010101;
static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 2172
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	int a, b;
	cin >> a >> b;
	if (a <= 5) {
		cout << 0 << endl;
	}
	else if (a <= 12) {
		cout << b / 2 << endl;
	}
	else {
		cout << b << endl;
	}
	return 0;
}

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

int main() {
  int R, G, B, N;
  cin >> R >> G >> B >> N;

  int count = 0;
  for (int i = 0; i <= N; i += R) {
    for (int j = 0; j <= N; j += G) {
      if (i + j > N) {
        break;
      }
      else if (i + j == N) {
        count++;
      }
      else if ((N - (i + j)) % B == 0) {
        count++;
      }
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 256
//Author rahuliitkgp

/*A thing of beauty is a joy forever,
Its loveliness increases,
it will never pass into nothingness.*/
//Men at Work :)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;

#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define INF (int)1e9 + (int)1e8
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void cpp() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int main(){
    cpp();
    string s, t;
    cin>>s>>t;
    vector<vector<int> > dp(s.size()+1, vector<int>(t.size()+1));
    dp[0][0] = 1;
    for(int i=1; i<dp.size(); i++){
        for(int j=1; j<dp[0].size(); j++){
            if(s[i-1]==t[j-1]){
                dp[i][j] = dp[i-1][j-1]+1;
            }
            else{
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }
    int i = dp.size()-1;
    int j = dp[0].size()-1;
    string ans;
    while(i>0&&j>0){
        if(s[i-1]==t[j-1]){
            ans+=s[i-1];
            i=i-1;
            j=j-1;
        }
        else{
            if(dp[i-1][j]>dp[i][j-1]){
                i = i-1;
            }
            else{
                j = j-1;
            }
        }
    }
    reverse(ans.begin(), ans.end());
    cout<<ans<<endl;
    return 0;
}






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

int main() {
    string s; cin >> s;
    int a = s[0]-'0', b = s[1]-'0', c = s[2]-'0', d = s[3]-'0';
    if(a+b+c+d==7) cout << a << '+' << b << '+' << c << '+' << d << "=7" << endl;
    else if(a+b+c-d==7) cout << a << '+' << b << '+' << c << '-' << d << "=7" << endl;
    else if(a+b-c+d==7) cout << a << '+' << b << '-' << c << '+' << d << "=7" << endl;
    else if(a+b-c-d==7) cout << a << '+' << b << '-' << c << '-' << d << "=7" << endl;
    else if(a-b+c+d==7) cout << a << '-' << b << '+' << c << '+' << d << "=7" << endl;
    else if(a-b+c-d==7) cout << a << '-' << b << '+' << c << '-' << d << "=7" << endl;
    else if(a-b-c+d==7) cout << a << '-' << b << '-' << c << '+' << d << "=7" << endl;
    else if(a-b-c-d==7) cout << a << '-' << b << '-' << c << '-' << d << "=7" << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
s = list(input())

master=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']

answer = ''
for i in s:
  count=0
  for k in master:
    if i == k:
      if count + n > 25:
        minus = 25 - (count-1)
        answer = answer + master[n - minus]
      else:
        answer = answer + master[count + n]
    count = count + 1

print(answer)


Measured memory_bytes: 3064
#include<iostream>
#include<complex>
#include<cstring>
#include<sstream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<vector>
#include<string>
#include<deque>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<list>
#include<functional>
#include<algorithm>
#define rep(i,k) for(int i=0;i<k;i++)
using namespace std;
struct P{
	int v;
	string r;
};

void swap(P *x,P *y){
	string s=x->r;
	int temp=x->v;
	x->r=y->r;
	x->v=y->v;
	y->r=s;
	y->v=temp;
};
int main(){
	int n,x,y,z,now=0;
	string s;
	while(cin>>n,n){
		P tab[20];
		if(now!=0)
		cout<<endl;
		rep(i,n){
			cin>>tab[i].r>>x>>y>>z;
			tab[i].v=x*3+z;
		}
		rep(i,n-1)
			rep(j,n-1){
				if(tab[j].v<tab[j+1].v)
				swap(&tab[j],&tab[j+1]);
		}
		rep(i,n)
			cout<<tab[i].r<<','<<tab[i].v<<endl;
		now++;
	}
	return 0;
}

Measured memory_bytes: 0
n, a, b = map(int, input().split())

x = 0
y = 0
j = 0
sum = 0

for i in range(1, n+1):
    j = i
    y = 0
    while j > 0:
        x = j%10
        j = j//10
        y += x

    if a <= y and y <= b:
        sum += i

print(sum)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>

/*
 *変数
 */
std::string n;

/*
 *解 
 */
void solve(){
    if(n[0]=='1')printf("9");
    else if(n[0]=='9')printf("1");
    else std::cout<<n[0];
    if(n[1]=='1')printf("9");
    else if(n[1]=='9')printf("1");
    else std::cout<<n[1];
    if(n[2]=='1')printf("9");
    else if(n[2]=='9')printf("1");
    else std::cout<<n[2];
}

/*
 *入力 
 */
int main(){
       std::cin.tie(0);
       std::ios::sync_with_stdio(false);
       std::cin>>n;
       solve();
       return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;

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

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

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn gcd(a: u64, b: u64) -> u64 {
    assert!(a != 0 || b != 0);
    if a == 0 {
        b
    } else {
        gcd(b % a, a)
    }
}

fn lcm(a: u64, b: u64) -> u64 {
    a / gcd(a, b) * b
}

fn main() {
    input! {
        N: usize,
    }
    for h in 1..3501 {
        for n in 1..3501 {
            if 4 * h * n > (N as u64 * (n + h)) {
                if (N as u64 * h * n) % (4 * h * n - N as u64 * n - N as u64 * h) == 0 {
                    let w = (N as u64 * h * n) / (4 * h * n - N as u64 * n - N as u64 * h);
                    return println!("{} {} {}", h, n, w)
                }
            }
        }
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {
    int D; cin>>D;
    if(D==25){
        cout<<"Christmas";
    }
    else if(D==24){
        cout<<"Christmas Eve";
    }
    else if(D==23){
        cout<<"Christmas Eve Eve";
    }
    else if(D==22){
        cout<<"Christmas Eve Eve Eve";
    }
    return 0;
}

Measured memory_bytes: 256
from math import gcd

def main():
    K = int(input())
    ans = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            g = gcd(i, j)
            for k in range(1, K+1):
              ans += gcd(g, k)

    print(ans)

if __name__ == "__main__":
    main()

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

int check(int a){
	if(a<=0)return 0;
	return a/2;
}

int main(){
	int n;
	int a,b,c;
	int i,j,k;
	int s=0;
	cin>>n;
	b=-1,c=0;
	for(i=0;i<n;i++){
		cin>>a;
		if(a!=b){
			s+=check(c);
			b=a,c=1;
		}else c++;
	}
	s+=check(c);
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
 
template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}
 
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; }
 
 
int main()
{
    int N;
    cin >> N;
    vector<int> h(N);
    rep(i,N) cin >> h[i];
 
    vector<ll> dp(N,INF_LL);
    dp[0] = 0;
    rep(i,N)
    {
        //if( i+1 < N ) chmin(dp[i+1], dp[i] + abs(h[i+1] - h[i]));
        //if( i+2 < N ) chmin(dp[i+2], dp[i] + abs(h[i+2] - h[i]));
        if( i+1 < N ) dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1] - h[i]));
        if( i+2 < N ) dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2] - h[i]));
 
        /*
        rep(i,dp.size()) cout << dp[i] << " ";
        cout << endl;
        cout << endl;
        */
    }
 
    cout << dp[dp.size()-1] << endl;
}


Measured memory_bytes: 1408
MOD = 998244353
N, K = map(int, input().split()) #Nはマス目の数、Kは区間の数(Kは10以下)
kukan = [tuple(map(int, input().split())) for _ in range(K)]

dp = [0] * (N+1)
dp[1] = 1

sumdp = [0] * (N+1)
sumdp[1] = 1

for i in range(2, N+1):
    for l, r in kukan:
        li = max(i - l, 0)
        ri = max(i - r - 1, 0)

        dp[i] += sumdp[li] - sumdp[ri]
        dp[i] %= MOD

    sumdp[i] = sumdp[i-1] + dp[i]

print(dp[N])

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

int a[100010], b[100010];

int main () {
	int n; scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	vector <int> t1;
	int ans = 0; long long sum = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &b[i]);
		if (a[i] > b[i]) t1.push_back(a[i] - b[i]);
		else if (a[i] < b[i]) sum += b[i] - a[i], ans++;
	}
	sort(t1.rbegin(), t1.rend());
	int now = 0;
	while (now < t1.size() && sum > 0) {
		ans++, sum -= t1[now++];
	}
	if (sum > 0) printf("-1\n");
	else printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1404
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N, M = list(map(int, input().split()))

if N > 2:
    a = combinations_count(N, 2)
elif N == 2:
    a = 1
else:
    a = 0

if M > 2:
    b = combinations_count(M, 2)
elif M == 2:
    b = 1
else:
    b = 0

print(a+b)

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

using namespace std;

int main()
{
    string day;
    cin >> day;

    if(day == "SUN") printf("7");
    else if(day == "MON") printf("6");
    else if(day == "TUE") printf("5");
    else if(day == "WED") printf("4");
    else if(day == "THU") printf("3");
    else if(day == "FRI") printf("2");
    else if(day == "SAT") printf("1");

    return 0;
}


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

struct Data{
  int x, z;

  bool operator < (const Data& data) const{
    if(z != data.z) return z < data.z;
    return x > data.x;

  }
};

struct Result{
  int x, y;

  bool operator < (const Result& result) const{
    if(y != result.y) return y < result.y;
    return x > result.x;
  }
};

int ta[100001], lt[100001];

int main(){
  int n, r, limit;
  int x, y, z;
  int max = -999999;
  int t = 0, tt = 1;
  priority_queue<Data> Q;
  priority_queue<Result> P;

  cin >> n >> r >> limit;

  for(int i = 0; i < r; i++){
    cin >> x >> y >> z;
    ta[x] += z;
    Q.push((Data){x,ta[x]});
    while(!Q.empty() && Q.top().z != ta[Q.top().x]) Q.pop();
    lt[tt] += y - t; 
      t = y;
      tt = Q.top().x;
  }

  lt[tt] += limit - t;

  max = 1;
  for(int i = 1; i <= n; i++){
    if(lt[i] > lt[max])
      max = i;
  }

  cout << max << endl;

  return 0;
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static int MOD = 1000000000 + 7;
const static llong INF = 1LL << 60;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

template<typename T> T my_gcd(T a, T b) {
    return (a ? my_gcd(b % a, a) : b);
}

template<typename T> T my_lcm(T a, T b){
	return a * b / my_gcd(a, b);	
}

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> A(n);
    int cnt_2n = 0, cnt_4n = 0;
    rep(i, n) {
        int a;
        cin >> a;

        int g = my_gcd(a, 4);
        if (g == 1) continue;
        else if (g == 4) ++cnt_4n;
        else ++cnt_2n;
    }
    if (n == 3) {
        if (cnt_4n >= 1 || cnt_2n == 3) cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
    }

    if (cnt_4n >= n / 2 || cnt_2n == n || 2 * cnt_4n + cnt_2n == n) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=998244353;


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();

    string s;
    cin>>s;
    ll n=s.size();
    if(s[n-1]=='s')
        s+="es";
    else
        s+='s';
    cout<<s;



    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

Measured memory_bytes: 3852