akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF 2147483647//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    string s;
    cin >> s;
    if(s[0] == 'A' && (s[1] == 'B' || s[2] == 'B')){
        cout << "Yes" << endl;
        return 0;
    }else if(s[1] == 'A' && (s[0] == 'B' || s[2] == 'B')){
        cout << "Yes" << endl;
        return 0;
    }else if(s[2] == 'A' && (s[0] == 'B' || s[1] == 'B')){
        cout << "Yes" << endl;
        return 0;        
    }
    cout << "No" << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
H,N = map(int,(input().split()))
dp = [10**9]*(H+1)
dp[0] = 0

A = [list(map(int,(input().split()))) for _ in range(N)]

for i in range(H+1):
    for j,k in A:
        next = min(H,i+j)
        dp[next] = min(dp[next],dp[i]+k)

print(dp[H])

Measured memory_bytes: 42076
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;

#define MOD 998244353


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

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}
  
  

int main(){
    string s;
    cin>>s;
    
    ll num = s.size();
    
    for(ll i = 0; i<num; i++){
        cout<<"x";
    }
    cout<<endl;
    return 0;
}
    
    



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    ll n;cin>>n;
    vector<int> c(n),s(n),f(n),t(n,0);
    For(i,0,n-1) cin>>c[i]>>s[i]>>f[i];
    For(i,0,n){
        For(j,i,n-1){
            t[i]=max(s[j],(t[i]+f[j]-1)/f[j]*f[j])+c[j];
        }
    }
    For(i,0,n) cout<<t[i]<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	string str;
	cin >> str;
	for(int i=0;i<str.size();i++){
		if(str[i]=='C'){
			for(int j=i+1;j<str.size();j++){
				if(str[j]=='F'){
						cout << "Yes\n";
						return 0;
				}
			}
		}
	}
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <bitset>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <sstream>
using namespace std;
#define MOD 1000000007
#define MAX 510000
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    ll a,b,c; cin >> a >> b >> c;
    if(a<=c && c<=b) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {

  var a, b int

  fmt.Scan(&a, &b)

  if a >= 1 && a <=9 && b >=1 && b <=9 {
    fmt.Println(a * b)
  } else {
    fmt.Println(-1)
  }
  

}

Measured memory_bytes: 512
use std::collections::BinaryHeap;
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let m: usize = sc.read();
    let a: Vec<u64> = sc.vec(n);
    let mut heap = BinaryHeap::from(a);
    for _ in 0..m {
        let x = heap.pop().unwrap();
        heap.push(x / 2);
    }
    let mut result: u64 = 0;
    while let Some(x) = heap.pop() {
        result += x;
    }
    println!("{}", result);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int main() {
	int n, k;
	cin >> n >> k;
	vector<int>s;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		s.push_back(a);
	}
	int sum = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] > k - s[i]) {
			sum = sum + 2 * (k - s[i]);
		}
		else {
			sum = sum + 2 * (s[i]);
		}
	}
	cout << sum;
}


Measured memory_bytes: 256
N = int(input())
precomputed = {
    4: ["abcc", "abdd", "eefg", "hhfg"],
    5: ["abc..", "abc..", "ddeff", "g.ehh", "giijj"],
    6: ["abc...", "abc...", "d.eeff", "dghh..", ".g.ijj", "kk.ill"],
    7: ["abc....", "abc....", "def....", "def....", "g..hhii", "g..jjkk", ".llmmnn"],
}
if N == 2:
    print(-1)
elif N == 3:
    print("aa.")
    print("..b")
    print("..b")
else:
    K = N // 4
    M = N % 4
    assert 4 * K + M == N
    K -= 1
    M += 4
    assert K >= 0
    assert M in [4, 5, 6, 7]
    assert 4 * K + M == N
    grid = [['.' for j in range(N)] for i in range(N)]

    for k in range(K):
        for i in range(4):
            for j in range(4):
                grid[4 * k + i][4 * k + j] = precomputed[4][i][j]
    for i in range(M):
        for j in range(M):
            grid[4 * K + i][4 * K + j] = precomputed[M][i][j]
    for row in grid:
        print("".join(row))


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

int main() {
  string s;
  cin >> s;
  if (s.find("a") != string::npos && s.find("b") != string::npos && s.find("c") != string::npos) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    priority_queue <double,vector <double>,greater<double> > pq;
    for(int i=0,x;i<n;i++)
    {
        cin>>x;
        pq.push(x);
    }
    while(pq.size()>1)
    {
        double t1 = pq.top();
        pq.pop();
        double t2 = pq.top();
        pq.pop();
        pq.push((double)((t1+t2)/2.0));
    }
    cout<<pq.top()<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

int main(){
    int N;cin>>N;
    string S;cin>>S;
    int blue = 0;
    int red = 0;
    for(int i = 0; i<S.size();i++){
        if(S[i] == 'R'){
            red++;
        }else{
            blue++;
        }
    }
    if(red>blue){
        cout<<"Yes";
    }else{
        cout<<"No";
    }

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int w,n;
	int a,b;

	cin >> w >> n;

	int h[w];

	for(int i = 0;i < w;i++){
		h[i] = i+1;
	}
	for(int i = 0;i < n;i++){
		scanf("%d,%d",&a,&b);
		swap(h[a-1],h[b-1]);
	}

	for(int i = 0;i < w;i++){
		cout << h[i] << endl;
	}
}

Measured memory_bytes: 1240
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int main()
{
	ll n=read(),x=read(),ans=0; ans+=n;
	ll p1=x,p2=n-x; if(p1<p2) swap(p1,p2);
	ll c1=0,c2=0,p=0;
	while(p2!=0)
	{
		//cout<<p1<<" "<<p2<<" "<<ans<<endl;
		c1=p1/p2,c2=p1%p2;
		ans+=c1*p2*2;
		p1=p2; p2=c2;
	}
	cout<<ans-p1<<endl;
	return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    if(abs(x - a) < abs(x - b)){
      cout << "A"<< endl;
    } else {
      cout << "B" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
/////////////////////////////////////////
////////// ^\/^ *_* :) :-D '~' \\\\\\\\\\
/////////////////////////////////////////
#include <bits/stdc++.h>
//#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
//#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
//#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
//#include <string.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,m;
vector <int> begp,endp,g[100010];
bool vis[100010];

void dfs(int pla)
{
	vis[pla]=true;
	endp.pb(pla);
	rep(i,g[pla].size())
	{
		if(!vis[g[pla][i]])
		{
			dfs(g[pla][i]);
			return;
		}
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	rep(i,m)
	{
		int x,y;
		cin>>x>>y;
		g[x].pb(y);
		g[y].pb(x);
	}
	dfs(1);
	swap(begp,endp);
	dfs(1);
	cout<<begp.size()+endp.size()-1<<endl;
	for(int i=begp.size()-1;i>0;i--) cout<<begp[i]<<" ";
	rep(i,endp.size()) cout<<endp[i]<<" ";
	cout<<endl;
	rt0;
}

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

using namespace std;
#define BUF (1004)
#define ll long long 

char mat[BUF][BUF];
int n,m,a,b;

int main(void){
	cin >> n >> m >> a >> b;
	int od=0;
	//fill with .
	for(int i=0;i<n+1;i++){
		for(int j=0;j<m+1;j++){
			mat[i][j]='.';
		}
	}
	
	int r=0;
	int c=0;
	if(n%2==1 ){ 
		r=min(a,m/2);
		a-=r;
		for(int i=0;i<r;i++){
			mat[n][2*i+1]='<';
			mat[n][2*i+2]='>';
		}
	}
	if(m%2==1 ){ 
		c=min(b,n/2);
		b-=c;
		for(int i=0;i<c;i++){
			mat[2*i+1][m]='^';
			mat[2*i+2][m]='v';
		}
	}

	if(n%2==1 && m%2==1 && a%2==1 && b%2==1){
			mat[n-2][m-2]='<';
			mat[n-2][m-1]='>';
			mat[n-2][m  ]='^';
			mat[n-1][m  ]='v';
			mat[n  ][m  ]='>';
			mat[n  ][m-1]='<';
			mat[n  ][m-2]='v';
			mat[n-1][m-2]='^';
			a--;
			b--;
			od = 1;
	}

	int recta=(a+1)/2;
	int rectb=(b+1)/2;
	int rects=recta+rectb;

	if((n/2)*(m/2)-od -rects<0){
		cout << "NO\n";
		return 0;
	}else{
		cout << "YES\n";
	}

	//cout << a << b ;

	for(int i=0;i<n/2;i++){
		for(int j=0;j<m/2;j++){
			if(a<=0)break;
			mat[2*i+1][2*j+1 ] = '<'; 
			mat[2*i+1][2*j+2 ] = '>';
			mat[2*i+2][2*j+1 ] = '<';
			mat[2*i+2][2*j+2 ] = '>';
			if(a==1){
				mat[2*i+2][2*j+1 ] = '.';
				mat[2*i+2][2*j+2 ] = '.';	
			}	
			a-=2;
		}
	}
	
	for (int i = 0; i < n / 2; i++){
		for (int j = 0; j < m / 2; j++){
			if (mat[2 * i + 1][2 * j + 1] == '.'){
				if (b<=0)break;
				mat[2 * i + 1][2 * j + 1] = '^';
				mat[2 * i + 1][2 * j + 2] = '^';
				mat[2 * i + 2][2 * j + 1] = 'v';
				mat[2 * i + 2][2 * j + 2] = 'v';
				if(b==1){
					mat[2 * i + 1][2 * j + 2] = '.';
					mat[2 * i + 2][2 * j + 2] = '.';	
				}
				b-=2;
			}
		}
	}


	//show
	for(int i=1;i<n+1;i++){
		for(int j=1;j<m+1;j++){
			cout << mat[i][j];
		}
		cout << "\n";
	}
	return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  string s;
  cin >> s;
  long long n=s.size();
  vector<long long> k(2019,0);
  long long q[200000];
  q[199999]=1;
  rep(i,199999){
    q[199998-i]=(q[199999-i]*10)%2019;
  }
  long long u[n];
  u[0]=s[n-1]-'0';
  k[u[0]]++;
  rep(i,n-1){
    long long j=(u[i]+q[199998-i]*(s[n-2-i]-'0'))%2019;
    u[i+1]=j;
    k[j]++;
    //cout << j << endl;
  }
  long long ans=0;
  rep(i,2018){
    ans+=k[i+1]*(k[i+1]-1)/2;
  }
  ans+=k[0]*(k[0]+1)/2;
  cout << ans << endl;
  
}


Measured memory_bytes: 6856
#include <iostream>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <stack>

using namespace std;

#define maxN 100000
#define maxM 100000

class UFT{
public:
  long long int par[maxN]; // 親
  long long int rank[maxN]; // 木の深さ
  long long int degree; // unionの数

  // n要素で初期化
  UFT(long long int n){
    for (long long int i = 0; i < n; i++) {
      par[i] = i;
      rank[i] = 0;
    }
    degree = n;
  }

  // 木の根を求める
  long long int find(long long int x){
    if (par[x] == x){
      return x;
    }
    else{
      return par[x] = find(par[x]);
    }
  }

  // xとyの属する集合を併合
  void unite(long long int x, long long int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rank[x] < rank[y]) {
      par[x] = y;
    }
    else {
      par[y] = x;
      if (rank[x] == rank[y]) rank[x]++;
    }
    degree --;
  }
};

int main(){
  long long int N, M;
  long long int X, Y, Z;
  long long int res=0;

  cin >> N >> M;
  UFT uft(N);
  for(long long int i=0; i<M; i++){
    cin >> X >> Y >> Z;
    uft.unite(X,Y);
  }
  cout << uft.degree << endl;

}


Measured memory_bytes: 1792
package main

import "fmt"

func main() {
	var N, K, X, Y int
	fmt.Scan(&N)
	fmt.Scan(&K)
	fmt.Scan(&X)
	fmt.Scan(&Y)
	if N > K {
		fmt.Println(K*X + (N-K)*Y)
	} else {
		fmt.Println(N * X)
	}
}


Measured memory_bytes: 512
n=input()
m=input()
ks=[input() for i in range(m)]
card=[v for v in range(1,n*2+1)]
for k in ks:
    if k==0:
        tmp=[]
        c1,c2=card[:n],card[n:]
        for i in range(n):
            tmp+=[c1[i],c2[i]]
        card=tmp
    else:
        card=card[k:]+card[:k]

for v in card:
    print v

Measured memory_bytes: 4284
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <limits>//setprecision
#include <iomanip>
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set,multiset
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#include <numeric> //accumulate,,,
//#define endl "\n";
using namespace std;

const long long INF = 4000000000000000001;
const int inf = 1001001001;
long long MOD = 998244353;

void chmax(long long &a,long long b){if(a < b) a = b;}
void chmin(long long &a,long long b){if(a > b) a = b;}

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //When end-of-a bit is 1, times simple N.
    if (M & 1) res = (res * N) % MOD;
    return res %= MOD;
}
long long gcd(long long a, long long b) {
    if (b == 0) return a; else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

//dp[i]:そのマスへの来方の総和
long long dp[200005];
long long rui[200005];

int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    long long N;int K;cin >> N >> K;
    vector<pair<int,int>> move(K);
    for(int i = 0;i<K;i++) cin >> move.at(i).first >> move.at(i).second;
    for(int i = 0;i<200005;i++) dp[i] = 0,rui[i] = 0;
    dp[0] = 1;rui[1] = 1;
    for(int i = 0;i<N;i++){
        for(pair<int,int> P : move){
            int left = max(i-P.second,0),right = max(i-P.first+1,0);
            dp[i] += rui[right]-rui[left];
            dp[i] %= MOD;
            if(dp[i] < 0) dp[i] += MOD;
        }
        //cout << dp[i] << " ";
        rui[i+1] = rui[i]+dp[i];
        rui[i+1] %= MOD;
        if(rui[i+1] < 0) rui[i+1] += MOD;
    }
    //for(int i = 0;i<=N;i++) cout << dp[i] << " ";
    //cout << endl;
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 6764
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double a = scan.nextDouble();
        double b = scan.nextDouble();
        double h = scan.nextDouble();
        double m = scan.nextDouble();
        double naga = m * 360 / 60;
        double miji = (h * 60 + m) * 360 / (12 * 60);
        double kaku = miji - naga;
        double result = Math.sqrt(a*a + b*b - 2*a*b* Math.cos(Math.toRadians(kaku)));
        System.out.println(result);

    }
}

Measured memory_bytes: 37116
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MAX 1010

struct poi {
	int x, y, z;	
}v[MAX];

int t[5];

bool cmp(poi a, poi b) {
	int t1 = (a.x * t[1]) + (a.y * t[2]) + (a.z * t[3]);
	int t2 = (b.x * t[1]) + (b.y * t[2]) + (b.z * t[3]);
	
	return t1 > t2;
}

int n, m;
int ans = 0;

int32_t main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> v[i].x >> v[i].y >> v[i].z;
	}
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 3; j++) {
			if (i & (1 << j)) 
				t[j + 1] = -1;
			else
				t[j + 1] = 1;
		}		
		sort(v, v + n, cmp);
        
		int xx = 0, yy = 0, zz = 0;
		for (int j = 0; j < m; j++) {
			xx += (v[j].x * t[1]);
            yy += (v[j].y * t[2]);
            zz += (v[j].z * t[3]);
		}
        ans = max(ans, abs(xx) + abs(yy) + abs(zz));
	}
	cout << ans << '\n';
	return 0;
}	


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>

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

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;

const ll INF = LONG_LONG_MAX;

int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    int N,C;
    cin >> N >>C;
    vector<vint> clist(C,vint(2*112345,0));
    repeat(i, N){
        int s,t,c;
        cin >> s >> t >> c;
        s *= 2;
        t *= 2;
        c--;
        clist[c][s-1] += 1;
        clist[c][t] += -1;
    }
    repeat(c, C){
        repeat(t, 2*112345){
            clist[c][t+1] += clist[c][t];
        }
        repeat(t, 2*112345){
            clist[c][t+1] = clist[c][t+1]>0;
        }
    }
    int ans = 0;
    repeat(t, 2*112345){
        int num=0;
        repeat(c, C){
            num += clist[c][t];
        }
        ans = max(ans,num);
    }
    cout << ans << endl;
    return 0;
}



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

int main(){
    int N,ans;
    cin >> N;
    vector<int> H(N);
    for(int i = 0;i < N;i++){
        cin >> H[i];
    }
    ans = 0;
    int cnt = 0;
    for(int i = 1;i < N;i++){
        if(H[i] <= H[i-1]){
            cnt += 1;
            ans = max(ans,cnt);
        }else{
            cnt = 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
// Problem : B - Tag
// Contest : AtCoder - Tokio Marine & Nichido Fire Insurance Programming Contest 2020
// URL : https://atcoder.jp/contests/tokiomarine2020/tasks/tokiomarine2020_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db long double
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define mi map<int,int>
#define ml map<ll,ll>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define MAX 4294967295
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define MAXN 15000005
#define inf 1e10
#define PI acos(-1.0)
#define int long long

void solve(){
    int a,v,b,w,T;
    cin>>a>>v>>b>>w>>T;
    if(v <= w){
        cout<<"NO\n";
        return;
    }
    db t = (db)abs(a-b)/(v-w);
    if(t <= T) cout<<"YES\n";
    else cout<<"NO\n";
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int t;
    //cin>>t;
    t = 1;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3608
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define deba(a) cout << #a << a << endl;
#define debab(a,b) cout << #a << a << #b << b << endl;
int main()
{
	fast;

	ll a, b, t;
	cin >> a >> b >> t;
	ll i = 1, ans = 0;
	ll k = a;
	while (a <= t)
	{
		a = k * i;
		// deba(a);
		if (a <= t)
			ans += b;
		i++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main{

	public static void main(String args[]) {

		//
		String sentence = "";
		int shuffle_times = 0;
		int shuffle_number = 0;
		StringBuffer input_sentence = null;
		String out = "";
		StringBuffer out_all = new StringBuffer(out);

		//
		Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {

			// 入力文字列
			sentence = sc.next();
			// 入力文字列が_の場合は
			if (sentence.equals("-"))
				break;

			//
			input_sentence = new StringBuffer(sentence);
			// シャッフルする回数
			shuffle_times = sc.nextInt();

			while (sc.hasNext()) {
				// シャッフル枚数
				for (int i = 0; i < shuffle_times; i++) {

					//
					shuffle_number = sc.nextInt();
					// シャッフルしてカードの上に移動するものを、取ってくる
					StringBuffer add_sentence = new StringBuffer(
							input_sentence.substring(0, (shuffle_number)));
					// 上に移動するカードを元のカード列から削除
					input_sentence = input_sentence.delete(0, (shuffle_number));
					// シャッフルしたあとカード列
					input_sentence = add_sentence.insert(0, input_sentence);

				}
				out_all = out_all.append(input_sentence + "\n");
				break;
			}

		}
		System.out.print(out_all);
	}

}

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

int main () {
  int n, x;
  static long long t[100002];

  while (cin >> n >> x) {
    for (int i = 0; i < n; i++) {
      cin >> t[i];
    }

    long long ans = 0;

    for (int i = 1; i < n; i++) {
      long long sum = t[i] + t[i - 1];
      long long remove = max(0LL, sum - x);

      ans += remove;

      t[i] = max(0LL, t[i] - remove);
    }

    cout << ans << endl;
  }
}

Measured memory_bytes: 1024
/*
  The Island Was Silent before.
  .....
  And One day again it became Silent.
*/
#include<bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ll  long long
#define modd(a,b) ((a+2*b)%b)
#define debug(a) cout << #a << ": " << (a) << "\n"
#define ioso ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define rtt cerr << "Time: " << clock()*1.0 / CLOCKS_PER_SEC << endl;
#define ffe freopen("input.txt","r",stdin), freopen("output.txt","w",stdout);
int cots[100010];
int dp[100010]; 
ll path(ll u) {
  if(u==0) {return 2e8;}
  if(u==1) {return 0;}

  if(dp[u]!=-1) {
    return dp[u];
  }

  return dp[u] = min(path(u-1)+abs(cots[u-1]-cots[u]), path(u-2)+abs(cots[u-2]-cots[u]));
  //cout << u << " " << dp[u];

}

int main() {
  ioso
  #ifndef ONLINE_JUDGE
  ffe
  #endif
  ll n; cin >> n;
  memset(dp,-1,sizeof(dp));
  for(int i=1;i<=n;i++) {
    cin >> cots[i];
  }

  cout << path(n) << endl;
  

}

Measured memory_bytes: 6724
#include <stdio.h>
#include <string.h>

int main()
{
    char o[51], e[51], pass[101];
    scanf("%s", o);
    scanf("%s", e);
    int i;
    for (i=0; i<strlen(o); i++)
    {
        pass[2*i] = o[i];
    }
    for (i=0; i<strlen(e); i++)
    {
        pass[2*i+1] = e[i];
    }
    pass[strlen(o) + strlen(e)] = '\0';
    printf("%s\n", pass);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            int x = sc.nextInt();
            int y = sc.nextInt();
            
            if( x == 0 && y == 0 )
                break;
            if(x < y)
                System.out.println(x + " " + y);
            else
                System.out.println(y + " " + x);
        }
    }
}


Measured memory_bytes: 35888
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))

typedef struct edge{ll s,g,c;}E;
E e[2010];
ll d[1010];
int n,m;

void berumanfoodo(ll n,ll s){
	rep(i,0,n)d[i]=i==s?0:INF;
	rep(nnnn,0,n-1)rep(i,0,m)if(d[e[i].s]!=INF)d[e[i].g]=min(d[e[i].g],d[e[i].s]+e[i].c);
	rep(nnnn,0,n)rep(i,0,m)if(d[e[i].s]!=INF){
		if(d[e[i].g]>d[e[i].s]+e[i].c)d[e[i].g]=-INF;
	}
}

int main(){
	scanf("%d%d",&n,&m);
	rep(i,0,m){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		a--;
		b--;
		e[i].s=a;
		e[i].g=b;
		e[i].c=-c;
	}
	berumanfoodo(n,0);
	if(d[n-1]==-INF)puts("inf");
	else printf("%lld\n",-d[n-1]);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int output=0;
    string str;
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> str;
	for(int i=0;i<6;i++){
		if(str[i]=='1') output++;
	}
	cout << output << "\n";
}

Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let (k, s) = get!(i64, i64);
    let mut ans = 0;
    for x in 0..k+1 {
        for y in 0..k+1 {
            let z = s - (x + y);
            if z >= 0 && z <= k {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


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



int main(){
    string a,b;
    cin >> a >> b;
    bool e = true;
    if(a.size()>b.size()){
        cout << "GREATER" << endl;
        e = false;
    }else if(a.size()<b.size()){
        cout << "LESS" << endl;
        e = false;
    }else{
        for(int i=0;i<a.size();i++){
            if(a.at(i)>b.at(i)){
                cout << "GREATER" << endl;
                e = false;
                break;
            }else if(a.at(i)<b.at(i)){
                cout << "LESS" << endl;
                e = false;
                break;
            }else if(a.at(i)==b.at(i)){
                continue;
            }
        }
    }
    if(e) cout << "EQUAL" << endl;
}
    

Measured memory_bytes: 3612
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = MAP()
M = N - K
A = [0] + LIST()

# dp[i][j] := 列をi個使って、最後に使ったのがj列目の時の最小コスト
dp = list2d(M+1, N+1, INF)
dp[0][0] = 0
for i in range(1, M+1):
    for j, h1 in enumerate(A):
        for k in range(max(j-N, 0), j):
            h2 = A[k]
            dp[i][j] = min(dp[i][j], dp[i-1][k] + max(h1 - h2, 0))
print(min(dp[M]))


Measured memory_bytes: 44124
#include<iostream>
using namespace std;
int main(){
	long N;
	cin >> N;
	long sum = 0,num[10000];
	for (int i = 0; i < N; i++){
		cin >> num[i];
		sum = sum + num[i];
	}
	long max0=num[0], min0=num[0];
	for (int i = 0; i < N; i++){
		if (max0 < num[i]){
			max0 = num[i];
		}
		if (min0 > num[i]){
			min0 = num[i];
		}
	}
	cout << min0 << " " << max0 << " " << sum << endl;
	return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    while(K--) {
        if(B <= A) {
            B *= 2;
            continue;
        }
        C *= 2;
    }
    if(A < B and B < C) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

int main() {
	int n, ans = 0;
	cin >> n;
	vector<int> c(n), v(n);
	for (int i = 0; i < n; ++i) cin >> v[i];
	for (int i = 0; i < n; ++i) cin >> c[i];
	for (int i = 0; i < n; ++i) {
		if (v[i] > c[i]) ans += v[i] - c[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int H, R;
	if (scanf("%d%d", &H, &R) != 2) return 1;
	if (H < -R) {
		puts("-1");
	} else if (H == -R) {
		puts("0");
	} else {
		puts("1");
	}
	return 0;
}



Measured memory_bytes: 2124
from sys import stdin


def mod(val):
    res = val % (10 ** 9 + 7)
    if (res < 0):
        res += (10 ** 9 + 7)
    return res


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    A_arr = list(map(int, _in[1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    A_arr_mod = [0] * len(A_arr)
    for i, a in enumerate(A_arr):
        A_arr_mod[i] = mod(a)

    ans = 0
    cache = sum(A_arr_mod)
    for i in range(N-1):
        cache -= A_arr_mod[i]
        ans += A_arr_mod[i] * cache
        ans = mod(ans)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)


if __name__ == "__main__":
    main()


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

const int INF = 1e9 + 10;

int N;

int main() {
    cin >> N;
    vector<ll> a(N);
    rep(i,N)  {
        cin >> a[i];
        if (a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    ll res = 1LL;
    rep(i,N) {
        if (res <= 1000000000000000000 / a[i]) {
            res *= a[i];
        } else {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << res << endl;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n;
  cin >> n;
  string s = "";

  while (n != 0) {
    if (n & 1)
      s = "1" + s, n--;
    else
      s = "0" + s;
    n /= -2;
  }
  
  if (s == "") s = "0";
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int ans = 0;
        int [] b = new int [a+1];
        b[0]=100000;
        b[a]=100000;
        for(int i=1;i<a;i++){
                             b[i] = sc.nextInt();
                            }
        for(int i=0;i<a;i++){ans+=Math.min(b[i],b[i+1]);
                            }       
		System.out.println(ans);
	}
}


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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,a,n) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20
#define INF 1e12+20

typedef long long ll;
using namespace std;

int n,a,b;
int main() {
    cin >> n >> a >> b;
    a = n-a;
    n = a/b;
    n = a-(n*b);
    pout(n);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (ll)1e9 //10^9:∞
#define LLINF (ll)1e12
#define MOD (ll)(1e9+7) //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)
#define endl "\n"

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	ll N, K;
	cin >> N >> K;

	vector<int> a(N);
	REP(i, N)cin >> a[i];

	vector<int> seen(N + 1, -1); //seen[i]:=街iに来た番数
	vector<int> repeat;

	int c = 1, l = 0;

	{
		int v = 1;
		while (seen[v] == -1) {
			seen[v] = repeat.size();
			repeat.emplace_back(v);
			v = a[v - 1]; //0indexだからv-1
		}
		c = repeat.size() - seen[v];
		l = seen[v];
	}

	if (K < l) cout << repeat[K] << endl;
	else {
		K -= l;
		K %= c;
		cout << repeat[l + K] << endl;
	}




	return 0;
}


Measured memory_bytes: 5848
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define MOD_Q 998244353
#define PI 3.14159265358979
#define ll long long
using namespace std;



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

	printf("%d", a * b);

	return 0;
}



Measured memory_bytes: 3712
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const int MOD = 1e9 + 7;









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

	int mx;
	if (n % 2 == 0) {
		mx = n / 2;
	}
	else {
		mx = (n + 1) / 2;
	}


	if (mx >= k) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	
	return 0;
}


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

using namespace std;

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back

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

int read(){
	int i;
	scanf("%d",&i);
	return i;
}

vector<int> tree[2000];

void dfs(int v,int p,int x,int& dx,int y,int& dy,int d){
	if(d<=x)
		dx++;
	if(d==y)
		dy++;
	for(auto c:tree[v])
		if(c!=p)
			dfs(c,v,x,dx,y,dy,d+1);
}

int Calc(int c,int x,int y){
	int res=1;
	int ad=0;
	for(auto v:tree[c]){
		int w=0;
		dfs(v,c,x,res,y,w,1);
		ad=max(ad,w);
	}
	return res+ad;
}

int main(){
	int n=read(),k=read();
	REP(i,n-1){
		int a=read()-1,b=read()-1;
		tree[a].PB(b);
		tree[b].PB(a);
	}
	int ans=0;
	REP(i,n)
		ans=max(ans,Calc(i,k/2,k%2?(k+1)/2:INT_MAX));
	printf("%d\n",n-ans);
}

Measured memory_bytes: 512
#include <stdio.h>
#include <utility>

constexpr int UB = 1e9+1;
long long int getSQRT(long long int A){
    long long int ok = 0, ng = UB;
    while(ng - ok > 1){
        long long int mid = (ok+ng) >> 1;
        if(mid * mid < A) ok = mid;
        else ng = mid;
    }
    return ok;
}


int main(void){
    int Q; scanf("%d", &Q);
    while(Q--){
        int a, b; scanf("%d%d", &a, &b);
        if(a > b) std::swap(a, b);
        // a ≤ bとしても一般性を失わない
        // 明らかに, a-1ペアを作ることはできる, そして明らかに解はb-1以下
        // 1 ~~~> ab-1と組めば良い
        // 2 ~~~> floor(ab/2)と組めば良い
        // 3 ~~~> floor(ab/3)と組めば良い
        // ....
        // t^2 ≤ ab なる整数とする
        // 1 -> ab-1
        // 2 -> small(ab/2)
        // 3 -> small(ab/3)
        // ....
        // t -> small(ab/t)
        // それ以降は被ってしまう : 逆向きもそう ; t ≤ ab/tであるから被りもしない ? 
        // (1, ab-1), ..., (T, T or T+1?)
        // (ab-1, 1), ..., (T, T or T+1?)   <= ここに (a, b)が入るのか ? Tの部分で被りあるかも？
        // (a, b)は近くなければ, 余裕がそれなりにあるのでワンチャンセーフでは？
        //     e.g. T-1 -> T, T+1 ok
        // でも, T = aみたいなケースだと厳しい
        // どんなとき? a^2 < a*(a+1) < a*(a+2) < (a+1)^2
        // 差が2以下の時
        // a == b ----> (1, a^2-1), ..., (a-1, a+1)で組めば良い : 2a-2
        // a == b + 1 ---> (1,x)...., (a-1, a+1), (x, 1), ...., (a+1, a-1); 2a-2
        // a == b + 2 ---> (1,x)...., (a-1, a+1), (x,1)...(a+2,a) : 2a-1
        // それ以外なら, a, bの混入を気にせず基本的に上記の方法でやれば良い
        // (T-1, ...., T+1 or T) : T - T+1がい毛ないなら-1組
        long long int K = a; K *= b;
        long long int T = getSQRT(K);
        if(b - a <= 2){
            if(a == b or a + 1 == b) printf("%d\n", 2 * a - 2);
            else printf("%d\n", 2 * a - 1);
        }
        else if(T * (T+1) < K){
            printf("%lld\n", 2 * T - 1);
        }
        else printf("%lld\n", 2 * T - 2);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std ;
int main()
{
    int a ,b;
   
    cin>>a;
    cin>>b;
    if(a>b)
    {
        for(int c=a;c>0;c--)
        cout<<b;
        
    }
    else if (b>=a)
    {
        for(int c=b;c>0;c--)
        cout<<a;
    }
}


Measured memory_bytes: 256
//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

inline void scani(int& x){
	scanf("%d",&x);
}

//end of macro

const ll MOD = 1e9 + 7;

inline ll addmod(ll a, ll b){
    return (a+b)%MOD;
}
inline ll mulmod(ll a, ll b){
    return (a*b)%MOD;
}
inline ll expmod(ll a, ll b){
    ll ret = 1;
    while(b){
        if(b & 1)ret = mulmod(ret, a);
        a = mulmod(a, a);
        b >>= 1;
    }
    return ret;
}

const int N = 1e5 + 5;

int n;
string str;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);
    
    cin>>str;
    n = str.size();
    int ans = 0;
    int pre1 = 0;
    FOR(i,n){
        if(str[i] == '1'){
            ans = addmod(ans, mulmod(expmod(2, pre1), expmod(3, n-i-1)));
            pre1++;
        }
    }
    
    ans = addmod(ans, expmod(2, pre1));
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 512
n, a, b, c = map(int, input().split())
L = [int(input()) for _ in range(n)]
INF = 10**8


def dfs(current_index, sum_a, sum_b, sum_c):
    if current_index == n:
        if min(sum_a, sum_b, sum_c) > 0:
            return sum(abs(x-y) for x, y in
                       zip([a, b, c], [sum_a, sum_b, sum_c]))-30
        else:
            return INF

    cost_none = dfs(current_index+1, sum_a, sum_b, sum_c)
    cost_a = dfs(current_index+1, sum_a+L[current_index], sum_b, sum_c)+10
    cost_b = dfs(current_index+1, sum_a, sum_b+L[current_index], sum_c)+10
    cost_c = dfs(current_index+1, sum_a, sum_b, sum_c+L[current_index])+10
    return min(cost_none, cost_a, cost_b, cost_c)

print(dfs(0, 0, 0, 0))

Measured memory_bytes: 3064
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a=`dd`.split().map(&:to_i)
puts (a[0]+a[1])*a[2]/2

Measured memory_bytes: 2044