akhauriyash/Code-Regression huggingface dataset:
X,Y = map(int,input().split())

# a+2b=X
# 2a+b=Y
# b = (2X-Y)/3
# a = (2Y-X)/3

p = 10 ** 9 + 7
N = 10 ** 6 +10  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p


a = (2*X-Y)
b = (2*Y-X)

if a < 0 or b < 0 or a%3!=0 or b%3!=0:
    print(0)
else:
    a = a//3
    b = b//3

    print(cmb(a+b,a,p))





Measured memory_bytes: 122048
use proconio::input;

fn main() {
    input! {
        n: usize,
        d: f64,
        dots: [(f64, f64); n],
    }

    let mut ans = 0;
    for dot in dots {
        let distance = (dot.0 * dot.0 + dot.1 * dot.1).sqrt();
        if distance <= d {
            ans += 1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 7804
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char [ ] c = sc.next().toCharArray();
		if(c[0]=='a'||c[0]=='i'||c[0]=='u'||c[0]=='e'||c[0]=='o'){
			System.out.print("vowel");
		}else{
			System.out.print("consonant");
		}
	}
}

Measured memory_bytes: 21844
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 15
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;


ll fact[MAX_INT];
ll invfact[MAX_INT];

ll modMul(ll A, ll B) {
	return (A * B) % MOD;
}

ll modSum(ll A, ll B) {
	return (A + B) % MOD;
}

ll modPow(ll a, ll b, ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

ll modInv(ll x) {
	return modPow(x, MOD - 2, MOD);
}

void precompute() {
	fact[0] = 1;
	fei(i, 1, N, 1) {
		fact[i] = modMul(fact[i - 1], i);
	}
	invfact[N] = modInv(fact[N]);
	for(int i = N - 1; i >= 0; i--) {
		invfact[i] = modMul(invfact[i + 1], i + 1);
	}
}

ll ncr(ll n, ll r) {
	if(n < r) {
		return 0;
	}
	ll ans = fact[n];
	ans = modMul(ans, invfact[r]);
	ans = modMul(ans, invfact[n - r]);
	return ans;
} 


int main() {
	go;
    cin >> N;
    ll val = 1;
    fi(i, 0, N, 1) {
    	val = modMul(val, i + 1);
    }
    cout << val << "\n";
    
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int k ;
int main(){
    string s;
    cin >> k >> s;
    for(int i = 0 ; i < min((int)s.size() , k) ; i++)
        cout << s[i];
    if(s.size() > k)
    cout << "...";
    return 0;
}

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

ll gcd(ll a, ll b){
  if(b==0)return a;
  else gcd(b,a%b);
}
ll lcm(ll x,ll y){
  return x*y/gcd(x,y);
}


int main(){
  ll A,B,C,D;
  cin >> A >> B >> C >> D;
  
  ll ansB = B - B/C -B/D +B/lcm(C,D);
  ll ansA = A-1 - (A-1)/C -(A-1)/D +(A-1)/lcm(C,D);
  cout << ansB -ansA << endl;
}

Measured memory_bytes: 256
/**
        	C++14 (GCC 5.4.1)
**/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;

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

    int f = s / 100;
    int b = s % 100;
    
    if((1 <= f && f <= 12) && (1 <= b && b <= 12)){
        cout << "AMBIGUOUS" << endl;
    }
    else if((1 <= f && f <= 12)){
        cout << "MMYY" << endl;
    }
    else if((1 <= b && b <= 12)){
        cout << "YYMM" << endl;
    }
    else{
        cout << "NA" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#define Inf 1000000000
#define nmax_def 110000
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;

int main() {
	ll A, B, K;
	cin >> A >> B >> K;
	if (A > K) {
		A -= K;
		K = 0;
	}
	else {
		K -= A;
		A = 0;
	}
	if (B > K) {
		B -= K;
	}
	else
		B = 0;
	cout << A << " " << B << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int gcd(int a, int b)
{
	
	int t;

	if (a < b)
	{
		t = a;
		a = b;
		b = t;
	}

	if (b == 0)
        return (a);

    return gcd(b, a % b);
}

int gcd3(int a, int b, int c)
{
	int d;

	d = gcd(a, b);
	return (gcd(d,c));
}

int main(void)
{
	int a = 1;
	int b = 1;
	int c = 1;
	int k = 0;
	long sum = 0;

	scanf("%d", &k);
	for (a = 1; a < k+1; a++)
	{
		for (b = 1; b < k+1; b++)
		{
			for (c = 1; c < k+1; c++)
			{
				sum += gcd3(a, b, c);
			}
		}
	}
	printf("%ld\n", sum);
	return (0);
}

Measured memory_bytes: 1728
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Main
{
    public static class Program
    {
        static void Main(string[] arg)
        {
            var answer = 0;
            var line = GetIntList(Console.ReadLine());
            int a = line[0];
            int b = line[1];
            int c = line[2];

            answer = b / a;
            answer = answer > c ? c : answer;


            Console.WriteLine(answer);
            Console.ReadLine();

        }
        #region libraries
        private static int[] GetIntList(string line)
        {
            return line.Split(' ').Select(x => int.Parse(x)).ToArray();

        }
        private static double[] GetDoubleList(string line)
        {
            return line.Split(' ').Select(x => double.Parse(x)).ToArray();

        }
        private static int SearchNearest(this IEnumerable<int> list, int target)
        {
            var min = list.Min(c => Math.Abs(c - target));
            return list.First(c => Math.Abs(c - target) == min);
        }
        public static int Gcd(int a,int b)
        {
            if(a < b)
            {
                Gcd(b, a);
            }
            while (b != 0)
            {
                var rm = a % b;
                a = b;
                b = rm;
            }
            return a;
        }
        #endregion
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
using namespace std;


signed main(){
    double r;

    std::cin >> r;

    double rate = 3.141592653589;

    cout.precision(6);
    std::cout << fixed << r * r * rate << " " << fixed << r * 2 * rate << std::endl;

    return 0;
}


Measured memory_bytes: 3284
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int m;
    cin>>m;
    cout<<24+(24-m)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(), (x).end()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end());
const long long INF = 1LL << 60;
// map<int,int> mp;

int main() {
  string S, T;
  cin >> S >> T;

  int cnt = 0;
  int cnt_min = 1001;

  for (int i = 0; i < S.size() - T.size() + 1; i++) {
    cnt = 0;
    for (int j = 0; j < T.size(); j++) {
      if (S[i + j] != T[j]) cnt++;
    }
    cnt_min = min(cnt_min, cnt);
  }

  cout << cnt_min << endl;
}


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

using namespace std;

int main()
{
    int n ;
    cin>>n ;
    int arr[n] ;
    for(int i = 0 ; i < n ; ++i)
        cin>>arr[i] ;
    int ans = 0 ;
    sort(arr , arr + n) ;
    for(int i = 0 ; i < n-1 ; ++i)
        ans += arr[i] ;
    ans += (arr[n-1] / 2) ;
    return cout<<ans , 0 ;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#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 INF 1000000000000
#define MOD 1000000007
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3)                                                 \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << endl
#define debug_4(x1, x2, x3, x4)                                             \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5)                                         \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

using namespace std;
using ll = long long;

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n, 0);
    // vector<ll> dp(n, 0);
    rep(i, n) cin >> a[i];
    ll pre = a[0];
    ll ans = 0;
    // debug(pre, a[0]);
    reps(i, n - 1) {
        // debug(pre, a[i]);
        if (pre > a[i]) {
            ll sum = pre - a[i];
            a[i] = a[i] + sum;
            ans += sum;
        }
        pre = a[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4464
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) < sum(b):
    print(-1)
    exit()
diffl = [0]*len(a)
for i in range(len(a)):
    diffl[i] = a[i] - b[i]
diffl.sort()
if diffl[0] >= 0:
    print(0)
    exit()
ret = 0
msum = 0
for num in diffl:
    if num < 0:
        msum -= num
        ret += 1
for num in diffl[::-1]:
    if num >= msum:
        ret += 1
        break
    else:
        ret += 1
        msum -= num
print(ret)

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

int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    int a[m];
    for(int i = 0; i < m; i++) cin >> a[i];
    int total_p = 0;
    int total_m = 0;
    for(int i = 0; i < m; i++)
    {
        if(x < a[i]) total_p++;
        else if(x > a[i]) total_m++;
    }
    if(total_p <= total_m) cout << total_p << endl;
    else if(total_p > total_m) cout << total_m << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int cnt[300006];
int main(){
	register int n, a, b, i, j, sum;
	scanf("%d %d %d", &n, &a, &b);
	if ((n + a - 1) / a > b || b + a > n + 1) {
		puts("-1");
		return 0;
	}
	if (a == 1) {
		for (i = n; i; --i) printf("%d ", i);
	}
	else {
		cnt[1] = b;
		for (i = b + 1; i <= n; ++i) ++cnt[i % (a - 1) + 2];
		sum = 0;
		for (i = 1; i <= a; ++i) {
			sum += cnt[i];
			for (j = 0; j < cnt[i]; ++j) printf("%d ", sum - j);
		}
	}
	return 0;
}

Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int h = 0;
        int m = 0;
        int s = 0;
        s = S%60;
        if(S/60<60){
            m = S/60;
            h = 0;
        }else{
            h = S/3600;
            m = S/60%60;
        }
        System.out.println(h+":"+m+":"+s);
        sc.close();
    }   

}


Measured memory_bytes: 26184
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<functional>
#include<climits>
#include<utility>
#include <iomanip>
#include<map>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define FOR(i,s,e) for (int i = int(s); i < int(e); i++)
#define REP(i,x) FOR(i,0,x)
#define CLR(a) memset((a), 0 ,sizeof(a))


const ll MOD = 1e+9+7;
const double PI  = acos(-1.0);


int main(){
  string s;
  cin>>s;
  int l=0, r=s.size()-1;
  int ret=0;
  while(l<r){
    if(s[l]==s[r]){
      l+=1, r-=1;
    }else if(s[l]=='x'){
      ret+=1;
      l+=1;
    }else if(s[r]=='x'){
      ret+=1;
      r-=1;
    }else{
      cout<<"-1\n";
      return 0;
    }
  }
  cout<<ret<<"\n";
}


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

using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;

const int MOD = 1e9 + 7;
const int INFi = 2e9 + 1;
const lli INFl = (lli)(9e18) + 1;
// const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(i, vec) for(auto &(i) : (vec))
/*
template <class T>
int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
*/
template <class T> inline int argmin(vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


int main(void){
  int n, w; cin >> n >> w;
  Vint W(n), V(n);
  REP(i, n) cin >> W.at(i) >> V.at(i);
  Wlli DP(n, Vlli(w + 1, -1));
  // DP[i][j] := 0, 1, ..., iまでを使って, 重さ j で得られる価値の最大値
  REP(i, n) DP[i][0] = 0; DP[0][W.at(0)] = V.at(0);
  REP(i, n - 1) REP(j, w) if(DP[i][j] != -1){
    chmax(DP[i + 1][j], DP[i][j]);
    if(W[i + 1] + j <= w) chmax(DP[i + 1][j + W[i + 1]], DP[i][j] + V.at(i + 1));
  }
  cout << *max_element(DP[n-1].begin(), DP[n-1].end()) << "\n";
  return 0;
}

Measured memory_bytes: 79360
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) std::cerr<< #x <<": "<<x<<"\n"
#define debug2(x,y) std::cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<"\n"
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}

vector<char> s;
vector<set<int> > g;

bool judge(int x) {
  bool oka = false;
  bool okb = false;
  for (int y : g[x]) {
    if (s[y] == 'A') {
      oka = true;
    } else {
      okb = true;
    }
    if (oka && okb) {
      return true;
    }
  }
  return false;
}

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  s.resize(n);
  rep (i, n) {
    scanf(" %c", &s[i]);
  }
  g.resize(n);
  rep (i, m) {
    int a, b;
    scanf("%d %d", &a, &b);
    a -= 1; b -= 1;
    g[a].insert(b);
    g[b].insert(a);
  }

  vector<bool> ng_flag(n, false);
  deque<int> stk;
  rep (i, n) {
    if (!judge(i)) {
      stk.push_back(i);
      ng_flag[i] = true;
    }
  }
  while(!stk.empty()) {
    int u = stk.front();
    stk.pop_front();
    for (int v : g[u]) {
      if (ng_flag[v]) {
        continue;
      }
      g[v].erase(u);
      if (!judge(v)) {
        stk.push_back(v);
        ng_flag[v] = true;
      }
    }
  }
  int ok_cnt = 0;
  rep (i, n) {
    if (ng_flag[i] == false) {
      ok_cnt += 1;
    }
  }
  if (ok_cnt > 0) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 23168
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n, q;
    string s;
    cin >> n >> q >> s;
    vector<int> sum(n);
    rep(i, n - 1) if (s[i] == 'A' && s[i + 1] == 'C') sum[i + 1] = 1;
    rep(i, n - 1) sum[i + 1] += sum[i];
    while (q--)
    {
        int l, r;
        cin >> l >> r;
        r--, l--;
        cout << sum[r] - sum[l] << endl;
    }
}

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

bool exists(int v,int* arr,int len)
{
    for(int i=0;i<len;i++)
        if(v==arr[i])
            return true;
    return false;
}

int abs(int x,int y){return x<y?y-x:x-y;}

int main()
{
    int x,n;
    int *p;
    cin >> x;
    cin >> n;
    if(n==0) {cout << x; return 0;}
    p=new int[n];
    for(int i=0;i<n;i++) cin >> p[i];
    int c=0;
    for(int i=0;i<=101;i++)
    {
        if(exists(i,p,n)) continue;
        if(abs(c,x)<=abs(i,x)) continue;
        c=i;
    }
    cout << c;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
  int n,x;
  cin >> n >> x;
  VI l(n);
  rep(i,n){
    cin >> l.at(i);
  }
  int m=0;
  int ans=0; 
  rep(i,n){
    m+=l.at(i);
    if(m<=x){
      ans++;
    }
  }
  cout << ans+1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color, D; vll path;
int main() {
	cin >> N >> K;
	if (K == 0) {
		cout << N * N;
	}
	else {
		for (ll b = K + 1; b <= N; b++) {
			ll p = N / b;
			ans += p * (b - K);
			//debug(ans, b, p);
			ans += max(z,(N - (b * p + K) + 1));
			//debug(ans, b, p);
		}
		cout << ans;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> roads(N, vector<int>(0));
    vector<int> suggestions(N);
    vector<int> hash(N);

    rep(i, M){
        int a, b;
        cin >> a >> b;
        roads[a - 1].push_back(b - 1);
        roads[b - 1].push_back(a - 1);
    }

    queue<int> q;
    q.push(0);
    while(q.size() > 0){
        int room;
        room = q.front();
        q.pop();
        for(int x: roads[room]){
            if(hash[x] == 0){
                q.push(x);
                suggestions[x] = room;
                hash[x] = 1;
            }
        }
    }
    cout << "Yes" << endl;
    rep(i, N - 1){
        cout << suggestions[i + 1] + 1 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 10608
/**
 * @author: Mackenzie
**/
#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n;
    cin >> n;
    bool ok = 1;
    forn(i, n) {
        int v;
        cin >> v;
        if (v % 2 == 0)
            ok &= (v % 3 == 0) || (v % 5 == 0);
    }
    if (ok)
        cout << "APPROVED" << endl;
    else
        cout << "DENIED" << endl;

    return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main() {
	string S;
	cin >> S;
	if (S == "SUN") {
		cout << 7 << endl;
	}else if (S == "MON") {
		cout << 6 << endl;
	}else if (S == "TUE") {
		cout << 5 << endl;
	}else if (S == "WED") {
		cout << 4 << endl;
	}else if (S == "THU") {
		cout << 3 << endl;
	}else if (S == "FRI") {
		cout << 2 << endl;
	}else if (S == "SAT") {
		cout << 1 << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <memory.h>
#include <deque>
#include <stdlib.h>
#include <time.h>
using namespace std;
typedef long long ll;
#define mp make_pair
const int M=100005;
const int N=1000001;
const int K=1000000000;
const ll MAX=1000000000000000000ll;
int n,a[M][3],dp[M][3];
int main(){
    cin>>n;
    for(int i=0;i<n;i++)
    	scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);
    dp[n-1][0]=a[n-1][0];
    dp[n-1][1]=a[n-1][1];
    dp[n-1][2]=a[n-1][2];
    for(int i=n-2;i>=0;i--)
    {
    	dp[i][0]=max(dp[i+1][1],dp[i+1][2])+a[i][0];
    	dp[i][1]=max(dp[i+1][0],dp[i+1][2])+a[i][1];
    	dp[i][2]=max(dp[i+1][0],dp[i+1][1])+a[i][2];
    }
    cout<<max(dp[0][0],max(dp[0][1],dp[0][2]));
}

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

using namespace std;

int main(void) {
  int n, l;
  cin >> n >> l;

  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }

  vector<bool> used(n, false);
  vector<string> vs;
  for (int i = 0; i < n; i++) {
    if (used[i]) continue;
    for (int j = i + 1; j < n; j++) {
      if (used[j]) continue;
      string rev = s[j];
      reverse(rev.begin(), rev.end());
      if (s[i] == rev) {
        string t = min(s[i], s[j]);
        vs.push_back(t);
        used[i] = used[j] = true;
        break;
      }
    }
  }
  sort(vs.begin(), vs.end());
  reverse(vs.begin(), vs.end());


  string r = "";
  for (int i = 0; i < n; i++) {
    if (used[i]) continue;
    string rev = s[i];
    reverse(rev.begin(), rev.end());
    if (s[i] == rev) {
      if (r != "") {
        r = min(r, s[i]);
      } else {
        r = s[i];
      }
    }
  }

  string ans = r;
  for (int i = 0; i < vs.size(); i++) {
    string rev = vs[i];
    reverse(rev.begin(), rev.end());
    ans = vs[i] + ans + rev;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3272
def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

from itertools import groupby
N = int(input())
P = prime_decomposition(N)
ans = 0
for v, g in groupby(P):
    n = len(list(g))
    for i in range(1, 100000):
        n -= i
        if n >= 0:
            ans += 1
        else:
            break
print(ans)


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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
	int n,K,s;cin>>n>>K>>s;
	int null=(s==1e9?1:1e9);
	rep(i,K)cout<<s<<' ';
	rep(i,n-K)cout<<null<<' ';
	cout<<endl;
}

Measured memory_bytes: 1280
#! usr/bin/env python
# -*- coding: utf-8 -*-

from collections import deque
import heapq
import math
import bisect


def main():
    H, W, N = map(int, input().split())
    sr, sc = map(int, input().split())
    S, T = input(), input()
    dic = {"L" : 0, "R" : 1, "U" : 2, "D" : 3}
    dic2 = {"L" : 1, "R" : 0, "U" : 3, "D" : 2}

    cnt = [0] * 4
    need = [sc, W-sc+1, sr, H-sr+1]
    for i in range(N):
        cnt[dic[S[i]]] += 1
        for j in range(4):
            if need[j] <= cnt[j]:
                print("NO")
                exit()

        if T[i] == "L" and 1 < sc + cnt[1]:
            cnt[dic2[T[i]]] -= 1
        elif T[i] == "R" and sc - cnt[0] < W:
            cnt[dic2[T[i]]] -= 1
        elif T[i] == "U" and 1 < sr + cnt[3]:
            cnt[dic2[T[i]]] -= 1
        elif T[i] == "D" and sr - cnt[2] < H:
            cnt[dic2[T[i]]] -= 1

    print("YES")


if __name__ == '__main__':
    main()


Measured memory_bytes: 43468
n = gets.to_i
s = gets.chomp
cnt = 0
0.upto(n) do |i|
  1.upto(n) do |j|
    break if i + 2 * j >= n
    cnt += 1 if s[i] != s[i + j] && s[i] != s[i + 2 * j] && s[i + j] != s[i + 2 * j]
  end
end
puts s.count('R') * s.count('G') * s.count('B') - cnt

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int B[1010],A[1010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N-1) cin>>B[i];
	A[0]=B[0];
	A[N-1]=B[N-2];
	for(i=1;i<N-1;i++) A[i]=min(B[i-1],B[i]);
	int ret=0;
	FOR(i,N) ret+=A[i];
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Data.List(sort, groupBy)

main :: IO ()
main = do
  num <- getLine
  ls <- getNums <$> getLine
  let a = length $ groupBy (==) $ sort ls
  putStrLn $ show $ if (a `mod` 2 == 0)
                  then a - 1
                  else a

getNums :: String -> [Int]
getNums = map read . words


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, k, a, cnt=0, ans=0;
  cin >> n >> k;
  unordered_map<int, int> mp;
  vector<pair<int, int>> vp;

  rep(i, n) {
    cin >> a;
    if (mp.find(a) == mp.end()) cnt++;
    mp[a]++;
  }

  if (cnt <= k) {
    cout << "0" << endl;
  } else {
    for (auto x : mp) {
      vp.emplace_back(make_pair(x.second, x.first));
    }
    sort(vp.begin(), vp.end());
    for (int i = 0; i < vp.size(); ++i) {
      ans += vp[i].first;
      cnt--;
      if (cnt <= k) {
        cout << ans << endl;
        break;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 11592
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main()
{
	fast;
 int n,m;
 cin>>n>>m;
 vector<int>num(n,0);
 vector<int>v(n,0);
 if(n==1 && m==0)
 {
 	cout<<"0";
 	return 0;
 }
 while(m--)
 {
 	int s,c;
 	cin>>s>>c;
 	if(v[s-1]!=0 && num[s-1]!=c)
 	{
	 	cout<<"-1";
	 	return 0;
	 }
	 num[s-1]=c;
 		v[s-1]=1;
 }
 string p="";
 if(v[0]==0)
 {
 	num[0]=1;
 }
 for(int i=0;i<n;i++)
{        p+=num[i]+'0';
 }
 if(p.size()!=n || (p[0]=='0'&& n!=1))
 {
 	cout<<"-1";
 	return 0;
 }
 	cout<<p;
 	return 0;
} 


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

using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    a[n] = a[n - 1] + 1;
    int ans = 0, len = 1;
    for (int i = 1; i < n + 1; ++i) {
        if (a[i] == a[i - 1]) ++len;
        else {
            ans += len / 2;
            len = 1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
using namespace std;
#define MAX  200000
#define SENTINEL  2000000000

long long int L[MAX/2 + 2], R[MAX/2 + 2], Xsorted[MAX], X[MAX]; 

void Merge(long long int Xsorted[], int n, int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++)
    {
        L[i] = Xsorted[left + i];
    }
    for (int i = 0; i < n2; i++)
    {
        R[i] = Xsorted[mid + i];
    }
    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;
    for (int k = left; k < right; k++)
    {
        if (L[i] <= R[j])
        {
            Xsorted[k] = L[i];
            i++;
        }
        else
        {
            Xsorted[k] = R[j];
            j++;
        }
    }
}

void MSort(long long int Xsorted[], int n, int left, int right)
{
    if (left + 1 < right)
    {
        int mid = (left + right) / 2;
        MSort(Xsorted, n, left, mid);
        MSort(Xsorted, n, mid, right);
        Merge(Xsorted, n, left, mid, right);
    }
}

int main()
{
    int N;
    scanf("%d", &N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &X[i]);
        Xsorted[i] = X[i];
    }
    //for (int i = 0; i < N; i++) printf("%lld\n", X[i]);
    MSort(Xsorted, N, 0, N);
    //for (int i = 0; i < N; i++) printf("%lld\n", Xsorted[i]);
    for (int i = 0; i < N; i++)
    {
        if (X[i] < Xsorted[N/2])
        {
            printf("%lld\n", Xsorted[N / 2]);
        }
        else if (X[i] >= Xsorted[N/2])
        {
            printf("%lld\n", Xsorted[N / 2 - 1]);
        }
    }
    return 0;
}

Measured memory_bytes: 6784
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int q = scan.nextInt();
		
		for(int i = 0; i < q; i++) {
			char[] x = scan.next().toCharArray();
			char[] y = scan.next().toCharArray();
			int[][] dp = new int[x.length+1][y.length+1];
			
			for(int j = 0; j < x.length; j++) 
				for(int k = 0; k < y.length; k++) 
					if(x[j] == y[k]) {
						dp[j+1][k+1] = dp[j][k]+1;
					}else {
						dp[j+1][k+1] = Math.max(dp[j+1][k], dp[j][k+1]);
					}
			
			System.out.println(dp[x.length][y.length]);
		}
		scan.close();
	}
}


Measured memory_bytes: 64088
#include<bits/stdc++.h>
using namespace std;
#define V vector
#define L long
#define W V<L>
L E=70,M=2e17,i,a,b;W S(V<W>p){if(!E)return{1,0};V<V<W>>T(2);for(W x:p){T[x[1]&1].push_back({x[0]/2,x[1]/2});if(x[0]&1)T[(x[1]+1)&1].push_back({x[0]/2,(x[1]+1)/2});}for(L i;i<2;i++){L c=0;for(W x:T[!i])c^=(2*x[0]+x[1])%3+1;if(!c){E--;W A=S(T[i]);A[0]*=2;A[1]*=2;A[1]+=i;return A;}}for(W&v:p)v[0]++;W A=S(p);A[0]--;return A;}int main(){cin>>i;V<W>p(i);while(i--,cin>>a>>b)p[i]={a+M,b+M};W x=S(p);cout<<x[0]-M<<" "<<x[1]-M;}

Measured memory_bytes: 62908
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
typedef long long LL;
char s[1050];
int sum;
int main(){
	sum=0;
	scanf("%s",s+1);
	for(int i=1;i<=3;i++){
		if(s[i]=='o') sum+=100;
	}
	printf("%d\n",sum+700);
}

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

Measured memory_bytes: 27064
def split(n, a, b, remain, ai, ans, width):
    # print(n, a, b, remain, ai, ans, width)
    # print(*(f'{c:5d}' for c in ans))
    # print(*(f'{c:05b}' for c in ans))
    if width == 2:
        ans[ai] = a
        ans[ai + 1] = b
        return
    x = a ^ b
    y = x & -x  # Rightmost Bit at which is different for a and b
    l = y.bit_length() - 1
    remain.remove(l)
    i = next(iter(remain))
    lb = a ^ (1 << i)
    ra = lb ^ y
    width >>= 1
    split(n, a, a ^ (1 << i), remain, ai, ans, width)
    split(n, ra, b, remain, ai + width, ans, width)
    remain.add(l)


def solve(n, a, b):
    if bin(a).count('1') % 2 == bin(b).count('1') % 2:
        print('NO')
        return
    remain = set(range(n))
    ans = [0] * (1 << n)
    split(n, a, b, remain, 0, ans, 1 << n)
    print('YES')
    print(*ans)


n, a, b = list(map(int, input().split()))
solve(n, a, b)


Measured memory_bytes: 11276
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

int main(){
  string S; cin >> S;
  int ans = 0;
  int cnt_0 = 0, cnt_1 = 0;
  for (int i = 0; i < S.length(); i++){
    if (S[i] == '0') cnt_0++;
    else cnt_1++;
  }
  cout << 2 * min(cnt_0, cnt_1) << endl;

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string X; cin >> X;
    int ans = 0, s = 0;
    for (int i = 0; i < X.size(); i++) {
        if (X[i] == 'T' && s == 0) ans++;
        else if (X[i] == 'T') s--;
        else s++;
    }
    cout << ans * 2 << endl;
    return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if(abs(x-a) > abs(x-b)) cout << "B" << endl;
  else cout << "A" << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace ABC122B
{
    public partial class Program
    {
        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var S = ss.Next();
            var ACGT = "ACGT";
            var cnt = 0;
            var res = 0;

            foreach (var s in S)
            {
                if (ACGT.Any(c => c == s))
                {
                    cnt++;
                }
                else
                {
                    res = Math.Max(res, cnt);
                    cnt = 0;
                }
            }

            sw.WriteLine(Math.Max(res, cnt));
            //---------------------------------
        }
    }

    public class StreamScanner
    {
        static readonly char[] Separator = {' '};
        readonly StreamReader streamReader;

        string[] line = new string[0];
        int index = 0;

        public StreamScanner(Stream stream)
        {
            this.streamReader = new StreamReader(stream);
        }

        public string Next()
        {
            return Next(s => s);
        }

        public string[] Next(int x)
        {
            return Next(s => s, x);
        }

        public string[][] Next(int x, int y)
        {
            return Next(s => s, x, y);
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (index < line.Length) return parser(line[index++]);
            index = 0;
            line = streamReader.ReadLine()?.Split(Separator, StringSplitOptions.RemoveEmptyEntries);
            return Next(parser);
        }

        public T[] Next<T>(Func<string, T> parser, int x)
        {
            var ret = new T[x];
            for (var i = 0; i < x; ++i) ret[i] = Next(parser);
            return ret;
        }

        public T[][] Next<T>(Func<string, T> parser, int x, int y)
        {
            var ret = new T[y][];
            for (var i = 0; i < y; ++i) ret[i] = Next(parser, x);
            return ret;
        }
    }

    public partial class Program
    {
        static void Main()
        {
            Excute(Console.OpenStandardInput(), Console.OpenStandardOutput());
        }

        public static void Excute(Stream input, Stream output)
        {
            var ss = new StreamScanner(input);
            var sw = new StreamWriter(output);
            new Program().Solve(ss, sw);
            sw.Flush();
        }
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define INF 1000000000000000000
#define all(x) x.begin(), x.end()
#define PI 3.141592653589793

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    string str1 = "", str2 = "L", str3 = "", str4 = "R";
    rep(i, ty - sy) {
        str1.push_back('U');
        str2.push_back('U');
    }
    str2 += "UR";

    rep(i, tx - sx) {
        str1.push_back('R');
        str2.push_back('R');
    }
    str2 += 'D';

    rep(i, ty - sy) {
        str3.push_back('D');
        str4.push_back('D');
    }
    str4 += "DL";

    rep(i, tx - sx) {
        str3.push_back('L');
        str4.push_back('L');
    }
    str4 += 'U';

    string ans = str1 + str3 + str2 + str4;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using std :: cout;
using std :: cin;
using std :: endl;
int main()
{
    int S;
    int W;
    cin >> S >> W;
    if (W >= S)
    {
        cout << "unsafe" << endl;
    }
    else
    {
        cout << "safe" << endl;
    }
}

Measured memory_bytes: 3128
#pragma comment(linker, "/STACK:102400000,102400000")
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <ctime>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <iomanip>
#include <bitset>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define SZ(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define pi acos(-1)
#define mod 1000000007
#define inf 1000000007
#define ll long long
#define ull unsigned long long
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
#define N 100010
#define _DEBUG
template <class U,class T> void Max(U &x, T y){if(x<y)x=y;}
template <class U,class T> void Min(U &x, T y){if(x>y)x=y;}
template <class T> void add(int &a,T b){a=(a+b)%mod;}
inline int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}

int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%mod;
        a=1LL*a*a%mod;b>>=1;
    }
    return ans;
}
int pow(int a,int b,int c){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%c;
        a=1LL*a*a%c;b>>=1;
    }
    return ans;
}

char s[N];
int main(){
    //srand(time(NULL)+clock());
    int T,ca=0,k,i,j,m=0,n;
    //double start=clock();
    scanf("%d%s",&n,s);
    int v[26]={0};
    rep(i,0,n)v[s[i]-'a']++;
    ll ans=1;
    rep(i,0,26)ans=ans*(v[i]+1)%mod;
    ans%=mod;
    ans--;
    if(ans<0)ans+=mod;
    printf("%lld\n",ans);
    //cerr<<(1.*clock()-start)/CLOCKS_PER_SEC<<"\n";
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

void printvec(vi& x, int size = 0) {
    if (x.size() == 0) {
        cout << endl;
        return;
    }
    cout << x.front();
    for (int i = 1; i < (size == 0 ? x.size() : size); i++) {
        cout << " " << x[i];
    }
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    vi as(n);
    iota(as.begin(), as.end(), 1);
    do {
        printvec(as);
    } while (next_permutation(as.begin(), as.end()));
}


Measured memory_bytes: 3096
#include <cstdio>
#include <algorithm>
using namespace std;
int n;
long long k;
int arr[200005];
int f[200005];
bool test(long long i){
    long long res=0;
    for (int x=0;x<n;x++){
        res+=max(arr[x]-i/f[x],0LL);
    }
    return res<=k;
}
int main(){
    scanf("%d%lld",&n,&k);
    for (int x=0;x<n;x++) scanf("%d",&arr[x]);
    for (int x=0;x<n;x++) scanf("%d",&f[x]);

    sort(&arr[0],&arr[n]);
    sort(&f[0],&f[n]);
    reverse(&f[0],&f[n]);

    if (test(0)){
        printf("0\n");
        return 0;
    }

    long long a=0,b=1000000000005,c;
    while (b-a>1){
        c=(a+b)>>1;
        if (!test(c)){
            a=c;
        }
        else{
            b=c;
        }
    }
    printf("%lld\n",b);
}


Measured memory_bytes: 1664
#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	char s[100];
	int min;
	int i;
	int len;
	while(scanf("%s",&s)!=-1)
	{
		min=753;
		len=strlen(s);
		for(i=0;i<len;i++)
		{
			s[i]=s[i]-'0';
		} //可以当作数字运算了 
		for(i=0;i<len-2;i++)
		{int temp;
		//	printf("min=%d\n",min);
			
			
			temp=s[i]*100+s[i+1]*10+s[i+2];//printf("temp=%d\n",temp);
			if(abs(temp-753)<min)
				min=abs(temp-753);
		}
		printf("%d\n",min);
	}
 } 

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ans = 0,maxi = 0;
  cin >> n;
  vector<int> a(n);
  for(int i = 0;i < n;i++){
    cin >> a[i];
  }
  
  for(int i = 0;i < n;i++){
    if(maxi <= a[i]){
      maxi = a[i];
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int A, B, C;
	cin >> A >> B >> C;
	for (int i = 1; i <= B; i++) {
		if (i*A%B == C) {
			cout << "YES" << endl;
			return 0;
		}
		

	}
	cout << "NO" << endl;
}

Measured memory_bytes: 256
mod=10**9+7

const=1
for i in range(1,16):
    const=(const*pow(i,mod-2,mod))%mod

def poly(n):
    if n<=14:
        return 0
    else:
        res=const
        for i in range(15):
            res=(res*(n-i))%mod
        return res

c=[1,5,10,10,5,1]
def conb(n):
    return c[n]


data=[[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1],[1,5,10,10,5,1]]

for _ in range(int(input())):
    N=int(input())
    ans=0
    for i in range(6):
        temp=0
        for j in range(6-i):
            n=(N+5-i)//2
            temp=(temp+poly(n+10-j)*data[5-i][j])%mod
        temp=(c[i]*temp*2**i)%mod
        ans=(ans+temp)%mod
    print(ans%mod)


Measured memory_bytes: 68248
n = int(input())
cnt = [0] * (1 + n)
for a in range(1, 100):
    for b in range(1, 100):
        for c in range(1, 100):
            k = a ** 2 + b ** 2 + c ** 2 + a * b + b * c + c * a
            if k > n:
                continue
            else:
                cnt[k] += 1
for i in range(1, n + 1):
    print(cnt[i])

Measured memory_bytes: 69200
import sys
for line in sys.stdin.readlines():
    line=map(float,line.strip().split())
    x=line[0::2]
    y=line[1::2]
    vx=x[0]-x[1],x[2]-x[3]
    vy=y[0]-y[1],y[2]-y[3]
    if vx[0]*vx[1]+vy[0]*vy[1]+0==0:
        print "YES"
    else:
        print "NO"

Measured memory_bytes: 4248