akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<set>
#include<map>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const int INF = 2000000000;

    ll N,M;
    ll A,B,C;ll X=-INF,Y=INF;
    std::string S[200],T[200];
    bool F=true;
    ll ans=0;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>N>>M>>A>>B;
    REP(i,N){
        ll a;
        cin>>a;
        X=max(X,a);
    }
    REP(j,M){
        ll a;
        cin>>a;
        Y=min(Y,a);
    }
    for(int i=A+1;i<=B;i++){
        if(X<i&&Y>=i){
            cout<<"No War";
            return 0;
        }
    }
    cout<<"War";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>

#define mod 1000000007

using namespace std;
using ll = long long;

bool isPrime(int x){
    if(x < 2){
        return false;
    }
    for(int i = 2; i <= sqrt(x); i++){
        if(x%i == 0){
            return false;
        }
    }
    return true;
}

void solve(){
    int a[100001];
    int q;
    cin >> q;
    int l[q], r[q];

    for(int i = 2; i <= 100000; i++){
        if(isPrime(i) && isPrime((i+1)/2)){
            a[i] = a[i-1]+1;
        }else{
            a[i] = a[i-1];
        }
    }
    for(int i = 0; i < q; i++){
        cin >> l[i] >> r[i];
        cout << a[r[i]]-a[l[i]-1] << endl;
    }
}

int main(){
    solve();
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define mxn 1000010
#define LL long long
#define pb push_back
#define pf push_front
#define pii pair<int,int> 
#define mp make_pair
#define fr first
#define sc second
using namespace std;
LL A,B,C,D,E,sl,fh,ans;
LL rd()
{
	sl=0;fh=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch) {if(ch=='-') fh=-1; ch=getchar();}
	while('0'<=ch&&ch<='9') sl=sl*10+ch-'0',ch=getchar();
	return sl*fh;
}
LL gcd(LL a,LL b)
{
	LL r=a%b;
	while(r)
	{
		a=b;
		b=r;
		r=a%b;
	}
	return b;
}
LL calc(LL a,LL p) {return a/p;}
int main()
{
	A=rd();B=rd();C=rd();D=rd();E=C*D/gcd(C,D);
	ans=(B-A+1)-(calc(B,C)-calc(A-1,C))-(calc(B,D)-calc(A-1,D))+(calc(B,E)-calc(A-1,E));
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> graph[110000];
int dp[110000];
int solve(int n){
	if(dp[n] != -1)
		return dp[n];
    int ret = 0;
	for(auto u: graph[n]){
		ret = max(ret, solve(u)+1);
	}
	dp[n] = ret;
	return dp[n];
}
int main()
{
	memset(dp, -1, sizeof(dp));
	int n, m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int x, y;
		cin>>x>>y;
		graph[x].push_back(y);
	}
	int ret = 0;
	for(int i=1;i<=n;i++){
		ret = max(ret, solve(i));
	}
	cout<<ret<<endl;
	return 0;
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
double ans;

//-------------------------↓↓↓↓↓↓------------------------

//------ 自分を天才だと信じる ------

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

    cin>>n;
    rep(i,n)cin>>a[i];
    sort(a,a+n);
    ans=((double)a[0]+(double)a[1])/2.0;
    rrep(i,2,n){
        ans=(ans+(double)a[i])/2.0;
    }
    doublecout(ans);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
			int a =sc.nextInt();
			double sum=a+Math.pow(a,2)+Math.pow(a,3);
			//int sum1 = (int)sum;
			System.out.println((int)sum);
		
		}
	
	
	
	}


Measured memory_bytes: 35440
N = gets.to_i
V = gets.chomp.split(' ').map{|x| x.to_i}
C = gets.chomp.split(' ').map{|x| x.to_i}

ans = 0
for i in 0...N
  ans += [0, V[i] - C[i]].max
end  
p ans
            


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

using namespace std;

// MACROS

#define ll long long
#define ull unsigned long long
#define ld long double

#define vi vector<int>
#define vll vector<ll>
#define vld vector<ld>
#define u_s unordered_set

#define pii pair<int,int>
#define pll pair<ll,ll>

#define FOR(i, n) for (ll (i) = 0; i < n; i++)
#define FORN(i, a, b) for (ll (i) = a; i < b; i++)
#define FORE(i, l) for (auto (i) : l)

#define pb push_back
#define pob pop_back
#define emp emplace

#define in(n) cin >> (n);
#define debug(n) cout << #n << ": " << n << '\n';

// FUNCTIONS

template< typename T >
inline T gcd(T a, T b) { if (b) return gcd(b, a % b); return a; }

template< typename T >
inline T ext_gcd(T a, T b, T & x, T & y) { if (a == 0) { x = 0; y = 1; return b; } T x1, y1; T g = ext_gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return g; }

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);	
    ll n;
    cin >> n;
    string s;
    cin >> s;
    char cur = s[0];
    ll num = 1;
    FORN(i, 1, n)
    {
        if (cur != s[i]) num++;
        cur = s[i];
    }
    cout << num << '\n';
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
#define l long long
#define pb push_back
#define mem(a,n) memset(a,n,sizeof(a))
#define find(v,n) find(v.begin(),v.end(),n)
#define sort1(v) sort(v.begin(),v.end())
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mod 998244353
#define reverse(s) reverse(s.begin(),s.end())
//#define pi pair<l,l> 
const double pi=3.141592653589793;
bool isprime(l n)
{
	for(l i=2;i<=n;i++)
	{
		if(n%i==0)
			return false;
	}
	return true;
}
bool fact(l n)
{
	vector<l> v;
	for(l i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			if(i%2==1||(n/i)%2==1)
			{
				return true;
			}
		}
	}
	return false;
}
l power(l a,l b)
{
	l ans=1;
	while(b>0)
	{
		if(b&1)
		{
			ans=(ans*a)%mod;
		}
		b>>=1;
		a=(a%mod*a%mod)%mod;
	}
	return ans;
}//prefixsums
void frooty()
{
	string s,t;
	cin>>s>>t;
	l n1=(l)s.size();
	l n2=(l)t.size();
	if(n2!=n1+1)
	{
		cout<<"No";
		return ;
	}
	else
	{
		for(l i=0;i<n1;i++)
		{
			if(s[i]!=t[i])
			{
				cout<<"No";
				return ;
			}
		}
		cout<<"Yes";
	}
	
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int q=1;
//	cin>>q;
	while(q--)
	{
		frooty();
	}
}

Measured memory_bytes: 3616
import sys
n = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))

ten = 0
for i in range(n):
    ten += min(a[i], b[i])
    if b[i]> a[i]:
        ten += min(a[i+1], b[i]-a[i])
        a[i+1] = max(a[i+1]-(b[i]-a[i]), 0)
            
print(ten)

Measured memory_bytes: 19376
// motatoes cp snippet
#include <bits/stdc++.h>

using namespace std;

#define endl "\n"
#define ll long long

#define forr(a,b,v) for(int v=a; v<=b; v++)
#define ford(a,b,v) for(int v=a; v>=b; v--)

// https://www.topcoder.com/community/competitive-programming/tutorials/power-up-c-with-the-standard-template-library-part-1/#map
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef pair< int,int > ii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())


string to_string(string s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

// get default value from map type
template<class K, class V>
V get(map<K,V> m, K k, V def) {
    if (m.find(k) != m.end()) {
        return m[k];
    } else {
        return def;
    }
}

// <geometry>
const double PI = acos(-1.0);

double toDegreeFromMinutes(double minutes) {
  return (minutes/60);
}

double toRadians(double degree) {
  return (degree * PI/180.0);
}

double toDegree(double radian) {
  if (radian < 0) radian += 2 * PI;
  return (radian * 180 / PI);  
}

double fixAngle(double A) {
  return A > 1 ? 1 : (A < -1 ? -1 : A);
}

// sin(A)/a = sin(B)/b = sin(C)/c
double getSide_a_bAB(double b, double A, double B) {
  return (sin(A)*b)/sin(B);
}

double getAngle_A_abB(double a, double b, double B) {
  return asin( fixAngle(  (a*sin(B))/b ));  
}

// a^2 = b^2 + c^2 - 2*b*c*cos(A)
double getAngle_A_abc(double a, double b, double c) {
  return acos( fixAngle(  (b*b*c*c-a*a) / (2*b*c)  ) );  
}
// </geometry>


const int N = 10000;

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

    string s;
    cin >> s;
  
    int m = atoi(s.substr(0,2).c_str());
	int y = atoi(s.substr(2,2).c_str());
  
	if ( (m >= 01 and m <= 12) and (y >= 01 and y <= 12) ) {
		cout << "AMBIGUOUS" << endl;
	} else if ( ( m >= 01 and m <= 12 ) ) {
		cout << "MMYY" << endl;
	} else if (y >= 01 and y <= 12) {
		cout  << "YYMM" << endl;
	} else {
		cout << "NA" << endl;
	}
	
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(void){
	char s[4], t[4];
	scanf("%s", s);
	scanf("%s", t);
	int c = 0;
	for(int i = 0; i < 3; i++){
		if(s[i] == t[i])c++;
	}
	printf("%d\n", c);
	return 0;
}


Measured memory_bytes: 2152
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define ll int
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<pill, ll>
using namespace __gnu_pbds;
using namespace std;
typedef gp_hash_table<int, short, hash<int>, equal_to<int>, direct_mod_range_hashing<int>, linear_probe_fn<>, hash_standard_resize_policy<hash_prime_size_policy, hash_load_check_resize_trigger<true>, true>> gp;

const ll N = 5e3 + 100;
const ll big = 1e18;
const ll block = 800;
const ll mod = 1e6;
string a;
ll x;
int main() {
	cin >> a;
	for(auto u : a)
		x += u - '0';
	cout << (x % 9 ? "No\n" : "Yes");
}

/*

*/


Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
    fastio;
    string s,t;
    cin>>s>>t;
    ll c=0;
    for(ll i=0;i<s.length();++i){
        if(s[i]==t[i]) ++c;
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void)
{
    int sum;
    char str[1100];
    int i;
    for (i=0; i<1100; i++){
        str[i] = 0;
    }

    while (1){
        scanf(" %s", str);
        if (strcmp(str, "0") == 0){
            break;
        }
        sum = 0;
        for (i=0; str[i]!='\0'; i++){
            sum += str[i] - '0';
        }

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

    return 0;
}
            

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

using namespace std;

#define LL long long
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const int maxn = 1e6 + 7;
const LL INF = 1e12;
const LL mod = 1e9 + 7;

LL inv[maxn];

///1e6��Ԫ���
void get_inv() {
    inv[1] = 1;
    for(int i = 2 ; i < maxn ; i++) {
        inv[i] = (mod - mod / i) * inv[mod % i] % mod;
//        if(inv[i] < 0) inv[i] += mod;
    }
}

LL qpow(LL a,LL b) {
    LL res = 1;
    while(b) {
        if(b & 1LL) res = (res * a) % mod;
        a = (a * a) % mod;
        b >>= 1LL;
    }
    return res % mod;
}

int a[maxn];
set<int>s;
map<int,int>mp;

int main() {
    int n;
    get_inv();
    while(~scanf("%d",&n)) {
        s.clear();
        for(int i = 1 ; i <= n ; i++) {
            scanf("%lld",&a[i]);
            s.insert(a[i]);
        }
        mp.clear();
        for(int i = 1 ; i <= n ; i++) {
            int p = a[i];
            for(int j = 2 ; j * j <= p ; j++) {
                if(p % j == 0) {
                    int cnt = 0;
                    while(p % j == 0) {
                        p /= j;
                        cnt++;
                        mp[j] = max(mp[j],cnt);
                    }
                }
            }
            if(p != 1) mp[p] = max(mp[p],1);
        }
        LL res = 1;
        for(map<int,int>::iterator it = mp.begin() ; it != mp.end() ; it++) {
//            cout << it -> first << " " << it -> second << " " << qpow(1LL * it -> first , 1LL * it -> second) << endl;
            res = ((res % mod) * qpow(1LL * it -> first , 1LL * it -> second)) % mod;
        }
//        cout << "res = " << res << endl;
        LL ans = 0;
        for(int i = 1 ; i <= n ; i++) {
//            cout << "inv = " << inv[a[i]] << endl;
            ans = ((ans % mod) + (res * inv[a[i]]) % mod) % mod;
//            cout << "ans = " << ans << endl;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 10880
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    vector<int> ans(31, 0);

    ans[0] = 0;
    for(int i = 1; i <= 30; ++i) {
        ans[i] = i;
        for(int j = 1; j < i-1; ++j) {
            int level = min(j, i-j-1);
            int x = 1;
            for(int k = 0; k < level; ++k) {
                ans[i] += 2*x;
                x *= 3;
            }
        }
    }

    int N;
    while(cin >> N) {
        cout << ans[N] << endl;
    }
    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

/*-------------------------------------------*/

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

    int H, W, N;
    cin >> H >> W >> N;
    vector<pair<int, int>> vec;
    vec.emplace_back(H, 0);
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        if(x >= y) vec.emplace_back(x - 1, y - 1);
    }
    sort(ALL(vec));
    int giri = 0;
    for(auto p : vec) {
        if(p.first - p.second > giri) {
            cout << p.first << endl;
            return 0;
        }
        if(p.first - p.second == giri) giri++;
    }

    return 0;
}

Measured memory_bytes: 2420
#include <iostream>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin >> a >> b >> c;
    if (a == b && b ==c) cout<< 1 << "\n";
    else if (a == b||a == c||b == c) cout << 2 <<"\n";
    else cout<< 3 <<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

template <typename T> class FenwickTree {
  const int n;
  std::vector<T> data;

public:
  /// @brief
  /// 長さ count の Fenwick Tree を作り，全ての要素を 0 で初期化する．
  /// @complexity $O(n)$
  FenwickTree(int count) : n(count), data(count, 0) { ; }

  /// @brief
  /// pos 番目の要素に値 value を加える．
  /// @complexity $O(\\log(n))$
  void add(int pos, const T &value) {
    assert(0 <= pos && pos < n);
    for (int i = pos; i < n; i |= i + 1) data[i] += value;
  }

  /// @brief
  /// 区間 [0, pos) 番目の範囲の和を求める．(pos = 0 のときは 0 を返す．)
  /// @complexity $O(\\log(n))$
  T sum(int pos) const {
    assert(0 <= pos && pos <= n);
    T res = 0;
    for (int i = pos - 1; i >= 0; i = (i & (i + 1)) - 1) {
      res += data[i];
    }
    return res;
  }

  /// @brief
  /// 区間 [l, r) 番目の範囲の和を求める．(l = r のときは 0 を返す．)
  /// @complexity $O(\\log(n))$
  T sum(int l, int r) const {
    assert(0 <= l && l <= r && r <= n);
    return sum(r) + (-sum(l));
  }
  using value_type = T;
  using update_type = T;
};

int main(void)
{
  LL q;
  cin >> q;
  vector<pair<LL,LL>> as;
  vector<LL> bs(1);
  vector<LL> qs;
  REP(i,q) {
    LL co;
    cin >> co;
    if(co == 1) {
      LL a,b;
      cin >> a >> b;
      as.emplace_back(a,as.size());
      bs.push_back(bs.back()+b);
    } else {
      qs.push_back(as.size());
    }
  }
  LL ass = as.size();
  sort(as.begin(),as.end());
  vector<pair<LL,LL>> upd(ass);
  REP(i,ass) {
    upd[as[i].second] = make_pair(i,as[i].first);
  }
  FenwickTree<LL> cbit(ass);
  FenwickTree<LL> bit(ass);
  LL pushed = 0;
  for(auto sz:qs) {
    while(pushed<sz) {
      auto p=upd[pushed];
      cbit.add(p.first, 1);
      bit.add(p.first, p.second);
      ++pushed;
    }
    LL l=0,r=ass;
    while(r-l>1) {
      LL p = (r+l)/2;
      if(cbit.sum(p)<=(sz-1)/2) l=p;
      else r=p;
    }
    LL x=as[l].first;
    LL answer = bs[pushed];
    answer += cbit.sum(l)*x - bit.sum(l);
    answer += bit.sum(l,ass) - cbit.sum(l,ass)*x;
    cout << x << " " << answer << endl;
  }
  return 0;
}


Measured memory_bytes: 11360
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<map>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
    int n;
    cin >> n;
    int tmp = findSumOfDigits(n);
    if(n % tmp == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
//
// Created on 2020/03/01.
//
//#include <bits/stdc++.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;
using gragh = vector<vector<int>>;

struct UnionFind {
    vector<int>d;
    UnionFind(int n=0):d(n,-1){} 
    int find(int x) {
        if(d[x] < 0) return x;
        else  return d[x] = find(d[x]);
    }
    bool unite(int x,int y) {
        x = find(x);
        y = find(y);
        if (x == y) return false;
        if(d[x] < d[y]) swap(x,y);
        //x.size > y.size
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y) {return find(x)==find(y);}
    int size(int x) {return -d[find(x)];}

};


int main() {
    int n,m,k;
    cin>>n>>m>>k;
    UnionFind uf(n);
    vector<int>friend_list(n,0);

    for (int i = 0; i < m; ++i) {
        int A,B;
        cin>>A>>B;
        A--;
        B--;
        uf.unite(A,B);
        friend_list[A]++;
        friend_list[B]++;
    }
    vector<vector<int>>block(n,vector<int>());
    for (int i = 0; i < k; ++i) {
        int A,B;
        cin>>A>>B;
        A--;
        B--;
        block[A].push_back(B);
        block[B].push_back(A);
    }
    for (int j = 0; j < n; ++j) {
        int ans = uf.size(j)-1-friend_list[j];
        for (int i = 0; i < block[j].size(); ++i) {
            if(uf.same(j,block[j][i])) ans--;
        }
        cout<<ans<<' ';
    }

    cout<<endl;
}



Measured memory_bytes: 7424
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

#include <set>
#include <unordered_map>
#include <stack>
#include <map>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
template<class T>bool chmaxj(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
void YesNo(bool y) { cout << (y ? "Yes" : "No") << endl; } //true==yes


#define INF 21474836

//////////////////////////////////////////////////////////////



int main() {

	long long A, B, N;
	cin >> A >> B >> N;

	long long ans;
	if (N < B) {
		ans = (A * N) / B;
	}
	else {
		ans = (A*(B - 1)) / B;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int n;
 
    while (scanf("%d", &n), n) {
	int MAX = (n-1) / 2;
	int cnt[MAX];
	fill(cnt, cnt+MAX, 0);
 
	set<int> s;
	for (int i = 1; i < n; i++) {
	    int num = i * i % n;
	    if (!s.count(num)) {
		s.insert(num);
	    }
	}
 
	set<int>::iterator it;
	vector<int> v;
	for (it = s.begin(); it != s.end(); it++) {
	    v.push_back(*it);
	}
	int len = (int)v.size();
	for (int i = 0; i < len; i++) {
	    for (int j = 0; j < len; j++) {
		if(i == j) continue;
		int diff = v[i] - v[j];
 
		if (diff < 0) {
		    diff += n;
		}
		if (diff > MAX) {
		    diff -= n;
		}
 
		cnt[diff-1]++;
	    }
	}
	for (int i = 0; i < MAX; i++) {
	    printf("%d\n", cnt[i]*2);
	}
    }
    return 0;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod
#define AddMult(x, y, z) x = (x + (y) * (z)) % mod

int num(int n, int d){
    int a = n % bit(d), b = n / bit(d + 1);
    if((n >> d) & 1) return b * bit(d) + a;
    else return b * bit(d);
}

signed main(){

    int A, B; cin >> A >> B;
    int ans = 0;
    REP(i, 60){
        if((num(B + 1, i) - num(A, i)) % 2) ans += bit(i);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;

template <int mod>
struct ModInt{
    int x;
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p){
        if ((x += p.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p){
        if ((x += mod - p.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p){
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p){
        *this *= p.inverse();
        return *this;
    }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while (b > 0){
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }

    ModInt pow(int e){
        long long a = 1, p = x;
        while (e > 0){
            if (e % 2 == 0){
                p = (p * p) % mod;
                e /= 2;
            }
            else{
                a = (a * p) % mod;
                e--;
            }
        }
        return ModInt(a);
    }

    friend ostream &operator<<(ostream &os, const ModInt<mod> &p){
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a){
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

using modint = ModInt<mod>;
modint f[d5];

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    modint res=0;
    vector<modint> a(d5,0);
    for(int i=k;i>=1;i--){
        modint x=modint(k/i).pow(n);
        for(int j=1;j*i<=k;j++){
            x-=a[i*j];
        }
        a[i]=x;
        res+=modint(i)*x;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 4764
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n,m;
    cin>>n>>m;
    int ans=0;
    for(int i=1; i*i<=m; ++i){
        if(m%i!=0)continue;
        int j=m/i;
        if((ll)i*n<=m)ans=max(ans,i);
        if((ll)j*n<=m)ans=max(ans,j);
    }
    cout<<ans<<endl;
}

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

#define INF 1e9+1

int main(){
  int N, W; cin >> N >> W;
  long long int dp[N+1][W+1] = {};
  long long int wi, vi;
  for(int i=1; i<N+1; ++i){
    cin >> wi >> vi;
    for(int j=1; j<W+1; ++j){
      if(j>=wi){
        dp[i][j] = max(dp[i-1][j-wi]+vi, dp[i-1][j]);
      }else{
        dp[i][j] = dp[i-1][j];
      }
    }
  }
  cout << dp[N][W] << endl;
  return 0;
}

Measured memory_bytes: 79104
global N
global Nlist
global Ma
global Mb
global minicost
minicost = 10000000
N, Ma, Mb = map(int,input().split()) 
Nlist = []
for i in range(N):
    a,b,c = map(int,input().split())
    Nlist.append([a,b,c])

def dvector(Masum,Mbsum,cost,vector):
    global Ma
    global Mb
    global Nlist
    global minicost
    if len(vector) == len(Nlist):
        return 0
    dvector(Masum,Mbsum,cost,vector+[0])
    Masum+= Nlist[len(vector)-1][0]
    Mbsum+= Nlist[len(vector)-1][1]
    cost += Nlist[len(vector)-1][2]
    if Mbsum > 0:
        if Masum/Mbsum == Ma/Mb:
            if minicost > cost:
                minicost = cost
    if cost < minicost:
        dvector(Masum,Mbsum,cost,vector+[1])
    return 0
    
dvector(0,0,0,[])
if minicost == 10000000:
    print("-1")
else:
    print(minicost)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#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;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  C -= (A - B);
  cout << max(0, C) << endl;
}

Measured memory_bytes: 256
# coding=utf-8

###
### for atcorder program
###

import sys
import math
import array

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def main():
    
    N = int(input())
    D = [int(w) for w in input().split()]

    D.sort()

    print(D[(N//2)] - D[N//2-1])
    
if __name__ == '__main__':
    main()



Measured memory_bytes: 14428
n=int(input())
s=input()
e_count=[0]
w_count=[0]
for i in range(n):
    if s[i]=='E':
        e_count.append(e_count[i]+1)
    else:
        e_count.append(e_count[i])
    if s[n-1-i]=='W':
        w_count.append(w_count[i]+1)
    else:
        w_count.append(w_count[i])
Min=n
for i in range(n):
    a=i-e_count[i]+n-i-1-w_count[n-1-i]
    if a<Min:
        Min=a
print(Min)

Measured memory_bytes: 81628
#include <iostream>

using namespace std;

int main() {
    
   int n;cin>>n;int a[n]={0};
   int cnt=0;
   for(int i=1;i<=n;i++)
   {
   cin>>a[i];
   if((a[i]&1)&&(i&1))cnt++;
   }
   cout<<cnt<<endl;
    
    
    
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define PI 3.141592653589
#define ll long long
using namespace std;

template<typename T_char>
T_char ToUpper(T_char cX){return toupper(cX);}

int main(){
  int a, b; cin >> a >> b;

  int cnt = 0, res = 1;
  while(res<b){
    --res;
    res += a;
    ++cnt;
  }
  
  cout << cnt;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)

	P := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&P[i])
	}

	min := P[0]
	count := 1
	for i := 1; i < N; i++ {
		if P[i] <= min {
			min = P[i]
			count += 1
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 4992
n = int(input())
L = []
R = [] # Rは右から見た値を入れる
for _ in range(n):
  s = input()
  btm = 0
  total = 0
  for c in s:
    if c == "(":
      total += 1
    else:
      total -= 1
    btm = min(btm, total)
  if total > 0:
    L.append((btm, total))
  else:
    R.append((btm - total, - total))
    
L.sort(key=lambda x: (-x[0], -x[1]))
R.sort(key=lambda x: (-x[0], -x[1]))

Lcrr_end = 0
for b, e in L:
  if Lcrr_end + b < 0:
    print("No")
    exit()
  Lcrr_end += e

Rcrr_end = 0
for b, e in R:
  if Rcrr_end + b < 0:
    print("No")
    exit()
  Rcrr_end += e

if Lcrr_end - Rcrr_end == 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 172804
#include <iostream>
#include <map>
#include <vector>
#include <string>

using namespace std;

int main() {
    int n, m, max = 0;
    map<string, int> val;
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; ++i) {
        cin >> s.at(i);
        ++val[s.at(i)];
    }
    cin >> m;
    vector<string> t(m);
    for (int i = 0; i < m; ++i) {
        cin >> t.at(i);
        --val[t.at(i)];
    }
    for (auto i = val.begin(); i != val.end(); ++i) if (i->second > max) max = i->second;
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long N;
int main() {
    cin >> N;
    long long ans = 0x3f3f3f3f3f3f3f3f;
    long long lim = (long long) (sqrt(N)+1);
    for (long long i=1; i<=lim; i++){
        if (N % i == 0) {
            long long g = N / i;
            ans = min(ans, i+g-2);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
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 main()
{
    int n;
    cin >> n;
    vector<int> A(n);
    int total = 0;
    repi(i, n, 0)
    {
        cin >> A[i];
        total += A.at(i);
    }
    int q;
    cin >> q;
    vector<int> m(q);
    repi(i, q, 0)
    {
        cin >> m[i];
    }

    repi(i, q, 0)
    {
        if (total < m.at(i))
        {
            puts("no");
            continue;
        }
        bool state = false;
        for (int bit = 0; bit < (1 << n); ++bit)
        {
            int sum = 0;
            repi(j, n, 0)
            {
                if (bit & (1 << j))
                {
                    sum += A.at(j);
                    if (sum > m.at(i))
                    {
                        break;
                    }
                }
            }
            if (sum == m.at(i))
            {
                state = true;
            }
        }
        if (state)
        {
            puts("yes");
        }
        else
        {
            puts("no");
        }
    }
    return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 50;
int main()
{
    std::ios::sync_with_stdio(false);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll x = max(a * c, a * d);
    ll y = max(b * c, b * d);
    ll ans = max(x, y);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3688
S = input()
mmlist = ["01", "02", "03",
          "04", "05", "06",
          "07", "08", "09",
          "10", "11", "12"]
if S[:2] in mmlist :
    if S[2:] in mmlist :
        print("AMBIGUOUS")
    else :
        print("MMYY")
else :
    if S[2:] in mmlist :
        print("YYMM")
    else :
        print("NA")

Measured memory_bytes: 2940
//dp[i]=min(dp[j]+max(T,(s[i]-s[j+1])*2)+(s[i]-s[j]));
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
const long long inf=1LL<<60;
int s[maxn];
int n,E,T;
int head,tail,que[maxn];
long long dp[maxn];
long long tmp=inf;
int main()
{
    scanf("%d%d%d",&n,&E,&T);
    for(int i=1;i<=n;i++)scanf("%d",&s[i]);
    head=1,tail=0;
    que[++tail]=0;
    for(int i=1;i<=n;i++)
    {
        while(head<=tail&&2*(s[i]-s[que[head]+1])>T)tmp=min(tmp,dp[que[head]]-2*s[que[head]+1]),head++;
        dp[i]=min(dp[que[head]]+T,tmp+2*s[i]);
        que[++tail]=i;
    }
    printf("%lld\n",dp[n]+E);
}

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

const ll INF = 1LL << 60;

ll N;
vector<ll> a;
int main() {
    cin >> N;
    a.resize(N);
    rep(i, N) cin >> a[i];

    map<string, ll> mp;
    ll free = 0;
    rep(i, N) {
        if (1 <= a[i] && a[i] <= 399) {
            mp["gray"]++;
        } else if (400 <= a[i] && a[i] <= 799) {
            mp["brown"]++;
        } else if (800 <= a[i] && a[i] <= 1199) {
            mp["green"]++;
        } else if (1200 <= a[i] && a[i] <= 1599) {
            mp["mizu"]++;
        } else if (1600 <= a[i] && a[i] <= 1999) {
            mp["ao"]++;
        } else if (2000 <= a[i] && a[i] <= 2399) {
            mp["ki"]++;
        } else if (2400 <= a[i] && a[i] <= 2799) {
            mp["dai"]++;
        } else if (2800 <= a[i] && a[i] <= 3199) {
            mp["red"]++;
        } else {
            free++;
        }
    }
    ll min_v = mp.size();
    if (min_v == 0 && free > 0) {
        min_v = 1;
    }
    ll max_v = (ll)mp.size() + free;
    cout << min_v << " " << max_v << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define dl long double
#define ff first
#define ss second
#define pb push_back
#define MAXN 10100
#define MAXD 110
#define INI 12332112
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef pair<int,int> pii;
const int M = 1e9+7;

string s;
int d;
int n;
int dp[MAXN][MAXD][2];

inline int mod(int a,int m){
	int r = a%m;
	if(r<0)r+=m;
	return r;
}


int s2(int dig,int soma,int flag){
	if(dp[dig][soma][flag]!=-1)return dp[dig][soma][flag];
	if(dig==n){
		if(soma==0){
			return dp[dig][soma][flag]=1;
		}else return dp[dig][soma][flag]=0;
		
	}
	if(flag){
		int res=0;
		for(int i=0;i<10;i++){
			res=mod(res+s2(dig+1,mod(soma+i,d),1),M);
		}
		return dp[dig][soma][flag]=mod(res,M);
	}else{
		int res=0;
		for(int i=0;i<10;i++){
			if(s[dig]-'0'>i){
				res=mod(res+s2(dig+1,mod(soma+i,d),1),M);
			}else if(s[dig]-'0'==i){
				res=mod(res+s2(dig+1,mod(soma+i,d),0),M);
			}else break;
		}
		return dp[dig][soma][flag]=mod(res,M);
	}
	
}



int32_t main(){
	fastio;
	cin>>s;
	cin>>d;
	n = s.size();
	memset(dp,-1,sizeof(dp));

	int r2 =0;
	for(int i=0;i<10;i++){
		if(s[0]-'0'>i){
			r2=mod(r2+s2(1,mod(i,d),1),M);
		}else if(s[0]-'0'==i){
			r2=mod(r2+s2(1,mod(i,d),0),M);
		}
	}
	
	cout<<mod(r2-1,M)<<endl;
	
}

Measured memory_bytes: 18432
n,m,l=map(int,input().split())
A=[list(map(int,input().split())) for i in range(n)]
B=[list(map(int,input().split())) for i in range(m)]
C=[[0]*l for i in range(n)]

for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] +=A[i][k]*B[k][j]

for i in range(n):
    print(*C[i])


Measured memory_bytes: 7044
#include <iostream>
using namespace std;
int main(){
        int h,w,x,y,r;
        cin >> w >> h;
        cin >> x >> y >> r;
        bool sign=0 , sign2=0;
        if(y+r >=0 && y-r>=0 )
                if( x+r >+0 && x-r>=0 )
                        sign=1;
        if(y+r<=h && x+r<=w )
                sign2=1;
        if(sign+sign2==2)
                cout <<"Yes"<<endl;
        else
                cout<<"No"<<endl;
        return 0;
}

Measured memory_bytes: 3100
import java.util.Scanner;

public class Main {
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		int r = scan.nextInt();
		int c = scan.nextInt();
		int data[][] = new int[r + 1][c + 1];
		
		for(int i = 0; i <= r; i++) {
			for(int j = 0; j <= c; j++) {
				if( j == c && i != r) {
					data[r][c] += data[i][c];
				}else if( i != r){
					data[i][j] = scan.nextInt();
					data[i][c] += data[i][j];
					data[r][j] += data[i][j];
				}
			}
		}
		
		for(int i = 0; i <= r; i++) {
			for(int j = 0; j <= c; j++) {
				if( j == c) {
					System.out.println(data[i][j]);
				}else {
					System.out.print(data[i][j] + " ");
				}
			}
		}
		
		
	}
}



Measured memory_bytes: 41556
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    if(n>k)cout << 0<<endl;
    else cout << 1<<endl;
    return 0;
}



Measured memory_bytes: 3160
require 'prime'
n = gets.chop.to_i
a = gets.chop.split.map(&:to_i)
a.select! {|item| item % 2 == 0 }
ans = 0
if a.length != 0
  a.map {|item|
    ans += Prime.prime_division(item)[0][1]
  }
end
puts ans

Measured memory_bytes: 2684
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>
#include <cstdint>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef unsigned long long		SQWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
/* 最大公約数 */
QWORD gcd(QWORD a, QWORD b) 
{
	if (b == 0) return a;
	return gcd(b, a % b);
}

/* 約数の列挙 */
vector<ll> divisorExec(ll n)
{
	vector<ll> res;
    for(ll i = 1; i <= sqrt(n); i++){
		if ((n % i) == 0) {
			res.push_back(i);
			if ((i * i) != n) {
				res.push_back(n / i);
			}
        }
    }
	sort(res.begin(), res.end());
	return res;
}

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

	vector<ll> res = divisorExec(M);
	for (auto one : res) {
		if (N <= one) {
			cout << M / one << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

int main() {
	int N;
	scanf("%d", &N);
	return !printf("%d\n", 48 - N);
}

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

int main()
{
  char s[1000],c[10];
  int sum=0;
  cin>>c;
  for(int i=0;i<strlen(c);i++)c[i]=tolower(c[i]);
  while(1){
    cin>>s;
    if(strcmp(s,"END_OF_TEXT")==0)break;
    for(int i=0;i<strlen(s);i++)s[i]=tolower(s[i]);
    if(strcmp(s,c)==0)sum++;
  }
  cout<<sum<<endl;
  return 0;
}

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

vector<int> graph[100005];  // 木の情報を格納

int dfs(int parent){
    if(graph[parent].size() == 0)    return 0;

    vector<int> depth;  // 親ノードparentの子ノードの部分木の深さ
    for(int i = 0; i < (int)graph[parent].size(); ++i){
        int child = graph[parent][i];
        depth.push_back(dfs(child));
    }
    sort(depth.begin(), depth.end(), greater<int>());

    int ret = 0;
    for(int i = 0; i < (int)depth.size(); ++i){
        ret = max(ret, depth[i] + i + 1);
    }

    return ret;
}

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

    int n;
    cin >> n;
    for(int i = 1; i < n; ++i){
        int a;
        cin >> a;
        --a;
        graph[a].push_back(i);
    }

    cout << dfs(0) << endl;
}

Measured memory_bytes: 15104
cost, amount, satisfaction = list(map(int, input().split()))
# 最小コストの満足回数を求める => 円
total_yen = cost * satisfaction
# もしも満足回数のコストが所持金を下回ればそのまま出力
# そうでなければ所持金で聞けるだけの回数を出力
if total_yen <= amount:
    print(satisfaction)
else:
    print(amount // cost)

Measured memory_bytes: 2940
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
typedef pair<int, int> P;
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int a[51];
    rep(i, N) cin >> a[i];
    int idx = 0;
    rep(i, N) {
        if(abs(a[idx]) < abs(a[i])) idx = i;
    }
    vector<P> A;
    rep(i, N) {
        A.push_back({idx, i});
    }
    rep(i, N - 1) {
        if(a[idx] <= 0) {
            A.push_back({N - i - 1, N - i - 2});
        } else {
            A.push_back({i, i + 1});
        }
    }
    cout << A.size() << endl;
    for(auto& e: A) {
        cout << e.first + 1 << " " << e.second + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256