akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;


int main(){
	int N, M;
	cin >> N >> M;
	int K[N];
	int A[N][M];
	for(int i = 0;i<N;i++){
		cin >> K[i];
		for(int j=0;j<K[i];j++){
			cin >> A[i][j];
		}
	}
	int cnt = 0;
	for(int k=0;k<M;k++){
		int check = 1;
		for(int i=0;i<N;i++){
			int exist = 1;
			for(int j=0;j<K[i];j++){
				if(A[i][j]-1 == k) exist = 0;
			}
			if(exist) check = 0;
		}
		cnt = cnt + check;
	}
	cout << cnt << endl;
}

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

int main() {
 int n;
 cin >> n;
 
 vector<int> a(n);
 rep(i,n) {
  cin >>a.at(i);
  }
  
  rep(i,n-1) {
  cout << a.at(i) << ' ';
  }
  cout << a.at(n-1) << endl;
  
  
  for(int i = 1; i < n; i++) {
  int v = a.at(i);
  int j = i - 1;
  while (j >= 0 && a.at(j) > v) {
   a.at(j+1) = a.at(j);
   j--;
   }
   a.at(j+1) = v;
   
   rep(i,n) {
    cout << a.at(i);
    if(i != n-1){
     cout << ' ';
     }
     else {
      cout << endl;
      }
      }
      
  }
  
 
 
}


Measured memory_bytes: 3084
import sys

H, W = map(int, input().split())

rows = []
for i in range(H):
    chars = list(input())
    rows.append([1 if c == '#' else 0 for c in chars])

for h in range(H):
    for w in range(W):
        if rows[h][w] == 1:
            sys.stdout.write('#')
            continue

        range_w = (max(0, w - 1), w + 2)
        range_h = (max(0, h - 1), h + 2)

        target_rows = [
            sample_row[range_w[0]:range_w[1]]
            for sample_row in rows[range_h[0]:range_h[1]]
        ]

        conv_result = sum([sum(r) for r in target_rows])
        sys.stdout.write(str(conv_result))
    
    print()


Measured memory_bytes: 3316
S = input().strip()
T = input().strip()
k = len(T)
A = []
for i in range(len(S)-k+1):
    flag = 1
    for j in range(i,i+k):
        if S[j]!="?" and S[j]!=T[j-i]:
            flag = 0
            break
    if flag==1:
        A.append(i)
if len(A)==0:
    print("UNRESTORABLE")
else:
    S = S[:A[-1]]+T+S[A[-1]+k:]
    for i in range(len(S)):
        if S[i]=="?":
            S = S[:i]+"a"+S[i+1:]
    print(S)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <map>

using namespace std;

#define fi first
#define se second

map<int, int> mymap;

int n, x, res = 0;

int main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> x, mymap[x]++;
	for (map<int, int>::iterator it = mymap.begin(); it != mymap.end(); it++)
	{
		if (it->fi > it->se)
			res += it->se;
		else if (it->fi < it->se)
			res += it->se - it->fi;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 4736
// Abhishek Chaturvedi- abhishekchaturvedi10oct //

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define endl            "\n"
#define inf             2e18+1
#define ninf            -2e18+1
#define mod             1000000007
#define eps             1e-9
#define ff              first
#define ss              second
#define int             long long 
#define ld              long double
#define str             string 
#define pb              emplace_back
#define mp              make_pair
#define vi              vector<int>
#define si              set<int>
#define pii             pair<int,int>
#define psi             pair<str,int>
#define mii             map<int,int>
#define msi             map<str,int>
#define vvi             vector<vector<int>>
#define maxheap         priority_queue<int>
#define minheap         priority_queue<int,vi,greater<int>>
#define sz(x)           (int)x.size()
#define all(x)          x.begin(),x.end()
#define allr(x)         x.rbegin(),x.rend()
#define gcd(x,y)        __gcd(x, y)
#define arrsz(x)        sizeof(x)/sizeof(x[0])
#define sp(x,y)         fixed<<setprecision(y)<<x
#define tc(x)           int x; cin>>x; while(x--)
#define loopf(i,x,y)    for(int i=x;i<=y;i++)
#define loopb(i,x,y)    for(int i=x;i>=y;i--)
#define in(x,n)         int x[n];loopf(i,0,n-1) cin>>x[i];
#define out(x)          for(auto i:x) cout<<i<<" "; cout<<endl;
#define init(x,n,y)     int x[n];loopf(i,0,n-1) x[i]=y;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

bool isPowerOfTwo(int x){
   return x&&(!(x&(x-1)));
}

int takemod(int x){ 
    return (x%mod + mod) % mod; 
}

int lcm(int x,int y) {
    return (x/gcd(x,y)) * y;
}

int fpow(int base,int power,int MOD) {
    int result = 1;
    base=base%MOD;
    while(power){
        if(power&1) 
            result = (result*base) % MOD;
        base = (base*base) % MOD;
        power = power>>1;
    }
    return result;
}

int modinv(int x){return fpow(x,mod-2,mod);}

void fastIO(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

void solve(){
   int x,y; cin>>x>>y;
   if(y%2||y>x*4||y<x*2) cout<<"No";
   else cout<<"Yes";
}

int32_t main(){
    
    fastIO();
    
    //tc(t){ 
       solve();  
    //}
    
    return 0;
}


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

using namespace std;

int solve(vector<int> s){
    sort(s.begin(),s.end());
    int al = 0;
    for(int i=1;i<s.size()-1;i++){
        al += s[i];
    }
    return al / (s.size()-2);
}
int main(){
    while(true){
        int n;
        cin >> n;
        if(n == 0) break;
        vector<int> s(n);
        for(int i=0;i<n;i++) cin >> s[i];
        cout << solve(s) << endl;
    }
    return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

ll N, M;
vector<ll> A;

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

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

int main() {
// https://atcoder.jp/contests/abc150/tasks/abc150_d
    cin >> N >> M;
    A.resize(N);
    rep(i, 0, N) 
    { 
        cin >> A[i]; 
        A[i] /= 2L; 
    }
    
    ll l = A[0];
    rep(i, 1, N) l = lcm(l, A[i]);

    if (l > M)
    {
        cout << 0 << endl;
        return 0;
    }
    
    rep(i, 0, N) 
    {
        if ((l / A[i]) % 2 == 0)
        {
            cout << 0 << endl;
            return 0;
        }  
    }

    cout << (M / l + 1L) / 2L << endl;
}


Measured memory_bytes: 1024
'use strict';
(function(stdin) {

  // define function
  var compare = function(a, b) {
    if (a < b) return 'a < b';
    if (a > b) return 'a > b';
    return 'a == b';
  };

  // declare variable
  var inputs  = stdin.toString().trim().split('\n');

  // var result = (function([a,b]) {
  //   console.log(compare(a, b));
  // })(inputs[0].split(' ').map(Number));

  var cols = inputs[0].split(' ');
  var a = parseInt(cols[0], 10);
  var b = parseInt(cols[1], 10);
  console.log(compare(a, b));
  // main
  // 
  // display
  
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15580
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define int long long int
#define ld long double
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MAXX 1000000000000000000

int32_t main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n, i, j, x=0, y, a[200005];

	unordered_map<int,int> values;

	cin >> n;

	for(i=1;i<=n;i++)
	{
		cin >> a[i];
		if(a[i] < i)
		{
			x += values[i-a[i]];
		}
		values[i + a[i]] += 1;
	}
	cout << x;
	return 0;
}


Measured memory_bytes: 13492
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

#[fastout]
fn main() {
   input! {
      n: usize,
      w: usize,
      mut wv: [(usize, usize); n]
   }

   let w0 = wv[0].0;
   let mut vs = vec![vec![]; 4];
   for &(w, v) in wv.iter() {
      vs[w - w0].push(v);
   }

   let mut m = vec![0; 4];
   for i in 0..4 {
      vs[i].sort_by(|a, b| b.cmp(a));
      m[i] = vs[i].len();
      vs[i].insert(0, 0);
      for j in 0..m[i] {
         vs[i][j + 1] += vs[i][j];
      }
   }

   let mut ans = 0;
   for i in 0..=m[0] {
      for j in 0..=m[1] {
         for k in 0..=m[2] {
            for l in 0..=m[3] {
               if (i + j + k + l) * w0 + j + 2 * k + 3 * l > w {
                  break;
               }
               ans = std::cmp::max(ans, vs[0][i] + vs[1][j] + vs[2][k] + vs[3][l]);
            }
         }
      }
   }
   println!("{}", ans);
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, starter, n) for (int i = (starter); i < (int)(n); i++)

int main(){
    int N;
    int K;
    int Q;
    cin >> N >> K >> Q;
    vector<int> a(N);
    rep(i,Q){
        int temp;
        cin >> temp;
        a.at(temp-1) +=1;
    }

    rep(j,N){
        if( K - (Q - a.at(j)) >0) cout << "Yes" << endl;
        else cout << "No" << endl; 
    }
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define MOD                     998244353
#define inf                     3e18
#define vi                      vector<int>
#define vld                     vector<ld>
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define fi                      first
#define se                      second
#define fastIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds; 
		//order_of_key (k) : Number of items strictly smaller than k .
		//find_by_order(k) : K-th element in a set (counting from zero) (returns an iterator)           


void inp_out()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("debug.txt", "w", stderr);
	#endif
}

int32_t main()
{
	fastIO
	inp_out();
	int n, x, m; 
	cin >> n >> x >> m; 

	vi vis(m); 

	int ans = 0, cur = x; 
	vi v; 
	int idx = n, total = 0, flag = 0; 

	for(int i = 0; i < n; ++ i)
	{
		if(vis[cur] == 2)
		{
			idx = i; 
			break; 
		}

		if(vis[cur] == 1)
		{
			vis[cur] = 1; 
			total += cur; 
			v.pb(cur); 
		}

		vis[cur]++;

		ans += cur; 
		cur = (cur * cur) % m; 
	}

	int sz = v.size(); 

	if(sz != 0)
	{
		ans += total * ((n - idx) / sz); 
		for(int i = 0; i < ((n - idx) % sz); ++ i)
			ans += v[i]; 
	}
	cout << ans; 

	return 0;
}

Measured memory_bytes: 4640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << ” ” << xxx.second << “\n”;}}

using LL = long long;

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

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

constexpr long long INF = 1e12;

vector<LL> h, dp;

LL f(int i) {
    if (dp[i] < INF) return dp[i];

    LL cost = INF;
    for (int j = 1; j <= 2; j++) {
        int from = max(i - j, 0);
        chmin(cost, f(from) + abs(h[from] - h[i]));
    }

    return dp[i] = cost;
}

int main() {

    int N;
    cin >> N;

    h = vector<LL>(N);
    for (int i = 0; i < N; i++) cin >> h[i];

    dp = vector<LL>(N, INF);
    dp[0] = 0;

    LL ans = f(N - 1);
    cout << ans << endl;

    return 0;
}































Measured memory_bytes: 9600
def gcd(a,b):
    if b>a:
        a,b=b,a
    while b:
        a,b=b, a%b
    return a


def cul(n,x):
    l=len(x)
    b=[x[i] for i in range(l)]
    b.pop(n)
    tmp=b[0]
    for i in range(1,l-1):
        tmp=gcd(tmp,b[i])
    return tmp

import sys
import math
p=10
N=int(input())
a=list(map(int,input().split()))
if N<=p:
    ans=0
    
    for i in range(N):
        tmp=cul(i,a)        
        if tmp>ans: ans=tmp
    print(ans)
    sys.exit()
        
M=a[0]
for i in range(1,p):
    M=gcd(M,a[i])

ans=0
for i in range(1,math.ceil(M**0.5)+1 ):
    if M%i==0:
        cnt=0
        for j in range(p,N):
            if a[j]%i!=0:
                cnt+=1
                if cnt==2: break
            elif j==N-1 and i>ans: ans=i
        
        x=M//i
        cnt=0
        for j in range(p,N):
            if a[j]%x!=0:
                cnt+=1
                if cnt==2: break
            elif j==N-1 and x>ans: ans=x

R=a[p]
for i in range(p+1,N):
    R=gcd(R,a[i])

if R>ans:
    for i in range(p):
        s=gcd(cul(i,a[:p]),R)
        if s>ans: ans=s

print(ans)

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

const int N=3e3+20,MOD=998244353;

int n,s,x,dp[N][N],ans;

int main()
{
	cin>>n>>s;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		memcpy(dp[i],dp[i-1],sizeof(dp[0]));
		dp[i][x]=(dp[i][x]+i)%MOD;
		for(int j=1;j+x<=s;j++)
			dp[i][j+x]=(dp[i][j+x]+dp[i-1][j])%MOD;
		ans=(dp[i][s]+ans)%MOD;
	}
	cout<<ans;
}

Measured memory_bytes: 35584
#include <stdio.h>
#include <math.h>

#define N 10000

int main(){
  int A[N],n,i,j,cnt=0,z,flag,a;

  scanf("%d",&n);

  if(n>=1 && n<=N){
    for (i=0; i<n; i++) scanf("%d",&A[i]);
 
    for (i=0; i<n; i++){
      a = A[i];
      if (a >= 2 && a <= 100000000){
	flag = 0;
	if (a == 2) flag = 0;
	else if (a%2 == 0) flag = 1;
	else {
	  for (j=3; j<=(sqrt(a)); j++){
	    z = a%j;
	    if (z == 0){
	      flag = 1;
	      break;
	    }
	  }
	}
	if (flag == 0) cnt++;
      }
    }
    
    printf("%d\n",cnt);
  }

  return 0;
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct aaa{
	ll x,y;
}a[500001];
ll n,rmx,rmn,bmx,bmn,ans,mx[500001],mn[500001];
bool cmp(aaa a,aaa b){
	return a.x<b.x;
}
int main(){
	ll i,hh;
	bmx=rmx=-1;
	bmn=rmn=2e9;
	scanf("%lld",&n);
	for(i=1;i<=n;i++){
	 scanf("%lld%lld",&a[i].x,&a[i].y);
	 if(a[i].x>a[i].y)swap(a[i].x,a[i].y);
	 rmx=max(rmx,a[i].x);rmn=min(rmn,a[i].x);
	 bmx=max(bmx,a[i].y);bmn=min(bmn,a[i].y);
  }
  ans=(bmx-bmn)*(rmx-rmn);
  sort(a+1,a+n+1,cmp);
  hh=2e9;
  mx[1]=mn[1]=a[1].y;
  for(i=2;i<n;i++){
  	mx[i]=max(mx[i-1],a[i].y);
  	mn[i]=min(mn[i-1],a[i].y);
  	hh=min(hh,max(mx[i],a[n].x)-min(mn[i],a[i+1].x));
  }
  //printf("%lld\n",hh);
  printf("%lld",min(ans,hh*(bmx-rmn)));
}
/*
对于最大最小的都在一起的情况只会一个有点麻烦的移动队列扫过去的做法
看完题解才知道可以贪心 
*/

Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
typedef long long int ll;
int x;
int n;
const int N=1e2+4;
ll h[N],s[N]; ll dp[N][100006];

ll solve(int idx,int tot){
	if(idx==n+1) {
		if(tot<=x) {
			return 0;
		}
		return -1e18;
	}
	if(tot>x) {
		return -1e18;
	}
	if(dp[idx][tot]!=-1) {
		return dp[idx][tot];
	}
	return dp[idx][tot]=max(solve(idx+1,tot+h[idx])+s[idx],solve(idx+1,tot));
}

int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	cin>>n;
	cin>>x;
	for(int i=1; i<=n; i++) {
		cin>>h[i];
		cin>>s[i];
	}

	memset(dp,-1,sizeof dp);
	ll ans=solve(1,0);
	cout<<ans<<endl;
	return 0;
}


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

class myheap{
public:
  int size;
  long long int* heap;
  myheap(int size){
    this->size = size;
    heap = new long long int[size+1];
  }
  ~myheap(){
    delete[] heap;
  }
  void print(){
    for(int i=1; i<=size; i++){
      cout << "node " << i << ": key = " << heap[i];
      if(i/2>=1){
        cout << ", parent key = " << heap[i/2];
      }
      if(i*2<=size){
        cout << ", left key = " << heap[i*2];
        if(i*2+1<=size){
          cout << ", right key = " << heap[i*2+1];
        }
      }
      cout << ", " << endl;
    }
  }
};

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

  int v;
  for(int i=0; i<n; i++){
    cin >> v;
    h.heap[i+1] = v;
  }

  h.print();

  return 0;
}



Measured memory_bytes: 3084
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
typedef long long ll;
using namespace std;
const ll INF = 1LL << 50;
struct edge {int from, to; ll cost;};
edge es[2005];
ll d[1005];
int N,M;
bool negative[1005]; 

void shortest_path(int s){
  rep(i, N) d[i] = INF;
  d[s] = 0;
  rep(loop, N-1){
    rep(i, M){
      edge e = es[i];
      if (d[e.from] == INF) continue;
      if(d[e.from] != INF && d[e.to] > d[e.from]+e.cost) d[e.to] = d[e.from] + e.cost;
    }
  }
}

void find_negative_loop(){
  rep(i, N){
    rep(j, M){
      edge e =es[j];
      if (d[e.from] == INF) continue;
      if (d[e.to] > d[e.from] + e.cost) {
        d[e.to] = d[e.from] + e.cost;
        // n回目にも更新があるなら負の経路が存在する
        negative[e.from] = true;
      }
      if(negative[e.from]) negative[e.to] = true;
    }
  }
}

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

  cin >> N >> M;
  int a,b;
  ll c;
  rep(i, M){
    cin >> a >> b >> c;
    a--, b--;
    edge e = {a, b, -c};
    es[i] = e;
  }
  shortest_path(0);
  find_negative_loop();
  if (negative[N-1]) cout << "inf" << endl;
  else cout << - d[N-1] << endl;
}

Measured memory_bytes: 256
import java.util.*
fun main(args: Array<String>) {
    val reader = Scanner(System.`in`)
    //val (H, M, W) = readLine()!!.split(" ").map{ it.toInt() }
    val H = reader.nextInt()
    val M = reader.nextInt()
    val W = reader.nextInt()

    /*val map = Array(H){
        val rows = IntArray(M)
        rows.fill(0)
        rows
    }*/
    val positionArray = mutableListOf<Pair<Int, Int>>()
    
    var maxRowNum = 0
    var maxRowCount = 0L
    //var rowNoList = mutableListOf<Int>()
    val maxRows = IntArray(H)
    maxRows.fill(0)
    
    val rowNums = IntArray(H)
    rowNums.fill(0)

    var maxColumnNum = 0
    var maxColumnCount = 0L
    //var columnNoList = mutableListOf<Int>()
    val maxColumns = IntArray(M)
    maxColumns.fill(0)
    
    val columnNums = IntArray(M)
    columnNums.fill(0)

    repeat(W){
        //val (row, column) = readLine()!!.split(" ").map { it.toInt() - 1}
        val row = reader.nextInt() - 1
        val column = reader.nextInt() - 1
        rowNums[row] += 1
        columnNums[column] += 1

        positionArray.add(Pair(row, column))

        if(rowNums[row] > maxRowNum){
            maxRowNum = rowNums[row]
        }

        if(columnNums[column] > maxColumnNum){
            maxColumnNum = columnNums[column]
        }
    }

    rowNums.forEachIndexed { index, i ->
        if(i == maxRowNum){
            //rowNoList.add(index)
            maxRows[index] = 1
            maxRowCount += 1
        }
    }

    columnNums.forEachIndexed{ index, i->
        if(i == maxColumnNum){
            //columnNoList.add(index)
            maxColumns[index] = 1
            maxColumnCount += 1
        }
    }
    
    var positionCount = 0L
    positionArray.forEach { 
        if(maxRows[it.first] == 1 && maxColumns[it.second] == 1){
            positionCount++
        }
    }
   /* for(rowIndex in 0..rowNoList.size - 1){
        for(columnIndex in 0..columnNoList.size - 1){
            var rowNum = rowNoList[rowIndex]
            var columnNum = columnNoList[columnIndex]

            if(map[rowNum][columnNum] == 0){
                findCommon = false
                break
            }
        }
        if(!findCommon){
            break
        }
    }*/
    //println("maxRowCount: ${maxRowCount} maxColumnCount: ${maxColumnCount} positionCount: ${positionCount}")
    println(if(maxRowCount * maxColumnCount <= positionCount) maxRowNum + maxColumnNum - 1 else maxRowNum + maxColumnNum)
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;
#define debug(x) cerr << #x << ": " << (x) << "\n";

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

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

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

  int n;
  cin >> n;
  ll ans = 0ll;
  ll a;
  rep(i, 0, n) {
    cin >> a;
    ans += (a - 1ll);
  }

  cout << ans << endl;

  return 0;
};


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

int main() {
    int n;
    cin >> n;
    if (n < 10) cout << n << endl;
    else if (10 <= n && n < 100) cout << 9 << endl;
    else if (100 <= n && n < 1000) cout << 9 + n - 99 << endl;
    else if (1000 <= n && n < 10000) cout << 9 + 900 << endl;
    else if (10000 <= n && n < 100000) cout << 9 + 900 + n - 9999 << endl;
    else if (n == 100000) cout << 90909 << endl;
    return 0;
}

Measured memory_bytes: 256
D, N = list(map(int, input().split()))
if D == 0:
    if N == 100:
        print(101)
    else:
        print(N)
elif D == 1:
    if N == 100:
        print(100 * 101)
    else:
        print(100 * N)
else:
    if N == 100:
        print(10000 * 101)
    else:
        print(10000 * N)


Measured memory_bytes: 9176
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();
		int[] fruit = new int[n];
		for(int i = 0; i < n; i++) fruit[i] = in.nextInt();
		Arrays.sort(fruit);
		int ans = 0;
		for(int i = 0; i < k; i++) {
			ans += fruit[i];
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 39032
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define black_tree tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define pair_black_tree tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update>
#define gp __gnu_pbds
#define INF 1000000000
#define MOD 1000000007
#define MAX 1000000
#define endl '\n'
#define ll long long
#define ld long double
#define lli long long int
#define ull unsigned long long
#define ulli unsigned long long int
#define pb push_back
#define pf push_front
#define ook order_of_key
#define fbo find_by_order
#define np next_permutation
#define mp make_pair
#define eb emplace_back
#define mae max_element
#define mie min_element
#define lb lower_bound 
#define ub upper_bound
#define bs binary_search
#define ff first
#define ss second
using namespace std;
using namespace gp;
ll n;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    cout<<360/__gcd(360LL,n);
}

Measured memory_bytes: 3648
a, b = map(int, input().split())
c = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]
if c.index(a) > c.index(b):
    print('Alice')
elif c.index(a) == c.index(b):
    print('Draw')
else:
    print('Bob')

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

int main(){
	string s,t;
	cin>>s;
	cin>>t;
	int len = s.length();
	int ans = 0;
	for(int i=0;i<len;i++){
		if(s[i] != t[i])ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3860
function main(input){
    var tmp = input.split(/\r\n|\r|\n/);
    var N = Number(tmp[0]);
    var S = tmp[1].split('');
    //console.log(N, S);

    var res;
    var i = 0;
    var isYoko;
    if(S[i]==S[i+1]){
        res = 6;
        i = i+2;
        isYoko = true;
    }else{
        res = 3;
        i++;
        isYoko = false;
    }

    for(; i<N-1; i++){
        if(S[i]==S[i+1]){
            if(isYoko){
                res = res * 3;
            }else{
                res = res * 2;
            }
            i++;
            isYoko = true;
        }else{
            if(!isYoko){
                res = res * 2;
            }
            isYoko = false;
        }
    }

    if(i<N){
        if(!isYoko){
            res = res * 2;
        }
    }

    console.log(res%1000000007);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

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

    vector<int> ans(0);
    int cnt=0;
    int tmp=0;
    for(int i=0; i<=N; i++){
        if(S[N-i]=='0'){
            tmp=cnt;
        }
        if(cnt==M){
            if(tmp==0){
                cout << -1 << endl;
                return 0;
            }
            ans.push_back(tmp);
            cnt-=tmp;
            tmp=0;
        }
        cnt++;
    }

    if(tmp!=0){
        ans.push_back(tmp);
    }

    for(int i=(int) ans.size()-1; i>=0; i--){
        cout << ans[i];
        if(i>0){
            cout << ' ';
        }
    }
    cout << endl;
}

Measured memory_bytes: 1144
#include<iostream>

using namespace std;

int main()
{
    int n,m,x;
    int a[110]={};
    int b[110]={};
    int k1 = 0;
    int k2 = 0;

    cin >> n >> m >> x;

    for(int i = 0;i < m;i++){
        cin >> a[i];
        b[a[i]]++;
    }
    for(int i = 0;i < n;i++){
        if(b[i] && i < x) k1++;
        if(b[i] && i >= x) k2++; 
    }
    cout << min(k1, k2) << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np


# 文字列を一文字ずつのリストに代入 test は['t', 'e', 's', 't']
s = list(input())
t = list(input())
dame = 0
d = []
for i in ["a","b","c","d","e","f","g","h","i","j","k","l","m",\
            "n","o","p","q","r","s","t","u","v","w","x","y","z"]:
    if i in s:
        j=t[s.index(i)]
        if j in d:
            dame = 1
#            print("a")
            break
        d.append(j)
#        print("add",i)
        for x in [p for p, x in enumerate(s) if x == i]:
            if j != t[x]:
                dame = 1
#                print("b")
                break

if dame:
    print("No")
else:
    print("Yes")



Measured memory_bytes: 21260
/*Remember: The Struggle is Important*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

#include<bits/stdc++.h>
using namespace std;

#define     int          long long int
#define     ld           long double
#define     fast()       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)       x.begin(),x.end()
#define     mem(a,b)     memset(a,b,sizeof(a))
#define     gcd(a,b)     (__gcd((a),(b)))
#define     lcm(a,b)     (((a)*(b))/gcd((a),(b)))
#define     pb           push_back
#define     ins          insert
#define     pii          pair<int,int>
#define     F            first
#define     S            second
#define     makep        make_pair
#define     maket        make_tuple
#define     show(x)      for(auto c:x)cout<<c<<" ";cout<<"\n";
#define     show2(x)     for(auto c:x)cout<<c.F<<" "<<c.S<<"\n";

const ld pi=acos(-1);
const int inf=1e18,M=1e9+7;
const int N=1;

void solve()
{
    int a,b,c;
    cin>>a>>b>>c;

    int l=4ll*a*b;

    if(c-a-b<0ll)
    {
        cout<<"No";
        return;
    }

    int r=(c-a-b)*(c-a-b);

    int ans=r-l;

    if(ans>0ll)
        cout<<"Yes";
    else
        cout<<"No";
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAXN 10000010
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	long long r,d,b,i,son;
	cin>>r>>d>>b;
	for(i=1;i<=10;i++)
	{
		son=r*b-d;
		cout<<son<<endl;
		b=son;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

const int MAX_N = 100005;
int bit[MAX_N], n;

void add (int i, int x ){
	
	while (i <= n ){
		bit[i] += x;
		i += i & (-i);
	} // end while
}

int sum (int i ){
	
	int s = 0;
	while (i > 0 ){
		s += bit[i];
		i -= i & (-i);
	} // end while

	return s;
}

void init_bit (void ){
	n = 0;
	memset (bit, 0, sizeof (bit ) );
}

int main()
{
	init_bit ();
	int q;
	scanf ("%d %d", &n, &q );

	rep (i, q ){
		int com, x, y; scanf ("%d %d %d", &com, &x, &y );
		if (com == 0 ){
			add (x, y );
		}else{
			int s = sum (y );
			int t = sum (x-1 );
			int res = s - t;
			printf ("%d\n", res );
		} // end if 
	} // end rep
		
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    string s,t;
    cin >> s ;
    t = "";
    char moji[] ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
    for(int i = 0; i < (int)(s.length()); i++){
        t.push_back(moji[(s[i] + n - 65) % 26]);
    }
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<unordered_map>
using namespace std;
int main(){
    int N, M;
    cin >> N >> M;
    long long ans = 0;
    
    vector<vector<int>> work(M);
    
    for(int i = 0;i < N;++i){
        int A, B;
        cin >> A >> B;
        --A;
        if(A < M) work[A].push_back(B);
    }
    
    priority_queue<int> q;
    for(int i = 0;i < M;++i){
        for(int B : work[i]){
            q.push(B);
        }
        if(!q.empty()){
            ans += q.top();
            q.pop();
        }
    }

    cout << ans;
}


Measured memory_bytes: 5504
#include<iostream>

int main(){
  	int n;
  	int sum=0;
  	std::cin >> n;
  	for(int i=1;i<(n+1);i++){
      	int input;
      	std::cin >> input;
      	if((i%2==1) && (input%2==1)){
          	sum++;
        }
    }
  	std::cout << sum << "\n";
  	return 0;
}

Measured memory_bytes: 3152
class dice:
  def __init__(self,dice_number_list):
    self.top,self.front,self.right,self.left,self.rear,self.bottom = dice_number_list
    self.dice_number_list = dice_number_list
    
  def roll(self,op):
    if   op=='N': 
      self.top, self.front, self.bottom, self.rear = \
      self.front, self.bottom, self.rear , self.top
    elif op=='E':
      self.top, self.left , self.bottom, self.right = \
      self.left , self.bottom, self.right, self.top
    elif op=='W': 
      self.top, self.right, self.bottom, self.left = \
      self.right, self.bottom, self.left , self.top
    elif op=='S': 
      self.top, self.rear , self.bottom, self.front = \
      self.rear , self.bottom, self.front, self.top
           
  def print_top(self):
    print(self.top)
  def print_right(self):
    print(self.right)
    
  def get_label(self):
    return([self.top, self.front, self.right, self.left, self.rear, self.bottom])
    
  #全パターン24通りの取得(ソート済み)
  def get_all_number_list(self):
    all_dice_number_list = []
    for op in "NNNNWNNNWNNNENNNENNNWNNN":
      self.roll(op)
      if self.get_label() not in all_dice_number_list:
        all_dice_number_list.append(self.get_label())
    return(sorted(all_dice_number_list))
  
  #2つのサイコロの一致判定
  def judge_equal(self,another):
    if(self.get_all_number_list() == another.get_all_number_list()):
       return True
    else:
       return False
  
n = int(input())
dice_list=[[0,0,0,0,0,0]]*n

for i in range(n):
  dice_list[i] = dice(list(map(int,input().split())))

FLG=True
for i in range(n-1):
  for j in range(i+1,n):
    if dice_list[i].judge_equal(dice_list[j]):
      FLG=False
      break

if FLG == True:
  print("Yes")
else:
  print("No")


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

class UnionFind {
public:
    // parent node index if not root index
    // minus size of the tree if root index
    std::vector<int> data;

    UnionFind( int n ) {
        data.resize( n, -1 );
    }

    int find( int x ) {
        if ( data[x] < 0 ) {
            return x;
        } else {
            int r = find( data[x] );
            data[x] = r;
            return r;
        }
    }

    void unite( int x, int y ) {
        int r = find( x );
        int s = find( y );
        if ( r != s ) {
            data[r] += data[s];
            data[s] = r;
        }
    }

    int count( int x ) {
        return -data[find(x)];
    }
};

template<typename T> int compress(vector<T>& x) {
    int n = x.size();
    vector<T> xs(n);
    for ( int i = 0; i < n; i++ ) xs[i] = x[i];
    sort(xs.begin(), xs.end());
    xs.erase(unique(xs.begin(), xs.end()), xs.end());
    for ( int i = 0; i < n; i++ ) {
        x[i] = lower_bound(xs.begin(), xs.end(), x[i]) - xs.begin();
    }
    return xs.size();
}

int main() {
    int N;
    cin >> N;
    vector<int> X(N), Y(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> X[i] >> Y[i];
        X[i]--, Y[i]--;
    }
    compress(X);
    compress(Y);
    UnionFind uf(2 * N);
    for ( int i = 0; i < N; i++ ) {
        uf.unite(X[i], Y[i] + N);
    }

    map<int, int> nx, ny;
    for ( int i = 0; i < 2 * N; i++ ) {
        int r = uf.find(i);
        int c = uf.count(r);
        if ( c <= 1 ) continue;
        if ( i < N ) {
            nx[r]++;
        } else {
            ny[r]++;
        }
    }

    ll dots = 0;
    for( auto q : nx ) {
        dots += (ll)q.second * ny[q.first];
    }
    ll ans = dots - N;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 2168
/*
 *    author: Tran Minh Khoa
 *    created: 14.05.2019 08:45:02
 *    Ho Chi Minh University of Science
 */

#include <bits/stdc++.h>

using namespace std;

const int N = 1010;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};

int H, W;
int op[N][N];

bool can(int u, int v) {
  return u >= 1 && u <= H && v >= 1 && v <= W; 
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);
  cout.precision(10); 
  cout << fixed;
#ifdef KM777
  freopen("in", "r", stdin);
#endif
  cin >> H >> W;
  
  char s[N][N];

  for (int i = 1; i <= H; i++) {
    cin >> s[i] + 1;
  }
  queue<pair<int, int>> Q;
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      if (s[i][j] == '#') {
        pair<int, int> x = {i, j};
        Q.push(x);
      }
    } 
  }
  while (!Q.empty()) {
    auto x = Q.front();
    Q.pop();
    for (int k = 0; k < 4; k++) {
      int u = x.first + dx[k];
      int v = x.second + dy[k];
      if (!can(u, v)) {
        continue;
      }
      if (s[u][v] == '.') {
        op[u][v] = op[x.first][x.second] + 1;
        s[u][v] = '#';
        pair<int, int> y = {u, v};
        Q.push(y);
      } 
    }
  }
  int result = 0;
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      result = max(result, op[i][j]);
    }
  }
  cout << result << "\n";
  return 0;
}


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

int main() {
    long long int a, b;
    cin >> a >> b;
    if(a%b == 0) {
        cout << -1 << '\n';
        return 0;
    }
    for(long long int i = 1; i < 1000000000; ++i) {
        if(a*i%b != 0) {
            cout << a*i << '\n';
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int n,a[100000];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i]++;
    }
    int cnt[100001]={},ans=1;
    cnt[0]=3;
    for(int i=0;i<n;i++){
        (ans*=cnt[a[i]-1])%=mod;
        cnt[a[i]-1]--;
        cnt[a[i]]++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<iomanip>
#include<math.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
const long long INF = 1LL << 60;

int main(){
    int n;
    cin >> n;
    vector<int> b(n - 1);
    REP(i,n-1){
        cin >> b[i];
    }

    int ans = 0;
    ans += b[0];
    FOR(i,1,n-1){
        ans += min(b[i - 1], b[i]);
    }
    ans += b[n - 2];

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

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	
	class UnionFind{
		int [] par, rank;
		int num;
		public UnionFind(int n) {
			par = new int[n];
			rank = new int[n];
			for(int i = 0 ; i < n; i++){
				par[i] = i;
				//rank[i] = 0;
			}
			num = n;
		}
		int find(int x){
			if(par[x] == x)return x;
			else return par[x] = find(par[x]);
		}
		void unite(int x, int y){
			x = find(x);
			y = find(y);
			if(x == y) return ;
			if(rank[x] < rank[y]) par[x] = y;
			else{
				par[y] = x;
				if(rank[x] == rank[y]) rank[x]++;
			}
			num--;
		}
		boolean same(int x, int y){
			return find(x) == find(y);
		}
	}
	
	private void doit(){
		
		Scanner sc = new Scanner(System.in);
		long mod = 1000000007;
		while(sc.hasNext()){
			int N = 100000 * 2;
			
			int n = sc.nextInt();
			int k = sc.nextInt();
			int m = sc.nextInt();
			UnionFind uf = new UnionFind(n);
			for(int i = 0; i < k; i++){
				
				int a = sc.nextInt() - 1;
				int b = sc.nextInt() - 1;
				uf.unite(a, b);
			}
			UnionFind uf2 = new UnionFind(n);
			for(int j = 0; j < m; j++){
				int a = sc.nextInt() - 1;
				int b = sc.nextInt() - 1;
				uf2.unite(a,b);
			}
			
			TreeMap<Long, Integer> count = new TreeMap<>();
			for(int i=0;i< n;i++){
				long res = (long) uf.find(i) * N + uf2.find(i);
				if(! count.containsKey(res)){
					count.put(res, 1);
				}
				else{
					count.put(res, count.get(res) + 1);
				}
			}
			
			StringBuilder ans = new StringBuilder();
			for(int i =0;i<n;i++){
				int res = count.get((long) uf.find(i) * N + uf2.find(i));
				ans.append(" " + res);
			}
			System.out.println(ans.substring(1));
			
		}
 
	}
 
	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}
 
	public static void main(String[] args) {
		new Main().doit();
	}
 
}

Measured memory_bytes: 97692
package main

import "fmt"

func is_inside(width int, height int, x int, y int, r int) bool {
	return 0 <= x - r && x + r <= width && 0 <= y - r && y + r <= height
}

func main() {
	var width, height, x, y, r int
	fmt.Scanf("%d%d%d%d%d", &width, &height, &x, &y, &r)
	if is_inside(width, height, x, y, r) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}



Measured memory_bytes: 1124
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

x,y = li()

res = x

ans = 0
while res <= y:
    res = 2*res
    ans += 1
    
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int ans = 0;
void find(int a[], int b[][16], int c[][16], int n, int x, bool used[])
{
    if(x == n + 1)
    {
        int sub = 0;
        bool wrong = false;
        for(int i = 1; i <= n; i++)
        {
            if(used[i])
            {
                sub++;
                for(int j = 0; j < a[i]; j++)
                {
                    if(used[b[i][j]] != c[i][j])
                    {
                        wrong = true;
                        return;
                    }
                }
            }
        }
        ans = max(sub, ans);
        return;
    }
    find(a, b, c, n, x + 1, used);
    used[x] = true;
    find(a, b, c, n, x + 1, used);
    used[x] = false;
}
int main()
{
    int n;
    cin >> n;
    int a[16], b[16][16], c[16][16];
    bool used[n + 1];
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
        used[i] = false;
        for(int j = 0; j < a[i]; j++)
        {
            cin >> b[i][j] >> c[i][j];
        }
    }
    find(a, b, c, n, 1, used);
    cout << ans << endl;
    return 0;
}


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

int main(){
  int N;
  int count = 0;
  cin >> N;
    
  vector<string> data(N);
  vector<string> Gdata(N);
  
  for(int i = 0;i < N ;i++){
    cin >> data.at(i);
  }
  
  sort(data.begin(), data.end());
  data.erase(unique(data.begin(), data.end()),data.end());
  
  cout << data.size() << endl;
}

Measured memory_bytes: 15644
/*
g++ -std=c++11 -o2 -Wall ABC113A.cpp -o .\out\ABC113A.out
.\out\ABC113A.out
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  int ans;
  ans = a + b / 2;
  cout << ans << "\n";
}


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

typedef long long int ll;
//Factors of an num
/*
vector<ll> fact(ll n){
	vector<ll>v;
	for(int i=1;i*i<=n;i++){
		if(n%i ==0){
			v.push_back(i);
		
		if(i!=n/i)
			v.push_back(n/i);
	    }
	}

	return v;
}
*/


/*
Seive Of Eratos..
int N=1e5;
vector<bool> isprime(N+1,true);
void pri(int n){
	for(int i=2;i*i<=n;i++){
		if(isprime[i]){
			for(int j=i*i;j<=n;j+=i){
				isprime[j]=false;
			}
		}
	}
	return;
}
*/

/*
//Prime Factors
vector<bool> isprime(1e6+1,true);
 vector<int> primes;
 void sieve()
 {

    ll  i,j;
    isprime[0] = false;
    isprime[1] = false;

    for(i=2; i<=1e6 ;i++)
  {

    if(isprime[i])
    {

      primes.push_back(i);

      for(j=i*i; j<=1e6; j+=i)
      {
        isprime[j]=false;
      }

    }

  }
}

vector<int> primefactors(int  N)

 {

    vector<int> factors;
    ll pf_idx = 0, pf=primes[pf_idx];

    while(pf*pf<=N)
    {
        while(N % pf == 0)
        {
            N/=pf;
            factors.push_back(pf);
        }
        pf = primes[++pf_idx];
    }
    
    if(N != 1) factors.push_back(N);
    return factors;
}
 */   




int main(){
	 
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 int N,X,T;
 cin>>N>>X>>T;
 int t;
 t=(N+X-1)/X;
 int ans=t*T;
 cout<<ans<<endl;
   }




Measured memory_bytes: 3628
#include <stdio.h>
int main(){
  long int a,b,c,ans=0;
  scanf("%ld%ld%ld",&a,&b,&c);
  if(c>=b-1){
    ans=a*(b-1);
    ans/=b;
  }
  else {
  ans=a*c;
  ans/=b;
  }
    
  printf("%ld",ans);
  return 0;
}

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

int main(void) {
    string s;
    cin >> s;
    int i = 0;
    int ans = 0;
    int prev = 0;
    while (i < s.size()) {
        if (prev == 1 && s[i-1] == s[i]) {
            if (i == s.size() - 1) break;
            i += 2;
            prev = 2;
        } else {
            i++;
            prev = 1;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}

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


template <typename T>
struct Knap_Big_Weight{
	T W;
	int N,max_v;
	vector<int> v;
	vector<T> w;
	vector< vector<T> > dp;
	Knap_Big_Weight(int N_, T W_ ,int max_v_){
		W = W_;
		N = N_;
		max_v = max_v_;
		v.resize(N);
		w.resize(N);
		dp = vector< vector<T> >(2,vector<T>(max_v*N+1,W+1));
	}
	int calc(){
		dp[0][0] = dp[1][0] = 0;
		for(int i=1;i<=N;i++){
			for(int j=0;j<=N*max_v;j++){
				int k = i%2;
				int l = 1-k;
				if(j<v[i-1]){
					dp[k][j] = dp[l][j];
				}else{
					dp[k][j] = min(dp[l][j],dp[l][j-v[i-1]]+w[i-1]);
				}
			}
		}
		int k = N%2;
		for(int i=N*max_v;i>=0;i--){
			if(dp[k][i] < W+1){
				return i;
			}
		}
	}
};


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	long long W;
	int N;
	cin >> N >> W;
	Knap_Big_Weight<long long> kbw(N,W,100);
	for(int i=0;i<N;i++){
		cin >> kbw.v[i] >> kbw.w[i];
	}
	cout << kbw.calc() << endl;
}


Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e5 + 5;
const int inf = 1000000000;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338; // double PI = 4*atan(1);



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	//ifstream cin (".in");
	//ofstream cout (".out");
	string s;
    cin >> s;
    string t = "ATCG";
    int ans = 0;
    int now = 0;
    
    for (int i = 0; i < s.size(); i++) {
        bool isATCG = false;
        
        for (int j = 0; j < t.size(); j++) {
            if (s[i] == t[j]) {
                isATCG = true;
            }
        }
        if (!isATCG) {
            now = 0;
            
        } else {
            now++;
            ans = max(now, ans);
        }
    }
    
    cout << ans << endl;
    return 0;
}





Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
using namespace std;
int p[110];

int main(){
  int a,b=0,c=0,i;
  cin>>a;
  for(i=0;i<a;i++){
    cin>>p[i];
  sort(p,p+a);
  reverse(p,p+a);
  }
  for(i=0;i<a;i+=2){
    b+=p[i];
   }
  for(i=1;i<a;i+=2){
    c+=p[i];
  }
  cout<<b-c<<endl;
}


Measured memory_bytes: 256