akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = getInt(sc.nextLine());
        String[] s = sc.nextLine().split(" ");

        Map<String,Integer> x = new HashMap<>();
        Map<String,Integer> y = new HashMap<>();

        // map初期化
        for(int i = 0; i < n;i++){
            if(i%2 == 0){
                x.put(s[i], 0);
            }else{
                y.put(s[i], 0);
            }
        }
        // 数カウント
        for(int i = 0;i < n;i++){
            if(i%2 == 0){
                x.put(s[i], x.get(s[i])+1);
            }else{
                y.put(s[i], y.get(s[i])+1);
            }
        }
        // xとyが1個ずつで、x != y
        if(x.size() == 1 && y.size() == 1 && !s[0].equals(s[1])){
            println(0);
            return;
        }

        // xとyが1個ずつで、x == y
        if(x.size() == 1 && y.size() == 1 && s[0].equals(s[1])){
            println(n/2);
            return;
        }

        // 一番多いやつ探す
        String xmax = s[0];
        for(String key : x.keySet()){
            int nowMax = x.get(xmax);
            int current = x.get(key);
            if(nowMax < current){xmax = key;}
        }
        String ymax = s[1];
        for(String key : y.keySet()){
            int nowMax = y.get(ymax);
            int current = y.get(key);
            if(nowMax < current){ymax = key;}
        }

        int stable = x.get(xmax) + y.get(ymax);
        //  最頻値が同じ場合再探索
        //  xの1番目とyの2番目 yの1番目とxの2番目 のうち数が大きい方を対象とする
        if(xmax.equals(ymax)) {
            String xmax2 = "";
            int countx = 0;
            for (String key : x.keySet()) {
                if (countx <= x.get(key) && !key.equals(xmax)) {
                    countx = x.get(key);
                    xmax2 = key;
                }
            }

            String ymax2 = "";
            int county = 0;
            for (String key : y.keySet()) {
                if (county <=  y.get(key) && !key.equals(ymax)) {
                    county = y.get(key);
                    ymax2 = key;
                }
            }

            stable = Math.max(x.get(xmax) + y.get(ymax2),x.get(xmax2) + y.get(ymax));
        }

        // 最頻値以外の数
        println(n - stable);
        return;
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {return Integer.parseInt(val);}
    static String[] split(String val) {return val.split(" ");}
    static List<String> toSortedList(String[] s){ return sortList(Arrays.asList(s));}
    static List<String> sortList(List<String> list){
        Collections.sort(list, Comparator.comparingInt(val -> Integer.parseInt(String.valueOf(val))));
        return list;
    }

    static void println(String val){System.out.println(val);}
    static void println(int val){System.out.println(val);}
    static void println(long val){System.out.println(val);}
}

Measured memory_bytes: 50656
// D - Maze Master
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
using vi = vector<int>;
using vvi = vector<vi>;
using VC = vector<char>;
using VVC = vector<VC>;

// BFS (幅優先探索)
// 文字列迷路SをS[sh][sw]から各マスまでの最短コストをdist[h][w]に求める
#define HMAX 20
#define WMAX 20
VVC S(HMAX+2, VC(WMAX+2, '#'));//外周を壁で囲む
vvi dist(HMAX+1, vi(WMAX+1, -1));
void bfs(int sh, int sw){
	int dx[4]={0,-1,0,1}, dy[4]={-1,0,1,0};
	dist[sh][sw] = 0;//最短コスト設定
	S[sh][sw] = '_';//訪問済みフラグ on
	queue<int> qh, qw;
	qh.push(sh), qw.push(sw);
	while(!qh.empty()){
		int ph = qh.front(); qh.pop();
		int pw = qw.front(); qw.pop();
		rp(k, 0, 4){//四方向処理
			int h = ph + dy[k], w = pw + dx[k];
			if(S[h][w] != '.') continue;//壁・訪問済みはパス
			S[h][w] = '_';//訪問済みフラグ on
			dist[h][w] = dist[ph][pw] + 1;//最短コスト設定
			qh.push(h);
			qw.push(w);
		}
	}
}

int main(){
	int H,W; cin>>H>>W;

	rp(h, 1, H+1){
		string s; cin>>s;
		rp(w, 1, W+1) if(s[w-1]=='.') S[h][w] = '.';
	}

	VVC S_temp = S;
	vvi dist_temp = dist;

	int ans = 0;
	rp(h, 1, H+1){
		rp(w, 1, W+1){
			if(S_temp[h][w]=='.'){
				S = S_temp;
				dist = dist_temp;
				bfs(h,w);
				for(vi v:dist)for(int d:v) ans = max(ans, d);
			}
		}
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int A[50];
int main(){
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  int KL2GvlyY;
  int Q5VJL1cS = 0;
  int e98WHCEY;
  int cTE1_r3A;
  int RZTsC2BF;
  for(KL2GvlyY=(0);KL2GvlyY<((N-1)+1);KL2GvlyY++){
    cTE1_r3A = abs(A[KL2GvlyY]);
    if(Q5VJL1cS==0 || e98WHCEY<cTE1_r3A){
      e98WHCEY = cTE1_r3A;
      Q5VJL1cS = 1;
      RZTsC2BF = KL2GvlyY;
    }
  }
  int i = RZTsC2BF;
  wt_L(2*N);
  wt_L('\n');
  if(A[i] >= 0){
    int FmcKpFmN;
    for(FmcKpFmN=(0);FmcKpFmN<(2);FmcKpFmN++){
      wt_L(i+1);
      wt_L(' ');
      wt_L(1);
      wt_L('\n');
    }
    for(i=(1);i<(N);i++){
      int xr20shxY;
      for(xr20shxY=(0);xr20shxY<(2);xr20shxY++){
        wt_L(i);
        wt_L(' ');
        wt_L(i+1);
        wt_L('\n');
      }
    }
  }
  else{
    int WYIGIcGE;
    for(WYIGIcGE=(0);WYIGIcGE<(2);WYIGIcGE++){
      wt_L(i+1);
      wt_L(' ');
      wt_L(N);
      wt_L('\n');
    }
    for(i=(N)-1;i>=(1);i--){
      int t_ynMSdg;
      for(t_ynMSdg=(0);t_ynMSdg<(2);t_ynMSdg++){
        wt_L(i+1);
        wt_L(' ');
        wt_L(i);
        wt_L('\n');
      }
    }
  }
  return 0;
}
// cLay varsion 20190921-1

// --- original code ---
// int N, A[50];
// {
//   rd(N,A(N));
//   int i = argmax[k=0---N-1](abs(A[k]));
// 
//   wt(2N);
//   if(A[i] >= 0){
//     rep(2) wt(i+1, 1);
//     rep(i,1,N) rep(2) wt(i, i+1);
//   } else {
//     rep(2) wt(i+1, N);
//     rrep(i,1,N) rep(2) wt(i+1, i);
//   }
// }


Measured memory_bytes: 256
//#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>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
   return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
   os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  string s,t;cin>>s>>t;

  ll ans=0;
  rep(i,0,siz(s)){
    if(s[i]!=t[i])++ans;
  }
  cout<<ans<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 3772
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 105;
const double eps = 1e-5;
int s,w[maxn],t[maxn];
double r;
bool vis[maxn];
double ans;
double li[maxn],ri[maxn],val[maxn];
void init() {
	memset(vis,false,sizeof(vis));
	memset(w,0,sizeof(w));
	memset(t,0,sizeof(t));
}
void cal(int num) {
	memset(li,0,sizeof(li));
	memset(ri,0,sizeof(ri));
	memset(val,0,sizeof(val));
	for(int i = num - 1;i >= 1;i--) {
		if(t[i] == -1) {
			val[i] = val[2*i] + val[2*i+1];
			double L = val[2*i+1]/val[i],R = val[2*i]/val[i];
			li[i] = min(li[2*i]-L,li[2*i+1]+R);
			ri[i] = max(ri[2*i+1]+R,ri[2*i]-L);
		}
		else if(t[i]) val[i] = w[t[i]];
	}
	double temp = ri[1] - li[1];
	if(temp - r < eps && temp > ans) ans = temp;
}
void dfs(int cur,int cnt,int now) {
	if(cnt == s) {
		cal(cur);
		return;	
	}
	if(t[cur/2] != -1) dfs(cur+1,cnt,now);
	else {
		if(s - cnt > now) {
			t[cur] = -1;
			dfs(cur+1,cnt,now+1);
			t[cur] = 0;
		}
		if(now == 1 && s - cnt > now) return; 
		for(int i = 1;i <= s;i++) {
			if(!vis[i]) {
				vis[i] = true;
				t[cur] = i;
				dfs(cur+1,cnt+1,now-1);
				vis[i] = false;
				t[cur] = 0;
			}
		}
	}
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int T;
	scanf("%d",&T);
	while(T--) {
		scanf("%lf %d",&r,&s);
		init();
		for(int i = 1;i <= s;i++) scanf("%d",&w[i]);
		if(s == 1) {printf("0.00\n");continue;}
		ans = -1;
		t[1] = -1;
		dfs(2,0,2);
		if(ans == -1) printf("-1\n");
		else printf("%.10lf\n",ans);
	}
	return 0;
}


Measured memory_bytes: 3200
a, v = input().split(' ')
a = int(a)
v = int(v)
b, u = input().split(' ')
b = int(b)
u = int(u)
t = int(input())


if a <= b and a + v * t >= b + u * t :
  print('YES')
elif a > b and a - v * t <= b - u * t :
  print('YES')
else:
  print('NO')

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

int main(){
    int a,b;
    cin >> a >> b;
    int cnt = 0;
    for (int i = a;i <= b;i++){
        int c = i%10;
        int d = i%100/10;
        int e = i/1000%10;
        int f = i/10000;
        if (c == f && d == e){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue

const ll MOD = 1e9 + 7;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	ll a, b, c, d; cin >> a >> b >> c >> d;
	ll ans = LLNINF;
	for (const ll& x : {a, b} ) {
		for (const ll& y : {c, d} ){
			ans = max(ans, x*y);
		}
	}
	cout << ans;
}

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

const int N=2e5+20;

int n,mod=2019,m[N];
long long dp[N],p[N],ans;
char a[N];

int main()
{
	scanf(" %s",a+1);
	n=strlen(a+1);

	p[0]=1;
	for(int i=1;i<=n;i++)
	{
		p[i]=(p[i-1]*10)%mod;
		dp[i]=(dp[i-1]*10+a[i]-'0')%mod;
	}

	for(int i=n;i>=1;i--)
	{
		dp[i]=(dp[i]*p[n-i])%mod;
		m[dp[i]]++;
		ans+=m[dp[i]]-1;
	}

	printf("%lld",ans+m[0]);
}

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

using namespace std;

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

  int a = stoi(w.substr(0, 2));
  int b = stoi(w.substr(2, 2));

  if (a < 0 || b < 0 || (a > 12 && b > 12)) {
    cout << "NA" << '\n';
    return 0;
  }
  if (a == 0 || b == 0) {
    if (a == 0 && b == 0) {
      cout << "NA" << '\n';
      return 0;
    } else if (a == 0 && b <= 12) {
      cout << "YYMM" << '\n';
      return 0;
    } else if (a <= 12 && b == 0) {
        cout << "MMYY" << '\n';
        return 0;
    } else {
      cout << "NA" << '\n';
      return 0;
    }
  }
  
  
  
  


  if (a > 12 && b <= 12) {
    cout << "YYMM" << '\n';
  } else if (b > 12 && a <= 12){
    cout << "MMYY" << '\n';
  } else if (a <= 12 && b <= 12) {
    cout << "AMBIGUOUS" << '\n';
  }

  return 0;
}

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

using ll = long long;
#define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int n;
  cin >> n;
  vector<ll> v(n+1);
  v[0] = 0;
  REP(i,n) {
    int tmp;
    cin >> tmp;
    v[i+1] = v[i] + tmp;
  }
  SORT(v);
  ll ans = 0;
  int count = 1;
  REP(i,n) {
    if(v[i] == v[i+1]) ++count;
    else {
      ans += count * (count - 1) / 2;
      count = 1;
    }
  }
  ans += count * (count - 1) / 2;
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
typedef long long int ll;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;

int main() {
	long long int n, x;
	cin >> n >> x;
	long long int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	long long int b;
	b = 0;
	if (a[0] > x) {
		b = b + a[0] - x;
		a[0] = x;
	}
	for (int i = 1; i < n; i++) {
		if (a[i] > (x - a[i - 1])) {
			b = b + a[i] + a[i - 1] - x;
			a[i] = x - a[i - 1];
		}
	}
	cout << b << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define ff(i, n) for (int i = 1; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back   
#define PB pop_back
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;




void solve(){
    string s, t;
    int ans = 0;
    cin>>s>>t;
    f(i,3){
        if(s[i] == t[i])ans++;
    }
    cout<<ans;
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


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

int main() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if (e - a <= k) {
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 764
//aea ctmr
#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/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//v.erase(unique(v.begin(),v.end()),v.end());
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
 
 
typedef long double ld;
typedef long long ll;
const ll N = 2500;
const ll mod = 1e+9 + 9;
const ld PI = acos(-1);
const ll INF = 1e+18;
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
 
#define TRACE
#ifdef TRACE
#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...);}
#else
#define trace(...)
#endif

int xd[N];

void solve(){
    int n, x, y;
    cin >> n >> x >> y;
    if(x > y) swap(x, y);
    int ans;
    for(int i = 1; i <= x - 1; i++){
        for(int j = i + 1; j <= x - 1; j++){
            ans = j - i; xd[ans]++;
        }
        for(int j = x; j <= y; j++){
            ans = x - i + min(j - x, 1 + y - j); xd[ans]++;
        }
        for(int j = y + 1; j <= n; j++){
            ans = x - i + j - y + 1; xd[ans]++;   
        }
    }
    for(int i = x; i <= y; i++){
        for(int j = i + 1; j <= y; j++){
            ans = min(j - i, 1 + i - x + y - j); xd[ans]++;
        }
        for(int j = y + 1; j <= n; j++){
            ans = j - y + min(y - i, i - x + 1); xd[ans]++;   
        }
    }
    for(int i = y + 1; i <= n; i++){
        for(int j = i + 1; j <= n; j++){
            ans = j - i; xd[ans]++;
        }
    }
    
    for(int i = 1; i < n; i++){
        cout << xd[i] << endl;
    }
}

int main(){
    fastio;
    
    int tc;
    //cin >> tc;
    tc = 1;
    while(tc--) solve();
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

int main()
{
    long A[2][100]={{}};
    long result[2][101]={{}};
    long N;
    std::cin >> N;
    for(int i=0; i<2; i++){
        for(long j=0; j<N; j++){
            std::cin >> A[i][j];
        }
    }
    result[0][0]=A[0][0];
    result[1][0]=A[1][0]+A[0][0];
    for(long j=1; j<N; j++){
        result[0][j]=result[0][j-1]+A[0][j];
    }
    for(long i=1;i<N;i++){
        if(result[0][i]<=result[1][i-1]){
            result[1][i]=result[1][i-1]+A[1][i];
        }else{
            result[1][i]=result[0][i]+A[1][i];
        }
    }
    std::cout << result[1][N-1]<< std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

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);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int K = in.nextInt();
        	int a = 0;
        	int b = 0;
        	if(K % 2 != 0) {
        		K -= 1;
        		a = K / 2;
        		b = K / 2 + 1;
        	} else {
        		a = K / 2;
        		b = K / 2; 
        	}
        	out.println(a * b);
        }
    }

    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 int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21332
#include <iostream>
using namespace std;
 
int main() {
	int D, N; cin >> D >> N;
 
	int S = 1; for (int i = 0; i < D; i++) S *= 100;
	if (N < 100) {
		cout << S * N << endl;
	}
	else {
		cout << S * 101 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
hash = {}

#ハッシュのキーにインデックスを付与
n.times do |i|
  v1,v2 = gets.chomp.split
    hash[i+1] = [v1.to_s,v2.to_i]
end

# 「<=>」演算子の挙動について
# 比較する2項が全く同じ値ならば、返り値が「0」となる
#
# nonzeroメソッドについて
# レシーバが「0」ならば、返り値が「nil」になる
#
# 文字列要素でソートする
# もし文字列要素が同じならば、上記「<=>」の挙動通り、0が返り値となり、
# そして、上記nonzeroメソッドの挙動通り、全体がnilとなる
# 続いて、||　の右側の処理(数値の並び替え)が実行

# ブロック変数を | a, b | とすると、並び替え用に演算子を a <=> b として用いた場合、
# aがbより小さい時はaが先に、aがbより大きい時はaが後に並び替えられます
# || による後者への分岐は、その逆、つまり降順

order = hash.values.sort{|a,b| (a[0] <=> b[0]).nonzero? || b[1] <=> a[1]}


order.each do |i|
  hash.each do |k,v|
    puts k if v == i
  end
end


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

int main() {
    int a,b,c,d,e;
    cin >> a >> b >> c >> d >> e;
    auto maxt = [](int time) { return (time + 9) / 10 * 10; };
    auto delt = [&maxt](int time) { return maxt(time) - time; };
    int allsum = maxt(a) + maxt(b) + maxt(c) + maxt(e) + maxt(d);
    int del = max({delt(a),delt(b),delt(c),delt(d),delt(e)});
    cout << allsum - del << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    n=int(input())
    a=list(map(int,input().split()))
    i=0
    cnt=1
    while i<=len(a)-1:
        if a[i]==cnt:
            cnt+=1
        i+=1
    if cnt==1:
        print(-1)
    else:
        print(len(a)-cnt+1)
    
if __name__ == '__main__':
    main()

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

using namespace std;

int main(){
  int n;
  int a[2][100] = {};
  int i, j;

  cin >> n;
  
  for(i = 0; i < 2; i++){
    for(j = 0; j < n; j++){
      cin >> a[i][j];
    }
  }
  
  int reward;
  int max_reward = 0;
  for(i = 0; i < n; i++){
    // マス(1, i) で曲がった時の報酬
    reward = 0;

    for(j = 0; j < n; j++){
      if(j <= i) reward += a[0][j];
      else       reward += a[1][j];
    }reward += a[1][i];

    max_reward = max(max_reward, reward);
  }

  cout << max_reward << endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()

alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

ans = []

for s in S:
  for i,al in enumerate(alph):
    if s==al:
      ans.append(alph[(i+N)%len(alph)])
      break
ans = ''.join(ans)
print(ans)

Measured memory_bytes: 40304
n = int(input())
XY = [[i]+list(map(int,input().split())) for i in range(1,n+1)]

from operator import itemgetter
margin = []
XY.sort(key = itemgetter(1))

for j in range(n-1):
    margin.append([XY[j][0],XY[j+1][0],XY[j+1][1]-XY[j][1]])

XY.sort(key = itemgetter(2))
for j in range(n-1):
    margin.append([XY[j][0],XY[j+1][0],XY[j+1][2]-XY[j][2]])

margin.sort(key = itemgetter(2))
def search(UF,loc):
    if UF[loc] == loc:
        return UF[loc]
    else:
        UF[loc] = search(UF,UF[loc])
        return UF[loc]
UF = [k for k in range(n+1)]
count = 1
ans = 0
for p,q,m in margin:
        if count == n:
            break
        UF[p] = search(UF,p)
        UF[q] = search(UF,q)
        if UF[p] != UF[q]:
            ans += m
            UF[max(UF[p],UF[q])] = min(UF[p],UF[q])
            count += 1
print(ans)

Measured memory_bytes: 54000
#include<stdio.h>
int main()
{
    long int n,sum=0;
    int i;
    scanf("%ld",&n);
    for(i=1; i<=n; i++)
    {
        if(i%3!=0 && i%5!=0)
        {
              sum=sum+i;
        }
    }
         
          printf("%ld",sum);  
  
}


Measured memory_bytes: 1732
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def LI(): return list(map(int, stdin.readline().split()))
def LS(): return list(stdin.readline())

s = LS()
if 'A' in s:
    if 'B' in s:
        print('Yes')
        exit()
print('No')

Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
int f,s;
scanf("%d %d",&f,&s);
if(f>s)
	for(int i = 0;i < f;i++)
	printf("%d",s);
else 
	for(int i = 0;i < s;i++)
	printf("%d",f);
return 0;
}	

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int S,h,m,s;
	
	do{
		scanf("%d",&S);
	}while(S < 0 || S >= 86400);
	
	h = S / 3600;
	S = S % 3600;
	
	m = S / 60;
	S = S % 60;
	
	s = S;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
int main()
{
	//freopen(".in","r",stdin);freopen(".out","w",stdout);
	char c;
	cin>>c;
	if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')cout<<"vowel";
	else    cout<<"consonant";
	cout<<endl;
	return 0;
}

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

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            var words = Console.ReadLine().Replace(",", "\t").Replace(" ", "\t").Replace(".", "\t").Split('\t');
            string output = "";
            for (int i = 0; i < words.Length; i++)
            {
                if (words[i].Length > 2 && words[i].Length < 7)
                {
                    output += " " + words[i];
                }
            }
            Console.WriteLine(output.Trim());
        }
    }
}

Measured memory_bytes: 5316
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1001001001;


int main(){
  ll h,w,n;
  cin>>h>>w>>n;
  map<P,ll>mp;
  rep(i,n){
    ll a1,b1;
    cin>>a1>>b1;
    a1--;b1--;
    for(ll i=-2;i<=0;i++){
      for(ll j=-2;j<=0;j++){
        if (a1+i<0 or b1+j<0 or a1+i+2>=h or b1+j+2>=w)continue;
    //    cout<<a1+i<<' '<<b1+j<<endl;
        mp[make_pair(a1+i,b1+j)]++;
    //    cout<<mp[make_pair(a1+i,b1+j)]<<endl;

      }
    }
  //  cout<<endl;
  }
  vector<ll> v(10,0);
  ll ans=(h-2)*(w-2);
  for(auto t=mp.begin();t!=mp.end();t++){
    v[t->second]++;
    ans--;
  }
v[0]=ans;
  rep(i,10)cout<<v[i]<<endl;
}


Measured memory_bytes: 56448
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def is_p(n):
        if n < 4:
            return 1
        i = 2
        while i*i <= n:
            if n%i == 0:
                return 0
            i += 1
        return 1

    def f(n):
        res = set([n])
        i = 2
        while i*i <= n:
            if n%i == 0:
                m = n//i
                res.add(i)
                res.add(m)
            i += 1
        res = list(res)
        res.sort()
        return res

    n = I()
    if n == 1:
        print(0)
        return
    if is_p(n):
        print(1)
        return
    f = f(n)
    m = len(f)
    k = [0]*m
    for i in range(m):
        fi = f[i]
        if is_p(fi):
            for j in range(i+1,m):
                if f[j]%fi == 0:
                    k[j] += 1
    lis = deque([f[i] for i in range(m) if k[i] <= 1])
    ans = 0
    while lis:
        x = lis.popleft()
        if n%x == 0:
            n //= x
            ans += 1
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


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

namespace AABC
{
    class Program
    {
        static void Main(string[] args)
        {
            string kk = Console.ReadLine();
            int ik = int.Parse(kk);
            int r = 111;

            for(int i = 1; i < 10; i++)
            {
                int tmp = i * 111;
                if( ik <= tmp)
                {
                    r = tmp;
                    break;
                }
            }

            

            Console.WriteLine(r);
        }
    }
}


Measured memory_bytes: 11092
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int N;
  cin >> N;
  map<int, int> mp;
  REP(i, N) {
    int A;
    cin >> A;
    mp[A]++;
  }
  int ans = 0;
  for (auto a : mp) ans += a.second % 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

ll a, b, v, w, t;

signed main() {
	cin >> a >> v >> b >> w >> t;
	if (v <= w)cout << "NO" << endl;
	else if ((v - w)*t >= abs(a - b))cout << "YES" << endl;
	else cout << "NO" << endl;
}

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

int main() {
    int n, k; cin >> n >> k;
    if(k%2==1) {
        long long x = n/k;
        cout << x*x*x << endl;
    }
    else {
        long long x = n/k;
        long long y = (n + (k/2)) / k;
        cout << x*x*x + y*y*y << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int x[100005] , l[2] , r[2] , s , j;
signed main(){
  string str;
  cin>>str;
  s = str.size();
  for(int i=0;i<s;i++){
    j = s-i-1;
    if(str[i] == 'R'){
      r[i%2]++;
    } else {
      x[i]+=r[i%2];
      x[i-1]+=r[(1+i)%2];
      r[0]=0 , r[1]=0;
    }
    if(str[j] == 'L'){
      l[j%2]++;
    } else {
      x[j]+=l[j%2];
      x[j+1]+=l[(j+1)%2];
      l[0]=0 , l[1]=0;
    }
  }
  
  for(int i=0;i<s;i++){
    cout<<x[i];
    if(i < s-1){
      cout<<' ';
    } else {
      cout<<endl;
    }
  }
  return(0);
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        // code goes here
        StringTokenizer st = new StringTokenizer(br.readLine());
        long X = Long.parseLong(st.nextToken());
        long K = Long.parseLong(st.nextToken());
        long D = Long.parseLong(st.nextToken());
        X = Math.abs(X);
        long maxSteps = (X - X%D)/D;
        if(maxSteps >= K){
            sb.append(X - K*D);
        }else {
            long rem = K - maxSteps;
            if(rem % 2 == 1){
                sb.append(Math.abs( (X % D) - D ));
            }else {
                sb.append(X % D);
            }
//            if(X % D > Math.abs( (X % D) - D )){
//                if(rem % 2 == 1){
//                    sb.append(Math.abs( (X % D) - D ));
//                }else {
//                    sb.append(X % D);
//                }
//            }else {
//                if(rem % 2 == 1){
//                    sb.append(Math.abs( (X % D) - D ));
//                }else {
//                    sb.append(X % D);
//                }
//            }
            //sb.append(Math.min(X % D, Math.abs( (X % D) - D )));
        }
        System.out.print(sb.toString());
    }

    private static int nextInt(BufferedReader br) throws IOException{
        return Integer.parseInt(br.readLine());
    }

    private static int[] nextIntArray(BufferedReader br, int n) throws IOException{
        StringTokenizer st = new StringTokenizer(br.readLine());
        int[] arr = new int[n];
        for(int i = 0; i < n; i++){
            arr[i] = Integer.parseInt(st.nextToken());
        }
        return arr;
    }

    static class Pair<A, B>{
        A first;
        B second;
        public Pair(A first, B second){
            this.first = first;
            this.second = second;
        }
    }
}


Measured memory_bytes: 32640
#include<iostream>
using namespace std; // 575

int main() {
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	cout << (H - h) * (W - w);
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

やるだけ
*/

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  double h;
  double max=0,min=0,hi;
  while(cin>>h){
    if(max<h){
      max=h;
    }
    hi=max-h;
    if(hi>min){
      min=hi;
    }
  }
  cout<<min<<endl;
  return 0;
}

Measured memory_bytes: 1280
#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++)
typedef long long ll;

int main(){
    ll n,maxR=-1000000000000000,minR;
    cin >> n;
    vector<long long> R(n);
    rep(i,n) cin >> R[i];
    minR=R[0];
    repr(i,1,n){
        maxR=max(maxR,R[i]-minR);
        minR=min(minR,R[i]);
    }
    cout << maxR << endl;
    return 0;
}


Measured memory_bytes: 4408
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

char field[1000][1000];
int step[1000][1000]; // INFは未訪問

struct Loc {
	int r;
	int c;
};

// 移動ベクトル
vector<int> dr;
vector<int> dc;
map<int, int> mv_to_cost;

// sr: スタート行, cs: スタート列, gr: ゴール行, gc: ゴール列
int bfs(int R, int C, int sr, int sc, int gr, int gc) {
	// 未訪問で初期化
	for (int r=0; r<R; r++) {
		for (int c=0; c<C; c++) {
			step[r][c] = INF;
		}
	}

	deque<Loc> search_queue;
	search_queue.push_back(Loc{sr, sc});
	step[sr][sc] = 0;

	while(!search_queue.empty()) {
		// キューから探索対象の位置情報を取り出す
		Loc loc = search_queue.front();
		search_queue.pop_front();

		int r = loc.r;
		int c = loc.c;
		int s = step[r][c];
		//cout << r << ' ' << c << " (" << s << ")" << endl; // **** debug ****

		if (r == gr && c == gc) return s; // ゴールに到達

		// 探索を予約
		for (int mv = 0; mv < dr.size(); mv++) {
			int next_r = r + dr[mv];
			int next_c = c + dc[mv];

			if (next_r < 0 || next_r >= R || next_c < 0 || next_c >= C) continue; // 外壁がない場合
			if (field[next_r][next_c] == '#') continue; // 壁

			int cost = mv_to_cost[mv];
			if (step[next_r][next_c] <= s + cost) continue; // 同等以下のコストで探索済み

			if (cost == 0) {
				search_queue.push_front(Loc{next_r, next_c});
			} else {
				search_queue.push_back(Loc{next_r, next_c});
			}

			step[next_r][next_c] = s + cost;
		}
	}

	return -1; // ゴールできなかった場合
}

int main(){
  int R, C;
	int sr, sc, gr, gc;
	cin >> R >> C;
	cin >> sr >> sc;
	cin >> gr >> gc;

	for (int r=0; r<R; r++) {
		for (int c=0; c<C; c++) {
			cin >> field[r][c];
		}
	}

	// 移動ベクトルを作成
	int mv = 0;
	for (int i=-2; i<=2; i++) {
		for (int j=-2; j<=2; j++) {
			if (i == 0 && j == 0) continue;
			dr.push_back(i);
			dc.push_back(j);

			int cost = 1;
			if (i == 1 && j == 0) cost = 0;
			if (i == -1 && j == 0) cost = 0;
			if (i == 0 && j == 1) cost = 0;
			if (i == 0 && j == -1) cost = 0;
			mv_to_cost[mv] = cost;
			mv++;
		}
	}

	int ans = bfs(R, C, sr - 1, sc - 1, gr - 1, gc - 1);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8544
#include <bits/stdc++.h>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> d;
    ll suma = 0;
    ll sumb = 0;
    rep(i, n) {
        cin >> a[i];
        suma += (ll) a[i];
    }
    rep(i, n) {
        cin >> b[i];
        sumb += (ll) b[i];
    }
    if(sumb > suma) {
        cout << -1 << endl;
        return 0;
    }
    int ans = 0;
    ll s = 0;
    rep(i, n) {
        if(a[i] < b[i]) {
            ans++;
            s += (ll) b[i] - (ll) a[i];
        }
        else {
            d.push_back(a[i] - b[i]);
        }
    }
    ll k = 0;
    sort(d.rbegin(),d.rend());
    int j = 0;
    while(k < s) {
        k += (ll) d[j];
        j++;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4420
#import itertools
import math
n = int(input())
a = input().split()
a = [int(m) for m in a]
dic = {}
dic2 = {}
for i in range(n + 1):
    dic[a[i]] = 0
    dic2[a[i]] = []
k = 0
j = 0
for i in range(n + 1):
    dic[a[i]] += 1
    dic2[a[i]].append(i)
    if dic[a[i]] == 2:
        j = dic2[a[i]][0]
        k = i

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = n + 1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


for i in range(n + 1):
    if i == 0:
        print(n)
    else:
        if j + n - k >= i:
            if (cmb(n + 1, i + 1, mod) - cmb(j + n - k, i, mod)) >= 0:
                print(cmb(n + 1, i + 1, mod) - cmb(j + n - k, i, mod))
            else:
                print(cmb(n + 1, i + 1, mod) - cmb(j + n - k, i, mod) + mod)
        else:
            print(cmb(n + 1, i + 1, mod))

Measured memory_bytes: 48328
#include<bits/stdtr1c++.h>
using namespace std;
#define LL long long int
int main()
{
    LL n;
    while(scanf("%lld",&n)==1)
    {
        if(n%2==0)
        {
            printf("%lld %lld %lld\n",n,n,n/2);
        }
        else
        {
            int mark=0;
            for(LL i=1;i<=3500;i++)
            {
                if(mark)break;
                for(LL j=1;j<=3500;j++)
                {
                    if(mark)break;

                    LL s1=(LL)4*i*j-(LL)(i+j)*n;
                    LL s2=(LL)n*i*j;
                    if(s1>0)
                    {
                        if(s2%s1==0)
                        {
                            if(s2/s1<=3500&&s2/s1>=1)
                            {
                                printf("%lld %lld %lld\n",i,j,s2/s1);
                                mark++;
                            }


                        }
                    }
                }
            }
        }
    }
return 0;
}


Measured memory_bytes: 256
def main():
    from itertools import accumulate as ac
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    c = list(map(int, input().split()))
    s = set()
    loop = []
    for i in range(n):
        if i not in s:
            j = i
            temp = [c[j]]
            s.add(j)
            while True:
                j = p[j]-1
                if j not in s:
                    temp.append(c[j])
                    s.add(j)
                else:
                    break
            loop.append(temp+temp)
    ans = -10**15
    for l in loop:
        m = len(l)//2
        s = max(0, sum(l)//2)
        l = [0]+list(ac(l))
        temp = [-10**15]*m
        for i in range(m):
            for j in range(i+1, i+m+1):
                width = j-i-1
                temp[width] = max(temp[width], l[j]-l[i])
        for i in range(m):
            if k-i-1 >= 0:
                ans = max(ans, ((k-i-1) // m)*s+temp[i])
    print(ans)


main()


Measured memory_bytes: 69524
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**9
eps = 10**-7

N,M = map(int,input().split())
# 1-indexed union-find
# parent(親)
par = [i for i in range(N+1)]
# rank(深さ)
rank = [0]*(N+1)
# 同グループの頂点数
# size = [1]*(N+1)

# 木の根を求める
def root(x):
    if par[x] == x:             # 根の時
        return x
    else:
        par[x] = root(par[x])   # 経路圧縮
        return par[x]

# xとyの属する集合を併合(ランク有)
def unite(x,y):
    x = root(x)
    y = root(y)
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y              # xの親をyに
        #size[y] += size[x]      # yの頂点数+=xの頂点数
    else:
        par[y] = x              # yの親をxに
        #size[x] += size[y]      # xの頂点数+=yの頂点数
        if rank[x] == rank[y]:
            rank[x] += 1

LRD = [tuple(map(int,readline().split())) for i in range(M)]

for (L,R,D) in LRD:
    unite(L,R)

from collections import defaultdict,deque
rel = defaultdict(lambda: [])

for (L,R,D) in LRD:
    rel[root(L)].append((L,R,D))

for k,v in rel.items():
    dist = defaultdict(lambda: [])
    for (L,R,D) in v:
        dist[L].append((R,D))
        dist[R].append((L,-D))
    que = deque([])
    x = {}
    for k1,v1 in dist.items():
        x[k1] = 0
        for (to,dis) in v1:
            x[to] = dis
            que.append(to)
        break
    while que:
        fro = que.popleft()
        for (to,dis) in dist[fro]:
            if to not in x.keys():
                x[to] = x[fro] + dis
                que.append(to)
    for (L,R,D) in v:
        if x[R] - x[L] != D:
            print('No')
            exit()
print('Yes')


Measured memory_bytes: 112272
#include<iostream>
using namespace std;
int main() {
	int H, W;
	while (1) {
		cin >> H >> W;
		if (H == 0 && W == 0)break;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (i == 0 || i == H - 1 || j == 0 || j == W - 1)cout << "#";
				else cout << ".";
				if (j == W - 1)cout << endl;
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		long ans = 0;
		int N = I.nextInt();
		long[][] rob = new long[N][2]; //[Position,Wing-span]
		boolean[] vis = new boolean[N+1];
		long up = 0; //Current largest X coordinate occupied
		for (int i = 0; i < N; i++) {
			rob[i][0] = I.nextLong();
			rob[i][1] = I.nextLong(); //End-points excluded
		}
		Arrays.sort(rob,(a,b)->Long.compare(a[0],b[0]));
		up = rob[0][0]+rob[0][1];
		vis[0]=true;
		int cur = 0; //Which robot was most recently included in optimal set
		for (int i = 1; i < N; i++) {
			long curlo = rob[i][0]-rob[i][1];
			long curhi = rob[i][0]+rob[i][1];
			if (curlo<up) { //if overlap
				if (curhi<up) {
					up=curhi; //Including current, excluding previous
					vis[cur]=false;
					vis[i]=true;
					cur=i;
				} 
			}else {
				vis[i]=true;
				up=curhi;
				cur=i;
			}
		}
		for (int i = 0; i < N; i++) if (vis[i]) ans++;
		O.pln(ans);
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				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());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}


Measured memory_bytes: 50620
import java.util.*;
import java.util.stream.*;

public class Main {
  static int A, B, C;

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int N = in.nextInt();
    A = in.nextInt();
    B = in.nextInt();
    C = in.nextInt();
    int[] l = new int[N];
    for (int i = 0; i < N; i++) {
      l[i] = in.nextInt();
    }
    System.out.println(dfs(l, 0, 0, 0, 0));
  }

  public static int dfs(int[] arr, int depth, int a, int b, int c) {
    return depth == arr.length
        ? IntStream.of(a, b, c).min().getAsInt() > 0 
          ? Math.abs(a - A) + Math.abs(b - B) + Math.abs(c - C) - 30
          : Integer.MAX_VALUE / 2
        : IntStream.of(
          dfs(arr, depth + 1, a, b, c),
          dfs(arr, depth + 1, a + arr[depth], b, c) + 10,
          dfs(arr, depth + 1, a, b + arr[depth], c) + 10,
          dfs(arr, depth + 1, a, b, c + arr[depth]) + 10
        ).min().getAsInt();
  }
}

Measured memory_bytes: 45032