akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	string S=in<string>();
	int left=0,right=S.size()-1;
	int sum=0;
	while(left<right){
		if(S[left]==S[right]){
			left++;
			right--;
		}
		else{
			if(S[left]=='x'){
				sum++;
				left++;
			}
			else if(S[right]=='x'){
				sum++;
				right--;
			}
			else{
				out(-1);
				return 0;
			}
		}
	}
	out(sum);
	return 0;
}


Measured memory_bytes: 512
/*
[agc016] F - Games on DAG
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

const int MAX_N = 15;
const int MOD = 1e9 + 7;

class gf {
public:
    int n;
    gf() : n(0) {}
    gf(int n) : n(n < 0 ? n % MOD + MOD : n % MOD) {}
    gf operator+(gf x) { return gf((n + x.n) % MOD); }
    gf operator-(gf x) { return gf((n - x.n + MOD) % MOD); }
    gf operator*(gf x) { return gf((1LL * n * x.n) % MOD); }
    gf& operator+=(gf x) { return *this = (*this + x); }
    gf& operator-=(gf x) { return *this = (*this - x); }
    gf& operator*=(gf x) { return *this = (*this * x); }
};

int N, M;
int E[MAX_N];
gf dp[1 << MAX_N];

int solve() {
    int full = (1 << N) - 1;
    dp[0] = 1;
    for (int s = 0; s < full; s++) {
        int ut = full ^ s;
        for (int t = ut; t > 0; t = (t - 1) & ut) {
            int u = ut ^ t;
            if ((t & 3) == 3) continue;
            gf m = 1;
            for (int i = 0; i < N; i++) {
                if (t & (1 << i)) {
                    m *= 1 << __builtin_popcount(E[i] & u);
                } else if (u & (1 << i)) {
                    m *= (1 << __builtin_popcount(E[i] & t)) - 1;
                }
            }
            dp[s | t] += m * dp[s];
        }
    }

    int ans = dp[full].n;
    return ans;
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        E[x] |= 1 << y;
    }

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 384
def LI(): return list(map(int, input().split()))
def I(): return map(int, input().split())
mod = 10**9 + 7

def main():
  n = int(input())
  ac, wa, tle, re = 0,0,0,0
  s = []
  for _ in range(n):
    s.append(input())
  for i in range(n):
    if s[i] == 'AC':
      ac += 1
    elif s[i] == 'WA':
      wa += 1
    elif s[i] == 'TLE':
      tle += 1
    else:
      re += 1
  print('AC x', ac)
  print('WA x', wa)
  print('TLE x', tle)
  print('RE x', re)

  
if __name__ == '__main__':
  main()

Measured memory_bytes: 16196
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////


signed main(){
  int a, b;cin>>a>>b;
  if(a*b <= 0)cout << "Zero" << endl;
  else if(a > 0)cout << "Positive" << endl;
  else if((b-a) % 2 == 1)cout << "Positive" << endl;
  else cout << "Negative" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<30;
const int mod = 1000000007;

int main(){
	int a, b;
	cin >> a >> b;
	if(a>=13) cout << b;
	else if(a >= 6) cout << b/2;
	else cout << 0;
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
using namespace std;

#define NUM 100
#define INF 100000000000
int v_num, e_num;
long long V[NUM][NUM];
long long A[NUM][NUM];

void wardhallFloyd(){
    for(int i = 0; i < v_num; i++){
        for(int j = 0; j < v_num; j++){
            A[i][j] = V[i][j];
        }
    }

    for(int k = 0; k < v_num; k++){
        for(int i = 0; i < v_num; i++){
            for(int j = 0; j < v_num; j++){
                if(A[i][k] != INF && A[k][j] != INF){
                    A[i][j] = min(A[i][j], A[i][k] + A[k][j]);
                }
                //printf("A[%d][%d]: %lld\n", i, j, A[i][j]);
            }
        }
    }
}

void init(){
    for(int i = 0; i < v_num; i++){
        for(int j = 0; j < v_num; j++){
            if(i == j){
                V[i][j] = 0;
            }else{
                V[i][j] = INF;
            }
        }
    }
}

bool is_negative(){
    for(int i = 0; i < v_num; i++){
        if(A[i][i] < 0){
            return true;
        }
    }
    return false;
}

void printA(int i, int j){
    if(A[i][j] == INF){
        printf("INF");
    }else{
        printf("%lld", A[i][j]);
    }
}

int main(void){
    scanf("%d", &v_num);
    scanf("%d", &e_num);

    init();

    for(int i = 0; i < e_num; i++){
        long long s, t, d;
        scanf("%lld", &s);
        scanf("%lld", &t);
        scanf("%lld", &d);
        V[s][t] = d;
    }

    wardhallFloyd();

    if(is_negative()){
        printf("NEGATIVE CYCLE\n");
        return 0;
    }

    for(int i = 0; i < v_num; i++){
        for(int j = 0; j < v_num; j++){
            if(j == v_num - 1){
                printA(i, j);
                printf("\n");
            }else{
                printA(i, j);
                printf(" ");
            }
        }
    }
}



Measured memory_bytes: 3376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mod = 1000000007;
int main() {
    int n;
    cin>>n;
    vector<string> s(2);
    cin>>s[0];
    cin>>s[1];
    ll ans=1;
    int ind=1;
    int pcond=0;
    if(s[0][0]!=s[1][0]){
        ans=6;
        ind=2;
        pcond=1;
    }
    else ans=3;
    while(ind<n){
        int tcond=s[0][ind]==s[1][ind]?0:1;
        if(pcond==0)ans*=2;
        else if(tcond==1)ans*=3;
        ans%=mod;
        ind+=1+tcond;
        pcond=tcond;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

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

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

struct BIT {
    ll n;
    vll a;
    BIT(ll n) : n(n), a(n + 1, 0) {}
    void add(ll i, ll w){
        for(ll x = i; x <= n; x += x & -x) a[x] += w;
    }
    ll sum(ll i) { // sum of [1, i]
        ll ret = 0;
        for(int x = i; x > 0; x -= x & -x) ret += a[x];
        return ret;
    }
    ll sum(ll l, ll r) { // sum of [l, r]
        return sum(r) - sum(l - 1);
    }
};

void solve() {
    ll n;
    cin >> n;
    vll a(n);
    for(ll i = 0; i < n; i++) cin >> a[i];
    vll b = a;
    sort(b.begin(), b.end());
    BIT bit(n);
    ll ans = 0;
    for(ll i = 0; i < n; i++) {
        ll j = lower_bound(b.begin(), b.end(), a[i]) - b.begin() + 1;   // 1-indexed
        ans += bit.sum(j + 1, n);
        bit.add(j, 1);
    }
    cout << ans << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 7640
using System;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var p = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

        var ans = 0;
        for (int i = 1; i + 1 < n; i++)
        {
            if (p[i - 1] < p[i] && p[i] < p[i + 1]) ans++;
            if (p[i - 1] > p[i] && p[i] > p[i + 1]) ans++;
        }

        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13140
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}

#define MAXN ((ll)2e5+5)
#define MOD ((ll)1e9 + 7)
#define INF ((ll)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define LOG(x) if(DEBUG) cerr << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<ll,ll>
#define mid ((l+r)/2)

ll n,m,k;
vector <ll> a, b;
ll ans = 0;

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin >> n >> m >> k;
	a.resize(n+1);
	b.resize(m+1);
	for (ll i = 1; i <= n; ++i)
	{
		cin >> a[i];
		a[i] += a[i-1];
	}
	for (ll i = 1; i <= m; ++i)
	{
		cin >> b[i];
		b[i] += b[i-1];
	}

	for (ll i = 0; i <= n; ++i)
	{
		ll rem = k - a[i];
		if(rem < 0)
			break;
		auto it = upper_bound(all(b), rem) - b.begin() - 1;
		ans = max(ans, i + it);
	}

	cout << ans << endl;
}

/* stuff you should look for
	* ll overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/

Measured memory_bytes: 6372
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

A = get_int
B = get_int

arr = [1, 2, 3] - [A] - [B]

puts arr.first


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

using namespace std;

int dp[100001];

int main()
{
	int n,k;
	cin>>n>>k;
	int height[n];
	for(int i=0;i<n;i++){
		cin>>height[i];
	}
	for(int i=0;i<n;i++){
		dp[i]= INT_MAX;
		}
	dp[0] = 0;
	dp[1] = abs(height[1]-height[0]);
	for(int i=2;i<n;i++){
		dp[i] = abs(height[i]-height[i-1]) + dp[i-1];
		for(int j=2;j<=k;j++){
			if(i-j>=0){
		dp[i] = min(dp[i], abs(height[i]-height[i-j]) + dp[i-j]);
			}
		}
	}
	cout<<dp[n-1]<<endl;
	return 0;
	
}


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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w;
  cin >> h >> w;
  vector<vector<char>> a(h, vector<char>(w));
  rep(i, h) {
    rep(j, w) {
      cin >> a[i][j];
    }
  }
  vector<bool> elim_y(h, false), elim_x(w, false);
  rep(i, h) {
    bool white = true;
    rep(j, w) {
      if (a[i][j] == '#') white = false;
    }
    if (white) elim_y[i] = true;
  }
  rep(j, w) {
    bool white = true;
    rep(i, h) {
      if (a[i][j] == '#') white = false;
    }
    if (white) elim_x[j] = true;
  }
  for (int i = 0; i < h; i++) {
    if (elim_y[i]) {
      a.erase(a.begin() + i);
      elim_y.erase(elim_y.begin() + i);
      h = (int)a.size();
      i--;
    }
  }
  for (int j = 0; j < w; j++) {
    if (elim_x[j]) {
      rep(i, h) {
        a[i].erase(a[i].begin() + j);
      }
      elim_x.erase(elim_x.begin() + j);
      w = (int)a[0].size();
      j--;
    }
  }
  rep(i, h) {
    rep(j, w) {
      cout << a[i][j];
    }
    cout << '\n';
  }
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin>>N;
  priority_queue<int>A;
  for(int i=0;i<N;i++){
    int a; cin>>a;
    A.push(a);
  }
  int M; cin>>M;
  priority_queue<int>B;
  for(int i=0;i<M;i++){
    int b; cin>>b;
    B.push(b);
  }
  while(!A.empty()){
    if(A.top()==B.top())B.pop();
    A.pop();
    if(B.empty()){cout<<"YES"<<endl;return 0;}
  }
  cout<<"NO"<<endl;
}

Measured memory_bytes: 5636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int a,b; cin >> a >> b;
    int dif = b - a;
    int H = (dif-1)*dif/2;
    cout << H - a << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    int n, k;
    cin >> n >> k;
    vector <int> qw (n);
    for (int i=0; i<n; ++i)
        cin >> qw[i];
    sort(qw.begin(), qw.end());
    int m=0;
    for (int i=0; i<k; ++i)
        m+=qw[i];
    cout << m << endl;
}


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

int main(void)
{
    int n, m, l;
    long long a[100][100], b[100][100], c[100][100] = {{}};
    
    cin >> n >> m >> l;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            cin >> a[i][j];
    for (int j = 0; j < m; ++j)
        for (int k = 0; k < l; ++k)
            cin >> b[j][k];
            
    for (int i = 0; i < n; ++i) {
        for (int k = 0; k < l; ++k) {
            for (int j = 0; j < m; ++j) {
                c[i][k] += a[i][j] * b[j][k];
            }
            cout << ((k == 0)? "" : " ")<< c[i][k];
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3308
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int c=0;
    string s1,s2;
    cin>>s1>>s2;
    for(int i=0;i<s1.size();i++)
    {
        if(s1[i]!=s2[i])
        {
            c++;
        }
    }
    cout<<c<<endl;


}


Measured memory_bytes: 3916
//--- pE ---//
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}


class Solution {
	Scanner scanner;



	public Solution() {
		scanner = new Scanner(System.in);

		// scanner.nextLine();
		while (scanner.hasNext()) {
			run_case();
		}
	}


	private void run_case() {
		int N = scanner.nextInt();
		String str = scanner.next();

		List<BIT> list_st = new ArrayList<>();
		for (int i=0; i<26; i++) list_st.add(new BIT(N+1));
		// SegmentTreeRSQ st = new SegmentTreeRSQ(1, N);
		for (int i=0; i<str.length(); i++) {
			int idx = str.charAt(i) - 'a';
			// int t = (int)list_st.get(idx).query(i + 1, i + 1);
			list_st.get(idx).addVal(i, 1);
		}

		int Q = scanner.nextInt();
		StringBuilder str_sb = new StringBuilder(str);
		for (;Q-->0;) {
			// int[] arr = strToIntArray(scanner.nextLine());
			// String[] vals = scanner.nextLine().split("\\s+");

			int q = scanner.nextInt();

			if (q == 1) {
				int i = scanner.nextInt();
				char c = scanner.next().charAt(0);
				int n = str_sb.charAt(i-1) - 'a';
				int m = c - 'a';

				// int t = (int)list_st.get(n).query(i, i);
				list_st.get(n).addVal(i-1, -1);

				str_sb.setCharAt(i-1, c);

				// t = (int)list_st.get(m).query(i, i);
				list_st.get(m).addVal(i-1, 1);
			} else {
				int l = scanner.nextInt()-1;
				int r = scanner.nextInt()-1;
				int cnt = 0;
				for (int i=0; i<26; i++) {
					if (list_st.get(i).getSum(l, r) > 0) cnt ++;
				}
				System.out.println(cnt);
			}
		}
		return;
	}


	private int[] strToIntArray(String str) {
	    String[] vals = str.split("\\s+");
	    int sz = vals.length;
	    int[] res = new int[sz];
	    for (int i=0; i<sz; i++) {
	        res[i] = Integer.parseInt(vals[i]);
	    }
	    return res;
	}
}
class BIT {
	public long[] arr;
	public BIT(int n) {
		arr = new long[n];
	}
	public long getSum(int i) {
		long sum = 0;
		for(i++;i > 0;i -= i&-i)sum += arr[i];
		return sum;
	}
	public long getSum(int l, int r) {
		return getSum(r) - getSum(l-1);
	}
	public void addVal(int i, long v) {
		if(v == 0)return;
		int n = arr.length;
		for(i++;i < n;i += i&-i)arr[i] += v;
	}
}


Measured memory_bytes: 215532
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, g;
  cin >> n >> g;
  rep(i, n - 1) {
    ll a;
    cin >> a;
    g = gcd(g, a);
  }
  cout << g << endl;
}

Measured memory_bytes: 3624
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int cnt,x;
	char s[4];
	scanf("%s",s);
	cnt=0;
	if(s[0]=='o') cnt++;
	if(s[1]=='o')	cnt++;
	if(s[2]=='o')	cnt++;
	x=700+cnt*100;
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b);
#define chmin(a, b) a = min(a, b);
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

vector<int> memo(1 << 21, -1);
int f(int x) {
    if (memo[x] >= 0) return memo[x];
    int bc = __builtin_popcount(x);
    return memo[x] = f(x%bc) + 1;
}

int main() {
    memo[0] = 0;
    int n;
    string x;
    cin >> n >> x;
    int pc = 0;
    rep(i, n) pc += x[i] == '1';
    vi pn(n), pp(n);
    int now1 = 1;
    int now2 = 1;
    rep(i, n) {
        pn[n-1-i] = (pc == 1 ? 0 : now1);
        pp[n-1-i] = now2;
        if (pc > 1) now1 = (now1 * 2) % (pc-1);
        now2 = (now2 * 2) % (pc + 1);
    }
    int tot1 = 0, tot2 = 0;
    rep(i, n) if (x[i] == '1') {
        if (pc > 1) tot1 = (tot1 + pn[i]) % (pc-1);
        tot2 = (tot2 + pp[i]) % (pc+1);
    }
    rep(i, n) {
        if (x[i] == '0') {
            int t = (tot2 + pp[i]) % (pc+1);
            cout << f(t) + 1 << endl;
        } else {
            if (pc == 1) cout << 0 << endl;
            else {
                int t = (tot1 - pn[i] + pc-1) % (pc-1);
                cout << f(t) + 1 << endl;
            }
        }
    }
    return 0;
    int xo = 0;

    for(int i = 0; i < n; i++) {
        xo |= (x[n-1-i] == '1') << i;
    }
    //cout << xo << ' ' << (1 << 21 << endl;
    for(int i = 0; i < n; i++) {
        int xi = xo ^ (1 << (n-i-1));
        cout << f(xi) << endl;
    }
}


Measured memory_bytes: 13424
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ll ai, ao, at, aj, al, as, az;
  cin >> ai >> ao >> at >> aj >> al >> as >> az;
  ll res0 = 0, res1 = 0;
  ll bi = ai, bo = ao, bj = aj, bl = al;
  if (bi > 0 && bj > 0 && bl > 0) {res1+=3; bi--; bj--; bl--;}
  res1 += (2*(bi/2) + 2*(bj/2) + 2*(bl/2) + bo);
  res0 += (2*(ai/2) + 2*(aj/2) + 2*(al/2) + ao);
  
  cout << max(res0,res1) << endl; 
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define N 2000001
#define a 10001
void CountingSort(int);
int C[a],A[N],B[N],n;
main(){
  int i,k=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    if(k<A[i]) k=A[i];
  }
  CountingSort(k);
  for(i=1;i<=n;i++){
    printf("%d",B[i]);
    if(i==n) printf("\n");
    else printf(" ");
  }
  
  return 0;
  
}

void CountingSort(int k){
  int i,j;
  for(i=0;i<=k;i++){
    C[i]=0;
  }
  for(j=0;j<n;j++){
    C[A[j]]=C[A[j]]+1;
  }
  for(i=0;i<=k;i++){
    C[i]=C[i]+C[i-1];
  }
 

  for(j=n-1;j>=0;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]=C[A[j]]-1;
  }
}

Measured memory_bytes: 16268
X, K, D = map(int, input().split())
X = abs(X)

if K * D <= X:
    ans = X - K * D
else:
    r = X // D + 1
    l = X // D
    if r % 2 == K % 2:
        ans = abs(X - D * r)
    else:
        ans = abs(X - D * l)
print(ans)


Measured memory_bytes: 9180
// 失敗するからこそ そこから立ち向かって行く強さがあって そんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;

#if defined(DAIJOBU)
#include "/home/pavan/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif

#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;


const int mod = 1000000007;
struct mint {
	ll x;
	mint(ll x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}
	mint inv() const {
		return pow(mod-2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res/=a;
	}
};
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};


int main(){
	FIO
	
	combination C(3e5 + 10);
	int n, a, b;cin >> n >> a >> b;
	mint nca = 1, ncb = 1;
	for(int i = n; i >= n - a + 1; i--)nca *= i;
	nca /= C.fact[a];
	for(int i = n; i >= n - b + 1; i--)ncb *= i;
	ncb /= C.fact[b];
	mint total = 2;
	total = total.pow(n);
	total -= (nca + ncb);
	cout << total.x - 1;
	return 0;
}


Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var ABX = ReadInts();
            //1L Price
            var A = ABX[0];

            //500ml Price
            var B = ABX[1];

            //Need water
            var X = ABX[2];

            var q = X / 1000;
            if (X % 1000 != 0) q += 1;
            var w = X / 500;
            if (X % 500 != 0) w += 1;

            var list = new List<int>();
            list.Add(q * A);
            list.Add(w * B);
            if ((q - 1) * 1000 + 500 >= X)
            {
                list.Add((q - 1) * A + B);
            }
            WriteLine(list.Min());
        }
        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}



Measured memory_bytes: 18296
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [a, b]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    return `${1 <= a && a <= 9 && 1 <= b && b <= 9 ? a * b : -1}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


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

int main(){
  string S, T;
  cin >> S >> T;

  string ans = "No";
  
  if (S==T) ans = "Yes";

  for (int i=0; i<S.size(); i++){
    char ins = S[S.size()-1];  // 1文字取り出すときはchar
    S.insert(S.begin(), ins);
    S.erase(S.end()-1);
//     cout << S << endl;
    if (S==T) ans = "Yes";
  }
  cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define SREP(s,i,m) for(unsigned int i = s; i < m; ++i)
#define REP(i,m) SREP(0,i,m)

using namespace std;
#ifdef _MSC_VER
using LONG = __int64;
using ULONG = unsigned __int64;
#else
using LONG = long long int;
using ULONG = unsigned long long int;
#endif

// 二乗を計算する。
int sq(int x) { return x * x; }

// 領域内にいるか。
bool within(int x, int min, int max) {
	return min <= x && x <= max;
}

// container の中から key より小さい値を見つける。
// 見つからない場合は container.end() を返す。
template<typename T>
typename T::iterator less_than(T &container, typename T::key_type &key) {
	typename T::iterator prev = container.lower_bound(key);
	if (prev == container.begin()) prev = container.end();
	else prev--;
	return prev;
}

// container の中から key より大きい値を見つける。
// 見つからない場合は container.end() を返す。
template<typename T>
typename T::iterator greater_than(T &container, typename T::key_type &key) {
	return container.upper_bound(key);
}

// b^e (mod m) を求める
LONG modpow(LONG b, LONG e, LONG m) {
	LONG result = 1;
	while (e > 0) {
		if ((e & 1) == 1) result = (result * b) % m;
		e >>= 1;
		b = (b * b) % m;
	}
	return result;
}

int main(void) {
	int N, Z, W;
	cin >> N >> Z >> W;
	vector<int> D(N);
	REP(i, N) cin >> D[i];
	if (N == 1) {
		cout << std::abs(D.back() - W) << endl;
	}
	else {
		cout << std::max(std::abs(D.back() - W), std::abs(D[D.size() - 2] - D.back())) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 998244353;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

const int MAX = 510000;
in fac[MAX], finv[MAX], inv[MAX];
//fac:n!  ,  finv:1/n  ,  inv:1/n!
// テーブルを作る前処理
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;
    }
}
// 二項係数計算
in 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;
}

//a^n (mod)
in modpow(in a, in n) {//変えた
    in mod=MOD;
    in res = 1ll;
    while (n > 0ll) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in n,m,k;
    cin>>n>>m>>k;
    in ans=0;
    COMinit();
    rep(i,k+1){
        in x=modpow(m-1ll,n-i-1ll);
        x *=COM(n-1,i);
        x %=MOD;
        ans +=x;
        ans %=MOD;
      //  cout<<ans<<" "<<x<<endl;
    }
    ans *=m;
    ans %=MOD;
    cout<<ans<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 15608
#include <iostream>

using namespace std;

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  int cnt = 0;
  for (int i = a; 1 <= i; --i) {
    cnt += a / i * i == a && b / i * i == b;
    if (cnt != k)
      continue;
    cout << i << endl;
    break;
  }
}

Measured memory_bytes: 3676
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(" ").map { it.toInt() }
    val s = readLine()!!.toCharArray()

    var count = 0
    var continueP = -1
    var startLR = s[0]
    var nowRotating = false

    for (i in 0 until n) {
        if (s[i] == startLR) {
            continueP++
            nowRotating = false
        } else {
            if(nowRotating) {
                continueP++
            } else {
                if(count < k) {
                    count++
                    nowRotating = true
                    continueP++
                } else {
                    startLR = s[i]
                }
            }
        }
    }

    println(continueP)
}

Measured memory_bytes: 41164
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {

  int N; std::cin >> N;
  std::unordered_map<std::string, ll> K;
  for(int i=0; i<N; i++) {
    std::string c; std::cin >> c;
    std::sort(c.begin(), c.end());
    if ( K.count(c) == 0 ) K[c] = 1;
    else K[c]++;
  }

  ll ans = 0;
  for(auto itr = K.begin(); itr != K.end(); ++itr) {
    ans += itr->second * (itr->second-1) / 2;
  }

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


Measured memory_bytes: 10660
/////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-10-23 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
//const long long INF=114514191911451419;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool inG(ll x,ll n){return 0<=x && 0<n;}
bool outG(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

struct Arithmetic{Arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  string s;
  getline(cin,s);

  transform(ALL(s),s.begin(),::toupper);

  cout<<s<<endl;

  return 0;

}



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

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

    int n,max = 0,ans;

    cin >> n;

    if(n == 1){
        cout << 1 << endl;
        return 0;
    }

    for(int i = 1; i <= n; ++i){
        int tmp = i;
        int count = 0;
        while(1){
            if(tmp % 2 != 0) break;
            else{ 
                tmp = tmp / 2;
                count++;
            }
        }
        if(max < count){
            max = count;
            ans = i;
        }
    }

    cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N = int(input())
abc = [[]]
for i in range(N):
    abc.append(list(map(int, input().split())))

dp = [[0,0,0] for _ in range(N+1)]
dp[1] = [abc[1][0], abc[1][1], abc[1][2]]
for i in range(2, N+1):
    for j in range(3):
        dp[i][j] = max(dp[i-1][(j+1)%3], dp[i-1][(j+2)%3]) + abc[i][j]
print(max(dp[N]))

Measured memory_bytes: 47340
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, Q;
  cin >> N >> Q;
  string str;
  cin >> str;
  
  vector<int> vec1(2*Q);
  for (int i = 0; i < 2*Q; i++) {
    cin >> vec1.at(i);
  }
  
  vector<int> vec2(N-1);
  for (int i = 0; i < N-1; i++) {
    if (str.at(i) == 'A' && str.at(i+1) == 'C'){
      vec2.at(i) = 1;
    }
  }
  
  vector<int> vec3(N);
  for (int i = 1; i < N; i++) {
    vec3.at(i) = vec3.at(i-1) + vec2.at(i-1);
  }
    
  for(int i = 0; i < Q; i++){
    cout << vec3.at(vec1.at(2*i+1)-1) - vec3.at(vec1.at(2*i)-1) << endl;
  } 
}

Measured memory_bytes: 2688
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX + 1];

void maxHeapify(int i) {
	int l, r, largest;
	l = 2 * i;
	r = 2 * i + 1;

	if (l <= H && A[l] > A[i]) largest = l;
	else largest = i;
	if (r <= H && A[r] > A[largest]) largest = r;

	if (largest != i) {
		swap(A[i], A[largest]);
		maxHeapify(largest);
	}
}

int extract() {
	int maxv;
	if (H < 1) return -INFTY;
	maxv = A[1];
	A[1] = A[H--];
	maxHeapify(1);
	return maxv;
}

void increaseKey(int i, int key) {
	if (key < A[i]) return;
	A[i] = key;
	while (i > 1 && A[i / 2] < A[i]) {
		swap(A[i], A[i / 2]);
		i = i / 2;
	}
}

void insert(int key) {
	H++;
	A[H] = -INFTY;
	increaseKey(H, key); // A[H]にkeyを挿入
}

int main() {
	int key;
	char com[10];

	while (1) {
		scanf("%s", com);
		if (com[0] == 'e'&&com[1] == 'n') break;
		if (com[0] == 'i') {
			scanf("%d", &key);
			insert(key);
		}
		else {
			printf("%d\n", extract());
		}
	}
}


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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> m(N);
  for (int i=0; i<N; i++) {
    cin >> m.at(i);
  }
  sort(m.begin(), m.end());
  int sum = accumulate(m.begin(), m.end(), 0);
  int ans = N+(X-sum)/m.at(0);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    ll n;
    cin >> n;
    ll ans = INF;
    for (ll a = 1; a * a <= n; a++)
    {
        if (n % a)
            continue;
        ll b = n / a;
        ans = min(ans, a + b);
    }
    cout << ans - 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#Coding:Utf-8
import sys
input=sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
ans=[0 for i in range(N)]

for i in range(N):
    ans[(A[i]-1)]=i+1

for l in range(N):
    print(ans[l],end=" ")

print("")


Measured memory_bytes: 13876
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
   int n;
   cin>>n;
   vector<long long> a(n);
   for(int i=0;i<n;i++)cin>>a[i];
   int ans=0;
   sort(a.begin(),a.end());
   long long sum=a[0];
   for(int i=1;i<n;i++){
      if(sum*2>=a[i])ans++;
      else ans=0;
      sum+=a[i];
   }
   ans++;
   cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
using namespace std;
int main() {
    string s;
    cin>>s;
    int n=s.length();
    int p=0;
    for(int i=0;i<n;i++){
        if(s[i]=='p'){
            p++;
        }
    }
    cout<<n/2-p<<endl;
}   



Measured memory_bytes: 512
#include <stdio.h>

char s[21][21];
int count, h, w;
int dx[] = { 0, 0, 1, -1 };
int dy[] = { 1, -1, 0, 0 };

void dfs(int x, int y) {
	int i;
	if (s[y][x] == '.' || s[y][x] == '@') {
		count++;
		s[y][x] = '#';
		for (i = 0; i < 4; i++) {
			dfs(x + dx[i], y + dy[i]);
		}
	}
	return 0;
}

int main(void) {
	char a;
	int i, j, x, y;
	while(1){
		scanf("%d %d", &w, &h);
		scanf("%c", &a);
		if (w == 0 && h == 0) {
			break;
		}

		for (i = 0; i<21; i++) {
			for (j = 0; j<21; j++) {
				s[i][j] = '#';
			}
		}
		count = 0;

		for (i = 1; i<=h; i++) {
			for (j = 1; j<=w; j++) {
				scanf("%c", &s[i][j]);
				if (s[i][j] == '@') {
					x = j;
					y = i;
				}
			}
			scanf("%c", &a);
		}
		dfs(x, y);
		printf("%d\n", count);
	}
	return 0;
}

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

namespace CSharpSample01
{


	class Program
	{
		static void Main(string[] args)
		{
			var N = int.Parse(Console.ReadLine());
			var inputDict = new SortedDictionary<string, int>(StringComparer.OrdinalIgnoreCase);
			var maxCount = 1;
			for (int i = 0; i < N; i++)
			{
				var value = Console.ReadLine();

				if (inputDict.ContainsKey(value))
				{
					inputDict[value]++; ;
					if (maxCount < inputDict[value])
					{
						maxCount = inputDict[value];
					}
				}
				else
				{
//					inputDict.Add(value, 1);
					inputDict[value] = 1;
				}
			}

//			var answerList = inputDict.Where(x => x.Value == maxCount);
			foreach (var answer in inputDict.Where(x => x.Value == maxCount))
			{
					Console.WriteLine(answer.Key);
			}

		}
	}
}

Measured memory_bytes: 36448
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD=1e9+7;
const long double Pi=acos(-1);
int main(){
  ll N,ans=1;
  cin>>N;
  vector<ll> vec(N);
  for(ll i=0;i<N;i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(),vec.end());
  if(vec.at(0)==0){cout<<0<<endl;return 0;}
  else{
    for(ll i=0;i<N;i++){
      //cout<<vec.at(i)<<endl;
      if(1000000000000000000/ans<vec.at(i)){cout<<-1<<endl;return 0;}
      ans*=vec.at(i);
      //if(ans>1000000000000000000){cout<<-1<<endl;return 0;}
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4048
# -*- coding: utf-8 -*-

"""
参考：https://minus9d.hatenablog.com/entry/2018/09/02/004610
・2べきで作るといいのは気づいたんだけどなぁ。
・2べき以外の数値をどうつなげばうまく処理できるかまとめられず…。
"""

L = int(input())

# 2べきで表せる基本部分を作る
edges = []
# baseは基本部分の守備範囲
v = base = 1
while base * 2 <= L:
    edges.append([v, v+1, 0])
    edges.append([v, v+1, base])
    base *= 2
    v += 1
# ゴールの頂点
end = edges[-1][1]
# 残りがいくつか
rest = L - base
# 残りを2べきに分割
for i in range(18, -1, -1):
    num = 2 ** i
    if rest >= num:
        # ちょうどいい位置(ここより手前で2**iまでを網羅)にバイパスを作る感じ
        edges.append([i+1, end, L-rest])
        rest -= num
print(v, len(edges))
for i in range(len(edges)):
    print(*edges[i])


Measured memory_bytes: 3064
vals = [int(s) for s in input().split()]

rs = [v%2 for v in vals]

def f(vs):
    m = max(vs)
    d = [(m-x)//2 for x in vs]
    return sum(d)

add = 0
if not (sum(rs)==0 or sum(rs)==3):
    add = 1
    if rs[0]==rs[1]:
        vals[0] += 1
        vals[1] += 1
    if rs[1]==rs[2]:
        vals[1] += 1
        vals[2] += 1
    if rs[2]==rs[0]:
        vals[2] += 1
        vals[0] += 1

print(f(vals) + add)


Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <set>
#include <string>
#include<string.h>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
int c[27][27]={0};
void play_table(void)
{
    for(int i=0;i<=26;i++)
        for(int j=0;j<=i;j++)
            if(!j || i==j)
                c[i][j]=1;
            else
                c[i][j]=c[i-1][j-1]+c[i-1][j];
    c[0][0]=0;
    return;
}
bool f[15];
int e[15],o[15];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        int x;
        scanf("%d",&x);
        if(x&1) f[i]=true;//odd 1
        else f[i]=false;// even  0
        if(f[i]){
            e[i]=2;
            o[i]=1;
        }else{
            e[i]=1;
            o[i]=2;
        }
    }
    int ans;
    int even=0,odd=0;
    /*
    cure=e[1]*e[2]+e[1]*o[2]+o[1]*e[2];
    curo=(e[1]+o[1])*(e[2]+o[2])-cure;
    */
    odd=o[1]*o[2];
    even=(o[1]+e[1])*(o[2]+e[2])-odd;

    //printf("cure=%d,curo=%d\n",cure,curo);
    for(int i=2;i<n;i++){
            int tmp=odd;
        odd=odd*o[i+1];
        even=(tmp+even)*(o[i+1]+e[i+1])-odd;
            /*
            cure=cure*e[i+1]+curo*e[i+1]+cure*o[i+1];
        curo=(cure+curo)*(e[i+1]+o[i+1])-cure;
         printf("cure=%d,curo=%d\n",cure,curo);
            */

    }
    if(n==1){
        if(f[1]) printf("0\n");
        else printf("1\n");
    }else{
        printf("%d\n",even);

    }


	return 0;
}


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

int main(){
    int n;
    int bef=0;
    cin >> n;
    string ans="";
    while(n!=1 and n!= 0){
        bef=n%-2;
        if(bef==1){
            n--;
            ans.insert(0,"1");
        //    cout<<"   "<<1<<endl;
        }else if(bef==-1){
            n--;
            ans.insert(0, "1");
          //  cout << "   " << 1 << endl;
        }else{
            ans.insert(0, "0");
           // cout << "   " << 0 << endl;
        }
      //  cout<<n<<"->  ";
        n/=-2;
     //   cout<<n<<endl;
    }
    ans.insert(0, "1");
    if(n==1){
    //cout << "   " << 1 << endl;
    cout<<ans;}
    else{
        cout<<"0";
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}




int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll N; cin >> N;
  vector<ll> T;
  rep(i,N){
    ll inp; cin >> inp;
    T.pb(inp);
  }

  ll ans = 1;
  rep(i,N)
    ans = lcm(ans, T[i]);
  cout << ans << endl;
  
  
  
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
lst = []
for _ in range(N):
    a, b, c = map(int,input().split())
    lst.append([a, b, c])
for i in lst:
    i.sort()
    if i[0] ** 2 + i[1] ** 2 == i[2] ** 2:
        print('YES')
    else:
        print('NO')
    



Measured memory_bytes: 5728