akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fe first
#define se second
#define pii pair<int,int>
#define PI  3.14159265358979323846

const int N=1e5+10;

ll a[N];
ll n,m,x;


void solve()
{  
	cin>>n;
	for(int i=1;i<=n;i++)
		{ cin>>a[i];
		  x=__gcd(x,a[i]); 
		}
	cout<<x;
}


int main()
{ cool;
	 int t=1;
	 while(t--)
        { solve();
        }

        return 0;
}


Measured memory_bytes: 1024
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var NM = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var N = NM[0]; var M = NM[1];

            var union = new UnionFind(N);
            var result = N - 1;

            for (int i = 0; i < M; i++)
            {
                var ab = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                if (!union.sameRoot(ab[0], ab[1]))
                {
                    result--;
                    union.unite(ab[0], ab[1]);
                }
            }
            Console.WriteLine(result);

        }
    }

    public class UnionFind
    {
        private int[] parents;
        // 同じ根に属する枝の数を格納する
        private int[] rootCount;

        public int RootCount(int branch)
        {
            return rootCount[root(branch)];
        }

        public UnionFind(int count)
        {
            parents = new int[count + 1];
            rootCount = new int[count + 1];
            for (int i = 0; i < count + 1; i++)
            {
                parents[i] = i;
                rootCount[i] = 1;
            }
        }

        private int root(int N)
        {
            if (parents[N] == N) return N;
            return parents[N] = root(parents[N]);
        }

        //木を併合する際に、枝の数も合算する
        public void unite(int X, int Y)
        {
            int rootX = root(X);
            int rootY = root(Y);
            if (rootX == rootY) return;
            rootCount[rootX] += rootCount[rootY];
            parents[rootY] = rootX;
        }

        public bool sameRoot(int X, int Y)
        {
            return root(X) == root(Y);
        }
    }
}


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

using namespace std;

int main() {

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	int n;
	cin >> n;
	unordered_set<string> items;
	string item;
	for (int i = 0; i < n; ++i) {
		cin >> item;
		items.insert(item);
	}
	cout << items.size() << '\n';
	return 0;
}

Measured memory_bytes: 17680
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int (i) = 0; (i) <(n); (i)++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}
long comb(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
using namespace std;

int main(){
  
  int n;
  std::cin >> n;
  std::vector<double> a(n);
  rep(i,n)std::cin >> a[i];
  std::sort(a.begin(), a.end() );
 
  double w=a[0];
  
  for(int i=1;i<n;i++){
      w=(w+a[i])/2;
      
  }
  
  
  

  std::cout << w << std::endl;
}


Measured memory_bytes: 256
import math
a,b,c=map(float,input().split())
C=c*math.pi/float(180)
S=(1/2)*a*b*math.sin(C)
L=a+b+math.sqrt((a*a+b*b)-2*a*b*math.cos(C))
h=b*math.sin(C)
print('{:.8f}'.format(S))
print('{:.8f}'.format(L))
print('{:.8f}'.format(h))


Measured memory_bytes: 5696
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxn 205

using namespace std;

int a[maxn][maxn];
int d[maxn][maxn];
int p[maxn];
int des[maxn];
int n,m,r;
int ans;

int main() {
	scanf("%d%d%d",&n,&m,&r);
	for (int i=1;i<=r;i++) 
		scanf("%d",&des[i]);
	memset(a,0x3f,sizeof(a));
	for (int i=1;i<=m;i++) {
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		a[u][v]=a[v][u]=w;
	}
	for (int i=1;i<=n;i++)
		a[i][i]=0;
	for (int k=1;k<=n;k++) 
		for (int i=1;i<=n;i++)
			for (int j=1;j<=n;j++)
				a[i][j]=min(a[i][j],a[i][k]+a[k][j]);
	int fac=1;
	for (int i=0;i<r;i++) {
		p[i]=i+1;
		fac*=i+1;
	}
	int ans=1000000000;
	for (int i=1;i<=fac;i++) {
		int sum=0;
		for (int j=1;j<r;j++) sum+=a[des[p[j]]][des[p[j-1]]];
		ans=min(ans,sum);
		next_permutation(p,p+r);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 384
using System;

namespace Test
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var inputs = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            var n = inputs[0];
            var p = inputs[1];
            var time=0;
            var queue = new Queue<Process>(n);
            while (queue.IsFull() == false)
            {
                var temp=Console.ReadLine().Split();
                var process = new Process(temp[0],int.Parse(temp[1]));
                queue.Enqueue(process);
            }

            while (queue.IsEmpty() == false)
            {
                var process = queue.Dequeue();
                if (process.Time > p)
                {
                    time += p;
                    process.Time = process.Time - p;
                    queue.Enqueue(process);
                }
                else
                {
                    time += process.Time;
                    Console.WriteLine("{0} {1}", process.Name, time);
                }
            }

            Console.Read();
        }
    }
    class Process
    {
        public string Name { get; set; }
        public int Time { get; set; }
        public Process(string name, int time)
        {
            Name = name;
            Time = time;
        }
    }
    class Queue<T>
    {
        private T[] array;
        private int top = 0;
        private int back = 0;

        public Queue(int capacity)
        {
            array = new T[capacity+1];
        }
        public void Enqueue(T item)
        {
            array[top++] = item;
            if (top == array.Length)
            {
                top = 0;
            }
        }
        public T Dequeue()
        {
            var temp = array[back++];
            if (back == array.Length) back = 0;
            return temp;
        }
        public bool IsEmpty()
        {
            return top == back;
        }
        public bool IsFull()
        {
            return (top + 1) % array.Length == back;
        }
        
    }

}

Measured memory_bytes: 20004
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
using namespace std;
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    bool p[1000001];
    for (int i=0;i<1000001;i++) p[i]=0;
    map<int,int> cnt;
    for (int i=0;i<n;i++)
    {
        cin>>a[i];
        p[a[i]]=1;
        cnt[a[i]]++;
    }
    sort(a, a+n);
    for(int i=0;i<n;i++)
    {
        if(p[a[i]])
        {
            for(int j=2*a[i];j<=a[n-1];j+=a[i])
            {
                p[j]=false;
            }
        }
    }
    for(auto x:a)
    {
        if(cnt[x]>1)
        {
            p[x]=0;
        }
    }
    int ans=0;
    for (auto x: p)
    {
        if (x) ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 14716
#include <limits.h>
#include <string>
#include <iostream>

using namespace std;

int main()
{
	long long ans = LLONG_MAX, i, j, k, N, K, x[100000], a[100000] = {0}, cnt=0, c=0;

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

	for (i = 0; i <= N-K; i++) {
		if (x[i + K - 1] <= 0)
			a[i] = -x[i];
		else if (-x[i] > x[K - 1 + i])
			a[i] = 2 * x[K - 1 + i] - x[i];
		else if (x[i] <= 0)
			a[i] = -2 * x[i] + x[K - 1 + i];
		else
			a[i] = x[K - 1 + i];

		if (a[i] < ans)
			ans = a[i];
	}

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

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 10000000000000

int main(){
    ll n,k,q;cin>>n>>k>>q;
    vector<ll> a(q);for(ll i=0;i<q;i++){cin>>a[i];a[i]--;}
    vector<ll> point(n,k);//n人のpoint

    for(ll i=0;i<q;i++){
        point[a[i]]++;
    }

    for(ll i=0;i<n;i++){
        point[i]-=q;
    }

    for(ll i=0;i<n;i++){
        if(point[i]<=0){cout<<"No"<<endl;}
        else{cout<<"Yes"<<endl;}
    }
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
int isP(int x){
    for(int i = 2; i <= sqrt(x); i++){
        if(x%i==0)return i;
    }
    return x;
}
void solve(){
    int n;
    cin>>n;
    int a = 1;
    map<int, int>cnt;
    for(int i = 1; i <= n; i++){
        int j = i;
        while(j>1)
        {
            cnt[isP(j)]++;
            j/=isP(j);
        }
        cnt[i]+=(j!=1);
    }
    for(int i = 1; i <= n; i++){
        a*=cnt[i]+1;
        a%=mod;
    }
    cout<<a;
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;



unsigned euclidean_gcd(unsigned a, unsigned b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}


int main(){
    int n;
    cin>>n;
    long sum=0;

    int a,b,c;

    for(a=1;a<=n;a++){
        for(b=1;b<=n;b++){
            for(c=1;c<=n;c++){
                sum+=euclidean_gcd(euclidean_gcd(a,b),c);
            }
        }
    }
    cout<<sum<<endl;
    return 0;

}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int N,num_query;
vector<int> V;

int main(){

	scanf("%d",&N);

	int tmp;
	for(int i = 0; i < N; i++){

		scanf("%d",&tmp);
		V.push_back(tmp);
	}

	scanf("%d",&num_query);

	for(int loop = 0; loop < num_query; loop++){

		scanf("%d",&tmp);

		printf("%d %d\n",lower_bound(V.begin(),V.end(),tmp)-V.begin(),upper_bound(V.begin(),V.end(),tmp)-V.begin());
	}

	return 0;
}



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

using namespace std;

long long n, p, ans = 1;
map<long long, long long> fact;

void factor(long long n) {
    while (n % 2 == 0) {
        fact[2]++;
        n /= 2;
    }
    for (long long d = 3; d * d <= n; d += 2) {
        while (n % d == 0) {
            fact[d]++;
            n /= d;
        }
    }
    if (n > 1) fact[n]++;
}

long long binpow(long long a, long long b) {
    long long res = 1;
    while (b) {
        if (b & 1) res *= a;
        a *= a; b >>= 1;
    }
    return res;
}

int main() {
	cin >> n >> p;
	if (p == 1) ans = 1;
	else if (n == 1) ans = p;
	else {
        factor(p);
        for (auto it : fact) {
            ans *= binpow(it.first, it.second / n);
        }
	}
	cout << ans << '\n';
}

Measured memory_bytes: 256
N = int(input())
As = []
minus = 0
for c in input().split(" "):
  tmp = int(c)
  if tmp<0:
    minus += 1
    As.append(-tmp)
  else:
    As.append(tmp)

if minus%2==0:
  print(sum(As))
else:
  print(sum(As) - 2 * min(As))

Measured memory_bytes: 14380
def main():
	N = int(input())
	A = list(map(int, input().split()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print(-1)
			return
	print(prod)
main()

Measured memory_bytes: 84528
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <fstream>
using namespace std;

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v; ll w; };

const int MOD = 1000000007;
const int _MOD = 1000000009;
double EPS = 1e-10;
const int INF = INT_MAX / 2;

int main() {
	string s; cin >> s;
	s = "0000000000" + s;
	int N = s.length();
	vector<int> a(N);
	rep(i, N) a[i] = (s[i] - '0') * 9;
	for (int i = N - 1; i > 0; i--) {
		int x = a[i];
		a[i] = x % 10;
		a[i - 1] += x / 10;
	}
	//rep(i, N) cout << a[i];
	//cout << endl;
	int lb = -1, ub = 100000000;
	int x;
	while (ub - lb > 1) {
		int mid = (lb + ub) / 2;
		vector<int> b = a;
		x = b[N - 1];
		x = (10 - x) % 10;
		b[N - 1] += x + mid * 10;
		for (int i = N - 1; i > 0; i--) {
			b[i - 1] += b[i] / 10;
			b[i] %= 10;
		}
		int sum = 0;
		rep(i, N - 1) sum += b[i];
		if (b[N - 1]) sum += 10;
		if (sum <= x + mid * 10) ub = mid;
		else lb = mid;
	}
	cout << (x + ub * 10 + 8) / 9 << endl;
}


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

using namespace std;

int main(){
        int H, W;
        string s[100];
        cin>>H>>W;
        for(int i=0;i<H;i++){
                cin>>s[i];
                for(int j=0;j<W;j++){
                        if(s[i][j]=='.'){
                                s[i][j]='0';
                        }
                }
        }
        int dx[8]={-1, -1, -1, 0, 0, 1, 1, 1};
        int dy[8]={-1, 0, 1, -1, 1, -1, 0, 1};
        for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                        if(s[i][j]=='#'){
                                for(int h=0;h<8;h++){
                                        int y=i+dy[h];
                                        int x=j+dx[h];
                                        if(y<0||y>H-1||x<0||x>W-1||s[y][x]=='#'){
                                                continue;
                                        }
                                        s[y][x]++;
                                }
                        }
                }
        }
        for(int i=0;i<H;i++){
                cout<<s[i]<<endl;
        }
        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;

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


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

int main(){
	ll a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    ll answ=a,anss=0,w=0,s=0;
    double ans=0;
    rep(i,0,f/(100*a)+1){
        rep(j,0,f/(100*b)+1){
            w=i*a+j*b;
            rep(k,0,(f-w)/c+1){
                rep(l,0,(f-w)/d+1){
                    s=k*c+l*d;
                    if((w*100+s)<=f && e>=s/(double)w){
                        if(ans<(s/(double)w)){ans=(s/(double)w);answ=w;anss=s;}
                    }
                }
            }
        }
    }
    cout<<answ*100+anss<<" "<<anss;
}

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

const ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<ll> s(n + 1);
  for (int i = 0; i < n; i++) {
    s[i + 1] = a[i] + s[i];
  }
  ll ans = INFL;
  int l = 1;
  int r = 3;
  for (int m = 2; m <= n - 2; m++) {
    while (l < m && abs((s[l] - s[0]) - (s[m] - s[l])) >=
                        abs((s[l + 1] - s[0]) - (s[m] - s[l + 1]))) {
      l++;
    }
    while (r < n && abs((s[n] - s[r]) - (s[r] - s[m])) >=
                        abs((s[n] - s[r + 1]) - (s[r + 1] - s[m]))) {
      r++;
    }
    ll P = abs(s[l] - s[0]);
    ll Q = abs(s[m] - s[l]);
    ll R = abs(s[r] - s[m]);
    ll S = abs(s[n] - s[r]);
    ll mx = max({P, Q, R, S});
    ll mn = min({P, Q, R, S});
    ans = min(ans, mx - mn);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5616
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

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

#define ll long long
#define ld long double 
#define endl "\n"
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (ll)(a.size())
#define all(a) a.begin(), a.end() 
#define fr(i,n) for(i=1;i<=n;i++)
#define rp(i,n) for(i=0;i<n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
typedef pair<ll, ll> ii;
typedef vector<ll> vl;
const ll N = 200010;
ll mod=1e9+7;

ll ffmod(ll x, ll y, ll mod)
{
    ll rt=1;
    while(y)
    {
        if(y&1ll) rt=(rt*x)%mod;
        x=(x*x)%mod, y/=2ll;
    }
    return rt;
}

ll dp1[10010][110], dp2[10010][110];

int main()
{
    FIO;
    string s;
    ll n,d,i,j,k,tp;
    cin>>s>>d;
    n=SZ(s);
    s="$"+s;
    fr(i,n) s[i]-=48;
    for(i=0;i<s[1];i++)
        dp1[1][i%d]++;
    dp2[1][i%d]=1;
//    i=1;
  //  rp(j,d) tr(i,j,dp1[i][j]);
    for(i=2;i<=n;i++)
    {
        for(j=0;j<s[i];j++)
            for(k=0;k<d;k++)
            {
                tp=(k+j)%d;
                dp1[i][tp]=(dp1[i][tp]+dp1[i-1][k]+dp2[i-1][k])%mod;
            }
        for(k=0;k<d;k++)
        {
            tp=(k+j)%d;
            dp2[i][tp]=(dp2[i][tp]+dp2[i-1][k])%mod;
//            tr(i,k,tp,dp2[i][tp]);
        }
        for(;j<10;j++)
            for(k=0;k<d;k++)
            {
                tp=(k+j)%d;
                dp1[i][tp]=(dp1[i][tp]+dp1[i-1][k])%mod; 
            }
//        rp(j,d) tr(i,j,dp1[i][j]);
    }
    cout<<(dp1[n][0]+dp2[n][0]-1+mod)%mod<<endl;
    return 0;
}


Measured memory_bytes: 17536
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
H = LIST()

for i in range(N):
	if i == N-1:
		break
	if H[i+1] == H[i]:
		continue
	if H[i+1] < H[i]:
		print("No")
		sys.exit(0)
	else:
		H[i+1] -= 1
print("Yes")


Measured memory_bytes: 16324
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

int n,sm=0,bs=0;
long long int qma;
short q[11];

int pw(int a,int b){
  int c=1;
  for(int i=0;i<b;i++)c*=a;
  return c;
}

int main(){
  for(int i=0;i<12;i++)q[i]=-1;
  scanf("%d",&n);
  while(q[9]==-1){
    sm++;
    q[0]++;
    qma=0;
    int ks[]={0,0,0};
    for(int i=0;i<11;i++){
      if(q[i]>2){
        q[i]=0;
        q[i+1]++;
      }
      ks[q[i]]++;
      if(q[i]!=-1)qma+=pw(10,i)*(q[i]*2+3);
    }
    if(ks[0] and ks[1] and ks[2] and qma<=n)bs+=1;
  }
  printf("%d\n",bs);
}

Measured memory_bytes: 256
# ABC110B - 1 Dimensional World's Tale
n, m, x, y = list(map(int, input().rstrip().split()))
x_data = list(map(int, input().rstrip().split()))
y_data = list(map(int, input().rstrip().split()))
x_data.append(x)
y_data.append(y)

print("No War" if max(x_data) < min(y_data) else "War")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    int N; cin>>N;
    int count = 0;
    int ans = 0;
    int H1; cin >> H1;
    for(int i=0; i<N-1; i++){
        int H2; cin >> H2;
        if(H1>=H2) count++;
        else count=0;
        if(count > ans) ans = count;
        H1 = H2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int32_t main(){
  double n;
  cin >> n;
  double ans = 3.141592653589793238462643383279502884197169399375105820974944592307816406286*n*2.00;
       cout << fixed << setprecision(6) << ans << "\n"; 
    
    return  0;
}

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

int main(){

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

for(i=0;i<n;i++){
    if(arr[i]%2==0){
        if(arr[i]%3==0 || arr[i]%5 ==0){
            continue;
        }
        else
            x++;
    }
}
if(x==0)
cout<<"APPROVED";
else
cout << "DENIED";

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> L(n); rep(i, n) cin >> L[i];
  ll mx = *max_element(all(L));
  ll sum = accumulate(all(L), 0LL) - mx;
  cout << (mx < sum ? "Yes" :  "No") << endk;
  return 0;
}


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

int main() {
    int n, k; cin>>n>>k;
    int h[n], dp[n] = {0};
    for (int i=0; i<n; ++i) cin>>h[i];
    for (int i=0; i<n-1; ++i) dp[i] = 2e9;
    for (int i=n-2; i>=0; i--)
        for (int j=1; j<=k and i+j<n; j++)
            dp[i] = min(dp[i], abs(h[i]-h[i+j]) + dp[i+j]);
    cout << dp[0] << '\n';
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = null;
		try {
			sc = new Scanner(System.in);
			// 縦線の数
			int w = sc.nextInt();
			// あみだのスタートライン
			int[] nums = new int[w];
			for (int i = 0; i < w; i++) {
				nums[i] = i + 1;
			}

			// 横線の数
			int n = sc.nextInt();

			// 横線を引く
			for (int i = 0; i < n; i++) {
				String[] input = sc.next().split(",");
				int a = Integer.parseInt(input[0]);
				int b = Integer.parseInt(input[1]);

				int work = nums[a - 1];
				nums[a - 1] = nums[b - 1];
				nums[b - 1] = work;
			}

			// 結果出力
			for (int result : nums) {
				System.out.println(result);
			}
		} finally {
			sc.close();
		}
	}
}

Measured memory_bytes: 26348
#Sharing Cookies
def ABC_67_A():
    A,B = map(int, input().split())
    
    if A%3 == 0:
        print('Possible')
    elif B%3 == 0:
        print('Possible')
    elif (A+B)%3 == 0:
        print('Possible')
    else:
        print('Impossible')

#ABCxxx
def ABC_68_A():
    N = input()
    print('ABC'+N)
    
    

if __name__ == '__main__':

    ABC_67_A()

Measured memory_bytes: 3060
#pragma region Macros
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;
#pragma endregion
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	string a, b;
	cin >> a >> b;

	int nb;
	nb = stoi(a + b);
	string ans = "No";
	rep(i, 350)
	{
		if (i * i == nb)
		{
			ans = "Yes";
			break ;
		}
	}
	cout << ans << '\n';
	return 0;
}


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

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}

int a[55],b[55],c[55],d[55];
vector< vector<int> >vec;
int n,m,q;
vector<int>v;
void rec(int pos,int last)
{
    if(pos>n)
    {
        vec.pb(v);
        return ;
    }
    for(int i=last;i<=m;i++)
    {
        v.pb(i);
        rec(pos+1,i);
        v.pop_back();
    }
}
 main()

{
    cin>>n>>m>>q;
    f(i,0,q-1)
    {
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    }
    rec(1,1);
    int sz=vec.size();
    int ses=0;
    f(i,0,sz-1)
    {
       int ans=0;
      //for(auto x:vec[i])cout<<x<<" ";cout<<endl;
       for(int j=0;j<q;j++)
       {
           if(vec[i][b[j]-1]-vec[i][a[j]-1]==c[j])
           {
               ans+=d[j];
           }
       }
       ses=max(ans,ses);
    }

     cout<<ses<<endl;
















    return 0;

}













Measured memory_bytes: 14000
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < A[i].size(); j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< int > X(N), Y(N), P(N);
	rep(i, N) cin >> X[i] >> Y[i] >> P[i];
	vector< pii > line;
	int count = 0;
	vector< int > ans(N + 1, LINF);
	vector< int > d(N, LINF);
	rep(i, N) d[i] = min(abs(X[i]), abs(Y[i]));
	auto f = [&](auto &&f, int i) -> void {
		if (i == N) {
			int tmp = 0;
			rep(i, N) tmp += d[i] * P[i];
			chmin(ans[count], tmp);
		} else {
			f(f, i + 1);
			vector< int > d2 = d;
			rep(j, N) {
				chmin(d[j], abs(X[j] - X[i]));
			}
			count++;
			//line.push_back(pii(0, i));
			f(f, i + 1);
			d = d2;
			rep(j, N) {
				chmin(d[j], abs(Y[j] - Y[i]));
			}
			//line.pop_back();
			//line.push_back(pii(1, i));
			f(f, i + 1);
			//line.pop_back();
			d = d2;
			count--;
		}
	};
	f(f, 0);
	rep(i, N + 1) cout << ans[i] << endl;
	return 0;
}

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

A = [list(map(int, input().split())) for i in range(n)]
b = [int(input()) for i in range(m)]

for i in range(n):
    ans = 0
    for j in range(m):
        ans += A[i][j] * b[j]
    print(ans)



Measured memory_bytes: 5980
#include <iostream>
using namespace std;
using ll = long long;
const ll MOD = 1000000007LL;

ll pow(ll a, ll n) {
  ll res = 1;
  for (; n; n >>= 1) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
  }
  return res;
}

ll fact(int n) {
  ll res = 1;
  for (int i = 2; i <= n; i++)
    res = res * i % MOD;
  return res;
}

ll comb(ll n, ll r) {
  ll tmp = 1;
  for (int i = n; i > n - r; i--) tmp = tmp * i % MOD;
  ll inv_fact_r = pow(fact(r), MOD-2);
  return tmp * inv_fact_r % MOD;
}

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

    int N, M; cin >> N >> M;
    int m = M;
    ll ans = 1;
    for (int i = 2; i * i <= M; i++) {
        if (m % i) continue;
        ll c = 0;
        while (m % i == 0) {
            c++;
            m /= i;
        }
        ans = ans * comb(c+N-1, c) % MOD;
    }
    if (m > 1) ans = ans * N % MOD;
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 500000
#define BIG 1000000000
int L[MAX/2+2],R[MAX/2+2];

long long merge(int A[], int n,int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
int i = 0,j = 0,k=0;
long long cnt = 0;
  for(i = 0;i<n1;i++) L[i]=A[left+i];
  for(i = 0;i<n2;i++) R[i]=A[mid+i];
  L[n1] = BIG;
  R[n2] = BIG;
  i=0;j=0;
  for(k=left;k < right;k++) {
    if (L[i] <= R[j]) {
      A[k] = L[i++];
    }  else{
      A[k] = R[j++];
      cnt += n1 - i;
    }
}
return cnt;
}

long long mergeSort(int A[],int n, int left,int right){
  long long v1, v2 , v3;
  if (left+1 < right) {
    int mid = (left + right)/2;
    v1 = mergeSort(A,n, left, mid);
    v2 = mergeSort(A,n, mid, right);
    v3 = merge(A, n, left, mid, right);
    return v1 + v2 + v3;
  } else return 0;
  }

int main() {
  int A[MAX],n,i;
  scanf("%d",&n);
  for(i = 0;i<n;i++) scanf("%d\n", &A[i]);

   long long ans = mergeSort(A,n,0,n);
  printf("%lld\n", ans);

  return 0;
 }

Measured memory_bytes: 2168
#include<stdio.h>
int main(){
  int N;
  scanf("%d",&N);
  int a[N];
  int i;
  int c4=0;
  int c=0;
  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<N;i++){
    if(a[i]%4==0){
      c4++;
    }
    else if(a[i]%2!=0){
      c++;
    }
  }
  if(N%2!=0){
    if(c4+1>=c){
      printf("Yes");
    }
    else{
      printf("No");
    }
  }
  if(N%2==0){
    if(c4>=c){
      printf("Yes");
    }
    else{
      printf("No");
    }
  }
}

Measured memory_bytes: 512
while 1:
    try:
        a,b,c,d,e,f=[int(i) for i in input().split()]

        y=float((c*d-f*a)/(b*d-e*a))
        x=float((c-b*y)/a)
        print("{0:.3f}".format(x),"{0:.3f}".format(y))
    except EOFError:
        break

Measured memory_bytes: 7604
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str;
        str = scan.nextLine();
        String[] num = str.split(" ",0);
        int a, b;
        a = Integer.valueOf(num[0]);
        b = Integer.valueOf(num[1]);
        System.out.println(a/b + " " + a%b + " " + String.format("%.8f", (double)a/b));
        scan.close();
    }
}


Measured memory_bytes: 26464
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int n;
	cin >> n;
	
	vector<ll> h(n);
	for(int i = 0; i < n; ++i) {
		cin >> h[i];
	}
	
	vector<ll> dp(n + 10, 1LL << 60);
	dp[0] = 0; 
	
	/*
	dp[1] = abs(h[0] - h[1]);
	for(int i = 2; i < n; ++i) {
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	*/
	
	for(int i = 1; i < n; ++i) {
		dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
		if( i > 1 ) dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	
	cout << dp[n - 1] << endl;
	
	return 0;
}


Measured memory_bytes: 4832
n = int(input())
x = input()
k = x.count("1")
cnt = 0
s = int(x, 2)
if k >= 2:
	k1 = s % (k-1)
k2 = s % (k+1)
while s != 0:
	targ = bin(s).count("1")
	s = s % targ
	cnt += 1

def ev(n):
	cnt = 0
	while n != 0:
		m = bin(n).count("1")
		n = n % m
		cnt += 1
	return cnt

if k != 1:
	for i in range(n):
		if x[i] == "0":
			targ = k+1
			print(ev((k2+pow(2, n-i-1, targ)) % targ)+1)
		else:
			targ = k-1
			print(ev((k1-pow(2, n-i-1, targ)) % targ)+1)
else:
	for i in range(n):
		if x[i] == "0":
			targ = k+1
			print(ev((k2+pow(2, n-i-1, targ)) % targ)+1)
		else:
			targ = k-1
			print(0)

Measured memory_bytes: 81280
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

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

  int n, k;
  string s;
  cin >> n >> k;
  cout << n - k + 1 << endl;
    
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int main(){
  int d,i,j,k;
  cin >> d;
  double a[1000]={},b[1000]={};
  for(i=0;i<d;i++) cin >> a[i];
  for(i=0;i<d;i++) cin >> b[i];
  double o1=0,o2=0,o3=0,oe=0;
  for(i=0;i<d;i++){
    o1+=fabs(a[i]-b[i]);
    o2+=fabs(a[i]-b[i])*fabs(a[i]-b[i]);
    o3+=fabs(a[i]-b[i])*fabs(a[i]-b[i])*fabs(a[i]-b[i]);
    oe=max(oe,fabs(a[i]-b[i]));
  }
  printf("%.6f\n",o1);
  printf("%.6f\n",sqrt(o2));
  printf("%.6f\n",pow(o3,1.0/3.0));
  printf("%.6f\n",oe);
  return 0;
}


Measured memory_bytes: 3404
#include <iostream>

using namespace std;

int main(void){

    int H, W;
    cin >> H >> W;
    char c[H][W];
    for(int i = 0; i < H;i++){
        for(int j = 0;j < W;j++){
            cin >> c[i][j];
        }
    }
    int count[H][W];
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            count[i][j] = 0;
        }
    }
    //8マス全部見て置換
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){

            for(int k = i - 1;k <= i + 1;k++){
                for(int l = j - 1;l <= j + 1;l++){

                    if(!(k < 0 || H <= k || l < 0 || W <= l)){
                        if(c[k][l] == '#'){
                            count[i][j] += 1;
                        }
                    }
                }
            }
        }
    }
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            if(c[i][j] == '#'){
                cout << '#';
            }else{
                cout << count[i][j];
            }
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int a[100010];
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }
    int ans = 0;
    rep(i, n) if (a[a[i]] == i) ans++;
    cout << ans / 2 << endl;

    return 0;
}


Measured memory_bytes: 640
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

function main() {
    let X = +cin.shift();
    for (let a = -120; a < 120; a++) {
        for (let b = -120; b < 120; b++) {
            if (a ** 5 - b ** 5 == X) {
                console.log(a, b);
                return;
            }
        }
    }
}
main();


Measured memory_bytes: 34040
#include <bits/stdc++.h>
/**
AHMAD;HASSAN;SAEED
*/
using namespace std;


int main()
{
    int n;
    cin>>n;
    cout<<(n/1000+!!(n%1000))*1000-n<<'\n';
/**
10
9
2 0 1 1 2 4 4 2 0
*/
    return 0;
}


Measured memory_bytes: 3612
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using ll = long long;
typedef std::pair<int,int> P;
#include <boost/multiprecision/cpp_int.hpp>

using bint = boost::multiprecision::cpp_int;
 



int main(){
    int a,b;
    cin>> a >> b;
    int m = max(a,b);
    cout << (m <= 8? "Yay!": ":(");
    rn 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define P pair<int,int>
#define PP pair<P,int>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    string s;
    cin>>s;
    stack<char> st;
    REP(i,s.size()){
        if(s[i]=='T'){
            if(st.size()&&st.top()=='S'){
                st.pop();
            }else{
                st.push(s[i]);
            }
        }else{
            st.push(s[i]);
        }
    }
    cout<<st.size()<<endl;
    return 0;
}

Measured memory_bytes: 644
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000007
#define pb push_back
#define MP make_pair
typedef long long ll;
typedef std::pair<int,int> pii;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        swap(a,b);
    }
    ll k=a%b;
    while(k!=0){
        a=b;
        b=k;
        k=a%b;
    }
    return b;
}

int main() {
    int n;
    ll ans=0;
    cin>>n;
    vector<ll> v(n);
    rep(i,0,n){
        cin>>v[i];
        if(i==0)ans=v[i];
        if(i>0){
            ans=v[i]/gcd(v[i],ans)*ans;
        }
    }
    cout<<ans<<endl;
    
    return 0;
}


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

namespace AtCoder.BC088
{
    public class B
    {
        public static void Main()
        {
            Console.ReadLine();
            List<int> cards = Console.ReadLine().Split(" ").Select(n => int.Parse(n)).OrderByDescending(n => n).ToList();
            int a = 0, b = 0;

            for (int i = 0; i < cards.Count(); i++)
            {
                if (i % 2 == 0)
                {
                    a += cards[i];
                }
                else
                {
                    b += cards[i];
                }
            }

            Console.WriteLine(a - b);
        }
    }
}

Measured memory_bytes: 28468
#include<iostream>
#include<string>

int main(){
    int n, k, r, s, p;
    long ans = 0;
    std::string t, str{};

    std::cin >> n >> k;
    std::cin >> r >> s >> p;
    std::cin >> t;

    for(int i = 0; i < k; i++){
        if(t.at(i) == 'r'){
            ans += p;
            str += 'p';
        }else if(t.at(i) == 's'){
            ans += r;
            str += 'r';
        }else{
            ans += s;
            str += 's';
        }
    }
    for(int i = k; i < n; i++){
        if( t.at(i) == 'r' && str.at(i - k) == 'p' || 
            t.at(i) == 's' && str.at(i - k) == 'r' || 
            t.at(i) == 'p' && str.at(i - k) == 's'){

            str += 'd';

        }else{
            if(t.at(i) == 'r'){
                ans += p;
                str += 'p';
            }else if(t.at(i) == 's'){
                ans += r;
                str += 'r';
            }else{
                ans += s;
                str += 's';
            }
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


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

using namespace std;

const long long int MOD = 1000000007;

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

class Add_Segment_Tree {
	vector<long long int>v;
	vector<int>l;
	vector<int>r;
	long long int ret;
	int num;
	long long int Update(int place) {
		if (place >= v.size() / 2) {
			return v[place];
		}
		v[place] = Update(place * 2) + Update(place * 2 + 1);
		return v[place];
	}
	void Sum(int a, int b, int place) {
		if (l[place] >= a && r[place] <= b) {
			ret += v[place];
			return;
		}
		if (l[place] > b || r[place] < a) return;
		Sum(a, b, place * 2);
		Sum(a, b, place * 2 + 1);
		return;
	}
public:
	void Left(int place) {
		if (place >= v.size() / 2) {
			l[place] = place - v.size() / 2;
			return;
		}
		Left(place * 2);
		Left(place * 2 + 1);
		l[place] = l[place * 2];
		return;
	}
	void Right(int place) {
		if (place >= v.size() / 2) {
			r[place] = place - v.size() / 2;
			return;
		}
		Right(place * 2);
		Right(place * 2 + 1);
		r[place] = r[place * 2 + 1];
		return;
	}
	Add_Segment_Tree(int n) {
		n++;
		num = 1;
		while (num < n * 2)num *= 2;
		l.resize(num);
		r.resize(num);
		v.resize(num, 0);
		Left(1);
		Right(1);
	}
	void Add(int place, long long int num, bool update) {
		place += v.size() / 2;
		v[place] += num;
		if (!update)return;
		place /= 2;
		while (place) {
			v[place] = v[place * 2] + v[place * 2 + 1];
			place /= 2;
		}
	}
	void TopDown() {
		Update(1);
	}
	long long int Sum(int a, int b) {
		ret = 0;
		Sum(a, b, 1);
		return ret;
	}
};

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


	cin >> N;
	vector<int>v(N);
	for (int i = 0; i < N; i++)cin >> v[i];
	if (N == 1) {
		cout << v[0] << endl;
		return 0;
	}
	L = 0;
	R = MOD;
	while (R - L > 1) {
		Add_Segment_Tree asg(N * 2 + 1);
		int mid = (R + L + 1) / 2;
		auto w = v;
		for (auto &i : w) {
			if (i < mid)i = -1;
			else i = 1;
		}
		long long int box = 0;
		asg.Add(w[0] + N, 1, false);
		for (int i = 1; i < N; i++) {
			w[i] += w[i - 1];
			asg.Add(w[i] + N, 1, false);
		}
		asg.TopDown();
		int bef = 0;
		for (int i = 0; i < N; i++) {
			box += asg.Sum(N + bef, 2 * N);
			bef = w[i];
			asg.Add(bef + N, -1, true);
		}
		if ((N*(N + 1) / 2 + 1) / 2 <= box) {
			L = mid;
		}
		else {
			R = mid;
		}
	}
	cout << L << endl;
	return 0;
}

Measured memory_bytes: 11292
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

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

  ll N, M;
  cin >> N >> M;

  ll a = max(N, M);
  ll b = min(N, M);
  ll ans = 1;

  if (a - b >= 2) {
    cout << 0 << endl; // impossible
    return 0;
  }
  else if (a - b == 1) {
    bool putFromA = true;
    while (a > 0) {
      if (putFromA) {
        ans = (ans * a) % mod;
        a--;
      }
      else {
        ans = (ans * b) % mod;
        b--;
      }
      putFromA = !putFromA;
    }
  }
  else {
    bool putFromA = true;
    while (b > 0) {
      if (putFromA) {
        ans = (ans * a) % mod;
        a--;
      }
      else {
        ans = (ans * b) % mod;
        b--;
      }
      putFromA = !putFromA;
    }
    ans = (ans * 2) % mod;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
"""
    正解数　A,B
    正の整数　Z：A,Bも割り切る
    出力：Zの内K番目に大きいもの
"""

a, b, k = map(int, input().split())
i = 1
z = []

while i <= 100:
    if (a % i == 0 and b % i == 0):
        z.append(i)
    i += 1
    
print(z[-k])  

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int state=0;
inline int val(int pos)
{
	return state & (1 << (pos-1));
}

int main()
{
	int N, M,map[14][14],p[14];
	memset(map, 0, sizeof(map));
	cin >> N >> M;
	int MAXS = (1 << N) ;
	int k;
	for (int i = 0; i < M; ++i)
	{
		cin >> k;
		for (int j = 0; j < k; ++j)cin >> map[i][j];
	}
	for (int i = 0; i < M; ++i)cin >> p[i];
	int ans = 0;
	for (; state < MAXS; ++state)
	{
		bool flag = true;
		for (int i = 0; i < M; ++i)
		{
			int num = 0;
			for (int j = 0; map[i][j] != 0; ++j)num = num + (val(map[i][j]) ? 1 : 0);
			if (num % 2 != p[i]) { flag = false; break; }
		}
		if (flag)++ans;
	}
	cout << ans;

	system("pause");
	return 0;
}

Measured memory_bytes: 504