akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<set>
#include<cmath>
#include<vector>
#include<algorithm>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
const int maxn = 1e3+5;
int w[maxn], v[maxn], dp[maxn];

int main(){
	int n, m; cin >> n >> m;
	int ans = n / m + (n % m ? 1 : 0);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define MAX(a,b) (a>b?a:b)
using namespace std;

int main(){
  int R, G;
  cin >> R >> G;
  int ans = 2*G - R;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
	long long a,b;
	cin>>a>>b;
	if (a==1 || b==1)
	{
		cout<<1<<endl;
		return 0;
	}
	if ((a*b)%2==0)
	{
		cout<<(a*b)/2<<endl;
	}
	else
	{
		cout<<(a*b)/2+1<<endl;
	}
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = "x";
		
		for(int i = 0; i < S.length() - 1; i++){
			T += "x";
		}
		
		System.out.println(T);
	}
}


Measured memory_bytes: 22100
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int res[100];

int main() {
	int p,q;
	while(cin>>p>>q){
		memset(res,0,sizeof(res));
		p*=10;
		int i=0;
		int k=0;
		while(p){
			for(k=0;k<i;k++){
				if(res[k]==p)goto end;
			}
			res[i++]=p;
			cout<<p/q;
			p-=p/q*q;
			p*=10;
		}
		end:;
		cout<<endl;
		int j;
		if(p){
			for(j=0;j<i;j++){
				if(j>=k)cout<<"^";
				else cout<<" ";
			}
			cout<<endl;
		}
	}
	return 0;
}

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

using ull = unsigned long long;
using ll = long long;

#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 pb push_back
#define fill(x, y) memset(x, y, sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define IN1(x) ll x; cin >> x;
#define OUT1(x) cout << x << endl;

// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int) (lower_bound(s, t, x) - s)
#define UB(s, t, x) (int) (upper_bound(s, t, x) - s)

ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1) ans = 1ll * ans * a % mo; a = 1ll * a * a % mo; } while (b >>= 1); return ans; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll temp = gcd(a, b); return temp ? (a / temp * b) : 0; }
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx8[] = { 1, -1, 0, 0, 1, 1, -1, -1 }, dy8[] = { 0, 0, -1, 1, -1, 1, -1, 1 };

template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) { return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...)); }
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }
// auto dp = make_v<int>(4, h, w);
// fill_v(dp, 0);

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

template <typename T>
vector<T> pows(int n) {
	vector<T> ret;
	T x = 1;
	while (ret.size() < n) {
		ret.push_back(x);
		x *= 10;
	}
	return ret;
}

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; }

inline tuple<ll, ll> rotate45(tuple<ll, ll> point) { ll x = get<0>(point), y = get<1>(point); return tuple<ll, ll>(x + y, x - y); }
inline bool rangeCheck2D(int nx, int ny, int Width, int Height) { return nx >= 0 and nx < Width and ny >= 0 and ny < Height; }

template <typename T>
void out(T o) { cout << o << endl; }
template <typename T>
void out(vector<T> &out) { REP(i, (int)out.size()) { cout << out[i]; if (i == (int)out.size() - 1) cout << endl; else cout << " "; } }



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

	ll x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
	ll x3 = x2 - (y2 - y1);
	ll y3 = y2 + x2 - x1;
	ll x4 = x3 - (y3 - y2);
	ll y4 = y3 + x3 - x2;
	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    if(N/1000 == 0) cout << "ABC" << endl;
    else cout << "ABD" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int A,B,MAX,a,b,c;
    scanf("%d %d",&A,&B);
    a=A+B;b=A-B;c=A*B;
    if(a>b)
        {
            if(a>c)
                MAX=a;
            else
                MAX=c;
        }
     else
     {
         if(b>c)
            MAX=b;
         else
            MAX=c;
     }
    printf("%d",MAX);
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
    int a,b,c,r;
    scanf("%d %d",&a,&b);
    if((a-2*b)>0){
        c=a-2*b;
    }
    else{
        c=0;
    }
    printf("%d\n",c);
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
  int N, M;
  cin >> N >> M;
  pair<int, int> v[200000];

  int a, b;
  for (int i = 0; i < M; i++) {
    cin >> a >> b;
    v[i] = make_pair(b, a);
  }

  sort(v, v + M);

  int c = 0, l = 0;
  for (int i = 0; i < M; i++) {
    if (l <= v[i].second) {
      l = v[i].first;
      c++;
    }
  }

  cout << c << endl;
  return 0;
}


Measured memory_bytes: 1920
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int result = 0;
        for (int i = 0; i < S.length(); i++) {
            if (S.charAt(i) == '+') {
                result = result + 1;
            }else if(S.charAt(i) == '-'){
                result = result - 1;
            }
        }
        System.out.println(result);
    }

}


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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

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

const int maxn = 310;

int n;
int cnt[4];
double d[maxn][maxn][maxn];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        ++cnt[a];
    }
    d[0][0][0] = 0;
    for (int a = 0; a <= n; ++a) {
        for (int b = 0; b <= n; ++b) {
            for (int c = 0; c <= n; ++c) {
                if (a+b+c == 0) continue;
                d[a][b][c] = n;
                if (a) d[a][b][c] += d[a-1][b+1][c] * a;
                if (b) d[a][b][c] += d[a][b-1][c+1] * b;
                if (c) d[a][b][c] += d[a][b][c-1]   * c;
                d[a][b][c] /= double(a+b+c);
            }
        }
    }
    cout << fixed << setprecision(15);
    cout << d[cnt[3]][cnt[2]][cnt[1]] << endl;
}


Measured memory_bytes: 227584
N,M = gets.strip.split.map(&:to_i)

if N>=2 then
  if M>=2 then
    a = (1..N).to_a
    b = (1..M).to_a
    puts (a.combination(2).to_a.count+b.combination(2).to_a.count)
  else
    a = (1..N).to_a
    puts (a.combination(2).to_a.count)
  end
else
  if M>=2 then
    b = (1..M).to_a
    puts (b.combination(2).to_a.count)
  else
    puts 0
  end
end

Measured memory_bytes: 14420
#include<iostream>
#include<iomanip>
#include<algorithm>
using namespace std;
int main(){
    int N;
    cin>>N;
    double a[100];
    double sum=0;
   for(int i=0; i<N; i++){
       cin>>a[i];
   }
   sort(a,a+N);
   
     for(int j=0; j<N; j++){
      sum=sum+a[N-1]/a[j]; 
     }
     
     cout<<fixed<<setprecision(12)<<(1/sum)*a[N-1];
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

void solve_abc_c() {
	ll n;
	ll ans = 1;

	cin >> n;

	V t(n);
	rep(i, n) {
		cin >> t[i];
		ans = lcm(ans, t[i]);
	}

	cout << ans << "\n";
}

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

	solve_abc_c();

	return 0;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int,string>> sub(m);
    rep(i,m) cin >> sub[i].first >> sub[i].second;

    int ac = 0, pena = 0;
    map<int,int> mp;
    rep(i,m) {
        int p = sub[i].first;
        string s = sub[i].second;
        if(mp[p] == -1) continue;
        if(s == "WA"){
            mp[p]++;
        } else {
            ac++;
            pena += mp[p];
            mp[p] = -1;
        }
    }
    cout << ac << " " << pena << endl;
}

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

using namespace std;

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


Measured memory_bytes: 256
import java.util.Scanner;

//Sharing Cookies
public class Main {
	private static Scanner sc;

	public static void main(String[] args) {
		sc = new Scanner (System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = a + b;
		if((a%3) * (b%3) * (c%3) == 0)
			System.out.printf("Possible");
		else System.out.printf("Impossible");
	}
}

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

int n, a[100009], D,  c;

int main() {
	cin >> n;
	cin >> D >> c;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		for (int j = 1; j <= D; j += a[i]) c++;
	}
	cout << c << endl;
	return 0;
}

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

int main()
{
  int x,a,b;
  cin >> x>>a>>b;

  int eatafter = b-a;
  if(eatafter<=0) cout << "delicious" << endl;
  else if(eatafter<=x) cout << "safe" << endl;
  else cout << "dangerous" << endl;
}


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

int main(){
  int N;
  cin>>N;
  set<int> s;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    s.insert(a);
  }
  int M=s.size();
  if(N==M){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}

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

using namespace std;

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

#define PI (2*acos(0.0))
#define eps 1e-9
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC() ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL);

const int N = 1e5+10;
vi arr(N);

int main()
{
    int i = 0, j = 0, cs = 0, in;
    speed;
    int n; cin>>n;
    vi v(n);
    ll sum = 0;
    for(i = 0; i < n; i++){
        cin>>v[i];
        arr[ v[i] ]++;
        sum += v[i];
    }
    int q; cin>>q;
    while(q--){
        int a, b; cin>>a>>b;
        sum -= 1LL*arr[a]*a;
        sum += 1LL*arr[a]*b;
        arr[b] += arr[a];
        arr[a] = 0;
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3948
#include <iostream>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;

int main(void)
{
	string s, t; cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());
	if (s < t)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int main(){
	int a,b,c,count = 0;
	scanf("%d %d %d",&a,&b,&c);
	for(int i = a; i <= b; i++){
		if(c%i == 0) count++;
	}
	printf("%d\n",count);
}



Measured memory_bytes: 2740
#include<bits/stdc++.h>
typedef long long ll;
#define db double
#define ui unsigned int
#define ll long long
#define ull unsiged ll
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define per(i,r,l)for(int i=r;i>=l;i--)
#define pb push_back
#define pp pop_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1e9+7
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define inf  INT_MAX
#define lnf LLONG_MAX
#define mii map<int,int>
#define mll map<ll,ll>
#define mil map<int,ll>
#define umii unordered_map<int,int>
#define umll unordered_map<ll,ll>
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define boots ios::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
using namespace std;
const int MX = 1e6 + 7;
ll modulo(ll num, ll MOD = mod) { return ((num%MOD) + MOD) % MOD; }
ll power(ll b, ll e, ll MOD = mod) { ll ans = 1; while (e) { if (e % 2) ans = (ans*b) % MOD; b = (b*b) % MOD; e /= 2; } return ans; }
ll inv(ll num, ll MOD = mod) { return power(modulo(num), MOD - 2, MOD); } ll gcd(ll a, ll b) { return ((b == 0) ? a : gcd(b, a%b)); }
int top;
ll pri[MX];
int ji[MX];
void prime()
{
    for(int i=2;i<MX;i++)
    {
        if(!ji[i])
        pri[++top]=i;
        for(int j=2;j*i<MX;j++)
        {
            ji[j*i]=1;
        }
    }
}
int main()
{
    boots;
    prime();
    ll a,b;
    cin>>a>>b;
    ll sum=1;
    ll ans=max(a,b);
    ll ant=sqrt(ans);
    for(int i=1;pri[i]<=ant;i++)
    {
        if(!a||!b)break;
        if(a%pri[i]==0&&b%pri[i]==0)
        {
            sum++;
        }
        if(a%pri[i]==0)
        {
            while(a%pri[i]==0)
            {
                a/=pri[i];
            }
        }
        if(b%pri[i]==0)
        {
            while(b%pri[i]==0)
            {
                b/=pri[i];
            }
        }
    }
    if(a>1&&b>1&&a==b)sum++;
    cout<<sum<<endl;
}


Measured memory_bytes: 6400
import java.util.*;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), p = sc.nextInt();
		String s = sc.next();
		sc.close();
		long ans = 0;
		if (p == 2 || p == 5) {
			for (int i = 0; i < n; ++i) {
				int tmp = (int) (s.charAt(i) - '0');
				if (tmp % p == 0)
					ans += (long) (i + 1);
			}
		} else {
			Map<Integer, Long> modlist = new HashMap<Integer, Long>();
			long val = 0;
			int m = 1, mode10 = 10 % p;
			for (int i = n - 1; i >= 0; --i) {
				int tmp = (int) (s.charAt(i) - '0');
				tmp %= p;
				tmp *= m;
				tmp %= p;
				val += (long)tmp;
				val %= (long)p;
				int key = (int)val;
				long value = 1;
				if (modlist.containsKey(key))
					value += modlist.get(key);
				modlist.put(key, value);
				ans += (key == 0 ? value : value - 1);
				m *= mode10;
				m %= p;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 37008
N,M = map(int,input().split())
A = [list(input().split()) for _ in range(M)]
C = {str(i):0 for i in range(1,N+1)}
for i in range(M):
    p,s = A[i]
    if s=="AC":
        C[p] = 1
D = {str(i):0 for i in range(1,N+1)}
cnt = 0
for i in range(M):
    p,s = A[i]
    if s=="WA":
        if C[p]==1 and D[p]==0:
            cnt += 1
    else:
        D[p] = 1
ac = 0
for i in range(1,N+1):
    if C[str(i)]==1:
        ac += 1
print(ac,cnt)

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

ll f(ll h) {
  if (h == 1) return 1;
  return f(h/2)*2+1;
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  ll h;
  cin >> h;
  cout << f(h) << endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Hassan El Desouky
 */


#include "bits/stdc++.h"

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define el '\n'
#define F first
#define S second
#define M_PI 3.14159265358979323846  /* pi */
#define FOR(i,a,b) for(int i = a; i <= b; ++i)
#define FORD(i,a,b) for(int i = a; i >= b; --i)
#define RI(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(n)-1)
#define SQR(x) (x)*(x)
#define all(v)  	((v).begin()),((v).end())
#define degreesToRadians(angleDegrees) (angleDegrees * M_PI / 180.0) // Converts degrees to radians.
#define radiansToDegrees(angleRadians) (angleRadians * 180.0 / M_PI) // Converts radians to degrees.
#define ordered_set1 tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef long double ld;
typedef vector<int>		vi;
typedef vector<int>		vll;
typedef vector<pii>		vpii;
const double EPS = 1e-9;
const int N = 1e3+2, M = 3e5+5, OO = 0x3f3f3f3f;
int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; // 4 Direction
//int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1}; // 8 Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction


class ANovember30 {
public:
	void solve(std::istream& in, std::ostream& out) {
        int m1, d1, m2, d2; in >> m1 >> d1 >> m2 >> d2;
        if (m1 != m2) out << 1 << el;
        else out << 0 << el;
	}
};


int main() {
	ANovember30 solver;
	std::cout << std::fixed;
	ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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


int findcost(int n,vector<int> h){
    int dp[n+1];

   dp[1] = 0;
   dp[2] = abs(h[2]-h[1]);
   dp[3] = abs(h[3]-h[1]);

    for(int j=4;j<=n;j++){
        dp[j] = min(dp[j-1]+abs(h[j-1]-h[j]),dp[j-2]+abs(h[j-2]-h[j]));
    }
    return dp[n];
}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<int> h(n+1);
    for(int i=1;i<=n;i++)
        cin>>h[i];

    if(n == 1){
        cout<<0<<endl;
        return 0;
    }
    if(n == 2){
        cout<<abs(h[2]-h[1])<<endl;
        return 0;
    }
    cout<<findcost(n,h)<<endl;


    return 0;
}

Measured memory_bytes: 1408
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    ab <- replicateM n $ do
        [a,b] <- getIntList
        return (a,b)
    print $ foldr solve 0 ab

solve (a,b) k = k + ((b - ((a+k) `mod` b)) `mod` b)

Measured memory_bytes: 39548
#include<stdio.h>

int g[50];

int fib(int n, int g[]){

    if(n == 1 || n == 0)
        return 1;
    else if(n >= 2)
        return g[n - 1] + g[n - 2];

}

int main()
{
    int i, n;

    scanf("%d", &n);

    g[0] = 1;
    g[1] = 1;

    for(i = 2; i < 50; i++)
        g[i] = g[i - 1] + g[i - 2];  

    printf("%d\n", fib(n, g));

    return 0;
}


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

#define maxn 100002
#define FOR(i, l, r) for (int i=l; i<=r; ++i)
#define FORD(i, r, l) for (int i=r; i>=l; --i)
#define REP(i, r) for (int i=0; i<(int)r; ++i)
#define REPD(i, r) for (int i=(int)r-1; i>=0; --i)
#define fi first
#define se second
#define mk make_pair
#define nil NULL
#define y0 y902
#define y1 y232
#define x0 x92
#define x1 x899
#define next asdfa
#define sz size
#define Debug(X) {cerr << #X << " = " << X << '\n';}
#define PR(A, n) {cerr << #A << " = "; FOR(i, 1, n) cerr << A[i] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; REP(i, n) cerr << A[i] << ' '; cerr << '\n';}
typedef long long ll;
typedef double db;
typedef pair<db, db> dd;
typedef pair<int, int> ii;
typedef vector<int> vi;
const int inf = 1e9;
template<class T> int getbit(T x, int pos) {return (x>>(pos-1)) & 1;}
template<class T> void turn_on(T &x, int pos) {x = x | ((T)1<<(pos-1));}
template<class T> void turn_off(T &x, int pos) {x = x & ~((T)1<<(pos-1));}
template<class T> T sqr(T a) {return a*a;}

struct edge {
    int u, v, w;
    edge () {}
    edge(int a, int b, int c) {
        u = a; v = b; w = c;
    }
};
struct point {
    int x, y, id;
} a[maxn];
int n, lab[maxn];
ll res;
vector<edge> e;

bool cmp1(point a, point b) {return a.x<b.x;}
bool cmp2(point a, point b) {return a.y<b.y;}
bool cmp3(edge a, edge b) {return a.w<b.w;}

int findset(int u) {return lab[u]<=0 ? u : lab[u]=findset(lab[u]);}
void uni(int s, int t) {
    if (lab[s]<lab[t]) lab[t] = s;
    else if (lab[s]>lab[t]) lab[s] = t;
    else {lab[t] = s; lab[s]--;}
}

void process(edge e) {
    int s = findset(e.u), t = findset(e.v);
    if (s==t) return;
    uni(s, t);
    res += (ll)e.w;
}

int main() {
    //freopen("build.inp", "r", stdin);
    //freopen("", "w", stdout);
    //ios::sync_with_stdio(0); cin.tie(0);
    scanf("%d", &n);
    FOR(i, 1, n) {
        scanf("%d%d", &a[i].x, &a[i].y);
        a[i].id = i;
    }
    sort(a+1, a+n+1, cmp1);
    FOR(i, 1, n-1) {
        e.push_back(edge(a[i].id, a[i+1].id, a[i+1].x-a[i].x));
    }
    sort(a+1, a+n+1, cmp2);
    FOR(i, 1, n-1) {
        e.push_back(edge(a[i].id, a[i+1].id, a[i+1].y-a[i].y));
    }
    sort(e.begin(), e.end(), cmp3);
    REP(i, e.sz())
        process(e[i]);
    printf("%I64d", res);
}



Measured memory_bytes: 5876
import sys
input = sys.stdin.readline

def main():
    N,K = map(int, input().split())
    A = list(map(int, input().split()))
    
    l,r = 0, max(A)
    while l < r-1:
        mid = (l+r)//2
        cnt = 0
        for a in A:
            if a % mid:
                cnt+= a//mid
            else:
                cnt += a//mid - 1
            
        if cnt <= K:
            r = mid
        else:
            l = mid
    print(r)
    
main()

Measured memory_bytes: 31088
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    long long n;
    cin >> n;
    vector<long long>a(n);
    rep(i,n)cin >> a[i];
    long long step = 0;
    long long ans = 0;
    rep2(i,1,n){
        if(a[i-1]+step>a[i]){
            step = a[i-1]+step - a[i];
        }
        else step = 0;
        ans += step;
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 4744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF=1e18,MOD=1e9+7;
int main(){
	string s;
	cin>>s;
	if(s=="A")cout<<"T"<<endl;
	else if(s=="T")cout<<"A"<<endl;
	else if(s=="G")cout<<"C"<<endl;
	else cout<<"G"<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
const int inf=1e18;
int32_t main(){
    if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0),cin.tie(0);
    int n,m;
    cin >> n >> m;
    int a[n],sum=0;
    for(int i=0;i<n;i++){
    	cin >> a[i];
    	sum+=a[i];
    }
    sort(a,a+n);
    reverse(a,a+n);
    int fl=1;
    for(int i=0;i<m;i++){
    	if(a[i]*4*m<sum){
    		fl=0;
    		break;
    	}
    }
    if(fl)cout << "Yes";
    else cout << "No";
}

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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] num = Console.ReadLine().Split(' ').Select(tmp => long.Parse(tmp)).ToArray();
            long[] value = Console.ReadLine().Split(' ').Select(tmp => long.Parse(tmp)).ToArray();
            long sum = 0;
            Array.Sort(value);
            for (int i = 0; i < num[1]; i++)
            {
                sum += value[i];
            }
            Console.WriteLine(sum);

        }
    }
}


Measured memory_bytes: 28600
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


SIZE = 3001
MID = 1500


N = int(input())
table = [None]*SIZE

for _ in range(N):
    for i in range(SIZE):
        table[i] = '@'

    input_str = input()

    table[MID] = input_str[0]
    loc = 0

    for i in range(1,len(input_str)-2,3):
        if input_str[i] == '-': #右へ
            loc += 1
            table[MID+loc] = input_str[i+2]
        else: #左へ
            loc -= 1
            table[MID+loc] = input_str[i+2]

    for i in range(SIZE):
        if table[i] == '@':
            continue
        print("%s"%(table[i]),end="")
    print()



Measured memory_bytes: 13744
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef double keytype;

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int main(){
    ll a, b, k;

    scanf("%lld %lld %lld", &a, &b, &k);

    if(a >= k){
        a = a - k;
    }else{
        if(b >= (k - a)){
            b = b - (k - a);
            a = 0;
        }else{
            b = 0;
            a = 0;
        }

    }

    printf("%lld %lld\n", a, b);

    return 0;
}


Measured memory_bytes: 1736
// atcoder/abc051/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int k, s;
  while (cin >> k >> s) {
    int cnt = 0;
    for (int x = 0; x <= k; ++x) {
      for (int y = 0; y <= k; ++y) {
        int z = s - x - y;
        if (0 <= z && z <= k) {
          ++cnt;
        }
      }
    }
    cout << cnt << endl;
  }

  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	M := 0
	A := 0
	R := 0
	C := 0
	H := 0
	var N int

	fmt.Scan(&N)

	for i := 0; i < N; i++ {
		var name string
		fmt.Scan(&name)
		if name[0] == 'M' {
			M++
		}
		if name[0] == 'A' {
			A++
		}
		if name[0] == 'R' {
			R++
		}
		if name[0] == 'C' {
			C++
		}
		if name[0] == 'H' {
			H++
		}
	}
	ans := M*A*R + M*A*C + M*A*H + M*R*C + M*R*H + M*C*H +
		A*R*C + A*R*H + A*C*H +
		R*C*H
	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
int dp[100002],n,k,a[100002];
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=k;i++){
        for(int j=1;j<=n;j++){
            if((a[j]<=i)&&(dp[i-a[j]]==0)){
                dp[i]=1;
                break;
            }
        }

    }
    if(dp[k]==1){
        cout<<"First";
    }
    else
        cout<<"Second";
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int n,k;
    cin>>k;
    cin>>s;
    n=s.size();
    if(k>=n)
        cout<<s<<endl;
    else
    {
        for(int i=0;i<k;i++)
        {
            cout<<s[i];
        }
        cout<<"..."<<endl;
    }
}


Measured memory_bytes: 3620
import java.util.*;
public class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int a = sc.nextInt();
      int[] x = new int[n];
      int[] l = new int[n];
      int g = 0;
      for(int i = 0;i < n;i++){
        x[i]=sc.nextInt();
        l[i]=Math.abs(a-x[i]);
        g = gcd(l[i],g);
      }
      System.out.println(g);
    }
    public static int lcm(int x, int y){
      return x*y/gcd(x,y);
    }
    public static int gcd(int x, int y){
      if(x < y)return gcd(y,x);
      if(y==0)return x;
      return gcd(y,x%y);
    }
}

Measured memory_bytes: 50432
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 234567;
int A[MAXN];

int main() {
    int N, K;
    scanf("%d %d", &N, &K);
    for (int i = 1; i <= N; i++) {
        int tmp;
        scanf("%d", &tmp);
        A[i] = ((tmp + A[i - 1]) % K);
    }
    LL ans = 0;
    map<int, int> mp;
    for (int i = N; i >= 0; i--) {
        int idx = (i % K);
        if (i + K <= N) {
           int tmp = (A[i + K] - ((idx + K) % K) + K) % K;
           mp[tmp]--;
        }
        int cur = (A[i] - idx + K) % K;
        ans += mp[cur];
        mp[cur]++;
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 10368
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 200000
#define MO 1000000007
#define INF 0x3FFFFFFF
using namespace std;
struct node
{
	int X,V,id;
	node(){};
	node(int _X,int _V):X(_X),V(_V){};
}nd[MAXN+5];
bool cmp1(const node &a,const node &b){return a.X<b.X;}
bool cmp2(const node &a,const node &b){return a.V<b.V;}
int L[MAXN+5],R[MAXN+5];
int dp[MAXN+5];
int main()
{
//	freopen("red.in","r",stdin);
//	freopen("red.out","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d %d",&nd[i].X,&nd[i].V);
	sort(nd+1,nd+1+n,cmp2);
	for(int i=1;i<=n;i++)
		nd[i].id=i;
	sort(nd+1,nd+1+n,cmp1);
	int mx=-1,mn=INF;
	for(int i=1;i<=n;i++)
	{
		mx=max(mx,nd[i].id);
		R[i]=mx;
	}
	for(int i=n;i>=1;i--)
	{
		mn=min(mn,nd[i].id);
		L[i]=mn;
	}
	int pos=0,sum=1;
	dp[0]=1;
	for(int i=1;i<=n;i++)
	{
		while(R[pos]<L[i]-1)
			sum=((1LL*sum-1LL*dp[pos])%MO+MO)%MO,pos++;
		dp[i]=sum;
		sum=(1LL*dp[i]+1LL*sum)%MO;
	}
	int ans=0;
	for(int i=1;i<=n;i++)
		if(R[i]>=n)
			ans=(1LL*ans+1LL*dp[i])%MO;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4864
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <tuple>
#include <cinttypes>
#include <cinttypes>

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;

i32 n, m;
i64 memo[1000][1000];
std::tuple<i64, i64, i64> C[1000], in[1000];
constexpr i64 INF_L = -100100100100100100ll;

i64 dp(i32 i, i32 j) {
  if (j == m) return 0;
  if (i == n) return INF_L + 1;
  if (memo[i][j] != INF_L) return memo[i][j];
  i64 x, y, z;
  std::tie(x, y, z) = C[i];

  return memo[i][j] = std::max(dp(i + 1, j + 1) + x + y + z, dp(i + 1, j));
}

int main() {
  std::cin >> n >> m;
  for (i32 i = 0; i < n; ++i) {
    i64 x, y, z;
    std::cin >> x >> y >> z;
    in[i] = std::make_tuple(x, y, z);
  }

  i64 res = INF_L;
  for (i32 s = 0; s < (1 << 3); ++s) {
    std::fill_n(memo[0], 1000 * 1000, INF_L);
    for (i32 i = 0; i < n; ++i) {
      i64 x, y, z;
      std::tie(x, y, z) = in[i];
      x *= s & 1 ? -1 : 1;
      y *= (s >> 1) & 1 ? -1 : 1;
      z *= (s >> 2) & 1 ? -1 : 1;
      C[i] = std::make_tuple(x, y, z);
    }
    res = std::max(res, dp(0, 0));
  }
  std::cout << res << std::endl;
}


Measured memory_bytes: 8696
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

ans = dict()

if n == 1:
    print(1)
    exit()

for i in range(n):
    for j in range(n):
        if (i == j):
            continue
        p = xy[j][0] - xy[i][0]
        q = xy[j][1] - xy[i][1]
        if ans.get((p, q)) == None:
            ans[(p, q)] = 1
        else:
            ans[(p, q)] += 1
# print(ans)
print(n-max(ans.values()))

Measured memory_bytes: 3444
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

length, N=two_int()

S=one_str()

ac_list = [0]

hoge = 0
for i in range(length-1):
    if S[i:i+2]=="AC":
        hoge += 1
    ac_list.append(hoge)

for i in range(N):
    l, r = two_int()
    print(ac_list[r-1] - ac_list[l-1])

Measured memory_bytes: 53068
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>
#include<type_traits>

using namespace std;
using ll = long long;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;
constexpr ll LONGINF = 1050000000000000000;


int main() {

	int h, w; cin >> h >> w;

	vector<vector<int>> c(10, vector<int>(10, 0));

	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> c[i][j];
		}
	}

	for (int i = 0; i < 10; i++) {//なんとかフロイド法だっけ？
		for (int j = 0; j < 10; j++) {
			for (int k = 0; k < 10; k++) {
				if (c[j][k] > c[j][i] + c[i][k]) {
					c[j][k] = c[j][i] + c[i][k];
				}
			}
		}
	}

	int ans = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			int x; cin >> x;
			if (x == -1) {

			}
			else {
				ans += c[x][1];
			}
		}
	}

	cout << ans << endl;



	return 0;
}

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

#define int int64_t
int nCr(int n, int r) {
    long ans = 1;
    if (n == 1||n==0) {
        return 0;
    }
    for (int i = n; i > n - r; --i) {
        ans = ans * i;
    }
    for (int i = 1; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}


signed main() {
    int N;
    int A[200000] = { 0 };
    int memo[200000] = { 0 };
    int memo_2[200000] = { 0 };
    int max = 0;
    int zen = 0;
    int same = 0;

    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        memo_2[A[i]]++;
        if (max < A[i]) {
            max = A[i];
        }
    }
    for (int i = 1; i < max + 1; i++) {
        zen += nCr(memo_2[i], 2);
    }
    for (int i = 1; i < max + 1; i++) {
      //  cout << i<<"    "<<memo_2[i] << endl;
    }
    
    for (int i = 0; i < N; i++) {
        if (memo[A[i]] !=0) {
            cout << memo[A[i]] << endl;
        }
        else {
             memo[A[i]] = zen - (nCr(memo_2[A[i]],2)-nCr(memo_2[A[i]]-1,2));
             cout << memo[A[i]] << endl;
        }
    }
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb emplace_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
    string s;
    cin>>s;
    int l=s.size();
    l--;
    if(s[l]!='s') s=s+'s';
    else s=s+"es";
    cout<<s;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define oo int(1e9)
using namespace std;
int n;

int main() {
	cin.tie(0); ios::sync_with_stdio(0); cout.tie(0);
	cin >> n;
	vector<int> h(n);
	for (int i = 0; i < n; i++) cin >> h[i];
	vector<int> dp(n);
	for (int i = 1; i < n; i++) dp[i] = oo;
	for (int i = 0; i < n; i++)
	    if (dp[i] < oo){
	        if (i + 1 < n) dp[i + 1] = min(dp[i + 1],dp[i] + abs(h[i] - h[i + 1]));
	        if (i + 2 < n) dp[i + 2] = min(dp[i + 2],dp[i] + abs(h[i] - h[i + 2]));
	    }
	cout << dp[n - 1];    
	return 0;
}

Measured memory_bytes: 1024
def solve(N, As):
    As = [1 if a % 2 == 1 else 2 for a in As]
    if all(a == 2 for a in As):
        return "second"
    else:
        return "first"


if __name__ == "__main__":
    N = int(input())
    As = [int(input()) for _ in range(N)]
    print(solve(N, As))

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

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

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

int main()
{
    int m1, m2, d1, d2;
    cin >> m1 >> d1;
    cin >> m2 >> d2;
    cout << m2 - m1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k, t;
    cin >> k >> t;
    vector<int> a(t);
    int mx = 0, id = 0;
    rep(i,t){
        cin >> a[i];
        if(mx < a[i]){
            id = i;
            mx = a[i];
        }
    }
    int rest = k - mx;
    int ans = 0;
    if(mx > rest+1){
        mx -= rest;
        ans = mx - 1;
    }
    cout << ans << endl;
	return 0;
}

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

using namespace std;

void doc()
{
    freopen("solve.inp","r",stdin);
    freopen("solve.out","w",stdout);
}

void solve() {
    vector <string> S;
    S.push_back("Sunny");
    S.push_back("Cloudy");
    S.push_back("Rainy");
    string s;
    cin >> s;
    for (int i = 0; i < 3; i++) {
        if (s == S[i]) {
            cout << S[(i + 1) % 3];
        }
    }
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    //doc();
    solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
typedef pair<ll,ll> cp2;
typedef pair<ll,cp2> cp3;
#define fi first
#define se second
#define sec se.fi
#define thr se.se
const ll mod = 1000000007;
//              123456789

int p[105];

int main(){
	int n, x, y, z;
	
	cin >> n;
	
	cin >> x;
	
	REP(i,x){
		int a;
		
		cin >> a;
		
		p[a]--;
	}
	
	cin >> y;
	
	REP(i,y){
		int b;
		
		cin >> b;
		
		p[b]++;
	}
	
	cin >> z;
	
	REP(i,z){
		int c;
		
		cin >> c;
		
		p[c] += 2;
	}
	
	int cnt = 0;
	
	REP(i,n+1){
		if (p[i] >= 2) cnt++;
	}
	
	cout << cnt << endl;
	
	return 0;
}

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

#define NAME "rewind"
#define show(x) cout << (#x) << " is " << (x) << endl
#define ll long long
#define ms(arr,val) memset(arr,val,sizeof(arr))
#define len length()

const int maxn = 1e5;
const int mod = 1e9+7;
int a[101];
ll dp[101][maxn+1];
ll tmp[maxn+1];
int main(){
    //ifstream cin(NAME".inp");
    //ofstream cout(NAME".out");
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>a[i];

    dp[0][k]=1;

    for(int i=1;i<=n;i++){

        for(int j=0;j<=k;j++){
            int L = max(0, j-a[i] );
            tmp[L] = ( tmp[ L ] + dp[i-1][j] )%mod;
            if (j+1<=k) tmp[j+1] = ( tmp[j+1] - dp[i-1][j]+ mod)%mod;
        }

        ll presum = 0;
        for(int j=0;j<=k;j++){
            presum = (presum + tmp[j])%mod;
            dp[i][j] = presum;
        }
        //for(int j=0;j<=k;j++) cout<<dp[i][j]<<" ";
        //cout<<endl;
        ms(tmp,0);
    }
    cout<<dp[n][0];
}


Measured memory_bytes: 82512
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main() {

	int N,K;
	string S;

	cin >> N >> K;
	cin >> S;

	if (S[K-1] == 'A')
		S[K-1] = 'a';
	if (S[K-1] == 'B')
		S[K-1] = 'b';
	if (S[K-1] == 'C')
		S[K-1] = 'c';
	

	cout << S << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222



ll a[MAX];


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



  cin >> n;
  rep(i, n) cin >> a[i];
  rep(i, n - 1) {
    ll sum1 = 0, sum2 = 0;
    rep(j, i + 1) sum1 += a[j];
    FOR(j, i + 1, n) sum2 += a[j];
    mi = min(mi, abs(sum1 - sum2));
  }
  cout << mi << endl;




  return 0;
}

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

int main()
{
    char a, b;
    scanf("%c %c", &a, &b);
    if (a == 'H')
    {
        printf("%c\n", b);
    }
    else
    {
        if (b == 'H')
        {
            printf("D\n");
        }
        else
        {
            printf("H\n");
        }
    }
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = N/100;
        int b = (N/10)%10;
        int c = N%10;
        if(a == 7 || b == 7 || c == 7){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} 

Measured memory_bytes: 35816