akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    vector<string> A(N);
    vector<string> B(M);

    REP(i, N) { cin >> A[i]; }
    REP(i, M) { cin >> B[i]; }

    REP(x, N - M + 1) {      //探索開始点(x)
        REP(y, N - M + 1) {  //探索開始点(y)
            int loss = 0;
            REP(j, M) {      //探索画素位置(x)
                REP(i, M) {  //探索画素位置(y)
                    if (A[y + i][x + j] != B[i][j]) loss++;
                    debug(x, y, j, i, A[y + i][x + j], B[i][j], loss);
                    if (loss > 0) break;
                }
                if (loss > 0) break;
            }
            if (loss == 0) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAX 10000
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
static const int N = 100;
static const int INFTY = 10000000;

int n,M[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u){
  int v;
  color[u] = GRAY;
  tt++;
  d[u] = tt;
  for( v = 0;v<n;v++){
    if(M[u][v] ==0) continue;
    if(color[v] == WHITE){
      dfs_visit(v);
    }
  }
  color[u] = BLACK;
  tt++;
  f[u] = tt;
}
void dfs(){
  int u;
  for(u =0;u<n;u++) color[u] = WHITE;
  tt = 0;
  
  for(u= 0;u<n;u++){
    if(color[u] == WHITE) dfs_visit(u);
  }
  for(u = 0;u<n;u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
}


int main(){
  int u,v,k,i,j;
  
  scanf("%d",&n);
  for(i = 0;i<n;i++){
    for(j = 0;j<n;j++){
      M[i][j] = 0;
    }
  }
  for(i = 0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j = 0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }
    dfs();

}


Measured memory_bytes: 3212
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int q = sc.nextInt();
		int[] result = new int[n];
		ArrayList<Edge>[] list = new ArrayList[n];
		for(int i = 0; i < n; i++){
		    list[i] = new ArrayList<Edge>();
		}
		for(int i = 0; i < n-1; i++){
		    int from = sc.nextInt()-1;
		    int to = sc.nextInt()-1;
		    list[from].add(new Edge(from, to, 0));
		    list[to].add(new Edge(to, from, 0));
		}
		int[] c = new int[n];
		for(int i = 0; i < q; i++){
		    int index = sc.nextInt()-1;
		    c[index] += sc.nextInt();
		}
		
		// 計算
		PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
		int[] visited = new int[n];
		pq.add(0);
		result[0] = c[0];
		visited[0] = 1;
		while(!pq.isEmpty()){
		    int from = pq.poll();
		    for(Edge e : list[from]){
		        int to = e.to;
		        if(visited[to] == 1) continue;
		        visited[to] = 1;
		        result[to] = result[from] + c[to];
		        pq.add(to);
		    }
		}
		
		// 出力
		for(int i = 0; i < n; i++){
		    System.out.print(result[i] + " ");
		}
		
	}
}

class Edge {
    int from;
    int to;
    int weight;
    
    Edge(int from, int to, int weight){
        this.from = from;
        this.to = to;
        this.weight = weight;
    }

    public String toString(){
        return "from:" + from + " to:" + to + " weight:" + weight;
    }   
}



Measured memory_bytes: 218528
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void)
{
  char *S=(char *)malloc(128);
  char *T=(char *)malloc(128);
  scanf("%s",S);
  scanf("%s",T);
  *(T+(strlen(S)))='\0';
  if(strcmp(S,T)){
    puts("No");
  }else{
    puts("Yes");
  }
  free(S);
}


Measured memory_bytes: 1656
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
int main()
{
	fast;
	double h,w,x,y;
	cin>>w>>h>>x>>y;
	double ans1=0,ans2=0,ans;
	if(x*2==w&&y*2==h)
		ans2=1;
	cout<<fixed<<setprecision(9)<<h*w/2.0<<" ";
	cout<<fixed<<setprecision(0)<<ans2;
	return 0;
}


Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll nxt[MAX],need,c[MAX];
vector<ll>v;
void tour(int par,int k)
{
    v.clear();
    ll sum=0,ans=0,it=0,cur=par;
    while(nxt[cur]!=par)
    {
        cur=nxt[cur];
        sum+=c[cur];
        v.push_back(sum);
    }
    v.push_back(sum+c[par]);
}
ll test(ll k)
{
    ll sz=v.size();
    ll mx=0,ans=-1e18;
    if(sz==0)
        return ans;
    if(k>sz)
    {
        ll cur=0;
        cur=v[sz-1];
        ll mul=k/sz;
        cur*=mul;
        ll rem=k%sz;
        mx=0;
        for(int i=0; i<rem; i++)
            mx=max(mx,v[i]);
        cur+=mx;
        if(rem==0){
            for(int i=sz-1;i>=0;i--)
                ans=max(ans,cur-v[i]);
        }
        ans=max(ans,cur);
        for(int i=0; i<sz; i++)
            ans=max(ans,v[i]);
    }
    else
    {
        for(int i=0; i<k; i++)
            ans=max(ans,v[i]);
    }
    return ans;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,k;
    cin>>n>>k;
    ll ans=-1e18;
    for(int i=1; i<=n; i++)
    {
        cin>>nxt[i];
    }
    for(int i=1; i<=n; i++)
    {
        cin>>c[i];
    }
    for(int i=1; i<=n; i++)
    {
        tour(i,k);
        ans=max(ans,test(k));
    }
    cout<<ans<<endl;


    return 0;
}


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

int main()
{
  int n, m, b = 0;
  cin >> n >> m;
  vector<int> broken(m + 1), count(n + 1);
  for (int i = 0; i < m; i++) cin >> broken.at(i);
  count.at(0) = 1;
  for (int i = 1; i <= n; i++) {
    if (i == broken.at(b)) {
      count.at(i) = 0;
      b++;
    } else if (i == 1) {
      count.at(i) = count.at(i - 1);
    } else {
      count.at(i) = (count.at(i - 1) + count.at(i - 2)) % 1000000007;
    }
  }
  cout << count.at(n) << endl;
}


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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    h, a = input_to_int_map()

    if h % a == 0:
        return h // a

    return (h // a) + 1


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
void solve(){
string a;
	cin>>a;
	for(int i=0;i<a.size();i++)
		if(a[i]=='7'){
			cout<<"Yes"<<endl;
			return;
		}
	cout<<"No"<<endl;
}
int main(){
	solve();
	return 0;
}

Measured memory_bytes: 3592
#include "bits/stdc++.h"
using namespace std;
using LL = long long;
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

int n;
LL a[202020];
const LL mod = 1e9 + 7;
int main(){
    cin >> n;
    LL sum = 0;
    REP(i, n){
        cin >> a[i];
    }
    LL ans = 0;
    for(int i = n - 1;i >= 0;i--){
        (ans += sum * a[i]) %= mod;
        (sum += a[i]) %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5108
#include <bits/stdc++.h>
using namespace std;
#define maxn 1000000
int n, K, a[maxn], sum[maxn], sum2[maxn];
int ans = 999999999;

int read()
{
	int x = 0, k = 1;
	char c; c = getchar();
	while(c < '0' || c > '9') { if(c == '-') k = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * k;
}

int main()
{
	n = read(), K = read(); int rec = 0;
	for(int i = 1; i <= n; i ++) a[i] = read();
	for(int i = 1; i <= n; i ++)
	{
		if(a[i] >= 0) break;
		rec = i;
	}
	for(int i = rec; i; i --) sum[rec - i + 1] = -a[i]; 
	for(int i = rec + 1; i <= n; i ++) sum2[i - rec] = a[i];
	for(int i = 1; i <= rec; i ++)
	{
		if(K - i < 1 || K - i > n - rec) continue; 
		int tem = sum[i], tem2 = sum2[K - i];
		int tem3 = min(tem, tem2);
		ans = min(ans, tem + tem2 + tem3);
	}
	if(rec >= K) ans = min(ans, sum[K]);
	if(n - rec >= K) ans = min(ans, sum2[K]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8576
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let mut a: Vec<(i32, usize)> = (0..n).map(|i| (input(), i)).collect();
    a.sort();
    a.reverse();

    let mut v = vec![a[0].0; n];
    v[a[0].1] = a[1].0;
    for v in v {
        println!("{}", v);
    }
}


Measured memory_bytes: 11772
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
#define INF 100000000
#define IINF 9999999999999;
using vint = std::vector<int>;
using ll = long long;
using vll = std::vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = std::min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = std::max(a, b); }

//original problem

int prime[25] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
string S;
int B;
int decomposition_of_numbers[101];
int prime_filling_up[101];

int main() {
    int N;
    cin >> N;
    int color[N];
    rep(i, N) cin >> color[i];
    int ans = 0;
    int temp = 10000;
    FOR(i, 1, N) {
        if(color[i - 1] == color[i + 1] && (color[i - 1] == color[i] || color[i] == color[i + 1])) {
            color[i] = temp;
            ++temp;
            ++ans;
        }
    }
    FOR(i, 1, N) {
        if(color[i - 1] == color[i] || color[i] == color[i + 1]) {
            color[i] = temp;
            ++temp;
            ++ans;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;	
		


int32_t main()
{   
	IOS
	string s;cin>>s;
	for(int i=0;i<3;i++){
		if( s[i]=='7' ){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
}





Measured memory_bytes: 3640
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>*/
 
#define pb push_back
#define mp make_pair
#define sz(s) ((int)(s.size()))
#define all(s) s.begin(), s.end()
#define rep(i, a, n) for (int i = a; i <= n; ++i)
#define per(i, n, a) for (int i = n; i >= a; --i)
#define onlycin ios_base::sync_with_stdio(false); cin.tie(0) 
#define F first
#define S second
using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
/*typedef tree<
pair < int, int >,
null_type,
less< pair < int, int > >,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;*/
// find_by_order() order_of_key()
const int MAXN = (int)5e5+228;
const char nxtl = '\n';
const int mod = (int)1e9+7;
const double eps = (double)1e-7;
template<typename T> inline bool updmin(T &a, const T &b) {return a > b ? a = b, 1 : 0;}
template<typename T> inline bool updmax(T &a, const T &b) {return a < b ? a = b, 1 : 0;}

int n;
map <ll, int > M;
ll cnt;

int main() {
	#ifdef accepted
		freopen(".in", "r", stdin);
		freopen(".out", "w", stdout);
	#endif
	onlycin;
	cin >> n;
	M[0] = 1;
	ll sum = 0;
	rep(i, 1, n) {
		int x; cin >> x; sum += x;
		cnt += M[sum];
		M[sum]++;
	}
	cout << cnt << nxtl;
	
	return 0;
}

Measured memory_bytes: 12800
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

a, b = MAP()

def f(n):
    if n % 2 == 1:
        if ( (n+1)//2 ) % 2 == 1:
            return 1
        else:
            return 0
    else:
        if ( n//2 ) % 2 == 1:
            return n^1
        else:
            return n

ans = f(a-1)^f(b)
print(ans)

Measured memory_bytes: 10300
n,m = list(map(int, input().split()))
ac = {}
wa = {}
wrong = 0
for i in range(m):
  p,s  = list(map(str, input().split()))
  if s == "AC":
    if p not in ac:
      ac[p] = 1
      if p in wa:
        wrong += wa[p]
  elif s == "WA":
    if p not in ac:
      if p not in wa:
        wa[p] = 1
      else:
        wa[p] += 1
print("{} {}".format(len(ac),wrong))

Measured memory_bytes: 17228
import numpy as np
import sys

n = int(input())
a = np.array(list(map(int, input().split())))

cnt = 1

if np.any(a%2==1):
    print(0)
    sys.exit()

while True:
    a2 = a % 2**cnt
    if np.all(a2==0):
        cnt += 1
        continue
    else:
        print(cnt-1)
        break

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

int main() {
  int a, b;
  cin >> a >> b;
  
  if ((a < 0 && b > 0) || a == 0 || b == 0)
    cout << "Zero" << endl;
  else if (a > 0)
    cout << "Positive" << endl;
  else
    cout << ((b % 2 - a % 2) % 2 == 0 ? "Negative" : "Positive") << endl;
  
  return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()

west = [0] * (n + 2)
east = [0] * (n + 2)

for i,v in enumerate(s):
    west[i + 1] = west[i]
    if v == 'W':
        west[i + 1] += 1

for i,v in enumerate(reversed(s)):
    east[n - i] = east[n + 1 - i]
    if v == 'E':
        east[n - i] += 1

min_count = None
for i in range(n):
    if min_count is None:
        min_count = west[i] + east[i + 2]
    else:
        min_count = min(min_count, west[i] + east[i + 2])

print(min_count)


Measured memory_bytes: 17636
n = int(input())
c = []
s = []
f = []
for i in range(n-1):
  csf = [int(x) for x in input().split()]
  c.append(csf[0])
  s.append(csf[1])
  f.append(csf[2])

for i in range(n-1):
  time = 0
  for j in range(i, n-1):
    if time<s[j]:
      time=s[j]
    else:
      if time%f[j]==0:
        pass
      else:
        time+=(f[j]-(time%f[j]))
    time+=c[j]
  print(time)

print(0)

Measured memory_bytes: 3188
from functools import reduce
from fractions import gcd

def lcm(x, y):
    return x * y // gcd(x, y)

N, M = map(int, input().split())
A = [int(x)//2 for x in input().split()]
B = [0] * N
for i in range(N):
    a = A[i]
    cnt = 0
    while a % 2 == 0:
        cnt += 1
        a //= 2
    B[i] = cnt

if len(set(B)) != 1:
    print(0)
    exit()

c = reduce(lcm, A)

if (M // c) % 2 == 0:
    print(M // c // 2)
else:
    print(M // c // 2 + 1)    

Measured memory_bytes: 16284
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
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 long long INF = 1LL << 60;

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

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

ll choose2(ll n){
    return n*(n-1)/2;
}

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

    vector<int> countnum(n,0);

    rep(i,n){
        countnum[a[i]-1]++;
    }

    ll tot = 0;

    rep(i,n) tot+=choose2(countnum[i]);

    rep(i,n){
        ll ans = tot;
        ans-=choose2(countnum[a[i]-1]);
        ans+=choose2(countnum[a[i]-1]-1);
        cout << ans << endl;
    }


    return 0;
}

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

int main() {
  std::string x(4, ' ');
  scanf("%s", &x[0], x.size());
  for (int i = 0; i < x.length(); i++) {
    if (std::count(x.cbegin(), x.cend(), x[i]) != 2) {
      printf("No");
      return 0;
    }
  }
  printf("Yes");
}


Measured memory_bytes: 256
n, m = map(int, input().split())
aaa = [0] * (n + 1)
for _ in range(m):
    aaa[int(input())] = 1
dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 0 if aaa[1] == 1 else 1
for i in range(2, n + 1):
    if aaa[i] == 1:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] + dp[i - 2]

print(dp[n] % 1000000007)

Measured memory_bytes: 460788
def Z(s,ls):
    lcp = [0]*ls
    lcp[0] = ls
    i,j = 1,0
    while i < ls:
        while i+j < ls and s[j] == s[i+j]:
            j += 1
        lcp[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < ls and k + lcp[k] < j:
            lcp[i+k] = lcp[k]
            k += 1
        i += k
        j -= k
    for i in range(ls):
        lcp[i] = min(lcp[i],i)
    return max(lcp)

n = int(input())
s = list(map(ord,list(input())))
print(max(Z(s[i:],n-i) for i in range(n)))

Measured memory_bytes: 48988
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		int N=sc.nextInt();
		int A=sc.nextInt();
		int B=sc.nextInt();
		int min=0;
		if(A+B<=N) {
			min=0;
		}
		else {
			min=A+B-N;
		}
		int max=Math.min(A, B);
		pl(max+" "+min);
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
}

Measured memory_bytes: 21204
// Problem : E - Flatten
// Contest : AtCoder Beginner Contest 152
// URL : https://atcoder.jp/contests/abc152/tasks/abc152_e
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include <bits/stdc++.h>

using namespace std;

int N;
long long arr[10005];
int cnt[1000005];
long long MOD = 1e9+7;

long long mult(long long a, long long b){
	return (a*b)%MOD;
}

long long add(long long a, long long b){
	return (a+b)%MOD;
}

long long qikpow(long long a, long long b){
	if(!b){
		return 1;
	}
	long long ret = qikpow(a, b/2);
	ret = mult(ret, ret);
	if(b&1){
		ret = mult(ret, a);
	}
	return ret;
}

long long divd(long long a, long long b){
	return mult(a, qikpow(b, MOD-2));
}

int main(){
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> N;
	for(int i = 1; i<=N; i++){
		cin >> arr[i];
		int t = arr[i];
		for(int j = 2; j<=sqrt(t); j++){
			if(t%j == 0){
				int k = 0;
				while(t%j == 0){
					k++;
					t /= j;
				}
				cnt[j] = max(cnt[j], k);
			}
		}
		if(t-1){
			cnt[t] = max(cnt[t], 1);
		}
	}
	long long p = 1;
	for(int i = 2; i<=1000000; i++){
		for(int j = 1; j<=cnt[i]; j++){
			p = mult(p, i);
		}
	}
	long long ans = 0;
	for(int i = 1; i<=N; i++){
		ans = add(ans, divd(p, arr[i]));
	}
	cout << ans << endl;
}

Measured memory_bytes: 2944
import std.stdio, std.string, std.conv, std.algorithm;

void main(){
    while(true){
        auto input = readln.split.map!(to!int);
        int h = input[0], n = input[1];
        if(n == 0 && h == 0) break;
        int[int] cube;
        foreach(i; 0..n){
            auto line = readln.split;
            int a = line[1].to!int - 1, b = line[2].to!int - 1;
            final switch(line[0]){
                case "xy":
                    foreach(z; 0..h){
                        cube[(a << 18) + (b << 9) + z] = 0;
                    }
                    break;
                case "xz":
                    foreach(y; 0..h){
                        cube[(a << 18) + (y << 9) + b] = 0;
                    }
                    break;
                case "yz":
                    foreach(x; 0..h){
                        cube[(x << 18) + (a << 9) + b] = 0;
                    }
                    break;
            }
        }
        (h * h * h - cube.length).writeln;
    }
}

Measured memory_bytes: 7380
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>

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

int main()
{
    int64_t N, X;
    std::cin >> N >> X;

    int64_t D = 0;
    for (std::size_t i = 0; i < N; ++i) {
        int64_t x = 0;
        std::cin >> x;

        int64_t distance = std::abs(x - X);
        if (D == 0) {
            D = distance;
        } else {
            D = gcd(D, distance);
        }
    }

    std::cout << D << std::endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	waCnt := 0
	acCnt := 0
	acM := make(map[int]int)
	waM := make(map[int]int)
	for i := 0; i < m; i++ {
		var p int
		var s string
		fmt.Scan(&p, &s)
		if acM[p] > 0 {
			continue
		}
		if s == "AC" {
			acM[p]++
			acCnt++
			waCnt += waM[p]
		} else {
			waM[p]++
		}
	}
	fmt.Println(acCnt, waCnt)
}


Measured memory_bytes: 7936
program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,m,i
    integer(int32), allocatable:: t(:),td(:)
    integer(int64):: ans=0

    read*, n,m
    allocate(t(n),td(n-1))
    read*, t(:)

    do i=1,n-1
        td(i) = t(i+1)-t(i)
    end do
    
    do i=1,n-1
        ans=ans+min(m,td(i))
    end do

    print*, ans+m

end program name

Measured memory_bytes: 2304
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner in=new Scanner(System.in);
        String s=in.next();
        if(s.charAt(s.length()-1)=='s')
            System.out.println(s+"es");
        else
            System.out.println(s+"s");
    }
}

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

int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(i%2)
		{
			if(s[i]=='L'||s[i]=='U'||s[i]=='D')
				continue;
			else
			{
				cout<<"No"<<endl;
				return 0;
			}
		}
		else
		{
			if(s[i]=='R'||s[i]=='U'||s[i]=='D')
				continue;
			else
			{
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes";

	return 0;
}

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

using namespace std;

int main(){

 long long  n,T,t,x,sum=0;
 cin>>n>>T;

 long long ani[300000];

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

  for(int i=0;i<n-1;i++){
    sum += min(T,ani[i+1]-ani[i]);
 }


 sum  = sum +  T;
 
 cout<<sum<<endl;


return 0;
}















Measured memory_bytes: 2432
<?php
  fscanf(STDIN,"%d %d",$a,$b);
  $count = 0;
  for($j=$a; $j<=$b; $j++){
    $i = strval($j);
    if($i[0] == $i[4] && $i[1] == $i[3]){
      $count++;
    }
  }
  echo $count."\n";

Measured memory_bytes: 4604
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  char c;
  cin >> c;
  char res = c + 'b' - 'a';
  cout << res << "\n";
  return 0;
}


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

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

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

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

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

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

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

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

    vector<ll> L(N);

    REP(i,N){
        cin >> L[i];
    }

    // 昇順ソート
    sort(L.begin(), L.end());

    // REP(i, N){
    //     cout << L[i] << endl;
    // }

    ll ans = 0;
    for(ll i=0; i<N-1; i++){
        for(ll j=i+1; j<N; j++){
            vector<ll>::iterator iter_lower;
            iter_lower = lower_bound(L.begin()+j, L.end(),L[i]+L[j]);
            ll idx_lower = distance(L.begin(), iter_lower); 
            // cout << i << " " << j << " " << idx_lower << endl;
            ans += N - idx_lower;
        }
    }
    cout << N*(N-1)*(N-2)/6 - ans << endl;
    return 0;
}

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

int main()
{
	int a,b,c;
	int num = 0;

	cin >> a >> b >> c;

	for(int i=a; i<=b; i++){

		if((c%i)==0){
			num++;
		}
	}
	cout << num << endl;

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
using namespace std;
const long INF = 1e9;
const long MOD = 1e9 + 7;
#define repi(i, n, init) for (int i = init; i < int(n); i++)

int power(int n, int t)
{
    int s = 1;
    repi(i, t, 0)
    {
        s *= n;
    }
    return s;
}

int main()
{
    int n, m, ans = -1;
    cin >> n >> m;
    vector<pair<int, int>> b(m);
    repi(i, m, 0)
    {
        int s, c;
        cin >> s >> c;
        b[i] = make_pair(s, c);
    }

    repi(i, power(10, n), power(10, n - 1) - (n == 1 ? 1 : 0))
    {
        bool state = true;
        repi(j, m, 0)
        {
            string num = to_string(i);
            if (num.at(b.at(j).first - 1) - '0' != b.at(j).second)
            {
                state = false;
                break;
            }
        }
        if (state)
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def gcd(a,b):
	while b:
		a,b = b,a % b
	return a

def lcm(a,b):
	return a * b // gcd (a, b)

a,b,c,d=map(int,input().split())
e=lcm(c,d)

cc=(b//c)-((a-1)//c)
dd=(b//d)-((a-1)//d)
cd=(b//e)-((a-1)//e)
print((b-a+1)-(cc+dd-cd))

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#define N 200005
using namespace std;

int n, a, M=1e9+7, dp[N]={1}, pr[N];
int main() {
	cin >> n;
	for(int i=1; i<=n; i++) {
		scanf("%d", &a);
		dp[i] = dp[i-1];
		if(pr[a]>0 && i-pr[a]>1) dp[i] = (dp[i] + dp[pr[a]]) % M;
		pr[a] = i;
	}
	cout << dp[n];
	return 0;
}

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

int main(){
	int N; cin >> N;
	vector<int> a(N);
	rep(i,N) cin >> a[i];
	int ans = 0;
	rep(i,N){
		if(i%2==0&&a[i]%2==1) ans++;
	}
	cout << ans << endl;
}










Measured memory_bytes: 3612
unittest
{
//	assert( [ "3" ].parse.expand.solve == "Yes\n3\n2 1 2\n2 3 1\n2 2 3" );
	assert( [ "3" ].parse.expand.solve == "Yes\n3\n2 1 2\n2 1 3\n2 2 3" );
	assert( [ "4" ].parse.expand.solve == "No" );
}



import std.algorithm;
import std.conv;
import std.format;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	return tuple( n );
}

auto solve( long n )
{
	auto ansss = [ [ 1L ], [ 1L ] ];
	auto s = 1L;
	while( s < n )
	{
		auto k = ansss.length.signed;
		ansss.length++;
		for( auto i = 0L; i < k; i++ )
		{
			s++;
			ansss[ i ] ~= s;
			ansss[ k ] ~= s;
		}
	}
	if( s != n ) return "No";
	else         return format( "Yes\n%s\n%s", ansss.length, ansss.map!( ( a ) => format( "%s %s", a.length, a.to!( string[] ).join( " " ) ) ).join( "\n" ) );
}


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

typedef long long ll;

int main() {
  int operate_num;
  ll k;
  cin >> operate_num >> k;
  unordered_map<int, ll> map;
  for (int i = 0; i < operate_num; i++) {
    int num, push_num;
    cin >> num >> push_num;
    map[num] += push_num;
  }

  vector<ll> keys;
  for (auto itr = map.begin(); itr != map.end(); ++itr) {
    keys.push_back(itr->first);
  }

  sort(keys.begin(), keys.end());
  int order = 0;
  for (auto i : keys) {
    order += map[i];
    // cout << i << " : " << map[i] << ", " << order << endl;
    if (k <= map[i]) {
      cout << i << endl;
      return 0;
    }
    k -= map[i];
  }
}

Measured memory_bytes: 4260
//        ★★ ASHWINI SHARMA ★★ 
#include <bits/stdc++.h>
using namespace std;
 
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)
#define foreach(it,ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )
#define debug(x) cout<<#x<<": "<<x<<endl
#define ull unsigned long long int
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second 
 
 
#define PI 3.1415926535897932385
#define INF 1e18
#define EPS 1e-7
#define MAXN 1000005
#define MOD 1000000007
                                  //          ★★ ASHWINI SHARMA ★★      
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
ll exp(ll x, ll y, ll p)
{
    ll res = 1;   
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)    
            res = (res*x) % p;
        y = y>>1;     
        x = (x*x) % p; 
    }
    return res;
}
 
 
 
int main() {
   
    fastio;
    int n;
    cin >> n;
    int h[n];
    rep(i, n)
    cin >> h[i];
    int dp[n] = {0};
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);
    fr(i, 2, n-1)
    {
        int x = dp[i-2]+abs(h[i]-h[i-2]);
        int y = dp[i-1]+abs(h[i]-h[i-1]);
        dp[i] = min(x, y);
    }
    cout << dp[n-1];
    
    return 0; 
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <limits>
#include <numeric>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;

int N;
Graph G;
vector<int> res;
const long long INF = 1LL << 60;

void dfs(int v, int p, int c) {
    res[v] = c;
    for(auto e : G[v]) {
        if(e.first == p)
            continue;
        if(e.second%2==1)
            dfs(e.first, v, 1 - c);
        else
            dfs(e.first, v, c);
    }
}

int main() {
    cin >> N;
    G.assign(N, vector<Edge>());
    rep(i, 0, N - 1) {

        int u, v, w;
        cin >> u >> v >> w;
        u--;
        v--;
        G[u].push_back(Edge(v, w));
        G[v].push_back(Edge(u, w));
    }
    res.assign(N, 0);
    dfs(0, -1, 1);
    for (auto v : res) cout << v << endl;
}

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

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

  double x[11];
  string u[11];

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

  double ans = 0;
  for (int i = 0; i < n; i++) {
    if (u[i] == "JPY") {
      ans += x[i];
    } else {
      ans += x[i] * 380000.0;
    }
  }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(int i=0; i<n; i++)
#define loop(i, j, n) for(int i=j; i<n; i++)
using namespace std;
// }}} End Header

int main()
{
	int D, N, ans;
	cin >> D >> N;
	if(N == 100) ans = pow(100, D) *(N+1);
	else ans = pow(100, D) * N;
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    int A[N];
    for(int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    int c = 0;
    int m;
    for(int k = 0; k < N; k++)
    {
        m = A[k];
        if(A[m - 1] == k + 1)
        {
            c = c + 1;
        }
        else
        {
        
        }
    }
    cout << c/2 << endl;

}


Measured memory_bytes: 640
k = int(input())
ans=0
for N in range(k+1):
    if N%3==0 and N%5==0:
        N="FizzBuzz"
    elif N%3==0:
        N="Fizz"
    elif N%5==0:
        N="Buzz"
    else:
        ans+=N
print(ans)

Measured memory_bytes: 67716
import sys
input = sys.stdin.readline
def solve():
  n = int(input())
  query = []
  candi = []
  for i in range(n):
    x,y,h = (int(i) for i in input().split())
    query.append((x,y,h))
  if n == 1:
    print(*[x,y,h])
    exit()
  query = sorted(query,reverse = True,key=lambda x: x[2])
  for cx in range(0,101):
    for cy in range(0,101):
      judge = True
      x,y,h = query[0]
      karih = h +abs(cx-x)+abs(cy-y)
      karih2 = 0
      for i in range(n-1):
        nx,ny,nh = query[i+1]
        if nh == max(karih-abs(nx-cx)-abs(ny-cy),0):
          pass
        else:
          judge = False
      if judge:
        candi.append((cx,cy,karih))
        
  print(*candi[0])
        
          
      
      
solve()

Measured memory_bytes: 3064
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

# import fractions

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

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

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

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


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

    K = ii()
    S = iss()

    if K >= len(S):
        print(S)
    else:
        print(''.join(S[:K]) + '...')


if __name__ == '__main__':
    main()


Measured memory_bytes: 10220
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        long ans = 0;
        int N = reader.nextInt();
        long[] D = new long[N];
        for (int i=0; i<N; i++) {
            D[i] = reader.nextLong();
        }
        for (int i=0; i<N; i++) {
            for (int j=i+1; j<N; j++) {
                ans += D[i]*D[j];
            }
        }
        System.out.println(ans);
    }

    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



Measured memory_bytes: 21332
#include <iostream>

using namespace std;

int main()
{
    int N;
    int N2;
    int ans=0;
    char S[101];

    cin >> N;
    for (int i = 0; i < N;i++){
        cin >> S[i];
    }

    N2 = N / 2;

    for (int i = 0; i < N2;i++){
        if(S[i]!=S[i+N2])
            ans = 1;
    }

    if(ans==1||N%2==1)
        cout << "No";
    else
        cout << "Yes";

    return 0;
}

Measured memory_bytes: 256
import math
n = int(raw_input())
N = [int(raw_input()) for _ in xrange(n)]

def isPrime(x):
    if x == 2:
        return True

    if x < 2 or x % 2 == 0:
        return False

    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2

    return True

def main():
    cnt = 0
    for x in N:
        if isPrime(x):
            cnt += 1
    print cnt
    return 0

main()

Measured memory_bytes: 6624
#include<iostream>
using namespace std;
int main()
{
    int h,n,a,i;
    cin>>h>>n;
    for(i=0;i<n;i++){
        cin>>a;
        h-=a;
    }
    if(h>0)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

struct Dinic {
    struct Edge {int to, rev, cap;};
    vector<vector<Edge>> Graph;
    vector<int> dist, iter;
    Dinic(int v) : Graph(v) {}
    void AddEdge(int from, int to, int cap) {
        Graph[from].push_back({to, SZ(Graph[to]), cap});
        Graph[to].push_back({from, SZ(Graph[from]) - 1, 0});
    }
    bool bfs(int s, int t) {
        dist.assign(SZ(Graph), -1);
        queue<int> q;
        dist[s] = 0;
        q.push(s);
        while (!q.empty() && dist[t] == -1) {
            int v = q.front();
            q.pop();
            for (const auto &e: Graph[v]) {
                if (e.cap > 0 && dist[e.to] == -1) {
                    dist[e.to] = dist[v] + 1;
                    q.push(e.to);
                }
            }
        }
        return dist[t] != -1;
    }
    int dfs(int now, int t, int mn) {
        if (now == t) return mn;
        for (int &i = iter[now]; i < SZ(Graph[now]); ++i) {
            Edge &e = Graph[now][i];
            if (e.cap > 0 && dist[now] + 1 == dist[e.to]) {
                int d = dfs(e.to, t, min(mn, e.cap));
                if (d > 0) {
                    e.cap -= d;
                    Graph[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
    int MaxFlow(int s, int t) {
        int ans = 0;
        while (bfs(s, t)) {
            iter.assign(SZ(Graph), 0);
            int f = 0;
            while ((f = dfs(s, t, 1001001001)) > 0) ans += f;
        }
        return ans;
    }
};

int main() {
    int x, y, e;
    cin >> x >> y >> e;
    Dinic D(x + y + 2);
    REP(i, x) D.AddEdge(0, i + 1, 1);
    REP(i, y) D.AddEdge(i + x + 1, x + y + 1, 1);
    REP(i, e) {
        int a, b;
        cin >> a >> b;
        D.AddEdge(a + 1, b + x + 1, 1);
    }
    cout << D.MaxFlow(0, x + y + 1) << "\n";
}



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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX


int a,c,d,e,f,g,ans;


signed main() {
    cin >> a >> ans >> c >> d >> e >> f >> g;
    if (a%2 + d%2 + e%2 > 1 && a && d && e) ans += 3,--a,--d,--e;
    ans += a/2*2 + d/2*2 + e/2*2;
    cout << ans << endl;
}




Measured memory_bytes: 256
#define _USE_MA_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    string s;
    cin>>s;
    bool a=s.length()%2;
    bool b=s[0]==s[s.length()-1];
    if(a^b)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}
    

Measured memory_bytes: 512
package main

import "fmt"

var S, T [10000]int
var n, q int

func main() {
	var count, j int

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&S[i])
	}
	fmt.Scan(&q)
	for i := 0; i < q; i++ {
		fmt.Scan(&T[i])
	}
	for j = 0; j < q; j++ {
		count += linear(j)
	}
	fmt.Println(count)
}
func linear(j int) int {

	for i := 0; i < n; i++ {
		if S[i] == T[j] {
			return 1
		}
	}
	return 0
}



Measured memory_bytes: 1680
import scala.io.StdIn
object Main extends App {
  val N = StdIn.readLine().toInt
  val h = StdIn.readLine().split(" ").map(_.toInt).toList
  var answer = 0
  var m = h.head
  var max = 0
  val subList = h.tail.map{n => val sub = n - m; m = n; sub}
  var streak = 0
  for (n <- subList) {
    if (n <= 0) {
      streak += 1
    } else {
      streak = 0
    }
    if (streak > max) max = streak
  }
  println(max)
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  cin >> n;
  vector<int> cnt(4);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    ++cnt[x];
  }
  int ones = cnt[1];
  int twos = cnt[2];
  int triples = cnt[3];
  
  using real_t = long double;
  vector<vector<vector<real_t>>> dp(n + 1, vector<vector<real_t>>(n + 1, vector<real_t>(n + 1)));
  for (int s = 1; s <= n; ++s) {
    for (int i = s; i >= 0; --i) {
      for (int j = s - i; j >= 0; --j) {
        int k = s - i - j;
        dp[i][j][k] = n;
        if (i) {
          dp[i][j][k] += dp[i - 1][j][k] * i;
        }
        if (j) {
          dp[i][j][k] += dp[i + 1][j - 1][k] * j;
        }
        if (k) {
          dp[i][j][k] += dp[i][j + 1][k - 1] * k;
        }
        dp[i][j][k] /= s;
      }
    }
  }
  cout << setprecision(12) << fixed << dp[ones][twos][triples] << '\n';
  return 0;
}


Measured memory_bytes: 431360
module Main where

import Control.Monad
import Text.Printf

main :: IO ()
main = do
  n <- read <$> getLine :: IO Int
  xus <- replicateM n $ read' . words <$> getLine
  printf "%.6f" $ sum xus

rate :: Double
rate = 380000

read' :: [String] -> Double
read' [x, u] = read x * if u == "BTC" then rate else 1

Measured memory_bytes: 636