akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

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


int main(){
  string s;
  cin >> s;
  cout<<(regex_match(s,regex("(dream|dreamer|erase|eraser)*"))?"YES":"NO")<<endl;
  return 0;
}


Measured memory_bytes: 39808
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    string s;
    cin>>s;
    int cnt=0,ans=0;
    rep(i,s.size()){
        if(cnt>0){
            if(s[i]=='g') --cnt,++ans;
            else --cnt;
        }
        else {
            if(s[i]=='g') ++cnt;
            else ++cnt,--ans;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
using System;
using static System.Console;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] S = ReadLine().ToCharArray();
            int ans = 0;
            for (int i = 0; i < 4; i++)
            {
                if (S[i] == '+')
                {
                    ans += 1;
                }
                else
                {
                    ans -= 1;
                }
            }
            WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;


int main(){
int A,B,K;
cin >> A >> B >> K ;
if(B - A + 1 < 2*K){
    for(int i = A; i <= B; i++){
        cout << i <<  endl;
    }
}


else{
for(int i = A; i < A + K;  i++){
    cout << i <<  endl;
}

for(int i = B - K + 1; i <= B; i++){
    cout << i <<  endl;
}
}
}


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

int main()
{
  int l;

  cin >> l;

  double ans = 0;

  ans = (double)l/3;

  cout << fixed << setprecision(9) << ans*ans*ans;
  
}


Measured memory_bytes: 3756
#include<bits/stdc++.h>
#define rep(i,start,lim) for(lld i=start;i<lim;i++)
#define repd(i,start,lim) for(lld i=start;i>=lim;i--)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define br printf("\n")
#define sz(a) lld((a).size())
#define YES printf("Yes\n")
#define NO printf("No\n")
#define all(c) (c).begin(),(c).end()
using namespace std;
#define INF         1011111111
#define LLINF       1000111000111000111LL
#define EPS         (double)1e-10
#define MOD         1000000007
#define PI          3.14159265358979323
using namespace std;
typedef long double ldb;
typedef long long lld;
lld powm(lld base,lld exp,lld mod=MOD) {lld ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
typedef vector<lld> vlld;
typedef pair<lld,lld> plld;
typedef map<lld,lld> mlld;
typedef set<lld> slld;
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl '\n'
#define N 505
#define fre freopen("1.in","r",stdin); freopen("1.out","w",stdout);
lld c[N],s[N],f[N];
int main()
{
  sync;
  lld n;
  cin>>n;
  rep(i,1,n) cin>>c[i]>>s[i]>>f[i];
  rep(i,1,n+1) {
    lld curr = 0;
    rep(j,i,n) {
      if(curr<s[j]) curr=s[j];
      if((curr%f[j]) != 0) {
        curr = ((curr/f[j])+1) * f[j];
      }
      curr+=c[j];
    }
    cout<<curr<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include <limits.h>
#include<stdlib.h>
#include<string.h>

int main() {
	int n, x, t;
	scanf("%d %d %d", &n, &x, &t);

	if (n % x != 0) {
		printf("%d\n", (n / x + 1) * t);
	}
	else {
		printf("%d\n", (n / x ) * t);
	}

	return 0;
}

Measured memory_bytes: 1712
x = int(input())
isPrime = False


def isP(num):
    for i in range(2, num):
        if num % i == 0:
            return False
    return True


isPrime = isP(x)

if isPrime:
    print(x)
else:
    while isPrime == False:
        x += 1
        isPrime = isP(x)
    print(x)


Measured memory_bytes: 38768
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

const int M = 1000000007;

signed main(){
	int n;
	string s;
	cin >> n >> s;

	vector<int> num(26, 0);
	for(auto i : s){
		num[i - 'a']++;
	}

	vector<int> a, b;
	rep(s,1 << 13){
		int sum = 1;
		rep(j,13){
			if((s >> j) bitand 1){
				(sum *= num[j]) %= M;
			}
		}
		a.emplace_back(sum);
	}

	rep(s,1 << 13){
		int sum = 1;
		rep(j,13){
			if((s >> j) bitand 1){
				(sum *= num[j + 13]) %= M;
			}
		}
		b.emplace_back(sum);
	}

	int ans = 0;
	int b_sum = 0;
	rep(i,b.size()){
		(b_sum += b[i]) %= M;
	}
	rep(i,a.size()){
		(ans += a[i] * b_sum % M) %= M;
	}

	cout << ans - 1 << endl;
}


Measured memory_bytes: 640
#define FASTIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//#define BZ
//#define PBDS
//#define POINT

#ifndef BZ
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("no-stack-protector")
#pragma GCC target ("tune=native")
//#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize ("conserve-stack")
//#pragma GCC optimize ("no-stack-limit")
#endif

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using str = string;
using pll = pair<ll, ll>;

#ifdef POINT
using point = complex<ll>;
#define x real
#define y imag
#endif

#ifdef PBDS
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
//using namespace __gnu_pbds::detail;
template <class T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#endif

#define INF 0x7fffffffffffffffLL
#define BASE 1000000007LL // 3 * 10**9 + 19 // 998244353 - rev == pow(n + m, BASE - 2)
#define MAX(type) std::numeric_limits<type>::max()
#define MIN(type) std::numeric_limits<type>::min()

#define LOG(v) cout << #v << " " << v << "\n";

#define pb push_back
#define eb emplace_back
//#define all(c) c.begin(), c.end()
//#define rall(c) c.rbegin(), c.rend()
#define F first
#define S second
#define forEach(c) for (auto &it : c)
#define loop while (true)
#define mp make_pair
#define mt make_tuple

template<class T>
void chMax(T &a, T b) {
	if (a < b) a = b;
}

template<class T>
void chMin(T &a, T b) {
	if (b < a) a = b;
}

inline ll divUp(ll a, ll b) {
	return (a + b - 1)/b;
}

#define PI (acos(-1))

void solve() {
	ld a, b, x;
	cin >> a >> b >> x;
	ld d = ld(x * 2) / b / a;
	cout.precision(16);
	if (d <= a) {
		cout << ld(90) - (atan2(d, b) * 180 / PI) << "\n";
	} else {
		x -= a * a * b / 2;
		ld d = ld(x * 2) / a / a;
		// assert(d <= b);
		cout << atan2(b - d, a) * 180 / PI << "\n";
	}
}

//#define LOCAL

int main() {
	FASTIO
#ifdef LOCAL
	auto start = std::chrono::system_clock::now();
#endif
	solve();
#ifdef LOCAL
	auto end = std::chrono::system_clock::now();
	std::chrono::duration<ld> elapsed_seconds = end - start;
	cerr << "\ntime: " << elapsed_seconds.count() << " s\n";
#endif
	return 0;
}


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

int main(){
    string s,t;
    cin>>s>>t;
    ll ns=s.size(),nt=t.size(),ans=1000;
    rep(i,ns-nt+1){
        ll cnt=0;
        rep(j,nt){
            if(s[i+j]!=t[j]) cnt++;
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <stdlib.h>
#include <utility>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <vector>
#include <stdio.h>
#define   FOR(i,n) for(int i=0;i<n;i++)

using namespace std;
int int_sort(const void*a,const void *b) {
	return *(  int *) b - *(int *) a;
	//qsort(b, a, sizeof(long long int), int_sort);
}

int main() {
	int a,b;
	char s[10000]={};
	vector<int>A(1000000,0);
	cin>>s;
	s[3]='8';

		cout<<s;
		return 0;



}


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

int main() {
  //input
  int K, X;
  cin >> K >> X;
  //calc
  string answer = 500 * K >= X ? "Yes" : "No";
  //output
  cout << answer << endl;
}

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

int main(){
  int N;cin>>N;
  int V[N],C[N],A[N];
  for(int i=0;i<N;i++) cin>>V[i];
  for(int i=0;i<N;i++) cin>>C[i];
  for(int i=0;i<N;i++) A[i]=V[i]-C[i];
  sort(A,A+N);
  reverse(A,A+N);
  int ans=0;
  for(int i=0;i<N;i++){
    if(A[i]>0) ans+=A[i];
    else break;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3580
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>

using namespace std;
typedef long long ll;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    ll t = 0;
    ll r = 0;
    for (int i = 0; i < n;) {
        ll a = 0;
        ll b = 0;
        for (; i < n && s[i] == '>'; i++) {
            a++;
        }
        for (; i < n && s[i] == '<'; i++) {
            b++;
        }
        t += max(r, a) + a*(a-1)/2 + b*(b-1)/2;
        r = b;
    }
    t += r;
    cout << t << endl;
}


Measured memory_bytes: 900
/**
 *    DP
 *    26.04.2020 14:25
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  double h;
  cin >> N;
  vector<double> dp (N + 1, 0.0);
  /*
    dp[i] = probability of having i heads (so far)
    dp[5] at 8 coins = dp[4] at 7 coins * 8th head + 
                       dp[5] at 7 coins * 8th tail
  */
  
  dp[0] = 1; // p(0 heads) always 1 at 0 coins
  for (int i = 1; i <= N; i++) {
    cin >> h;
    for (int j = i; j >= 0; j--) {
      if (j == 0) dp[j] = dp[j] * (1 - h);
      else dp[j] = dp[j - 1] * h + dp[j] * (1 - h);
    }
  }
  double ans = 0;
  for (int i = N/2 + 1; i <= N; i++) {
    ans += dp[i];
  }
  cout << setprecision(15) << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()

if n % 2 != 0:
    print('No')
else:
    ans = True
    for i in range(int(n/2)):
        if s[i] != s[i + int(n/2)]:
            print('No')
            ans = False
            break
    if ans:
        print('Yes')

Measured memory_bytes: 38436
# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]

def ncr(n, r, p=MOD):
    a = 1
    b = 1
    for i in range(r):
        a = (a * (n - i) % p)
        b = (b * (r - i) % p)

    return a * pow(b, p - 2, p) % p

N, M = LI()

print(ncr(N,2) + ncr(M,2))


Measured memory_bytes: 38564
#include<iostream>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<queue>
#include<string.h>
#include<map>
#include<set>
#include<algorithm>
#define ll long long
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)
#define rep(i,a,b) for(int i = a;i < b;i++)
#define N 300004
#define INF 1e9+7

using namespace std;

ll n,k,ar[N];
bool dp[N];

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

    cin >> n >> k;

    rep(i,0,n)
    {
        cin >> ar[i];
    }

    rep(i,1,k+1)
    {
        rep(j,0,n)
        {
            if(i-ar[j]<0)
                break;

            if(!dp[i-ar[j]])
            {
                dp[i]=true;
                break;
            }
        }
    }

    if(dp[k])
        cout << "First\n";
    else
        cout << "Second\n";

    return 0;
}



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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			long n = cin.Long();
			long x = cin.Long();
			long[] a = new long[n];
			for (int i = 0; i < n; i++) {
				long temp = cin.Long();
				a[i] = Math.Abs(temp - x);
			}

			long ans = GCD(a);
			Console.WriteLine(ans);
		}

		public static long GCD(long[] values)
		{
			if (values.Length == 1) {
				return values[0];
			}

			long gcd = values[0];
			for (int i = 1; i < values.Length; ++i) {
				if (gcd == 1) {
					return gcd;
				}
				gcd = GCD(values[i], gcd);
			}

			return gcd;
		}

		public static long GCD(long a, long b)
		{
			if (a > b) {
				if (b == 0) {
					return a;
				}

				return GCD(b, a % b);
			} else {
				if (a == 0) {
					return b;
				}

				return GCD(a, b % a);
			}
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;

		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 18784
#include <bits/stdc++.h>
#define rep(it,beg,end) for(__typeof(beg) it=beg,a=end;it!=a;it+=(beg<=a?1:-1))
using namespace std;
#define ll long long
#define pb emplace_back
#define mp make_pair
inline void read(ll &n) {
	char c;n=0;ll x=1;
	while (!isdigit(c=fgetc(stdin))&&c!='-');
	if (c=='-') x=-1, c=fgetc(stdin);
	while (isdigit(c)) n=n*10+c-'0',c=fgetc(stdin);
	n*=x;
}
inline void read(int &n) {ll x;read(x);n=x;}
template <typename T1,typename T2>
inline void read(T1 &a,T2 &b) {read(a);read(b);}
template <typename T1,typename T2,typename T3>
inline void read(T1 &a,T2 &b,T3 &c) {read(a);read(b);read(c);}
template <typename T1,typename T2,typename T3,typename T4>
inline void read(T1 &a,T2 &b,T3 &c,T4 &d) {read(a);read(b);read(c);read(d);}
// -------------------- Standard Template --------------------
map<int,int> cnt;
int n,arr[100005];
int main() {
	read(n);
	rep(i,0,n) read(arr[i]);
	rep(i,0,n) {
		cnt[arr[i]]++;
		cnt[arr[i]+1]++;
		cnt[arr[i]-1]++;
	}
	int mx=1;
	for(auto a:cnt) {
		mx=max(mx,a.second);
	}
	printf("%d\n",mx);
	return 0;
}


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

using namespace std;
int x;
int main()
{
    cin >> x;
  	for(int i = 1; i <= 9; i++)
    for(int j = 1; j <= 9; j++)
      	if(i*j==x)
          	return cout << "Yes",0;
 	cout << "No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
inline int read(){
	register int x=0;
	register bool f=0;
	register char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-') f=1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<3)+(x<<1)+c-48;
		c=getchar();
	}
	return f?-x:x;
}
char cr[200],str[200];int tt;
inline void print(int x,char k='\n') {
    if(!x) putchar('0');
    if(x < 0) putchar('-'),x=-x;
    while(x) cr[++tt]=x%10+'0',x/=10;
    while(tt) putchar(cr[tt--]);
    putchar(k);
}
char mp[105][105];
int h,w,f[105][105][205];
int m[105][105];
signed main(){
	h=read();w=read();
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			mp[i][j]=getchar();
			while(mp[i][j]!='#'&&mp[i][j]!='.') mp[i][j]=getchar();
			if(mp[i][j]=='.') m[i][j]=0;
			else m[i][j]=1;
		}
	}
	memset(f,63,sizeof(f));
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(i==1&&j==1){
				if(m[i][j]==0) f[i][j][0]=0,f[i][j][1]=999999999;
				else f[i][j][0]=999999999,f[i][j][1]=1;
				continue;
			}
			for(int k=0;k<=200;k++){
				if(m[i][j]==0){
					if(k&1) continue;
					f[i][j][k]=min(f[i-1][j][k],f[i][j-1][k]);
					f[i][j][k]=min(f[i][j][k],f[i-1][j][k-1]+1);
					f[i][j][k]=min(f[i][j][k],f[i][j-1][k-1]+1);
					f[i][j][k]=min(f[i][j][k],f[i-1][j][k+1]);
					f[i][j][k]=min(f[i][j][k],f[i][j-1][k+1]);
				}
				else{
					if(k%2==0) continue;
					f[i][j][k]=min(f[i-1][j][k],f[i][j-1][k]);
					f[i][j][k]=min(f[i][j][k],f[i-1][j][k-1]+1);
					f[i][j][k]=min(f[i][j][k],f[i][j-1][k-1]+1);
					f[i][j][k]=min(f[i][j][k],f[i-1][j][k+1]);
					f[i][j][k]=min(f[i][j][k],f[i][j-1][k+1]);
				}
			}
		}
	}
	int ans=999999999;
	for(int i=0;i<=200;i++){
		if(i%2==m[h][w]) ans=min(ans,f[h][w][i]);
	}
	print(ans);
	return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

/*vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, k, m, r;
string s;


// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n>> m;
	cout<<(n + m -1)/m;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  string S;
  cin>>S;
  vector<int>W(N,0);
  if(S.at(0)=='W'){
    W[0]=1;
  }
  for(int i=1;i<N;i++){
    if(S.at(i)=='W'){
      W[i]=W[i-1]+1;
    }
    else{
      W[i]=W[i-1];
    }
  }
  vector<int>Ans(N);
  Ans[0]=N-1-(W[N-1]-W[0]);
  for(int i=1;i<N;i++){
    Ans[i]=W[i-1]+N-i-1-(W[N-1]-W[i]);
  }
  sort(Ans.begin(),Ans.end());
  cout<<Ans[0]<<endl;
}
    


Measured memory_bytes: 3076
#include <bits/stdc++.h>
#include<stdint.h>
using namespace std;
#define vi vector<int>
#define pb push_back
#define w(t)   int t;cin>>t;while(t--)
#define show(ar) for(int i=0;i<ar.size();i++) cout<<ar[i]<<" "; cout<<endl;
#define mod 1e9+7
#define ff first
#define ss second
#define fio ios::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL);
#define all(x) (x.begin(),x.end())
#define inf 1e9+7
#define MAX 90000000
#define ll long long
/*ll prime[MAX];

void sieve()
{
    prime[0] = prime[1] = 1;
    for (ll i = 2; i < MAX; i++) {
        if (prime[i] == 0) {
            for (int j = i * 2; j < MAX; j += i) {
                if (prime[j] == 0) {
                    prime[j] = i;
                }
            }
            prime[i] = i;
        }
    }
}
*/

 //check for boundary cases like n<=1
// use bool array instead of int array
// remember binary search
// overflow limit
// try to use prefix and suffix array
vi inp(int n)
{
	vi v; int x;
	for(int i=0;i<n;i++) {
		cin>>x; v.pb(x);
	}
	return v;
}


int main()
{
	fio
	//sieve();
	int n,k; cin>>k;
	string s; cin>>s;
	if(s.size()<=k) cout<<s<<endl;
	else{
		for(int i=0;i<k;i++) cout<<s[i];
		cout<<"...\n";
	}
	return 0;
}


Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public List<int> Update(IReadOnlyList<int> A)
        {
            var B = Enumerable.Repeat(0, A.Count).ToList();
            foreach (var i in Enumerable.Range(0, A.Count))
            {
                var l = Math.Max(0, i - A[i]);
                B[l]++;

                var r = Math.Min(A.Count - 1, i + A[i]);
                if (r + 1 < A.Count)
                {
                    B[r + 1]--;
                }
            }

            var sum = 0;
            return Enumerable.Range(0, A.Count).Select(i => sum += B[i]).ToList();
        }

        public void Solve()
        {
            var items = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToList();
            var N = items[0];
            var K = items[1];
            var A = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToList();

            Enumerable.Range(0, Math.Min(100, K)).ToList().ForEach(_ => A = this.Update(A));
            Console.WriteLine(string.Join(" ", A));
        }
    }
}


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

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 ll INF = 1LL << 60;

//---main---------------------------------------------
int main(){
    //main
    int N, Amax = 1000005;
    cin >> N;
    int A[N];
    int dp[Amax];
    rep(i,Amax) dp[i] = 0;

    rep(i,N){
        cin >> A[i];
        //if( dp[Ai] != false)
        if(dp[A[i]] == 0){
            ll x = A[i];
            while(x<=Amax){
                dp[x]++;
                x += A[i];
            }
        }
        else dp[A[i]] = 2;
    }

    int ans = 0;
    rep(i,N) if(dp[A[i]]==1) ans++;
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 8252
from math import floor
def main():
    A, B = map(int, input().split())
    minX = -1
    fB = (B*10 // 10) * 10
    bXCands = [fB+i for i  in range(10)]
    for aXcand in bXCands:
        if int(aXcand * 0.08) == A:
            minX = aXcand
            break
    print(minX)



    # minX = -1
    # aX = int(A * 100 / 8)
    # if int(aX * 0.1) == B:
    #     minX = aX

    # bX = int(B * 100 / 10)
    # if int(bX * 0.08) == A:
    #     if minX == -1:
    #         minX = bX
    #     else:
    #         minX = min(aX, bX)
    # print(minX)
    

main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> list(n, 0);
  for (int i = 0; i < q; i++) {
    int x;
    cin >> x;
    list.at(x - 1)++;
  }
  for (int i = 0; i < n; i++) {
    if (list.at(i) <= q - k) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

struct UnionFind {
    vector<int> d;
    UnionFind(int n): d(n, -1) {}
    int root(int x) {
        if (d[x] < 0) return x;
        return d[x] = root(d[x]);
    }
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int size(int x) { return -d[root(x)]; }
};

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    int fri[n] = {}, bro[n] = {};
    for (int i = 0, a, b; i < m; i++) {
        cin >> a >> b;
        a--; b--;
        uf.unite(a, b);
        fri[a]++; fri[b]++;
    }
    for (int i = 0, c, d; i < k; i++) {
        cin >> c >> d;
        c--; d--;
        if (uf.same(c, d)) {
            bro[c]++; bro[d]++;
        }
    }
    for (int i = 0; i < n; i++) {
        if (i > 0) cout << ' ';
        cout << uf.size(i) - 1 - fri[i] - bro[i];
    }
    cout << endl;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    cin >> n;

    vector<pair<int, int> > student;
    for (int i = 1; i <= n; i++) {
        int num;
        cin >> num;
        student.push_back(make_pair(num, i));
    }

    sort(student.begin(), student.end());
    for (auto pr : student) {
        cout << pr.second << " ";
    }
    cout << endl;
}

Measured memory_bytes: 1780
#include <stdio.h>
#include <math.h>
int main(){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(x-r >= 0 && x+r<=W && y+r<=H && y-r >= 0){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
	vector<int>x,y,d;
	static int zx[1000000+2],zy[1000000+2],zd[1000000+2],p[50][6],n,k,sea[102][102][102];
	long long int ans=0,a;
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++){
		for(int j=0;j<6;j++){
			scanf("%d",&p[i][j]);
		}
		x.push_back(p[i][0]);
		x.push_back(p[i][3]);
		y.push_back(p[i][1]);
		y.push_back(p[i][4]);
		d.push_back(p[i][2]);
		d.push_back(p[i][5]);
	}
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	sort(d.begin(),d.end());
	int N=2*n;
	for(int i=0;i<N;i++){
		zx[x[i]]=i;
		zy[y[i]]=i;
		zd[d[i]]=i;
	}
	for(int i=0;i<N+1;i++){
		for(int j=0;j<N+1;j++){
			for(int l=0;l<N+1;l++){
				sea[i][j][l]=0;
			}
		}
	}
	
	for(int i=0;i<n;i++){
		sea[zx[p[i][0]]][zy[p[i][1]]][zd[p[i][2]]]++;
		sea[zx[p[i][0]]][zy[p[i][1]]][zd[p[i][5]]]--;
		sea[zx[p[i][0]]][zy[p[i][4]]][zd[p[i][2]]]--;
		sea[zx[p[i][0]]][zy[p[i][4]]][zd[p[i][5]]]++;
		sea[zx[p[i][3]]][zy[p[i][1]]][zd[p[i][2]]]--;
		sea[zx[p[i][3]]][zy[p[i][1]]][zd[p[i][5]]]++;
		sea[zx[p[i][3]]][zy[p[i][4]]][zd[p[i][2]]]++;
		sea[zx[p[i][3]]][zy[p[i][4]]][zd[p[i][5]]]--;
	}
	for(int i=1;i<N+1;i++){
		for(int j=0;j<N+1;j++){
			for(int l=0;l<N+1;l++){
				sea[i][j][l]+=sea[i-1][j][l];
			}
		}
	}
	for(int i=0;i<N+1;i++){
		for(int j=1;j<N+1;j++){
			for(int l=0;l<N+1;l++){
				sea[i][j][l]+=sea[i][j-1][l];
			}
		}
	}
	for(int i=0;i<N+1;i++){
		for(int j=0;j<N+1;j++){
			for(int l=0;l<N+1;l++){
				if(l!=0)sea[i][j][l]+=sea[i][j][l-1];
				if(sea[i][j][l]>=k){
					a=1;
					a*=x[i+1]-x[i];
					a*=y[j+1]-y[j];
					a*=d[l+1]-d[l];
					ans+=a;
				}
			}
		}
	}
	printf("%lld\n",ans);
}

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

int N,M,a,b;
queue<pair<int,int >> Q; //first-distance, second-index id
int dist[200001];
vector<int> G[200001]; //adjacency matrix


int main(){
  
  cin >> N >> M;
  for (int i=0;i<M;i++){
    cin >> a >> b;
    G[a].push_back(b);G[b].push_back(a);
  }
  memset(dist,-1, sizeof(dist)); //only works for 0 and -1
  int Source = 1;
  Q.push(make_pair(0,Source)); //Root has a distance of zero
  //BFS Algorithm
  while (!Q.empty()){
    int d = Q.front().first, u = Q.front().second;//u is the index id
    Q.pop();
    if (dist[u] != -1) continue;
    dist[u] = d;
    for (int i=0; i< G[u].size();i++){ //accessing the adjancency matrix
      Q.push(make_pair(d+1, G[u][i]));
    }
  }
  if (dist[N] == 2){
    cout << "POSSIBLE";
  }
  else{
    cout << "IMPOSSIBLE";
  }
    
  return 0;
}

Measured memory_bytes: 14192
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){

    int n, m;
    cin >> n >> m;
    
    vector<pair<int , string>> data;
    
    for(int i=0; i<m; i++) {
        pair<int, string> temp;
        cin >> temp.first >> temp.second;
        data.push_back(temp);
    }
    
    vector<bool> isAC(n+1, false);
    vector<int> wa_count(n+1, 0);
    
    
    int num_ac = 0;
    int num_wa = 0;
    for(int i=0; i<m; i++) {
        if(data[i].second == "WA" && isAC[data[i].first] == false) {
            wa_count[data[i].first]++;
        }
        else if(data[i].second == "AC" && isAC[data[i].first] == false) {
            num_ac++;
            isAC[data[i].first] = true;
            num_wa += wa_count[data[i].first];
        }
    }

    cout << num_ac << " " << num_wa << endl;

    return 0;
}


Measured memory_bytes: 6896
n,s = map(int,input().split())
xmax = s // 10000
ymax = s // 5000
if(xmax > 2000):
    xmax=2000
if(ymax > 2000):
    ymax = 2000
isloop = True
for x in range(xmax+1):
    
    if(isloop==False):
        break
    xv = x*10000
    for y in range(ymax+1):
        
        if(isloop==False):
            break
        yv = y*5000
        xysum = xv+yv
        if(xysum > s):
            continue
        
        z = (s-(xysum))//1000
        if((x+z+y)==n):
            print(x,y,z)
            isloop=False
            break

if(isloop==True):
    print(-1,-1,-1)

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

signed main () {
    int n;
    cin >> n;
    string s;
    cin >> s;
    for (int mask = 0; mask < 4; ++mask) {
        vector < int > ans(n, -1);
        for (int i = 0; i < 2; ++i)
            ans[i] = int(bool(mask & (1 << i)));
        for (int i = 1; i < n - 1; ++i) {
            if (ans[i]) {
                if (s[i] == 'o')
                    ans[i + 1] = ans[i - 1];
                else 
                    ans[i + 1] = int(!bool(ans[i - 1]));
            }
            else {
                if (s[i] == 'o')
                    ans[i + 1] = int(!bool(ans[i - 1]));
                else 
                    ans[i + 1] = ans[i - 1];
            }
        }
        bool shit = 0;
        for (int i = 0; i < n; ++i) {
            if (ans[i]) {
                if (s[i] == 'o') 
                    shit = shit || (ans[(i - 1 + n) % n] != ans[(i + 1) % n]);
                else
                    shit = shit || (ans[(i - 1 + n) % n] == ans[(i + 1) % n]);
            }
            else {
                if (s[i] == 'o') 
                    shit = shit || (ans[(i - 1 + n) % n] == ans[(i + 1) % n]);
                else
                    shit = shit || (ans[(i - 1 + n) % n] != ans[(i + 1) % n]);
            }
        }
        if (!shit) {
            for (int i = 0; i < n; ++i) {
                if (ans[i])
                    cout << 'S';
                else
                    cout << 'W';
            }
            cout << '\n';
            return 0;
        }
    }
    cout << "-1\n";
}


Measured memory_bytes: 1016
n,k=map(int,input().split())
s=input()
a=s[k-1]
a=a.lower()
l=''
if k==1:
  l+=a
  l+=s[k:]
  print(l)
elif k<n:
  l+=s[:k-1]+a+s[k:]
  print(l)
else:
  l+=s[:k-1]+a
  print(l)

Measured memory_bytes: 3064
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: usize,
        c: u64,
        k: u64,
        mut t: [u64; n],
    }

    t.sort();
    let mut ans = 0;
    let mut humans = 0;
    let mut t_limit = t[0] + k;
    for i in 0..n {
        // 定員 or 待てないので出発
        if humans == c || t[i] > t_limit {
            ans += 1;
            humans = 0;
        }

        humans += 1;
        // 一人目: 出発時刻は限界まで待つ
        if humans == 1 {
            t_limit = t[i] + k;
        }

        // 最後は端数となり得る
        if i == n - 1 && humans > 0 {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4220
#include<iostream>
using namespace std;
bool check(int a)
{
	for(int i=2;i*i<=a;i++)
	{
		if(a%i==0) return false;
	}
	return true;
}
int main()
{
	int n,num=0;
	cin>>n;
	for(int i=3;num<n;i+=10)
	{
		if(check(i)==true){
		cout<<i<<" ";
		num++;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <cstring>
#include <cmath>
#include <queue>
#include <math.h>
#include <algorithm>

using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;

#define EPS (1e-7)
#define v_exists(elem, v) find(v.begin(),v.end(),elem)!=v.end()
#define s_exists(elem, s) s.find(elem)!=s.end()
#define tasu(x, y) (x+y)%MOD
#define kake(x, y) (x*y)%MOD

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

long lcm( long m, long n ){
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;

	return ((m / gcd(m, n)) * n);
}



// https://www.mk-mode.com/octopress/2012/08/08/08002014/
map<int,int> decompositPrime(long long n){
	map<int,int> ret;

    // 割る数の初期値
    int a = 2;
    // √n ≧ a ( n ≧ a * a ) の間ループ処理
    while (n >= a * a) {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0) {
            //printf("%d * ", a);
            ret[a]+=1;
            n /= a;
        } else {
            a++;
        }
    }
    // 最後に残った n は素因数
    //printf("%d\n", n);
    ret[n]+=1;
    return ret;
}

map<int, int>::iterator it;
map<int, int>::iterator it1;
map<int, int>::iterator it2;
map<int, int>::iterator it3;

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

	map<int, int> cnt;

	for(int i = 1; i<=n ; ++i){
		map<int, int> temp = decompositPrime(i);
		for ( it = temp.begin(); it != temp.end(); it++ ){
			cnt[it->first] += it->second;
		}
	}

	int mt4 = 0, mt2 = 0;
	for ( it = cnt.begin(); it != cnt.end(); it++ ){
		if(it->second >= 4){
			mt4++;
		} else if(it->second >= 2){
			mt2++;
		}
	}

	if(mt4 < 2 || mt2 < 1){
		cout << 0 << endl;
		return 0;
	}

	int ans = 0;
	for ( it1 = cnt.begin(); it1 != cnt.end(); it1++ ){
		for ( it2 = next(it1); it2 != cnt.end(); it2++ ){
			for ( it3 = next(it2); it3 != cnt.end(); it3++ ){

				if((it1->second >= 4 && it2->second >= 4 && it3->second >= 2)){
					ans += 1;
				}

				if((it1->second >= 2 && it2->second >= 4 && it3->second >= 4)){
					ans += 1;
				}

				if((it1->second >= 4 && it2->second >= 2 && it3->second >= 4)){
					ans += 1;
				}

			}
		}
	}

	for ( it1 = cnt.begin(); it1 != cnt.end(); it1++ ){
		for ( it2 = next(it1); it2 != cnt.end(); it2++ ){
			if((it1->second >= 24 && it2->second >= 2)){
				ans += 1;
			}

			if((it1->second >= 2 && it2->second >= 24)){
				ans += 1;
			}

			if((it1->second >= 14 && it2->second >= 4)){
				ans += 1;
			}

			if((it1->second >= 4 && it2->second >= 14)){
				ans +=1;
			}
		}
	}

	for ( it1 = cnt.begin(); it1 != cnt.end(); it1++ ){
		if(it1->second >= 74){
			ans += 1;
		}
	}

	cout << ans << endl;


}

Measured memory_bytes: 256
import java.io.*;

public class Main{

	static int first = 0;
	static int second = 0;
	static int third = 0;
	static int tmp = 0;
	
	public static void main(String[] args) {
         InputStreamReader isr = new InputStreamReader(System.in);
         BufferedReader br = new BufferedReader(isr);
         try{
        	 String buf = br.readLine();
        	 for(int i = 0; i <= 9; i++){
               	 tmp = Integer.parseInt(buf);
        	 	 if(first <= tmp){
        	 		 third = second;
        	 		 second = first;
        	 		 first = tmp;
        	 	 }else if(second <= tmp){
        	 		 third = second;
        	 		 second = tmp;
        	 	 }else if(third <= tmp){
        	 		 third = tmp;
        	 	 }
        	 	 buf = br.readLine();
        	 }    	 
         }catch(Exception e){
        	
         }        
         System.out.println(first+"\n"+second+"\n"+third);
	}
	
}

Measured memory_bytes: 24288
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N, P;
	cin >> N >> P;
	ll r = 2;
	ll ans = 1;
	while (r * r <= P) {
		ll cnt = 0;
		while (P % r == 0) {
			P /= r;
			cnt++;
		}
		REP(i, cnt / N) {
			ans *= r;
		}
		r++;
	}
	if (r < P) {
		if (N == 1)ans *= P;
	}
	cout << ans << endl;
	PAU;
	return 0;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n,m; cin >> n >> m;
  int ans = 1;
  for (int a=1; a*a <= m; a++) {
    if (m%a) continue;

    int b = m/a;
    if ((ll)a*n <= m) chmax(ans,a);
    if ((ll)b*n <= m) chmax(ans,b);
  }
  COUT(ans);
  return 0;
}

Measured memory_bytes: 3604
n = int(input())
a = list(map(int, input().split()))
count = 0
absl= []
for i in range(n):
  if a[i] < 0:
    count += 1
  absl.append(abs(a[i]))
if count % 2 == 0:
  print(sum(absl))
else:
  print(sum(absl) - 2 * min(absl))

Measured memory_bytes: 14412
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 100005;
const int mod = 1000000007;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  vector<ll>a;
  ll n;
  cin>>n;
  for(int i=2;i*(ll)i<=n;i++){
    if(n%i==0){
      a.push_back(i);
      if(n/i!=i){
        a.push_back(n/i);
      }
    }
  }
  a.push_back(n);
  ll ret = 0;
  for(int i=0;i<a.size();i++){
    ll cur = n;
    while(cur>=a[i]){
      if(cur%a[i]==0)cur/=a[i];
      else {
        cur%=a[i];
      }
    }
    if(cur==1)ret++;
  }
  vector<ll>b;
  for(int i=2;i*(ll)i<n;i++){
    if((n-1)%i==0){
      b.push_back(i);
      if((n-1)/i!=i){
        b.push_back((n-1)/i);
      }
    }
  }
  if(n-1>=2)b.push_back(n-1);
  unordered_set<ll>st;
  for(int i=0;i<a.size();i++)st.insert(a[i]);
  for(int i=0;i<b.size();i++)if(st.find(b[i])==st.end())ret++;
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
long long m=1e9+7;

long long modRecursive(long long a,long long b,long long c)
{
	if(b == 0) return 1;
	if(b%2 ==0) return modRecursive((a*a)%c,b/2,c);
	else return ((a%c)*(modRecursive((a*a)%c,b/2,c)))%c;
}

long long get(string s)
{
	stringstream geek(s);
    long long x = 0;
    geek >> x;
	return x;
}

long long total(long long x,string s)
{
	int last=0;
	long long ans=0;
	int n=s.size();
	for(int i=0; i<n; i++)
	{
		if (x&(1<<i))
		{
			ans+=get(s.substr(last,i-last+1));
			last=i+1;
		}
	}
	ans+=get(s.substr(last,n-last));
	return ans;
}

int main()
{
	string s;
	cin>>s;
	int n=s.size();
	long long ans=0;
	if(n==1) cout<<s<<endl;
	else
	{
		n--;
		for(long long i=0; i<=(1<<n)-1; i++)
		{
			long long x=total(i,s);
			ans+=x;
		}
		cout<<ans<<endl;
	}
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,W;
    cin>>N>>W;
    int arrW[N+1], arrV[N+1];
    int tot = 0;
    for(int i=1; i<=N; i++){
        cin>>arrW[i]>>arrV[i];
        tot += arrV[i];
    }
    long long dp[tot+1];
    for(int i=1;i<=tot;i++)
        dp[i]  = INT_MAX;
    dp[0] = 0;
    long long minVal = INT_MIN;
    for(int i=1;i<=N;i++){
        for(int j=tot; j>=arrV[i];j--){
            dp[j] = min(dp[j], dp[j-arrV[i]]+arrW[i]);
                
        }
    }
    for(long long i=0;i<=tot;i++){
        if(dp[i] <= W){
            minVal = max(minVal, i);
        }
    }
    cout<<minVal;
    return 0;
}

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll) 1e9 + 7;
constexpr long long MOD = 998244353LL;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


void solve(){
	ll n;
	cin>>n;
	vec<ll> a(n);
	REP(i,n) cin>>a[i];

	map<ll,ll> mp1,mp2;
	REP(i,n/2){
		mp1[a[2*i]]++;
		mp2[a[2*i+1]]++;
	}

	vec<P> v1,v2;
	for(auto i:mp1){
		v1.push_back({-i.second,i.first});
	}
	for(auto i:mp2){
		v2.push_back({-i.second,i.first});
	}
	v1.push_back({0,-1});
	v2.push_back({0,-1});

	sort(all(v1));
	sort(all(v2));

	if(v1[0].second==v2[0].second){
		cout<<min(n+v1[0].first+v2[1].first,n+v1[1].first+v2[0].first)<<en;
	}else{
		cout<<n+v1[0].first+v2[0].first<<en;
	}

}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
    //ll t;cin>>t;REP(i,t) solve();

    return 0;
}

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

int main() {
	int neko;
	int unk;
	int x;
	string s = "NO";
	cin >> neko >> unk >> x;
	for (int i = 0; i <= unk; i++) {
		if (x == i + neko) {
			s = "YES";
		}
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

template <typename T>
using vec = vector<T>;

template <typename T>
using vec2 = vector<vector<T>>;

template <typename T>
using vec3 = vector<vector<vector<T>>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

    int x, y;
    cin >> x >> y;

    bool ans = false;

    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            if (i + j == x && i * 2 + j * 4 == y) {
                ans = true;
                break;
            }
        }
    }

    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

int main() {
  int N, X, T;
  cin >> N >> X >> T;
  auto cdiv = [&](auto a, auto b) {
    return (a + b - 1) / b;
  };
  cout << cdiv(N, X) * T << "\n";
}

Measured memory_bytes: 3564
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(math.sqrt(n))+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors
def main():
    X = int(input())
    l = make_divisors(X)
    for i in l:
        if 360 % i == 0:
            return (360//i)
print(main())


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

int main() {
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    int n;
    cin>>n;
    double ans = 0.0;
    for(int i = 0;i < n;i++) {
        double x;
        string u;
        cin>>x>>u;
        if(u == "BTC") ans += x*380000.0;
        else ans += x;
    }
    printf("%.12lf\n", ans);
}

Measured memory_bytes: 256
import sys
from itertools import combinations
def input(): return sys.stdin.readline().strip()


def main():
    n = int(input())
    A = list(map(int, input().split()))
    ans = 0
    for a, b in combinations(A, 2):
        ans = max(ans, abs(a - b))
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 64680