akhauriyash/Code-Regression huggingface dataset:
//#pragma comment(linker, "/stack:200000000")
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set =
	tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define un(x) x.erase(unique(ALL(x)),x.end())
#define REP(i,x,v)for(int i=x;i<=v;i++)
#define REPD(i,x,v)for(int i=x;i>=v;i--)
#define FOR(i,v)for(int i=0;i<v;i++)
 
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int MOD=1e9+7;//998244353;


ll dp[120][4][2];

int poss(int n,int k) {

	ll wyn=1;
	FOR(i,k) wyn*=(n-i);
	FOR(i,k) wyn/=(i+1);
	FOR(i,k) wyn*=9;
		debug()<<imie(n)<<imie(k)<<imie(wyn);
	return wyn;
}


ll go(string s,int k) {
	debug()<<imie(s)<<imie(k);
	while(SZ(s) && s[0]=='0') s=s.substr(1);
	int n=SZ(s);
	ll wyn=0;
	if (k>0) {
		if (n==0) return 0;
		REP(c,1,9) {
			if (c<s[0]-'0') {
				wyn+=poss(n-1,k-1);
			}
			if (c==s[0]-'0') {
				wyn+=go(s.substr(1),k-1);
			}
		}
		wyn+=poss(n-1,k);
	}
	else wyn=1;
	
	debug()<<imie(s)<<imie(k)<<imie(wyn);
	return wyn;
}

	
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);
	cout << fixed << setprecision(11);
	cerr << fixed << setprecision(6);
	string s;cin>>s;
	int k;cin>>k;
	cout<<go(s,k)<<endl;


    return 0;
}










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

using namespace std;
typedef long long ll;

ll calcNumOfCombination(ll n, ll r) {
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}

int main() {
    int A, B;
    cin >> A >> B;
    int ans = -1;

    for (int i = 1; i < 1010; i++) {
        int tmpA = i * 8 / 100;
        int tmpB = i * 10 / 100;
        if (tmpA == A & tmpB == B) {
            ans = i;
            break;
        }
    }

    cout << ans << endl;


    return 0;
}

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

typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) (in).begin(),(in).end()
#define ALL(in,K) (in),(in)+(K)

#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a, b)*b; } //最小公倍数

ll input(){
  ll a;
  cin >> a;
  return a;
}

int main(){
  string s;
  cin >> s;
  REP(i,s.size()){
    cout << s.at(i);
    if(i==3)cout << " ";
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	int k = 1;
	while (k * (k + 1) / 2 < n) {
		++k;
	}

	int total = k * (k + 1) / 2;
	vector<int> ans;
	while (k) {
		if (total - k < n || total - k > n) {
			cout << k << "\n";
		} 

		--k;
	}

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <utility>
using namespace std;
#define fol(i,n) for (int i=0;i<n;i++)
 
int main(){
    int a;
    cin >>a;
cout << a*800-200*(a/15)<<endl;
return 0;
}

Measured memory_bytes: 256
#pow(a,b,mod)
#np.gcd.outer
#s.count, s.replace, s.index
from math import gcd
from functools import reduce
from itertools import product ##for i in z for j in z -> for i,j in product(z,z)   ||  for i,j in product(z,repeat=2)
#slice operation: sum(ans[slice(i*2,k+1,i)]) = sum(ans[i*2:k+1:i])
from collections import defaultdict #d=defaultdict(lambda:0)  d=defaultdict(list)
n=int(input())
s=input()
 
ret=0
 
for i,x in enumerate(s):
	for j,y in enumerate(s[i+1:],start=i+1):
		if x==y:
			continue
		if i+(j-i)*2 < n :
			z=s[i+(j-i)*2]
			if y!=z!=x:
				ret-=1
 
dic=defaultdict(lambda:0)
for x in s:
	if not x in dic: 
		dic[x]=0
	dic[x]+=1

f=dic.items()
for (i,x),(j,y),(k,z) in product(f,f,f):
	if i<j<k:
		ret+=x*y*z
print(ret)



Measured memory_bytes: 69360
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    string S;
    cin>>S;
    int ans=0;
    for(int i=0;i<S.size();i++){
        if(S[i]=='p'&&i%2==0)ans--;
        if(S[i]=='g'&&i%2==1)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"

using namespace std;


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

template <typename T>

void print(T x)
{
	std::cout << x <<"\n" ;
}


signed main(void) {
	int N;
	vector<int> A;
	cin >> N ;
	A.resize(N);

	rep(i, N) {
		cin >> A[i];
	}
	std::vector<int>::iterator maxIt = std::max_element(A.begin(), A.end());
	size_t maxIndex = distance(A.begin(), maxIt);

	sort(A.begin(), A.end(), std::greater<int>());

	rep(i, N) {
		if (i != maxIndex) print(A[0]);
		else print(A[1]);
	}
}

Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

typedef long long ll;
vector<vector<pair<int,ll> > >  g;
vector<int>dst;
void dfs(int i,int pre){
    for(auto x:g[i]){
        if(x.first!=pre){
            dst[x.first] = dst[i] + x.second;
            dfs(x.first,i);
        }
    }
}

int main(){
    int n;
    cin >> n;
    g.resize(n);
    dst.resize(n);
    for(int i=0;i<n-1;i++){
        int a,b,w;
        cin >> a >>b >> w;
        g[a].push_back(make_pair(b,w));
        g[b].push_back(make_pair(a,w));
    }
    dfs(0,-1);
    int mx = -1;
    int mxind;
    for(int i=0;i<n;i++){
        if(mx<dst[i]){
            mx = dst[i];
            mxind = i;
        }
    }    
    for(int i=0;i<n;i++){
        dst[i] = 0;
    }
    dfs(mxind,-1);
    mx = -1;
    for(int i=0;i<n;i++){
        if(mx<dst[i]){
            mx = dst[i];
            mxind = i;
        }
    }    
    cout << mx << endl;
    return 0;
}


Measured memory_bytes: 14820
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(n);
// string p=s.substr(0,len);
// string q=s.insert(0,str);
// sort(arr, arr+n, greater<int>());
// cout<<fixed<<setprecision(9)<<pi<<endl
// const  double pi = acos(-1.0);
// sort(v.rbegin(),v.rend());
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}


int main(void)
{
	fast();

	int n,x,t;
	
	cin>>n>>x>>t;

	ll ans = 0;
	
	while(n>0)
	{
		n=n-x;
		ans=ans+t;
	}	
	cout<<ans<<endl;
}

Measured memory_bytes: 3632
n,t = map(int, input().split( ))
a = list(map(int, input().split( )))
mn = 10**10
mx = 0
cnt_mn = 0#現在の買値の最小値
cnt_inf = 0#最大りえきの達成で買える町の数
cnt_sup = 0#現在の最大利益の達成で売れる町の数
for i in range(n):
    if a[i]<mn:
        mn = a[i]
        cnt_mn = 1
    elif a[i] == cnt_mn:
        cnt_mn += 1
    if mx < a[i] - mn:
        mx = a[i] - mn
        cnt_sup = 1
        cnt_inf = cnt_mn
    elif mx == a[i]-mn:
        cnt_sup += 1
        cnt_inf += cnt_mn

print(min(cnt_inf,cnt_sup))

Measured memory_bytes: 62704
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <numeric>
#include <queue>
#include <set>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

int main(int argc, char const *argv[])
{
  ll l, r;
  cin >> l >> r;
  set<ll> s;
  if (r - l >= 2019)
  {
    REP(i, 2019)
    {
      s.insert(i);
    }
  }
  else
  {
    for (ll i = l; i <= r; i++)
    {
      s.insert(i % 2019);
    }
  }
  vector<ll> sv;
  for (auto ss : s)
  {
    sv.push_back(ss);
  }
  ll res = 2019;
  for (ll i = 0; i < sv.size(); i++)
  {
    for (ll j = i + 1; j < sv.size(); j++)
    {
      res = min((sv[i] * sv[j]) % 2019, res);
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>

using namespace std;

struct Point {
	double x, y;
	Point() : x(0), y(0) { }
	Point(double x, double y) : x(x), y(y) { }
	Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); }
	Point operator-(const Point &p) const { return Point(x - p.x, y - p.y); }
	Point operator*(double s) const { return Point(x * s, y * s); }
	Point operator/(double s) const { return Point(x / s, y / s); }
	Point &operator+=(const Point &p){ x += p.x; y += p.y; return *this; }
	Point &operator-=(const Point &p){ x -= p.x; y -= p.y; return *this; }
	Point &operator*=(double s){ x *= s; y *= s; return *this; }
	Point &operator/=(double s){ x /= s; y /= s; return *this; }
	bool operator==(const Point &p) const { return x == p.x && y == p.y; }
	bool operator!=(const Point &p) const { return x != p.x || y != p.y; }
	bool operator<(const Point &p) const {
		return (x == p.x) ? (y < p.y) : (x < p.x);
	}
};
inline Point operator*(double s, const Point &p){ return p * s; }

inline double norm(const Point &p){ return p.x * p.x + p.y * p.y; }
inline double abs(const Point &p){ return sqrt(norm(p)); }
inline double arg(const Point &p){ return atan2(p.y, p.x); }
inline Point unit(const Point &p){ return p / abs(p); }
inline Point ortho(const Point &p){ return Point(-p.y, p.x); }
inline double cross(const Point &a, const Point &b){
	return a.x * b.y - a.y * b.x;
}
inline double dot(const Point &a, const Point &b){
	return a.x * b.x + a.y * b.y;
}

class Polygon {
private:
	vector<Point> m_points;
public:
	Polygon() : m_points() { }
	template <typename Iterator>
	Polygon(Iterator begin, Iterator end) : m_points(begin, end) { }
	const Point &operator[](int i) const {
		return m_points[i % m_points.size()];
	}
	Point &operator[](int i){ return m_points[i % m_points.size()]; }
	size_t size() const { return m_points.size(); }
};

inline double area(const Polygon &g){
	const int n = g.size();
	double sum = 0;
	for(int i = 0; i < n; ++i){ sum += cross(g[i], g[i + 1]); }
	return sum * 0.5;
}
inline int contains(const Polygon &g, const Point &p){
	const int n = g.size();
	int result = 0;
	for(int i = 0; i < n; ++i){
		Point a = g[i] - p, b = g[i + 1] - p;
		if(a.y > b.y){ swap(a, b); }
		if(a.y <= 0 && 0 < b.y && cross(a, b) < 0){ result = 1 - result; }
		if(cross(a, b) == 0 && dot(a, b) <= 0){ return -1; } // on line
	}
	return result;
}

int main(){
	ios_base::sync_with_stdio(false);
	cout << setiosflags(ios::fixed) << setprecision(1);
	int n;
	cin >> n;
	vector<Point> points(n);
	for(int i = 0; i < n; ++i){ cin >> points[i].x >> points[i].y; }
	const Polygon polygon(points.begin(), points.end());
	int q;
	cin >> q;
	while(q--){
		Point p;
		cin >> p.x >> p.y;
		const int c = contains(polygon, p);
		switch(c){
			case  0: cout << 0 << endl; break;
			case -1: cout << 1 << endl; break;
			case  1: cout << 2 << endl; break;
		}
	}
	return 0;
}

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

using namespace std;

template<class T>
using V = vector<T>;
template<class T>
using VV = V<V<T>>;

using ld = long double;
#define ll long long
using ull = unsigned ll;
using PLL = pair<ll, ll>;
using VLL = V<ll>;
using VB = V<bool>;
using VVB = VV<bool>;
using VVLL = VV<ll>;
using Gr = VVLL;
using MLL = map<ll, ll>;
#define UMLL unordered_map<ll, ll, custom_hash>
//typedef __int128 int128;
//typedef __float128 double128;

#define fast ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);

#define INF LLONG_MAX
#define MINF LLONG_MIN

#define R &
#define CR const R

#define FORI(i, a, b) for(ll i = a, max##i = b; i < max##i; ++i)
#define FOR(i, n) FORI(i, 0, n)
#define RFORI(i, a, b) for(ll i = a, min##i = b; i >= min##i; --i)
#define RFOR(i, n) RFORI(i, n, 0)
#define FORA(i, a) for(auto i : a)
#define FORAR(i, a) for(auto R i : a)
#define FORACR(i, a) for(auto CR i : a)
#define ALL(obj) begin(obj), end(obj)
#define Count(q) while(q--)
#define OK cerr << "OK\n";

#define mp make_pair
#define pb push_back

//#define DEBUG

template<class T>
T sqr(T x)
{
    return x * x;
}

void YES(bool g, ostream R os, bool upper = false)
{
    if(g)
        if(upper)
            os << "YES";
        else
            os << "Yes";
    else
        if(upper)
            os << "NO";
        else
            os << "No";

    os << "\n";
}

template<class T>
ll cast(T CR t)
{
    return static_cast<ll>(t);
}

template<class T>
void show(T CR t, ostream R os = cerr)
{
    FORACR(i, t)
        os << i << " ";
    os << "\n";
}

constexpr ll MOD = 1e9 + 7;
//constexpr ll len = 2 * ('z' - 'a' + 1);
//constexpr ld eps = 1e-9;

//constexpr ld unreal = -1e9;

constexpr ld PI = atanl(1.0L) * 4;

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

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

void solve(istream R is, ostream R os)
{
    ll n;
    is >> n;

    VLL a(n);
    FORAR(i, a)
        is >> i;

    ll sum = 0;
    FORACR(i, a)
        sum = (sum + i) % MOD;

    ll ans = 0;
    FORACR(i, a)
    {
        sum = (sum - i + MOD) % MOD;
        ans = (ans + i * sum) % MOD;
    }

    os << ans << "\n";
}

int main()
{
    fast
    ll q = 1;
    //cin >> q;
    cout << setprecision(999);
    Count(q)
        solve(cin, cout);
}


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

int sum_of_digits(int n) {
    int res = 0;
    while (n > 0) {
        res += n % 10;
        n /= 10;
    }
    return res;
}

int main() {
    int N, A, B;
    cin >> N >> A >> B;

    int res = 0;
    for (int i = 1; i <= N; i++) {
        int t = sum_of_digits(i);
        if (t >= A && t <= B) {
            res += i;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 764
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
const ll MOD = 1000000000000000001;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,x,ans=0,pre=0,tmp;
  cin>>n>>x;
  rep(i,n){
    ll a;
    cin>>a;
    tmp=max((ll)0,pre+a-x);
    ans+=tmp;
    pre=a-tmp;
  }
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		System.out.println((n - 1) * (m - 1));
	}

}


Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b, c, d;
	cin >> a;
	if (a == 2){
		cin >> b >> c;
		for (int i = 0; i < min(c,b); i++){
			if (b%(i+1) == 0 && c%(i+1) == 0){
				cout << i+1 << endl;
			}
		}
	}else
	if (a == 3) {
		cin >> b >> c >> d;
		for (int i = 1; i < min(b,min(c,d))+1; i++) {
			if (b%i == 0 && c%i == 0 && d%i == 0) {
				cout << i << endl;
			}
		}
	}
	cin >> c;
}

Measured memory_bytes: 3108
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	char str[1001] = {0};
	int i, Count = 0;
	cin >> str;
	int len = strlen(str);
	for(i = 0; i < (len+1)/2; i++){
		if(str[i]!=str[len-i-1]){
			Count++;
		}
	}
	cout << Count << endl;
	return 0;
} 

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<queue>
#include<vector>
#include<cstring>
#include<algorithm>
#include<stack>
#include<sstream>
#include<string>
using namespace std;
#define ll long long
#define N 1100
ll a[N],b[N],c[N];

priority_queue<ll>q;
bool cmp(ll a,ll b)
{
    return a>b;
}
int main()
{
    int x,y,z,k;
    scanf("%d%d%d%d",&x,&y,&z,&k);

    for(int i=1;i<=x;i++)
        scanf("%lld",&a[i]);
    for(int i=1;i<=y;i++)
        scanf("%lld",&b[i]);
    for(int i=1;i<=z;i++)
        scanf("%lld",&c[i]);

    sort(a+1,a+1+x,cmp);
    sort(b+1,b+1+y,cmp);
    sort(c+1,c+1+z,cmp);
    for(int i=1;i<=x;i++)
    {
        for(int j=1;j<=y;j++)
        {
            for(int o=1;o<=z;o++)
            {
                if(i*j*o<=k)
                    q.push(a[i]+b[j]+c[o]);
                else
                    break;
            }
        }
    }
    while(k--)
    {
        printf("%lld\n",q.top());
        q.pop();
    }
       return 0;
}


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

int main(){
  string a; int n; n=a.length();
  cin >>n >>a;

  if(n%2){cout <<"No"; return 0;}
  else{
    for(int i=0; i<n/2; i++)
    {
      if(a[i]!=a[n/2+i]){cout <<"No"; return 0;}
    }
  }
  cout <<"Yes";

return 0;
}

Measured memory_bytes: 256
/**
 *Code Author: codeknight13
 *Institution: IIT(ISM)
**/
 
#include <bits/stdc++.h>
using namespace std;

//remember-> largest 2d memory that can be allocated is dp[5100][5100];
#define ll int
#define v vector
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define str string
#define pq priority_queue
#define vi vector< ll >
#define vii vector< vi >
#define viii vector< vii >
#define pii pair< ll, ll >
#define vpii vector< pii >
#define len length()
#define pb push_back
#define mp make_pair3
#define ff first
#define ss second
#define nl cout <<  endl
#define all(ar) ar.begin(), ar.end()
#define ini(X,Y) ll X; X=Y
#define inx(X) ll X; cin >> X
#define inxy(X, Y) ll X, Y; cin >> X >> Y
#define iter(arr) for (ll i=0; i<arr.size(); i++)
#define ret return
#define cont continue
ll inf=1000000007;

ll min1(ll a, ll b, ll c)
{
	ret (max(a,max(b,c)));
}
int k;


int main()
{
	fast;
	int n;
	cin >> n;
	vii arr(n,vi(3));
	vii dp(n,vi(3,0));
	for (int i=0; i<n; i++)
	{
		for (int j=0; j<3; j++)
		{
			cin >> arr[i][j];
		}
	}
	for (int i=0; i<3; i++)
	{
		dp[0][i]=arr[0][i];
	}
	for (int i=1; i<n; i++)
	{
		dp[i][0]=arr[i][0]+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=arr[i][1]+max(dp[i-1][2],dp[i-1][0]);
		dp[i][2]=arr[i][2]+max(dp[i-1][0],dp[i-1][1]);
	}
	cout << min1(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
	ret 0;
}

Measured memory_bytes: 11264
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>

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

    double r;
    std::cin >> r;
    std::cout << std::fixed << std::setprecision(6) << M_PI*r*r << " " << M_PI*2*r << "\n";
    return 0;
}

Measured memory_bytes: 1300
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  if(max({a,b,c,d,e})-min({a,b,c,d,e})>k)
  {
    cout << ":(" << endl;
  }
  else
  {
    cout << "Yay!" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
integer(16) N,x
integer(16),allocatable,dimension(:)::a
integer ans
read*,N,x
allocate(a(N))
read*,a
call heapsort(n,a)

ans=0
do i=1,N
  if(a(i)>x)exit
  x=x-a(i)
  ans=ans+1
end do
if(ans==N.and.x/=0)ans=ans-1

print"(i0)",ans

contains

subroutine heapsort(n,array)
  implicit none
!ここの入力は状況に応じて変更すること
  integer(16),intent(in) :: n
  integer(16),intent(inout) :: array(1:n)
  integer(16)::i,k,j,l
  integer(16):: t

  l=n/2+1
  k=n
  do while(k /= 1)
     if(l > 1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k == 1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j<=k)
        if(j < k)then
           if(array(j) < array(j+1))j=j+1
        endif
        if (t < array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo
  return
end subroutine heapsort
end

Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"

#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define ll long long int
#define sp ' '
#define intmax 2147483647
#define intmin -2147483647
#define llmax 9223372036854775807
using namespace std;

int n, a, cnt;


int main(){
	cin >> n;
	lp(n) {
		cin >> a;
		if (a % 2 == 1)cnt++;
	}
	cout << (cnt % 2 == 0 ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
string s;
bool f;
int main()
{
  cin >> s;
  int ss = s.size();
  
  f=false;
  int res = 0;
  char front = s[0];
  rep1(i,ss){
    if(f){
      f = false;
      res++;
      front = s[i];
    }
    else{
      if(s[i] != front){
	res++;
	front = s[i];
      }
      else{
	if(i == ss) break;
	i++;
	res++;
	f = true;
      }
    }
  }
  cout << res << "\n";
  
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n); for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
long double pi = acos(-1);
const int INF = 1001001001;
const int N_MAX = 100001;
const int modint = 1000000007;

// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int strtoint(char s){
  return (int(s-'0'));
}
char changeS(char alpha){
  if(0x41 <= alpha and alpha <= 0x5A)return (alpha + 0x20);
  else if(0x61 <= alpha and alpha <= 0x7A)return (alpha - 0x20);
  return alpha;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }

int main(){
  string s;
  cin >> s;
  int cnt = 0;
  bool flag = false;
  rep(i,3){
    if(s[i] == 'R' and flag == true)cnt++;
    else if(s[i] == 'R'){
      flag = true;
      cnt = 1;
    }
    else{
      flag = false;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3612
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>

using namespace std;

void solve(int N, vector<int> B) {
  sort(B.begin(), B.end());
  int x = B[N / 2];
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += abs(B[i] - x);
  }
  printf("%lld\n", ans);
}

int main() {
  int N;
  cin >> N;
  vector<int> B(N);
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    B[i] = a - (i + 1);
  }
  solve(N, B);
  return 0;
}

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

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

  int A;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> A;
    A--;
    a[A]++;
  }
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 0; i < n - k; i++) {
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
N = int(input())
A = list(map(int,input().split()))
Q = int(input())

count = [0 for i in range(0,10**5+1,1)]
for i in range(0,N,1):
    count[A[i]]+=1

ans = 0
for i in range(0,10**5+1,1):
    ans += i*count[i]

res =[]
for i in range(0,Q,1):
    B,C = map(int,input().split())
    count[C]+=count[B]
    ans -= count[B]*B
    ans += count[B]*C
    count[B]=0
    res.append(ans)

for i in range(len(res)):
    print(res[i])



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

int main(){
  int N;cin>>N;
  int A[2][N];
  for(int i=0;i<N;i++) cin>>A[0][i];
  for(int i=0;i<N;i++) cin>>A[1][i];
  vector<int> C(100,0);
  for(int i=0;i<N;i++){
    int ans=0;
    for(int j=0;j<=i;j++) ans+=A[0][j];
    for(int j=i;j<N;j++) ans+=A[1][j];
    C.at(i)=ans;
  }
  sort(C.begin(),C.end());
  reverse(C.begin(),C.end());
  cout<<C.at(0)<<endl;
}


Measured memory_bytes: 3600
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

a, b, c = Is()
if len({a, b, c}) == 2:
    print("Yes")
else:
    print("No")

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int N; cin >> N;
    if(N==1) cout << "Hello World" << endl;
    else{
        int A,B; cin >> A >> B;
        cout << A+B << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
bool D[10];
bool a(int x) {
    while (x > 0) {
        if (D[x % 10])
            return false;
        x /= 10;
    }
    return true;
}
int main() {
    int N, K, d;
    cin >> N >> K;
    for (; K--;) {
        cin >> d;
        D[d] = true;
    }
    while (!a(N))
        N++;
    cout << N << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
	double a,b,c,d,e,f,x,y;
	while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f) != EOF){
		x = (c*e-b*f)/(a*e-b*d);
		y = (-c*d+a*f)/(a*e-b*d);
		double vx,vy;
		if(ceil(x*1000)-x*1000>x*1000-floor(x*1000)){
			vx = floor(x*1000);
		}else{
			vx = ceil(x*1000);
		}
		if(ceil(y*1000)-y*1000>y*1000-floor(y*1000)){
			vy = floor(y*1000);
		}else{
			vy = ceil(y*1000);
		}
		double newx,newy;
		newx = vx/1000;
		newy = vy/1000;
		if(newx == -0.000){
			newx = 0.000;
		}
		if(newy == -0.000){
			newy = 0.000;
		}
		printf("%.3f %.3f\n",newx,newy);
		
	}
	return 0;
}  

Measured memory_bytes: 656
#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define int long long
using namespace __gnu_pbds;
using namespace std;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

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

int n,a[200010],maxv[200010];

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	maxv[1]=a[1];
	for(int i=2;i<=n;i++) maxv[i]=max(maxv[i-1],a[i]);
	int ans=0;
	for(int i=1;i<=n;i++) ans+=maxv[i]-a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6780
import numpy as np

n = int(input())
a = [int(x) for x in input().split()]
a.sort()

m = np.zeros(max(a)+1, dtype=int)
cnt = 0

for i in range(n):
    x = a[i]
    if i == n-1:
        if m[x] == 0:
            cnt +=1
    else:
        if m[x] == 0 and a[i] != a[i+1]:
            cnt +=1
    m[x::x] += 1
print(cnt)

Measured memory_bytes: 51732
from collections import Counter
N,M = map(int,input().split(" "))
Hs = [int(i) for i in input().split(" ")]
Ts = [1]*N

for _ in range(M):
    A,B = map(int,input().split(" "))
    if Hs[A-1]==Hs[B-1]:
        Ts[A-1]=0
        Ts[B-1]=0
    elif Hs[A-1]>Hs[B-1]:
        Ts[B-1]=0
    else:
        Ts[A-1]=0

C = Counter(Ts)
print(C[1])

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

void solve()
{
    string s;
    cin >> s;
    long long int ans = 0;
    for (int i = 0; i < s.size(); i++)
        ans += s[i] - '0';
    if (ans % 9 == 0)
        cout << "Yes\n";
    else
        cout << "No\n";
}

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
    solve();

    return 0;
}


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

int main() {
  int n,m;
  long long k;
  cin>>n>>m>>k;
  vector<long long> a(n+1); // 山Aの本を上からi冊目まで読むのにかかる時間
  vector<long long> b(m+1); // 0,1,1~2,1~3,1~4,...,1~n
  
  long long time;
  a.at(0) = 0;
  for (int i = 1; i < n+1; i++) {
    cin>>time;
    a.at(i) = a.at(i-1) + time;
  }
  a.at(0) = 0;
  for (int i = 1; i < m+1; i++) {
    cin>>time;
    b.at(i) = b.at(i-1) + time;
  }
  
  long long j = m; // 山Bの本は全部読めると仮定.読めないなら減らす方針
  int ans = 0;
  for (int i = 0; i < n+1; i++) { // 山Aはkを越えない限り,全通り試す
    if (a.at(i) > k) break;
    // aもbも単調増加a[i] < a[i+1]なので降順に探した方が最大値は早く見つかる
    while (b.at(j) > k - a.at(i)) j--; // 山Aをi冊目まで読むとき山Bからは最大j冊目まで読める
    if (ans < i+j) ans = i+j;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6404
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;

int h,w,k,flag = 0;
int res = 0xffffff;
int si,sj;
int graph[805][805];
int dist[805][805];
int di[] = {0,1,0,-1}, dj[] = {-1,0,1,0};
typedef pair<int,int> pii;

int min4(int c1,int c2, int c3, int c4){
    return  min(min(c1,c2),min(c3,c4));
}

int dis(int i,int j){
    return ceil(min4(i-1,j-1,h-i,w-j)*1.0/k);
}

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

    cin>>h>>w>>k;
    char line[w+5];
    for(int i = 1; i <= h; i++){
        cin >> line;
        for(int j = 1; j <= w; j++){
            if(line[j-1]=='#')  graph[i][j] = 1;
            else if(line[j-1] == 'S'){si = i;sj = j;}
        }
    }

    queue<pii> q;
    q.push(make_pair(si,sj));
    dist[si][sj] = 1;
    while(!q.empty()){
        pii u = q.front();q.pop();
        int ni = u.first, nj = u.second;

        if(dist[ni][nj]-1 > k)    break;
        if(ni == 1||nj == 1||ni == h||nj == w){res = 0;break;}
        res = min(res, dis(ni,nj));

        for(int t = 0; t < 4; t++){
            int i = di[t]+ni, j = dj[t]+nj;
            if(i < 1||j < 1||i > h||j > w)  continue;
            if(dist[i][j])   continue;
            if(graph[i][j]) continue;
            q.push(make_pair(i,j));
            dist[i][j] = dist[ni][nj]+1;
        }
    }

    cout<<res+1<<endl;
    return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
#define sort(a) sort(a.begin(), a.end())
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int k, a, b;
    cin>>k>>a>>b;
    for(int i = a; i<=b; i++){
        if(i%k==0) return cout<<"OK\n", 0;
    }
    cout<<"NG\n";
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
int n;
int x,y,t,px,py,curt,ok=1;
int main(){
	ios_base::sync_with_stdio(0);
	cin>>n;
	px=0;
	py=0;
	curt=0;
	for(int i=1;i<=n;i++){
		cin>>t>>x>>y;
		int dis=abs(x-px)+abs(y-py);
		px=x;
		py=y;
		if(t-curt>=dis && (t-curt-dis)%2==0){
			curt=t;
		}
		else{
			ok=0;
			curt=t;
		}
	}
	if(ok==1) cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define intMax 2147483647
#define longMax 9223372036854775807
#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vector<int>>
#define vvl vector < vector<long long>
#define vii vector<pair<int, int>>
#define ii pair<int, int>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repp(i, a, b) for (int i = a; i >= b; i--)
#define be(x) x.begin(), x.end()
#define rbe(x) x.rbegin(), x.rend()
#define pb push_back
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vi v(n);
    cin >> v[0];
    int z = 0;
    int maxi = 0;
    rep(i, 1, n)
    {
        cin >> v[i];
        if (v[i] <= v[i - 1])
        {
            z++;
        }
        else
        {
            maxi = max(maxi, z);
            z = 0;
        }
    }
    cout << max(maxi,z);
}

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

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int mx = 0;
    for(int i=0; i<n-1; i++)
    {
        int dis1 = 0 , dis2 = 0;
        map<char,int>mp,dp;

        for(int j=0; j<=i; j++)
        {
            if(!mp[s[j]])dis1++;
            mp[s[j]]++;
        }
        for(int j=i+1; j<n; j++)
        {
            if(mp[s[j]] && !dp[s[j]])dis2++;
           dp[s[j]]++;
        }

        mx = max(mx,dis2);

    }
    cout << mx << endl;

}


Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#define r(i,n) for(int i=0;i<n;i++)
#define debug(x) cerr << #x << ": " << x << endl;
using namespace std;

int main(){

  int n,k;
  cin >> n >> k;

  if(n%k!=0){
    cout << 1 << endl;
  }else{
    cout << 0 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
n = int(input())
lb = []
lr = []

for i in range(n):
    lb.append(input())

say = list(set(lb))

m = int(input())
for i in range(m):
    lr.append(input())

p = []
for i in range(len(say)):
    c = lb.count(say[i]) - lr.count(say[i])
    p.append(c)



if max(p) <= 0:
    print(0)
else:
    print(max(p))




Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int a,s,d,f;
	cin>>a>>s>>d>>f;
	cout<<(a-d)*(s-f)<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong(), b = sc.nextLong();
		int k=sc.nextInt();//,k=sc.nextInt();
		long sum=0,count=0,flag=0,max=-999999,min=99999;
		long[] array=new long[k];
		//String[] array = new String[n];
		//String s=sc.next();//,t=sc.next();
		for(long i=0;i<k;i++) {
			if(a+i<=b) {
				System.out.println(a+i);
			}
			count=i;
		}
		for(int i=0;i<k;i++) {
			array[i]=b-i;
		}
		Arrays.sort(array);
		for(int i=0;i<k;i++) {
			if(array[i]>a+count) {
				System.out.println(array[i]);
			}
		}
		//System.out.println(Math.min(count, sum));
	}
	public static int sample(int n) {
		return n;
	}

}


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

using namespace std;

#define ll long long int
#define get(a) ll a; cin >> a;
#define show(a) cout << a << endl;
#define full(p) p.begin(), p.end()
#define sz(a) (ll)(a.size())
#define pb push_back

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout<<fixed;
	////////////////////////////////
	get(n);
	get(k);

	string s; cin >> s;

	s[k-1] -= 'A' - 'a'	;

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define mod 1000000007 
#define check exit(0)
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace __gnu_pbds;
using namespace std;

int main()
{
    jaldi
    int n,m;
    cin>>n>>m;
    vector<int> v(n,-1);
    for(int i=0;i<m;i++)
    {
        int l,d;
        cin>>l>>d;
        if(d==0 && l==1 && n!=1)
        {
            cout<<-1;
            return 0;
        }
        if(v[l-1]==-1) v[l-1]=d;
        else if(v[l-1]==d) continue;
        else
        {
            cout<<-1;
            return 0;
        }
    }
    if(v[0]==-1) if(n!=1) v[0]=1;
    for(int x:v) 
    {
        x==-1?cout<<0:cout<<x;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,ra,re) for((i)=ra;(i)<(re);(i)++)
#define _rep(i,ra,re) for((i)=ra;(i)>(re);(i)--)
#define rep_(i,ra,re) for((i)=ra;(i)<=(re);(i)++)
#define _rep_(i,ra,re) for((i)=ra;(i)>=(re);(i)--)
#define put(n) cout << n << " "; 
#define puts(n) cout << n << endl;
#define pu(n) cout << n;
#define mod 1000000007
int i,j,k,l;
static const int MAX_N=10e5*2;
int main(void){
	int N;
	long max,res=0;
	long a;
	cin >> N >> max;
	rep(i,0,N-1){cin >> a;
		if(max>a){
			res+=max-a;
		}
		else{
			max=a;
		}
	}
	puts(res);
	return 0;
}


Measured memory_bytes: 3592
#include<iostream>
#include<cmath>
#include<algorithm>
#include<numeric>

using namespace std;

int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd


int main(){

    int k;

    cin >> k;

    long long int s=0; 

    for(int i=1;i<k+1;i++){
        for(int j=1;j<k+1;j++){
            for(int l=1;l<k+1;l++){
                s+= gcd(i,gcd(j,l));
            }
        }
    }

    

    cout << s << endl;

}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
typedef unsigned long long ull;
typedef long long ll;
#define MAX 10005
using namespace std;

int main() {
  ull a, b, i, max;
  cin >> a >> b;
  for(i=1;i<=b-a;i++) {
    max += i;
  }
  cout << max-b << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    vector<int> vec(n);
    for(int i=0;i<n;i++){
        cin>>vec.at(i);
    }
    int sum=0;
    for(int i=0;i<n;i++){
        sum+=vec.at(i);
    }
    int count=0;
    for(int i=0;i<n;i++){
        if(vec.at(i)*4*m>=sum){
            count++;
        }else{
            continue;
        }
    }
    if(count>=m){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
   Scanner sc=new Scanner(System.in);
   int N=sc.nextInt();
   int K=sc.nextInt();
    
   int[] saikoro=new int[N+1]; //imosをとって、そこから区間和が最大になるところを見つける
   Arrays.fill(saikoro,0);
   int max=0;		//区間和の最大値をメモする
   for(int i=0; i<N; i++){
     saikoro[i+1]=sc.nextInt();
   }
   for(int i=1; i<=N; i++){
     saikoro[i]=saikoro[i]+saikoro[i-1];	//imos
   }
    max=saikoro[K];
    for(int i=0; i<N-K+1; i++){
      max=Math.max(max,saikoro[i+K]-saikoro[i]);
    }
    System.out.println((double)(max+K)/2);
  }
}


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

int main() {
    long int n;
    cin>>n;
    double PI = acos(-1);
    double m = ((PI*(double)n)/180.0);
    double x1,y1,x=0,y=1;
    double eps=1e-9,angle=PI/2.0;
    long int ans=1;
    while(x*x + y*y > eps)
    {
        ans++;
        x += cos(angle+m);
        y+= sin(angle+m);
        angle+=m;
    }
    cout<<ans<<endl;
	// your code goes here
	return 0;
}


Measured memory_bytes: 4020
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFLL = LLONG_MAX / 3;
const double eps = (1e-9);

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

  ll n, x;
  cin >> n >> x;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll ans = 0;

  rep(i, n-1) {
    if (a[i] + a[i+1] <= x) continue;
    if (a[i] <= x) {
      ans += a[i] + a[i+1] - x;
      a[i+1] -= a[i] + a[i+1] - x;
    } else {
      ans += a[i+1];
      a[i+1] = 0;
      ans += a[i] - x;
      a[i] -= a[i] - x;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024