akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int gcd(int a, int b){
	return a%b?gcd(b,a%b):b;
} 
int main(){
	int N;
	scanf("%d",&N);
	int ret;
	for(int i=0;i<N;i++){
		int tmp;
		scanf("%d",&tmp);
		if(i==0) ret=tmp;
		else ret=gcd(ret,tmp);
	}
	printf("%d",ret);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

int main() {
    string s, t;
    cin >> s >> t;
    vector<int> sA(s.size() + 1, 0), sB(s.size() + 1, 0);
    vector<int> tA(t.size() + 1, 0), tB(t.size() + 1, 0);
    for (int i = 0; i < s.size(); i++) {
        sA[i + 1] = sA[i] + (s[i] == 'A');
        sB[i + 1] = sB[i] + (s[i] == 'B');
    }
    for (int i = 0; i < t.size(); i++) {
        tA[i + 1] = tA[i] + (t[i] == 'A');
        tB[i + 1] = tB[i] + (t[i] == 'B');
    }
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int a, b, c, d, cs, ct;
        cin >> a >> b >> c >> d;
        cs = sA[b] - sA[a - 1] + 2 * (sB[b] - sB[a - 1]);
        ct = tA[d] - tA[c - 1] + 2 * (tB[d] - tB[c - 1]);
        cout << ((cs - ct) % 3 == 0 ? "YES" : "NO") << endl;
    }
    return 0;
}

Measured memory_bytes: 2432
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"


using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;

long long int power(long long int x, long long int n, long long int M) {
	long long int ret = 1;
	long long int by = x;
	while (n) {
		if (n & 1) {
			ret *= by;
			ret %= M;
		}
		by *= by;
		by %= M;
		n >>= 1;
	}
	return ret;
}

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

	cin >> N;
	long long int ans = power(10, N, MOD) + MOD - power(9, N, MOD) * 2 % MOD + power(8, N, MOD);
	cout << ans % MOD << endl;
}

Measured memory_bytes: 3644
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	int n;
	int ma, mb;
	int[] a, b, c;
	int[][][] dp;
	boolean[][][] f;

	int dp(int k, int ta, int tb) {
		if (k == 0 && ta == a[0] && tb == b[0]) {
			return c[0];
		}
		if (k == 0 && ta == 0 && tb == 0) {
			return 0;
		}
		if (k < 0 || ta < 0 || tb < 0) {
			return 1 << 20;
		}
		if (f[k][ta][tb]) {
			return dp[k][ta][tb];
		}
		f[k][ta][tb] = true;

		int ret = 1 << 20;
		ret = Math.min(ret, dp(k - 1, ta, tb));
		ret = Math.min(ret, dp(k - 1, ta - a[k], tb - b[k]) + c[k]);
		return dp[k][ta][tb] = ret;
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		ma = sc.nextInt();
		mb = sc.nextInt();
		a = new int[n];
		b = new int[n];
		c = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}
		dp = new int[n][401][401];
		f = new boolean[n][401][401];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 401; j++) {
				Arrays.fill(dp[i][j], 1 << 20);
				Arrays.fill(f[i][j], false);
			}
		}
		int min = 1 << 20;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 401; j++) {
				for (int k = 0; k < 401; k++) {
					int tmp = dp(i, j, k);
					if (i != 0 && j != 0 && ma * k == mb * j) {
						min = Math.min(min, tmp);
					}
				}
			}
		}

		if (min < (1 << 20)) {
			System.out.println(min);
		} else {
			System.out.println(-1);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 90264
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int M=sc.nextInt();
        double[] num=new double[N];
        double sum=0;
        
        for(int i=0;i<N;i++){
            num[i]=sc.nextDouble();
            sum+=num[i];
        }
        
        Arrays.sort(num);
        
        if(num[N-M]<sum/(4*M)){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 23380
/*
 
Coded and Decoded by : Yash Kapoor
 
*/
#include <bits/stdc++.h>
using namespace std;
 
#define ll          long long
#define ld          long double
#define pb          push_back
#define pf          push_front
#define mp          make_pair
#define pll         pair<ll,ll>
#define vl          vector<ll>
#define sl          set<ll> 
#define vll         vector<pll>
#define ml          map<ll,ll>
#define mll         map<pll,ll>
#define all(a)      a.begin(),a.end()
#define x           first
#define y           second
#define sz(x)       (ll)x.size()
#define dl          '\n'
#define why         (ll)1000000007
//#define why         (ll)998244353
#define lp(i,a,b)   for(ll i=a;i<b;++i)
#define lpr(i,a,b)  for(ll i=a;i>=b;i--)
#define lpd(i,x)    for(auto i:x)
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll inf = 1e18;
ld pi = 3.141592653589;
ll mod = why;
ll fast_power(ll base,ll power,ll mod)
{
    ll result=1;
    while(power)
    {
        if(power%2)
        result=(result*base)%mod;
        base=(base*base)%mod;
        power/=2;
    }
    return result;
}
 
ll inverse(ll base,ll mod)
{
    return fast_power(base,mod-2,mod);
}

ll solve(){ 
    ll n,m,sm=0; cin>>n>>m;
    vl a(m); lp(i,0,m) cin>>a[i],sm+=a[i];
    if(sm > n) cout<<-1;
    else cout<<n-sm;
    return 0;
}  

int main(){
    ios
    ll t=1; 
    //cin>>t;
    while(t--){
        solve();
    }
}

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

using namespace std;

int main()
{
 int a,b,q,c,f,x;
 cin>>a>>b;
 q=(a-1)+a;
 c=(b-1)+b;
 
f=a+b;
x=max(c,q);

cout<<max(x,f);
 

    return 0;
}

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

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	cin >> N;

	map<int, int> m;
	for( int i = 0; i < N; ++i ) {
		int x;
		cin >> x;
		m[x] += 1;
	}

	int result = 0;
	for( auto kv: m ) {
		if( kv.second & 1 ) {
			result += 1;
		}
	}

	cout << result << endl;
	return 0;
}


Measured memory_bytes: 4992
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 1LL<<60
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;

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

  int n;
  cin >> n;

  vector<string> s(3);
  REP(i,3) cin >> s[i];
  
  int ans = 0;
  REP(i,n){
    map<char,int> mp;
  REP(j,3) mp[s[j][i]]++;
  int mx = 0;
  ITR(itr,mp) mx = max(mx,itr->sc);
  ans += 3-mx;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
*P, = map(int,input().split())
XY = [list(map(int,input().split())) for _ in [0]*M]

E = [[] for _ in [0]*N]
for x,y in XY:
    E[x-1].append(y-1)
    E[y-1].append(x-1)
    
def connect_bfs(N,E,start):
    connect = {start}
    q = [start]
    while q:
        i = q.pop()
        for j in E[i]:
            if j in connect:continue
            connect.add(j)
            q.append(j)
    return connect

done = [False]*N
ans = 0
for i in range(N):
    if done[i]:continue
    J = connect_bfs(N,E,i)
    PJ = set(P[j]-1 for j in J)
    ans += len(J & PJ)
    for j in J:
        done[j] = True
print(ans)

Measured memory_bytes: 63892
open Printf
open Scanf

let id x = x

let solve n =
  let ar = Array.make n 0 in
  let l = List.init (n - 1) @@ fun _ -> scanf "%d " id in
  List.iter (fun i -> ar.(i-1) <- ar.(i-1) + 1) l;
  Array.iter (printf "%d\n") ar
             
let () =
  scanf "%d " solve


Measured memory_bytes: 14888
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926525
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());
  ll ans=0;
  int k,s;cin>>k>>s;
  for(int x=0;x<=k;x++){
    for(int y=0;y<=k;y++){
      if(x+y<=s && s-x-y<=k)ans++;
    }
  }
  P(ans);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	double e1[42],e2[42];
	int i,j;
	int ans[8]={0};
	
	cin >> e1[0];
	for(i=1;cin >> e2[i-1];++i)
	{
		cin >> e1[i] ;
	}
	
	for(j=0;j<i-1;j++)
	{
		if(e1[j]>=1.1)
			ans[0]++;
		else if(e1[j]>=0.6)
			ans[1]++;
		else if(e1[j]>=0.2)
			ans[2]++;
		else
			ans[3]++;
		if(e2[j]>=1.1)
			ans[4]++;
		else if(e2[j]>=0.6)
			ans[5]++;
		else if(e2[j]>=0.2)
			ans[6]++;
		else
			ans[7]++;
	}
	for(i=0;i<4;i++)
	{
		cout << ans[i] << " " << ans[i+4] << endl;
	}
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] req = sc.nextLine().split("");
        StringBuilder sb = new StringBuilder();
        for (int i = req.length; i > 0; i--) {
            sb.append(req[i - 1]);
        }
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 25856
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int K;
    cin >> K;
    int cnt[2] = {0,0};
    rep1(i,K+1){
        cnt[i%2]++;
    }
    cout << cnt[0] * cnt[1]  << endl;
}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	// 末尾に追加可能な文字列を反転した文字列
	private static final String REVERSE_DREAM = new StringBuilder("dream").reverse().toString();
	private static final String REVERSE_DREAMER = new StringBuilder("dreamer").reverse().toString();
	private static final String REVERSE_ERASE = new StringBuilder("erase").reverse().toString();
	private static final String REVERSE_ERASER = new StringBuilder("eraser").reverse().toString();

	public static void main(String[] args) {

		// 処理対象文字列の入力
		Scanner sc = new Scanner(System.in);

		// 最後尾から追加可能な文字列を検索するため、処理対象の文字列を反転させる
		StringBuilder targetString = new StringBuilder(sc.next()).reverse();
		sc.close();

		int bak = 0;
		// 処理対象の文字列の最後尾から、追加可能である文字列を可能な限り削除する処理を繰り返す
		// ※効率化のため文字列は反転して処理
		while(bak != targetString.length()) {
			bak = targetString.length();
			targetString = checkTopString(targetString);
		}

		// 出力
		if(targetString.length() == 0) {
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}

	// 処理対象の文字列の最後尾に追加可能な文字列があるなら削除する関数(効率化のため処理は反転して行う)
	static StringBuilder checkTopString(StringBuilder targetString){
		if(targetString.indexOf(REVERSE_DREAM) == 0){
			return targetString.delete(0,REVERSE_DREAM.length());
		}

		if(targetString.indexOf(REVERSE_DREAMER) == 0){
			return targetString.delete(0,REVERSE_DREAMER.length());
		}

		if(targetString.indexOf(REVERSE_ERASE) == 0){
			return targetString.delete(0,REVERSE_ERASE.length());
		}

		if(targetString.indexOf(REVERSE_ERASER) == 0){
			return targetString.delete(0,REVERSE_ERASER.length());
		}

		return targetString;

	}

}

Measured memory_bytes: 28548
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

use std::collections::HashMap;

fn main() {
    let (n, a, b) = get!(usize, usize, usize);
    let mut vs = get!(String).split_whitespace().map(|v| v.parse().unwrap()).collect::<Vec<usize>>();
    vs.sort();
    vs.reverse();

    let mut map = HashMap::new();
    for i in 0..n {
        let x = map.entry(vs[i]).or_insert(0 as usize);
        *x += 1;
    }

    let mut tri: Vec<Vec<usize>> = Vec::new();
    tri.push(vec![1]);
    tri.push(vec![1, 1]);
    for i in 2..n+1 {
        let mut line = vec![1];
        for j in 0..i-1 {
            line.push(tri[i-1][j] + tri[i-1][j+1]);
        }
        line.push(1);
        tri.push(line);
    }

    if vs[0] == vs[a-1] {
        let mut c = 0;
        for x in a..b+1 {
            if x <= map.get(&vs[0]).unwrap()+0 {
                c += tri[map.get(&vs[0]).unwrap()+0][x];
            }
        }
        println!("{}", vs[0]);
        println!("{}", c);
    } else {
        let mut c = 0;
        let mut s: f64 = 0.0;
        for i in 0..a {
            if vs[i] == vs[a-1] { c += 1; }
            s += vs[i] as f64;
        }
        println!("{:.10}", s / (a as f64));
        println!("{}", tri[map.get(&vs[a-1]).unwrap()+0][c]);
    }
}

Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

void insertionSort(int A[], int n, int g) {
	for (int i = g; i < n; i++) {
		int v = A[i];
		int j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
	}
}

void shellSort(int A[], int n) {
	for (int h = 1;;) {
		if (h > n) break;
		G.push_back(h);
		h = 3 * h + 1;
	}
	for (int i = G.size() - 1; i >= 0; i--) {
		insertionSort(A, n, G[i]);
	}
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}
	cnt = 0;
	shellSort(A, n);
	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0; i--) {
		printf("%d", G[i]);
		if (i) printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++) {
		printf("%d\n", A[i]);
	}
	return 0;
}


Measured memory_bytes: 7100
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <utility>
#include <queue>

#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; i++)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return 1;} return 0; }

typedef long long ll;
using namespace std;

int main() {

    int n, k;
    cin >> n >> k;
    cout << ((n+1) / 2 >= k ? "YES" : "NO") << endl;
    
}

Measured memory_bytes: 384
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.next();
		int ans = 0;
		for(int i = 0; i < 3; i++) {
			if(s.charAt(i) == '1') {
				ans++;
			}
		}
		System.out.print(ans);
	}
}

Measured memory_bytes: 21844
//AtCoder ABC104 B - AcCepted
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
int main() {
    string S; cin>>S;
    bool ans=true;
    if(S[0]!='A') ans=false;
    ll idx=-1;
    for(ll i=0;i<S.size();++i){
        if(S[i]=='C'){
            if(i>=2&&i<=S.size()-2){
                idx=i;
            } else {
                ans=false;
            }
        }
    }
    if(idx<0) ans=false; //ない
    for(ll i=1;i<S.size();++i){
        if(i==idx) continue;
        if(S[i]>='a'&&S[i]<='z'){
        } else {
            ans=false;
        }
    }
    cout<<(ans?"AC":"WA")<<endl;
    return 0;
}

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

using namespace std;

int main(){
     long long n,fh,five,r;
     cin>>n;
     fh=n/500;
     r=n%500;
     five=r/5;
     r=r%5;
     cout<<(fh*1000)+(five*5)<<endl;



    return 0;
}

Measured memory_bytes: 3604
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=(input.trim()).split("\n");
while(true){
   var nm=arr.shift();
   if(nm=="0 0")break;
   nm=nm.split(" ").map(Number);
   var M=[];
   for(var i=0;i<=nm[1];i++)M[i]=[];
   var r=arr.shift()-0;
   while(r--){
      var tnms=arr.shift().split(" ").map(Number);
      var m=tnms[2];
      M[m].push([tnms[0],tnms[3]]);
   }
   M=M.map(function(v){
      var cnt=0;
      var time=[];
      v.sort(function(a,b){
         if(a[0]==b[0])return b[1]-a[1];
         else return a[0]-b[0];
      });
      v.forEach(function(V){
         if(V[1]==1)cnt++;
         else if(V[1]==0)cnt--;
         if(V[1]==1 && cnt==1)time.push(V[0]);
         else if(V[1]==0 && cnt==0)time.push(V[0]);
      });
      var flag=false;
      var obj={};
      for(var i=540;i<=1260;i++){
         if(time[0]==i){flag=(!flag);time.shift();}
         obj[i]=flag;
      }
      return obj;
   });
   var q=arr.shift()-0;
   while(q--){
      var ttm=arr.shift().split(" ").map(Number);
      var m=ttm[2];
      var sum=0;
      for(var i=ttm[0];i<ttm[1];i++){
         if(M[m][i])sum++;
      }
      console.log(sum);
   }
}

Measured memory_bytes: 295788
#include<bits/stdc++.h>
using namespace std;
int N,M,i,j,A[9],num[9]={2,5,5,4,5,6,3,7,6};
string dp[10101];
void chmax(string &s,string t){
  if(s=="_"||s.size()<t.size()||(s.size()==t.size()&&s<t))s=t;
}
int main(void){
  cin>>N>>M;
  for(i=0;i<M;i++)cin>>A[i];
  for(i=0;i<10101;i++)dp[i]="_";
  dp[0]="";
  for(i=0;i<=N;i++){
    if(dp[i]=="_")continue;
    for(j=0;j<M;j++)chmax(dp[i+num[A[j]-1]],dp[i]+(char)(A[j]+'0'));
  }
  cout<<dp[N]<<endl;
  return EXIT_SUCCESS;
}


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

int main(){
  string s;
  cin>>s;
  if(s[0]==s[1]&&s[1]==s[2]||s[1]==s[2]&&s[2]==s[3]||s[0]==s[1]&&s[1]==s[2]&&s[2]==s[3]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)
#define FORR(i,n,m) for(ll i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 100000000
#define MOD 100000007
#define SIZE 100005
#define pi  3.14159265358979323846
 
int main(){

    ll a[6];
    REP(i,6){
        cin >> a[i];
    }
    string s;
    cin >> s;
    REP(i,(ll)s.size()){
        ll temp[6] = {0};
        if(s[i]=='S'){
            
            temp[0]=a[4];
            temp[4]=a[5];
            temp[5]=a[1];
            temp[1]=a[0];

            a[0]=temp[0];
            a[1]=temp[1];
            a[4]=temp[4];
            a[5]=temp[5];            
        }
        if(s[i]=='N'){
            
            temp[0]=a[1];
            temp[1]=a[5];
            temp[5]=a[4];
            temp[4]=a[0];

            a[0]=temp[0];
            a[1]=temp[1];
            a[4]=temp[4];
            a[5]=temp[5];            
        }
        if(s[i]=='E'){
            
            temp[0]=a[3];
            temp[3]=a[5];
            temp[5]=a[2];
            temp[2]=a[0];

            a[0]=temp[0];
            a[2]=temp[2];
            a[3]=temp[3];
            a[5]=temp[5];            
        }
        if(s[i]=='W'){
            
            temp[0]=a[2];
            temp[2]=a[5];
            temp[5]=a[3];
            temp[3]=a[0];

            a[0]=temp[0];
            a[2]=temp[2];
            a[3]=temp[3];
            a[5]=temp[5];        
        }        
        //cout << a[0] << endl;

    }
    cout << a[0] << endl;
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

bool isSquare(int x){
	int tmp = (int)sqrt((long double)x);
	return (tmp * tmp == x) || ((tmp + 1) * (tmp + 1) == x);
}

signed main(){
	int n,d,x[20][20],ans = 0;
	cin >> n >> d;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < d;j++) cin >> x[i][j];
	}
	for(int i = 0;i < n;i++){
		for(int j = i + 1;j < n;j++){
			int sum = 0;
			for(int k = 0;k < d;k++) sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
			if(isSquare(sum)) ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String [] adf){
		Scanner in = new Scanner (System.in);
		int a, b, c;
		a = in.nextInt();
		b = in.nextInt();
		c = in.nextInt();
		if(a+b>=c) System.out.println("Yes");
		else System.out.println("No");
	}
}

Measured memory_bytes: 21844
N, A, B = map(int, input().split())
S = list(input())

allp = A + B
qual = 0
Brank = 1

for i in range(N):
    if S[i] == 'a' and qual < allp:
        qual += 1
        print('Yes')
    elif S[i] == 'b' and qual < allp and Brank <= B:
        qual += 1
        Brank += 1
        print('Yes')
    else:
        print('No')


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

typedef long long ll;

int main() {
    vector<int> v;
    int n = 9;
    for (int i = 3; i <= 9; i++) {
        n *= 3;
        rep(j, n) {
            vector<int> c(3, 0);
            int x = j, y = 0;
            rep(k, i) {
                y *= 10;
                y += (x % 3) * 2 + 3;
                c[x % 3]++;
                x /= 3;
            }
            if (c[0] == 0 || c[1] == 0 || c[2] == 0) continue;
            v.push_back(y);
        }
    }
    sort(v.begin(), v.end());
    int N;
    cin >> N;
    cout << upper_bound(v.begin(), v.end(), N) - v.begin() << endl;
}

Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))

minLeft = [a[0]] + [None] * (n - 1)
for i in range(1, n):
    minLeft[i] = min(minLeft[i - 1], a[i])
ret = 1
for i in range(1, n):
    ret += a[i] < minLeft[i - 1]
print(ret)

Measured memory_bytes: 24744
from itertools import permutations


def solve(a, b, c, d, e):
    m = 10000
    for p in permutations([a, b, c, d, e]):
        t = 0
        for i, o in enumerate(p):
            t += o
            if i == len(p) - 1:
                break
            while t % 10 != 0:
                t += 1
        m = min(t, m)
    return m

if __name__ == "__main__":
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    print(solve(a, b, c, d, e))


Measured memory_bytes: 3064
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main(){
	string s;
	cin>>s;
	int l=s.size();
	if(l%2==0)cout<<"No\n";
	else{
		for(int i=0;i<l/2;i++){
			if(s[i]!=s[l-i-1]){
				cout<<"No\n";
			//	cout<<i<<"和"<<l-i-1<<" "<<"也就是"<<s[i]<<"不等于"<<s[l-i-1]<<endl;
				return 0;
			}
		}
		int l1=(l-1)/2;
		for(int i=0;i<l1/2;i++){
			if(s[i]!=s[l1-i-1]){
				cout<<"No\n";
			//	cout<<i<<"和"<<l1-i-1<<" "<<"也就是"<<s[i]<<"不等于"<<s[l1-i-1]<<endl;
				return 0;
			}
		}
		int sta=(l+3)/2;
		int endd=(l-sta)/2+sta;
		for(int i=sta-1;i<endd;i++){
			if(s[i]!=s[l-i-1]){
				cout<<"No\n";
			//	cout<<i<<"和"<<l-i<<" "<<"也就是"<<s[i]<<"不等于"<<s[l-i-1]<<endl;
				return 0;
			}
		}
		cout<<"Yes\n";
		
	}
	
	return 0;
}

Measured memory_bytes: 256
N,M=list(map(int,input().split(' ')))
A=list(map(int,input().split(' ')))
k=0
for i in range(0,N):
    if A[i]/sum(A)>=1/(4*M):
        k=k+1
if k>M-1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
n, m, q = map(int,input().split())
ways = [[0 for i in range(n+2)] for j in range(n+2)]
for i in range(m):
    l,r = map(int,input().split())
    ways[l][r] += 1

sgways = [[0 for i in range(n+2)] for j in range(n+2)]
for j in range(1,n+1):
    for i in range(j):
        sgways[j-i][j] = sgways[j-i+1][j] +ways[j-i][j]

ans = [[0 for i in range(n+1)] for j in range(n+1)]
for i in range(1,n+1):
    for j in range(i,n+1):
        ans[i][j] = ans[i][j-1]+sgways[i][j]
for i in range(q):
    pi,qi = map(int,input().split())
    print(ans[pi][qi])


Measured memory_bytes: 15572
H, W = map(int, input().split())
grid = [list(input()) for _ in range(H)]
path = [[0] * W for _ in range(H)]

for i in range(H):
    for j in range(W):
        if path[i][j] == 0 and grid[i][j] == '#':
            judge = False
            path[i][j] = 1
            for dx, dy in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
                nx = i + dx
                ny = j + dy
                if 0 <= nx < H and 0 <= ny < W and grid[nx][ny] == '#':
                    judge |= True
                    path[nx][ny] = 1
            if not judge:
                print('No')
                exit()
print('Yes')


Measured memory_bytes: 39792
import java.util.*;

public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        // 整数の入力
        // final int a = sc.nextInt();
        // 文字列の入力
        // final String s1 = sc.next();
        final int a = sc.nextInt();
        final int b = sc.nextInt();
        final int c = sc.nextInt();
        final int k = sc.nextInt();
        sc.close();
        int result = 0;
        if (a >= k) {
            result = k;
        } else if (b >= k - a) {
            result = a;
        } else if (c >= k - b - a) {
            result = 2 * a + b - k;
        }

        System.out.println(result);
    }
}


Measured memory_bytes: 35716
#include <iostream>
  #include <string>
  #include <vector>
  #include <algorithm>
  #include <utility>
  using namespace std;
  typedef long long ll;
  #define rep(i,n) for (int i=0;i < (int)(n);i++)
  const ll mod = 1e9+7;
  int main(){
    ll n;
    cin >> n;
    ll ans=1;
    for (ll i=1;i <=n;i++){
      ans*=i;
      ans%=mod;
    }
    cout << ans << endl;
    
    


    return 0;
  }



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    string s;
    int n,a,b,c,d,e,x,y;
    cin >> c >> a >> b;
    loop(i,a,b+1){
        if(i%c == 0){
            cout <<"OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}


Measured memory_bytes: 3132
#include <iostream>
using namespace std;
int main(void){
    int n, h[20], c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    for(int i=0;i<n;i++){
        bool f=true;
        for(int j=0;j<i;j++){
            if(h[j]>h[i])f=false;
        }
        if(f)c++;
    }
    cout<<c<<endl;
}


Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

#[allow(dead_code)]
fn with_stdout_lock<F: FnOnce(std::io::BufWriter<std::io::StdoutLock>)>(f: F) {
    let out = std::io::stdout();
    let w = std::io::BufWriter::new(out.lock());
    f(w);
}

#[allow(unused_macros)]
macro_rules! debug {
    ($var:expr) => {
        match &$var { v => eprintln!(concat!(stringify!($var), "={:?}"), v) }
    };
    ($var:expr, $($vars:expr),*) => {
        match &$var { v => eprint!(concat!(stringify!($var), "={:?} "), v) }
        debug!($($vars),*);
    };
}

fn main() {
    let n: usize = input();
    let k: usize = input();
    let mut td: Vec<(usize, i64)> = (0..n).map(|_| (input(), input())).collect();
    td.sort_by_key(|&(_, d)| -d);

    let mut q = std::collections::BinaryHeap::new();
    let mut v = vec![vec![]; n + 1];
    let mut ans = 0;
    let mut tn = 0;
    for i in 0..k {
        let (t, d) = td[i];
        q.push((Reverse(d), t));
        v[t].push(d);
        ans += d;
        if v[t].len() == 1 {
            tn += 1;
        }
    }
    ans += tn * tn;

    let mut ans_temp = ans;
    for &(t, d) in &td {
        if v[t].is_empty() {
            while let Some((Reverse(di), ti)) = q.pop() {
                if v[ti].len() > 1 {
                    v[ti].pop().unwrap();
                    v[t].push(d);
                    tn += 1;
                    ans_temp += d + tn * tn - di - (tn - 1) * (tn - 1);
                    ans = std::cmp::max(ans, ans_temp);
                    break;
                }
            }
        }
    }

    println!("{}", ans);
}

#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
struct Reverse<T>(T);
impl<T: Ord> Ord for Reverse<T> {
    fn cmp(&self, other: &Reverse<T>) -> std::cmp::Ordering {
        other.0.cmp(&self.0)
    }
}
impl<T: PartialOrd> PartialOrd for Reverse<T> {
    fn partial_cmp(&self, other: &Reverse<T>) -> Option<std::cmp::Ordering> {
        other.0.partial_cmp(&self.0)
    }
}
impl<T: std::fmt::Display> std::fmt::Display for Reverse<T> {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.0.fmt(f)
    }
}


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

int main(void){
  int A[3];
  for(int i=0;i<3;i++){
    cin>>A[i];
  }
  int sum=0;
  for(int i=0;i<3;i++){
    sum+=A[i];
  }
  if(sum>=22) cout<<"bust"<<endl;
  else if(sum<=21) cout<<"win"<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
n,m=map(int,input().split())
a = [[int(i) for i in input().split()] for i in range(m)] 
c=[]
s=[]
a = sorted(a,key = lambda x:-x[1])

#print(a[0][0],a[0][1])
for i in range(m):
    if a[i][1] < n:
        break
    else:
        c.append(a[i][0])
c=set(c)
a = sorted(a,key = lambda x:x[0])
for i in range(m):
    if a[i][0] > 1:
        break
    else:
        s.append(a[i][1])

    #if a[i][1] in c:
s=set(s)

for i in s:
    if i in c:
        print("POSSIBLE")
        sys.exit()

print("IMPOSSIBLE")


Measured memory_bytes: 114772
#include<stdio.h>

long long GCD(long long A,long long B){

    if(A < B){
        int i = A;
        A = B;
        B = i;
    }

    long long temp;

    while(A % B != 0){
        temp = B;
        B = A % B;
        A = temp;
    }

    return B;
}

long long LCM(long long  A,long long B){

    long long ans = (A * B) / GCD(A, B);
    return ans;
}

int main(){

    int A, B;
    scanf("%d%d", &A, &B);

    printf("%ld\n", LCM(A, B));

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10
#define MOD 1000000007

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int Input[100100];

int main() {
  int A, B; cin >> A >> B;
  if ( A <= 5) {
    cout << 0 << endl;
  } else if ( A <= 12) {
    cout << B/2 << endl;
  } else {
    cout << B << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
typedef long long ll;
using namespace std;
const int MOD = 1e9+7;
int cache[1001][1001];
bool is_valid(int row, int col, int n, int m){
	return (row>=0 && row<n) && (col>=0 && col<m);
}
int calc(char ar[][1001], int row, int col, int N, int M) {
	if(!is_valid(row, col, N, M) || ar[row][col]=='#') {
		return 0;
	}
	
	if(row==N-1 && col==M-1) {
		return 1;
	}
	
	if(cache[row][col]!=-1) {
		return cache[row][col];
	}
	
	int right = calc(ar, row+1, col, N, M);
	int down = calc(ar, row, col+1, N, M);
	cache[row][col] = (right + down)%MOD;
	return cache[row][col];
}

int main() {
	int n,m;
	cin>>n>>m;
	char ar[1001][1001];
	for (int i=0; i<n; i++)	{
		for (int j=0; j<m; j++) {
			cin>>ar[i][j];
			cache[i][j] = -1;
		}
	}
	cout << calc(ar, 0, 0, n, m);
	return 0;
}

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

ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n),gcdl(n),gcdr(n);
    rep(i,n) cin>>a[i];
    gcdl[0]=a[0],gcdr[n-1]=a[n-1];
    for(ll i=1;i<n;i++) gcdl[i]=gcd(gcdl[i-1],a[i]);
    for(ll i=n-2;i>=0;i--) gcdr[i]=gcd(gcdr[i+1],a[i]);
    ll mx=gcdr[1];
    for(ll i=1;i<n-1;i++) mx=max(mx,gcd(gcdl[i-1],gcdr[i+1]));
    mx=max(mx,gcdl[n-2]);
    cout<<mx<<endl;
    return 0;
}

Measured memory_bytes: 5636
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

ll cnt[51];
map<PL, ll> memo;

ll calc(ll n, ll k){
    k = min(k, cnt[n]);
    if (memo.count(PL(n, k))) return memo[PL(n, k)];
    if (n == 0){
        return k > 0;
    }
    ll ret = 0;
    if (k >= 1){
        ret += calc(n - 1, k - 1);
    }
    if (k >= cnt[n - 1] + 2) ret++;
    if (k > cnt[n - 1] + 2){
        ret += calc(n - 1, k - cnt[n - 1] - 2);
    }
    return memo[PL(n, k)] = ret;
}

int main() {
    ll n, k;
    cin >> n >> k;
    cnt[0] = 1;
    REP(i,n) cnt[i+1] = 2 * cnt[i] + 3;

    cout << calc(n, k) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
	string s,ans;
	cin >> s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='B'){
			if(ans.size()!=0)
				ans.erase(ans.size()-1);
		}else{
			ans+=s[i];
		}
	}
	cout<<ans<<endl;
    return 0;
}

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

#define pb push_back
#define mp make_pair

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef long long ll;

int main() {
  int ca, cb, cab, a, b;
  cin >> ca >> cb >> cab >> a >> b;

  cab *= 2;
  int res = a*ca + b*cb;
  res = min(res, a*ca+b*cab);
  res = min(res, b*cb+a*cab);
  res = min(res, a*cab+max(0, b-a)*cb);
  res = min(res, b*cab+max(0, a-b)*ca);

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>

using namespace std;

const int INF = (1<<30) - 1;

int _not[3] = {2, 1, 0};
int _and[3][3] = {
    {0, 0, 0},
    {0, 1, 1},
    {0, 1, 2}
};
int _or[3][3] = {
    {0, 1, 2},
    {1, 1, 2},
    {2, 2, 2}
};

int formula(string s, int &i, const int P, const int Q, const int R){
    if      (s[i] == 'P')
        return s[i++] = P;
    else if (s[i] == 'Q')
        return s[i++] = Q;
    else if (s[i] == 'R')
        return s[i++] = R;
    else if (s[i] == '-')
        return _not[formula(s, ++i, P, Q, R)];
    else if (s[i] == '('){
        int a = formula(s, ++i, P, Q, R);
        if      (s[i] == '*'){
            int ret = _and[a][formula(s, ++i, P, Q, R)];
            i++;
            return ret;
        }else if(s[i] == '+'){
            int ret = _or[a][formula(s, ++i, P, Q, R)];
            i++;
            return ret;
        }
    }else{
        return s[i++]-'0';
    }
    return -1;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    while(cin>>s, s!="."){
        int count = 0;
        for(int P=0; P<3; P++)
            for(int Q=0; Q<3; Q++)
                for(int R=0; R<3; R++){
                    int i = 0;
                    count += 2 == formula(s, i, P, Q, R);
                }
        cout << count << endl;
    }
    
    return 0;
}

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


public  class Main 
{

	   
	   static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !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()); 
	        } 
	  
	        double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
	  
	        String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    } 

  

	  // Complete the hurdleRace function below.
//    public static void solve() {
//    	FastReader s=new FastReader();

   
    public static void main(String[] args) throws IOException {
    	FastReader s=new FastReader();
        int n =s.nextInt();
        int m =s.nextInt();
        boolean[] ac  = new boolean[105000];
        int[] wa  = new int[105000];
        int wnum=0,acnum=0;
        for(int i=0;i<m;i++) {
        	int p = s.nextInt();
        	String se = s.next();
        	
        	if(ac[p]!=true) {
        		if(se.equals("AC")) {
        			ac[p]=true;
        			wnum+=wa[p];
        			acnum++;
        		}
        		else wa[p]++;
        	}
        	
        }
        System.out.println(acnum+" "+wnum);
       	
    }	
}





        
    

      
 

Measured memory_bytes: 57404
fun main(args: Array<String>) {
    val (d, n) = readLine()!!.split(' ').map(String::toInt)
    var counter = 0
    var value = 0
    while (counter < n) {
        value++

        var x = value
        var c = 0
        while (x % 100 == 0)
        {
            x /= 100
            c++
        }
        if (c == d) counter++
    }
    println(value)
}

Measured memory_bytes: 38292
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

const string YES = "Yes";
const string NO = "No";

void solve(string S) {
  bool pred = false;
  if (S.size() % 2 == 0) {
    pred = true;
    for (size_t i = 0; i < S.size(); i += 2) {
      if (S.substr(i, 2) != "hi") {
        pred = false;
        break;
      }
    }
  }
  cout << (pred ? YES : NO) << endl;
}

int main() {
  string S;
  cin >> S;
  solve(S);
  return 0;
}


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

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second　//pairの二つ目の要素

int main(){
  int n,k;
  cin>>n>>k;
  double p[n];
  rep(i,n)cin>>p[i];
  int now=0;
  rep(i,k) now+=p[i];
  int maxv=now;
  int maxc=0;
  for(int i=1;i<n-k+1;i++){
    now-=p[i-1];
    now+=p[i+k-1];
    if(now>maxv){
      maxv=now;
      maxc=i;
    }
  }
  double ans=0;
  rep(i,k){
    ans+=(p[maxc+i]+1.)/2.;
  }
  cout<<fixed<<setprecision(7);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
 
 
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-11;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)


//ここから編集
ll GCD(ll a, ll b){
  if(b == 0) return a;
  return GCD(b, a%b);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int X; cin >> X;

  for(int i=1; i<=360; i++){
    if(X*i % 360 == 0){
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3648