akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <sstream>

using namespace std;

int main(){
	
	int t;
	cin >> t;
	
	for(int loop = 0; loop < t; loop++){
		
		int n;
		
		cin >> n;
		
		int max_num = 0;
		int min_num = 0;
		
		int pre;
		cin >> pre;
		
		for(int i = 1; i < n; i++){
			int cur, diff;
			cin >> cur;
			diff = cur - pre;
			max_num = max(max_num, diff);
			min_num = min(min_num, diff);
			pre = cur;
		}
		
		min_num *= -1;
		
		cout << max_num << " " << min_num << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int k;
  int a;
  int b;
  cin>>k>>a>>b;
  if(b/k-(a-1)/k==0){
    cout<<"NG"<<endl;
  }else{
    cout<<"OK"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3588
import math
A,B,H,M = map(int,input().split())
dega = (60*H+M)*(360/(60*12))
degb = M*(360/60)
a = [A*math.cos(math.radians(dega)),A*math.sin(math.radians(dega))]
b = [B*math.cos(math.radians(degb)),B*math.sin(math.radians(degb))]
dir = ((a[0]-b[0])**2 + (a[1]-b[1])**2)**0.5
print(dir)


Measured memory_bytes: 9340
N = int(input())
H = list(map(int, input().split(" "))) + [10**9]

N_highest = 0

if N == 1:
    print("Yes")
    exit()

for i in range(0, N):
    current = H[i]
    next = H[i+1]

    N_highest = max(N_highest, current)

    if current > next:
        if N_highest - next > 1:
            print("No")
            exit()

print("Yes")



Measured memory_bytes: 15020
#include <iostream>

using namespace std;


int main()
{
    long fib[45];
    int n;
    cin >> n;
    fib[0] = fib[1] = 1;
    for (int i = 2; i <= n; i++)
        fib[i] = fib[i - 1] + fib[i - 2];
    cout << fib[n] << endl;
}


Measured memory_bytes: 3124
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
#pragma endregion

int main()
{
  init_main();

  int h, w;
  cin >> h >> w;
  int a[80][80], b[80][80];
  rep(i, h) rep(j, w) cin >> a[i][j];
  rep(i, h) rep(j, w) cin >> b[i][j];

  bool dp[80][80][160 * 81] = {};
  const int add = 80 * 80;
  dp[0][0][a[0][0] - b[0][0] + add] = true;
  dp[0][0][b[0][0] - a[0][0] + add] = true;
  rep(i, h) rep(j, w)
  {
    rep(k, 160 * 80)
    {
      if (!dp[i][j][k])
        continue;
      if (i + 1 != h)
      {
        int kk = k + a[i + 1][j] - b[i + 1][j];
        if (0 <= kk && kk < 160 * 80)
          dp[i + 1][j][kk] = true;
        kk = k + b[i + 1][j] - a[i + 1][j];
        if (0 <= kk && kk < 160 * 80)
          dp[i + 1][j][kk] = true;
      }
      if (j + 1 != w)
      {
        int kk = k + a[i][j + 1] - b[i][j + 1];
        if (0 <= kk && kk < 160 * 80)
          dp[i][j + 1][kk] = true;
        kk = k + b[i][j + 1] - a[i][j + 1];
        if (0 <= kk && kk < 160 * 80)
          dp[i][j + 1][kk] = true;
      }
    }
  }

  int Min = INF;
  rep(k, 160 * 80)
  {
    if (!dp[h - 1][w - 1][k])
      continue;
    int val = abs(k - add);
    chmin(Min, val);
  }
  cout << Min << endl;
  return 0;
}


Measured memory_bytes: 81280
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int A, B, C, D;
      cin >> A >> B >> C >> D;
      
      if (B-D > 0) {
        cout << 1 << endl;
      }
      else {
        cout << 0 << endl;
      }
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,h,w;
    cin>>n>>h>>w;
    int x1,x2;
    int sum=0;
    for (int i=0;i<n/2;i++) {
        int start=w*i*2;
        int end=start+w+w;
        pair<int,int> odd=make_pair(start,start+w);
        pair<int,int> even=make_pair(start+w,end);
        cin>>x1>>x2;
        odd.first+=x1;
        odd.second+=x1;
        even.first-=x2;
        even.second-=x2;
        sum+=(min(odd.first,even.first)-start)*h;
        sum+=(end-max(odd.second,even.second))*h;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3108
x, y = map(int, input().split())
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
if x in a and y in a:
  print('Yes')
elif x in b and y in b:
  print('Yes')
elif x in c and y in c :
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9100
#include <bits/stdc++.h>
using namespace std;
constexpr auto MOD = 1000000007;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;

// index が条件を満たすかどうか vector<>maeに検索したいvectorを入れる keyを超える最小の要素番号を返す
bool isOK(int index, long long key, vector<long long> &mae)
{
  if (mae[index] >= key)
    return true;
  else
    return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(long long key, vector<long long> &mae)
{
  int left = -1;               //「index = 0」が条件を満たすこともあるので、初期値は -1
  int right = (int)mae.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

  /* どんな二分探索でもここの書き方を変えずにできる！ */
  while (right - left > 1)
  {
    int mid = left + (right - left) / 2;

    if (isOK(mid, key, mae))
      right = mid;
    else
      left = mid;
  }

  /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
  return right;
}

string s;
long long n, m;



int main()
{
  cin >> n;
  VLL a(n+1);
  a[0] = 0;
  ll in;
  rep(i, n)
  {
    cin >> in;
    a[i + 1] = a[i] + in;
  }
  int fnd = binary_search(a[n] / 2, a);
  ll mae, usiro;
  mae = a[n] - a[fnd - 1];
  usiro = a[n] - a[fnd];
  cout << min(abs(a[n] - 2*usiro), abs(a[n] - 2*mae))<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

int main() {
    int N,Y;
    cin >> N >> Y;
    
    int a=-1,b=-1,c=-1;
    for (int i=0; i<N+1; i++) {
        for (int j=0; i+j<N+1; j++) {
            if ((i*10000)+(j*5000)+((N-i-j)*1000)==Y) {
                a=i;
                b=j;
                c=N-a-b;
                break;
            }
        }
    }
    
    cout << a << " " << b << " " << c << endl;
}


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

int main(){
    string a,b,c;
    cin >> a >> b >> c;
    int x = 'A'-'a';
    cout << char(a[0]+x) << char(b[0]+x) << char(c[0]+x) << endl;
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <queue>
#include <random>
#define ll long long
#define pii pair<int, int>
#define fst first
#define snd second
using namespace std;
 
struct FlowGraph
{
	const ll FMX = 1e15;
	int N, M, s, t;
	vector<vector<pii>> adj;
	vector<pii> edge;
	vector<ll> cap, flow;
	vector<int> ptr, level;
	queue<int> q;
	
	void init(int n, int ss, int tt)
	{
		adj.clear(); edge.clear();
		cap.clear(); flow.clear();
		ptr.clear(); level.clear();
		M = 0;
		adj.assign(n, vector<pii>());
		N = n; s = ss; t = tt;
	}
	
	void newEdge(int u, int v, ll c)
	{
		if (c < 0) {swap(u, v); c = -c;}
		if (c == 0) {return;}
		adj[u].push_back({v, M});
		adj[v].push_back({u, M + 1});
		edge.push_back({u, v});
		edge.push_back({v, u});
		cap.push_back(c);
		cap.push_back(c);
		flow.push_back(0);
		flow.push_back(c);
		M += 2;
	}
	
	bool bfs()
	{
		level.assign(N, -1);
		level[s] = 0;
		q.push(s);
		while (q.size())
		{
			int u = q.front(); q.pop();
			for (auto v : adj[u])
			{
				if (cap[v.snd] == flow[v.snd]) continue;
				if (level[v.fst] == -1)
				{
					level[v.fst] = level[u] + 1;
					q.push(v.fst);
				}
			}
		}
		return (level[t] != -1);
	}

	ll dfs(int u, ll f)
	{
		if (f == 0) {return 0;}
		if (u == t) {return f;}
		for (; ptr[u] < adj[u].size(); ptr[u]++)
		{
			int v = adj[u][ptr[u]].fst;
			int id = adj[u][ptr[u]].snd;
			if (level[v] == level[u] + 1)
			{
				ll ret = dfs(v, min(f, cap[id] - flow[id]));
				if (ret == 0) continue;
				flow[id] += ret;
				flow[id ^ 1] -= ret;
				return ret;
			}
		}
		return 0;
	}

	ll findFlow()
	{
		ll ret = 0;
		
		while (bfs()) 
		{
			ll tp;
			ptr.assign(N, 0);

			while (tp = dfs(s, FMX)) 
			{
				ret += tp;
			}
		}
		return ret;
	}
};

int n, ar[101] = {};
FlowGraph g;
long long res = 0;

int main()
{
	cin >> n;
	g.init(n + 2, 0, n + 1);
	for (int i = 1; i <= n; i++) 
	{
		cin >> ar[i];
		if (ar[i] >= 0) res += ar[i];
		if (ar[i] < 0) g.newEdge(0, i, -ar[i]);
		else g.newEdge(i, n + 1, ar[i]);
	}
	for (int i = 1; i <= n; i++)
	{
		if (ar[i] < 0)
		{
			for (int j = 2 * i; j <= n; j += i) if (ar[j] >= 0) g.newEdge(i, j, g.FMX);
		}
	}
	cout << res - g.findFlow() << "\n";
	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int ans = INF;
	range(i, 2, s.size()) {
		int t = 0;
		t += (s[i - 2] - '0') * 100;
		t += (s[i - 1] - '0') * 10;
		t += (s[i - 0] - '0');
		ans = min(ans, abs(t-753));
	}
	cout << ans << endl;
}

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


// bool is_prime(int k)
// {
// 	for(int j=2;j*j<=k;j++){
// 		if(k%j==0) {
// 			return false;
// 		}
// 	}
//     return true;
// }

ll factorial(ll n) 
{
    if (n == 0)
       return 1;
    return n * factorial(n - 1);
}
int main()
{
    stringstream ss;
    // 入力
    int N;
    cin>>N;
    int A[N+1];
    ll sum[N+1];
    sum[0]=0;
    cin>>A[1];
    sum[1]=A[1];
    for(int i=2;i<=N;i++){
    	cin>>A[i];
    	sum[i]=sum[i-1]+A[i];
    }

    ll ans=0;
    sort(sum,sum+N+1);
    for(int i=0;i<=N-1;i++){
    	ll k=1;
    	bool same=false;
    	while(i+k<=N && sum[i]==sum[i+k]){
    		same=true;
    		k++;
    	}
    	if(same){
    		ans=ans + k*(k-1)/2;
    		i=i+k-1;
    	}
    }

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

Measured memory_bytes: 2560
#include<stdio.h>
int main(){
  int n,m,i,j,k,a,b;
  while(scanf("%d",&n),n){
    int dp[3001]={1};
    for(i=0;i<n;i++){
      scanf("%d %d",&a,&b);
      for(j=1001;j>-1;j--){
	for(k=1;k<=b;k++)dp[j+a*k]+=dp[j];
      }
    }
    scanf("%d",&m);
    while(m--){
      scanf("%d",&i);
      printf("%d\n",dp[i]);
    }
  }
  return 0;
}

Measured memory_bytes: 616
/*
螺旋本 p371

circumcenter:
    https://ja.wikipedia.org/wiki/%E5%A4%96%E6%8E%A5%E5%86%86#%E5%A4%96%E5%BF%83%E3%81%AE%E4%BD%8D%E7%BD%AE
    https://mathtrain.jp/goshin
*/
#pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
using namespace std;
#define INF 1LL << 55
#define MAX 1LL << 30
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll
int dx[]={1,-1,0,0},dy[]={0,0,-1,1};

#define EPS 0.0000000001
#define equals(a,b)(fbs(a-b)<EPS)

struct Point{
    double x,y;
    Point(double x,double y): x(x),y(y){}

    Point operator + (Point p){return Point(x+p.x,y+p.y);}
    Point operator - (Point p){return Point(x-p.x,y-p.y);}
    Point operator * (double a){return Point(a*x,a*y);}
    Point operator / (double a){return Point(x/a,y/a);}
    double operator * (Point p){return x*p.x+y*p.y;} //内積

    double abs(){return sqrt(norm());}
    double norm(){return x*x+y*y;}

};

double length(Point a,Point b){
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}

bool straight(Point a,Point b){
    double ans=a.x*b.y-a.y*b.x;
    if(ans<EPS && ans>-EPS) return true;
    else return false;
}

Point circumcenter(Point A,Point B,Point C){
    double a=length(B,C);
    double b=length(A,C);
    double c=length(A,B);
    a*=a;
    b*=b;
    c*=c;
    return ( ( A*a*(b+c-a)+ B*b*(c+a-b)+ C*c*(a+b-c) )/  (a*(b+c-a)+ b*(c+a-b)+ c*(a+b-c) ) );
}

vector<Point> koho;
vector<Point> V;
int N;

bool check(double r){
    for(Point c:koho){
        int i;
        for(i=0;i<N;i++){
            if(length(c,V[i])>EPS+r) break;
        }
        if(i==N) return true;
    }
    return false;
}

signed main(){
    cin>>N;
    
    for(int i=0;i<N;i++){
        int x,y;
        cin>>x>>y;
        V.emplace_back(x,y);
    }
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            koho.push_back((V[i]+V[j])/2);
        }
    }
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            for(int k=j+1;k<N;k++){
                if(!straight(V[i]-V[j],V[j]-V[k])) koho.push_back(circumcenter(V[i],V[j],V[k]));
            }
        }
    }
    double ng=0,ok=2000;
    while(ok-ng>=0.0000001){
        double mid=(ok+ng)/2;
        if(check(mid)) ok=mid;
        else ng=mid;
    }
    printf("%.10lf\n",ok);
}

Measured memory_bytes: 896
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion


void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    ll A, B, C;
    cin >> A >> B >> C;
    for(ll i=0; i<1000000000; i++){
        if(A%2 || B%2 || C%2){
            cout << i << el;return;
        }
        if(A==B && B==C){
            break;
        }
        ll tmpA = A/2;
        ll tmpB = B/2;
        ll tmpC = C/2;
        A+=tmpB+tmpC;
        B+=tmpA+tmpC;
        C+=tmpA+tmpB;
    }
    cout << -1 << el;
}



Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := NewScanner()

	d := sc.ReadInt()
	t := sc.ReadInt()
	s := sc.ReadInt()

	if d <= s*t {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

// from [my library](https://github.com/ikngtty/go-contestlib)
// -   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base, exponent int) int {
	if exponent < 0 {
		panic(fmt.Sprintf("exponent (%d) should not be a minus", exponent))
	}

	answer := 1
	for i := 0; i < exponent; i++ {
		answer *= base
	}
	return answer
}

func Ceil(divident, dividor int) int {
	if dividor == 0 {
		panic("dividor should not be 0")
	}

	quo := divident / dividor
	rem := divident % dividor

	if rem != 0 {
		if (divident > 0 && dividor > 0) ||
			(divident < 0 && dividor < 0) {
			return quo + 1
		}
	}
	return quo
}

// -   sortutil

func ReverseInts(a []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
}

func ReverseStrings(a []string) {
	sort.Sort(sort.Reverse(sort.StringSlice(a)))
}

// -   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}

func (sc *Scanner) ReadFloat() float64 {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.ParseFloat(text, 64)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  
  bool flag = true;
  int count = 1;
  int beki = K;
  while(flag){
    int am = N % beki; 
    if(am == N) flag = false;
    count++;
    beki *= K;
  }
  
  cout << count-1 << endl;
}
  
  
    


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

int main() {
  kyun;
  in6 l,r;
  cin >> l >> r;
  in6 ans = inf;
  bool check = 0;
  repa(i,l,r+1) {
    repa(j,i+1,r+1) {
      ans = min(ans,i*j%2019);
      if(ans == 0) check = 1;
      if(check) break;
    }
    if(check) break;
  }
  cout << ans;
  hinata;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func contains(target string, list []string) bool {
	for _, r := range list {
		if target == r {
			return true
		}
	}
	return false
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()

	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextInt64() int64 {
	sc.Scan()

	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextF64() float64 {
	sc.Scan()

	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func isInteger(x float64) bool {
	return math.Floor(x) == x
}

func Ave(s []int) int {
	val := 0
	for _, i := range s {
		val += i
	}
	return int(val / len(s))
}
func cal(i int) (sum int) {
	for i != 0 {
		sum += i % 10
		i /= 10
	}
	return
}
func max(a []int) (idx int, val int) {
	max := a[0]
	idx = 0
	for j, i := range a {
		if max < i {
			max = i
			idx = j
		}
	}
	return idx, max
}

func draw(i int, a []int) (l []int) {
	// p = a[i]
	for j := i; j < len(a); j++ {
		if j != len(a)-1 {
			a[j] = a[j+1]
		} else if j == len(a)-1 {
			a = a[:len(a)-1]
		}
	}
	return a
}
func abs(i int64) int64 {
	if i < 0 {
		return -i
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer([]byte{}, math.MaxInt64)
	// a := make([][]int, 3)
	// for i := 0; i < 3; i++ {
	// 	a[i] = make([]int, 3)
	// }
	// for i := 0; i < 3; i++ {
	// 	for j := 0; j < 3; j++ {
	// 		a[i][j] = nextInt()
	// 	}
	// }
	n := nextInt()
	// var cnt int
	var a []int

	for i := 0; i < n; i++ {
		a = append(a, nextInt())
	}
	out := make([]string, len(a))

	for i := 1; i <= len(a); i++ {
		out[a[i-1]-1] = strconv.Itoa(i)

	}
	fmt.Println(strings.Join(out, " "))

}


Measured memory_bytes: 7388
// AOJ DSL_2_I Range Query - RSQ and RUQ
// 2019.3.28 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//// 入力の高速化
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()    // 整数の入力（負数対応）
{
	int n = 0, c = gc();
	if (c == '-') {
		c = gc();
		do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(long long n)
{
	int i;
	char ob[40];

	if (!n) pc('0');
	else {
		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) ob[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(ob[i]);
	}
	pc('\n');
}


// セグメント木
#define MAXN (1<<17)      // セグメント木のサイズ。2のべき乗にすべし
#define INF  0x1f1f1f1f

long long segVal[2*MAXN];
int segLazy[2*MAXN];

void lazy(int k, int l, int r)
{
	if (segLazy[k] != INF) {
		segVal[k] = (long long)(r-l)*segLazy[k];
		if (l + 1 < r) {
			segLazy[(k << 1) + 1] = segLazy[k];
			segLazy[(k << 1) + 2] = segLazy[k];
		}
		segLazy[k] = INF;
	}
}

void update(int a, int b, int x, int k, int l, int r)
{
	lazy(k, l, r);
	if (r <= a || b <= l) return;
	if (a <= l && r <= b) {
		segLazy[k] = x;
		lazy(k, l, r);
		return;
	}
	update(a, b, x, (k << 1) + 1, l, (l + r) >> 1);
	update(a, b, x, (k << 1) + 2, (l + r) >> 1, r);
	segVal[k] = segVal[(k << 1) + 1] + segVal[(k << 1) + 2];
}

long long getSum(int a, int b, int k, int l, int r)
{
	long long ans;

	if (r <= a || b <= l) return 0;
	lazy(k, l, r);
	if (a <= l && r <= b) return segVal[k];
	ans = getSum(a, b, (k << 1) + 1, l, (l + r) >> 1);
	ans += getSum(a, b, (k << 1) + 2, (l + r) >> 1, r);
	return ans;
}

int main()
{
	int N, Q;
	int cmd, s, t, x;

	memset(segLazy, INF, sizeof(segLazy));
	N = in(), Q = in();
	while (Q--) {
		cmd = in(), s = in(), t = in();
		if (cmd == 0) {
			x = in();
			update(s, t+1, x, 0, 0, N);
		}
		else out(getSum(s, t+1, 0, 0, N));
	}
	return 0;
}


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

int main()
{
    int A, B;
    cin >> A >> B;
    long long count,tmp=2, result=0;

    if (A == 1)
    {
        result = B;
    }
    else if (B == 1)
    {
        result = A;
    }else if(A==B){
        result = A;
    }
    else
    {
        if (A > B)
        {
            count = A;
            while(count<10000000000){
                if(count%B==0){
                    result = count;
                    break;
                }
                count = A*tmp;
                tmp++;
            }
        }
        else
        {
            count = B;
            while(count<10000000000){
                if(count%A==0){
                    result = count;
                    break;
                }
                count = B*tmp;
                tmp++;
            }
        }
    }

    cout << result << endl;
}

Measured memory_bytes: 256
def modinverse(a,m)
  b=m
  u=1
  v=0
  while b>0
    t=a/b
    a-=t*b
    u-=t*v
    a,b=b,a
    u,v=v,u
  end
  u%=m
  if u<0
    u+=m
  end
  return u
end
f=[1]
r=[0]
v=[0]
mod=1000000007
100005.times do |i|
  f << f[-1]*(i+1)%mod
  r << (r[-1]*(i+1)+f[-2])%mod
  v << modinverse(f[-1],mod)
end
n=gets.to_i
x=gets.split.map(&:to_i)
y=[]
(n-1).times do |i|
  y << x[i+1]-x[i]
end
c=0
(n-1).times do |i|
  c+=y[i]*r[i+1]%mod*v[i+1]%mod
  c%=mod
end
puts c*f[n-1]%mod


Measured memory_bytes: 11748
#include<bits/stdc++.h>
#include<stdlib.h>
#include <dirent.h>
using namespace std;
int longestPath(int node, vector<vector<int>> &graph, vector<int> &memo) {
    if (memo[node] != -1) {
        return memo[node];
    }
    memo[node] = -1;
    for (int next : graph[node]) {
        memo[node] = max(memo[node], longestPath(next, graph, memo));
    }
    memo[node]++;
    return memo[node];
}
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  
    int n, m;
    cin >> n >> m;
    vector<vector<int>> graph(n+1);
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        graph[x].push_back(y);
    }
    vector<int> memo(n+1, -1);
    int longest = 0;
    for (int i = 1; i <= n; i++) {
        longest = max(longest, longestPath(i, graph, memo));
    }
    cout << longest << endl;
    return 0;
}

Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;

int main(){
    ll a,b; cin >> a >> b;
    ll l,r;
    if(b - a < 2019){
        l = a%2019;
        r = b%2019;
    }else{
        l = 0;
        r = 2019;
    }
    if(l > r)swap(l,r);

    ll ans = INF;
    for(int i=l;i<=r;++i){
        for(int j=l;j<=r;++j){
            if(i!=j){
                ll tmp = (i*j%2019);
                ans = min(ans,tmp);
            }
        }
    }
    cout << ans << endl;
}

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

#define ll long long

bool doo(string x){
 	ll n = x.size();
	for (ll i = 0; i < n/2; i ++){
		if (x[i] != x[n - 1 - i])	return 0;
	}
	return 1;
}

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

	if (!doo(a)){
		cout << "No\n";	return 0; 
	}

	if (!doo(a.substr(0, (n-1)/2))){
		cout << "No\n";	return 0;
	}

	if (!doo(a.substr( (n+1)/2,  n - (n+1)/2))){
		cout << "No\n";	return 0;
	}

	cout << "Yes\n";	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod=1e9+7;
ll power(ll x, ll y)
{
   ll res = 1;
   x = x % mod;
   while (y > 0)
   {
       if (y & 1)
            res = (res*x) %mod;
       y = y>>1;
       x = (x*x) %mod;
   }
   return res;
}
ll modi(ll n){
    return power(n,mod-2);
}
ll ncr(ll n,ll k){
    if(k>n-k) k=n-k;
    ll res=1;
    for(int i=0;i<k;i++){
        res=(res*(n-i))%mod;
        res=(res*modi(i+1))%mod;
    }
    return res;
}
int main() 
{ 
    ll n,a,b;
    cin>>n>>a>>b;
    ll an=power(2,n);
    an--;
    if(an<0) an+=mod;
    an-=ncr(n,a);
    if(an<0) an+=mod;
    an-=ncr(n,b);
    if(an<0) an+=mod;
    cout<<an;
	return 0; 
} 


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define ll long long
#define F(i,a,b) for(int i=(a);i<=(b);i++)
#define mst(a,b) memset((a),(b),sizeof(a))
#define PII pair<int,int>
using namespace std;
template<class T>inline void read(T &x) {
    x=0; int ch=getchar(),f=0;
    while(ch<'0'||ch>'9'){if (ch=='-') f=1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
    if(f)x=-x;
}
const int inf=0x3f3f3f3f;
const int maxn=150;
int n,ans;
char s[maxn];
int main()
{
	cin>>(s+1);
	n=strlen(s+1);
	int pos=n;
	for(int i=1;i<=n/2;i++)
	{
		if(s[i]!=s[pos]) ans++;
		pos--;
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

typedef long long int ll;

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

map<ll,bool> mp;
ll arr[1000001];

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

    arr[0] = 0;
    arr[1] = 1;
    for(int i=2 ; i<=1000000 ; i++)
    {
        if(arr[i] == 0)
        {
            for(int j=i ; j<=1000000 ; j+=i)
            {
              if(arr[j] ==0)
                arr[j] = i;
            }
        }
    }

    int n;
    cin >> n;
    ll a[n],ans=0;
    for(int i=0 ; i<n ; i++)
    {
        cin >> a[i];
        ans = GCD(ans,a[i]);
    }

    bool f=0;
    for(int i=0;  i<n ; i++)
    {
        ll ka = a[i];
        vector<ll> temp;
        while(ka>1)
        {
           // cout << a[i] << " " << ka << " " << arr[ka] << endl;
            if(mp.find(arr[ka]) != mp.end())
            {
                f=1;
                break;
            }
            temp.push_back(arr[ka]);
            ka/=arr[ka];
        }
       // cout << endl;
        if(f)
            break;
        for(int j=0 ; j<temp.size() ; j++)
            mp[temp[j]]=1;
    }
    if(!f)
        cout << "pairwise coprime\n";
    else if(ans == 1)
        cout << "setwise coprime\n";
    else
        cout << "not coprime\n";
    return 0;
}


Measured memory_bytes: 19204
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    vector<int> K(N);
    vector<vector<int>> A(N);

    REP(i, N){
        cin >> K[i];
        REP(j, K[i]){
            int a;
            cin >> a;
            A[i].push_back(a);
        }
    }

    int res, ans = 0;
    FOR(s, 1, M){
        res = 0;
        REP(i, N){
            REP(j, SIZE(A[i])){
                if (s == A[i][j]){
                    res++;
                }
            }
        }
        if (res == N){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        Integer s = Integer.parseInt(sc.next());

        // 主処理
        List<Integer> list = new ArrayList<>();
        list.add(s);

        int result = 0;
        for (int i = 0; true; i++) {
            s = s % 2 == 0 ? s / 2 : 3 * s + 1;
            if (list.contains(s)) {
                result = i + 2;
                break;
            } else {
                list.add(s);
            }
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 22996
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
#include<unordered_map>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

#define MOD 1000000007

lli invv[200005];

lli inv(lli a){ // a * a^(MOD-2) = 1
	if(invv[a] != 0) return invv[a];
	lli b[30];
	b[0] = a;
	rep(i, 29) b[i+1] = (b[i]*b[i]) % MOD;
	lli ret = 1;
	int j = MOD - 2;
	rep(i, 30) if(1&(j>>i)) ret = (ret*b[i])%MOD;
	return invv[a] = ret;
}

lli comb(lli m, lli n){ // mCn
	if(n == 0) return 1;
	lli ret = 1;
	n = min(m-n, n);
	reg(i, m-n+1, m) ret = (ret * i) % MOD;
	reg(i, 1, n) ret = (ret * inv(lli(i))) % MOD;
	return ret;
}

int main(void){
	lli h, w, a, b; cin >> h >> w >> a >> b;
		
	lli ans = 0;
	lli s = comb(h-a-1+b, h-a-1);
	lli t = comb(a-1+w-b-1, a-1);
	rep(i, w - b){
		ans = (ans + (s*t)%MOD) % MOD;
		s = (s*(((h-a+b+i)*inv(lli(b+1+i)))%MOD))%MOD;
		t = (t*((inv(lli(a-2+w-b-i))*(w-b-i-1))%MOD))%MOD;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1536
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int N = sc.nextInt();
			int K = sc.nextInt();

			BigDecimal p = new BigDecimal("0");
			for (int i = 1; i <= N; i++) {
				int point = i;
				BigDecimal p_sub = new BigDecimal("1");
				p_sub = p_sub.divide(BigDecimal.valueOf(N), 15, BigDecimal.ROUND_HALF_DOWN);
				while (point < K) {
					point = point * 2;
					p_sub = p_sub.divide(BigDecimal.valueOf(2));
				}
				p = p.add(p_sub);
			}
			System.out.println(p);
		}
	}
}

Measured memory_bytes: 39436
#include<iostream>
#include<algorithm>

using namespace std;

int selectionSort(int A[], int N) {
	int sw = 0;

	for (int i = 0; i < N; i++) {
		int minj = i;
		
		for (int j = i; j < N; j++)
			if (A[j] < A[minj]) minj = j;
		swap(A[i], A[minj]);
		if (i != minj) sw++;
	}
	return sw;
}

int main() {
	int A[100], N, sw;

	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	sw = selectionSort(A, N);
	for (int i = 0; i < N; i++) {
		if (i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw << endl;

	return 0;
}


Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	
	int d = BC(a ^ b);
	int s = n - d;
	
	if(d % 2 == 0) { cout << "NO" << endl; return 0; }
	cout << "YES" << endl;
	
	vector<vector<int>> C(n + 1), L(n + 1);
	C[0] = { 0 };
	L[1] = { 0, 1 };
	inc1(i, n) {
		int x = SI(C[i - 1]);
		inc(j, x) { C[i].PB(C[i - 1][j] | (0 * x)); }
		dec(j, x) { C[i].PB(C[i - 1][j] | (1 * x)); }
	}
	incII(i, 3, n) {
		if(i % 2 == 0) { continue; }
		
		int x = SI(L[i - 2]);
		incID(j, 0, 1) { L[i].PB(L[i - 2][j] | (0 * x)); }
		incID(j, 0, x) { L[i].PB(C[i - 2][j] | (2 * x)); }
		incID(j, 1, x) { L[i].PB(L[i - 2][j] | (0 * x)); }
		decID(j, 0, x) { L[i].PB(L[i - 2][j] | (1 * x)); }
		incID(j, 0, x) { L[i].PB(L[i - 2][j] | (3 * x)); }
	}
	
	vector<int> v;
	inc(i, 1 << d) {
		if(i % 2 == 0) { inc(j, 1 << s) { v.PB((L[d][i] << s) | C[s][j]); } }
		if(i % 2 == 1) { dec(j, 1 << s) { v.PB((L[d][i] << s) | C[s][j]); } }
	}
	
	map<int, int> mp;
	int c[2] = { 0, s };
	inc(i, n) {
		int x = bit(a ^ b, i);
		mp[1 << c[x]] = 1 << i;
		c[x]++;
	}
	
	vector<int> ans;
	inc(i, 1 << n) { ans.PB(i == 0 ? a : ans.back() ^ mp[v[i] ^ v[i - 1]]); }
	assert(ans.back() == b);
	
	inc(i, SI(ans)) { cout << (i == 0 ? "" : " ") << ans[i]; }
	cout << endl;
	
	return 0;
}


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

#define f(i,x,y)			for(int i=x; i<y; i++)
#define ll 					long long 
#define mp 					make_pair
#define F 					first
#define S 					second
#define N 					100005
#define inf 				1e9+1

int main()
{
	
	int n,k;
	cin>>n>>k;
	int a[n];
	f(i,0,n)
		cin>>a[i];
	
	bool dp[k+1];
	dp[0] = 0;
	
	f(i,1,k+1)
	{
		int x = 0;
		int j=0;
		while(j<n && a[j]<=i)
		{
			x |= !dp[i-a[j]];
			j++;
		} 
		dp[i] = x;
	}

	if(dp[k])
		cout<<"First";
	else
		cout<<"Second";
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
#define double long double
#define x first
#define y second
#define yy cout<<"YES\n"
#define nn cout<<"NO\n"
#define rt return
#define ct continue
#define br break
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define mmod 1000000007
#define pmod 998244353
using namespace std;
int gcd(int a,int b){
    while (b) b^=a^=b^=a%=b;
    return a;
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int bigmod(int b,int p,int m){
    int ans=1;
    b%=m;
    if (!b) return 0;
    while (p){
        if (p&1) ans=(ans*b)%m;
        p>>=1;
        b=(b*b)%m;
    }
    return ans;
}
void recur(){
	
	
	
}
void solve(){
	string s;
	cin>>s;
	if (s.back()=='s') cout<<s<<"es";
	else cout<<s<<'s';
	
	
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while (t--) solve();
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::multiprecision;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define ALL(x) (x).begin(),(x).end()

int main () {
  int n, m, c, b, a;
  vector<int> bs;
  int count = 0;

  cin >> n >> m >> c;

  REP(i, m) {
    cin >> b;
    bs.push_back(b);
  }

  REP(i, n) {
    int acc = c;
    REP(j, m) {
      cin >> a;

      acc += (bs[j] * a);
    }

    if(acc > 0) count++;
  }

  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

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

    ll intCount = 0;
    vector<vector<ll>> count(70, vector<ll>(70));
    vector<vector<ll>> c_sum(100, vector<ll>(70));
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        ll now = 0;
        int digitCount = 0;
        bool foundDot = false;
        for (auto &c:s) {
            if (foundDot)digitCount++;
            if (c == '.')foundDot = true;
            else now *= 10, now += c - '0';
        }

        ll twoCount = 0, fiveCount = 0;
        while (now % 2 == 0)twoCount++, now /= 2;
        while (now % 5 == 0)fiveCount++, now /= 5;

        if (digitCount <= twoCount && digitCount <= fiveCount)intCount++;
        count[digitCount - twoCount + 50][digitCount - fiveCount + 50]++;
        c_sum[twoCount - digitCount + 50][fiveCount - digitCount + 50]++;
    }

    for (int i = 99; i >= 0; i--) {
        for (int j = 69; j >= 0; j--) {
            if (i + 1 < 100) c_sum[i][j] += c_sum[i + 1][j];
            if (j + 1 < 70) c_sum[i][j] += c_sum[i][j + 1];
            if (i + 1 < 100 && j + 1 < 70)c_sum[i][j] -= c_sum[i + 1][j + 1];
        }
    }

    ll ret = 0;
    for (int i = 0; i < 70; i++) {
        for (int j = 0; j < 70; j++) {
            if (count[i][j] * c_sum[i][j] > 0) {
                ret += count[i][j] * c_sum[i][j];
            }
        }
    }

    cout << (ret - intCount) / 2 << endl;
    return 0;
}

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

int main(){
    int n;  cin >> n;
    vector<ll> l(n);
    for(int i=0; i<n; i++)  cin >> l.at(i);
    sort(l.begin(), l.end());

    int cnt=0;
    for(int i=0; i<n-2; i++){
        for(int j=i+1; j<n; j++){

            ll key = l.at(j)-l.at(i);
            int lb = upper_bound(l.begin(), l.end(), key)-l.begin();
            if(lb<=i)   cnt += j-1-i; 
            else cnt += j-lb;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<string.h>
#include<iostream>
using namespace std;
int main(void)
{
	string odd,even;
	int leno,lene;
	cin>>odd;
	cin>>even;
	leno=odd.length();
	lene=even.length();
	for(int i=0;i<lene;i++)
		cout<<odd[i]<<even[i];
	if(leno>lene)
		cout<<odd[leno-1];
	cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
const int mod=1e9+7;

int main() {
  int K,T;
  cin>>K>>T;
  vector<int>a(T);
  for(int i=0;i<T;i++){
    cin>>a[i];
  }
  sort(a.rbegin(),a.rend());
  int sum=0;
  for(int i=1;i<T;i++){
    sum+=a[i];
  }
  cout<<max(0,a[0]-1-sum)<<endl;
  return 0;
}


Measured memory_bytes: 3528
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=1000005;
#define M 1000000007
#define double long double
#define BINF 100000001
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 15000001
const int LG = 22;


#undef int 
int main() { 
#define int long long int 
 
ios_base::sync_with_stdio(false); 
cin.tie(0); 
cout.tie(0); 


	string s;
	cin >> s;
	for(int i = 1; i < 4; i++){
		if(s[i] == s[i - 1]){
			cout << "Bad";
			return 0;
		}
	}

	cout << "Good";



return 0;
}

Measured memory_bytes: 256
let () =
  let a,b,c,d,e,f = Scanf.sscanf (read_line ()) "%d %d %d %d %d %d" (fun a b c d e f -> a,b,c,d,e,f) in
  let command = read_line () in
  let rec roll a b c d e f i' =
    if i' < String.length command then
      let i = i'+1 in
           match command.[i'] with
             'E' -> roll d b a f e c i
           | 'W' -> roll c b f a e d i
           | 'S' -> roll e a c d f b i
           | 'N' -> roll b f c d a e i
           | _ -> ()
    else (print_int a; print_char '\n')
  in
  roll a b c d e f 0
;;


Measured memory_bytes: 2424
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   " << endl;
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}

int main(){
	ll N;
	cin >> N;
	//N--;

	string abc = "abcdefghijklmnopqrstuvwxyz";
	//cout << "  abc.size():  " << abc.size() << endl;

	string ans = "";
	while(N != 0){
		N--;
		int num = N % 26;
		char c = abc[num];
		ans.push_back(c);
		N /= 26;
		
	}

	reverse(ans.begin(), ans.end());
	cout << ans << endl;
	
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
typedef long long ll; 

#define vi vector <ll>
using namespace std ; 
long long M= 10e9+7;
ll power(ll x,ll y,ll m)
{            //power(x,y)=x^y  %m;
	ll res=1%m;
	while(y)
	{
	    if(y&1)
	    res=(res*x)%m;
	    x=(x*x)%m;
	    y=(y>>1)%m;
	}
	return res;
}
ll mod_inverse(ll x,ll m)
{
	return power(x,m-2,m);
}
int main ()
{
    ios_base :: sync_with_stdio ( false );
    cin.tie( NULL );
    cout.tie( NULL );
ll n;
cin>>n;
ll ans=0;
for(ll i=0;i<n;i++)
{
    ans+=(i+1)*(n-i);
}
for(ll i=0;i<n-1;i++)
{
    ll a,b;
    cin>>a>>b;
    
    
    ll tt;
    tt=min(a,b);
    ll ma;
    ma=max(a,b);
    ans-=(tt)*(n-ma+1);
    
}
cout<<ans<<"\n";

 

 return 0;
}

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

int main() {
  int n;
  cin>>n;
  vector<vector<int>>a(2,vector<int>(n));
  for(int i=0;i<2;i++){
    for(int j=0;j<n;j++) cin>>a[i][j];
  }
  int answer=0;
  for(int i=0;i<n;i++){
    int ans=0;
    for(int j=0;j<=i;j++){
      ans+=a[0][j];
      if(j==i) ans+=a[1][j];
    }
    for(int j=i+1;j<n;j++){
      ans+=a[1][j];
    }
    answer=max(ans,answer);
  }
  cout<<answer<<endl;
}


Measured memory_bytes: 256
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

N = I()
print(N**3)

Measured memory_bytes: 38384
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n=Integer.parseInt(sc.next());
int m=Integer.parseInt(sc.next());
int x=Integer.parseInt(sc.next());
int[] a=new int[m];
  int t=0;
  for(int i=0;i<m;i++){
  a[i]=Integer.parseInt(sc.next());
  } 
  for(int i=0;i<m;i++){
  if(a[i]>x){t=i;break;}
  }
System.out.println(Math.min(t,m-t));
}
}

Measured memory_bytes: 22996
s = input()

n = len(s)
mod_list = [0]*2019
mod_list[0] = 1
t = 0
keisu = 1
for i in range(n):
  t = (int(s[n-1-i])*keisu+t) %2019
  keisu = keisu*10 %2019
  mod_list[t]+= 1
count = 0
for k in range(2019):
  count += mod_list[k] * (mod_list[k]-1)//2
print(count)

Measured memory_bytes: 68248
package main

import (
    "fmt"
    "sort"
    "bytes"
)

func main() {
    
	var n, l int
	fmt.Scanf("%d %d",&n, &l)
	
	s := make([]string, n)
	for i := 0; i < n; i++ {
	    fmt.Scan(&s[i])
	}
	
	sort.Strings(s)
	
	var buffer bytes.Buffer
	for i := 0; i < n; i++ {
	    buffer.WriteString(s[i])
	}
	
	fmt.Println(buffer.String())
	
}

Measured memory_bytes: 768
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <list>

using namespace std;


int main(int argc, char * argv [] ) {
    string obj = "CF";
    string str;
    cin >> str;

    int strSize = str.size();
    int cnt = 0;
    for (int i = 0; i < strSize; ++i) {
        if (str.at(i) == obj.at(cnt)) {
            ++cnt;
            if (cnt == 2) {
                break;
            }
        }
    }

    cout << (cnt == 2 ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 256