akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String[] list = str.split(" ");

		if(list[0].endsWith(list[1].substring(0, 1)) && list[1].endsWith(list[2].substring(0, 1))){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}


}


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

int main() {
  string s;
  cin >> s;
  int ans = 0;
  if (s == "RRR") ans = 3;
  if (s == "RRS") ans = 2;
  if (s == "RSR") ans = 1;
  if (s == "SRR") ans = 2;
  if (s == "RSS") ans = 1;
  if (s == "SSR") ans = 1;
  if (s == "SRS") ans = 1;
  if (s == "SSS") ans =0;
  cout << ans << endl;
}


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

import sys
from math import sqrt

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 ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N,D=MAP()
X=[]
for i in range(N):
    X.append(LIST())

cnt=0
for i in range(N):
    for j in range(i+1, N):
        sm=0
        A=X[i]
        B=X[j]
        for k in range(D):
            sm+=(A[k]-B[k])**2
        ans=sqrt(sm)
        if ans>=0 and ans.is_integer():
            cnt+=1
print(cnt)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int K = scan.nextInt();
			
		int answer = N % K == 0 ? 0 : 1;
		System.out.println(answer);
	}
}

Measured memory_bytes: 23764
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<list>
#include <cstring>
#include <functional>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF ((Int)1<<60)
#define EPS (1e-10)
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define RREP(i,n) for(int i=1; i<=(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long Int;
typedef pair<Int, Int> PI;
typedef pair<int, int> P;
typedef vector<double> vec;
typedef vector<vec> mat;
const int N = 100005;
//////////////////////////////

int bitcnt[1 << 18];
int dp[1 << 18][18];
int a[18], b[18];

int value(int pos, int ind) {
	if ((pos - ind) % 2)return b[ind];
	else return a[ind];
}

int flip(int pos, int bit) {
	return bitcnt[bit & ((1 << 18) - (1 << pos))];
}

void solve()
{
	int n; cin >> n;
	REP(i, n) cin >> a[i];
	REP(i, n) cin >> b[i];
	REP(i, (1 << 18)) REP(j, 18) dp[i][j] = INF;
	dp[0][0] = 0;
	int ans = INF;

	REP(bit, (1 << n)) {
		if (bit) bitcnt[bit] = bitcnt[bit / 2] + bit % 2;
		REP(last, n) {
			if (bit == (1 << n) - 1) ans = min(ans, dp[bit][last]);
			if (bit > 0 && (bit & (1 << last)) == 0) continue;
			REP(nxt, n) {
				if (bit & (1 << nxt)) continue;
				int nxtbit = bit + (1 << nxt);
				if (bit > 0 && value(bitcnt[bit] - 1, last) > value(bitcnt[bit], nxt)) continue;
				dp[nxtbit][nxt] = min(dp[nxtbit][nxt], dp[bit][last] + flip(nxt, bit));
			}
		}
	}
	cout << (ans == INF ? -1 : ans) << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(13);
	solve();
	return 0;
}


Measured memory_bytes: 23036
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N, D, X;
    cin >> N >> D >> X;
    int ans = X;
    rep(i, 0, N)
    {
        int A;
        cin >> A;
        ans += 1 + (D - 1) / A;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	string S, T;
	cin >> S >> T;

	int i = S.size() - T.size();

	for(int i = S.size() - T.size(); i >= 0; i--) {
		string rsl = "";
		rep(j, 0, i) {
			if(S[j] == '?') rsl += 'a';
			else rsl += S[j];
		}

		for(int j = i; j < i + T.size(); j++) {
			if(S[j] == T[j - i] or S[j] == '?') rsl += T[j - i];
			else {
				break;
			}
		}
		
		for(int j = i + T.size(); j < S.size(); j++) {
			if(S[j] == '?') rsl += 'a';
			else rsl += S[j];
		}

		if(rsl.size() == S.size()) {
			cout << rsl << endl;
			return 0;
		}
	}

	cout << "UNRESTORABLE" << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    string s[3];
    rep(i,3)cin>>s[i];
    rep(i,3)cout<<s[i][i];
    cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, n) for (int i = (a); i < (n); ++i)
using namespace std;
using ll = long long;
using uint = unsigned int;
const ll mod = (ll)1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  ll money = 1000;
  ll stock = 0;

  for (int i = 0; i < n - 1;) {
    while (i < n - 1 && a[i] >= a[i + 1]) i++;
    if (i == n - 1) break;
    stock = money / a[i];
    money -= stock * a[i];
    while (i < n - 1 && a[i] <= a[i + 1]) i++;
    money += stock * a[i];
    stock = 0;
    if (i == n - 1)
      break;
  }
  cout << money << endl;
  return 0;
}


Measured memory_bytes: 3612
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    ret = (pow(10, N, MOD) - pow(9, N, MOD) - pow(9, N, MOD) + pow(8, N, MOD)) % MOD
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9764
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

void solve();

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

void solve(){
    ll a,b,x;cin>>a>>b>>x;

    cout<<(a<=x&&x<=a+b?"YES":"NO")<<endl;
}

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

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

    int maxSlope = 0;

    int slopeNum = 0;
    int prev, now;
    for (int i = 0; i < n; ++i)
    {
        int input;
        cin >> input;
        if (i == 0)
        {
            prev = input;
        }
        else
        {
            now = input;

            if (prev < now)
            {
                maxSlope = max(maxSlope, slopeNum);
                slopeNum = 0;
            }
            else
            {
                slopeNum++;
                maxSlope = max(maxSlope, slopeNum);
            }
            prev = now;
        }
    }

    cout << maxSlope << endl;
}

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



int main(){
  int N;
  cin >> N;
  
  int ans;
  if(N < 10)
  {
    ans = N;
  }
  else if( N < 100)
  {
    ans = 9;
  }
  else if( N < 1000)
  {
    ans = N - 90;
  }
  else if( N < 10000)
  {
    ans = 909;
  }
  else if(N < 100000)
  {
    ans = N - 9090;
  }
  else
  {
    ans = 90909;
  }

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

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
occur = [0 for i in range(n + 1)]
MOD = 1000000007
for i in range(n + 1):
    if occur[a[i]] > 0: val = n - 1 - i + occur[a[i]]
    else: occur[a[i]] = i + 1
inv = [0 if i > 2 else 1 for i in range(n + 2)]
pinv = [0 if i > 2 else 1 for i in range(n + 2)]
perm = [0 if i > 2 else 1 for i in range(n + 2)]
for i in range(2, n + 2):
    inv[i] = -int(MOD / i) * inv[MOD % i] + MOD
    pinv[i] = pinv[i - 1] * inv[i] % MOD
    perm[i] = perm[i - 1] * i % MOD
def C(n, m):
    return (perm[m] * pinv[n] % MOD) * pinv[m - n] % MOD if n <= m else 0
for i in range(1, n + 2):
    temp = C(i, n + 1) - C(i - 1, val)
    if temp < 0: temp += MOD
    print(temp)

Measured memory_bytes: 27752
#include <iostream>
#include "string.h"
#include <algorithm>
#include <vector>
#include <stdio.h>
#include "math.h"
#include <queue>
using namespace std;

int main() {

    int x, y;
    cin >> x >> y;

    cout << (x+y/2) << endl;

    return 0;
}

Measured memory_bytes: 256
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let v: Vec<u32> = vec![
        1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4,
        1, 51,
    ];
    let k: usize = read();
    println!("{}", v[k - 1]);
}


Measured memory_bytes: 4352
function qchong(s)
  local t={}
  for i=1,#s do
    t[i]=string.sub(s,i,i)
  end
  table.sort(t)
  local i=1
  while t[i] do
    if t[i]==t[i+1] then
      table.remove(t,i)
      i=i-1
    end
    i=i+1
  end
  return t
end
N=io.read()
S=io.read()
res={}
for i=1,#S-1 do
  a=string.sub(S,1,i)
  b=string.sub(S,i+1,#S)
  a=qchong(a)
  b=qchong(b)
  local count=0
  for i=1,#a do
    for j=1,#b do
      if a[i]==b[j] then
        count=count+1
      end
    end
  end
  res[i]=count
end
table.sort(res,function (a,b) return a>b end)
print(res[1])


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N, C;
    cin >> N >> C;

    vector<vector<ll>> D(C+1, vector<ll>(C+1));

    for(ll i=1; i<=C; i++){
        for(ll j=1; j<=C; j++){
            cin >> D[i][j];
        }
    }

    map<ll, ll> M0;
    map<ll, ll> M1;
    map<ll, ll> M2;
    for(ll i=1; i<=N; i++){
        for(ll j=1; j<=N; j++){
            ll a;
            cin >> a;
            if((i+j)%3 == 0){
                if(M0.count(a)){
                    M0[a]++;
                }
                else{
                    M0[a] = 1;
                }
            }
            if((i+j)%3 == 1){
                if(M1.count(a)){
                    M1[a]++;
                }
                else{
                    M1[a] = 1;
                }
            }
            if((i+j)%3 == 2){
                if(M2.count(a)){
                    M2[a]++;
                }
                else{
                    M2[a] = 1;
                }
            }
        }
    }

    // cout << "M0" << endl;
    // for (auto iter = M0.begin(); iter != M0.end(); iter++){
    //     cout << iter->first << " " << iter->second << endl;
    // }
    // cout << "M1" << endl;
    // for (auto iter = M1.begin(); iter != M1.end(); iter++){
    //     cout << iter->first << " " << iter->second << endl;
    // }
    // cout << "M2" << endl;
    // for (auto iter = M2.begin(); iter != M2.end(); iter++){
    //     cout << iter->first << " " << iter->second << endl;
    // }

    ll ans = INF;
    for(ll i=1; i<=C; i++){
         for(ll j=1; j<=C; j++){
            for(ll k=1; k<=C; k++){
                if(i==j) continue;
                if(j==k) continue;
                if(k==i) continue;
                // cout<< i << j << k << endl;

                ll temp = 0;
                for (auto iter = M0.begin(); iter != M0.end(); iter++){
                    temp += D[iter->first][i]*iter->second;
                }
                for (auto iter = M1.begin(); iter != M1.end(); iter++){
                    temp += D[iter->first][j]*iter->second;
                }
                for (auto iter = M2.begin(); iter != M2.end(); iter++){
                    temp += D[iter->first][k]*iter->second;
                }
                // cout << temp << endl;
                ans = min(ans, temp);
            }       
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void solve(){
	long d,t,s;
	cin>>d>>t>>s;
	if(t*s>=d){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long t=1;
//	cin>>t;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; ll K; cin >> N >> K;
    vector<int> A(N);
    REP(i, 0, N) cin >> A[i], A[i]--;

    vector<vector<int>> next(61, vector<int>(N, 0));
    REP(i, 0, N) next[0][i] = A[i];

    REP(i, 0, 60) {
        REP(j, 0, N) next[i + 1][j] = next[i][next[i][j]];
    }

    int s = 0;
    for (int i = 60; i >= 0; i--) if (K & (1LL << i)) s = next[i][s];
    cout << s + 1 << endl;
    return 0;
}

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

using namespace std;

int n, m, lq;
char s[200010];
vector<int> g[200010];
int v[2][200010];
int q[200010];
int inq[200010];

int main()
{
    scanf("%d%d%s", &n, &m, s);
    for(int i = 0; i < n; i++)
        s[i] -= 'A';
    for(int i = 0; i < m; i++)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        a--; b--;
        g[a].push_back(b);
        v[s[b]][a]++;
        if(a != b)
        {
            g[b].push_back(a);
            v[s[a]][b]++;
        }
    }
    for(int i = 0; i < n; i++)
    {
        if(v[0][i] == 0 || v[1][i] == 0)
        {
            inq[i] = 1;
            q[lq++] = i;
        }
    }
    int r = 0;
    while(r < lq)
    {
        int k = q[r];
        for(int i = 0; i < g[k].size(); i++)
        {
            v[s[k]][g[k][i]]--;
            if(v[s[k]][g[k][i]] == 0)
            {
                if(inq[g[k][i]] == 0)
                {
                    inq[g[k][i]] = 1;
                    q[lq++] = g[k][i];
                }
            }
        }
        r++;
    }
    if(lq != n)
        printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 13440
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
signed main() {
  ll x,n;
  ll p[1000];
  cin >> x >> n;
  
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  
  int f[1000] = {};
  int ans = 0;
  
  for (int i = 0; i < n; i++) {
    f[p[i]] = 1;
  }
  
  for (int i = 1; i <= 101; i++) {
    if (f[i] == 0) {
      int a,b;
      a = abs(x - ans);
      b = abs(x - i);
      if (a > b) {
        ans = i;
      }
    }
  }
  
  cout << ans << "\n";
  
  return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<numeric>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(lli i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
 
int main(void){
	int n; cin >> n;
	vector<int> a(n), b(n);
	rep(i, n){
		a[i] = 20000*(i+1);
		b[i] = 20000*(n-i);
	}
	
	rep(i, n){
		int t;
		cin >> t; t--;
		a[t] += i;
	}
	rep(i, n) cout << a[i] << (i==n-1?"\n":" ");
	rep(i, n) cout << b[i] << (i==n-1?"\n":" ");
	return 0;
}

Measured memory_bytes: 768
N,*A = $<.read.split.map &:to_i
H = Hash.new(0)
A.each {|i| H[i] += 1}
t = 0
H.keys.each {|i|
  v = H[i]
  t += x=v*(v-1)/2
  H[i] = (v-1)*(v-2)/2 - x
}
puts A.map {|i| t+H[i]}

Measured memory_bytes: 31868
use std::io;

fn read<T: std::str::FromStr>() -> Vec<T>{
    let mut te = String::new();
    io::stdin().read_line(&mut te).unwrap();
    te.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}

fn main() {
    let nums : Vec<i32> = read();
    let mut ans = 0;
    if (nums[0] + nums[1]) > 0 && nums[0] > (nums[0] + nums[1]){
        for i in 0..nums[0] {
            ans += i + nums[1];
        }
    } else if nums[1] < 0 {
        for i in 0..nums[0] - 1 {
            ans += i + nums[1];
        }
    } else {
        for i in 1..nums[0] {
            ans += i + nums[1];
        }
    }
    println!("{}", ans);
}




Measured memory_bytes: 4352
import sys
input = sys.stdin.buffer.readline

N, X, M = map(int, input().split())

SeqToNum = []
NumToSeq = {}

while not X in NumToSeq:
    NumToSeq[X] = len(SeqToNum)
    SeqToNum.append(X)
    X = X * X % M

if N <= NumToSeq[X]:
    ans = 0
    for i in range(N):
        ans += SeqToNum[i]
else:
    ans = 0
    for i in range(NumToSeq[X]):
        ans += SeqToNum[i]
    N -= NumToSeq[X]
    # cycle
    cycleScore = 0
    cycle = len(NumToSeq) - NumToSeq[X]
    for i in range(NumToSeq[X], len(NumToSeq)):
        cycleScore += SeqToNum[i]
    ans += cycleScore*(N//cycle)
    N %= cycle
    
    for i in range(NumToSeq[X], NumToSeq[X] + N):
        ans += SeqToNum[i]

print(ans)

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

using namespace std;

typedef long long int big;

int main(){
	//freopen("pai.txt","r",stdin);
	//freopen("pao.txt","w",stdout);
	big n,k;
	cin>>n>>k;
	
	vector<big> arr(n);
	for(big i=0;i<n;i++){
		cin>>arr[i];
	}
	
	sort(arr.begin(),arr.end());
	
	n = n-k;
	
	big sum=0;
	for(big i=0;i<n;i++){
		sum=sum+arr[i];
	}
	cout<<sum<<endl;
	return 0;
}

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

int n;
string a;
int main()
{
	int i;
	cin >> n >> a;
	if (n % 2) {puts("No"); return 0;}
	for (i = 0; i < n / 2; i++) {
		if (a[i] != a[i + n / 2]) {puts("No"); return 0;}
	}
	puts("Yes");
    return 0;
}

Measured memory_bytes: 256
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    S = input()
    T = input()

    n = len(S)
    ans = 0

    for i in range(n):
        if S[i] != T[i]:
            ans += 1
    
    print(ans)

if __name__ == "__main__":
	main()

Measured memory_bytes: 9388
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        if 4 * h * n - N * n - N * h:
            w = N * h * n / (4 * h * n - N * n - N * h)
            if 0 < w <= 3500 and w == int(w):
                print(h, n, int(w))
                exit()


Measured memory_bytes: 40796
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int N=sc.nextInt();
      int number=N%10;
       if(number==2 ||number==4|| number==5|| number==7 ||number==9)
       {
         System.out.println("hon");
       }
       else  if(number==0 ||number==1|| number==6|| number==8)
         {
         System.out.println("pon");
       }
        else 
           {
         System.out.println("bon");
       }
       
  }
}


Measured memory_bytes: 35656
input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
line = lines.shift().split(' ')
N = line[0] * 1
K = line[1] * 1 
S = lines.shift()

cnt = 0
s = S[0]
for (i=1; i<N; i++) {
    if (s != S[i]) {
        cnt++
        s = S[i]
    }
}

d = cnt - 2 * K
if (d < 1) {
    d = 0
}

console.log(N - 1 - d)

Measured memory_bytes: 21064
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#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()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	ll h,w; cin >> h >> w;
	if(h==1 || w==1) cout << 1 << endl;
	else{
		ll ans = (h*w+1)/2;
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int N,M,Q;
const int MN=100000;
vector<int> G[MN];
int vd[MN][11];
int col[100000];

int main(){
	cin>>N>>M;
	rep(i,M){
		int x,y;
		cin>>x>>y;
		x--,y--;
		G[x].pb(y);
		G[y].pb(x);
	}
	rep(i,MN) rep(j,11) vd[i][j]=-1;
	cin>>Q;
	rep(t,Q){
		int v,d,c;
		cin>>v>>d>>c;
		v--;
		vd[v][d]=t;
		col[t]=c;
	}
	for(int d=10;d>0;d--){
		rep(v,N){
			if(vd[v][d]==-1) continue;
			int t = vd[v][d];
			for(int u:G[v]){
				chmax(vd[u][d-1],t);
			}
			chmax(vd[v][d-1],t);
		}
	}
	rep(v,N){
		if(vd[v][0]==-1) cout<<0<<endl;
		else cout<<col[vd[v][0]]<<endl;
	}
}

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

int main(){
  string s, t;
  int a, b;
  string u;
  cin >> s >> t >> a >> b >> u;
  if(s == u) {
    cout << a - 1 << " " << b << endl;
  } else{
    cout << a << " " << b - 1 << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int[] A=new int[N];
		for(int i=0;i<N;i++){
			A[i]=sc.nextInt();
		}
		int B=0;
		for(int i=0;i<N;i++){
			if(i==0)
				B=A[0];
			else
				B=A[i]-B;
		}
		System.out.println(B);	
		for(int i=0;i<N-1;i++){
			B/=2;
			B=(A[i]-B)*2;
			System.out.println(B);
		}
	}
}

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

int main(){
  int n,k,sum=1;
  cin>>n>>k;
  
  
  for(int i=0;i<n;i++){
    if(sum<=k){
      sum = sum*2;
    }
    else
      sum=sum+k;
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
M, D = map(int, input().split())
mul_day = 0
for m in range(1, M + 1):
    for d in range(1, D + 1):
        if len(str(d)) < 2:
            continue
        d10, d1 = int(str(d)[0]), int(str(d)[1])
        if d1 >= 2 and d10 >= 2 and d1 * d10 == m:
            mul_day += 1
print(mul_day)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007 
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main(){
	string s;
	cin >> s;
	int win = 0;
	cu(i,0,s.length()){
		win += s[i] == 'o';	
	}
	win += 15 - s.length();
	cout << (win>=8?"YES":"NO") << '\n';
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

H,W,K=map(int,input().split())
MAP=[input().strip() for i in range(H)]

ANS=0
for i in range(1<<H):
    for j in range(1<<W):

        A=0

        for k in range(H):
            if i & (1<<k)!=0:
                continue
            for l in range(W):
                if j & (1<<l)!=0:
                    continue
                if MAP[k][l]=="#":
                    A+=1
        if A==K:
            ANS+=1
print(ANS)
                


Measured memory_bytes: 9204
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> pii;

void parse(string in, string& group, vector<string>& mem) {
	int k=0;
	while(in[k]!=':') k++;
	group = in.substr(0,k);
	k++;
	string name = "";
	while(k < in.length()) {
		if(in[k]==',' || in[k]=='.') {
			mem.push_back(name);
			name = "";
		} else {
			name += in[k];
		}
		k++;
	}
}

typedef pair<int, vector<string> > pivs;
map< string, pivs > graph;
bool visit[101];

void dfs(string p) {
	if( graph.find(p) == graph.end() ) return;
	if( visit[graph[p].first] ) return;
	visit[ graph[p].first ] = true;
	for(int i=0; i<graph[p].second.size(); i++) {
		string s = graph[p].second[i];
		dfs(s);
	}
}

int main() {
	int n;
	while(cin >> n, n) {
		memset(visit, 0, sizeof(visit));
		graph.clear();
		vector<string> in(n);
		string fs;
		rep(i,n) {
			cin >> in[i];
			string g;
			vector<string> m;
			parse(in[i], g, m);
			graph[g] = pivs(i, m);
			if(i==0) fs = g;
		}

		dfs(fs);
		vector<string> _in;
		rep(i, n) {
			if(visit[i]) {
				_in.push_back(in[i]);
			}
		}
		in = _in;

		set<string> gr, em;
		rep(i, in.size()) {
			string g;
			vector<string> m;
			parse(in[i], g, m);
			gr.insert(g);
			rep(j, m.size()) em.insert(m[j]);
		}
		vector<string> s;
		set_difference(em.begin(), em.end(), gr.begin(), gr.end(), back_inserter(s));
		cout << s.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 1492
#include<stdio.h>
int main(){
  int n,c,h,i;
  char s[201];
  scanf("%d",&n);
  while(n--){
    scanf("%s",s);
    if(s[c=0]!='>'||s[h=1]!='\''&&s[1]!='^'){
      printf("NA\n");
      continue;
    }
    for(i=2;s[i];i++){
      if(s[1]=='\''){
	if     (s[i]=='=')c+=h;
	else if(s[i]=='#'){
	  if(h==-1)break;
	  h=-1;
	}
	else if(s[i]=='~'&&s[i+1]==0){
	  if(c!=0)break;
	}
	else break;
      }
      else{
	if(s[i]=='Q'&&s[i+1]=='=')i++;
	else if(s[i]!='~')break;
      }
    }
    if(s[i])printf("NA\n");
    else{
      if(s[1]=='\''){
	if(s[i-2]=='=')printf("A\n");
	else                  printf("NA\n");
      }
      else{
	if(s[i-3]=='=')printf("B\n");
	else           printf("NA\n");
      }
    }
  }
  return 0;
}
	  
	

Measured memory_bytes: 584
def solve(n,i,flg):
    if n%i != 0:
        return flg
    else:
        flg += 1
    return solve(int(n/i),i,flg)
if __name__ == '__main__':
    
    n = int(input())
    if n <= 104:
        print(0)
    
    else:
            
        so = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
        count = 0
        for k in range(104,n+1):
            if k%2 == 1:
                cnt_list = []
                for j in so:
                    cnt = solve(k,j,0)
                    cnt_list.append(cnt)
                cnt_list.sort(reverse=True)
                
                if (cnt_list[0:4] == [7,0,0,0]) or (cnt_list[:4] == [3,1,0,0]) or (cnt_list[:4] == [1,1,1,0]) :
                    count += 1
                
        
        print(count)

Measured memory_bytes: 39664
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        long[] NHW = ReadArrayLong();
        long N = NHW[0];
        long H = NHW[1];
        long W = NHW[2];

        int count = 0;
        for (int i = 0; i < N; i++)
        {
            long[] AB = ReadArrayLong();
            if (H <= AB[0] && W <= AB[1])
            {
                count++;
            }
        }
        Console.WriteLine(count);
    }

    static long[] ReadArrayLong() => Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
    static int ReadInt() => int.Parse(Console.ReadLine());
}


Measured memory_bytes: 13268
//
import java.math.*;
import java.util.*;
import java.io.*;

  
public class Main { 
  
    static BufferedReader in;
    static PrintWriter out = new PrintWriter(System.out);
    static String file = "../in";
    static int test = 10; // 0 for local testing, 1 for std input
    static int inf = 1_000_000;

    class Comb
    {
        long[] f, ff;
        int mod = 1_000_000_007;

        public Comb(int n)
        {
            f = new long[n + 10];
            f[0] = 1;
            for(int i = 1; i <= n; i++)
            {
                f[i] = (f[i - 1] * i) % mod;
            }
        }

        public long choose(int n, int m)
        {
            return f[n] * pow(f[m], mod - 2) % mod * pow(f[n - m], mod - 2) % mod;
        }

        long pow(long a, int b)
        {
            long re = 1;
            while(b > 0)
            {
                if(b % 2 != 0)
                {
                    re *= a;
                    re %= mod;
                }
                b /= 2;
                a = a * a;
                a %= mod;
            }
            return re;
        }

    }

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

    void swap(int[]ary, int i, int j)
    {
        int t = ary[i];
        ary[i] = ary[j];
        ary[j] = t;
    }
    
    String[] split() throws Exception
    {
        return in.readLine().split(" ");
    }

    int readInt() throws Exception
    {
        return Integer.valueOf(in.readLine());
    }

    int[] toIntArray() throws Exception
    {
        String[] sp = split();
        int n = sp.length;
        int[] ary = new int[n];
        for(int i = 0; i < n; i++) ary[i] = Integer.valueOf(sp[i]);
        return ary;
    }

    String reverse(String str)
    {
        return new StringBuilder(str).reverse().toString();
    }

    public static void main(String[] args) throws Exception
    {
        int _k = Integer.valueOf("1");
        if(test > 0) in = new BufferedReader(new InputStreamReader(System.in));
        else in = new BufferedReader(new FileReader(file));
        if(test < 0) {String[] str = in.readLine().split(" ");}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/

        new Main().d();
        out.flush();
    }

    void d() throws Exception
    {
        int[] ary = toIntArray();
        int x = ary[0], y = ary[1];
        if((x + y) % 3 != 0) 
        {
            System.out.println("0");
            return;
        }
        int xy3 = (x + y) / 3;
        int a = y - xy3, b = x - xy3;
        if(a < 0 || b < 0)
        {
            System.out.println("0");
            return;
        }
        // answer = (a + b) choose a % MOD
        //        = (a + b)!  % mod * pow(a!, mod - 2) * pow(b!， mod - 2)
        Comb comb = new Comb(a + b);
        System.out.println(comb.choose(a + b, a));
    }

    
}


Measured memory_bytes: 25428
def Main():
    cross = input().replace("\n", "")

    S = list()
    V = list()
    ans = list()

    for i in range(len(cross)):
        r = cross[i]

        if r == "\\":
            S.append(i)
        elif r == "/":
            if len(S) > 0:
                j = S.pop()
                v = i - j
                V.append([v, j])

    while len(V) > 0 :
        total = 0
        [v, j] = V.pop()
        total += v

        while True:
            if len(V) > 0:
                [vv, jj] = V.pop()

                if jj > j:
                    total += vv
                else:
                    V.append([vv, jj])
                    ans.append(total)
                    break
            else:
                ans.append(total)
                break

    print("{}".format(sum(ans)))
    print(len(ans), *reversed(ans))

Main()


Measured memory_bytes: 6752
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#define rep(i, n) for (int i = 0; i<n; i++)
using namespace std;
// https://atcoder.jp/contests/abc163/tasks/abc163_c
typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<int> a(N, 0);
    
    rep(i, N-1){
        int A;
        cin >> A;
        a[A-1]++;
    }
    
    //for(auto &i:a) cout << i << endl;
    rep(i, N) cout << a.at(i) << endl;
    return 0;
    
    
}


Measured memory_bytes: 4016
#include <stdio.h>

int main(){
    int n,ans = 0;

    scanf("%d", &n);

    int d[n];

    for(int i = 0; i < n; i++){
        scanf("%d", d + i);
    }

    for(int i = 0; i < n - 1; i ++){
        for(int j = i + 1; j < n; j ++){
            ans += d[i] * d[j];
        }
    }

    printf("%d", ans);
    return 0;
}

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

#define FOR(i, a, b) for (int i = a; i < (int) b; i++)
#define F0R(i, a) FOR (i, 0, a)
#define GO(to, a) for (auto to : a)

#define f first
#define s second
#define eb emplace_back
#define sz(x) (int) x.size()
#define all(x) x.begin(), x.end()

int k;
int dp [105][5];

string cur;

int solve (int n, int m, bool tight) {
	if (m > k) return 0;
	if (n < 0) {
		return (m == k);
	}
	if (tight && ~dp[n][m]) return dp[n][m];
	int tot = 0;
	int lim = cur[n] - '0';
	for (int i = 0; i <= (tight ? 9 : lim); i++) {
		if (i) {
			tot += solve (n - 1, m + 1, tight | (i < lim));
		} else {
			tot += solve (n - 1, m, tight | (i < lim));
		}
	}
	return (tight ? dp[n][m] = tot : tot);
}

void GetSolve (string w) {
	memset (dp, -1, sizeof(dp));
	cur = w;
	reverse (all(cur));
	cout << solve (sz(w) - 1, 0, false) << '\n';
}

int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string w;
	cin >> w >> k;
	GetSolve (w);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int N, A[20], B[20], C[20];
  cin >> N;
  for(int i=0; i<N; i++){
  	cin >> A[i];
  }
  for(int i=0; i<N; i++){
  	cin >> B[i];
  }
  for(int i=0; i<N; i++){
  	cin >> C[i];
  }
  int ans = 0;
  ans += B[A[0]-1];
  for(int i=1; i<N; i++){
    if(A[i] == A[i-1] + 1){
      ans += C[A[i-1]-1];
    }
    ans += B[A[i]-1];
  }
  cout << ans << endl;
  return 0;
}

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

#define REP(i,x,y) for(ll i=x; i<=y; i++)
#define BIT(t) ((long long 1) << t)
#define PER(i,y,x) for(ll i=y; i>=x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
typedef long long ll;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,t=0,x=0,y=0,f=0;
    cin>>n;
    for(int i=0,tt,tx,ty;i<n;i++)
    {
        cin>>tt>>tx>>ty;
        if((abs(tx-x)+abs(ty-y))%2!=(tt-t)%2||abs(tx-x)+abs(ty-y)>(tt-t))
            f=1;
        t=tt;
		x=tx;
		y=ty;
    }
    if(!f) cout<<"Yes";
    else cout<<"No";
    return 0;
}

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

using namespace std;

int main() {
	vector<int> vec;
	int temp, i = 0;

	while (true)
	{
		cin >> temp;
		if (temp == 0) break;

		vec.emplace_back(temp);
	}

	for (auto&& v : vec) {
		i++;
		cout << "Case " << i << ": " << v << "\n";
	}

	return 0;
}



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

int main() {
    int A, B;
    string S; cin >> A >> B >> S;
    for (int i = 0; i < A+B+1; i++) {
        if (i != A) {
            if (S.at(i) == '-') {
                cout << "No" << endl;
                return 0;
            }
        } else {
            if (S.at(i) != '-') {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    if (S.size() == A+B+1) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


li n, a, b, c, d;
string s;

inline bool solve() {

    repp(i, a, c) {
        if (s[i] == '#' && s[i + 1] == '#') {
            return false;
        }
    }

    repp(i, b, d) {
        if (s[i] == '#' && s[i + 1] == '#') {
            return false;
        }
    }

    if (c < d) {
        return true;
    }
    repp(i, b - 1, d) {
        if (s[i] != '#' && s[i + 1] != '#' && s[i + 2] != '#') {
            return true;
        }
    }
    return false;
}

int main() {
    cin >> n >> a >> b >> c >> d;
    a--;
    b--;
    c--;
    d--;
    cin >> s;

    cout << (solve() ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
#define PI 3.14159265358979323846264338327950

int main() {
	int a, b, h, m;
	int min = 0;
	long double rad = 0.0;
	scanf("%d%d%d%d", &a, &b, &h, &m);
	min = h * 60 + m;
	rad = fabs((long double)min * 0.5 - (long double)min * 6.0);
	for (int i = 0; i < rad; i++) {
		rad -= 360.0;
		if (rad <= 360)break;
	}
	rad = rad * PI / 180.0;
	long double rsq = (long double)(a * a + b * b) - (long double)(2 * a *
		b) * cosl(rad);
	printf("%20.20Lf\n", sqrtl(rsq));
	return 0;
}

Measured memory_bytes: 2584
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <queue>
#include <cstdio>
using namespace std;

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using vvvll = V<V<V<ll>>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vvpll = V<vpll>;
using vtpll = V<tpll>;
using vst = V<str>;
using vch = V<char>;
using vvch = V<vch>;
using dqll = deque<ll>;
using vdqll = V<dqll>;
using pqll = priority_queue<ll>;
using vpqll = V<pqll>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin() 
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define ba back()
#define fr front()
#define pob pop_back()
#define pof pop_front()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,n) substr(a,n)
#define cfs(a) cout<<fixed<<setprecision(a) //
/*vvll v(n,vll(m)) n行m列  continue
A.erase(A.begin()+i); 配列Aのi番目を消せる
std::binary_search(v.bgn,v.en,a); 二分探索
abs(a,b)   pow(a,n)  to_string  stoll
auto Iter=lower_bound(v.bgn,v.en,a); v[i]>=aとなる初のv[i]
v.insert(lower_bound(v.bgn,v.en,a),b); bを入れられる
lower upper  co(*Iter) co(Iter-v.bgn) v[i]>=aとなる初のi
vvll v(100001,vll(0)); v[a].pb(b); v[b].pb(a);
pqll pq; pq.push(ai); pq.top(); pq.pop();
priority_queue<ll,vll,greater<ll>> pqg; 昇順
vdqll dq(3);  dq[0].pb(1); dq[0].pb(2); dq[0].pf(0);
dq[0].fr→0 dq[0].ba→1 dq[0].pof; dq[0].fr→1
que.sz while(!que.empty())
ll a=1,b=2,c=4,xo; xo=a^b^c; if(a^b^c==0)co(xo)→7 if(xo==0)co(xo)→なし
a<<b→a*2^b a>>b→a/2^b
rep(i,1<<10)rep(j,10)if((i>>j)&1)→iの二進で1となる桁のjのみ 
*/

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void Comuse() {
    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;
    }
}
#define comuse Comuse()
ll combi(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;
}
ll pow_mod(ll a,ll n,ll mod){
  ll res=1;        //n=k_2  pow(a,k_2)
  for(;n>0;n/=2){  //ex,pow(a,1011_2)=a^8*a^2*a^1
    if(n%2==1)res=(res*a)%mod;
    a=(a*a)%mod;
  }
  return res;
}
ll digit_sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0)break;
  }
  return m;
}
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}

int main(){
  str s,st;
  cin>>s>>st;
  ll n=s.sz;
  bool b=false;
  FOR(i,0,n){
    s=s+s[0];
    s=s.subs(1,n);
    if(s==st){
      b=true;
      break;
    }
  }
  if(b)co("Yes");
  else co("No");
}
  

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<algorithm>
#include <cstdlib>
#include <cmath>

using namespace std;
int main()
{
	int a, b, c, d,x=1;
	cin >> a >> b >> c >> d;
	string yn[2] = { "Yes","No" };
	if (abs(c - a) <= d) x = 0;
	else if (abs(b - a) <= d&&abs(c - b) <= d) x = 0;
	cout << yn[x] << endl;
    return 0;
}

Measured memory_bytes: 764
N, X, Y = map(int, input().split())
ans = [0]*N

for i in range(1,N+1):
  for j in range(i+1,N+1):
    d = min(j-i,abs(i-X)+abs(j-Y)+1)
    #print(i,j,d)
    ans[d]+=1

for i in range(1,N):
	print(ans[i])


Measured memory_bytes: 9340