akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define ll unsigned long long
using namespace std;
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main(){
    ll X;
    cin>>X;
    for(;;){
        if(IsPrime(X))break;
        X++;
    }
    cout<<X<<endl;
}


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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
        #define eprintf(...) 42
#endif

#define int long long

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

int par[100000], rnk[100000], siz[100000];

void init(int n)
{
  for(int i = 0; i < n; i++){
    par[i] = i;
    rnk[i] = 0;
    siz[i] = 1;
  }
}

int find(int x)
{
  if(par[x] == x) return x;
  return par[x] = find(par[x]);
}

void unite(int x, int y)
{
  x = find(x);
  y = find(y);
  if(x == y) return;

  if(rnk[x] < rnk[y]){
    par[x] = y;
    siz[y] += siz[x];
  }else{
    par[y] = x; 
    siz[x] += siz[y];
    if(rnk[x] == rnk[y]) rnk[x]++;
  }
}

bool same(int x, int y)
{
  return find(x) == find(y);
}

int ufsize(int x)
{
  return siz[find(x)];
}

signed main()
{
  int n, m;
  cin >> n >> m;

  vi a(m), b(m);
  rep(i, m){
    cin >> a[i] >> b[i];
  }

  reverse(all(a));
  reverse(all(b));

  init(n);
  vl ans;
  ll cnt = n*(n-1)/2;
  ans.pb(cnt);
  rep(i, m-1){
    if(!same(a[i], b[i])){
      cnt -= ufsize(a[i])*ufsize(b[i]);
      unite(a[i], b[i]);
    }
    ans.pb(cnt);
  }

  reverse(all(ans));

  rep(i, m){
    cout << ans[i] << endl;
  }

  return 0;
}


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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i > (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x)            \
	for (auto &youso_ : (x)) \
	cin >> youso_
#define mp make_pair
#define All(a) (a).begin(), (a).end()
template <typename T = long long>
inline T IN()
{
	T x;
	cin >> x;
	return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail)
{
	cin >> head;
	CIN(move(tail)...);
}
#define CINT(...)    \
	int __VA_ARGS__; \
	CIN(__VA_ARGS__)
#define LCIN(...)   \
	ll __VA_ARGS__; \
	CIN(__VA_ARGS__)
#define SCIN(...)       \
	string __VA_ARGS__; \
	CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int A, B;

int main()
{
	cin >> A >> B;
	int ans = 0;
	REP(i, 2)
	{
		if (A >= B)
		{
			ans += A;
			A--;
		}
		else
		{
			ans += B;
			B--;
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a,b,k,i,c=0;
  scanf("%d%d%d",&a,&b,&k);
  for(i=a;1<=i;i--){
    if(a%i==0&&b%i==0)c++;
    if(k==c)break;
  }
  printf("%d",i);
  return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= 9; ++i) {
    for (int j = 1; j <= 9; ++j) {
      if (i * j == n) {
	puts("Yes");
	return 0;
      }
    }
  }
  puts("No");
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int i, n, s[13], h[13], c[13], d[13];
    cin >> n;
    for(i = 0; i < 13; i++){
        s[i] = 1;
        h[i] = 1;
        c[i] = 1;
        d[i] = 1;
    }
    char m;
    int t;
    for(i = 0; i < n; i ++){
        cin >> m >> t;
        if(m == 'S'){
            s[t-1] = 0;
        }else if(m == 'H'){
            h[t-1] = 0;
        }else if(m == 'C'){
            c[t-1] = 0;
        }else if(m == 'D'){
            d[t-1] = 0;
        }
    }
    for(i = 0; i < 13; i++){
      if(s[i]){cout << 'S' << " "<< i+1 << endl;}
    }
    for(i = 0; i < 13; i++){
      if(h[i]){cout << 'H' << " "<< i+1 << endl;}
    }
    for(i = 0; i < 13; i++){
      if(c[i]){cout << 'C' << " " <<  i+1 << endl;}
    }
    for(i = 0; i < 13; i++){
      if(d[i]){cout << 'D' << " " <<  i+1 << endl;}
    }
}


Measured memory_bytes: 3080
#include <iostream>
#include <set>
#include <string>

using namespace std;

int main()
{
	int test;
	cin >> test;
	set<string> s;
	string str(test, 0);
	for (int i = 0; i < test; i++) {
		cin >> str;
		s.insert(str);
	}
	cout << (int) s.size() << endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 19220
def gcd(a, b):
    if a < b:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a

k = int(input())
sum = 0

for i in range(1, k + 1):
    for j in range(1, k + 1):
        gcd_ij = gcd(i, j)
        for k in range(1, k + 1):
            sum += gcd(gcd_ij, k)
print(sum)

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

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

  double n;
  cin >> n;

  vector<int> vc;

  int count = 0;

  for(int i = 0; i < n+1; i++){
    vc.push_back(i);
    if(i%2 != 0){
      count = count + 1;
    }
  }

  double ans = count/n;

  cout << ans;



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vmax 10000
constexpr ll inf = 1e18+7;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

int main(){
  cout<<fixed<<setprecision(20);
  cin.tie(0);ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vector<int> a(n),b(n,0);
  rep(i,n){
    cin>>a[i];
    b[i]=a[i];
  }
  SORT(b);
  rep(i,n){
    if(a[i]<=b[n/2-1]){
      cout<<b[n/2]<<endl;
    }else{
      cout<<b[n/2-1]<<endl;
    }
  }
  return 0;
}


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

using namespace std;
int main() {
  int r;
  cin >> r;
  if (r < 1200) cout << "ABC" << endl;
  if (1200 <= r && r < 2800) cout << "ARC" << endl;
  if (2800 <= r) cout << "AGC" << endl;
  return 0;
}

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

using namespace std;

int main(void){

  string taro,hanako;
  while( cin >> taro >> hanako ){
    if( taro == hanako && taro == "0" )break;

    int hit = 0;
    int blow = 0;
    for( int i = 0 ; i < 4 ; i++ ){
      for( int j = 0 ; j < 4 ; j++ ){
	if( i != j && taro[i] == hanako[j] ){
	  hit++;
	}
	if( i == j && taro[i] == hanako[j] ){
	  blow++;
	}
      }
    }
    cout << blow << " " << hit << endl;

  }
  return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define FFOR(i, a, b) for(int (i)=a;(i)>(b);--(i))
#define rrep(i,n) FFOR(i,0,n)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define lb long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 1234567890123456
typedef pair<int, int> P;
typedef pair<int, P> PP;

const int maxn =1e5 + 10;

//initialization here
//

//
//initialization finish


// your function is here
//

//
// your function finished

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// your code is here
	//

	ll a,b;cin>>a>>b;
	if(a == 1 &&b == 1)Print(1);
	else if(a== 1 || b ==1)
	{
		int tate = a+b-1;
		Print(tate-2);
	}
	else
	{
		Print((a-2)*(b-2));
	}
	//
	// your code finished


	return 0;
}

Measured memory_bytes: 256
use proconio::input;

const INF:i32 = 1000000000;
fn main() {
    input! {
        n:usize,
        m:usize,
        x:i32,
        ca:[(i32,[i32;m]);n],
    };

    let mut ans:i32 = INF;

    for bit in 0..(1<<n) {
        let mut price = 0;
        let mut smart = vec![0i32;m];
        for i in 0..n {
            if (bit>>i)&1==1 {
                price+=ca[i].0;
                for j in 0..m {
                    smart[j] += ca[i].1[j]
                }
                
            }
        }
        if smart.iter().fold(true,|isok,&s| isok && s>=x) {
            ans = std::cmp::min(price,ans);
        }
    }

    if ans >= INF {
        println!("-1");
    }
    else{
        println!("{}",ans);
    }

}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  
  ll ans=0;
  ll pos=0;
  while(pos<n){
    ll sum=0;
    while(pos<n&&a[pos]!=0){
      sum+=a[pos];
      pos++;
    }
    ans+=sum/2;
    pos++;
  }
  
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		while (true) {
			int n = sc.nextInt();
			if (n == 0) break;
			
			Bridge[] bridge = new Bridge[n];
			for (int i = 0; i < n; i++) {
				bridge[i] = new Bridge(sc.nextInt(), sc.nextInt());
			}
			Arrays.sort(bridge);
			
			boolean flag = true;
			int bag = 0;
			for (int i = 0; i < n; i++) {
				bag += bridge[i].tre;
				if (bag > bridge[i].max) {
					flag = false;
					break;
				}
			}
			if (flag) {
				out.println("Yes");
			} else {
				out.println("No");
			}
		}
		out.flush();
	}
	
	static class Bridge implements Comparable<Bridge> {
		int tre, max;
		
		public Bridge(int tre, int max) {
			this.tre = tre;
			this.max = max;
		}
		
		@Override
		public int compareTo(Bridge b) {
			return this.max - b.max;
		}
		
	}
	
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) return false;
		}
		return true;
	}
	
	private byte readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	
	private boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}
	
	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}
	
	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}
	
	public int nextInt() {
		if (!hasNext()) { throw new NoSuchElementException(); }
		int n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) { throw new NumberFormatException(); }
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
}

Measured memory_bytes: 24576
from collections import deque
n = int(input())

g = [[] for i in range(n)]

for i in range(n-1):
  u, v, w = map(int, input().split())
  u, v  = u-1, v-1
  g[u].append([v, w])
  g[v].append([u, w])

c = [-1]*n
c[0] = 0

queue = deque([0])

while queue:
  x = queue.popleft()
  for x_, w_ in g[x]:
    if c[x_] == -1:
      if w_%2 == 0:
        c[x_] = c[x]
      else:
        c[x_] = 1-c[x]
      queue.append(x_)
    else:
      continue
for x in c:
  print(x)
    
  



Measured memory_bytes: 83360
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	int[] r = new int[n];
	for (int i = 0; i < n; i++) {
	    r[i] = Integer.parseInt(scan.nextLine());
	}
	int max = r[1] - r[0];
	int min = r[0];
	for (int i = 1; i < n; i++) {
	    if (max < r[i] - min){
		max = r[i] - min;
	    }
	    if (min > r[i]){
		min = r[i];
	    }
	}
	System.out.println(max);
    }
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
#define all(v) begin(v),end(v)
#define pb push_back
#define inf (1e9)
#define eps (1e-9)

typedef long long Integer ;
typedef long double Real;
const Real PI = acosl(-1);
typedef pair<int, int> P;

template<class S, class T> inline
ostream& operator<<(ostream&os, pair<S,T> p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template<class S, class T, class U> inline
ostream& operator<<(ostream&os, tuple<S,T,U> t) {
  return os << '('
    << get<0>(t) << ", "
    << get<1>(t) << ", "
    << get<2>(t) << ')';
}

template<class T> inline
ostream& operator<<(ostream&os, set<T> v) {
  os << "(set";
  for (T item: v) os << ' ' << item;
  os << ")";
  return os;
}

template<class T> inline
ostream& operator<<(ostream&os, vector<T> v) {
  if (v.size() == 0) { return os << "(empty)"; }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

template<class T> inline
istream& operator>>(istream&is, vector<T>&v) {
  rep (i, v.size()) is >> v[i];
  return is;
}

//           ^   >  v   <
int dx[] = { -1, 0, 1,  0 };
int dy[] = {  0, 1, 0, -1 };

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<bool> vb;

int table[11][331];
bool used[10];

void search(int len, int d, int sum) {
  if (len == d) table[len][sum]++;
  else {
    rep (i, 10) {
      if (used[i]) continue;
      used[i] = true;
      search(len, d+1, sum + i * (d+1));
      used[i] = false;
    }
  }
}

void dp(int len) {
  rep (i, 10) used[i] = false;
  search(len, 0, 0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout.setf(ios::fixed);
  cout.precision(10);
  random_device dev;
  mt19937 rand(dev());

  rep (i, 10) {
    dp(i+1);
  }

  int n,s;
  while (cin >> n >> s) {
    if (s > 330) {
      cout << 0 << endl;
    } else {
      cout << table[n][s] << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 1260
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<string>
#include<set>
#include<string>
#include<climits>
using namespace std;

static int a, b, c;


int main()
{
	while (scanf("%d%d%d", &a, &b, &c) != EOF)
	{
		printf(c >= a&&c <= b ? "Yes\n" : "No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)

int main() {
    int a, b, k; cin >> a >> b >> k;
    int table[101] = {0};
    rrep(i, 1, a + 1) if (a % i == 0) table[i]++;
    rrep(i, 1, b + 1) if (b % i == 0) table[i]++;
    int c = 0;
    for (int i = 100; i >= 1; --i) {
        if (table[i] == 2) {
            c++;
            //cout << i << endl;
        }
        if (c == k) {
            cout << i << 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 N = sc.nextInt();
        long[] H = new long[N];
        int ans = 0;

        for (int i = 0; i < N; i++) {
            H[i] = sc.nextLong();
        }

        int count = 0;
        for (int i = 1; i < N; i++) {
            if (H[i - 1] >= H[i]) {
                count++;
            } else {
                ans = Math.max(count, ans);
                count = 0;
            }
        }
        ans = Math.max(count, ans);

        System.out.println(ans);
    }
}

Measured memory_bytes: 50392
#include <iostream>

using namespace std;

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

	switch (N % 10) {
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		cout << "hon" << endl;
		break;
	case 0:
	case 1:
	case 6:
	case 8:
		cout << "pon" << endl;
		break;
	case 3:
		cout << "bon" << endl;
		break;
	}
}


Measured memory_bytes: 3676
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;

#define NMAX 200000
#define M 17

int N;
PII robots[NMAX];
int table[NMAX][1 + M];

// O(lgN)
int query(int L, int R) {
  if (L > R) return -1;
  auto N = R - L + 1;
  int i = 0;
  while ((1 << i) <= N) i++;
  i--;
  return max(table[L][i], table[R - (1 << i) + 1][i]);
}

int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  cin >> N;
  for (int i = 0; i < N; i++) cin >> robots[i].first >> robots[i].second;
  sort(robots, robots + N);
  for (int i = N; --i >= 0; ) {
    int e = lower_bound(robots + i, robots + N, PII(robots[i].first + robots[i].second, 0)) - robots - 1;
    table[i][0] = max(e, query(i + 1, e));
    for (int j = 1; j <= M; j++) {
      table[i][j] = table[i][j - 1];
      auto k = i + (1 << (j - 1));
      if (k < N) table[i][j] = max(table[i][j], table[k][j - 1]);
    }
    //cout << i << " " << table[i][0] << endl;
  }





  vector <int> dp;
  dp.resize(N + 1);
  dp[N] = 1;

  for (int i = N - 1; i >= 0; --i) {
    //cout << "R[" << i << "] = " << R[i] << endl;
    if (table[i][0] + 1 < dp.size()) {
      dp[i] = (dp[i + 1] + dp[table[i][0] + 1]) % 998244353;
    }
    else {
      dp[i] = (dp[i + 1] + 1) % 998244353;
    }
    //cout << "dp[i] = " << dp[i] << endl;
  }

  cout << dp[0] << endl;
  return 0;
}

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


int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  rep(i,n){
    cin >> vec[i];
  }
  int ans;
  ans = 0;
  
  for(int i = 1; i < n - 1; i++){
    if(vec[i-1] < vec[i] && vec[i] < vec[i+1]){
      ans++;
    }
    else if(vec[i-1] > vec[i] && vec[i] > vec[i+1]){
      ans++;
    }
   }
            cout << ans;
  return 0;
}

Measured memory_bytes: 3596
#include<cmath>
#include<iostream>

#define	PI	3.14159265358979

using namespace std;

int main()
{
	double r=6378.1;
	while(1){
		double lat[2],lng[2];
		for(int i=0;i<2;i++)	cin>>lat[i]>>lng[i];
		if(lat[0]==-1 && lat[1]==-1 && lng[0]==-1 && lng[1]==-1)	break;
		for(int i=0;i<2;i++)	lat[i]*=PI/180,lng[i]*=PI/180;
		double chord=r*sqrt(2*(1-cos(lat[0])*cos(lat[1])*cos(lng[0]-lng[1])-sin(lat[0])*sin(lat[1])));
		cout<<(int)(2*r*asin(chord/(2*r))+0.5)<<endl;
	}
	return 0;
}

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

int main() {
	vector<int> count;
	int n;
	while (cin >> n) {
		int r = 0;
		for (int a = 0; a < 10; a++) {
			for (int b = 0; b < 10; b++) {
				for (int c = 0; c < 10; c++) {
					for (int d = 0; d < 10; d++) {
						if (a + b + c + d == n) r++;
					}
				}
			}
		}
		count.push_back(r);
	}
	for (int i = 0; i < count.size(); i++) {
		cout << count[i] << endl;
	}
}

Measured memory_bytes: 1216
#pragma region include
#include <stdio.h>
#include <string>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <bitset>
#include <cmath>
#include <tuple>
#pragma endregion
using namespace std;

#pragma region 定数
#define INF_VAL (2147483647 - 1)
#define INF_VAL_MINUS -INFVAL
#pragma endregion

#pragma region マクロ
// 型
#define ll long long

// 配列の長さを取得する(ただし関数内ではポインタサイズに注意)
#define SIZE_OF_ARRAY(array) sizeof(array) / sizeof(*array)

// for文
#define forn(i, size) for (long long(i) = 0; (i) < (size); (i)++)
#define for0(size) for (long(i) = 0; (i) < (size); (i)++)

// ソート
#define Sort(array, length) sort(array, array + length)
#define SortDESC(array, length, type_name) sort(array, array + length, std::greater<type_name>())

// 配列の最大値、最小値取得
#define MAX_OF_ARRAY(array, length) *max_element(array, array + length)
#define MIN_OF_ARRAY(array, length) *min_element(array, array + length)

// 結果出力系
#define YES                    \
    {                          \
        cout << "YES" << endl; \
        return 0;              \
    }
#define NO                    \
    {                         \
        cout << "NO" << endl; \
        return 0;             \
    }
#define Yes                    \
    {                          \
        cout << "Yes" << endl; \
        return 0;              \
    }
#define No                    \
    {                         \
        cout << "No" << endl; \
        return 0;             \
    }
#define println(str) cout << str << endl;

#pragma endregion

#pragma region Utility
#pragma region 配列要素の合計値を取得
template <typename T>
T getSum(T array[], int length)
{
    T sum = 0;
    for (int i = 0; i < length; i++)
    {
        sum += array[i];
    }
    return sum;
}
#pragma endregion

#pragma region ToString(int)
string ToString(int i)
{
    char buffer[1000];
    sprintf(buffer, "%d", i);
    return string(buffer);
}
#pragma endregion

#pragma region 10進数からN進数(<= 10) へ変換
string convertToN(long n, int base)
{
    string ans = "";
    while (n != 0)
    {
        int temp = n % base; // 1桁取得
        ans = ToString(temp) + ans;
        n /= base;
    }
    return ans;
}
#pragma endregion

#pragma region 連想配列のkeyが存在するか
template <typename T>
bool containsKey(map<string, T> map, string key)
{
    if (map.count(key) == 0)
    {
        return false;
    }
    return true;
}
#pragma endregion
#pragma endregion

int main()
{
    // 標準入力から値を取得
    string S;
    cin >> S;

    for (int i = 0; i < S.size(); i+=2)
    {
        if (S[i] != 'h' || S[i + 1] != 'i')
        {
            No
        }
    }
    Yes

}


Measured memory_bytes: 256
def main():
    n = int(input())
    bit = input()[::-1]
    count = bit.count("1")
    count_plus = count+1
    count_minus = count-1
    pow_plus = [1 % count_plus]
    for i in range(n):
        pow_plus.append(pow_plus[-1]*2 % count_plus)
    if count_minus != 0:
        pow_minus = [1 % count_minus]
        for i in range(n):
            pow_minus.append(pow_minus[-1]*2 % count_minus)
    else:
        pow_minus = []

    bit_plus = 0
    bit_minus = 0

    for i in range(n):
        if bit[i] == "1":
            bit_plus = (bit_plus+pow_plus[i]) % count_plus
    if count_minus != 0:
        for i in range(n):
            if bit[i] == "1":
                bit_minus = (bit_minus+pow_minus[i]) % count_minus
    ans = []
    for i in range(n):
        if bit[i] == "1":
            if count_minus == 0:
                ans.append(0)
                continue
            bit_ans = (bit_minus-pow_minus[i]) % count_minus
            count = count_minus
        else:
            bit_ans = (bit_plus+pow_plus[i]) % count_plus
            count = count_plus
        cnt = 1
        while bit_ans:
            b = str(bin(bit_ans)).count("1")
            bit_ans = bit_ans % b
            cnt += 1
        ans.append(cnt)
    for i in ans[::-1]:
        print(i)


main()


Measured memory_bytes: 90824
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
namespace Fast_Read {
	inline void read(int &res) {
		res = 0;int tmp = 1;
		char ch = getchar();
		while (ch < '0' || ch > '9') {if (ch == '-')tmp = -1;ch = getchar();}
		while (ch >= '0' && ch <= '9')res = (res<<1)+(res<<3)+(ch^48),ch = getchar();
		res *= tmp;
	}
	inline void read(long long &res) {
		res = 0;long long tmp = 1;
		char ch = getchar();
		while (ch < '0' || ch > '9') {if (ch == '-')tmp = -1;ch = getchar();}
		while (ch >= '0' && ch <= '9')res = (res<<1)+(res<<3)+(ch^48),ch = getchar();
		res *= tmp;
	}
}
using namespace Fast_Read;
#define ll long long
const int maxn = 2e5+10;
ll a[maxn];
int n,K;
ll ans;
inline bool cmp(ll u,ll v) {return u > v;}
int main() {
	read(n);read(K);
	for (register int i = 1;i <= n;++i)read(a[i]);
	if (K >= n) {
		puts("0");
		return 0;
	}
	sort(a+1,a+1+n,cmp);
	for (register int i = K+1;i <= n;++i)
		ans += a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException {

		List<Integer> midTermExam = new ArrayList<Integer>();
		List<Integer> finalTermExam = new ArrayList<Integer>();
		List<Integer> reTest = new ArrayList<Integer>();

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while (true) {
 			String[] examInfo = br.readLine().split(" ");
 			int midScore = Integer.parseInt(examInfo[0]);
 			int finalScore = Integer.parseInt(examInfo[1]);
 			int reScore = Integer.parseInt(examInfo[2]);

			if (midScore == -1 && finalScore == -1 && reScore == -1) {
				break;
			}
			midTermExam.add(midScore);
			finalTermExam.add(finalScore);
			reTest.add(reScore);
 		}

		int listSize = midTermExam.size();
		for (int i = 0; i < listSize; i++) {
			int midScore = midTermExam.get(i);
			int finalScore = finalTermExam.get(i);
			int reScore = reTest.get(i);

			if (midScore == -1 || finalScore == -1) {
				System.out.println("F");
			} else if ((midScore + finalScore) >= 80) {
				System.out.println("A");
			} else if ((midScore + finalScore) >= 65) {
				System.out.println("B");
			} else if ((midScore + finalScore) >= 50) {
				System.out.println("C");
			} else if ((midScore + finalScore) >= 30) {
				if (reScore >= 50) {
					System.out.println("C");
				} else {
					System.out.println("D");
				}
			} else {
				System.out.println("F");
			}
		}
	}
}

Measured memory_bytes: 24216
import bisect
n=int(input())
a=list(map(int,input().split()))
a.sort()
num=a[-1]/2
b=bisect.bisect_left(a,num)
if abs(num-a[b])<abs(num-a[b-1]):
  print(a[-1],a[b])
else:
  print(a[-1],a[b-1])

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

int main(){
	char s[18];

	for(int i=0;i<19;i++){
		cin>>s[i];
		if(s[i]==',')s[i]=' ';
	}

	for(int j=0;j<19;j++)cout<<s[j];

	cout<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0LL);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(){
    ld a, b;   cin >> a >> b;
    ld res = a*b;
    ll res1 = res;
    
    cout << res1 << endl;
    
}

Measured memory_bytes: 3740
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
using P=pair<int,int>;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,a,b,c,q,k,x,y;
  vector<int> G[100005]={};
  map<P,int> edge;
  cin >> n;
  for(int i=0; i<n-1; i++) {
    cin >> a >> b >> c;
    a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
    edge[P(a,b)]=edge[P(b,a)]=c;
  }
  cin >> q >> k;
  k--;
  ll dist[100005]={};
  for(int i=0; i<100005; i++) {
    dist[i]=INF;
  }
  //kから各頂点への距離をBFSで調べる
  queue<int> que;
  dist[k]=0;
  que.push(k);
  while(!que.empty()) {
    int p=que.front();
    que.pop();
    for(auto next:G[p]) {
      if(dist[next]==INF) {
        dist[next]=dist[p]+edge[P(p,next)];
        que.push(next);
      }
    }
  }
  while(q--) {
    cin >> x >> y;
    x--,y--;
    cout << dist[x]+dist[y] << "\n";
  }
}

Measured memory_bytes: 20856
#include<bits/stdc++.h>
using namespace std;
 
#define cinsc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOR(i,k,n)  for(int64 i=k;i<(int64)n;i++)
#define FORr(i,k,n)  for(int64 i=(int64)k;i>=n;i--)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define FOREACHr(it, l) for (auto it = l.rbegin(); it != l.rend(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define SQ(x) ((x)*(x))
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
const int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//ONLINE_JUDGE   LOCAL
 
int64 powr(int64 x,int64 y,int64 p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0;
    while (y > 0){   
        if (y & 1)  
            res = (res*x) % p;   
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
} 
 
void  in_o(){
#ifndef LOCAL
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	cinsc;
}


int main(){
	//in_o();
	int a,b,c;
	cin>>a>>b>>c;
	FOR(i,0,100001){
		if(a*i%b==c%b){
			return cout<<"YES"<<endl,0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int N, M;

 cin >> N >> M;

 int a[M], b[M], c[N]={0};

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

/* for(int i=0;i<M;i++){
     cout << a[i] << b[i] << endl;
 }*/

 for(int i=0;i<N;i++){
     for(int j=0;j<M;j++){
         if(a[j]==i+1){
             c[a[j]-1]+=1;
         }
         else if(b[j]==i+1){
             c[b[j]-1]+=1;
         }
     }
     cout << c[i] << endl;
 }
 
/* for(int i=0;i<M;i++){
     cout << c[i] << endl;
 }*/
 
}

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

void countingSort(int*, int*, int, int);
int main(){
  int n; cin >> n;
  int a[n], b[n];
  int m=-1;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    m = max(m, a[i]);
  }

  countingSort(a, b, m, n);

  for(int i=0; i<n; i++){
    cout << b[i];
    if(i!=n-1) cout << " ";
  }
  cout << endl;
  return 0;
}

void countingSort(int* a, int*b, int k, int n){
  int c[k+1];
  for(int i=0; i<=k; i++) c[i]=0;

  for(int j=0; j<n; j++) c[a[j]]++;

  for(int i=1; i<=k; i++) c[i] += c[i-1];

  for(int j=n-1; j>=0; j--){
    b[c[a[j]]-1] = a[j];
    //cout << c[a[j]] << ": " << b[c[a[j]]] << endl;
    c[a[j]]--;
  }

}



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

int main(){
    const int MAX_N = 1e5 + 10;
	int N, A[MAX_N];
    cin >> N;
    for (int i = 0; i < N; ++i){
        cin >> A[i];
    }

    int B = 0;
    int h = 1;
    for (int i = 0; i < N; ++i){
        B += h*A[i];
        h *= -1;
    }

    for (int i = 0; i < N; ++i){
        cout << B << " ";
        B = 2*A[i] - B; 
    }
    cout << endl;
    return 0;
}


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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
#define ALL(x) x.begin(),x.end()
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int N;

bool f(int m,vector<ll>& A)
{
	deque<bool> used(N);
	ll curr = A [m];
	used [m] = true;
	FOR(i,0,N) if(used [i] == false){
		if(curr * 2 >= A [i]){
			curr += A [i];
			used [i] = true;
		}
		else{
			return false;
		}
	}
	return true;
}

int main()
{
	scanf("%d",&N);
	vector<ll> A(N);
	FOR(i,0,N){
		scanf("%lld",&A [i]);
	}
	sort(ALL(A));

	int ng = -1,ok = N - 1,mid;
	while(ok - ng > 1){
		mid = (ok + ng) / 2;
		if(f(mid,A)){
			ok = mid;
		}
		else{
			ng = mid;
		}
	}

	printf("%d\n",N - ok);

	return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
//#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;
typedef long double ldb;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repu(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define repc(i,a,b,c) for(i=a;i<b;i+=c)
#define repcu(i,a,b,c) for(i=a;i<=b;i+=c)
#define repcd(i,a,b,c) for(i=a;i>=b;i-=c)
#define FIN freopen("input.in","r",stdin)
#define FOUT freopen("output.out","w",stdout)
#define CC(a) memset(a,0,sizeof(a))
#define MST(a,b) memset(a,b,sizeof(a))
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define VI vector<int>
#define VL vector<long long>
#define VII vector<PII>
#define VLL vector<PLL>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second

template<typename T>inline void gn(T &x){
	x=0;T f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
template<typename T>inline void gt(T x){
	if(!x)return;
	gt(x/10);putchar(x%10+'0');
}

const LL N=100005;
struct NODE{
	LL a,b,c;
}tt[N];
LL t,n,m,ans;
LL MOD=1e9+7,inf=0x1f1f1f1f;
db eps=1e-5;
LL ff[N],fac[N],a,b;
LL pr[N/10];
bitset<N> prime;
map<LL,LL> ma,mb;
set<LL> v;

void getprime(){
	LL i,j,k,l;
	for(i=2;i<N;i++){
		if(!prime[i]){
			pr[++pr[0]]=i;
			for(j=i+i;j<N;j+=i)prime[j]=1;
		}
	}
//	cout<<pr[0]<<endl;
}

LL cmp(NODE a,NODE b){
	return a.a<b.a;
}

LL check(LL x){
	LL i,j,k,l,cnt;
	a=b=1;
	for(i=1;i<=pr[0]&&pr[i]*pr[i]<=x;i++){
		if(x%pr[i]==0){
			cnt=0;
			while(x%pr[i]==0){
				x/=pr[i];
				cnt++;
			}
			cnt%=3;
			if(cnt==1){
				a*=pr[i];
				b*=pr[i]*pr[i];
			}
			else if(cnt==2){
				a*=pr[i]*pr[i];
				b*=pr[i];
			}
		}
	}
	if(x>1){
		a*=x;b*=x*x;
	}
	if(b<0||b>1e10)return 0;
	else return 1;
}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	LL i,j=0,k,l,ca=0;
	getprime();
	cin>>n;
	repu(i,1,n)cin>>ff[i];
	sort(ff+1,ff+n+1);
	repu(i,1,n){
		if(ff[i]!=ff[i-1]){
			if(check(ff[i])){
				tt[++j].a=a;
				tt[j].b=b;
				tt[j].c++;
			}
			else {
				ans++;
			}
		}
		else {
			if(b<0||b>1e10){
				ans++;
			}
			else {
				tt[j].a=a;
				tt[j].b=b;
				tt[j].c++;
			}
		}
	}
	sort(tt+1,tt+j+1,cmp);
	k=-1;
	repu(i,1,j){
		if(tt[i].a!=tt[i-1].a){
			tt[++k].a=tt[i].a;
			tt[k].b=tt[i].b;
			tt[k].c=tt[i].c;
			ma[tt[i].a]=tt[i].c;
		}
		else {
			tt[k].c+=tt[i].c;
			ma[tt[i].a]+=tt[i].c;
		}
	}
	repu(i,0,k){
		if(tt[i].a==1&&tt[i].c>0){
			ans++;
		}
		else if(ma[tt[i].a]){
			ans+=max(tt[i].c,ma[tt[i].b]);
			ma[tt[i].a]=ma[tt[i].b]=0;
		}
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 13824
process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  const s = lines[0];
  console.log((s + s).includes(lines[1]) ? "Yes" : "No");
});



Measured memory_bytes: 20296
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
typedef long long ll;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

int main(){
    int n,h,w;
    cin >> n >> h >> w;
    cout << (n-h+1)*(n-w+1) << endl;
    return 0;
}

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

using namespace std;

int main()
{
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> players;
    while(n--)
    {
        players.push_back(0);
    }
    for(int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        players[x-1]++;
    }
    for(int i = 0; i < players.size(); i++)
    {
        if(k-q+players[i]>0)
            cout << "Yes\n";
        else
            cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 1144
#include<bits/stdc++.h>
#define N 100005
#define int long long
using namespace std;
int n,m;
int a[N],s[N];
map<int,int> v;
signed main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	int ans=0;v[0]++;
	for(int i=1;i<=n;i++)
	{
		s[i]=(s[i-1]+a[i])%m;
		ans+=v[s[i]];v[s[i]]++;
	}
	cout<<ans;
	
	
	
}

Measured memory_bytes: 5760
n, k = map(int, input().split())

maxi = (n-1)*(n-2)/2
if k > maxi:
    print(-1)
    exit()

nokori = int(maxi - k)
print(nokori + n-1)
for i in range(1, n):
    print(i, n)

for i in range(1, n):
    if nokori == 0: break
    for j in range(i+1, n):
        print(i, j)
        nokori -= 1
        if nokori == 0: break

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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int train = 0;
    int bus = 0;
    if (A <= B) train = A;
    else train = B;
    if (C <= D) bus = C;
    else bus = D;
    cout << train + bus << endl;
}

Measured memory_bytes: 888
open Array
let n = read_int ()
let a = init n @@ fun _ -> Scanf.scanf "%d\n" @@ fun d -> d
let b = copy a
let () = fast_sort (fun x y -> if x = y then 0 else if x < y then 1 else -1) b
let amax, asec = b.(0), b.(1)
let () = iter (fun x -> print_int x; print_newline ()) (map (fun x -> if x = amax then asec else amax) a)

Measured memory_bytes: 10112
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define SaveTime ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define mx *max_element
#define mi *min_element
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 1e6+5;
const int INF = 1e18L;
int ncr(int n,int r){if(n<r)return 0;int p=1,k=1;if(n-r<r)r=n-r;if(r!=0){while(r){p*=n;k*=r;int g=__gcd(p, k);p/=g;k/=g;n--;r--;}}else p=1;return p;}
#define pi 2*acos(0.0)
int ar[N];
int tree[2*N];
int dp[N];
int bit[N];
signed main(){
 	// #ifndef ONLINE_JUDGE
 	// freopen("input.txt","r",stdin);
 	// freopen("output.txt","w",stdout);
 	// #endif
	SaveTime;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >> n;
		for(int i=1;i<=9;i++){
			for(int j=1;j<=9;j++){
				if(i*j==n){
					return cout <<"Yes",0;
				}
			}
		}
		cout <<"No";
	
	}
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
//	final static int MOD = 1000000007;

	public static long ans = 0;

	public static void main(String[] args) {

//		int ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

		int n = sc.nextInt();


		//-------------------------------------------------------------------------------------

		if(n >= 30) {
			f = true;
		}


		//-------------------------------------------------------------------------------------

		if(f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

//		System.out.println(ans);
//
		sc.close();
	}



}

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

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

	unsigned long long m = min(a, b);
	unsigned long long sm = sqrt(m);
	++sm;

	unsigned long long ret = 1;
	if (a % 2 == 0 && b % 2 == 0) {
		++ret;
	}
	while (a % 2 == 0) {
		a /= 2;
	}
	while (b % 2 == 0) {
		b /= 2;
	}

	for (unsigned long long i = 3; i <= sm; i += 2) {
		if (a % i == 0 && b % i == 0) {
			++ret;
		}
		while (a % i == 0) {
			a /= i;
		}
		while (b % i == 0) {
			b /= i;
		}
	}

	if ((a != 1 && b % a == 0) || (b != 1 && a % b == 0)) {
		++ret;
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
#include <climits>

//find out the use of the below
#include <list>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cassert>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define mp(a,b) make_pair((a),(b))
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pdd pair<double,double>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
const int mod = 1e9+7;
int R, C;
char gr[1001][1001];
vector<vector<int> > dp(1001, vector<int>(1001, 0));
map<pair<int, int>, int> fr;
int dr[] = {1, 0};
int dc[] = {0, 1};
inline bool vd(int r, int c){
    return !(r < 0 || r >= R || c < 0 || c >= C || gr[r][c] == '#');
}
void bfs(int r, int c){
    queue<pair<int, int> > q;
    q.push(mp(r, c));
    fr[mp(r, c)] = 1;
    while (!q.empty()){
        r = q.front().x;
        c = q.front().y;
        //cout << r << ' ' << c << endl;
        fr[mp(r, c)]--;
        q.pop();
        if (fr[mp(r, c)] != 0)
            continue;
        for (int i = 0; i < 2; ++i){
            int nr = r+dr[i], nc = c + dc[i];
            if (vd(nr, nc)){
                q.push(mp(nr, nc));
                if (fr.find(mp(nr, nc)) == fr.end())
                    fr[mp(nr, nc)] = 1;
                else
                    fr[mp(nr, nc)] ++;
                dp[nr][nc] = (dp[nr][nc] + dp[r][c])%mod;
            }
        }
    }
}
int main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt","w", stdout);
    scanf("%d %d\n", &R, &C);
    for (int i = 0; i < R; ++i){
        for (int j = 0; j < C; ++j){
            scanf("%c", &gr[i][j]);
        }
        if (i != R-1)
            scanf("\n");
    }
//    for (int i = 0; i < R; ++i)
//        for (int j = 0; j < C; ++j)
//            printf("%s\n", gr[i]);
    dp[0][0] = 1;
    bfs(0,0);
    printf("%d", dp[R-1][C-1]);
    return 0;
}
/* BEFORE submitting, check for:
 *  1. Integer overflow
 *  2. Float/Double precision errors
 *  3. Array index out of bounds
 *  4. Edge cases.(n=1, n=max, etc.)
 *  5. Time complexity. No TLEs
 */


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;


void solve()
{
	string s, t, u;
	int a, b;

	cin >> s >> t >> a >> b >> u;

	if (s == u)
	{
		a--;
	}
	else if (t ==  u)
	{
		b--;
	}

	cout << a << " " << b;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 256