akhauriyash/Code-Regression huggingface dataset:
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll mod = (ll)pow(10.0, 9.0) + 7;
pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

ll min(ll a, ll b)
{

	return (a < b) ? a : b;
}
string S;

ll N;
vector<ll> ans;
int main() {

	cin >> N;


	if (N == 3) {
		cout << 2 << " " << 5 << " " << 63;
		return 0;
	}
	
	for (int i = 1; i <= min(15000, 3 * (N / 3)); i++) {
		ans.push_back(2 * i);
	}

	if (N > 15000 && N % 2 == 0) {
		for (int i = 1; i <= N - 15000; i++) {
			ans.push_back(3 * (2 * i - 1));

		}
	}
	else if(N > 15000 && N % 2 == 1) {
		ans[ans.size() - 1] = 3;

		for (int i = 1; i <= N - 15000; i++) {
			ans.push_back(3 * (2 * i + 1));
		}
	}

	else {
		if (N % 3 == 0) {
			ans[ans.size() - 3] = 3;
			ans[ans.size() - 2] = 9;
		}

		else if (N % 3 == 1) {
			ans[ans.size() - 1] = 3;
			ans.push_back(9);

		}

		else if (N % 3 == 2) {
			ans.push_back(3);
			ans.push_back(9);
		}

	}

	for (auto &ct : ans) {

		cout << ct << " ";
	}

	return 0;
}


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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<vector<T>> m) {
    repall (v, m)
        init(v);
}

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------

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

    string s;
    cin >> s;

    int res = INF;
    rep (i, s.length() - 2) {
        int n = stoi(s.substr(i, 3));
        res = min(res, abs(753 - n));
    }
    print(res);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, 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 (b<a) { a=b; return 1; } return 0; }
#define print(x) cout << (x) << endl;
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INF = 1<<29;
const int MOD = 1000000007;
 
void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

vector<pair<long long, long long> > prime_factorize(long long n) { //素因数分解、pairのfirstに底、secondに底の何乗
   vector<pair<long long, long long> > res;
   for (long long p = 2; p * p <= n; ++p) {
       if (n % p != 0) continue;
       int num = 0;
       while (n % p == 0) { ++num; n /= p; }
       res.push_back(make_pair(p, num));
   }
   if (n != 1) res.push_back(make_pair(n, 1));
   return res;
}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N;
    ll P;
    cin >> N >> P;
    auto fac = prime_factorize(P);
    ll ans = 1;
    for(auto p : fac){
      rep(j, p.second/N) ans *= p.first;
    }
    print(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, a, b, s[114514], res;

signed main() {
	cin >> n;
	rep(i,n) {
		cin >> a >> b;
		s[a]++, s[b+1]--;
	}
	rep(i,100100) {
		s[i+1] += s[i];
		if (s[i]>=i-1) chmax(res, i-1);
	}
	cout << res << endl;
}



Measured memory_bytes: 3568
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=1000010;
const ll mod=1e9+7;


int main(){
  int n;
  string s;
  cin >> n >> s;
  int q;
  cin >> q;
while(q--){
  int k; cin >> k;
  ll ans = 0;
  ll dcnt = 0;
  ll mcnt = 0;
  ll cnt = 0;
  rep(i,n){
    if(i-k>=0){
      if(s[i-k]=='D'){
        dcnt--;
        cnt-=mcnt;
      }
      if(s[i-k]=='M'){
        mcnt--;
      }
    }
    if(s[i]=='C'){ 
      ans+=cnt; continue; 
    }
    if(s[i]=='M'){
      cnt+=dcnt;
      mcnt++;
      continue;
    }
    if(s[i]=='D'){
      dcnt++;
      continue;
    }
  }
  cout << ans << endl;
}

  return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────────────────

int main() {
	int a, b; cin >> a >> b; cout << LCM(a, b) << endl;
}

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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

int main(void){
    int a, b;
    string s, t, u;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(u == s){
        a--;
    }else{
        b--;
    }
    cout << a << ' ' << b << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    // Write Your Code Below
    string a, s, c;
    char x;
    cin >> a >> s >> c;
    x = s[0];
    cout << "A" << x << "C" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
using namespace std;


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

   int h,h1,w,w1; cin >> h  >> w >> h1 >> w1;
   int ans=w*h- w*h1-h*w1+h1*w1;
   cout << ans << endl;

}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
#define all(v) v.begin(),v.end()


ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
int main(){
    string s,t;
    cin >> s >> t;
    for(char c='a';c<='z';c++){
        string u=s+c;
        if(t==u){
            cout << "Yes" <<endl;
            return 0;
        }
    }
    cout << "No" <<endl;
  return 0;
}



Measured memory_bytes: 3632
n = int(input())
li_h = list(map(int, input().split()))

counter = 0
answer = 0
save = li_h[0]
for i in range(1, n):
    if save >= li_h[i]:
        counter += 1
    else:
        answer = max(answer, counter)
        counter = 0
    save = li_h[i]

print(max(answer, counter))


Measured memory_bytes: 14228
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int l = scan.nextInt();

		// ?????? A ??\???
		int[][] A;
		A = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				A[i][j] = scan.nextInt();
			}
		}
		// ?????? B ??\???
		int[][] B;
		B = new int[m][l];
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < l; j++) {
				B[i][j] = scan.nextInt();
			}
		}

		// ?????? C ??\???
		// long ?????????
		long[][] C;
		C = new long[n][l];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < l; j++) {
				for (int k = 0; k < m; k++) {
					C[i][j] = C[i][j] + A[i][k] * B[k][j];
				}
			}
		}

		// ?????? C ??????
		for (int i = 0; i < n; i++) {

			// C[i][j]???1???????????????????????????(" " + C[i][j])?????????
			int j = 0;
			System.out.print(C[i][j]);

			for (j = 1; j < l; j++) {
				System.out.print(" " + C[i][j]);
			}
			System.out.println();
		}

	}

}

Measured memory_bytes: 53196
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n,m;
  cin>>n>>m;
  vstr a(n),b(m);
  rep(i,n) cin>>a[i];
  rep(i,m) cin>>b[i];
  ll sa=n-m;
  rep(i,sa+1){
    rep(j,sa+1){
      ll k=1;
      for(int u=i;u<i+m;u++){
        for(int h=j;h<j+m;h++){
          if(a[u][h]!=b[u-i][h-j]) k=0;
        }
      }
      if(k){
        COUT("Yes");
        return 0;
      }
    }
  }
  COUT("No");
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  long long sum=0;
  for(int i=1;i<N;i++){
    if(A.at(i-1)>A.at(i)){
      sum+=A.at(i-1)-A.at(i);
      A.at(i)=A.at(i-1);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 4056
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
          Scanner scn= new Scanner(System.in);
          int k = scn.nextInt();
          int a=scn.nextInt();
          int b=scn.nextInt();
          if(a%k==0 || b%k==0 || (b/k-a/k)>0){
        	  System.out.println("OK");
        	 
          }else{
        	  System.out.println("NG");
          }
         
	}

}

Measured memory_bytes: 35748
#include <stdio.h>

int F[45];

int fibonacci(int n) {
    int i;
    F[0] = 1;
    F[1] = 1;
    for (i = 2; i <=n; i++) {
        F[i] = F[i - 2] + F[i - 1];
    }
    return F[n];
}

int main(void){
    int n;
    scanf("%d", &n);
    
    printf("%d\n", fibonacci(n));
    
    return 0;
}




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

int main() {
  long n,c,ans;
  cin >> n >> c;
  vector<long> tvt(50,-1);
  vector<long> tvch(50,-1);
  vector<vector<long>> v(n,vector<long>(3));
  for(long i=0;i<n;i++) cin >> v[i][0] >> v[i][1] >> v[i][2];

  sort(v.begin(),v.end());
  for(long i=0;i<n;i++) {
    for(long j=0;true;j++) {
      if(tvt[j]<v[i][0]) {
        tvt[j]=v[i][1];
        tvch[j]=v[i][2];
        break;
      } else if(tvch[j]==v[i][2]){
        tvt[j]=v[i][1];
        tvch[j]=v[i][2];
        break;
      }
    }
  }
  for(long i=0;true;i++) {
    if(tvt[i]==-1) {
      ans=i;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 8808
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll n, l, t;
    cin >> n >> l >> t;
    t *= 2;
    l *= 2;
    ll x[n], w[n];
    ll cnt = 0;
    ll tt = t;
    rep(i,n){
        cin >> x[i] >> w[i];
        x[i] *= 2;
        if(w[i]==1)cnt++;
    }
    ll INF = 1001001001001001001;
    INF -= INF % l;
    if(cnt == 0 || cnt == n){
        rep(i,n){
            if(w[i] == 1){
                cout << (x[i] + t) % l / 2 << endl;
            }else{
                cout << (x[i] + INF - t) % l / 2 << endl;
            }
        }
        return 0;
    }
    int nex[n] = {};
    int w1 = -1, w2 = -1;

    drep(i,n){
        if(w[i] == 2){
            nex[i] = w2;
            w2 = i;
        }
    }
    rep(i,n){
        if(w[i] == 1){
            nex[i] = w1;
            w1 = i;
        }
    }
    rep(i,n){
        if(nex[i] == -1){
            if(w[i] == 1) nex[i] = w1;
            else nex[i] = w2;
        }
    }

    if(w[0] == 1) cnt = (n-cnt);
    ll cnt2 = cnt;
    cnt *= 2;
    cnt %= n;
    
    ll loop = t / l;
    ll now = 0;
    if(w[0] == 1){
        now += loop * cnt;
        now %= n;
    }else{
        now += loop * (n - cnt);
        now %= n;
    }

    t %= l;
    int half_flag = 0;
    if(t >= l/2){
        if(w[0] == 1){
            now += cnt2;
            now %= n;
        }else{
            now += (n - cnt2);
            now %= n;
        }
        t -= l/2;
        half_flag = 1;
    }

    /*
    rep(i,n) cout << nex[i] << ' ';
    cout << endl;
    */

    int ite = -1;
    int start = ite;
    if(w[0]==1){
        rep(i,n){
            if(w[i] == 2){
                ite = i;
                break;
            }
        }
        start = ite;
        while(true){
            ll diff = (x[ite] - x[0]) / 2;
            if(diff >= t){
                break;
            }else{
                now = (now + 1) % n;
                ite = nex[ite];
            }
            if(ite == start) break;
        }
    }else{
        drep(i,n){
            if(w[i] == 1){
                ite = i;
                break;
            }
        }
        start = ite;
        while(true){
            ll diff = (l - (x[ite] - x[0])) / 2;
            if(diff > t){
                break;
            }else{
                now = (now + n - 1) % n;
                ite = nex[ite];
            }
            if(ite == start) break;
        }
    }
    now %= n;

    ll fin[n] = {};
    ll fzero;
    rep(i,n){
        if(w[i] == 1){
            fin[i] = (x[i] + tt) % l / 2;
        }else{
            fin[i] = (x[i] + INF - tt) % l / 2;
        }
    }
    fzero = fin[0];
    sort(fin,fin+n);
    int zero = lower_bound(fin,fin+n,fzero) - fin;
    rep(i,n){
        cout << fin[(zero+i+n-now)%n] << endl;
    }
    return 0;
}




Measured memory_bytes: 6304
//#pragma  GCC optimize("Ofast")

//#ifdef  DEBUG
//#define _GLIBCXX_DEBUG
//#endif

// -Ofast
// -O3
// -O2
// -fsanitize=address
// -fsanitize=undefined

// add_compile_options()

#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <stack>
#include <bitset>
#include <queue>
#include <algorithm>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
#include <unordered_map>
#include <cmath>
#include <cassert>

using namespace std;
//using namesparsace __gnu_pbds;



void solve();


int main()
{
    srand(time(0));
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    //freopen("input.txt", "r", stdin);
    //freopen("trench.out", "w", stdout);
    solve();
    return 0;
}

#define int long long

int max(int a, int b) {
    return a > b ? a : b;
}

const int maxN = 1e5 + 10, inf = 1e18;

pair < int, int > f(pair < int, int > a, pair < int, int > b) {
    return {max(a.first, b.first), min(a.second, b.second)};
}

int e(pair < int, int > a) {
    return max(0, a.second - a.first + 1);
}

int n, ans;
pair < int, int > a[maxN], pref[maxN], suf[maxN];



void solve() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i].first >> a[i].second;
    }
    sort(a, a + n);
    pref[0] = {a[0].first, a[0].second};
    for (int i = 1; i < n; i++) {
        pref[i] = f(pref[i - 1], a[i]);
    }
    suf[n - 1] = {a[n - 1].first, a[n - 1].second};
    for (int i = n - 2; i >= 0; i--) {
        suf[i] = f(suf[i + 1], a[i]);
    }
    for (int i = 0; i < n - 1; i++) {
        ans = max(ans, e(pref[i]) + e(suf[i + 1]));
        if (i) {
            ans = max(ans, e(f(pref[i - 1], suf[i + 1])) + e(a[i]));
        }
    }
    cout << ans;
}

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

long long gcd(long long a, long long b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

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

int main(){
    int n; cin>>n;
    long long a[n];
    for(int i=0; i<n; i++){
        cin>>a[i]; 
    }
    long long ans = a[0];
    for(int i=1; i<n; i++){
        ans = lcm(ans, a[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i= 0; i <n; ++i) {
    char c;
    cin >> c;
    vec[i] = c == 'W' ? 0 : 1;
  }

  int vsum = accumulate(vec.begin(), vec.end(), 0);
  int ans = 0;
  for (int i = 0; i < vsum; ++i)
    ans += vec[i] == 0;

  cout << ans << endl;
}


Measured memory_bytes: 4036
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int a[3][3];
	map<int,pair<int,int>> m;
	for(int i = 0; i < 3; i++)
		for(int j = 0; j < 3; j++){
			cin >> a[i][j];
			m[a[i][j]] = {i,j};
		}
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		if(m.count(x)){
			a[m[x].first][m[x].second] = 0;
		}
	}
	
	for(int i = 0; i < 3; i++){
		int temp = 0;
		for(int j = 0; j < 3; j++){
			temp += a[i][j];
		}
		if(temp == 0){
			cout << "Yes";
			return 0;
		}
	}
	
	for(int i = 0; i < 3; i++){
		int temp = 0;
		for(int j = 0; j < 3; j++){
			temp += a[j][i];
		}
		if(temp == 0){
			cout << "Yes";
			return 0;
		}
	}
	
	int temp = 0;
	for(int i = 0; i < 3; i++){
		temp += a[i][i];
	}
	if(temp == 0){
		cout << "Yes";
		return 0;
	}
	temp = 0;
	for(int i = 0; i < 3; i++){
		temp += a[i][2-i];
	}
	if(temp == 0){
		cout << "Yes";
		return 0;
	}
	cout << "No";


	return 0;
}



Measured memory_bytes: 256
import heapq
N, M = map(int, input().split())
h = []
for a in input().split():
    heapq.heappush(h, (-int(a), 1))
for _ in range(M):
    b, c = map(int, input().split())
    heapq.heappush(h, (-c, b))
ans = 0
for i in range(N):
    x, y = heapq.heappop(h)
    ans -= x
    if y > 1:
        heapq.heappush(h, (x, y-1))
print(ans)

Measured memory_bytes: 28260
def main():
    n = input()
    p_list = list(map(int, input().split()))
    count = 0

    for i in range(len(p_list) - 2):
        if check(p_list[i], p_list[i + 1], p_list[i + 2]):
            count += 1
    print(count)


def check(p1: int, p2: int, p3: int):
    return p1 < p2 < p3 or p1 > p2 > p3


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
        const double TSUBO = 3.305785;
        int a, b;

        cin >> a >> b;
        double ans = (double)(a * b) / TSUBO;
        printf("%.10f\n", ans);

        return 0;
}

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

#define forn(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;
const int h=2019;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);	
        string s;
        cin>>s;
        vector<int>v(h);
        int n=(int)s.length();
        int po=1;
        int suf=0;
        int ans=0;
        for(int i=n-1;i>=0;i--){
            int dig=s[i]-'0';
            suf=(suf+dig*po)%h;
            po=(po*10)%h;
            ans+=v[suf];
            v[suf]++;
        }
        ans+=v[0];
        cout<<ans<<endl;
}


Measured memory_bytes: 3736
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int[] a = new int[10000001];
		int sum = 0, cnt = 0;
		while (sum <= n) {
			cnt++;
			a[cnt] = cnt;
			sum += cnt;
		}
		a[sum - n] = 0;
		for (int i = 1; i <= n; i++) {
			if (a[i] >= 1) {
				sb.append(i + "\n");
			}
		}
		System.out.print(sb);
	}
}


Measured memory_bytes: 63188
def C():
    n = int(input())
    x = list(map(int, input().split()))
    res = []
    for p in range(min(x), max(x)+1):
        psum = 0
        for i in x:
            psum += (i-p)**2
        res.append(psum)
    print(min(res))
C()

Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner s = new Scanner(System.in)) {
            char[] L = s.next().toCharArray();

            long ans = 1;
            long san = 1;
            for (int i = L.length - 1; i >= 0; i--) {
                if (L[i] == '1') {
                    ans = (ans * 2 + san) % 1000000007;
                }
                san = san * 3 % 1000000007;
            }

            System.out.println(ans);
        }
    }

}


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

int main () {
  int a, b, c;
  cin >> a >> b;
  c = a * b % 2;
    if (c == 0){
      cout << "Even" << endl;
    }
  else {
    cout << "Odd" << endl;
  }
}
    

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

int main()
{
  string N;
  cin >> N;
  
  bool flag = false;
  if ((N[0] == N[1]) && (N[1] == N[2]))
  {
    flag = true;
  }
  else if ((N[1] == N[2]) && (N[2] == N[3]))
  {
    flag = true;
  }
  
  flag ? printf("Yes") : printf("No");
}


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

void ssort(string& s,bool _greater){
    for(int i=0;i<4;i++){
        for(int j=i+1;j<4;j++){
            if(_greater){
                if(s[i]>s[j]){
                    swap(s[i],s[j]);
                }
            }
            else{
                if(s[i]<s[j]){
                    swap(s[i],s[j]);
                }
            }
        }
    }
}

int main() {

    string s;

    while (1) {

        cin >> s;

        if(s[0]==s[1]&&s[1]&&s[2]&&s[2]==s[3]&&s[3]==s[0]){
            if(s[0]=='0'){
                break;
            }
            cout << "NA" << endl;
            continue;
        }

        int ans = 0;

        while(1) {


            if (s == "6174") {
                cout << ans << endl;
                break;
            }

            ans++;

            string s1, s2;

            s1 = s2 = s;

            //sort(s1.begin(),s1.end());
            //sort(s2.begin(),s2.end(),greater<string>());

            ssort(s1, false);
            ssort(s2, true);

            int a1, a2;

            stringstream ss;

            ss << s1;
            ss >> a1;
            ss.clear();
            ss << s2;
            ss >> a2;
            a1 -= a2;

            ss.clear();

            ss << a1;

            ss >> s;

            if(s.size() != 4){
                while(s.size()!=4){
                    s = '0' + s;
                }
            }
        }

    }

    return 0;
}

Measured memory_bytes: 3200
N = int(input())
a = list(map(int,input().split()))

ans = 0
numcnt = [0]*100001

for i in a:
    numcnt[i]+=1
    
for x in range(1,100000):
    subans = numcnt[x-1]+numcnt[x]+numcnt[x+1]
        
    ans = max(ans,subans)
    
print(ans)

Measured memory_bytes: 20724
n, m = map(int, input().split())
dp = [0 for i in range(n + 1)]
mod = 10 ** 9 + 7
broke = set()
for i in range(m):
    broke.add(int(input()))
dp[0] = 1
for i in range(n):
    if i + 1 <= n and i + 1 not in broke:
        dp[i + 1] += dp[i]
        dp[i + 1] %= mod
    if i + 2 <= n and i + 2 not in broke:
        dp[i + 2] += dp[i]
        dp[i + 2] %= mod
print(dp[-1] % mod)

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

using namespace std;

int main(){
	char s[10];
	char weather [3][10	] = {"Sunny", "Cloudy","Rainy"};
	scanf("%s",s);
	if(s[0]=='S'){
		printf("%s\n", weather[1]);
	}else if(s[0]=='C'){
		printf("%s\n", weather[2]);
	}else{
		printf("%s\n", weather[0]);
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <locale>
#include<set>



using namespace std;

#define MAX 200000
int main() {

    int i,j,k,n,temp,center,shift,memo;
    cin>>n;
    vector<int> x(n);
    vector<int> x2(n);

    for(i=0;i<n;i++){
        cin>>x[i];
    }

    center=n/2;

        for(j=0;j<n;j++){
            x2[j]=x[j];
        }

        sort(x2.begin(),x2.end());
    for(j=0;j<n;j++){
        if(x[j]>x2[center-1]){
            cout << x2[center-1] << endl;
        }else{
            cout << x2[center] << endl;
        }
    }


   // std::cout << ans << std::endl;
    return 0;
}



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

#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
using ll = long long;
bool custom1 (pair<int, int> a, pair<int, int> b) {
  return (a.first < b.first);
}
bool custom2(pair<int, int> a, pair<int, int> b) {
  return (a.second < b.second);
}

const int MAX = 510000;
const long long MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main() {
  long long n, a, b;
  cin >> n >> a >> b;
  long long c = modpow(2, n, MOD);
  c--;
  long long com = 1;
  long long aa;
  long long bb;
  for(long long i=0;i<=(b-1);i++) {
    if(i == 0) com = n;
    else {
      com *= (n - i);
      com %= MOD;
      com = com * modinv(i+1LL, MOD) % MOD;
    }
    if(i+1LL == a) aa = com;
    else if(i+1LL == b) bb = com;
  }

  long long ans = c - aa - bb;
  while(ans < 0) ans += MOD;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 100000

int partition( int A[], int p, int r){
    int x = A[r];
    int i = p - 1;
    for( int j = p; j < r; j++){
        if( A[j] <= x){
            i++;
            swap( A[i], A[j]);
        }
    }
    swap( A[i + 1], A[r]);
    return i + 1;
} 

int main(){
    int A[MAX], n, i, q;
    cin >> n;
    for(i = 0; i < n; i++) cin >> A[i];
    
    q = partition(A, 0, n-1);
    
    for(i = 0; i < n; i++){
        if(i) cout << " ";
        if(i == q) cout << "[" << A[i] << "]";
        else cout << A[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3444
use std::io::Read;

fn solve(n: usize, m: usize, a: Vec<usize>) {
    // println!("{} {} {}", n, m, a[0]);
    let mut max = 0;
    for i in (0..a.len()) {
        for j in (i+1..a.len()) {
            let b = a[i] + a[j];
            if max < b && b <= m {
                max = b;
            }
        }
    }
    match max {
        0 => println!("NONE"),
        _ => println!("{}", max),
    };
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    loop {
        let n: usize = iter.next().unwrap().parse().unwrap();
        let m: usize = iter.next().unwrap().parse().unwrap();
        if n == 0 && m == 0 {
            return;
        }
        let a: Vec<usize> = (0..n)
            .map(|_| {iter.next().unwrap().parse().unwrap()})
            .collect();
        solve(n, m, a);
    }
}


Measured memory_bytes: 5032
"use strict";

function Main(in_input){
    // Modify Input
    var in_lines = in_input.split("\n");
    var in_line1 = in_lines[0].split(" ");
    var a = parseInt(in_line1[0], 10);
    var b = parseInt(in_line1[1], 10);
    var t = parseInt(in_line1[2], 10);

    // Calc Answer
    var ans = Math.floor(t / a) * b;

    // Output
    console.log(ans)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11468
///#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt,avx,avx2,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

/*
    zet:
        find_by_order(k): k-stat [k > 0]
        order_of_key(k) : {el < k}

    gp_hash_table<key, val, custom_hash>

    rope<T>:
        iterators: mutable_begin, ..
        methods  : erase, insert, substr, ..
*/

#define all(x) (x).begin(), (x).end()
#define size(x) (int)((x).size())
#define em_back emplace_back

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<typename T>
using zet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

mt19937 eng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 1e5 + 4;

int n, m;
int cnt[N];
bool check[N];

void solve() {
    cin >> n >> m;
    check[1] = 1;
    fill_n(cnt, N, 1);

    for (int i = 0; i < m; ++i) {
        int x, y;
        cin >> x >> y;
        cnt[x]--;
        cnt[y]++;
        if (check[x]) {
            check[y] = 1;
            if (!cnt[x]) {
                check[x] = 0;
            }
        }
    }

    int res = accumulate(check, check + N, 0);
    cout << res << "\n";
}

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

    int z = 1;
    /// cin >> z;

    while (z--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 4124
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
    char ch[11];
    scanf("%s",ch);
    int s=strlen(ch);
    int ara[s-2];
    for(int i=0,j=0;i<s-2;i++)
    {
        ara[j++]=abs(((ch[i]-'0')*100)+((ch[i+1]-'0')*10)+(ch[i+2]-'0')-753);
    }
    sort(ara,ara+s-2);
    printf("%d\n",ara[0]);



    return 0;

}



Measured memory_bytes: 128
#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++)

int prime[100001];
int nums[100002];
int main(){
     prime[1]=1;
     for (int i=2;i <=100000;i++){
          if (prime[i] == 1) continue;
          for (int j=i+i;j <= 100000;j+=i){
               prime[j]=1;
          }
     }
     for (int i=1;i <= 100000;i++){
          nums[i]+=nums[i-1];
          if (prime[i] == 0 && prime[(i+1)/2] == 0) nums[i]++;
     }
     int q;
     cin >> q;
     rep(i,q){
          int l,r;
          cin >> l >> r;
          cout << nums[r]-nums[l-1] << endl;
     }
     
     
    
     
     return 0;
}


Measured memory_bytes: 1408
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int d[10101];

int main()
{
	while(1) {
		int n, a, b, c, x;
		cin >> n >> a >> b >> c >> x;
		if (!n) break;
		rep(i,0,n) cin >> d[i];

		int idx = 0;
		int i;
		for (i = 0; i < 10001; i++) {
			if (x == d[idx]) idx++;
			if (idx == n) break;
			x = (a * x + b) % c;
		}
		if (idx == n) cout << i << endl;
		else cout << -1 << endl;
	}

	return 0;
}

Measured memory_bytes: 1164
int main(){
   int N;
   int p[10];
   int max=100;
   int mp=0;
   int sum=0;
   scanf("%d",&N);
   for(int i=0;i<N;i++){
      scanf("%d",&p[i]);
      if(max<p[i]){
         max=p[i];
         mp=i;
      }
   }
   for(int i=0;i<N;i++){
      if(i==mp){
         sum+=p[i]/2;
      }else{
         sum+=p[i];
      }
   }
   printf("%d\n",sum);
   
   return 0;
}

Measured memory_bytes: 128
import sys, math

if(__name__ == "__main__"):
    N, D = map(int, input().strip().split() )
    D_sq = D**2
    xy_list = []
    for i in range(N):
        xy = list( map(int, input().strip().split() ) )
        xy_list.append(xy)
    Num = 0
    for i in range(N):
        x = xy_list[i][0]
        y = xy_list[i][1]
        if( abs(x) > D or abs(y) > D):
            continue
        else:
            sq = x**2+y**2
            if(sq <= D_sq):
                Num += 1

    # A, B, C = map(int, input().strip().split() )
    #map(int, input().strip() )
    print(Num)


Measured memory_bytes: 45472
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define inf 1e9
#define pi 3.1415926536
#define mod 1000000007
#define fr(i,a,b,in) for(int i=a;i<b;i+=in)
#define frn(i,a,b,dc) for(int i=a;i>=b;i-=dc)
#define test(t) int t; cin>>t; while(t--)

int findMaxGCD(int arr[], int n) 
{ 
    // Calculating MAX in array 
    int high = 0; 
    for (int i = 0; i < n; i++) 
        high = max(high, arr[i]); 
  
    // Maintaining count array 
    int count[high + 1] = {0}; 
    for (int i = 0; i < n; i++) 
        count[arr[i]]++; 
  
    // Variable to store the 
    // multiples of a number 
    int counter = 0; 
  
    // Iterating from MAX to 1 
    // GCD is always between 
    // MAX and 1. The first 
    // GCD found will be the 
    // highest as we are  
    // decrementing the potential 
    // GCD 
    for (int i = high; i >= 1; i--) 
    { 
        int j = i; 
       counter = 0; 
    
        // Iterating from current 
        // potential GCD 
        // till it is less than 
        // MAX 
        while (j <= high) 
        { 
            // A multiple found 
  
            if(count[j] >=2) 
               return j; 
  
           else if (count[j] == 1)          
                counter++;          
  
            // Incrementing potential 
            // GCD by itself 
            // To check i, 2i, 3i.... 
            j += i; 
  
            // 2 multiples found, 
            // max GCD found 
            if (counter == 2)          
                return i; 
        } 
    } 
} 

int main()
{
	fastio();
	int n;
	cin>>n;
	int a[n];
	fr(i,0,n,1) cin>>a[i];
	int gcd1=findMaxGCD(a,n);
	int gcd2=__gcd(a[0],a[1]);
	fr(i,2,n,1) gcd2 = __gcd(gcd2,a[i]);
	if(gcd1==1) cout<<"pairwise coprime"<<endl;
	else if(gcd2==1) cout<<"setwise coprime"<<endl;
	else cout<<"not coprime"<<endl;
}

Measured memory_bytes: 11404
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors
N,M = map(int,input().split())

d = M//N

divisor = sorted(make_divisors(M))

from bisect import *

b = bisect_left(divisor,d)
if divisor[b] == d:
  ans = divisor[b]
else:
  ans = divisor[b-1]
print(ans)

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

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

    if ( N % 4 == 0 || N >= 7 && (N - 7) % 4 == 0 || N >= 14 && (N - 14) % 4 == 0 || N >= 21 ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return ( 0 );
}


Measured memory_bytes: 256
n, m, x = map(int, input().split())
charge = list(map(int, input().split()))

cost1 = 0
cost2 = 0

for a in range(n+1):
    if a == x:
        break
    for b in range(m):
        if a == charge[b]:
            cost1 += 1

for a in range(n+1, -1, -1):
    if a == x:
        break
    for b in range(m):
        if a == charge[b]:
            cost2 += 1

print(min(cost1, cost2))


Measured memory_bytes: 3060
#include <stdio.h>

int main() {
  int i, j, w, h;
  char c, m[101][101];
  bool b[101][101], loop;

  while (1) {
    scanf("%d %d", &h, &w);
    if (!w && !h) break;
    for (i=0; i<h; i++) {
      for (j=0; j<w; j++) {
        do {
        scanf("%c", &c);
        m[i][j] = c;
        } while (c=='\n'||c=='\r');
      }
    }
    for (i=0; i<h; i++) {
      for (j=0; j<w; j++) {
        b[i][j] = false;
      }
    }
    i = j = 0;
    loop = false;
    while (1) {
      if (b[i][j]) {
        loop = true;
        break;
      }
      b[i][j] = true;
      c = m[i][j];
      if (c == '>') ++j;
      else if (c == '<') --j;
      else if (c == '^') --i;
      else if (c == 'v') ++i;
      else break;
    }
    if (!loop) {
      printf("%d %d\n", j, i);
    } else {
      printf("LOOP\n");
    }
  }
  return 0;
}

Measured memory_bytes: 1060
#include <iostream>

using namespace std ;
/*
ifstream cin ("input") ;
ofstream cout ("output") ;*/

int main(int argc, char const *argv[])
{
	int a, b, c ;
	cin >> a >> b >> c ;
	if ((b * 10 + c) % 4 == 0) cout << "YES\n" ;
	else cout << "NO\n" ;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
a = list(map(int, input().split()))
import heapq
class Heapq:
    # 最大値を取り出す際は desc=True に設定
    def __init__(self, arr, desc=False):
        if desc:
            arr = [-a for a in arr]
        self.sign = -1 if desc else 1
        self.hq = arr
        heapq.heapify(self.hq)
 
    def pop(self):
        return heapq.heappop(self.hq) * self.sign
 
    def push(self, a):
        heapq.heappush(self.hq, a * self.sign)
 
    def top(self):
        return self.hq[0] * self.sign
    
hp = Heapq(a, desc=True)
for i in range(M):
    max_ = hp.pop() // 2
    hp.push(max_)
    
ans = 0
for i in range(N - 1):
    #print(hp.top())
    ans += hp.pop()
print(ans + hp.top())

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

int n, m = 1;
int a[100000], l[100001], r[100001];

int gcd(int a, int b) {
	if (b == 0)
		return a;
	else{
		int p = a, q = b, r = a % b;

		while (r > 0) {
			p = q;
			q = r;
			r = p % q;
		}
		return q;
	}
}

int main()
{
	cin >> n;

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

	l[0] = 0;

	for (int i = 0; i < n; i++)
		l[i + 1] = gcd(l[i], a[i]);

	r[n] = 0;

	for (int i = n - 1; i >= 0; i--)
		r[i] = gcd(r[i + 1], a[i]);

	for (int i = 0; i < n; i++)
		m = max(m, gcd(l[i], r[i + 1]));

	cout << m << endl;

	return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>

int main(){
  int i,a,b;
  scanf("%d",&a);
  scanf("%d",&b);
  for(i=1;i<1010;i++){
    if((i*2/25==a)&(i/10==b)) break;
  }
  if(i==1010) i=-1;
  printf("%d",i);
  return(0);
}


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

a1=0
a2=0
for i in range(len(a)):
  m1=sum(a)//n
  m2=-(-sum(a)//n)
  a1+=(a[i]-m1)**2
  a2+=(a[i]-m2)**2
  
print(min(a1,a2))

Measured memory_bytes: 3060
let () = Scanf.scanf "%s" @@ fun s -> Printf.printf "%d\n" @@
  if s = "SUN"
  then 7
  else if s = "MON"
  then 6
  else if s = "TUE"
  then 5
  else if s = "WED"
  then 4
  else if s = "THU"
  then 3
  else if s = "FRI"
  then 2
  else 1

Measured memory_bytes: 3780
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    string S; cin >> S;
    int m=0;
    int x=0;
    for(int i=0;i<N;i++){
        if(S[i]=='I'){
            x++;
        }else{
            x--;
        }
        if(m<x) m=x;
    }
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 256