akhauriyash/Code-Regression huggingface dataset:
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

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

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

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

fn main() {
    input! {
        n: usize,
        a_list: [i64; n],
    }
    let sum = {
        let mut sum = 0;
        let mut prev = 0;
        for a in &a_list {
            sum += (prev - a).abs();
            prev = *a;
        }
        sum + a_list[n - 1].abs()
    };
    for i in 0..n {
        let ans = match i {
            0 => sum + a_list[1].abs()
                - a_list[0].abs()
                - (a_list[0] - a_list[1]).abs(),
            m if m == n - 1 => sum + a_list[m - 1].abs()
                - a_list[m].abs()
                - (a_list[m - 1] - a_list[m]).abs(),
            m => sum + (a_list[m - 1] - a_list[m + 1]).abs()
                - (a_list[m - 1] - a_list[m]).abs()
                - (a_list[m] - a_list[m + 1]).abs()
        };
        println!("{}", ans);
    }
}


Measured memory_bytes: 7420
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e3+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n, T;
pii arr[MAXN];
ll dp[MAXN][MAXN];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("../IO/int.txt","r",stdin);
        freopen("../IO/out.txt","w",stdout);
    #endif

    cin>>n>>T;

    for(int i = 1; i <= n; i++){
        int a, b;
        cin>>a>>b;
        arr[i] = {a, b};
    }
    sort(arr + 1, arr + n + 1);
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < T; j++){
            dp[i][j] = dp[i - 1][j];
            ans = max(ans, dp[i - 1][j] + arr[i].ss);
            if(j >= arr[i].ff){
                dp[i][j] = max(dp[i][j], dp[i - 1][j - arr[i].ff] + arr[i].ss);
            }
            ans = max(ans, dp[i][j]);
        }
    }
    cout<<ans<<endl;

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}

Measured memory_bytes: 70784
chomp( my $n = <> );
print( (grep {$_<=$n} qw/1 4 8 9 16 25 27 32 36 49 64 81 100 121 125 128 144 169 196 216 225 243 256 289 324 343 361 400 441 484 512 529 576 625 676 729 784 841 900 961 1000/)[-1])

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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

ll f(ll x, ll m) { return x % m; }

void solve(ll N, ll X, ll M) {
  vector<ll> id(M, -1);
  vector<ll> a;
  ll len = 0;
  ll tot = 0;
  while (id[X] == -1) {
    a.push_back(X);
    id[X] = len;
    len++;
    tot += X;
    X = (X * X) % M;
  }

  ll c = len - id[X];
  ll s = 0;
  for (int i = id[X]; i < len; i++) s += a.at(i);
  ll ans = 0;
  if (N <= len) {
    rep(i, N) ans += a.at(i);
  } else {
    ans += tot;
    N -= len;
    ans += s * (N / c);
    N %= c;
    rep(i, N) ans += a.at(id[X] + i);
  }

  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  ll X;
  scanf("%lld", &X);
  ll M;
  scanf("%lld", &M);
  solve(N, X, M);
  return 0;
}


Measured memory_bytes: 4632
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var b = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));

		var outNum = new HashSet<int>();
		var ans = 0;
		var nums = new Dictionary<int, int>();
		foreach (var num in b) {
			if (outNum.Contains(num)) {
				++ans;
			} else {
				if (nums.ContainsKey(num)) {
					++nums[num];
				} else {
					nums.Add(num, 1);
				}

				if (nums[num] == num) {
					outNum.Add(num);
					nums.Remove(num);
				}
			}
		}

		foreach (var num in nums) {
			ans += num.Value;
		}

		Console.WriteLine(ans);

		//デバッグ実行での確認用。そのまま提出しても問題なし
		Console.ReadKey();
	}
}


Measured memory_bytes: 25436
k=int(input())
ama=[0]*(k)
now=7
if now%k==0:
  print(1)
  exit()
else:
  ama[now%k]+=1
for _ in range(2*k):
  now=(now*10+7)%k
  if now%k==0:
    print(_+2)
    exit()
  elif ama[now%k]==0:
    ama[now%k]+=1
  else:
    print(-1)
    exit()
    
    

Measured memory_bytes: 16696
#include<bits/stdc++.h>
using namespace std;
#define int long long
const long long INF = 10000000000;
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; }

signed main(){
  int N;
  cin >> N;
  int h[12]={1,6,9,36,81,216,729,1296,6561,7776,46656,59049};
  int dp[100000+10];
  for(int i=0;i<100000+10;i++) dp[i]=INF;//初期化の際のiの範囲は配列の要素数！
  dp[0]=0;//初期タッ君
  for(int i=0;i<=N;i++){
    for(int j=0;j<12;j++){
      if(i+h[j]>N) break;
      chmin(dp[i+h[j]],dp[i]+1);
    }
  }
  cout << dp[N] << endl;
  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int i, j, c = 0;
		int[] array = new int[4];
		for(i = 0;i < 4;++i){
			array[i] = sc.nextInt();
			for(j = 0;j < i;++j){
				if(array[j] == array[i]){
					c++;
					array[j] = -1;
					array[i] = -1;
				}
			}
		}
		System.out.println(c >= 2 ? "yes" : "no");
	}
}

Measured memory_bytes: 26324
#include<bits/stdc++.h>
using namespace std;
 
#define Komachi is retarded
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define bcnt __builtin_popcount
#define clz __builtin_clz
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define LB lower_bound
#define UB upper_bound
#define IN insert
#define lp (p<<1)
#define rp (p<<1|1)
#define lson l,mid,lp
#define rson mid+1,r,rp
#define LL long long
#define uLL unsigned long long
#define DB double 
#define INF 1000000000
#define EPS 1e-6
#define debug(a,p) cerr<<a<<p;
#define REP(i,a,b) for(int i=(a),i##_end_=(b);i<i##_end_;i++)
#define DREP(i,a,b) for(int i=(a),i##_end_=(b);i>i##_end_;i--)
 
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0;}
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0;}
 
#define N 1000007
#define M 1000007

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min(min(a+b,a+c),b+c)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
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; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}




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

    vector<int>C(N);
    rep(i,N)cin >> C[i];

    int D = 0;
    rep(i,N){
        if(D>X){
            cout << i << endl;
            return 0;
        }

        D+=C[i];
    }
    if(D>X)cout << N << endl;
    else cout << N+1 << endl;

}

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

int main() {

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

    long l0 = 2;
    long l1 = 1;

    int cnt = 3;
    long temp;
    if (n == 1) {
        printf("%ld", l1);
    } else if (n == 2) {
        printf("%ld", (l0+l1));
    } else {

        while (cnt <= n) {

            temp = l0 + l1;
            l0 = l1;
            l1 = temp;

            cnt++;
        }
        printf("%ld", l0 + l1);
    }

    



    return 0;
}


Measured memory_bytes: 128
package main
 
import "fmt"
 
 
func main() {
  var X int
  
  fmt.Scanf("%d", &X)
  
  i := 0
  money := 100
  for ; money < X; i++ {
    money = int(float64(money) * 1.01)
  }
  fmt.Println(i)
}

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

using namespace std;

int n,l,i;
string s[105];

int main(){
	scanf("%d%d", &n, &l);
	for(i = 0; i < n; i++)
	cin >> s[i];
	sort(s, s + n);
	for(i = 0; i < n; i++)
	cout << s[i];
	cout << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////
#define R(i,n) for(int i=0;i<(n);++i)
/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

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

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////

void solve() {
	int N;
	string S;
	cin >> N>>S;
	char a = 'A';
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		if (i == 0)a = S[i];
		else {
			if (a != S[i]) {
				ans++;
				a = S[i];
			}
		}
	}
	ans++;
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}

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

#define int long long

signed main(){
    string S, T;
    cin>>S>>T;
    int res = 0;
    for(int i=0; i<3; i++){
        if(S[i] == T[i]) res++;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

Int P[5050];
pair<int, int> A[5050];

int main() {
  int N = in();
  P[0] = 0;
  for (int u = 1; u <= N; ++u) {
    P[u] = INFLL;
  }
  for (int i = 0; i < N; ++i) {
    A[i].first = in();
    A[i].second = in();
  }
  sort(A, A + N, [] (const pair<int, int>& a, const pair<int, int>& b) {
    return a.first + a.second < b.first + b.second;
  });

  for (int i = 0; i < N; ++i) {
    int H = A[i].first;
    int Z = A[i].second;
    for (int u = i; u >= 0; --u) {
      if (P[u] <= H) {
        chmin(P[u + 1], P[u] + Z);
      }
    }
  }

  int res = 0;
  for (int u = 0; u <= N; ++u) {
    if (P[u] < INFLL) {
      chmax(res, u);
    }
  }
  printf("%d\n", res);

  return 0;
}


Measured memory_bytes: 384
def factorialMod(n, modulus):
    ans=1
    if n <= modulus//2:
        #calculate the factorial normally (right argument of range() is exclusive)
        for i in range(1,n+1):
            ans = (ans * i) % modulus
    else:
        #Fancypants method for large n
        for i in range(n+1,modulus):
            ans = (ans * i) % modulus
        ans = modinv(ans, modulus)
        ans = -1*ans + modulus
    return ans % modulus


print factorialMod(input(),10**9+7)

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

bool prime(ll x){
    if(x==1)return false;
    for(ll i=2; i<=pow(x,0.5); i++){
        if(x%i==0)return false;
    }
    return true;
}

int main() {
  ll n,ans=0;cin>>n;
  if(prime(n))ans=1;
  else{
    ll m=pow(n,0.5);
    for(ll i=2; i<=m; i++){
      ll c=0;
      while(true){
       if(n%i!=0){break;}
        n/=i;c++;}
    
      ll k=1;
      while(true){
        if(c>=k){c-=k;ans++;}
        else{break;}
        k++;
      }
   // if(prime(n)){ans++;break;}
    
  }
  if(n!=1)ans++;
  }
  cout<<ans;
}
      




Measured memory_bytes: 4064
//21171_somesh || asomesh999

#include<bits/stdc++.h>
using namespace std;
#define fr(i,a,b) for(long long i=a;i<b;i++)
#define io ios::sync_with_stdio(false);cin.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
long int mod=1000000007;

int main()
{
	io
	#ifdef CODE
		clock_t startTime = clock();
		freopen("input.txt","r",stdin);
	#endif

	ll n, a, b;
	cin >> n >> a >> b;
	ll tot = n / (a + b);
	ll rem = n - tot * (a + b);
	ll ans = tot * a + min(rem, a);
	cout << ans;

	#ifdef CODE
		cerr << endl <<setprecision(20)<< double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;
	#endif
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a1,a2,a3;
  scanf("%d %d %d",&a1,&a2,&a3);
  getchar();
  if(a1+a2+a3>=22){
    printf("bust");
  }else{
    printf("win");
  }
  return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;

int main() {
  int N;
  cin >> N;
  ll maxn = 1e6 + 10;
  vector<int> A(N);
  vector<int> used(maxn);
  rep (i, N) {
    cin >>  A[i];
    used[A[i]]++;
  }

  bool ck1 = true;
  for (ll i = 2; i < maxn; i++) {
    int cnt = 0;
    for (ll j = 1; i * j < maxn; j++) {
      cnt += used[i * j];
      if (cnt > 1) {
	ck1 = false;
	break;
      }
    }
  }

  bool ck2 = false;
  int x = gcd(A[0], A[1]);
  for (int i = 2; i < N; i++) {
    x = gcd(x, A[i]);
    if (x == 1) ck2 = true;
  }

  if (ck1) {
    cout << "pairwise coprime" << endl;
  } else if (ck2) {
    cout << "setwise coprime" << endl;
  } else {
    cout << "not coprime" << endl;
  }

  
  return 0;
}


Measured memory_bytes: 11188
n = int(input())
a = sorted(int(input()) for _ in range(n))
ans = sum(a)
if ans % 10 != 0:
    print(ans)
    exit()
else:
    for i in a:
        if (ans-i) % 10 != 0:
            print(ans-i)
            exit()
    print(0)

Measured memory_bytes: 3060
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define PB push_back
#define MP make_pair
#define all(x) x.begin(),x.end()

int main(){
	int A, B, T;
	cin >> A >> B >> T;
	cout << T/A * B << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int floorRoot5(ll n) 
{ 
	// Base cases 
	if (n == 0 || n == 1) 
		return n; 

	// Initialize result 
	int res = 0; 

	// Keep incrementing res while res^5 is 
	// smaller than or equal to n 
	while (res*res*res*res*res <= n) 
		res++; 

	// Return floor of 5'th root 
	return res-1; 
} 

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	ll x;
	cin>>x;
	for(int i= 0; i<=200; i++)
	{
		for(int j = 0; j<=200;j++)
		{
			ll g = pow(i,5LL)-pow(j,5LL);
			ll g2 = pow(i,5LL)+pow(j,5LL);
			if(g==x)
			{
				cout<<i<<" "<<j<<endl;
				return 0;
			}
			if(g2==x)
			{
				cout<<i<<" "<<-j<<endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 4116
/*
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
typedef long long ll;
ll N;

int main()
{
    scanf("%lld",&N);
    ll h,n,w;
    for(h=1;h<=3500;h++){
        for(w=1;w<=3500;w++){
            ll fz=N*h*w;
            ll fm=4*h*w-(N*h+N*w);
            if(fm==0)   continue;
            if(fz%fm!=0)    continue;
            ll n=fz/fm;
            if(n>0&&n<=3500)    {printf("%lld %lld %lld\n",h,n,w); return 0;}
        }
    }
    return 0;
}
*/

///*

#include<stdio.h>
#include<stdlib.h>
typedef long long ll;
int main(){
    ll n;
    bool f=true;
    scanf("%lld",&n);
    for(ll h=1;h<=3500;h++){

        for(ll w=1;w<=3500;w++){
            ll fz=n*h*w;
            ll fm=4*h*w-n*w-n*h;
            if(fm<=0) continue;
            else if((fz%fm)!=0) continue;
            else if((fz%fm)==0){
                ll ans=fz/fm;
                if(ans<=3500&&ans>0){
                    printf("%lld %lld %lld\n",h,w,ans);
                    return 0;
                    //f=false;
                    //break;
                }
            }
        }
    //if(!f) break;
    }

    return 0;
}



//*/


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
	FastReader sc = new FastReader();
	int n = sc.nextInt();
	Map<Integer, Integer> map = new HashMap<>();
	int res = 0;
	for (int i = 0; i < n; i++) {
		int curr = sc.nextInt();
		int prev = curr - 1;
		int next = curr + 1;

		if (prev >= 0) { map.put(prev, map.getOrDefault(prev, 0) + 1); }
		map.put(curr, map.getOrDefault(curr, 0) + 1);
		map.put(next, map.getOrDefault(next, 0) + 1);
	}
	for (int v: map.values()) {
		res = Math.max(res, v);
	}
	System.out.println(res);
  }
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


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

void solve(long long N) {
	for(long long  A=1;A<=3500;A++) {
		for(long long B=A;B<=3500;B++) {
			long long P=4*A*B-N*(A+B);
			long long Q=N*A*B;
			if(P<=0) continue;
			if(Q%P) continue;
			cout<<A<<" "<<B<<" "<<Q/P<<endl;
			return;
        }
        }
    }
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}




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

typedef long long int lli;

long long int max(long long int a,long long int b){
  if(a>b)
    return a;
  else
    return b;
}
typedef pair<int,int> pii;
typedef vector<int> vi;

void solve(){
  string s;
  cin>>s;
  int n = s.length();
  vi ltrap(n);
  for(int i = 1;i<=n-1;i++){
    if(s.at(i)=='L'){
      if(s.at(i-1)=='R'){
        ltrap[i] = i-1;
      }
      else{
        ltrap[i] = ltrap[i-1];
      }
    }
  }
  vi rtrap(n);
  for(int i = n-2;i>=0;i--){
    if(s.at(i)=='R'){
      if(s.at(i+1)=='L'){
        rtrap[i] = i+1;
      }
      else{
        rtrap[i] = rtrap[i+1];
      }
    }
  }

  vector<lli> ans(n);
  for(int i = 0;i<n;i++){
    if(s.at(i)=='L'){
      int tr = ltrap[i];
      int dist = abs(i-tr);
      if(dist%2==0){
        ans[tr]++;
      }
      else{
        ans[tr+1]++;
      }

    }

    else{
      int tr = rtrap[i];
      int dist = abs(tr-i);
      if(dist%2==0){
        ans[tr]++;
      }
      else{
        ans[tr-1]++;
      }
    }

  }

  for(int i = 0;i<n;i++){
    cout<<ans[i]<<" ";
  }
  

}


int main(){
  solve(); 
}

Measured memory_bytes: 2176
LARGE = 10 ** 9 + 7


def solve_a(test=False, a=2, b=16):

    if not test:
        a, b = map(int, input().split())
    if (b - a) % 2 == 0:
        print((a + b) // 2)
    else:
        print("IMPOSSIBLE")


def solve_b(test=False, n=5, p_list=[5, 2, 3, 4, 1]):

    if not test:
        n = int(input())
        p_list = list(map(int, input().split()))

    r = 0
    for i in range(n):
        if p_list[i] != i + 1:
            r += 1
    if r == 0 or r == 2:
        print("YES")
    else:
        print("NO")


def solve_c(test=False, n=2, a_list=[3, 5, 2], b_list=[4, 5]):

    if not test:
        n = int(input())
        a_list = list(map(int, input().split()))
        b_list = list(map(int, input().split()))

    res = 0
    for i in range(n):
        if b_list[i] <= a_list[i]:
            res += b_list[i]
            a_list[i] -= b_list[i]
        elif b_list[i] < a_list[i] + a_list[i + 1]:
            res += b_list[i]
            a_list[i + 1] -= b_list[i] - a_list[i]
            a_list[i] = 0
        else:
            res += a_list[i] + a_list[i + 1]
            a_list[i] = 0
            a_list[i + 1] = 0

    print(res)


def solve_d(test=False, s='??2??5'):

    if not test:
        s = input()

    l = len(s)
    res_list_new = [0] * 13
    res_list_old = [0] * 13
    zero_mod = int(s.replace('?', '0')) % 13
    res_list_new[zero_mod] += 1

    for i in range(1, l + 1):
        if s[-i] == '?':
            for k in range(13):
                res_list_old[k] = res_list_new[k] % LARGE
            base_mod = pow(10, i-1, 13)
            for j in range(1, 10):
                for k in range(13):
                    res_list_new[(k + base_mod * j) % 13] += res_list_old[k]

    print(res_list_new[5] % LARGE)


# solve_a(test=True, a=2, b=16)
# solve_a(test=True, a=0, b=3)
# solve_a(test=True, a=998244353, b=99824435)

# solve_b(test=True, n=5, p_list=[5, 2, 3, 4, 1])
# solve_b(test=True, n=5, p_list=[2, 4, 3, 5, 1])
# solve_b(test=True, n=7, p_list=[1, 2, 3, 4, 5, 6, 7])

# solve_c(test=True, n=2, a_list=[3, 5, 2], b_list=[4, 5])
# solve_c(test=True, n=3, a_list=[5, 6, 3, 8], b_list=[5, 100, 8])
# solve_c(test=True, n=2, a_list=[100, 1, 1], b_list=[1, 100])

# solve_d(test=True, s='??2??5')
# solve_d(test=True, s='?44')
# solve_d(test=True, s='7?4')
# solve_d(test=True, s='?6?42???8??2??06243????9??3???7258??5??7???????774????4?1??17???9?5?70???76???')

solve_c()


Measured memory_bytes: 82020
import java.util.Scanner;
  
class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
            int x = sc.nextInt();
            int y = sc.nextInt();
            int[][]a = new int[x][y];
            int[]b = new int[y];
            int[]c = new int [x];
 
        for(int i =0 ; i < x; i++){
                    for(int j = 0; j < y; j++){
                        a[i][j] = sc.nextInt();
                    }
            }
          



            for(int i = 0; i < y; i++){
                    b[i] = sc.nextInt();
            }


            for(int i = 0; i < x; i++){
                    for(int j = 0; j < y; j++){
                        c[i] += a[i][j] * b[j];
                    }
                    System.out.println(c[i]);
            }
        }
}

Measured memory_bytes: 31796
// Code by ajcxsu
// Geometry template

#include<bits/stdc++.h>
#define EPS (1e-9)
using namespace std;

struct Point {
    double x,y;
    Point(double x=0,double y=0):x(x), y(y) {}

    Point operator +(Point p) { return Point(x+p.x,y+p.y); }
    Point operator -(Point p) { return Point(x-p.x,y-p.y); } // 加减
    Point operator *(double a) { return Point(x*a,y*a); }
    Point operator /(double a) { return Point(x/a,y/a); } // 数乘

    double norm() { return x*x+y*y; } // 范数
    double abs() { return sqrt(norm()); } // 大小

    bool operator < (const Point &p) { return x!=p.x?x<p.x:y<p.y; }
    bool operator == (const Point &p) { return fabs(p.x-x) < EPS && fabs(p.y-y) < EPS; }
} ;
typedef Point Vector;

double dot(const Point &a, const Point &b) {
    return a.x*b.x+a.y*b.y;
} // 内积
double cross(const Point &a, const Point &b) {
    return a.x*b.y-a.y*b.x;
} // 外积
bool equals(double a, double b) { return fabs(a-b)<EPS; } // 误差相等

struct Line {
    Point p1,p2;
} ;
typedef Line Seg;

/* 1 正交 2 平行 0 其他 */
int PO(Vector a, Vector b) {
    if(equals(dot(a,b), 0)) return 1;
    else if(equals(cross(a,b), 0)) return 2;
    else return 0;
}
int PO(Line a, Line b) { // 正交、平行判定
    return PO(a.p2-a.p1, b.p2-b.p1);
}

istream& operator >>(istream &in, Vector &a) {
    in>>a.x>>a.y;
    return in;
}
istream& operator >>(istream &in, Line &a) {
    in>>a.p1>>a.p2;
    return in;
} // 输入重载

Point project(Point a, Seg b) {
    Vector base=b.p2-b.p1;
    Vector hypo=a-b.p1;
    return b.p1+base*(dot(base, hypo)/ base.norm());
}

Point ref(Point a, Seg b) {
    Vector base=project(a,b)-a;
    return a+base*2;
}

ostream& operator <<(ostream &out, Vector a) {
    out<<a.x<<' '<<a.y;
    return out;
} // 输出重载

int main() {
    cout.setf(ios::fixed);
    cout<<setprecision(10); // 设置输出精度

    Line x;
    cin>>x;
    int q;
    cin>>q;
    while(q--) {
        Point a;
        cin>>a;
        cout<<ref(a,x)<<endl;
    }
    return 0;
}



Measured memory_bytes: 3284
import heapq
from math import ceil
n,m = map(int,input().split())
A = list(map(int,input().split()))
hq = list(map(lambda x:-1*x ,A))
heapq.heapify(hq)

for i in range(m):
    a = heapq.heappop(hq)
    a = ceil(a/2)
    heapq.heappush(hq,a)
print(-1*sum(hq))


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

namespace ABC088A_cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = int.Parse(Console.ReadLine());
            if (n % 500 <= a)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13140
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define BP(x) __builtin_popcountll(x)
#define PQS priority_queue <int, vector<int>, greater<int> > 
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

const int INF = 1e18 + 0;
//const int mod = 1e9 + 7;
const int mod = 998244353;
const int N = 2e5 + 5;

int dp[N];

int add(int a, int b) { a %= mod; b %= mod; return ((a + b) % mod); }
int sub(int a, int b) { a %= mod; b %= mod; return  ((a - b + mod) % mod);}

void solve() {
  int n, k;    
  cin >> n >> k;
  
  vector<pii> v(k);

  for(int i = 0; i < k; i++) {
    cin >> v[i].ff >> v[i].ss;
  }
  
  dp[1] = 1;
  for(int i = 2; i <= n; i++) {
    int cur = 0;
    for(int j = 0; j < k; j++) {
      int x = max(0ll, i - v[j].ff), y = max(0ll, i-v[j].ss);
      y = max(0ll, y-1);
      cur = add(cur, sub(dp[x], dp[y]));
    }
    dp[i] = add(cur, dp[i-1]);
  }

  int ans = sub(dp[n], dp[n-1]);

  cout << ans << '\n';
}

/*
  * overflow, array bounds
  * do smth instead of nothing and stay organized
*/
signed main() {   
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

  #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
  #endif
   int t = 1; // cin >> t;
   for(int i = 1; i <= t; i++) {
   //  cout << "Case #" << i << ": ";
     solve();
  }
}    

/*

*/

Measured memory_bytes: 5216
import sys
input = sys.stdin.readline
 
MOD = 10**9 + 7
def main():
    S = input()
    N = len(S)-1
 
    if S[0] == '?':
        dp = [1,1,1,1,1,1,1,1,1,1,0,0,0]
    else:
        dp = [0] * 13
        dp[int(S[0])] = 1
 
    for i in range(1,N):
        dppre = dp
        dp = [0] * 13
 
        if S[i] == '?':
            R = range(10)
        else:
            R = [int(S[i])]
        
        for j in range(13):
            for k in R:
                dp[(j * 10 + k) % 13 ] += dppre[j]
        for j in range(13):
            dp[j] %= MOD
 
    print(dp[5])
if __name__ == '__main__':
    main()

Measured memory_bytes: 44320
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>

using namespace std;

#define int long long

signed main()
{
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> v;
    for (int i = 0; i < N; i++)
    {
        int a, b;
        cin >> a >> b;
        v.push_back({a, b});
    }

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

    int ans = 0;
    int nbottle = 0;
    for (int i = 0; i < v.size(); i++)
    {
        int value = v[i].first;
        int nbottle_max = v[i].second;
        if (nbottle + nbottle_max >= M)
        {
            ans += (M - nbottle) * value;
            break;
        }
        else
        {
            ans += nbottle_max * value;
            nbottle += nbottle_max;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n][3];
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<3;j++)
    {
      cin>>a[i][j];
    }
  }
  int dp[n][3];
  dp[0][0]=a[0][0];
  dp[0][1]=a[0][1];
  dp[0][2]=a[0][2];
  for(int i=1;i<n;i++)
  {
    dp[i][0]=max(a[i][0]+dp[i-1][1],a[i][0]+dp[i-1][2]);
    dp[i][1]=max(a[i][1]+dp[i-1][0],a[i][1]+dp[i-1][2]);
    dp[i][2]=max(a[i][2]+dp[i-1][0],a[i][2]+dp[i-1][1]);
  }
  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define int long long
#define maxn 100005
#define inf 2000000000000000000
#define mod 1000000007
#define pb push_back
#define mp make_pair
const double PI = acos(-1);
using namespace std;

int n,k, f[maxn],sum[maxn];
int fastmul(int x,int so){
	if (so==0) return 1; if (so==1) return x%mod;
	int t=fastmul(x,so/2); t=(t*t)%mod;
	if (so%2==1) t=(t*x)%mod;
	return t;
}
main(){
	ios::sync_with_stdio(false); cin.tie(0); srand(time(NULL));
	//freopen("inp.txt","r",stdin); //freopen("out.txt","w",stdout);
	//freopen(".inp","r",stdin); freopen(".out","w",stdout);
	cin>>n>>k; int i,j,x;
	f[1]=1; sum[1]=0;
	for (i=2;i<=k;i++){
		f[i]=fastmul(i,n); sum[i]=sum[i-1];
		int val=1;
		for (j=2;j<=sqrt(i);j++){
			if (i%j==0){
				x=i/j;
				sum[i]=sum[i]-f[x-1]+f[x]; sum[i]%=mod;
				if (i/j!=j){
					sum[i]=sum[i]-f[j-1]+f[j]; sum[i]%=mod;
				}
			}
		}
		sum[i]+=f[1]; sum[i]%=mod;
		f[i]=(f[i]+mod-sum[i])%mod;
	}
	int ans=0;
	for (i=1;i<=k;i++){
		j=(k/i);
		ans+=i*f[j]; ans%=mod;
	}
	cout<<ans;
}

Measured memory_bytes: 5188
#4問目
s = input()
K = int(input())
result = []
for i in range(1, min(len(s)+1, 6)):
    if(i == 1):
        for j in list(s):
            result.append(j)
    else:
        n = 0
        m = n + i
        while m <= len(s):
            result.append(s[n:m])
            n += 1
            m = n + i

result = set(result)
s = sorted(result)
print(s[K-1])

Measured memory_bytes: 40304
#include <iostream>

using namespace std;
int main() {
	int cross = 0;
	int line = 0;

	int a, b;
	for(int i = 0; i < 3; i++){
		cin >> a >> b;
		if (a - b == 2 || b - a == 2) {
			cross++;
		}
		else {
			line++;
		}
	}

	if(cross == 2 && line == 1){
		cout << "YES";
		return 0;
	}

	if (line == 3){
		cout << "YES";
		return 0;
	}

	cout << "NO";

	return 0;
}

Measured memory_bytes: 256
import heapq

N, M = map(int,input().split())
A = list(map(lambda x: int(x) * (-1),input().split()))
heapq.heapify(A)
for i in range(M):
    tmp = heapq.heappop(A)
    tmp *= -1
    tmp //= 2
    tmp *= -1
    heapq.heappush(A,tmp)
print(sum(A) * -1)

Measured memory_bytes: 14180
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <iterator>
#include <random>
#include <cmath>
#include <functional>


using namespace std;
using lint = long long int;


lint solve(lint a, lint b) {
	auto x_min = ceil(a / 0.08);
	auto y_min = ceil(b / 0.1);
	auto x_max = (a + 1) / 0.08 - 0.0000001;
	auto y_max = (b + 1) / 0.1 - 0.0000001;
	if (x_max < y_min || y_max < x_min) {
		return -1;

	}
	return max((lint)x_min, (lint)y_min);
}

int main() {
	lint a, b;
	cin >> a >> b;
	cout << solve(a, b);

	//lint pre_solution = 0;
	//for (int a = 1; a <= 100; a++) {
	//	for (int b = 1; b <= 100; b++) {
	//		lint solution = solve(a, b);
	//		if (solution >= 0) {
	//			int a_sol = int(solution * 0.08);
	//			int b_sol = int(solution * 0.1);
	//			if (a_sol != a || b_sol != b) {
	//				cout << a_sol << " " << b_sol << " " << a << " " << b << endl;
	//				lint solution = solve(a, b);
	//			}
	//		}
	//	}
	//}

	return 0;
}


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

#define coutv(v) for (int i = 0; i < (v).size(); ++i) cout << v[i] << ' '; cout << endl;
#define coutvv(v) for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cout << v[i][j] << ' '; cout << endl;}
#define debugv(v) {for (int i = 0; i < (v).size(); ++i) cerr << v[i] << ' '; cerr << endl;}
#define debugvv(v) {for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cerr << v[i][j] << ' '; cerr << endl;}}
#define TC int TESTCASE; cin >> TESTCASE; while (TESTCASE--)
typedef long long ll;


int main() {
    string s;
    cin >> s;
    int res = 0;
    for (int i = 0; i < 4; i++) {
        if (s[i] == '+') {
            res += 1;
        } else {
            res -= 1;
        }
    }
    cout << res;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int N, M;
    cin >> N >> M;
    vector<bool> ok(N + 1, true);
    REP(i, M) {
        int a;
        cin >> a;
        ok[a] = false;
    }

    vector<ll> dp(N + 1);
    dp[0] = 1;
    REP(now, N) {
        FOR(next, now + 1, min(N, now + 2) + 1) {
            if (ok[next]) {
                dp[next] += dp[now];
                MOD(dp[next]);
            }
        }
    }

    std::cout << dp[N] << '\n';

    return 0;
}

Measured memory_bytes: 1024
// Beginner160.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <bits/stdc++.h>
#include <iostream>

using  namespace std;
typedef long long ll;

int main()
{
	/*string s;
	cin >> s;
	cout << (s[2] == s[3] && s[4] == s[5] ? "Yes" : "No") << '\n';*/

	/*int x;
	cin >> x;

	int y500 = x / 500;
	x -= y500 * 500;
	int y5 = x / 5;

	ll resut = y500 * 1000 + y5 * 5;

	cout << resut  << '\n';*/

	int k, n;
	cin >> k >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];


	ll result = 0;
	int max_dist = -1;
	int max_dist_i = -1;
	for (int i =0; i < n-1; ++i)
	{
		int dist = a[i + 1] - a[i];
		if (dist > max_dist)
		{
			max_dist = dist;
			max_dist_i = i;
		}
	}

	int last_dist = k - a[n - 1] + a[0];
	if (last_dist > max_dist)
	{
		max_dist = last_dist;
		max_dist_i = n - 1;
	}

	for (int i = 0; i < n; ++i)
	{
		if (i == max_dist_i) continue;
		if (i == n - 1) result += last_dist;
		else result += a[i + 1] - a[i];
	}

	cout << result << '\n';
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    string S;
    cin >> S;
    string T = S;
    reverse(T.begin(),T.end());
    string R = S.substr(0,S.size()/2);
    string I = S.substr(S.size()/2+1,S.size()/2);
    if(S == T) {
        for(int i = 0; i < R.size(); i++) {
            if(R[i] != R[R.size()-1-i] || I[i] != I[R.size()-1-i]) {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3656
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int h,w;
  cin >> h >> w;
  char a[h][w]={};
  bool hei[h]={},wid[w]={};
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      cin >> a[i][j];
      if(a[i][j]=='#') {
        hei[i]=true,wid[j]=true;
      }
    }
  }
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      if(hei[i]==true&&wid[j]==true) {
        cout << a[i][j];
      }
    }
    if(hei[i]==true) {
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    i = 0
    while True:
        n = N - 4 * i
        if n < 0:
            break
        if n % 7 == 0:
            print('Yes')
            return
        i += 1
    print('No')


if __name__ == '__main__':
    main()


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

/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int
#define endl '\n'

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/*template*/
template<class T>constexpr bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>constexpr bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
constexpr int32_t GCD(int32_t a, int32_t b){return b ? GCD(b, a%b) : a;}
constexpr int64_t GCD(int64_t a, int64_t b){return b ? GCD(b, a%b) : a;}
constexpr int32_t LCM(int32_t a, int32_t b){return a / GCD(a, b) * b;}
constexpr int64_t LCM(int64_t a, int64_t b){return a / GCD(a, b) * b;}

/* const */
constexpr int32_t INF = 1001001001;
constexpr int64_t LINF = 1001001001001001001ll;
constexpr int32_t MOD = 1e9 + 7;
constexpr int32_t EPS = 1e-9;
constexpr int32_t dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//constexpr int32_t dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

#define int int64_t

/*global*/



signed main()
{
	int n; cin >> n;
	int a = 1;
	int b{};
	for(int i{}; i < n; ++i)
	{
		int q{};cin >> q;
		int x{};cin >> x;
		if(q == 1)
		{
			a *= x;
			b *= x;
		}
		else if(q == 2)
		{
			b += x;
		}
		else if(q == 3)
		{
			b -= x;
		}
	}
	cout << -b <<" " << a << '\n';
}


Measured memory_bytes: 3176
def cal(a,b)
   if( (r = a % b) != 0 )
      cal(b,r);
   else
      return b;
   end
end

while n = gets
  a, b = n.chomp.split
  a, b = a.to_i, b.to_i

  g = cal(a,b)
  l = a*b/g

  puts "#{g} #{l}"
end




Measured memory_bytes: 6856
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    var ny = input[0].split(' ');
    var n = parseInt(ny[0], 10);
    var y = parseInt(ny[1], 10);


    var a = -1;
    var b = -1;
    var c = -1;

    for (var i = 0; i <= n; i++) {

        if (((y / 1000) - n - 4 * i) % 9 === 0) {
            a = ((y / 1000) - n - 4 * i) / 9;
            b = i;
            c = n - a - b;
            if (a < 0 || b < 0 || c < 0) {
                a = -1;
                b = -1;
                c = -1;
            }
            else {
                break;
            }
        }
    }

    console.log(a + ' ' + b + ' ' + c);

    return 0;
}


Measured memory_bytes: 11596
#include <stdio.h>
#include <math.h>

int main(void){
 char s[3];
  int count = 0;
  scanf("%s", s);
  
  if(s[0]=='R'&&s[1]=='R'&&s[2]=='R'){
    count = 3;
  }
   else if(s[0]=='R'&& s[1]=='R' && s[2]!='R'){
      count = 2;
    }
  else if(s[0]=='R'&&s[1]!='R'&&s[2]=='R'){
    count =1;
  }
  else if(s[0]=='R'&&s[1]!='R'&&s[2]!='R'){
    count = 1;
  }
   else if(s[0]!='R'&&s[1]=='R'&&s[2]=='R'){
     count = 2;
   }
  else if(s[0]!='R'&&s[1]!='R'&&s[2]=='R'){
    count = 1;
  }
  else if(s[0]!='R'&&s[1]=='R'&&s[2]!='R'){
    count = 1;
  }
  else if(s[0]!='R'&&s[1]!='R'&&s[2]!='R'){
    count = 0;
  }
  
  
    

  printf("%d", count);

  return 0;
}

Measured memory_bytes: 1668
#include<iostream>
#include<cstdio>
#include<cstring>
#define ll long long
using namespace std;
ll ans,cnt[30];
char s[200010];
int main()
{
	scanf("%s",s);
	ll len=strlen(s);
	ans=(len-1)*len/2+1;
	for(int i=0;i<len;i++) cnt[s[i]-'a']++;
	for(int i=0;i<26;i++) ans-=cnt[i]*(cnt[i]-1)/2;
	printf("%lld",ans);
}

Measured memory_bytes: 384
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
int main(){
  int N;
  int L,R;
  int ans=0;
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d %d",&L,&R);
    ans+=R-L+1;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
s=input()
k=int(input())


l=len(s)


if len(s)==1:
    print(k//2)
else:
    i=0
    cnt=0
    flag1=0
    while(i<l-1):
        if s[i]==s[i+1]:
            cnt+=1
            if i+1==l-1:
                flag1=1
            i+=2
        else:
            i+=1
    
    #cnt2=cnt
    
    i=1
    cnt2=1
    flag2=0
    while(i<l-1):
        if s[i]==s[i+1]:
            cnt2+=1
            if i+1==l-1:
                flag2=1
            i+=2
        else:
            i+=1
    
    #print(cnt,cnt2,flag1,flag2)
    if s[0]==s[-1]:
        if flag1==1:
            ans=cnt*k
        elif flag2==1:
            ans=(k//2+k%2)*cnt+(k//2)*cnt2
        else:
            ans=cnt+cnt2*(k-1)
    else:
        ans=cnt*k
            
    print(ans)

Measured memory_bytes: 3064
A,B=map(int,input().split())
i=0
while i<1001:
    X=int(i*0.08)
    Y=int(i*0.10)
    if A==X and B==Y:
        break
    i=i+1
if i==1001:
    i=-1
    print(i)
else:
    print(i)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,i,s=0;
    scanf("%d %d",&a,&b);
    for(i=a/100;i<=b/100;i++)
    {
        s++;
    }
    if((a/100*10+a/1000%10)*10+a/10000<a)
         s--;
    if((b/100*10+b/1000%10)*10+b/10000>b)
        s--;
     printf("%d\n",s);
    return 0;
}

Measured memory_bytes: 256
X,N = map(int,input().split())
if N>0:
    p = list(map(int,input().split()))
else:
    p = []
ans = []
for i in range(100):
    ans.append(X-i)
    ans.append(X+i)
import sys
for j in ans:
    if j not in p:
        print(j)
        sys.exit()

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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  if (a+b<a+c&&a+b<b+c) {
    cout<<a+b<<endl;
  }
  else if (a+c<a+b&&a+c<b+c) {
    cout<<a+c<<endl;
  }
  else {
    cout<<b+c<<endl;
  }
  
}


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

int N,X,D,A[100010];

int gcd(int n,int m){
	if(n%m==0) return m;
	else return gcd(m,n%m);
}

int main(){
	cin >> N >> X;
	int ans;
	for(int i=0;i<N;i++){
		cin >> A[i];
		if(i==0) ans = abs(A[i]-X);
		else ans = gcd(ans,abs(A[i]-X));
	}
	cout << ans << endl;
}

Measured memory_bytes: 640