akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
using Line = tuple<int, int, int>;
const ll MOD = 998244353ll;

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

ll mod_pow(ll x, ll e) {
  ll v = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) {
      v = v * x % MOD;
    }
    x = x * x % MOD;
  }
  return v;
}

Line getNormalizedLine(int x1, int y1, int x2, int y2) {
  int a = y2 - y1;
  int b = x1 - x2;
  int c = (-a * x1) + (-b * y1);
  int g = gcd(abs(a), abs(b));
  a /= g;
  b /= g;
  c /= g;
  if (a < 0) {
    a = -a;
    b = -b;
    c = -c;
  }
  if (a == 0 && b < 0) {
    b = -b;
    c = -c;
  }
  return Line(a, b, c);
}

int main() {
  int N;
  while (cin >> N) {
    vector<int> x(N), y(N);
    for (int i = 0; i < N; i++) {
      cin >> x[i] >> y[i];
    }
    map<Line, set<int>> linePoints;
    for (int i = 0; i < N; i++) {
      for (int j = i + 1; j < N; j++) {
        Line line = getNormalizedLine(x[i], y[i], x[j], y[j]);
        linePoints[line].insert(i);
        linePoints[line].insert(j);
      }
    }
    ll ans = mod_pow(2, N);
    ans = (ans - 1 + MOD) % MOD;
    ans = (ans - N + MOD) % MOD;
    for (auto& entry : linePoints) {
      int k = entry.second.size();
      ll ng = (mod_pow(2, k) - k - 1 + MOD) % MOD;
      ans = (ans - ng + MOD) % MOD;
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 100 + 10;

char s[maxn];
int n, k;

int main() {
  scanf("%s%d", s + 1, &k);
	n = strlen(s + 1);
	int f1, f2, sum = 0;
	ll Ans;
	for(int i = 1, j;i <= n;i = j + 1) {
		j = i;
		while(s[j + 1] == s[i])
			j ++;
    sum += (j - i + 1) / 2;
		if(i == 1) f1 = j - i + 1;
	  if(j == n) f2 = j - i + 1;
	}
	if(f1 == n || f2 == n) Ans = (ll)n * k / 2;
	else if((f1 % 2 == 0) || (f2 % 2 == 0) || s[1] != s[n]) Ans = (ll)sum * k;
	else Ans = (ll)sum * k + (k - 1);
	printf("%lld\n", Ans);
	return 0;
}


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

#define ll long long int
#define ull unsigned long long int
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define module 1000000007


int main(){
    IOS;
   int n;
   cin>>n;
   int l=n/2;
  float ans;
  ans=1-(float)l/n;
  printf("%0.10f",ans);
return 0;    
}


Measured memory_bytes: 256
from itertools import product
N = int(input())
S = input()
res = 0
for pair in product(range(10), repeat=3):
  s = S[::]
  found = True
  for i,num in enumerate(pair):
    idx = s.find(str(num))
    if idx == -1:
      found = False
      break
    else:
      if idx+1 == N:
        if i != len(pair)-1:
          found = False
        break
      s = s[idx+1:]

  if found:
    res += 1

print(res)

Measured memory_bytes: 73908
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

K = INT()

tmp = 7
ans = 1
p = 1
mo = tmp%K
checked = [0]*(K+1)
checked[mo] = 1
while mo != 0:
	mo += 7*pow(10, p, K)
	mo %= K
	p += 1
	if checked[mo]:
		print(-1)
		break
	checked[mo] = 1
else:
	print(p)


Measured memory_bytes: 17844
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

int n, x;

int solve(const vector<vector<int>>& b, int k){
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += b[(n+i-k)%n][k];
    }
    ans += x * k;

    return ans;
}

signed main(){
    cin >> n >> x;

    vector<int> a(n);
    rep(i, n) cin >> a[i];

    vector<vector<int>> b(n, vector<int>(n));
    rep(i, n) b[i][0] = a[i];

    for(int i = 0; i < n; i++){
        for(int j = 1; j < n; j++){
            b[i][j] = min(b[i][(n+j-1) % n], a[(i+j)%n]);
        }
    }

    int ans = INF;
    rep(k, n){
        int tmp = solve(b, k);
        if(tmp < ans){
            ans = tmp;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 31616
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define msg(x) debug() << x
#define int long long
const int xx = 2e5;
const int MOD = 1e9 + 7;
vector<int>v;
bool inrange(int x){
  if(x>=1 & x<=9) return true;
  return false;
}
signed main(){
  ios::sync_with_stdio(false);cin.tie(0);
  int a , b;
  cin >> a >> b;

  if(inrange(a) && inrange(b)){
    cout << a*b << '\n';
  }
  else{
    cout << -1 << '\n';
  }

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <limits>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <array>
#include <tuple>
#include <utility>
#include <cctype>
#include <typeinfo>
using namespace std;

#define len(x)  (int((x).size()))
#define append push_back
#define pp make_pair
#define ff(a, b)    for (int a = 0; a < int(b); ++a)
#define ii(n)    ff(i, n)
#define kk(n)    ff(k, n)
#define mm(n)    ff(m, n)
#define fff(a, b, c) for (int a = int(b); a < int(c); ++a)
#define iii(a, b) fff(i, a, b)
#define kkk(a, b) fff(k, a, b)
#define mmm(a, b) fff(m, a, b)
#define xx first
#define yy second
#define bb begin()
#define ee end()
#define all(x)  (x).bb, (x).ee
#define ite(v)   decltype((v).bb)
#define fe(i, v) for(ite(v) i = (v).bb; i != (v).ee; ++i)
#define err(...)    { fprintf(stderr, __VA_ARGS__); fflush(stderr); }

using LL = long long;
using pii = pair<int, int>;


const LL INF = 9223372036854775807LL;
//const int INF = 2147483647;
   
const LL MOD = LL(1e9) + 7;



int main() {
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    //cout << '\n';
    

    int N; 
    cin >> N;
    vector<int> sieve(N+1, 0);
    iii (2, N+1) {
        if (0 == sieve[i]) {
            kkk (2, 1000) {
                int mult = k * i;
                if (mult >= len(sieve))
                    break;
                if (0 == sieve[mult])
                    sieve[mult] = i;
            }
        }
    }

    map<int, int> factors;
    iii (2, N+1) {
        int f = i;
        while (0 != sieve[f]) {
            //printf("factor %d of %d\n", sieve[f], f );
            ++factors[sieve[f]];
            f /= sieve[f];
        }
        ++factors[f];
    }

    LL rr = 1;
    fe (it, factors) {
        rr = (rr * (it->yy+1)) % MOD;
    }

    cout << rr << '\n';

    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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;
}

const int INF = 1e9;
const long long LINF = 1e18;

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

    for (int i = 1; i <= 9; i++) {
        if (N % i == 0 && (N / i) <= 9) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


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

int main() {
  int c500, c100, c50, x, count = 0;

  cin >> c500;
  cin >> c100;
  cin >> c50;
  cin >> x;

  for(int i500 = 0; i500 <= c500; i500++) {
    for(int i100 = 0; i100 <= c100; i100++) {
      for(int i50 = 0; i50 <= c50; i50++) {
        if (x == 500 * i500 + 100 * i100 + 50 * i50)
          count++;
      }
    }
  }

  cout << count;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long const mod = 1e9+7;
int n, c;
vector<int> a, b;
vector< vector< long long > > dp, g, p;

void cal_p(){
    p.assign(401, vector<long long>(401, 1));
    for(int x = 0; x <= 400; x++){
        for(int y = 1; y <= 400; y++){
            p[x][y] = p[x][y-1] * x % mod;
        }
    }
}

void cal_g(){
    cal_p();
    g.assign(401, vector<long long>(401, 0));
    for(int i=0;i<=400;i++){
        for(int x = 1; x <= 400; x++){
            g[i][x] = (g[i][x-1] + p[x][i]) % mod;
        }
    }
}

int main(void){
    cin >> n >> c;
    a.assign(n, 0);
    b.assign(n, 0);
    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<n;i++) cin >> b[i];
    dp.assign(2, vector<long long>(c+1, 0));
    cal_g();
    dp[1][0] = 1;
    for(int i=0;i<n;i++){
        for(int j=0;j<=c;j++){
            long long res = 0;
            for(int k=0;k<=j;k++){
                res += dp[(i+1)%2][k] * (g[j-k][b[i]] - g[j-k][a[i]-1] + mod) % mod;
                res %= mod;
            }
            dp[i%2][j] = res;
            //cout << i << ", " << j << " : " << res << endl;
        }
    }
    cout << dp[(n+1)%2][c] << endl;
}


Measured memory_bytes: 2816
N, M = map(int, input().split())
first = set()
second = set()

for i in range(M):
  a, b = map(int, input().split())
  if a == 1:
    first.add(b)
  if b == N:
    second.add(a)

if first & second:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")


Measured memory_bytes: 18892
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let s = get!(String).chars().collect::<Vec<_>>();

    let b = 21908721983;

    let mut mx = 0;
    for len in 1..min!(n, n/2+3) {
        let mut map = HashMap::new();
        let mut hash = 0;
        let mut t = 1;
        for i in (0..len).rev() {
            hash += (s[i] as u8 as usize) * t;
            t *= b;
        }
        map.insert(hash, len);
        for i in 0..n-len {
            hash = hash*b + (s[i+len] as u8 as usize) - (s[i] as u8 as usize) * t ;
            if let Some(&r) = map.get(&hash) {
                if r <= i+1 {
                    mx = len;
                    break;
                }
            } else {
                map.insert(hash, i+len+1);
            }
        }
    }
    println!("{}", mx);
}


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

int main() {
	int n, h, w;
	scanf("%d%d%d", &n, &h, &w);
	int cnt = 0;
	while (n--) {
		int x, y;
		scanf("%d%d", &x, &y);
		if (x >= h && y >= w)
			cnt++;
	}

	cout << cnt << endl;
	
	return 0;
}

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

int main(void){
    int n;
    cin >> n;
    if(n % 1000 == 0){
        cout << 0 << endl;
    }else{
        cout << abs(1000 - (n % 1000)) << endl;
    }
    return 0;
}

Measured memory_bytes: 3644
def count(value, P):
    cnt = 0
    for p in P:
        if p & value == value:
            cnt += 1
    return cnt


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    P = []
    for i in range(N):
        s = 0
        for j in range(i, N):
            s += A[j]
            P.append(s)
    retval = 0
    for idx in range(40, -1, -1):
        tmp = retval + 2**idx
        if count(tmp, P) >= K:
            retval = tmp
    print(retval)


if __name__ == "__main__":
    main()


Measured memory_bytes: 28928
#include <iostream>
int main(int argc, const char * argv[]) {
    long n;
    std::cin >> n;
    long a[n+1];
    long b[n];
    for(long i=0; i<n+1; i++) std::cin >> a[i];
    for(long i=0; i<n; i++) std::cin >> b[i];
    long count=0;
    for(long i=0; i<n; i++)
    {
        if(a[i] < b[i])
        {
            count += a[i];
            b[i] -= a[i];
            if(a[i+1] < b[i])
            {
                count += a[i+1];
                a[i+1] = 0;
            }else{
                count += b[i];
                a[i+1] -= b[i];
            }
        }else{
            count += b[i];
        }
    }
    std::cout << count << std::endl;
    return 0;
}

Measured memory_bytes: 1792
n = int(input())
ans = {}
for i in range(n):
    key = ''.join(sorted(input()))
    ans[key] = ans.get(key, 0) + 1
print(sum([v*(v-1)//2 for k, v in ans.items()]))  # 1=0, 2=1, 3=3, 4=6, ... n(n-1)//2

Measured memory_bytes: 17852
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int nam = sc.nextInt();
		int nam2 = sc.nextInt();
		int nam3 = sc.nextInt();
		
		int sum = nam + nam2 + nam3;
		
		if(sum>21){
		    System.out.print("bust");
		}else{
		    System.out.println("win");
		}
		
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef pair<string,int> P;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

string change(string s, int n) {
  if(n==0) {
    swap(s[6],s[21]);
    swap(s[7],s[22]);
    swap(s[8],s[23]);
    swap(s[17],s[12]);
    swap(s[9],s[11]);
  } else if(n==1) {
    swap(s[0],s[27]);
    swap(s[1],s[28]);
    swap(s[2],s[29]);
    swap(s[15],s[14]);
    swap(s[18],s[20]);
  } else if(n==2) {
    swap(s[2],s[21]);
    swap(s[5],s[24]);
    swap(s[8],s[27]);
    swap(s[12],s[14]);
    swap(s[11],s[18]);
  } else if(n==3) {
    swap(s[0],s[23]);
    swap(s[3],s[26]);
    swap(s[6],s[29]);
    swap(s[9],s[20]);
    swap(s[15],s[17]);
  }
  return s;
}

bool check(string s) {
  for(int i=1; i<=8; i++) {
    if(s[i-1]!=s[i]) return false;
  }
  for(int i=10; i<=11; i++) {
    if(s[i-1]!=s[i]) return false;
  }
  for(int i=13; i<=14; i++) {
    if(s[i-1]!=s[i]) return false;
  }
  for(int i=16; i<=17; i++) {
    if(s[i-1]!=s[i]) return false;
  }
  for(int i=19; i<=20; i++) {
    if(s[i-1]!=s[i]) return false;
  }
  for(int i=22; i<=29; i++) {
    if(s[i-1]!=s[i]) return false;
  }
  return true;
}

int main() {
  int T;
  cin >> T;
  while(T--) {
    string s="";
    char c;
    for(int i=0; i<30; i++) {
      cin >> c;
      s+=c;
    }
    queue<P> que;
    que.push(P(s,0));
    set<string> m;
    m.insert(s);
    int ans=0;
    while(!que.empty()) {
      P p=que.front();
      s=p.first;
      int n=p.second;
      que.pop();
      if(check(s)) {
	ans=n;
	break;
      }
      for(int i=0; i<4; i++) {
	string t=change(s,i);
	if(m.count(t)==0) {
	  que.push(P(t,n+1));
	  m.insert(t);
	}
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 1264
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
  int N; 
  cin >> N;
  int a[3*N];
  int b[3*N];
  priority_queue<int> qr;
  priority_queue<P> ql;
  ll sumr[3*N];
  ll suml[3*N];
  
  for (int i = 0; i < 3 * N; i++) {
    sumr[i] = 0;
    suml[i] = 0;
  }
  
  
  for (int i = 0; i < 3 * N; i++) {
    cin >> a[i];
    b[i] = 1000000001 - a[i];
  }
  
  
  for (int i = 3*N-1; i >= 2*N; i--) {
     sumr[2*N] += a[i];
    qr.push(a[i]);
  }
  
  for (int i = 0; i < N; i++) {
    suml[N-1] += a[i];
    ql.push(P(b[i], a[i]));
  }
  
  for (int i = 2*N-1; i >= N; i--) {
    if (a[i] < qr.top()) {
      int m = qr.top();
      qr.pop();
      qr.push(a[i]);
      sumr[i] = sumr[i+1] + a[i] - m;
    } else {
      sumr[i] = sumr[i+1];
    }
  }
  for (int i = N; i < 2 * N; i++) {
    P q = ql.top();
    if (a[i] > q.second) {
      ql.pop();
      ql.push(P(b[i], a[i]));
      suml[i] = suml[i-1] + a[i] - q.second;
    } else {
      suml[i] = suml[i-1];
    }
  }
  
  ll score = suml[N-1] - sumr[N];
  for (int i = 1; i <= N; i++) {
    score = max(score, suml[i + N-1] - sumr[i+N]);
  }
  
  cout << score << endl;
}

Measured memory_bytes: 8824
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define all(a) a.begin(), a.end()
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 2 * 1050;

int n, x, y;
int ans[MAXN];

int main() {

    scanf("%d %d %d", &n, &x, &y);
    x--; y--;

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int curDist = j - i;
            curDist = min(curDist, abs(x - i) + 1 + abs(y - j));
            curDist = min(curDist, abs(y - i) + 1 + abs(x - j));
            ans[curDist]++;
        }        
    }

    for (int i = 1; i < n; i++) {
        printf("%d\n", ans[i]);
    }

    return 0;
}


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

#define ll long long int

int main(){
    ll x,d;
   
    cin >> x ;
    if(x<500)
      {
          cout<<(x / 5) * 5;
      }
    else
    {   d = (x / 500) * 1000;
        x-= (x / 500) * 500;
        cout<< d +(x / 5) * 5;
    }  
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iterator>
#include <vector>
#include <numeric>

using namespace std;

int main() {
  int n, h;
  vector<int> a, b;

  scanf("%d %d", &n, &h);

  int ta, tb;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &ta, &tb);
    a.push_back(ta);
    b.push_back(tb);
  }

  auto max_a = max_element(a.begin(), a.end());
  b.erase(remove_if(b.begin(), b.end(),
                    [=](int x) { return x < *max_a; }), b.end());
  sort(b.begin(), b.end(), greater<int>());
  int att = 0;
  for (const auto& e : b) {
    h -= e;
    att++;
    if (h <= 0) {
      printf("%d\n", att);
      return 0;
    }
  }


  if (h > 0) {
    att += h / *max_a;

    if (h % *max_a > 0) {
      att += 1;
    }
  }

  printf("%d\n", att);
}


Measured memory_bytes: 1276
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <iostream>
#include <climits>
#include <queue>
using namespace std;
int n;
int main()
{
    while(~scanf("%d",&n)){
            int ans = 0;
        for(int i = 1; i <=n ; i++)
        {
            ans+=i;
            if(ans >= n)
            {
                printf("%d\n",i);
                break;
            }
        }
    }
    return 0;
}


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

// #define multitest 1
// #define Debug 1
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#endif

typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;

const int nax = 3e2 + 5;
ld p[nax][nax][nax], ev[nax][nax][nax];

void solve()
{
	int n, x;
	cin >> n;
	vector<int> cnt(4);
	for (int i = 0; i < n; ++i)
	{
		cin >> x;
		cnt[x]++;
	}
	p[cnt[1]][cnt[2]][cnt[3]] = 1;
	for (int c = n; c >= 0; --c)
		for (int b = n; b >= 0; --b)
			for (int a = n; a >= 0; --a)
			{
				if ((a + b + c) == 0)
					continue;
				if (a + b + c > n)
					continue;
				ld p_waste = (ld)(n - a - b - c) / n;
				ld ev_waste = p_waste / (1 - p_waste) + 1;
				ev[a][b][c] += ev_waste * p[a][b][c];
				if (a != 0)
				{
					ld p_go = (ld)a / (a + b + c);
					p[a - 1][b][c] += p[a][b][c] * p_go;
					ev[a - 1][b][c] += ev[a][b][c] * p_go;
				}
				if (b != 0)
				{
					ld p_go = (ld)b / (a + b + c);
					p[a + 1][b - 1][c] += p[a][b][c] * p_go;
					ev[a + 1][b - 1][c] += ev[a][b][c] * p_go;
				}
				if (c != 0)
				{
					ld p_go = (ld)c / (a + b + c);
					p[a][b + 1][c - 1] += p[a][b][c] * p_go;
					ev[a][b + 1][c - 1] += ev[a][b][c] * p_go;
				}
			}
	cout << fixed << setprecision(15);
	cout << ev[0][0][0];
}

int main()
{
#ifndef Debug
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#endif
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
	return 0;
}

Measured memory_bytes: 874752
#include <bits/stdc++.h>
using namespace std;
#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 repR(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep1R(i,n) for (int i = int(n); i >= 1; i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define cauto const auto
#ifdef LOCAL
#define dump(...) cerr << "[" << __LINE__ << ":" << __FUNCTION__ << "] ", _dmp_(#__VA_ARGS__, __VA_ARGS__);
void _dmp_(const char*) { cerr << endl; }
template <class T, class... U>
void _dmp_(const char *s, T const& x, U const& ...y) { const char *o = "({[", *e = "]})"; for (int i = 0; *s != '\0'; cerr << *s++) { if (count(o,o+3,*s)) i++; if (count(e,e+3,*s)) i--; if (!i && *s == ',') break; } cerr << " = " << x; if (*s == ',') cerr << ", ", s++; _dmp_(s, y...); }
#else
#define dump(...)
#endif
using ll = long long;
#define int ll
template <class T> using pque_max = priority_queue<T>;
template <class T> using pque_min = priority_queue<T, vector<T>, greater<T> >;
#define CONAINER_OUTPUT os << "{"; for (auto const& x : v) os << " " << x; return os << " }";
template <class T> ostream& operator<<(ostream& os, vector<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, deque<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, set<T> const& v) { CONAINER_OUTPUT }
template <class T, class U> ostream& operator<<(ostream& os, map<T,U> const& v) { CONAINER_OUTPUT }
#undef CONAINER_OUTPUT
template <class T> istream& operator>>(istream& is, vector<T>& v) { for (auto& x : v) is >> x; return is; }
template <class T, class S> ostream& operator<<(ostream& os, pair<T,S> const& p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class T, class S> istream& operator>>(istream& is, pair<T,S> const& p) { return is >> p.first >> p.second; }
struct _Init_ { _Init_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } _init_;

template <class T> void quit(T const& x) { cout << x << endl; exit(0); }
template <class T> bool chmin(T& x, T const& y) { if (x > y) { x = y; return true; } return false; }
template <class T> bool chmax(T& x, T const& y) { if (x < y) { x = y; return true; } return false; }
#define YesNo(c) ((c) ? "Yes" : "No")
////////////////////////////////

int32_t main() {
    int n; cin >> n;
    string s; cin >> s;

    int ma = 0;
    vector<int> a(n);
    rep1 (i,n-1) {
        rep (i,n) a[i] = 0;
        rep (j,n-i) a[j] = (s[j] == s[j+i]);
        int j = 0;
        int c = 0;
        for ( ; j < n-i; j++) {
            if (a[j]) c++;
            else chmax(ma,min(c,i)), c = 0;
        }
        chmax(ma,min(c,i));
    }
    cout << ma << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility> 
#include <unordered_set>
#include <vector>
#include <list> 
#include <string>
#include <iterator> 
#include <deque>
#include <array>
#include <forward_list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <bitset>
#include <numeric>
using namespace std;


const long double PI = 3.14159265358979323846264338327950;
const int N = 100;

template <class T>
T gcd(T a, T b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int arr[N];

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

	int n, m;
	bool ok = true;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> m;
		if (m % 2 == 0)
		ok = ok && (m % 3 == 0 || m % 5 == 0);
	}
	if (ok)
		cout << "APPROVED" << '\n';
	else
		cout << "DENIED" << '\n';
}


Measured memory_bytes: 3696
N = int(input())
A = list(map(int, input().split()))
X = [0]*N
S = 0
As = 0
for i in range(N):
    S += A[i]
for i in range((N - 1) // 2):
    As += A[2 * i + 1]
X[0] = S - 2 * As
for i in range(1,N):
    X[i] = 2 * A[i-1] - X[i-1]
s = ""
for i in range(N):
    s += str(X[i]) + " "
print(s)

Measured memory_bytes: 20608
l, r = map(int, input().split())
if r-l >=2019:
  print("0")
  exit()
la = l % 2019
ra = r % 2019
diff = ra - la
if diff <= 0:
  print("0")
  exit()
ans = 2019
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = (i*j) % 2019
    if mul <= ans:
      ans = mul
print(int(ans))


Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
  int a,b;
  int c;
  int sum,avg;
  double tmp;

  c = 0;
  sum = 0;
  avg = 0;
  while(scanf("%d,%d",&a,&b)!=EOF){
    sum += a*b;
    avg += b;
    c++;
  }

  tmp =  (double)avg  / c;
  avg = (int)(tmp+1.0/2.0);

  printf("%d\n",sum);
  printf("%d\n",avg);

  return 0;
}

Measured memory_bytes: 0
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

const s = input[0];
const ss = s.split('');

const ans = '';

for (let i = 0; i <ss.length; i++){
    ss[i] = 'x';
}

console.log(ss.join(''));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define INF 1e18
#define MOD 1000000007
#define N 1000005
#define BB(V) V[V.size()-2]
#define ex(V) return printf(V),0
using namespace std;
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	printf("%lld",n%m?(ll)n*(m-1):-1ll);
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> inv;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

ll solve(ll a, ll b, ll c)
{
	ll d = a / b;
	ll e = a / c;
	ll f = GCD(b, c);
	f = a / (b * c / f);

	return a - d - e + f;
}

int main()
{
	ll a, b, c, d;
	cin >> a >> b >> c >> d;

	cout << solve(b, c, d) - solve(a - 1, c, d) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>
const int MAX = 3;
int main(){

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

    int n;
    cin >> n;
    vector<int> b(n);
    for(int i=0;i < n;i++) cin >> b[i];

    //見つけたら−１を入れる
    bool bingo = false;
    for(int i=0;i < 3;i++){
        for(int j=0;j < 3;j++){
            for(int k =0;k < n;k++){
                if(a[i][j] == b[k]){
                    a[i][j] = -1;
                } 

            }

            if((a[i][0] == -1 && a[i][1] == -1 && a[i][2] == -1) || (a[0][j] == -1 && a[1][j] == -1 && a[2][j] == -1) || (a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1) || (a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1)){
                bingo = true;
            }
            if(bingo) break;
        }
        if(bingo) break;

    }


    if(bingo) cout << "Yes"<< endl;
    else cout << "No"<< endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <deque>
#define mp make_pair
using namespace std;
int n,a[100005];
bool f[100005];
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		if (a[i]==i) f[i]=true;
	}
	int cnt=0;
	for (int i=1;i<=n;i++){
		if (f[i]){
			if (f[i+1]){
				f[i]=0;
				f[i+1]=0;
				cnt++;
			}else{
				cnt++;
			}
		}
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
long long n;
long long a[4],b[4];
long long dp[6000],pd[26000000];
vector<int> ok;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>a[1]>>a[2]>>a[3]>>b[1]>>b[2]>>b[3];
	if(a[1]<b[1])
		ok.push_back(1);
	if(a[2]<b[2])
		ok.push_back(2);
	if(a[3]<b[3])
		ok.push_back(3);
	long long v=0;
	memset(dp,-1,sizeof(dp));
	dp[n]=0;
	for(int i=n;i>=1;i--){
		if(dp[i]==-1){
			continue;
		}
		for(int j=0;j<ok.size();j++){
			if(i>=a[ok[j]]){
				dp[i-a[ok[j]]]=max(dp[i-a[ok[j]]],dp[i]+b[ok[j]]);
			}
		}
		v=max(v,dp[i]+i);
	}
	v=max(v,dp[0]);
	n=v;
	ok.clear();
	if(a[1]>b[1])
		ok.push_back(1);
	if(a[2]>b[2])
		ok.push_back(2);
	if(a[3]>b[3])
		ok.push_back(3);
	memset(pd,-1,sizeof(pd));
	pd[n]=0;
	for(int i=n;i>=1;i--){
		if(pd[i]==-1){
			continue;
		}
		for(int j=0;j<ok.size();j++){
			if(i>=b[ok[j]]){
				pd[i-b[ok[j]]]=max(pd[i-b[ok[j]]],pd[i]+a[ok[j]]);
			}
		}
		v=max(v,pd[i]+i);
	}
	v=max(v,pd[0]);
	cout<<v<<endl;
	return 0;
}


Measured memory_bytes: 203520
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep2(i, a, b) for(int i = (a); i < (b); i++)
typedef long long ll;

int main() {
   int n;
   cin >> n;
   vector<int> a(n);
   double sum = 0.0;
   rep(i, n) {
      cin >> a[i];
      sum += 1/(double)(a[i]);
   }

    printf("%.16f\n", 1/sum);
   
}

Measured memory_bytes: 256
input = gets.chomp.split(' ').map(&:to_i);
alice = input[0]
bob = input[1]

if alice == bob then
    puts "Draw"
elsif alice == 1 then
    puts "Alice"
elsif bob == 1 then
    puts "Bob"
elsif alice > bob then
    puts "Alice"
else
    puts "Bob"
end


Measured memory_bytes: 3836
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <numeric>
 
using namespace std;

long long quickpow(int n) {
    long long base = 2;
    long long ans = 1;
    while (n) {
        if (n&1) ans *= base;
        n >>= 1;
        base *= base;
    }
    return ans;
}


const long long maxn = 1e6+5;
// long long arr[maxn] = {};

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

    int N;
    cin >> N;

    multiset<long long, greater<long long> > s1;
    multiset<long long, greater<long long> > s2;

    // multiset<int, greater<int> > test;
    // test.insert(1);
    // test.insert(2);
    // test.insert(2);
    // test.insert(4);

    // cout << *(test.upper_bound(4)) << endl;

    long long q = quickpow(N);

    long long t;
    for (int i = 1; i <= q; i++) {
        cin >> t;
        s2.insert(t);
        // cout << i << endl;
    }
    // sort(arr+1, arr+q+1, greater<long long>());

    auto ptr = s2.begin();
    s1.insert(*ptr);
    s2.erase(ptr);

    for (int i = 0; i < N; i++) {
        long long c = quickpow(i);
        auto itr1 = s1.begin();
        long long len = s1.size();
        vector<long long> v;
        for (int i = 0; i < len; i++, itr1++) {
        // for (auto itr1 = s1.begin(); itr1 != s1.end(); itr1++) {
            auto itr2 = s2.upper_bound(*itr1);
            // cout << *itr1 << " " << *itr2 << (itr2==s2.end()) << endl;
            if (itr2 == s2.end()) { cout << "No" << endl; return 0; }
            v.push_back(*itr2);
            // s1.insert(*itr2);
            s2.erase(itr2);
        }
        for (long long a : v) {
            s1.insert(a);
        }

    }

    cout << "Yes" << endl;


    // long long c, maxi = arr[1];
    // for (int i = 0; i < N; i++) {
    //     c = quickpow(i);  //2^0, 2^1, 2^2...
    //     for (int j = 1; j <= c; j++) {
    //         cout << j << " " << j+c << endl;
    //         if (arr[j] == arr[j + c]) { cout << "No" << endl; return 0; }
            
    //     }
    // }
    // cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 14068
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


int main(void)
{
    int n, t, a;
    scanf("%d %d %d", &n, &t, &a);
    int h[n];
    for (int i=0; i < n; i++) scanf("%d", &h[i]);

    double min = t - h[0]*0.006 - a;
    if (min < 0) min *= -1;
    double df;
    int num = 0;

    for (int i=1; i < n; i++){
        df = t - h[i]*0.006 - a;
        if (df < 0) df *= -1;
        if (df < min){
            min = df;
            num = i;
        }
    }

    printf("%d\n", num+1);
    


    return 0;
} 



Measured memory_bytes: 128
H, W = map(int, input().split())
S = ['_' * (W+2)]+['_' + input() + '_' for _ in range(H)]+['_' * (W+2)]

table = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]

for h in range(1, H+1):
    for w in range(1, W+1):
        if S[h][w] == '.':
            cnt = 0
            for dy, dx in table:
                if S[h+dy][w+dx] == '#':
                    cnt += 1
            S[h] = S[h][:w] + str(cnt) + S[h][w+1:]

for h in range(1, H+1):
    print(S[h][1:-1])


Measured memory_bytes: 3064
def cmb(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] //= pivot
                denominator[k] //= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

n,k=map(int,input().split())
for i in range(k):
    if i==0:
        print(n-k+1)
    elif i>=n-k+1:
        print(0)
    else:
        print((cmb(n-k+1,i+1)*cmb(k-1,i))%1000000007)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define Maxn 100010
#define INF 10010
inline int read()
{
	char c=getchar();re ll f=1,s=0;
	while(!isdigit(c)){if(c=='-')f=-1,c=getchar();}
	while(isdigit(c)){s=s*10+c-48;c=getchar();}
	return f*s;
}
string s;
signed main()
{
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='C'){
			for(int j=i+1;j<s.size();j++){
				if(s[j]=='F'){
					printf("Yes\n");
					return 0;
				}
			}
		}
	}
	printf("No\n");
	return 0;
}

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

int main()
{
    int n;
    cin>>n;
    int x = n%10;

    if(x==2||x==4||x==5||x==7||x==9)
    {
        cout<<"hon";
    }
    else if(x==0||x==1||x==6||x==8)
    {
        cout<<"pon";
    }
    else
        cout<<"bon";

    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>

/*void alphabeticalorder(char *str)
{
    int i,j;
    char a;

    for(i=0; str[i]!=0; i++){
		for(j=i+1; str[j]!=0; j++){
			if(str[i]>str[j]){
				a = str[i];
				str[i] = str[j];
				str[j] = a;
			}
		}
	}
}
*/
int main(void)
{
	int i,flag,n=0,j,k,temp;
	char s[100],t[100],a;
	
	scanf("%s",s);
    scanf("%s",t);

    for(i=0;s[i]!=0;i++){
		n++;
	}
	
    //printf("%d\n",n);
	for(i=0;i<n; i++){
        for(j=0;j<n;j++)
            if(s[j]!=t[j]){
                flag=0;
                break;
            }
            else flag=1;
        if(flag) break;
        else{
            temp =s[n-1];
            for(k=0;k<n;k++){
                s[n-(k+1)]=s[n-(k+2)];
            }
            s[0]=temp;
        }
        //printf("%s\n",s);
    }

    //printf("%s\n",s);
    if(flag)
        printf("Yes\n");
    else
        printf("No\n");
        
}

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

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    bool turn = true;
    while(a > 0 && c > 0) {
        if(turn) {
            c -= b;
        }
        else {
            a -= d;
        }
        turn ^= 1;
    }
    cout << (a > 0 ? "Yes" : "No");
}


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

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

/* define const */
const long long INF = (1LL << 60);
/* end defineing */

int main()
{
    string s;
    cin >> s;

    int l_cnt = 0;
    int len = s.length();
    for (int i = 0; i < len; i++)
    {
        int tmp = 0;
        for (int j = i; j < len && (s[j] == 'A' || s[j] == 'T' || s[j] == 'C' || s[j] == 'G'); j++)
        {
            tmp++;
        }
        if (tmp > l_cnt)
        {
            l_cnt = tmp;
        }
    }
    cout << l_cnt << endl;
}

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

using namespace std;
vector<long long> factors;
#define ll long long

#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
int MOD = 1000'000'007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false); cout.tie(0);cin.tie(0);
#define flush fflush(stdout)


ll mod(ll a, ll m)
{ return (a + (abs(a) / m) * m + m) % m; }

//****************************don't use int!!!!!!!****************************//
//***************************code starts here!!!!!****************************//



int main()
{
	IOS

	int n;
	cin >> n;
	string str;
	cin >> str;

	vector<vector<ll>> suf(n, vector<ll>(26, 0));
	suf[n - 1][str[n - 1] - 'a']++;
	for (int i = n - 2; i >= 0; --i)
	{
		suf[i] = suf[i + 1];
		suf[i][str[i] - 'a']++;
	}

	ll res = 0;
	for (int i = n - 1; i >= 0; --i)
	{
		ll mul = 1;
		for (int j = 0; j < 26; ++j)
		{
			if (str[i] != char('a' + j))
			{
				mul *= (suf[i][j] + 1);
				mul %= MOD;
			}
		}
		res += mul;
		res %= MOD;
	}
	cout << res;
	return 0;
}

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

using namespace std;

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

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

#define int long long

int N;

string hoge(int n){
  string res;

  //cout<<"N = "<<N<<" n = "<<n<<endl;

  if(n <= N && to_string(n) <= to_string(N)) res = "Y";
  else if(n > N && to_string(n) > to_string(N)) res = "Y";
  else res = "N";
  // cout<<"res = "<<res<<endl;

  cout<<res<<endl;

  //string hogehoge;
  //cin>>hogehoge;

  return res;
}

bool checkt(int m){
  string ans;

  m *= 10;

  cout<<"? "<<m<<endl;
  //cout<<flush;

  ans = hoge(m);
  //cin>>ans;

  return ans == "Y";
}

void solvet(){
   int con = 0;

  for(int i = 1; con < 11;i *= 10){
    int n = i;
    string ans;

    cout<<"? "<<n<<endl;
    //cout<<flush;

    // cin>>ans;
    ans = hoge(n);

    if(ans == "Y") {
      con++;
    } else{
      break;
    }
  }

  if(con == 11) {
    for(int i = 2, j = 1; ; i *= 10, j *= 10){
      string ans;
      cout<<"? "<<i<<endl;
      cout<<flush;

      //cin>>ans;

      ans = hoge(i);
      if(ans == "Y") {

        cout<<"! "<<j<<endl;
        return ;
      }
    }
    return ;
  }
  // cout<<con<<endl;

  int l = 1, h = 10, m = 0;

  for(int i = 1; i < con; i++){
    l *= 10;
    h *= 10;
  }

  while(l + 1< h){
    m = (l + h)/2;

    if(!checkt(m)){
      l = m;
    } else {
      h = m;
    }
  }

  cout<<"! "<<h<<endl;
  cout<<flush;
}


void test(){

  while(true){
    cin>>N;

    solvet();

    while(true){
      int x;
      cin>>x;
      cout<<hoge(x)<<endl;
    }
  }
}


bool check(int m){
  string ans;

  m *= 10;

  cout<<"? "<<m<<endl;
  cout<<flush;

  cin>>ans;

  return ans == "Y";
}





void solve(){
   int con = 0;

  for(int i = 1;con < 11 ;i *= 10){
    int n = i;
    string ans;

    cout<<"? "<<n<<endl;
    cout<<flush;

    cin>>ans;

    if(ans == "Y") {
      con++;
    } else if(ans == "N"){
      break;
    }
  }
  if(con == 11) {
    for(int i = 2, j = 1; ; i *= 10, j *= 10){
      string ans;
      cout<<"? "<<i<<endl;
      cout<<flush;

      cin>>ans;

      if(ans == "Y") {

        cout<<"! "<<j<<endl;
        return ;
      }
    }
    return ;
  }

  int l = 1, h = 10, m = 0;

  for(int i = 1; i < con; i++){
    l *= 10;
    h *= 10;
  }

  while(l + 1< h){
    m = (l + h)/2;

    if(!check(m)){
      l = m;
    } else {
      h = m;
    }
  }

  cout<<"! "<<h<<endl;
  cout<<flush;
}



signed main(){

  // test();

  solve();

  return 0;
}


Measured memory_bytes: 716
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 1e7 + 10;
const int mod = 998244353;
int h1, m1, h2, m2, k;
int main() {
	scanf("%d%d%d%d%d", &h1, &m1, &h2, &m2, &k);
	int a = h1 * 60 + m1, b = h2 * 60 + m2;
	printf("%d\n", b - a - k);
	return 0;
}

Measured memory_bytes: 3816
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long A, long long B, long long C){
  std::cout << max(0LL, C - (A - B)) << std::endl;
}

int main(){
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  long long C;
  scanf("%lld",&C);
  solve(A, B, C);
  return 0;
}


Measured memory_bytes: 256