akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 100 + 10;
char s[N];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  int ret = INF;
  for (int i = 0; i < 26; ++i) {
    for (int k = 0; k < n; ++k) {
      int u;
      for (u = 0; u < n - k; ++u) {
        bool found = false;
        for (int v = 0; v <= k; ++v) {
          if (s[u + v] == 'a' + i) {
            found = true;
            break;
          }
        }
        if (!found) break;
      }
      if (u == n - k) {
        ret = min(ret, k);
      }
    }
  }
  printf("%d\n", ret);
  return 0;
}


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

int main(){
    string s;
    cin>>s;
    int n=s.size();
    int ans=0;
    for(int i=1;i<n;i++){
        if(s[i]!=s[i-1]) ans++;
    }

    cout<<ans;
        
}

Measured memory_bytes: 512
n,k,c = map(int,input().split())
s = input()

left = []
cnt = 0
now = 0
while(cnt < k):
    if(s[now]=='o'):
        left.append(now)
        cnt += 1
        now += c
    now += 1

right = []
cnt = 0
now = len(s)-1
while(cnt < k):
    if(s[now]=='o'):
        right.append(now)
        cnt += 1
        now -= c
    now -= 1

right = right[::-1]
for l,r in zip(left,right):
    if(l==r):
        print(l+1)

Measured memory_bytes: 20840
import sys
sys.setrecursionlimit(2 ** 20)

class Node():
    def __init__(self, parent=-1, left=-1, right=-1):
        '''
        :param parent: parent node
        :param left: left child
        :param right: right child
        '''
        self.parent = parent
        self.left = left
        self.right = right

    def __repr__(self):
        return '<Node object: parent={}, left={}, right={}>' .format(self.parent, self.left, self.right)

    def get_node_type(self):
        if self.parent == -1:
            return 'root'
        elif self.left == -1 and self.right == -1:
            return 'leaf'
        else:
            return 'internal node'

    def get_degree(self):
        degree = 0
        if self.left != -1:
            degree += 1
        if self.right != -1:
            degree += 1
        return degree


def get_sibling(T, u):
    if T[u].parent == -1:
        return -1
    elif T[T[u].parent].left != u:
        return T[T[u].parent].left
    else:
        return T[T[u].parent].right

def set_depth(u, p):
    '''
    u: Node ID
    p: Initial depth
    '''
    if u == -1:
        return
    D[u] = p
    set_depth(T[u].right, p + 1)
    set_depth(T[u].left, p + 1)

def set_height(u):
    h1 = h2 = 0
    if T[u].right != -1:
        h1 = set_height(T[u].right) + 1
    if T[u].left != -1:
        h2 = set_height(T[u].left) + 1

    H[u] = max(h1, h2)
    return H[u]


n = int(input())
# initialize tree
T = [Node() for _ in range(n)]
for i in range(n):
    idx, left, right = map(int, input().split())
    T[idx].left = left
    T[idx].right = right

    # set children's parent if Node idx is not leaf
    if left != -1:
        T[left].parent = idx
    if right != -1:
        T[right].parent = idx

D = [0] * n
H = [0] * n
for i in range(n):
    if T[i].parent == -1:
        set_depth(i, 0)
        set_height(i)
        break

for i, node in enumerate(T):
    print('node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}'.format(
        i, node.parent, get_sibling(T, i), node.get_degree(), D[i], H[i], node.get_node_type())
    )


Measured memory_bytes: 5644
S=input()

if S=="SUN":
    x=7
elif S=="MON":
    x=6
elif S=="TUE":
    x=5
elif S=="WED":
    x=4
elif S=="THU":
    x=3
elif S=="FRI":
    x=2
elif S=="SAT":
    x=1
    
print(x)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, l; cin >> n  >> l;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n - 1; i++){
		if(a[i] + a[i + 1] >= l){
			cout << "Possible" << endl;
			for(int j = 0; j < i; j++) cout << j + 1 << endl;
			for(int j = n - 2; j > i; j--) cout << j + 1 << endl;
			cout << i + 1 << endl;
			return 0;
		}
	}
	cout << "Impossible" << endl;
	return 0;
}


Measured memory_bytes: 1152
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>

using namespace std;

/// 各桁の和
int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;    
    }
    return sum;
}
/// 最大公約数 
int gcd(int x, int y){
      if(x<y){
          int temp = x;
          x = y;
          y = temp;
      }
      int r = x % y;
       while(r!=0){
           x = y;
           y = r;
           r = x % y;
       }
      return y;
   }



int main(){
int N,M;
cin >> N >> M;
vector<int> cnt(M+1);
for(int i = 0; i< N;i++){
    int x;
    cin >> x;
    for(int j=0;j<x;j++){
        int y ;
        cin >> y;
        cnt[y]++;
    }
}
int ans=0;
for(int i=0;i<=M;i++){
    if(cnt[i] == N){
        ans++;
       
    }

}
cout << ans << endl;
}

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

int main(){
    string S;cin >> S;
    int ans = 0;
    for(int i = 0; i < S.length(); i++){
        int l = 0;
        if(S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T'){
            l = 1;
            if(i != S.length()-1){
                for(int j = i+1; j < S.length() ; j++){
                    if(S[j] == 'A' || S[j] == 'C' || S[j] == 'G' || S[j] == 'T'){
                        l++;
                    }else{
                        break;
                    }
                }    
            }
            if(ans <= l){
                ans = l;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int t = sc.nextInt();
        int[] time = new int[n];
        for(int i = 0; i < n; i++){
            time[i] = sc.nextInt();
        }
        long sum = 0;
        int add = 0;
        for(int i = 0; i < n-1; i++){
            add = Math.min(t,time[i+1]-time[i]);
            sum = sum + add;
        }
        System.out.print(sum+t);
    }
}

Measured memory_bytes: 64752
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int INF=1e9;
const int MOD=1e9+7;
const double pi=acos(-1);

int main(){
  string s,t;
  cin >> s >> t;
  reverse(s.begin(),s.end());
  reverse(t.begin(),t.end());
  bool can=false;
  rep(i,s.size()-t.size()+1){
    bool ok=true;
    rep(j,t.size()){
      if(t[j]==s[i+j]||s[i+j]=='?')continue;
      ok=false;
    }
    if(ok){
      rep(j,t.size()){
        s[i+j]=t[j];
      }
      can=true;
      break;
    }
  }
  if(!can)cout<<"UNRESTORABLE"<<endl;
  else{
    reverse(s.begin(),s.end());
    rep(i,s.size()){
      if(s[i]=='?')s[i]='a';
    }
    cout << s << endl;
  }
    
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
   int n,i;
   long long int ans=0;
   scanf("%d",&n);
   ans=n;
   for(i=1;n-i>=1;i++){
      ans*=n-i;
   }
   printf("%lld\n",ans);
 
   return 0;
}


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

int64_t z(int64_t x)
{
  if(x>=0)
    return x;
  else
    return x*-1;
}

int main()
{
  int64_t n,k,ans;
  ans=1000000000;
  cin>>n>>k;
  vector<int64_t> h(n);
  for(int i=0;i<n;i++)
  {
    cin>>h.at(i);
  }
  sort(h.begin(),h.end());
  for(int i=0;i<=n-k;i++)
  {
    ans=min(ans,z(h.at(i)-h.at(i+k-1)));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[100001][3];
ll a[100001][3];ll n;
ll ans(ll ind,ll status){
  if(ind>n-1)return 0;
  if(dp[ind][status]!=-1)return dp[ind][status];
  dp[ind][status] = numeric_limits<ll>::min();
  for(ll i=0;i<3;i++){
      if(i!=status)
  		dp[ind][status] = max(ans(ind+1,i)+a[ind][i],dp[ind][status]);
  }
  return dp[ind][status];
}
int main(){
  memset(dp,-1,sizeof(dp));
  cin>>n;for(ll i=0;i<n;i++)cin>>a[i][0]>>a[i][1]>>a[i][2];
  cout<<max(ans(1,0)+a[0][0],max(ans(1,1)+a[0][1],ans(1,2)+a[0][2]))<<endl;
  return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
 
int main() {
  int N,M;
  cin >> N >> M;
 
  UnionFind UF(N);
  for (int i = 0; i < M; i++){
    int A,B;
    cin >> A >> B;
    A -= 1;
    B -= 1;
    UF.unite(A, B);
  }
  
  int count = 0;
  for (int i = 0; i < N; i++){
    if (UF.same(0, i)){
      count = count;
    }
    else {
      count++;
      UF.unite(0, i);
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3756
N,K = map(int,input().split())
P = list(map(int,input().split()))
ans = 0
D = [0]+[(p+1)/2 for p in P]
res = 0
for i in range(N+1):
    res += D[i]
    if i>=K:
        res-=D[i-K]
        ans = max(res,ans)
print(ans)

Measured memory_bytes: 24812
import java.util.*;

public class Main {

//    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
//        int N = sc.nextInt();
//        int[] arr = new int[N];
//
//        for (int i = 0; i <N ; i++) {
//            arr[i] = sc.nextInt();
//        }
//
//        if(N%2==0){
//            long ans1 =0;
//            for (int i = 0; i < N ; i=i+2) {
//                ans1+=arr[i];
//            }
//            long ans2 =0;
//            for (int i = 1; i < N ; i=i+2) {
//                ans2+=arr[i];
//            }
//            System.out.println(Math.max(ans1,ans2));
//
//        }else{
//
//            long ans = Integer.MIN_VALUE;
//            for (int j = 0; j < N; j++) {
//
//                long ans1 =0;
//                for (int i = 0; i < N ; i=i+2) {
//                    if(i==j){
//                        i++;
//                        if(i>=N) break;
//                    }
//                    ans1+=arr[i];
//                }
//                long ans2 =0;
//                for (int i = 1; i < N ; i=i+2) {
//                    if(i==j){
//                        i++;
//                        if(i>=N) break;
//                    }
//                    ans2+=arr[i];
//                }
//
//                ans = Math.max(ans,Math.max(ans1,ans2));
//
//            }
//            System.out.println(ans);
//
//        }
//    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();

        long[] gcdArr = new long[K+1];

        for (int g = K ; g>=1 ; --g){
            gcdArr[g] = (long)mpow(K/g, N);
            int gg= g *2;
            while(gg <=K){
                gcdArr[g] -=gcdArr[gg];

                gg += g;
            }
        }

        long ans =0;

        for (int i = 1; i <= K; i++) {
            ans += gcdArr[i] * i;
            ans = (ans) % 1000000007;
        }

        System.out.println(ans % 1000000007);

    }
    static final int MOD = 1_000_000_007;
    static long mpow(long a, long b) {
        if (b == 0) return 1;
        long ret = mpow(a, b >> 1);
        ret = (ret * ret) % MOD;
        if (b % 2 == 1)
            ret = (a * ret) % MOD;
        return ret;
    }

}


Measured memory_bytes: 36552
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

#include <atcoder/fenwicktree>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(...) DBG2::print(#__VA_ARGS__, __LINE__, __VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;



int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   int N, Q;
   cin >> N >> Q;

   atcoder::fenwick_tree<llong> FT(N);
   REP(i, N) {
      int a;
      cin >> a;
      FT.add(i, a);
   }

   REP(q, Q) {
      int t;
      cin >> t;
      if (t == 0) {
         int p, x;
         cin >> p >> x;
         FT.add(p, x);
      }
      else {
         int L, R;
         cin >> L >> R;
         llong res = FT.sum(L, R);
         cout << res << '\n';
      }
   }

   return 0;
}


Measured memory_bytes: 8252
n = input()
n = int(n)
a = input().split()
a = [int(aa) for aa in a]
ans = 0
#a = map(int, input().split())
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        ans = max(ans, abs(a[i] - a[j]))
print(ans)

Measured memory_bytes: 39792
import qualified Data.ByteString.Char8 as C
import Data.List



main :: IO ()
main = do
    [y,m,_] <- unfoldr (C.readInt . C.dropWhile (=='/')) <$> C.getLine
    let r = if y < 2019 then "Heisei"
            else if m <= 4 then "Heisei" else "TBD"
    putStrLn r





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

using namespace std;

string S;

void input()
{
  cin >> S;
}

int main()
{
  input();

  int ans = 0;
  int sCnt = 0;

  for (size_t i = 0; i < S.length(); i++) {
    if(S[i] == 'T'){
      if(sCnt == 0){
        ans++;
      }
      else{
        sCnt--;
      }
    }
    else{
      sCnt++;
    }
  }
  cout << ans + sCnt << endl;

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数s 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}

bool chk(string &s, ll a,ll b){
    fr(i,a - 1, b - 1){
        auto j = i +1;
        if(s[i] == '#' && s[j]== '#') {
            return false;
        }
    }
    return true;
}

int main() {
    ll n,x,m;
    cin>>n;
    vector<ll> v(n);
    cin>>v;
    ll sum = 0;
    rep(i, n) {
        sum+=v[i];
    }
    ll uu = 0;
    ll ans = sum;
    rep(i, v.size() -1){
        sum-=v[i];
        uu+=v[i];
        ans = min(ans, abs(sum - uu));
    }


    pr(ans);

    
    return 0;
}


Measured memory_bytes: 888
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        sc.close();

        int cnt = 0;
        for(int i=a; i<=b; i++) {
            if(c % i == 0) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }
}



Measured memory_bytes: 26268
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<utility>
#include<functional>
#include<cassert>
#include<cmath>
#include<math.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vint;
typedef vector<vint> vvint;
#define PI 3.1415926535;
#define MOD 1000000007;



int main(void) {
	int x;
	cin >> x;
	vvint dp(6,vint(100150));
	for (int i = 0; i < 6;i++) {
		dp[i][0] = 1;
	}
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < x; j++) {
			if (dp[i][j] == 1) {
				for (int k = 0; k < 6; k++) {
					dp[i][j + 100 + k] = dp[i +1][j + 100 + k] = 1;
				}
			}
		}
	}
	cout << dp[5][x] << endl;
	return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    string s,t; cin>>s>>t;
    cout<<t<<s<<endl;
}



Measured memory_bytes: 3636
/** "Ever tried.
         Ever failed.
               No matter.
                   Try Again.
                        Fail again.
                             Fail better.**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define bp  __builtin_popcount
#define pb push_back
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define sz(s) (int)(s.size())
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define setdp memset(dp,-1,sizeof(dp))
#define fr first
#define sc second
#define NumofDigits(n)   ((long long)log10(n)+1)
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int maxn=1e5+5;
const  double EPS = 1e-9;
const int MOD = 1e9+7;
/*
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll fastpow(ll b, ll p)
{if(!p)return 1;ll ret = fastpow(b, p >> 1);ret *= ret;if(p&1)ret*= b;return ret;}
int dx[] = {- 1, 0, 0, 1, 0 };
int dy[] = { 0,- 1, 1, 0, 0 };*/
void File()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}


int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    string s,ss;
    cin>>s>>ss;
    if(sz(s)>sz(ss))
        cout<<"GREATER";
    else if(sz(s)<sz(ss))
        cout<<"LESS";
    else
    {
        for(int i=0; i<sz(s); i++)
        {
            if((s[i]-'0')>(ss[i]-'0'))
                return cout<<"GREATER",0;
            else if((s[i]-'0')<(ss[i]-'0'))
                return cout<<"LESS",0;
        }
        cout<<"EQUAL";
    }
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int a[2000005];
int main()
{
   //freopen("t5.in","r",stdin);
   //freopen("t5.out","w",stdout);
   //ios::sync_with_stdio(false);
   //cin.tie(0); cout.tie(0);
    int i,j,m;
    long long n;
    string x;
    cin>>x;
    int flag=0;
    if(x.size()==6)
    {
        if(x[2]==x[3]&&x[4]==x[5])flag=1;
    }
    if(flag)puts("Yes");
    else puts("No");

    return 0;
}


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

int main() {
	int a, b;
	while (cin >> a >> b, a | b) {
		int temoti[50]{}, ba = b;
		for (int i = 0;; i++) {
			if (ba) {
				ba--;
				temoti[i%a]++;
				if (temoti[i%a] == b) { cout << i % a << endl; break; }
			}
			else {
				ba = temoti[i%a];
				temoti[i%a] = 0;
			}
		}
	}
}

Measured memory_bytes: 2992
using System;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        new Program().SolveB();
        Console.ReadKey();
    }

    Scanner sc = new Scanner();
    void SolveA()
    {
        string s = sc.Next();

        Console.WriteLine(s.Replace(',', ' '));
    }

    void SolveB()
    {
        int K = sc.NextInt();
        int S = sc.NextInt();
        int cnt = 0;
        for (int x = 0; x <= K; x++)
        {
            for (int y = 0; y <= K; y++)
            {
                if (x + y > S) break;
                int z = S - x - y;
                if (z <= K) cnt++;
            }
        }
        Console.WriteLine(cnt);
    }

    void SolveC()
    {

    }

    void SolveD()
    {

    }

    // ------------------------------------- //
    int Max(int v1, int v2) { return Math.Max(v1, v2); }
    int Min(int v1, int v2) { return Math.Min(v1, v2); }
    int[][] CreateArray2D(int n1, int n2)
    {
        int[][] ary = new int[n1][];
        for (int i = 0; i < n1; i++) ary[i] = new int[n2];
        return ary;
    }
}
class Scanner
{
    public Scanner() { }
    private string[] buff = null;
    private int bIndex = 0;
    public string Next()
    {
        if (buff == null || bIndex >= buff.Length)
        {
            buff = Console.ReadLine().Split(' ');
            bIndex = 0;
        }
        return buff[bIndex++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
}
class Pair<T, K>
{
    public Pair() { }
    public Pair(T f, K s)
    {
        first = f;
        second = s;
    }
    public T first {get; set;}
    public K second {get; set;}
}

Measured memory_bytes: 2904
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author jignesh1604
 */

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#define debugg(x) out << #x << " is " << x << "\n" ;
#define gcd(a , b) __gcd(a,b) ;
#define lssetbitindex(x) __builtin_ffs(x)-1 ;           // __builtin_ffs(x) = 1 + least significant 1-bit of x

using namespace std;

class DBannedK {
public:
	void solve(std::istream& in, std::ostream& out) {
	    long long int n , i , j ;
	    in >> n ;
	    long long int a[n+1] ;
	    for(i = 0 ; i < n ; i++) {
	        in >> a[i] ;
	    }
        map<long long int , long long int > mp ;
	    for(i = 0 ; i < n ; i++) {
	        mp[a[i]]++;
	    }
	    long long int sum = 0 ;
	    for(auto x : mp) {
	        sum += x.second*(x.second-1) /2 ;
	    }
	    for(i = 0 ; i < n ; i++) {
	        out << sum - mp[a[i]]*(mp[a[i]] - 1) / 2 + (mp[a[i]] - 1) *(mp[a[i]] - 2) /2 << "\n" ;
	    }
	}
};


int main() {
	DBannedK solver;
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;
using ll = long long int;

ll lcm(ll A, ll B){
    if (B == 0){
        return A;
    }
    return lcm(B, A % B);
    
}

ll gcd(ll A, ll B){
    return A / lcm(A, B) * B;
}

int main() {
    ll A, B;
    cin >> A >> B;
    cout << gcd(A, B) << endl;
    return 0;
}

Measured memory_bytes: 256
/*
tarun360
IIT Indore
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define forn_s(i,start,lim) for(ll_s i=start;i<lim;i++)
#define forn_d_s(i,start,lim) for(ll_s i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define debug1(a) cout<<a<<endl
#define debug2(a,b) cout<<a<<" "<<b<<endl
#define debug3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define debug4(a) cout<<"chu "<<a<<endl

ll h[100005],dp[100005];

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll n,k;
  cin>>n>>k;
  forn(i,0,n) cin>>h[i];
  forn(i,1,n){
    dp[i]=LONG_LONG_MAX;
    forn_d(j,k,1){
      if(i-j>=0)
        dp[i]=min(dp[i],dp[i-j] + abs(h[i]-h[i-j]));
    }
  }
  cout<<dp[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main{
  public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
 
        int diff = Math.abs(A-B)%2;
 
        if(diff == 0) {
            System.out.println("Alice");
        } else if (diff >= 1) {
            System.out.println("Borys");
        } else {
            System.out.println("Draw");
        }
    }
}




Measured memory_bytes: 35928
#include <iostream>

using namespace std;

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

    int ca = 0;
    int cb = 0;
    for(int i=0; i<s.length(); i++){
        if(s[i] == 'A') ca++;
        if(s[i] == 'B') cb++;

    }

    if(ca == s.length() || cb==s.length()) cout << "No" << endl;
    else cout << "Yes" << endl;


    return 0;
}

Measured memory_bytes: 256
//y???0???a-1

import java.util.*;
import java.io.*;

public class Main{
    public static void main(String[] args)throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));    
        int a = 0;
        int b = 0;
        
            while(true){
                StringTokenizer st = new StringTokenizer(br.readLine(), " ");
                b = Integer.parseInt(st.nextToken());
                a = Integer.parseInt(st.nextToken());

                    if(a==0&&b==0)break;
                        for(int x = 0; x<b; x++){
                            
                
                            for(int y = 0; y<a; y++){
                                if(y==0||y==a-1||x==0||x==b-1){
                                    System.out.print("#");
                                }
                                else{
                                    System.out.print(".");
                                }
                                
                            }
                
                            System.out.print("\n");
                        }
            
                        System.out.print("\n");
            
                    }
        
        
    }
}

Measured memory_bytes: 34820
#include <bits/stdc++.h>
using namespace std;
using LL = int64_t;
int main() {
    int l = 1, r = 10;
    auto check = [](int k) {
        string s = "";
        for (int i = 0; i < k; i++) s += '9';
        cout << "? " << s << endl;
        char c;
        cin >> c;
        if (c == 'Y') return 1;
        else return 0;
    };
    while (l < r) {
        int mid = (l + r) / 2;
        if (check(mid)) r = mid;
        else l = mid + 1;
    }
    int ws = r;
    auto check1 = [](int k) {
        string s = "1";
        for (int i = 1; i < k; i++) s += '0';
        cout << "? " << s << endl;
        char c;
        cin >> c;
        if (c == 'Y') return 1;
        else return 0;
    };
    l = 1, r = 11;
    while (l < r) {
        int mid = (l + r) / 2;
        if (check1(mid)) l = mid + 1;
        else r = mid;
    }
    r--;
    if (ws == 1 && r != 10) ws = r;
    string ans = "";
    for (int i = 0; i < ws - 1; i++) {
        auto judge = [&](int k) {
            string s = ans;
            s += '0' + k;
            cout << "? " << s << endl;
            char c;
            cin >> c;
            if (c == 'Y') return 1;
            else return 0;
        };
        int l = 0, r = 10;
        if (!i) l++;
        while (l < r) {
            int mid = (l + r) / 2;
            if (judge(mid)) l = mid + 1;
            else r = mid;
        }
        ans += '0' + r - 1;
    }
    auto judge = [&](int k) {
        string s = ans;
        s += '0' + k;
        s += '0';
        cout << "? " << s << endl;
        char c;
        cin >> c;
        if (c == 'Y') return 1;
        else return 0;
    };
    l = 0, r = 9;
    if (ws == 1) l++;
    while (l < r) {
        int mid = (l + r) / 2;
        if (judge(mid)) r = mid;
        else l = mid + 1;
    }
    ans += '0' + r;
    cout << "! " << ans << endl;
}


Measured memory_bytes: 596
W, H, N = map(int,input().split())
w = [1] * (W + 1)
h = [1] * (H + 1)
for _ in range(N):
    x, y, a = map(int,input().split())
    if a == 1:
        w[:x] = [0 for _ in range(x)]
    if a == 2:
        w[(x + 1):] = [0 for _ in range(W - x)]
    if a == 3:
        h[:y] = [0 for _ in range(y)]
    if a == 4:
        h[(y + 1):] = [0 for _ in range(H - y)]
if sum(w):
    A = sum(w) - 1
else:
    A = 0
if sum(h):
    B = sum(h) - 1
else:
    B = 0
print(A * B)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<queue>
#include<map>
#include<vector>
#include<ctime>

#define int long long
#define R register
#define IL inline
#define Rf(a,b,c) for(R int (a)=(b);(a)<=(c);++(a))
#define Tf(a,b,c) for(R int (a)=(b);(a)>=(c);--(a))
#define MP make_pair
#define PA pair<int,int>
#define MES(a,b) memset((a),(b),sizeof((a)))
#define MEC(a,b) memcpy((a),(b),sizeof((b)))
#define D double

using namespace std;

const int N=4e3+5;

int n,ans,s[N],a[N];

IL int read() {
    int x=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x*=10;x+=(ch-'0');ch=getchar();}
    return x*f;
}
IL void write(int x) {
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}

signed main()
{
	n=read();
	Rf(i,1,n) {
		a[i]=read();
		s[a[i]]++;
	}
	Rf(i,1,N-5) s[i]+=s[i-1];
	Rf(i,1,n-1) Rf(j,i+1,n) {
		R int A=a[i]+a[j]-1,B=abs(a[i]-a[j]);
		R int tmp=s[A]-s[B];
		if(a[i]>B) tmp--;
		if(a[j]>B) tmp--;
		ans+=max(0ll,tmp);
	}
	write(ans/3);
    return 0;
}


Measured memory_bytes: 3668
N, M = map(int, input().split())
a = [int(input())for i in range(M)]
MOD = 10 ** 9 + 7
ans = []
dp = [1] * (N + 1)

for i in a:
    dp[i] = 0

for i in range(2, N + 1):
    if dp[i] != 0:
        dp[i] = (dp[i - 1] + dp[i - 2])

print(dp[N] % MOD)


Measured memory_bytes: 460020
def main():
    n, m = map(int, input().split())

    card_list = [0] * n

    l_list = []
    r_list = []

    for _ in range(m):
        l, r = map(int, input().split())
        l_list.append(l)
        r_list.append(r)

    max_l = max(l_list)
    min_r = min(r_list)

    print(min_r-max_l+1 if min_r >= max_l else 0)

if __name__ == '__main__':
    main()

Measured memory_bytes: 57688
X, N = map(int, input().split())

if N != 0:
    p_list = list(map(int, input().split()))
    p_list_min = sorted(p_list)
    
non_p_list = []

if N >= 1:
    for i in range(p_list_min[0]-1, p_list_min[-1]+2):
        if i not in p_list_min:
            non_p_list.append(i)
            ans_diff = abs(X - non_p_list[-1])+1
        for i in range(len(non_p_list)):
            temp_diff = abs(X - non_p_list[i])
            if ans_diff > temp_diff:
                ans_diff = temp_diff
                ans = non_p_list[i]
    #print(non_p_list)
    print(ans)
else:
    print(X)

Measured memory_bytes: 9204
#include<cstdio>
#include <iostream>
#include<cmath>
#include<set>
#include<cstdio>
#include<algorithm>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<string>
#include<cstring>

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const double pi = acos(-1.0);

int a[11][11], w, h;

int chp(int y1, int y2, int x1, int x2) {
	int res = 0, ans = 0, t = 1e9;
	for (int i = y1; i <= y2; i++) {//寻找此区域内的最大高度
		for (int j = x1; j <= x2; j++) {
			res = max(res, a[i][j]);
		}
	}

	//检查是否能够围成池塘，并寻找池塘中水平面的最高高度
	for (int i = y1 - 1; i <= y2 + 1; i++) {
		for (int j = x1 - 1; j <= x2 + 1; j++) {
			if (i == y1 - 1 || i == y2 + 1 || j == x1 - 1 || j == x2 + 1) {
				if (a[i][j] <= res)return 0;
				t = min(t, a[i][j]);
			}
		}
	}

	//计算池塘容积
	for (int i = y1; i <= y2; i++) {
		for (int j = x1; j <= x2; j++) {
			ans += t - a[i][j];
		}
	}
	return ans;
}

int ch(int y, int x) {
	int ans = 0;

	//枚举池塘
	for (int i = y; i <= h - 2; i++) {
		for (int j = x; j <= w - 2; j++) {
			ans = max(ans, chp(y, i, x, j));
		}
	}
	return ans;
}

int main() {
	while (cin >> h >> w, h) {
		int ans = 0;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				cin >> a[i][j];
			}
		}
		for (int i = 0; i < h - 1; i++) {
			for (int j = 0; j < w - 1; j++) {
				if (i&&j)ans = max(ans, ch(i, j));
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
using namespace std;
using ll = long long;
int main(){
  string a, b, u;
  cin >> a >> b;
  int s, t;
  cin >> s >> t;
  cin >> u;
  
  if (u==a){
    cout << s-1 << ' ' << t << endl;
  }
  else{
    cout  << s << ' ' << t-1 << endl;
  }
  
}

Measured memory_bytes: 256
<?php
$n=trim(fgets(STDIN));
$x=explode(" ",trim(fgets(STDIN)));
sort($x);
$i=$x[0];
$ans=pow(10,10);
while($i<=$x[$n-1]){
  $sum=0;
  $j=0;
  while($j<$n){
    $sum+=pow(($x[$j]-$i),2);
    ++$j;
  }
  if($sum<$ans){
    $ans=$sum;
  }
  ++$i;
}
echo $ans;

Measured memory_bytes: 4728
INF = 10 ** 7
while 1:
    n = int(input())
    if n == 0:
        break
    m = int(input())
    M = [[INF] * n for i in range(n)]

    for i in range(m):
        a, b, c = map(int, input().split(','))
        M[a][b] = c
        M[b][a] = c

    d = [INF] * n
    used = [0] * n
    d[0] = 0

    while 1:
        minv = INF
        for i in range(n):
            if (not used[i]) and (d[i] < minv):
                minv = d[i]
                u = i
        if minv == INF:
            break
        used[u] = 1
        for i in range(n):
            if (not used[i]) and M[u][i] != INF and d[i] > M[u][i]:
                d[i] = M[u][i]

    print(int(sum(d)/100)-(n-1))



Measured memory_bytes: 5828
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`

										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	a := nextInt()
	v := nextInt()
	b := nextInt()
	w := nextInt()
	t := nextInt()

	ans := "NO"
	if absInt(b-a) <= (v-w)*t {
		ans = "YES"
	}

	//fmt.Fprintln(out, "[DEBUG]", a)
	fmt.Fprintln(out, ans)
}

//------------------------------------------------------------------------------

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <iostream>
#define DB(s) cout << s << " ";
#define NL cout << endl;
using namespace std;
long int mod = 1000000007;
bool sortinrev(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b)
{
    return (a.second > b.second);
}
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int tc;
cin >> tc;
long long int sol=0;
long long temp =1;
int t =3;
while(t--)
{
temp=tc*temp;
sol+=temp;
}
cout << sol << endl;
   
}



Measured memory_bytes: 3636
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Twinkle little = new Twinkle();
        little.star(1, in, out);
        out.close();


    }
static class Twinkle {
        public void star(int testNumber, InputReader in, PrintWriter out) {
            double T = in.nextInt();
            double X = in.nextInt();
            double ans = T/X;
            System.out.println(String.format("%.10f",ans));
}
}
  


    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
      public   String nextLine()
        {
            String str = "";
            try
            {
                str = reader.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }

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

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

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

        public boolean hasNext() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return false;
                    }
                    tokenizer = new StringTokenizer(line);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return true;
        }
    }
}


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vll = V<ll>;
using VVll = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

const double PI = acos(-1);
const ll MOD = 1e9+7;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
    int h, a;
    cin >> h >> a;

    if (h % a == 0) {
        std::cout << h / a << '\n';
    } else {
        std::cout << h / a + 1 << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
import sys

N = int(sys.stdin.readline())

# 4*h*n*w = N * (h*n + n*w + w*h)
# (4*h*n - N*n - N*h) * w = N*h*n
# w = N*h*n / (4*h*n - N*n - N*h)

for h in range(1, 3501):
    for n in range(1, 3501):
        a = N*h*n
        b = (4*h*n - N*n - N*h) 
        # print(h, n, a, b)
        if b > 0 and a % b == 0:
            w = a // b
            # print(4/N, 1/h + 1/n + 1/w)
            print(h, n, w)
            sys.exit()
else:
    print("something wrong")

Measured memory_bytes: 9160
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;
const int mod = 1000000007;

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

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

// mint N;

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

// combination c(N);
// mint ans = c(N,n);
// cout << ans.x << endl;

// -------------------------------------------------------------

int main(){
  string S;
  cin >> S;
  int N;
  N = S.size()/2;
  int ans=0;
  for(int i=0; i<N; i++){
    if(S[i] != S[S.size()-i-1]){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int n;
    cin>>n;
    int ans = 0,m = 0;
    int arr[n];
    for (int i=0;i<n;++i){
        cin>>arr[i];
    }
    int temp = arr[0];
    for(int i=1;i<n;++i){
        if (arr[i]<=temp){
            m++;
            temp = arr[i];
        }
        else{
            ans = max(ans,m);
            temp = arr[i];
            m=0;
        }
    }
    ans = max(ans,m);
    cout<<ans;
    
}

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


int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

int compare_string(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
}
//  qsort(names, 3, sizeof *names, compare_string);

//long long  factorial(long long n) {
//    if (n > 0) {
//        return n * factorial(n - 1);
//    } else {
//        return 1;
//    }
//}
long long  factorial(long long n, long long depth) {
    if (n > 1) {
        depth++;
        return factorial(n / 2, depth);
    } else {
        return depth;
    }
}

int min(int a, int b) {
    if (a > b)
        return b;
    else
        return a;
}

int distance(int a, int b) {
  return abs(a-b)*abs(a-b);
}



//int ()
/*
int triangle(int a, int b, int c){
  if(a<b+c){
    if(b<c+a){
      if(c<a+b){
        printf("1\n");
        return 1;
      }
    }
  }
  printf("1\n");
  return 0;
}
*/

int main()
{
//  int  a, b, c, d, e, X, Y ,r;
  unsigned long long a, b, c, d, e, X, Y;
  //  double  c;
// long long  A[200003]={};
  int  A[200003]={};
  int  B[100003]={};
//  int  C[100003][100001]={};
  int  C[100003]={};

  int  flg=0;

//  char s[101][101]={};
  char s[10000001]={};
  char t[100001]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  long long p=0,q=0;
  int sosuu[46] ={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199};
  int min =100000001;
  int len=0;
  int l=0;
  int cnt=0;
  int num=0;
  int num1=0;
  int num2=0;
  long long  ans=0;
  int ans_ac=0;
  int ans_wa=0;
  int max=0;
  long long sum=0;
  int addr=0;
  int ptn=0;
  int  tmp=0;
  double per=0; 
//  bool on_off[100]={};
  
//  char alp[26]={'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'};
  b=100;
  //  a=0;
  scanf("%s", &s);
  scanf("%s", &t);
//        printf("%s\n",s);
  len=strlen(s);
//          printf("%d\n",len);

    if( strncmp(s,t,len)!=0){
      printf("No\n");
    }
  else printf("Yes\n");
return 0;
}


Measured memory_bytes: 11572