akhauriyash/Code-Regression huggingface dataset:
import sys
N = int(input().strip())
grid = []
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
t = [0]
x = [0]
y = [0]
for lists in grid:
  t.append(lists[0])
  x.append(lists[1])
  y.append(lists[2])
i = 0
while i < N:
  d = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
  dt = t[i+1]-t[i]
  if dt >= d and (dt-d)%2==0:
    i += 1
  else:
    print('No')
    sys.exit()
print('Yes')

Measured memory_bytes: 29780
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	int n;
	cin>>n;
	if(n>=1000){
		cout<<"ABD"<<endl;
	}
	else{
		cout<<"ABC"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    return

#B
def B():
    def comb(a,b):
        return fact[a]*inv_fact[b]*inv_fact[a-b]%mod
    mod = 998244353
    n,a,b,k = LI()
    fact = [1]*(n+1)
    for i in range(1,n+1):
        fact[i] = fact[i-1]*i%mod
    inv_fact = [None]*(n+1)
    inv_fact[n] = pow(fact[n],mod-2,mod)
    for i in range(n)[::-1]:
        inv_fact[i] = inv_fact[i+1]*(i+1)%mod

    ans = 0
    for x in range(n+1):
        if (k-a*x)%b == 0 and k >= a*x and k-a*x <= n*b:
            y = (k-a*x)//b
            ans += comb(n,x)*comb(n,y)%mod
        ans %= mod
    print(ans)

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()


Measured memory_bytes: 51180
n = int(input())
ans = 0
i = 2

while n>1 and i*i<=n:
  if n % i == 0:
    c = 0
    while n % i == 0:
      n = n / i
      c = c + 1
    Y=1
    U=2
    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1

  i = i + 1
      
    
if n > 1:
  ans = 1 + ans

print(ans)

Measured memory_bytes: 9120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e9+9;
const int maxn=2e5+5;
ll n,m,k,a[maxn]={0},b[maxn]; 
int main(){
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		a[i]+=a[i-1]; 
	}
	for(int j=1;j<=m;j++){
		cin>>b[j];
		b[j]+=b[j-1];
	}
	int max1=0;
	for(int i=0,j=m;i<=n;i++){
		while(j&&a[i]+b[j]>k)j--;
		if(a[i]+b[j]<=k)max1=max(max1,i+j);
	}
	cout<<max1;
	return 0;
} 

Measured memory_bytes: 6712
#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;

int main(){
  int num[5];
  while(scanf("%d,%d,%d,%d,%d",&num[0],&num[1],&num[2],&num[3],&num[4])!=EOF){
    sort(num,num+5);
    bool three = false;
    int pair = 0;
    for(int i=0;i<4;i++){
      if(num[i] == num[i+1]){
	pair++;
      }
      if(i < 3 && num[i] == num[i+1] && num[i] == num[i+2]){
	three = true;
      }
    }
    if((num[0] == num[1] && num[1] == num[2] && num[2] == num[3]) ||
       (num[1] == num[2] && num[2] == num[3] && num[3] == num[4])){
      cout << "four card" << endl;
    }
    else if(three && pair == 3){
      cout << "full house" << endl;
    }
    else if(num[0] == num[1]-1 && num[0] == num[2]-2 &&
	    num[0] == num[3]-3 && num[0] == num[4]-4){
      cout << "straight" << endl;
    }
    else if(num[0] == 1 && num[1] == 10 && num[2] == 11 &&
	    num[3] == 12 && num[4] == 13){
      cout << "straight" << endl;
    }
    else {
      if(three) cout << "three card" << endl;
      else if(pair == 2) cout << "two pair" << endl;
      else if(pair == 1) cout << "one pair" << endl;
      else cout << "null" << endl;
    }
  }
}

Measured memory_bytes: 1224
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<cmath>
#include <iomanip>


#define rep(i,x) for(int i=0;i<(int)(x);i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)

#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e9

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; }
typedef long long ll;
typedef long double ld;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;

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

    ll cnt = 0;
    rep(i, s.size()){
        if(s[i] == 'o') cnt++;
    }
    if(cnt + 15 - s.size() >= 8) cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <chrono>
#include <random>
#include <cstdio>
#define ll long long int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define mod 998244353LL
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define pll pair<ll, ll>
#define pint pair<int, int>
#define S second
#define F first
#define all(c) (c).begin(),(c).end()
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500001;
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
#define pi 3.14159265358979323846264338
using namespace std; 
ll max(ll a, ll b){ if(a>b)return a;return b;}
ll min(ll a, ll b){ if(a < b) return a;return b;}
ll inf = 100000000000000000;

void solve() 
{
    int n;
    cin>>n;

    int mat[n][n];

    rep(i, n)
        rep(j, n) cin>>mat[i][j];

    // rep(i, n)
    // {
    //     rep(j, n)
    //     {
    //         cin>>mat[i][j]<<" ";
    //     }
    //     vo
    // }

    ll ans = 0;

    rep(i, n)
    {
        rep(j, n)
        {
            int f = 0;
            rep(k, n)
            {
                if(mat[i][j] + mat[j][k] < mat[i][k])
                {
                    cout<<-1<<endl;
                    return;
                }

                if(k!=i && k!=j && (mat[i][k] + mat[k][j] == mat[i][j]))
                {
                    // cout<<i<<" "<<j<<" "<<k<<endl; 
                    f = 1;
                }
            }
            if(f == 0) ans += mat[i][j];
        }
    }

    cout<<ans/2<<endl;



}

int main()
{   

    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 4060
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
using namespace std;
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const long long MM = 1e9;
const long long MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
// cout << fixed << setprecision(10);
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

int main(){
    int N; long long K; cin >> N >> K;
    vector<int> a(N);
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }

    long long a1 = 0,a2 = 0,sum = 0;
    for (int i = 0; i < N; i++){
        a1 = 0,a2 = 0;
        for (int j = 0; j < N; j++){
            if (i == j) continue;
            if (a[i] > a[j] && j < i){
                a1++;
            } else if (a[i] > a[j] && i < j){
                a2++;
            }
        }
        //cout << a1 << " " << a2 << endl;
        sum += ((a1 + a2)*((K*(K-1)/2)%MOD) + a2*K);
        sum %= MOD;
    }
    cout << sum << endl;
}

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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n, m, k;
  cin >> n >> m >> k;
  vector<int> x(n + 1), y(m + 1), a(m + 1);
  rep(i, 1, n + 1) cin >> x[i];
  rep(i, 1, m + 1) {
    cin >> y[i];
    a[i] += a[i - 1] + y[i];
  }

  int ans = 0, cnt = 0;

  rep(i, 0, n + 1) {
    cnt += x[i];
    auto itr = upper_bound(a.begin(), a.end(), k - cnt) - a.begin();
    if (k - cnt >= 0) chmax(ans, i + itr - 1);
  }

  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 7956
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			int r = sc.nextInt();
			if(n == 0 && r == 0)
				break;
			int[] num = new int[n];
			for(int i = 0, j = n; i < num.length; i++, j--)
				num[i] = j;

			for(int i = 0; i < r; i++) {
				int p = sc.nextInt();
				int c = sc.nextInt();
				for(int j = 0; j < c; j++) {
						int temp = num[p + c - 2];
					for(int k = p + c - 2; k > 0; k--) {
						num[k] = num[k - 1];
						num[k - 1] = temp;
					}
				}
			}
			System.out.println(num[0]);
		}
	}
}

Measured memory_bytes: 39020
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reve(a) reverse(a.begin(), a.end())
#define PI 3.14159265359
typedef long long ll;
const ll MOD = 1e9+7;

ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}
/*ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}*/

ll lcm(ll a, ll b){
  ll g = gcd(a, b);
  b /= g;
  a *= b;
  return a;
}

//素数判定 O(√n)
bool is_prime(int64_t n){
  for(int64_t i = 2; i*i<=n; i++){
    if(n%i==0) return false;
  }
  return n!=1;
}

//約数の列挙 O(√n)
vector<int64_t> dividor(int64_t n){
  vector<int64_t> res;
  for(int64_t i=1; i*i<=n; i++){
    if(n%i==0){
      res.push_back(i);
      if(i != n/i) res.push_back(i);
    }
  }
  return res;
}

//素因数分解 O(√n)
map<int64_t, int64_t> prime_factor(int64_t n){
  map<int64_t, int64_t> res;
  for(int64_t i=2; i*i<=n; i++){
    while(n%i==0){
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n] = 1;
  return res;
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

  


int main(){ 
  int64_t n, k; cin >> n >> k;
  vector<int64_t> A(n);
  int64_t a;
  rep(i, n){
    cin >> a;
    A[i] = a-1;
  }
  int64_t p=A[0];
  int64_t c;
  int64_t ct2=0LL;
  map<int64_t, int64_t> B;
  B[0] = p;

  //cout << 1 << endl;
  if(n<k){
  rep(i, n){
    if(B.count(p)){
      c = p;
      break;
    }
    else {
      B[p] = A[p];
      p = A[p];
      ct2++;
    }
  }
  //cout << c << endl;
  //cout << 1 << endl;
  p=0;
  int64_t ct1=0LL; 
  rep(i, n){
    if(p==c){
      break;
    }
    else {
      ct1++;
      p = A[p];
    }
  }
  //cout << ct2 << endl;
  k -= ct1;
  //cout << ct1 << endl;
  int64_t ct = ct2-ct1+1;
  //cout << ct << endl;
  int64_t r;
  r = k%ct;
  //cout << r << endl;
  //r--;
  //cout << 1 << endl;
  //if(r<0) {r = ct-1;}
  p = c;
  //cout << p << endl;
  rep(i, r){
    p=B[p];
  }
  cout << p+1 << endl;
  }
  else {
    int64_t g = 0;
    rep(i, k){
      g = A[g];
    }
    cout << g+1 << endl;
  }
}



Measured memory_bytes: 14768
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.buffer.readline


n_nodes, q_query = map(int, input().split())

edges = [[] for _ in range(n_nodes)]
for _ in range(n_nodes - 1):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

queries = []
for _ in range(q_query):
    p, x = map(int, input().split())
    queries.append([p - 1, x])

# print(n_nodes, q_query)
# print(edges, queries)

res = [0 for _ in range(n_nodes)]
for node, point in queries:
    res[node] += point


def dfs(v, parent):
    for v_next in edges[v]:
        if v_next != parent:
            res[v_next] += res[v]
            dfs(v_next, v)


dfs(0, None)

print(*res)


Measured memory_bytes: 257752
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextInt64() int64 {
	i, err := strconv.ParseInt(io.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}


func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func intMin(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func (io *Io) PrintBool(b bool, trueS, falseS string) {
	if b {
		io.PrintLn(trueS)
	} else {
		io.PrintLn(falseS)
	}
}

func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func absi(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func b2i(b bool) int {
	if b {
		return 1
	}
	return 0
}

type Int64s []int64
func (f Int64s) Len() int {
	return len(f)
}
func (f Int64s) Less(i, j int) bool {
	return f[i] < f[j]
}

func (f Int64s) Swap(i, j int) {
	f[i], f[j] = f[j], f[i]
}


func abcInt(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func gcdInt(a, b int) int {
	for a%b != 0 {
		a, b = b, a%b
	}
	return b
}

var (
	io *Io
)

type P struct {
	s string
	p int
	id int
}

type PS []P
func (f PS) Len() int {
	return len(f)
}
func (f PS) Less(i, j int) bool {
	if f[i].s != f[j].s {
		return f[i].s< f[j].s
	}
	return f[i].p > f[j].p
}

func (f PS) Swap(i, j int) {
	f[i], f[j] = f[j], f[i]
}

func solve() {
	n,m := io.NextInt(), io.NextInt()
	x := make([][]int, n)
	for i := 0; i < m; i++ {
		k := io.NextInt()
		for j := 0; j < k; j++ {
			v := io.NextInt() - 1
			x[v] = append(x[v], i)
		}
	}
	p := make([]int, m)
	for i := 0; i< m; i++ {
		p[i] = io.NextInt()
	}

	ans := 0
	for i := 0; i < (1<<uint(n)); i++ {
		b := make([]int, m)
		for j := 0; j < n; j++ {
			if i & (1<<uint(j)) != 0 {
				for _, k := range x[j] {
					b[k] ^= 1
				}
			}
		}
		ok := true
		for i := range b {
			if p[i] != b[i] {
				ok = false
			}
		}
		if ok {
			ans++
		}
	}

	io.PrintLn(ans)
}


func main() {
	io = NewIo()
	f, err := os.Open("src/input")
	if err == nil {
		io.reader = bufio.NewReader(f)
	}
	defer io.Flush()

	solve()
}

Measured memory_bytes: 768
#include <iostream>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    if(a == b)
        cout << "Draw";
    else if(a == 1 && b != 1)
        cout << "Alice";
    else if(b == 1 && a != 1)
        cout << "Bob";
    else if(a < b)
        cout << "Bob";
    else if(a > b)
        cout << "Alice";
    return 0;
}


Measured memory_bytes: 3600
import math

num = int(input())

x = list(map(float,input().split()))

y = list(map(float,input().split()))

diff = [0]*num

for a in range(num):
    diff[a] = abs(x[a] - y[a])
    
print(sum(diff)) #1

po = [0]*num

for b in range(num):
    po[b] = diff[b] * diff[b]
    
print(math.sqrt(sum(po))) #2



for c in range(num):
    po[c] = diff[c] * diff[c] * diff[c]
    
print((sum(po))**(1/3)) #3

_max = 0

for d in diff:
    if _max < d:
        _max = d

print(_max)#infinity


Measured memory_bytes: 5700
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pll>   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pi>   vpi;
typedef    set<pi>   spi;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define    all(x)   x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(10)<<fixed
#define    mems(dp,x)   memset(dp,x,sizeof(dp))
const    ld   PI=3.1415926535897932384626433832792884197169399375105820974944;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}
inline ll lcm(ll a,ll b){return ((a*b)/gcd(a,b));}


int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{




int n;
cin>>n;

ll a[n];
for(int i=0;i<n;i++)
cin>>a[i];


ll ut=a[0];
for(int i=1;i<n-1;i++)
{
	ut=a[i]-ut;
}
ll las=(ut+a[n-1]);
ll fir=2*(a[n-1]-(las/2));

ll ans[n];
ans[0]=fir;
ans[n-1]=las;

for( int i=0;i<n-1;i++)
{
	ans[i+1]=2*(a[i]-(ans[i]/2));
}

for(int i=0;i<n;i++)
cout<<ans[i]<<" ";









}return 0;}

Measured memory_bytes: 2944
class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        self.parents[x] = self.find(self.parents[x])
        return self.parents[x]


    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

def main():
    N, M = map(int, input().split())
    U = UnionFind(N)
    for _ in range(M):
        a, b = map(int, input().split())
        U.union(a - 1, b - 1)
    return max(U.size(i) for i in range(N))

print(main())


Measured memory_bytes: 14512
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

char a[100][100];
bool b[100][100];
bool line[100];

int main()
{
  int h,w;
  cin >> h >> w;
  bool flag;
  REP(i,h){
    flag = true;
    REP(j,w){
      cin >> a[i][j];
      b[i][j] = true;
      if(a[i][j] == '#') flag = false;
    }
    if(flag){
      line[i] = false;
      REP(j,w) b[i][j] = false;
    }else{
      line[i] = true;
    }
  }
  REP(j,w){
    flag = true;
    REP(i,h){
      if(a[i][j] == '#') flag = false;
    }
    if(flag){
      REP(i,h) b[i][j] = false;
    }
  }
  
  REP(i,h){
    flag = true;
    REP(j,w){
      if(b[i][j]) cout << a[i][j];
    }
    if(line[i]) cout << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
N=int(input())
A = list(map(int,input().split(' ')))
B = list(map(int,input().split(' ')))
a=0
b=0
for i,j in zip(A,B):
    if j-i>=0:
        a += (j-i)//2
    else:
        b += i-j
if a >= b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long int ll;
typedef unsigned long long ull;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair <PLL, int> PLLI;
typedef pair <PLL, PLL> PP;
typedef pair <PII, int> PPI;
typedef pair <ll, int> PLI;
typedef unsigned int ui;
const int inf = 1e9+9;
const int mod = 1e9+7;

const ll MOD = 1e9+696969;
const long long INF = 1e18+3;
#define maxn 500100
int tab[maxn], p[maxn], n, k;

const int R = (1 << 19);
PII dr[2 * R + 5];

inline void update(int x, int v)
{
	x += R-1;
	dr[x] = mp(v, x - R + 1);
	x >>= 1;
	while (x)
	{
		dr[x] = max(dr[x << 1 | 0], dr[x << 1 | 1]);
		x >>= 1;
	}
}

inline PII getMax(int x, int y)
{
	x += R-1; y += R-1;
	PII res = mp(-1, -1);
	res = max(res, dr[x]);
	if (x == y) return res;
	res = max(res, dr[y]);
	while (x + 1 < y)
	{
		if (!(x & 1)) res = max(res, dr[x + 1]);
		if (y & 1) res = max(res, dr[y - 1]);
		x >>= 1; y >>= 1;
	}
	return res;
}

int DL, odp[maxn];
set <int> best;

inline void poprawWiaderko(int bucket)
{
	PII f = getMax(max(1, bucket * k), min(n, (bucket + 1) * k - 1));	
	if (getMax(max(1, f.e2 - k + 1), min(n, f.e2 + k - 1)) == f && f.e1 != 0) best.insert(-f.e2);
}

int main()
{
	boost;
	cin >> n >> k;
	FOR(i, 1, n) 
	{
		cin >> p[i];
		tab[i] = p[i];
	}
	best.clear();
	FOR(i, 1, n) update(i, tab[i]);
	FOR(i, 0, n/k) poprawWiaderko(i);
	int MX = n / k;
	FOR(step, 1, n)
	{
		assert(!best.empty());
		int i = -(*best.begin());
		odp[i] = n - step + 1;
		best.erase(best.begin());
		int bucket = i / k;
		update(i, 0);
		poprawWiaderko(bucket);
		if (bucket != MX) poprawWiaderko(bucket + 1);
		if (bucket != 0) poprawWiaderko(bucket - 1);
	}
	
	FOR(i, 1, n) cout << odp[i] << "\n";
}


Measured memory_bytes: 41088
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long) 1e9 + 7;

long MAX(long x, long y){
    if(x > y){
        return x;
    } else {
        return y;
    }
}

int main(){
    
    long a, b, c, d, ans;
    cin >> a >> b >> c >> d;
    
    ans = MAX((a*c), MAX((a*d), MAX(b*c, b*d)));
    
    cout << ans << "\n";
    
    return 0;
}



Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=1000000007;
struct edges
{
	int to,next;
}edge[202];
int first[55],now;
void adde(int x,int y)
{
	now++;
	edge[now].to=y;
	edge[now].next=first[x];
	first[x]=now;
}
int dfn[55],low[55],dn;
bool ins[55];
int st[55],sn;
int pn[55],cnt;
int en,n,k;
int c[303][303];
bool h[55];
int fpow(int x,int y)
{
	if(y==0)
		return 1;
	int ret=fpow(x,y>>1);
	ret=(long long)ret*ret%mod;
	if(y&1)
		ret=(long long)ret*x%mod;
	return ret;
}
int gcd(int x,int y)
{
	if(y==0)
		return x;
	return gcd(y,x%y);
}
int calc(int x)
{
	int ret=0;
	for(int i=1;i<=x;i++)
		(ret+=fpow(k,gcd(i,x)))%=mod;
	ret=(long long)ret*fpow(x,mod-2)%mod;
	return ret;
}
long long ans=1;
void work(int p)
{
	dfn[p]=low[p]=++dn;
	st[++sn]=p;
	ins[p]=true;
	for(int e=first[p];e;e=edge[e].next)
		if(!dfn[edge[e].to])
		{
			work(edge[e].to);
			low[p]=min(low[p],low[edge[e].to]);
			if(low[edge[e].to]>=dfn[p])
			{
				cnt=1;
				pn[cnt]=p;
				h[p]=true;
				do
				{
					ins[st[sn]]=false;
					pn[++cnt]=st[sn];
					h[st[sn]]=true;
					sn--;
				}while(st[sn+1]!=edge[e].to);
				en=0;
				for(int i=1;i<=n;i++)
					if(h[i])
						for(int ee=first[i];ee;ee=edge[ee].next)
							if(h[edge[ee].to])
								en++;
				en>>=1;
				if(en==1)
					ans=(long long)ans*k%mod;
				else if(en==cnt)
					ans=(long long)ans*calc(en)%mod;
				else
					ans=(long long)ans*c[en+k-1][k-1]%mod;
				for(int i=1;i<=cnt;i++)
					h[pn[i]]=false;
			}
		}
		else if(ins[edge[e].to])
			low[p]=min(low[p],dfn[edge[e].to]);
}
int main()
{
	int m,x,y;
	scanf("%d%d%d",&n,&m,&k);
	memset(c,0,sizeof(c));
	for(int i=0;i<=300;i++)
	{
		c[i][0]=1;
		for(int j=1;j<=i;j++)
			c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
	}
	memset(first,0,sizeof(first));
	now=0;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&x,&y);
		adde(x,y);
		adde(y,x);
	}
	memset(dfn,0,sizeof(dfn));
	memset(ins,0,sizeof(ins));
	dn=0;
	memset(h,0,sizeof(h));
	sn=0;
	for(int i=1;i<=n;i++)
		if(!dfn[i])
			work(i);
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 640
# queueのライブラリをインポート
import queue
 
n,m = map(int,input().split())
# 各都市から繋がっている都市を記録
road = [[] for i in range(n)]
for i in range(m):
  a,b = map(int,input().split())
  road[a-1].append(b-1)
  road[b-1].append(a-1)
ans = 0
# まだ訪れていない都市を記録
city = set(i for i in range(n))
# まだ訪れていない都市がある間繰り返す
while len(city):
  # queueを用意する
  q = queue.Queue()
  # 初期値としてまだ訪れていない都市を入れる
  q.put(city.pop())
  # 1つのグループを全て辿る
  while not q.empty():
    x = q.get()
    for i in road[x]:
      # 既に訪れたか調べる
      if i in city:
        # 訪れていなければqueueに追加する
        q.put(i)
        # 未訪問の都市のリストから除外する
        city.discard(i)
  # まだ訪れていない都市があれば答えを増やす
  if len(city):
    ans += 1
print(ans)

Measured memory_bytes: 34456
s=list(input())
t=list(input())
score=len(t)

for i in range(len(s)-len(t)+1) :
    ans=0
    for j in range(len(t)) :
        if s[i+j]==t[j] :
            continue
        elif s[i+j]!=t[j] :
            ans+=1
    score=min(ans,score)

print(score)
    

Measured memory_bytes: 8980
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
//#include<bits/stdc++.h>
#define ll long long
using namespace std;
char s[210][110];
int main()
{
	ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	
	for(int i=0;i<2*a;i=i+2)
        for(int j=0;j<b;j++)
        {
        	cin>>s[i][j];
        	s[i+1][j]=s[i][j];
		}
    for(int i=0;i<2*a;i++){
    	for(int j=0;j<b;j++)
			cout<<s[i][j];
		cout<<endl;
	}
		
return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
# define MOD 1000000007
typedef long long ll;
int dp[2][1000001];
ll util(vector<int> adj[], int n, int u, int parent, int flag){
    if(dp[flag][u] != -1) return dp[flag][u]%MOD;
    int white = 1;
    for(int i=0;i<adj[u].size();i++){
        int v = adj[u][i];
        if(v != parent){
            ll o1 = util(adj, n, v, u, 0);
            white = (white*o1)%MOD;
        }
    }
    int res = white;
    if(flag == 0){
        int black = 1;
        for(int i=0;i<adj[u].size();i++){
            int v = adj[u][i];
            if(v != parent){
                ll o2 = util(adj, n, v, u, 1);
                black = (black*o2)%MOD;
            }
        }
        res = (res + black)%MOD;
    }
    dp[flag][u] = res;
    return res;
}
int main(){
	int n;
	cin>>n;
    vector<int> adj[n];
    for(int i=0;i<n-1;i++){
        int xi, yi;
        cin>>xi>>yi;
        adj[xi-1].push_back(yi-1);
        adj[yi-1].push_back(xi-1);
    }
    memset(dp, -1, sizeof(dp));
    int ans = util(adj, n, 0, -1, 0);
    cout<<ans;
	return 0;
}

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

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

struct UnionFind {
    int n, cc, *u;
    UnionFind() : n(0), cc(0), u(NULL) {}
    UnionFind(int n_) : n(n_), cc(n_) {
	u = new int[n_];
	memset(u, -1, sizeof (int) * n);
    }
    UnionFind(const UnionFind &y) : n(y.n), cc(y.cc) {
	u = new int[y.n];
	memcpy(u, y.u, sizeof (int) * n);
    }
    ~UnionFind() {
	delete[] u; u = NULL;
	n = cc = 0;
    }
    friend void swap(UnionFind &x, UnionFind &y) {
	swap(x.n, y.n); swap(x.cc, y.cc); swap(x.u, y.u);
    }
    UnionFind& operator=(UnionFind y) { 
	swap(*this, y);
	return *this;
    }
    int root(int x) {
	int y = x, t;
	while (u[y] >= 0) y = u[y];
	while (x != y) { t = u[x]; u[x] = y; x = t; }
	return y;
    }
    bool link(int x, int y) {
	x = root(x); y = root(y);
	if (x == y) return false;
	if (u[y] < u[x]) swap(x, y);
	u[x] += u[y]; u[y] = x; cc--;
	return true;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int size(int x) { return -u[root(x)]; }
    int count() { return cc; }
};
int N;
int A[100011];
int B[100011];
int C[100011];
int D[100011];
int cnt[100011];

int idx(int v) {
    return lower_bound(C, C+N+1, v) - C;
}

void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%d", A+i);
    REP (i, N) scanf("%d", B+i);

    REP (i, N) {
	A[N] ^= A[i];
	B[N] ^= B[i];
    }
    REP (i, N+1) {
	C[i] = A[i];
	D[i] = B[i];
    }
    sort(C, C+N+1);
    sort(D, D+N+1);
    
    bool yes = true;
    REP (i, N+1) {
	if (C[i] != D[i]) yes = false;
    }

    if (!yes) {
	puts("-1");
	return;
    }

    UnionFind U(N+1);
    REP (i, N+1) if (A[i] != B[i]) {
	int a = U.root(idx(A[i])), b = U.root(idx(B[i]));
	if (!U.same(a, b)) {
	    U.link(a, b);
	    cnt[U.root(a)] = cnt[a] + cnt[b];
	}
	cnt[U.root(a)]++;
    }

    int p = idx(A[N]);
    int ans = 0;
    REP (a, N+1) if ((a == 0 || C[a-1] != C[a]) && U.size(a) > 1 && U.root(a) == a) {
	if (U.same(a, p)) {
	    if (A[N] != B[N]) {
		ans += cnt[a]-1;
	    } else {
		ans += cnt[a];
	    }
	} else {
	    ans += cnt[a]+1;
	}
    }

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

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 2560
#!/usr/bin/env python3
import numpy as np


def is_ok(mid, K, A, F):
    return np.maximum(A - mid // F, 0).sum() <= K


def main():
    N, K = input_line(int, int)
    A = input_line([int])
    F = input_line([int])
    A = np.array(sorted(A))
    F = np.array(sorted(F, reverse=True))

    ng = -1
    ok = int(1e12)
    while ok - ng > 1:
        mid = (ng + ok) // 2
        if is_ok(mid, K, A, F):
            ok = mid
        else:
            ng = mid
    print(ok)


def input_line(*types):
    if isinstance(types[0], list):
        return [types[0][0](x) for x in input().split()]
    elif len(types) == 1:
        return types[0](input())
    else:
        return [t(x) for t, x in zip(types, input().split())]


if __name__ == "__main__":
    main()


Measured memory_bytes: 43644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M = 1e5 + 10;
char s[M];
int nex[M][3], a[3], b[M];
int main(){
    int n;
    scanf("%d", &n);
    scanf("%s", s + 1);
    for(int i = n; i >= 1; i--) {
        if(s[i] == 'R') b[i] = 0;
        else if(s[i] == 'G') b[i] = 1;
        else b[i] = 2;
    }
    for(int i = n; i >= 1; i--) {
        nex[i][0] = a[0];
        nex[i][1] = a[1];
        nex[i][2] = a[2];
        a[b[i]]++;
    }
    //for(int i = 1; i <= n; i++) printf("i = %d %d %d %d\n", i, nex[i][0], nex[i][1], nex[i][2]);
    ll ans = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = i + 1; j <= n; j++) {
            if(b[i] == b[j]) continue;
            int k;
            for(k = 0; k < 3; k++) {
                if(k != b[i] && k != b[j]) break;
            }
            ans += nex[j][k];
            if(j + j - i <= n) if(b[j + (j - i)] == k) ans--;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3876
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
const int MAXN = 5*(1e15);
int main(){
	 string s;
	 cin>>s;
	 long long k;
	 cin>>k;
	 for(int i=0;i<k;){
	 	if(s[i]=='1'){
	 		i++;
		 }else{
		 	cout<<s[i];
		 	return 0;
		 }
	 	
	 }
	 cout<<"1";
	 return 0;
	 
}

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

// flag を用いたバブルソート
int bubbleSort(int A[], int N) {
  int sw = 0;
  bool flag = 1;
  for ( int i = 0; flag; i++ ) {
    flag = 0;
    for ( int j = N - 1; j >= i + 1; j-- )
      if ( A[j] < A[j - 1] ) {
        // 隣接要素を交換する
        swap(A[j], A[j - 1]);
        flag = 1;
        sw++;
      }
  }
  return sw;
}

int main() {
  int A[100], N, sw;
  cin >> N;
  for ( int i = 0; i < N; i++ ) cin >> A[i];

  sw = bubbleSort(A, N);

  for ( int i = 0; i < N; i++ ) {
    if (i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  cout << sw << endl;

  return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
map<string,int>M;//0:?/1:ok/2:ng

int chk(string s){
	if(M[s]!=0)return M[s];
	if(s=="")return M[s]=1;
	if(s[0]!='m' || s[s.size()-1]!='w' || s.size()<3)return M[s]=2;
	string t=s.substr(1,s.size()-2);
	if(t.find("e")==string::npos)return M[s]=2;
	int flg=2;
	for(int i=0;i<t.size();i++){
		if(t[i]=='e'){
			if(chk(t.substr(0,i))==1 && chk(t.substr(i+1))==1)flg=1;
		}
	}
	return M[s]=flg;
}

int main(){
	
	string s;
	while(cin>>s)cout<<(chk(s)==1?"Cat":"Rabbit")<<endl;
	
	return 0;
}


Measured memory_bytes: 5820
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
bool cal(){
	int a,b;string s;
	cin>>a>>b;cin>>s;
	rep(i,a+b+1){
		if(i==a){
			if(s[i]!='-') return false;
		}
		else{
			if(s[i]>'9' || s[i]<'0') return false;
		}
	}
	return true;
}
int main()
{
	if(cal()) cout<<"Yes"<<endl;else cout<<"No"<<endl;
}


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

const int MAX = 1001;
int J[MAX][MAX], O[MAX][MAX], I[MAX][MAX];
char JOI[MAX][MAX];

int solve(int X, int Y) {
  for (int y = 1; y <= Y; y++) {
    for (int x = 1; x <= X; x++) {
      J[x][y] = J[x-1][y] + J[x][y-1] - J[x-1][y-1]
        + ((JOI[x][y] == 'J')? 1:0);

      O[x][y] = O[x-1][y] + O[x][y-1] - O[x-1][y-1]
        + ((JOI[x][y] == 'O')? 1:0);
      
      I[x][y] = I[x-1][y] + I[x][y-1] - I[x-1][y-1]
        + ((JOI[x][y] == 'I')? 1:0);
    }
  }
}

int search(int b, int a, int d, int c, char target) {
  if (target == 'J') {
    return J[c][d] - J[a - 1][d] - J[c][b - 1] + J[a - 1][b - 1];
  } else if (target == 'O') {
    return O[c][d] - O[a - 1][d] - O[c][b - 1] + O[a - 1][b - 1];
  } else {
    return I[c][d] - I[a - 1][d] - I[c][b - 1] + I[a - 1][b - 1];
  }
}

int main() {
  int x, y, k;
  string s;
  cin >> y >> x >> k;

  for (int j = 1; j <= y; j++) {
    cin >> s;
    for (int i = 1; i <= x; i++) {
      JOI[i][j] = s[i - 1];
    }
  }
  
  solve(x, y);

  for (int i = 0; i < k; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << search(a, b, c, d, 'J') << " "
         << search(a, b, c, d, 'O') << " "
         << search(a, b, c, d, 'I') << endl;
  }
}

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


int main(){
    ll n;
    cin >> n;
    ll a[n];
    for(ll i=0;i<n;i++) cin >> a[i];
    ll count=0;
    for(ll i=0;i<n-2;i++){
        for(ll j=i+1;j<n-1;j++){
            for(ll k=j+1;k<n;k++){
                if(a[i]!=a[k]&&a[k]!=a[j]&&a[i]!=a[j]&&a[i]+a[j]>a[k]&&a[i]+a[k]>a[j]&&a[k]+a[j]>a[i]) count++;
            }
        }
    }
    cout << count << endl;
}  


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

int main(void){
    int n,k;
    cin >> n >> k;
    
    vector<bool> p(n+1);
    for(int i=0;i<k;i++){
        int d;
        cin >> d;
        for(int j=0;j<d;j++){
            int e;
            cin >> e;
            p[e] = true;
        }
    } 
    int count = 0;
    for(int i=1;i<=n;i++){
        if(!p[i]) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3624
import sys

input = sys.stdin.readline


def ii():
    return int(input())


def il():
    return list(map(int, input().split()))


N, A, B = il()
s = 0
for n in range(1, N + 1):
    k = [int(i) for i in str(n)]
    if A <= sum(k) <= B:
        s += n
print(s)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	string c[2];
	cin>>c[0];
	cin>>c[1];
	reverse(c[0].begin(),c[0].end());
	if(c[1]==c[0])cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

	
		

Measured memory_bytes: 256
var s:ansistring;
    ch:string;
    i, T, opt, tp, rev: longint;
begin
  readln(s); readln(T);
  for i:= 1 to T do 
    begin
      read(tp);
      if tp = 1 then rev := 1 - rev
      else begin
        read(opt); read(ch);
        delete(ch, 1, 1);
        if rev = 1 then opt := 3 - opt;
        if (opt = 1) then s := ch + s
        else s := s + ch;
      end;
    end;
    if (rev = 1) then 
      begin
        for i:= length(s) downto 1 do write(s[i]);
        writeln;
      end else 
      begin for i:= 1 to length(s) do write(s[i]);
        writeln;end;
end.

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> ivv;
typedef vector<string> sv;

int main()
{
	string s;
	cin >> s;
	
	
	cout << "ABC" << s << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <assert.h>
#include <cstdio>

// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

inline bool chmin(ll &a, ll b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

inline bool chmax(ll &a, ll b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

//桁数取得
template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}
//整数乗
ll llpow(ll a, ll n)
{
    if (n == 0)
    {
        return 1;
    }
    else
    {
        ll rep = a;
        for (ll i = 1; i < n; i++)
        {
            rep *= a;
        }
        return rep;
    }
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

template <typename T>
T amarinasi(T a, T b)
{
    if (a % b == 0)
    {
        return a / b;
    }
    else if (a % b > 0)
    {
        return a / b + 1;
    }
    else
    {
        return a / b - 1;
    }
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------
const double pi = 3.14159265358979323846264;

int main()
{
    ll n, x, t;
    cin >> n >> x >> t;
    if (n % x)
    {
        cout << t * (n / x + 1) << endl;
    }
    else
    {
        cout << t * (n / x) << endl;
    }
}

Measured memory_bytes: 3620
N,M = map(int,input().split())

X = [list(map(int,input().split())) for _ in range(N)]
X = sorted(X,key=lambda X:-X[0])
a = X[0][0]
X = sorted(X,key=lambda X:-X[1])

i = 0
count = 0
while M > 0:
	if i < N and X[i][1] > a:
		M -= X[i][1]
		i += 1
	else:
		count += -(-M//a)
		break
	count += 1

print(count)


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

using namespace std;
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007
#define INF (1<<28)
#define int long long
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)

signed main(){
	int n;
	cin>>n;
	int a[100000],b[100000];
	lp(i,n){
		cin>>a[i];
		b[i]=a[i];
	}
	sort(a,a+n);
	int x=a[0],y=a[0];
	int itf=1,ite=n-1;
	int ans=0;
	while(1){
		ans+=a[ite]-x;
		x=a[ite];
		ite--;
		//cout<<ans<<endl;
		if(ite<itf) break;
		ans+=a[ite]-y;
		y=a[ite];
		ite--;
		//cout<<ans<<endl;
		if(ite<itf) break;
		ans+=x-a[itf];
		x=a[itf];
		itf++;
		//cout<<ans<<endl;
		if(ite<itf) break;
		ans+=y-a[itf];
		y=a[itf];
		itf++;
		//cout<<ans<<endl;
		if(ite<itf) break;
	}
	sort(b,b+n);
	reverse(b,b+n);
	x=b[0],y=b[0];
	itf=1,ite=n-1;
	int ans2=0;
	while(1){
		ans2+=x-b[ite];
		x=b[ite];
		ite--;
		//cout<<ans2<<endl;
		if(ite<itf) break;
		ans2+=y-b[ite];
		y=b[ite];
		ite--;
		//cout<<ans2<<endl;
		if(ite<itf) break;
		ans2+=b[itf]-x;
		x=b[itf];
		itf++;
		//cout<<ans2<<endl;
		if(ite<itf) break;
		ans2+=b[itf]-y;
		y=b[itf];
		itf++;
		//cout<<ans2<<endl;
		if(ite<itf) break;
	}
	cout<<max(ans2,ans)<<endl;
	return 0;
}

Measured memory_bytes: 1920
#include<iostream>
#include <stdio.h>
using namespace std;

int main(){
    int H,W;
    int i,j;
           
    for (;;){
        cin >> H >> W;
        if (H==0 && W==0)break;        
        for (i=0;i<H;i++){
            for (j=0;j<W;j++){
                if (i % 2) {
                    if (j !=(W-1)){
                        if (j % 2){
                            cout << "#";
                        }else{
                            cout << ".";
                        }    
                    }else{
                        if (j % 2){
                            cout << "#"<< endl;
                        }else{
                            cout << "." << endl;
                        }
                    }
                } else {
                    if (j !=(W-1)){
                        if (j % 2){
                            cout << ".";
                        }else{
                            cout << "#";
                        }    
                    }else{
                        if (j % 2){
                            cout << "."<< endl;
                        }else{
                            cout << "#" << endl;
                        }
                    }
                }

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

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <set>
#include <map>

int main(){
  int64_t count = 0;
  int white = 0;
  int c;
  for(int i = 0; (c = getchar()) != EOF; i++){
    if(c == 'W') {
      count += i - white;
      white++;
    }
  }
  printf("%lld\n", count);
  return 0;
}

Measured memory_bytes: 128