akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

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

using namespace std;

int main(){
	int a,b,c; scanf("%d%d%d",&a,&b,&c);
	puts(min(a,b)<=c&&c<=max(a,b)?"Yes":"No");
	return 0;
}


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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
//sort(a, a + N, greater<ll>())   // descend
//sort(a, a+N)                    //  ascend

/* 
void comb(vector<vector <ll> > &v) {
	ll mod=1000000007;
	rep (i,0,v.size()) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	rep (k,1,v.size()) {
		rep (j,1,k) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%mod;
		}
	}
}
/*main内でnCn~nC0 生成 **
vector<vector<ll> > v(n + 1, vector<ll>(n + 1, 0));
comb(v);
*/


int main() {
	ll n;
	cin>>n;
	ll res[110]={0};
	for(int num=2; num<=n; num++){
		int c = num;
		for(int i=2; i<=num; i++){
			while(c%i==0){
				res[i]++;
				c/=i;
			}
		}
	}
	ll ans=0;
	ll cnt1=0;
	ll cnt2=0;
	ll cnt3=0;
	ll cnt4=0;
	ll cnt5=0;
	ll cnt6=0;
	ll cnt7=0;
	ll cnt8=0;
	ll cnt9=0;
	ll cnt10=0;
	ll cnt11=0;
	ll cnt12=0;
	ll cnt13=0;

	rep(i,2,n+1) {
		if(res[i]>=4) cnt1++;
		else if(res[i]>=2 && res[i]<4) cnt2++;
	}
	ans+=cnt1*(cnt1-1)/2*(cnt1-2+cnt2);


	rep(i,2,n+1) {
		if(res[i]>=14) cnt3++;
		else if(res[i]>=4 && res[i]<14) cnt4++;
	}
	ans+=cnt3*(cnt3-1+cnt4);

	rep(i,2,n+1) {
		if(res[i]>=24) cnt5++;
		else if(res[i]>=2 && res[i]<24) cnt6++;
	}
	ans+=cnt5*(cnt5-1+cnt6);

	rep(i,2,n+1) {
		if(res[i]>=74) cnt7++;
	}
	ans+=cnt7;

	rep(i,2,n+1) {
		if(res[i]>=4 && res[i<=24]) cnt8++;
	}
	//ans-=cnt5*(cnt5-1+cnt8);

/* 
	rep(i,2,n+1) {
		if(res[i]<74 &&res[i]>24) cnt8++;
		else if(res[i]>2 && res[i]<24) cnt9++;
	}
	ans-=cnt8*(cnt8-1)/2*(cnt8-2+cnt9);
	
		rep(i,2,n+1) {
		if(res[i]<24 && res[i]>14) cnt10++;
		else if(res[i]<4 && res[i]>2) cnt11++;
	}
	ans-=cnt8*(cnt10-1)/2*(cnt10-2+cnt11);

	rep(i,2,n+1) {
		if(res[i]>=24) cnt10++;
		else if(res[i]>=4 && res[i]<14) cnt11++;
	}
	ans-=cnt8*(cnt10-1)/2*(cnt10-2+cnt11);
	
		rep(i,2,n+1) {
		if(res[i]>=74) cnt12++;
		else if(res[i]>=4 && res[i]<74) cnt13++;
	}
	ans+=cnt8*(cnt12-1)/2*(cnt12-2+cnt13);
*/

	cout<<ans;
} 


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

int main() {
    int N;
    cin>>N;
    int B[N-1];
    for(int i=0;i<N-1;++i){
        cin>>B[i];
    }
    int A[N];
    A[0] = B[0];
    A[N-1] = B[N-2];
    for(int i=1;i<N-1;++i){
        A[i] = min(B[i-1], B[i]);
    }
    int ans = 0;
    for(int i=0;i<N;++i){
        ans += A[i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n)     for (ll i = 0; i < (n); ++i)
#define rep2(i, a, b) for (ll i = (a); i < (b); ++i)
#define repin(a, n)  \
    vector<ll> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repins(a, n)     \
    vector<string> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repind(a, n)     \
    vector<double> a(n); \
    rep(i, n) { cin >> a[i]; }
#define in(a) \
    ll a;     \
    cin >> a;
#define ins(a) \
    string a;  \
    cin >> a;
#define ind(a) \
    double a;  \
    cin >> a;
template <class T>
inline void out(T a) {
    cout << a << endl;
}
inline void out(double a) { printf("%.10f\n", a); }
#define all(x)  (x).begin(), (x).end()    //昇順
#define rall(x) (x).rbegin(), (x).rend()  //降順
#define yes     out("Yes");
#define no      out("No");

#include <atcoder/all>
using namespace atcoder;

int main() {
    in(N);
    in(M);
    dsu ds(N);
    rep(i, M) {
        in(a);
        in(b);
        ds.merge(a - 1, b - 1);
    }
    out(ds.groups().size() - 1);
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

auto prime_factor = [](ll x){map<ll, int> xfact;for(int i=2; (ll)i*i<=x; i++) {while(x % i == 0) {xfact[i]++;x /= i;}}if(x > 1) xfact[x]++;return xfact;};

int main() {
  unsigned long long A, B; cin >> A >> B;
  auto G = __gcd(A, B);
  auto m = prime_factor(G);
  cout << m.size() + 1 << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
import numpy as np
from heapq import heapify, heappop, heappush
import copy


def main():
    N = int(input()[-1])
    if N == 3:
        print('bon')
    elif N == 0 or N == 1 or N == 6 or N == 8:
        print('pon')
    else:
        print('hon')


if __name__ == '__main__':
    main()


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

using namespace std;

int main()
{
  int N;
  cin >> N;
  int a;
  int r = 0;
  for( int i=0;i<N;i++ )
    {
      cin >> a;
      while( a%2 == 0 )
	{
	  a /= 2;
	  r++;
	}
    }
  cout << r << endl;
}


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

typedef long long ll;

int bin(ll b[] , int m , ll x) {
    int l=0,h=m,ans=0;
    while(l<=h) {
        int md=(l+h)/2;
        if(b[md]<=x)ans=md,l=md+1;
        else h=md-1;
    }
    return ans;
}

int main() {
    ll n,m,k;
    cin>>n>>m>>k;
    ll a[n+1],b[m+1];
    memset(a,0,sizeof(a)) , memset(b,0,sizeof(b));
    for(int i=0;i<n;++i) {
        ll t;
        cin>>t;
        a[i+1]=t+a[i];
    }
    for(int i=0;i<m;++i) {
        ll t;
        cin>>t;
        b[i+1]=b[i]+t;
    }
    ll cnt=0;
    for(int i=0;i<=n;++i) {
        if(a[i]<=k)
            cnt=max(cnt,(ll)i+bin(b,m,k-a[i]));
    }
    cout<<cnt;
}


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

using namespace std;

#define ll long long

int main(void){
    /* input */
    int N; cin >> N;
    vector<int> A(N), B(N);
    for (auto& ai : A)
        cin >> ai;
    for (auto& bi : B)
        cin >> bi;
    /* solve */
    priority_queue<pair<int, int>> dis_idx;
    for (int i = 0; i < N; ++i){
        if (B[i] < A[i]){
            cout << -1 << endl;
            exit(0);
        }
        int tmp = B[i] - (B[(i - 1 + N) % N] + B[(i + 1) % N] + A[i]);
        if (tmp >= 0) dis_idx.push({tmp, i});
    }
    ll op = 0;
    while (!dis_idx.empty()){
        int idx = dis_idx.top().second;
        dis_idx.pop();
        int dis = B[idx] - A[idx];
        int one_op = B[(idx - 1 + N) % N] + B[(idx + 1) % N];
        if (dis < one_op){
            cout << -1 << endl;
            exit(0);
        }
        op += dis / one_op;
        B[idx] = A[idx] + (dis % one_op);
        for (int i = idx - 1; i <= idx + 1; ++i){
            int tmp = B[(i + N) % N] - (B[(i - 1 + N) % N] + B[(i + 1) % N] + A[(i + N) % N]);
            if (tmp >= 0) dis_idx.push({tmp, (i + N) % N});
        }
        /* for (auto bi : B)
            cout << bi << " ";
        cout << endl; */
    }
    bool ok = true;
    for (int i = 0; i < N; ++i)
        ok &= A[i] == B[i];
    cout << (ok ? op : -1) << endl;
    return 0;
}

Measured memory_bytes: 2936
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>

using namespace std;

int main() {
	int n;
	cin >> n;
	if (n < 1200) {
		cout << "ABC" << endl;
	}
	else if (n < 2800) {
		cout << "ARC" << endl;
	}
	else {
		cout << "AGC" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			long h = sc.nextLong();
			
			
			System.out.println(countTurn(h));

		}
			
	}
	
	static private long countTurn(long hp) {
		
		if ( hp == 1 ) {
			return 1;
		}
		else {
			return 2 * countTurn(hp / 2) + 1;
		}
	}
}

Measured memory_bytes: 21844
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 3e5 + 10;
int a[N];
int b[N];
int c[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) cin >> b[i];
	for (int i = 1; i < n; i++) cin >> c[i];
	int pre = 0;
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		ans += b[a[i]];
		if (pre + 1 == a[i])
			ans += c[pre];
		pre = a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#define ll long long

using namespace std;

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

ll cnt=1;
int main(){

 ll a,b; 
 cin>>a>>b;
 
 ll G;
 G=gcd(a,b);
 ll dv=2;
 while(G>1){
  if(G%dv==0){
   while(G%dv==0){
     G/=dv;
   }
   cnt++;
  }
  dv++;
  if(dv>1000000) break;
 }
 
 if(G>1) cnt++;
 cout<<cnt<<endl;
 return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
area = [[] for i in range(h)]

for i in range(h):
    area[i] = input()
num = 0

for i in range(h):
    for j in range(w):
        if area[i][j] == '#' and j < num:
            print('Impossible')
            exit()
        elif area[i][j] == '#':
            num = j

print('Possible')


Measured memory_bytes: 9132
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b; cin >> a >> b;
  int tmp = 0;
  for(int i = 1; i <= b-a; i++){
    tmp += i;
  }
  cout << tmp - b << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
using namespace std;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;

int n;

int main() {
    //ios::sync_with_stdio(false);cin.tie(0);
    scanf("%d",&n);
    if(n>=400 && n<=599) puts("8");
    else if(n>=600 && n<=799) puts("7");
    else if(n>=800 && n<=999) puts("6");
    else if(n>=1000 && n<=1199) puts("5");
    else if(n>=1200 && n<=1399) puts("4");
    else if(n>=1400 && n<=1599) puts("3");
    else if(n>=1600 && n<=1799) puts("2");
    else if(n>=1800 && n<=1999) puts("1");
    return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, k; string s;
    cin >> n >> k >> s;
    int cnt = 0;
    for (int i = 0; i < n - 1; ++i) {
        if(s[i] != s[i+1]) cnt++;
    }
    for (int i = 0; i < k; ++i) {
        cnt = max(0, cnt-2);
    }
    cout << n-cnt-1 << "\n";
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(){
       int a,b,i;
     char op;
       for(i=1; ;i++){
       scanf("%d %c %d", &a, &op, &b);
       if(op=='?')break;
       if(op=='+'){
     printf("%d\n",a+b);
     }
       if(op=='-'){
     printf("%d\n",a-b);
     }
     if(op=='*'){
     printf("%d\n",a*b);
     }
     if(op=='/'){
     printf("%d\n",a/b);
     }
       }
       return 0;
   } 

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
vector<int> b(N-1);
  for (int i = 0; i < N-1; i++) {
    cin >> b.at(i);
  }
if(N==2){cout<<2*b.at(0);
}
else{
a.at(0)=b.at(0);
a.at(N-1)=b.at(N-2);
for(int i=0;i<N-2;i++){
a.at(i+1)=min(b.at(i),b.at(i+1));
}
int64_t sum=0;
for(int i=0;i<N;i++){
sum+=a.at(i);
}
cout<<sum;
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

const int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int N;
    cin >> N;
    vi A(N);
    rep(i, N) cin >> A[i];

    bool f = true;
    rep(i, N) {
        if (A[i] % 2 == 0) {
            if ((A[i] % 3 != 0) && (A[i] % 5 != 0)) f = false;
        }
    }

    if (f) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll abdiff(ll a,ll b)
{
    return (a-b)>=0?a-b:b-a;
}
int main()
{
    ll n,k;
    cin>>n>>k;
    ll h[n+1];
    for(ll i=1;i<=n;i++)
    {
        cin>>h[i];
    }
    ll dp[n+1];
    dp[1]=0;
    for(ll i=2;i<=n;i++)
    {
        if(i==2)
        {
            dp[i]=abdiff(h[2],h[1]);
        }
        else
        {
            dp[i]=LONG_LONG_MAX;
            for(ll j=1;j<=k && i-j>0;j++)
            {
                ll x;
                x=abdiff(h[i],h[i-j]);
                dp[i]=min(dp[i],dp[i-j]+x);
            }
        }
    }
    cout<<dp[n]<<"\n";
    return 0;
}


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

int main(void){
    int n;
    map<char,bool>m;
    cin>>n;
    int num=0;
    for(int i=0;i<n;i++){
        char a;
        cin>>a;
        if(m[a]==false){
            m[a]=true;
            num++;
        }
    }
    if(num==3){
        cout<<"Three"<<endl;
    }else{
        cout<<"Four"<<endl;
    }
    
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
 int sx, sy, tx, ty, l;
 scanf("%d%d%d%d", &sx, &sy, &tx, &ty);
 for(l = sx; l < tx; l++) putchar('R');
 for(l = sy; l < ty; l++) putchar('U');
 for(l = sx; l < tx; l++) putchar('L');
 for(l = sy; l < ty; l++) putchar('D');
 putchar('L');
 for(l = sy; l < ty; l++) putchar('U');
 putchar('U');
 putchar('R');
 for(l = sx; l < tx; l++) putchar('R');
 putchar('D');
 putchar('R');
 for(l = sy; l < ty; l++) putchar('D');
 putchar('D');
 putchar('L');
 for(l = sx; l < tx; l++) putchar('L');
 putchar('U');
}

Measured memory_bytes: 128
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Point{
	Point(double arg_x,double arg_y){
		x = arg_x;
		y = arg_y;
	}

	Point(){
		x = y = 0.0;
	}

	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 abs(){ return sqrt(norm()); }
	double norm(){ return x*x + y*y; }

	bool operator<(const Point &p) const{
		return x != p.x? x < p.x: y < p.y;
	}

	bool operator == (const Point &p) const{
		return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
	}

	double x,y;
};

typedef Point Vector;
typedef vector<Point> Polygon;

double cross(Vector a,Vector b){
    return a.x*b.y-a.y*b.x;
}

double dot(Vector a,Vector b){
    return a.x*b.x + a.y*b.y;
}

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -1;
static const int ON_SEGMENT = 0;

int ccw(Point p0,Point p1,Point p2){

	Vector a = p1 - p0;
	Vector b = p2 - p0;

	if(cross(a,b) > EPS)return COUNTER_CLOCKWISE;
	if(cross(a,b) < -EPS)return CLOCKWISE;
	if(dot(a,b) < -EPS)return ONLINE_BACK;
	if(a.norm() < b.norm())return ONLINE_FRONT;

	return ON_SEGMENT;
}

Point calc_Cross_Point(double x1,double x2,double x3,double x4,double y1,double y2,double y3,double y4){
	Point ret;
	ret.x = ((x2-x1)*(y3*(x4-x3)+x3*(y3-y4))-(x4-x3)*(y1*(x2-x1)+x1*(y1-y2)))/((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1));
	if(x1 != x2){
		ret.y = ((y2-y1)*ret.x+y1*(x2-x1)+x1*(y1-y2))/(x2-x1);
	}else{
		ret.y = ((y4-y3)*ret.x+y3*(x4-x3)+x3*(y3-y4))/(x4-x3);
	}
	return ret;
}

Point calc_Cross_Point(Point a,Point b,Point c,Point d){
	return calc_Cross_Point(a.x,b.x,c.x,d.x,a.y,b.y,c.y,d.y);
}

Polygon ConvexCut(Polygon g,Point a,Point b){

	Polygon ret;
	int N = g.size();

	for(int i = 0; i < g.size(); i++){
		Point A = g[i], B = g[(i+1)%N];
		if(ccw(a,b,A) != -1)ret.push_back(A);
		if(ccw(a,b,A)*ccw(a,b,B) == -1)ret.push_back(calc_Cross_Point(a,b,A,B));
	}

	return ret;
}

double calc_S(Polygon g){

	int N = g.size();
	double ret = 0;

	for(int i = 0; i < g.size(); i++){
		ret += cross(g[i],g[(i+1)%N]);
	}
	return ret/2.0;
}

int main(){

	int N;
	scanf("%d",&N);

	Polygon g;
	double x,y;

	for(int loop = 0; loop < N; loop++){
		scanf("%lf %lf",&x,&y);
		g.push_back(Point(x,y));
	}

	int Q;
	scanf("%d",&Q);

	Point a,b;
	Polygon ret;

	for(int loop = 0; loop < Q; loop++){
		scanf("%lf %lf %lf %lf",&a.x,&a.y,&b.x,&b.y);
		ret = ConvexCut(g,a,b);
		printf("%.10lf\n",calc_S(ret));
	}

	return 0;
}




Measured memory_bytes: 3224
using System;

namespace ALDS1_5_C_KochCurve
{
	class Program
	{
		static void Main ( string[] args )
		{
			Vector startPoint = new Vector (0, 0);
			Vector endPoint = new Vector (100, 0);

			int recursiveCount = int.Parse (Console.ReadLine ());

			Console.WriteLine (startPoint);
			KochCurve (recursiveCount, startPoint, endPoint);
			Console.WriteLine (endPoint);
		}

		static void KochCurve ( int restCount, Vector startPoint, Vector endPoint )
		{
			if (0 < restCount)
			{
				Vector s = new Vector ();
				Vector t = new Vector ();
				Vector u = new Vector ();

				s.X = (2 * startPoint.X + 1 * endPoint.X) / 3;
				s.Y = (2 * startPoint.Y + 1 * endPoint.Y) / 3;

				t.X = (1 * startPoint.X + 2 * endPoint.X) / 3;
				t.Y = (1 * startPoint.Y + 2 * endPoint.Y) / 3;

				double radian = 60 * Math.PI / 180;
				u.X = ((t.X - s.X) * Math.Cos (radian) - (t.Y - s.Y) * Math.Sin (radian)) + s.X;
				u.Y = ((t.X - s.X) * Math.Sin (radian) + (t.Y - s.Y) * Math.Cos (radian)) + s.Y;

				KochCurve (restCount - 1, startPoint, s);
				Console.WriteLine (s);

				KochCurve (restCount - 1, s, u);
				Console.WriteLine (u);

				KochCurve (restCount - 1, u, t);
				Console.WriteLine (t);

				KochCurve (restCount - 1, t, endPoint);
			}
		}
	}

	class Vector
	{
		public Vector () { }
		public Vector ( double x, double y )
		{
			this.X = x;
			this.Y = y;
		}

		public double X { set; get; }
		public double Y { set; get; }
		public override string ToString ()
		{
			return X + " " + Y;
		}
	}
}

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

using namespace std;

int gcd(int m ,int n){
    if(n==0 || m==0) return max(n,m);
    if(n==m) return m;
    if(n>m) return gcd(n%m,m);
    return gcd(n,m%n);
    
}

int main(){
    int m,n;
    cin >> m >>n;
    cout << gcd(m,n) << endl;
    
    return 0;
}


Measured memory_bytes: 3080
using System;

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            char[] a = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
                         'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };

            for (int i = 0; i < S.Length; i++)
            {
                var index = 0;
                for (int j = 0; j < a.Length; j++)
                {
                    if (a[j] == S[i])
                    {
                        index = j;
                        break;
                    }
                }
                Console.Write(a[index + N]);
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 11164
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll n;cin>>n;
    vector<pll>p(n);
    rep(i,n){
        cin>>p[i].first>>p[i].second;
    }
    sort(all(p));
    reverse(all(p));
    ll mal=p[0].first;
    ll r=p[0].second;
    rep(i,n){
        swap(p[i].first,p[i].second);
    }
    sort(all(p));
    ll ans=0;
    ll mir=p[0].first;
    ll L=p[0].second;
    ll ma=0;
    rep(i,n){
        if(i>0)ma=max(p[i].first-p[i].second+1,ma);
    }
    ans=ma+max(0LL,mir-mal+1);
    L=p[0].second;
    REP(i,1,n){
        ans=max(mir-L+1+max(0LL,p[i].first-mal+1),ans);
        L=max(L,p[i].second);
    }
    cout<<ans<<endl;
}

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

int main() {
  int n;
  cin >> n;
  int ans;
  for(int i = 1; i <= (int)sqrt(n); i++) {
    if(i * i <= n) {
      ans = i * i;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int n,m;
	while(cin>>m>>n,n+m){
		vvi dp(n+1,vi(m+1));
		int a;cin>>a;
		rep(i,a){
			int b,c;
			cin>>b>>c;
			dp[c][b]=-1;
		}
		dp[1][1]=1;
		loop(i,1,n+1)loop(j,1,m+1){//cout<<i<<" "<<j<<endl;
			if(dp[i][j]==-1)continue;
			dp[i][j]+=(dp[i-1][j]==-1?0:dp[i-1][j])+(dp[i][j-1]==-1?0:dp[i][j-1]);
		}
		cout<<dp[n][m]<<endl;
		//rep(i,n+1){rep(j,m+1)cout<<" "<<dp[i][j];cout<<endl;}
	}
}

Measured memory_bytes: 1216
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	//input
	int N, K;
	cin >> N >> K;
	int minus_line;
	if (K > (N - 1) * (N - 2) / 2) {
		cout << -1 << endl;//can't generate graph
	}
	else {
		//generate graph
		minus_line = (N - 1) * (N - 2) / 2 - K;
		cout << N - 1 + minus_line << endl;

		rep1(i, N) {
			cout << 1 << ' ' << i + 1 << endl;
		}

		int count = 0;
		rep(i, N - 1) {
			for (int j = i + 1; j < N - 1; j++) {
				if (minus_line == count) {
					break;
				}
				else {
					cout << i + 2 << ' ' << j + 2 << endl;
					count++;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

int main(){
    int n;
    string t;
    for(char c='a'; c<='z'; ++c) t += c;
    for(char c='A'; c<='Z'; ++c) t += c;
    t += t;
    while(scanf("%d", &n) && n){
        int K[n];
        rep(i, n) scanf("%d", &K[i]);
        string s;
        cin >> s;
        int cur = 0;
        for(char &c: s){
            int idx = 0;
            rrep(i, t.size())if(t[i] == c){
                idx = i;
                break;
            }
            c = t[idx-K[cur]];
            (cur += 1) %= n;
        }
        cout << s << "\n";
    }
}


Measured memory_bytes: 3272
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	if (ci - cn + 16 > cm) {
		int A = getcha() - '0';
		while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
		return A;
	}
	else {
		int A = *ci++ - '0';
		while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
		return A;
	}
}

pair<int, int> E[200000];
int H[100001];
bool D[100001];
void dfs(int A) {
	if (!D[A]) {
		D[A] = 1;
		for (int i = H[A]; i; i = E[i].second) {
			dfs(E[i].first);
		}
	}
}

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


	int N = getint(), M = getint();

	for (int i = 1; i < 2 * M; i += 2) {
		int x = getint();
		int y = getint();
		getint();
		E[i] = mp(y, H[x]);
		H[x] = i;
		E[i + 1] = mp(x, H[y]);
		H[y] = i + 1;
	}
	
	int kotae = 0;
	rep1(i, N) {
		if (!D[i]) {
			kotae++;
			dfs(i);
		}
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
int main() { int n; cin >> n; string s; cin >> s; if( n & 1 ) { puts("No"); return 0; } int m = n / 2; puts( s.substr(0,m) == s.substr(m,m) ? "Yes" : "No" ); return 0; }

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std ;

#define MAXN 200007

int n ;
int a[ MAXN ] ;

long long pref[ MAXN ] ;


long long st[ MAXN ] ;
long long en[ MAXN ] ;


long long get_sum ( int l , int r ) {
    return ( pref[ r ] - pref[ l - 1 ] ) ;
}

void input ( ) {
    scanf ( "%d" , &n ) ;
    int i ;
    for ( i = 1 ; i <= n ; i ++ ) {
        scanf ( "%d" , &a[ i ] ) ;
        pref[ i ] = ( pref[ i - 1 ] + a[ i ] ) ;
    }
}

void solve ( ) {
    int i ;
    for ( i = 2 ; i < n ; i ++ ) {
        long long sm = get_sum ( 1 , i ) ;
        int l , r , mid ;
        l = 1 ;
        r = i - 1 ;
        while ( r - l > 3 ) {
            mid = ( l + r ) / 2 ;
            if ( 2 * get_sum ( 1 , mid ) <= sm ) { l = mid ; }
            else { r = mid ; }
        }
        while ( r > 1 && 2 * get_sum ( 1 , r ) > sm ) { r -- ; }
        if ( r + 1 < i ) {
            st[ i ] = min ( get_sum ( 1 , r ) , sm - get_sum ( 1 , r ) ) ;
            st[ i ] = max ( st[ i ] , min ( get_sum ( 1 , r + 1 ) , sm - get_sum ( 1 , r + 1 ) ) ) ;
        }
        else {
            st[ i ] = min ( get_sum ( 1 , r ) , sm - get_sum ( 1 , r ) ) ;
        }


        sm = get_sum ( i , n ) ;
        l = i ;
        r = n - 1 ;
        while ( r - l > 3 ) {
            mid = ( l + r ) / 2 ;
            if ( 2 * get_sum ( i , mid ) <= sm ) { l = mid ; }
            else { r = mid ; }
        }
        while ( r > i && 2 * get_sum ( i , r ) > sm ) { r -- ; }
        if ( r + 1 < n ) {
            en[ i ] = min ( get_sum ( i , r ) , sm - get_sum ( i , r ) ) ;
            en[ i ] = max ( en[ i ] , min ( get_sum ( i , r + 1 ) , sm - get_sum ( i , r + 1 ) ) ) ;
        }
        else {
            en[ i ] = min ( get_sum ( i , r ) , sm - get_sum ( i , r ) ) ;
        }
    }
    long long ans = -1 ;
    for ( i = 3 ; i < n ; i ++ ) {
        long long u[ 4 ] ;
        u[ 0 ] = st[ i - 1 ] ;
        u[ 1 ] = en[ i ] ;
        u[ 2 ] = get_sum ( 1 , i - 1 ) - u[ 0 ] ;
        u[ 3 ] = get_sum ( i , n ) - u[ 1 ] ;
        sort ( u , u + 4 ) ;
        long long cur = u[ 3 ] - u[ 0 ] ;
        if ( ans < 0 ) { ans = cur ; }
        if ( ans > cur ) { ans = cur ; }
    }
    printf ( "%lld\n" , ans ) ;
}

int main ( ) {
    input ( ) ;
    solve ( ) ;
    return 0 ;
}


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

int main() {
  int n, a[222222], b[222222], i;
  cin>>n;
  for(i=1; i <= n; ++i) cin >> a[i];
  int evens, odds;

  if(1&n) {
    evens = n/2+2;
    odds = n/2+1;
  }
  else {
    evens = n/2;
    odds = n/2+1;
  }

  for(i = 1; i <= n; ++i) {
    if(i&1) {
      b[odds] = a[i];
      if(1&n) odds--;
      else odds++;
    }
    else
    {
      b[evens] = a[i];
      if(1&n) evens++;
      else evens--;
    }
  }
  for(i = 1; i <= n; ++i) cout << b[i] << " ";
  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + (ll)b) % mod
#define MUL(a, b) a = (a * (ll)b) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rer(i, a, b) for(int i = a - 1; i >= b; i--)
#define all(a) (a).begin(), (a).end()
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef pair<pi, pi> ppi;
typedef vector<ll> vec;

const int MAX_N = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;

void Debug() {cout << '\n'; }

template<class FIRST, class... REST> 
void Debug(FIRST arg, REST... rest) { cout << arg << " "; Debug(rest...); }

template<class T>
ostream& operator<< (ostream& out, const vector<T>& v) {
	out << "[";
	if(!v.empty()) {
		rep(i, 0, (int)v.size() - 1) out << v[i] << ", ";
		out << v.back();
	}
	out << "]";
  return out;
}

template<class S, class T>
ostream& operator<< (ostream& out, const pair<S, T>& v) {
	out << "(" << v.first << ", " << v.second << ")";
	return out;
}

///g++ -g3 -std=c++0x -DLOCAL -Wall -ftrapv -D_GLIBCXX_DEBUG -Wl,-stack,268435456 -o
///g++ -O2 -std=c++0x -DLOCAL -Wall -Wl,-stack,268435456 -o

///////////////////////////////////////////////////////////////////////

int W, H, N, M;
ppi P[MAX_N];
bool used[MAX_N];

bool is_edge(int x, int y) {
	if(x == 0 || y == 0 || x == W || y == H) return true;
	else return false;
}

pair<pi, int> convert(pi p, int i) {
	pi res; int x = p.fst, y = p.sec;
	if(x == 0) res = pi(0, y);
	else if(y == H) res = pi(1, x);
	else if(x == W) res = pi(2, H - y);
	else res = pi(3, W - x);
	return make_pair(res, i);
}

void solve() {
	cin >> W >> H >> M;
	rep(i, 0, M) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		if(!is_edge(a, b) || !is_edge(c, d)) continue;
		P[N++] = make_pair(pi(a, b), pi(c, d));
	}
	vector<pair<pi, int>> vec;
	rep(i, 0, N) {
		vec.push_back(convert(P[i].fst, i));
		vec.push_back(convert(P[i].sec, i));
	}
	sort(all(vec));
	stack<int> s;
	rep(i, 0, (int)vec.size()) {
		int a = vec[i].sec;
		if(!used[a]) {
			s.push(a); used[a] = true;
		}
		else {
			if(s.top() != a) {
				cout << "NO\n";
				return;
			}
			s.pop();
		}
	}
	cout << "YES\n";
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(0);	
    cout << fixed;
	cout.precision(20);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 6516
#!/usr/bin/env python3
data1 = input().split(" ")
N=int(data1[0])
T=int(data1[1])
data2 = input().split(" ")
t = [int(i) for i in data2]
sum = 0
i=0

for i in range(N):
    sum+=T
    t[i] += T
    if i == N-1:break
    elif t[i] >= t[i+1]:
        sum-=(t[i]-t[i+1])
        
print(sum)

Measured memory_bytes: 26836
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define lp(i,n) for(int i=0;i<(n);i++)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)2e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define CTOI(x) (x - 'A') 
#define ctoi(x) (x - 'a')
#define BIT(x) (1 << (x))
using namespace std;
int a,b,k,si,ans=-1;

void solve(int it,int bo,int kcnt,int an){
  if(it==si){
    ans=max(ans,an);
    return;
  }
  int nowa=a/pow(10,it);
  nowa%=10;
  int nowb=b/pow(10,it);
  nowb%=10;
  if(nowa-bo>=nowb){
    solve(it+1,0,kcnt,an+(nowa-bo-nowb)*pow(10,it));
  }
  else{
    if(kcnt!=k){
      solve(it+1,0,kcnt+1,an+(nowa-bo+10-nowb)*pow(10,it));
    }
    solve(it+1,1,kcnt,an+(nowa-bo+10-nowb)*pow(10,it));
  }
  return;
}

int main(){
  cin>>a>>b>>k;
  string s=to_string(a);
  si=s.size();
  solve(0,0,0,0);
  cout<<ans<<endl;
  return 0;
}



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

using namespace std;

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

#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;

int main() {
    int n;
    cin>>n;
    vector<int> h(n);
    rep(i, n) {
        cin>>h[i];
    }
    bool flag=true;
    rep(i, n) {
        if(i>0) {
            //a_n-1 < a_n で1下げる、
            if(h[i]>h[i-1]) {
                h[i]=h[i]-1;
            } else if(h[i]<h[i-1]) {
                Yes(false);
                return  0;
            }
        }else{
            h[0]=h[0]-1;
        }
    }
    Yes(true);
    return 0;
}


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

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

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

int main(){
	long long x, y;
	cin >> x >> y;

	int cnt = 0;
	while(x <= y){
		x *= 2;	
		cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 768
n, k = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10**9+7

ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        if A[i] > A[j]:
            ans += 1
ans *= k
ans %= MOD

cnt = 0
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        if A[i] > A[j]:
            cnt += 1
ans += cnt*(k*(k-1)//2) % MOD
ans %= MOD

print(ans)

Measured memory_bytes: 41836
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;

int n,cnt;
int a[500000];

int main(){
  int n;
  cin >> n;
  int a = n/100,
      b = n/10%10,
      c = n%10;
  a = a*9%10;
  b = b*9%10;
  c = c*9%10;
  cout << a*100+b*10+c << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int dp[702][2005];
int mod = 1e9+7;
int s;
int32_t main()
{
    for(int j = 3;j<=2000;j++)dp[1][j]=1;
    for (int i = 2;i<=700;i++){
        int cur = 0;
        dp[i][3]=cur;
        for (int j = 4;j<=2000;j++){
            cur+=dp[i-1][j-3];
            cur%=mod;
            dp[i][j]=cur;
        }
    }
    cin>>s;
    int ans = 0;
    for(int i = 1;i<=700;i++){ans+=dp[i][s];ans%=mod;}
    cout<<ans;
    return 0;
}

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

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

using namespace std;

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

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

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

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

  int x, a, b;
  while (cin >> x >> a >> b) {
    cout << (x - a) % b << endl;
  }
  
  return 0;
}


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

void lcs(string a,string b)
{
    int n = b.length();
    int m = a.length();
    
    std::vector<vector<int>> arr(n+1,vector<int>(m+1));
    
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(a[j-1] == b[i-1]) arr[i][j] = arr[i-1][j-1] + 1;
            else arr[i][j] = max(arr[i-1][j],arr[i][j-1]);
        }
    }
    int len = arr[n][m];
    char ans[len];
    len--;
    
    int i=n,j=m;
    while(len>=0)
    {
        if(a[j-1] == b[i-1])
        {
            ans[len] = a[j-1];
            len--;
            i--;
            j--;
        }
        else
        {
            if(arr[i-1][j]>arr[i][j-1])
            {
                i--;
            }
            else j--;
        }
    }
    for(int i=0;i<arr[n][m];i++)
    {
        cout<<ans[i];
    }
}

int main()
{
    string a,b;
    cin>>a>>b;
    
    lcs(a,b);
}


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

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

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

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

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,m;
string s;
vll f;
// <------------- Implement Functions Here ----------> //



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

void MAIN() {
	ll k;
	cin >> n >> k;
	vll a(n);
	for(ll i=0;i<n;i++) cin >> a[i];
	ll prev = a[0];
	ll next = a[k];
	ll j = k;
	while(j < n) {
		prev = a[j-k]; 
		next = a[j];
		if(prev < next) cout<<"Yes\n";
		else cout<<"No\n";
		j++;
	}
}

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


Measured memory_bytes: 239236
#include<iostream>
#include<stdio.h>
#include<vector>
#include<math.h>
#include<algorithm>
#include<string>
#define ll long long
#define vl vector<ll> 
#define vvl vector<vector<ll> >
#define vb vector<bool> 
#define vvb vector<vector<bool> >
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b:i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define INF 1123456789012345
using namespace std;

int main(){
	ll n,m; cin>>n>>m;
	vector<pair<ll,ll> > stud(n);
	vector<pair<ll,ll> > check(m);
	rep(i,n) cin>>stud[i].first>>stud[i].second;
	rep(i,m) cin>>check[i].first>>check[i].second;
	rep(i,n){
		ll temp=INF;
		ll ans=0;
		rep(j,m) if(temp>(abs(stud[i].first-check[j].first)+abs(stud[i].second-check[j].second))){
			temp=abs(stud[i].first-check[j].first)+abs(stud[i].second-check[j].second);
			ans=j+1;
		}cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define ll long long int
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
vector<pair<ll,ll>>v;
ll dp[100][100005]={0};
ll fun(ll n,ll m,ll i){
    if(i>=n)return 0;
    if(m-v[i].first < 0)return fun(n,m,i+1);
    if(dp[i][m]!=0)return dp[i][m];
    ll x=max(v[i].second+fun(n,m-v[i].first,i+1),fun(n,m,i+1));
    return dp[i][m]=x;
}
int32_t main() {
    ll n,m;
    cin>>n>>m;
    for(ll i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        v.push_back(make_pair(a,b));
    }
    ll x=fun(n,m,0);
    cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 70448
#include <iostream>
using namespace std;
int main () {
  string s;
  int count = 0;
  cin >> s;
  if (s[0] == '1') count += 1;
  if (s[1] == '1') count += 1;
  if (s[2] == '1') count += 1;
  cout << count << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define mp make_pair
#define write(x) cout<<(x)<<endl
using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; }return 0; }
inline ll pow2(const int n) { return 1ll << n; }
const int INF = 1 << 28; const ll LINF = 1ll << 60;
const int MAX = 1e5 + 5; const int MOD = 1e9 + 7; const double EPS = 1e-6;
const int dy[4] = { 0,1,0,-1 }; const int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;
// 1. 問題よくよめえええええええええええええええええええええええええ
// 2. intオーバーフロー << * + あたり
// 3. 落ち着け

int main() {
    vi a(3); rep(i, 3) cin >> a[i];
    sort(all(a));
    write(a[2] * 10 + a[0] + a[1]);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <numeric>
 
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
string S,T;
vector<ll> A;
vector<ll> B;
vector<ll> C;
ll D[100000];


ll N;
ll ans;

int main() {
    cin >> N;
    for(int i=0;i<N;i++){
        ll a;
        cin >> a;
        A.push_back(a);
    }
    for(int i=0;i<N;i++){
        ll b;
        cin >> b;
        B.push_back(b);
    }
    for(int i=0;i<N;i++){
        ll c;
        cin >> c;
        C.push_back(c);
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    for(int i=0;i<N;i++){
        D[i] = lower_bound(A.begin(),A.end(),B[i])-A.begin();
        if(i>0){
        D[i]+= D[i-1];
        }
    }
    for(int i=0;i<N;i++){
        ans += D[lower_bound(B.begin(),B.end(),C[i])-B.begin()-1];
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 6332
fun main(args: Array<String>) {
    val (n, a, b, c) = readLine()!!.split(" ").map { it.toInt() }
    val ls = (1..n).map { readLine()!!.toInt() }

    val target = Triple(a, b, c)
    val start = Triple(0, 0, 0)

    println(rec(ls, n, 0, start, target))
}

fun rec(list: List<Int>, n: Int, i: Int, now: Triple<Int, Int, Int>, target: Triple<Int, Int, Int>): Int {
    val (a, b, c) = now

    if (i == n) {
        if (a == 0 || b == 0 || c == 0 ) {
            return 1 shl 29
        }
        return Math.abs(now.first - target.first) + Math.abs(now.second - target.second) + Math.abs(now.third - target.third)
    }

    var res = rec(list, n, i + 1, Triple(a, b, c), target)
    res = Math.min(res, rec(list, n, i + 1, Triple(a + list[i], b, c), target) + if (a == 0) 0 else 10)
    res = Math.min(res, rec(list, n, i + 1, Triple(a, b + list[i], c), target) + if (b == 0) 0 else 10)
    res = Math.min(res, rec(list, n, i + 1, Triple(a, b, c + list[i]), target) + if (c == 0) 0 else 10)

    return res
}

Measured memory_bytes: 41420
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

const ll INF = 1LL << 50;

int main() {
  ll h, w, n;
  cin >> h >> w >> n;

  ll d = max(h, w);
  cout << (n + d - 1) / d << endl;

  return 0;
}


Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

n,m = I()
print((n-1)*(m-1))

Measured memory_bytes: 77432