akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

#define mod 1e9+7
#define ll long long int
#define epsilon 1e-7

ll ma(ll x, ll y){
    if(x>y)return x;
    return y;
}

char ap[2000][2001];
int hh[2000][2000];
int ww[2000][2000];
int main(void){
    int h, w;
    scanf("%d %d", &h, &w);
    for(int i = 0;i < h;i++){
        scanf("%s", &ap[i]);
    }
    /*for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            printf("%c", ap[i][j]);
        }
        printf("\n");
    }*/
    for(int i = 0;i < h;i++){
        int count = 0;
        for(int j = 0;j < w;j++){
            if(ap[i][j] == '.')count++;
            else{
                for(int k = j - count;k < j;k++){
                    ww[i][k] = count;
                }
                count = 0;
                ww[i][j] = 0;
            }
        }
        if(count != 0){
            for(int k = w - count;k < w;k++){
                ww[i][k] = count;
            }
        }
    }
    for(int j = 0;j < w;j++){
        int count = 0;
        for(int i = 0;i < h;i++){
            if(ap[i][j] == '.')count++;
            else{
                for(int k = i - count;k < i;k++){
                    hh[k][j] = count;
                }
                count = 0;
                hh[i][j] = 0;
            }
        }
        if(count != 0){
            for(int k = h - count;k < h;k++){
                hh[k][j] = count;
            }
        }
    }
    int ans = 0;
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            ans = ma(ans, hh[i][j]+ww[i][j]-1);
        }
    }
    /*for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            printf("%4d ", hh[i][j]+ww[i][j]);
        }
        printf("\n");
    }*/
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s1,s2,s3;
    cin>>s1>>s2>>s3;

    printf("%c%c%c\n",
        s1[0]-('a'-'A'),
        s2[0]-('a'-'A'),
        s3[0]-('a'-'A'));

   return 0;
}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int ans = 0;
  for(int i = 1; i <= N; i += 2) {
    int yaku = 0;
    for(int j = 1; j <= i; j++) {
      if(i % j == 0) yaku++;
    }
    if(yaku == 8) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int k,x;
  cin>>k>>x;
  for (int i=x-k+1; i<=x+k-1; i++) {
    cout<<i;
    if (i==x+k-1) cout<<endl;
    else cout<<' ';
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B, C;
	cin >> A >> B >> C;
	cout << (A-B+1) * (A-C+1) << endl;
}

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

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

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

  int min_sum=20000;

  for(int I=0;I<=p[0];I++){
    int q[5000];
    for(int j=0;j<N;j++){
      q[j]=p[j];
    }

    int sum=I;
    q[0] -= I;

    for(int i=0;i<=N-2;i++){
      if(q[i]<=0)
        continue;

      sum +=q[i]*2;
      q[i+1]-=q[i];
    }

    if(q[N-1]>0){
      sum += q[N-1];
    }

    min_sum = min(min_sum,sum);
  }

  cout << min_sum << endl;

  return 0;
}



Measured memory_bytes: 3128
//code by 27.
#include<stdio.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath>
#include<memory.h>
#include<sstream>
#include<time.h>
using namespace std;
const int BIG=100000000;
int main()
{
	string st;
	cin>>st;
	if(st.size()<4)
	{
		cout<<"No";
		return 0;
	}
	if(st[0]!='Y')
	{
		cout<<"No";
		return 0;
	}
	if(st[1]!='A')
	{
		cout<<"No";
		return 0;
	}
	if(st[2]!='K')
	{
		cout<<"No";
		return 0;
	}
	if(st[3]!='I')
	{
		cout<<"No";
		return 0;
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
/*
  AOJ 1215
  Title:Co-occurrence Search
  @kankichi573
*/
#include <stdio.h>
#include <string.h>
#include <limits.h>
#define max(x,y) (((x)>(y))?(x):(y))
char S[1000001], K[51], input[74];
int  pos[50];
int max_,min_,min_span,min_min,min_max,Klen,min_char_pos,count;

int my_strchr(char *s,char c,int start)
{
  char *ret;

  ret=strchr(s+start+1,c);
  if(ret)
    return(ret-s);
  else
    return(-1);
}
void search(int *min_,int *max_,int *min_char_pos)
{
  int i;

  *min_=INT_MAX;
  *max_=0;
  for(i=0;i<Klen;i++)
    {
      if(*min_ > pos[i])
	{
	  *min_=pos[i];
	  *min_char_pos =i;
	}
      *max_=max(*max_,pos[i]);
    }
}
void dump()
{
  int i;

  for(i=0;i<Klen;i++)
    printf("%c:[%d]",K[i],pos[i]);
  printf("min=%d max=%d min_char=%c\n",min_,max_,K[min_char_pos]);
}
void solve()
{
  char i,c;

  for(i=0;i<Klen;i++)
    {
      c=K[i];
      pos[i]=my_strchr(S,c,-1);
      if(pos[i]==-1)
	{
	  count=0;
	  return;
	}
      search(&min_,&max_,&min_char_pos);
      min_span = max_ - min_;
      min_min  = min_;
      min_max  = max_;
      count=1;
    }
#ifdef DEBUG
  dump();
#endif  
  while(-1!=(pos[min_char_pos]=my_strchr(S,K[min_char_pos],min_)))
    {
      search(&min_,&max_,&min_char_pos);
#ifdef DEBUG
      dump();
#endif
      if(min_span>(max_-min_))
	{
	  min_span=(max_-min_);
	  min_min = min_;
	  min_max = max_;
	  count=1;
	}
      else if(min_span==(max_-min_))
	count++;
#ifdef DEBUG
      printf("min_span=%d %d %d:%d\n",min_span,min_,max_,count);
#endif
    }
  

}
void write_result(int empty_line_flag)
{
  int i;
  if(empty_line_flag > 0)
    printf("\n");


  if(count)
    {
      printf("%d\n",count);
      for(i=min_min;i<=min_max;i++)
	{
	  if(((i - min_min)%72)==0)
	    printf("\n");
	  printf("%c",S[i]);
	}
      printf("\n");
    }
  else
    printf("0\n");
}
main()
{
  int ret,q_count;

  q_count=0;
  while(1)
    {
      S[0]='\0';
      while(1)
	{
	  if(NULL==fgets(input,74,stdin))
	    goto END;
	  //printf(":%s",input);
	  if(input[0]<' ')
	    break;
	  if(input[strlen(input)-1] < ' ')
	    input[strlen(input)-1]='\0';
	  strcat(S,input);
	}
      scanf("%s\n",K);
      //printf("::%s",K);
      Klen=strlen(K);
      
      solve();
      write_result(q_count);
      
      q_count++;
    }
 END:
  printf("\n");
  return(0);
}

Measured memory_bytes: 1032
#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 ll       long long int
#define fast     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define MOD      1000000007
#define pb       push_back
#define S        second
#define F        first
#define P 		 pair<ll,ll>
#define PI       3.1415926535897932384626433832795028
//#define ordered_set tree<ll, null_type,less_equal<>, rb_tree_tag,tree_order_statistics_node_update>


ll dp[3001][3001][2];

ll solve(vector<ll>& a, ll n, ll k)
{
	ll dp[n + 2][k + 2];

	for (ll j = 0; j <= k; j++)
		dp[1][j] = (j > a[1]) ? 0 : 1;

	for (ll i = 2; i <= n; i ++)
	{
		for (ll j = 0; j <= k; j++)
		{
			if (j == 0)
				dp[i][j] = dp[i - 1][j];
			else dp[i][j] = (MOD + dp[i][j - 1] + dp[i - 1][j] - ((j - a[i] - 1 >= 0) ? dp[i - 1][j - a[i] - 1] : 0)) % MOD;
		}
	}
	return dp[n][k];
}


int32_t main()
{	fast

// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif

	ll n, k;
	cin >> n >> k;
	vector<ll> a(n + 1);
	for (ll i = 1; i <= n; i++)
		cin >> a[i];
	cout << solve(a, n, k) << endl;
	return 0;

}




Measured memory_bytes: 78336
#include<stdio.h>
int main(){
    char a[]={"Sunny"},b[]={"Cloudy"},c[]={"Rainy"};
    char x[10];
    gets(x);
    if(x[0]=='S')printf("%s\n",b);
    if(x[0]=='C')printf("%s\n",c);
    if(x[0]=='R')printf("%s\n",a);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main() {
    ll n;
    cin>>n;
    cout<<n<<":";
    while(n%2==0)
    {
        n=n/2;
        cout<<" "<<2;
    }
    for(int i=3;i*i<=n;i=i+2)
    {
        while(n%i==0)
        {
            cout<<" "<<i;
            n=n/i;
        }

    }
    if(n>2)
    {
        cout<<" "<<n;
    }
    cout<<endl;
}


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

#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << "["<< *it << " = " << a << "]"<< endl;
    err(++it, args...);
}
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    bool prime = false;
    while (!prime) {
        prime = true;
        for (int i = 2; i*i <= n; i++ ) {
            if (n % i == 0) {
                prime = false;
                break;
            }
        }
        if (prime) {
            break;
        }
        n++;
    }
    cout << n;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    int A, B, m; cin >> A >> B>>m;
    // vector<int> a, b;
    int a[100100], b[100100];
    int amin=1e5+10;
    for(int i=1; i<=A; i++){
        int t; cin>>t;
        a[i] = t;
        amin = min(t, amin);
    }
    int bmin=1e5+10;
    for(int i=1; i<=B; i++){
        int t; cin >> t;
        b[i] = t;
        bmin = min(bmin, t);
    }
    ll ans = amin+bmin;
    rep(i,m){
        ll x, y, c; cin>>x>>y>>c;
        ans = min(ans, a[x]+b[y]-c);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define int long long
using namespace std;
typedef long long ll;
ll k,x,a,b,c,n;
signed main()
{

    //ios_base::sync_with_stdio(0),cin.tie(0);
    while(cin>>n)
    {
        vector<string> vs;
        rep(i,n)
        {
            string s;
            cin>>s;
            sort(s.begin(),s.end());
            vs.pb(s);
        }
        ll sum=0;
        map<string,ll> m;
        for(auto i:vs)
        {
            sum+=m[i];
            m[i]++;
        }
        cout<<sum<<"\n";
    }

    return 0;
}


Measured memory_bytes: 12020
#include <bits/stdc++.h>
#define boost ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define M 1000000007
#define eb emplace_back
#define watch(x) cout << (#x) <<" is "<< x <<"\n";


using namespace std;
//const int N = 1e6;

int maxpro(int A[], int n, int k) 
{ 
    int prod = 1; 
    if (A[n - 1] == 0 && (k & 1)) 
        return 0; 

    if (A[n - 1] <= 0 && (k & 1)) 
    { 
        for (int i = n - 1; i >= n - k; i--) 
        {
            prod *= A[i]; 
            prod %= M;
            prod = (prod + M)%M;
        }
        return prod; 
    } 

    int i = 0; 
  
    int j = n - 1; 
    if (k & 1) { 
        prod *= A[j]; 
        prod %= M;
        prod = (prod + M)%M;
        j--; 
        k--; 
    } 

    k >>= 1; 
    for (int itr = 0; itr < k; itr++) { 
  
        int left_prod = (A[i] * A[i + 1]); 
        int right_prod = (A[j] * A[j - 1]); 
        if (left_prod > right_prod) { 
            prod *= (left_prod%M); 
            prod %= M;
            prod = (prod + M)%M;
            i += 2; 
        } 
        else { 
            prod *= (right_prod%M); 
            prod %= M;
            prod = (prod + M)%M;
            j -= 2; 
        } 
    } 
  
    return prod; 
} 

int32_t main(){
  boost;
  int tc = 1; //cin >> tc;
  while(tc--)
  {
    int n, k; cin >> n >> k;
    int arr[n];
    for(int i=0; i<n; i++)
      cin >> arr[i];
    sort(arr, arr+n);
    int ans = maxpro(arr, n, k);
    cout << ans%M <<"\n";
  }
}



Measured memory_bytes: 5176
#D
from collections import deque
k = int(input())

lunlun = [[1,2,3,4,5,6,7,8,9]]

for _ in range(9):
    tmp = []
    
    for i in lunlun[-1]:
        if i % 10 != 0:
            tmp.append(i*10 + (i%10 - 1))
        
        tmp.append(i*10 + (i%10))
        
        if i % 10 != 9:
            tmp.append(i*10 + (i%10 + 1))
        
    lunlun.append(tmp)



q = deque()
for i in range(len(lunlun)):
    for j in lunlun[i]:
        q.append(j)
        
print(q[k-1])

Measured memory_bytes: 13836
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/

	coding: utf-8
	lang: C++ (GCC 9.2.1)
*/

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

// utility of stdin,stdout
#define _CRT_SECURE_NO_WARNINGS
#define OUT cout << 
#define BR << endl
#define RET return 0
#define TLong long long
#define TBMod int(1e9+7)

// fact(n)
template <typename T>
T fact(T n){
	if(n == 1)	return 1;
	else return (n * fact(n - 1));
}

// nCr(n, r)
template <typename T>
T nCr(T n, T r){
	if(r == 0 || r == n)	return 1;
	else if(r == 1)	return n;
	return (nCr(n - 1, r - 1) + nCr(n - 1, r));
}

// swap(&a, &b);
template <typename T>
void swap(T *a, T *b){
	T tmp;
	tmp = *a;	*a = *b;	*b = tmp;
	return;
}

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

// lcm(a, b)
template <typename T>
T lcm(T a,T b){
	return a / gcd(a,b) * b;
}

// divisor(type n)
template <typename T>
vector<T> divisor(T n)
{
  vector<T> ret;
  for(T i = 1; i * i <= n; i++)
	{
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

// eratosthenes(type n)
template <typename T>
vector<T> eratosthenes(T n){
	vector<bool> is_prime(n + 2, true);
	vector<T> primes;

	for (T i = 2; i <= n; i++)
	{
		if(is_prime[i]){
			for (T j = 2 * i; j <= n; j += i)	is_prime[j] = false;
			primes.push_back(i);
		}
	}
	return primes;
}

// vector scanner
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
	for(T& x : vec)	is >> x;
	return is;
}

int main(int argc, char const *argv[])
{
	// DON'T CHANGE
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	
	// here
	int n;
	cin >> n;
	OUT(n == 0 ? 1 : 0) BR;
	RET;
}


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

#define nl '\n'

using namespace std;

typedef long long ll;

struct UnionFind {
  vector<int> group, size;
  int components;

  UnionFind(int N) {
    components = N;
    group = size = vector<int>(N + 1);
    for (int i = 1; i <= N; i++)
      group[i] = i, size[i] = 1;
  };

  void unite(int a, int b) {
    if (find(a) == find(b))
      return;
    size[find(a)] += size[find(b)];
    size[find(b)] = 0;  // just to make sure i ignore this later on
    group[find(b)] = find(a);
    components--;
  }

  int find(int a) {
    if (group[a] != a)
      group[a] = find(group[a]);
    return group[a];
  }
};

void solve() {
  int N, M;
  cin >> N >> M;

  UnionFind friends(N);
  while (M--) {
    int A, B;
    cin >> A >> B;
    friends.unite(A, B);
  }
  vector<int> sizes;
  for (int size: friends.size) if (size) sizes.push_back(size);
  assert(sizes.size() == friends.components);
  sort(sizes.begin(), sizes.end());
  int ans = 0;
  for (int i = 0, taken = 0; i < sizes.size(); i++) {
    ans += sizes[i] - taken;
    taken = sizes[i];
  }

  cout << ans;
}

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

  // int t;
  // cin >> t;
  // while (t--) {
  solve();
  // cout << nl;
  // }

  return 0;
}

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

int main() {
    int n, x = 0, y = 0, t = 0;
    
    cin >> n;

    for (int i = 0; i < n; i++) {
        int xn, yn, tn;

        cin >> tn >> xn >> yn;

        int a = (tn -t) - (xn -x) - (yn - y);
        
        if ( a < 0 ) {
            cout << "No" << endl;
            return 0;
        }

        if ( a % 2 != 0 )  {
            cout << "No" << endl;
            return 0;
        }

        x = xn;
        y = yn;
        t = tn;
    }

    cout << "Yes" << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<ll> v[4];
ll n,W,y,x,ans;

void dfs(ll w,ll c,ll d){
  if(d==4){
    if(W>=w) ans = max(ans,c);
    return ;
  }
  dfs(w,c,d+1);
  ll sum=0;
  for(int i=0;i<v[d].size();i++){
    sum+=v[d][i];
    dfs(w+(x+d)*(i+1),c+sum,d+1);
  }
}

int main(){
  cin>>n>>W>>x>>y;
  v[0].push_back(y);
  for(int i=0;i<n-1;i++){
    int p,q;
    cin>>p>>q;
    v[p-x].push_back(q);
  }
  for(int i=0;i<4;i++)
    sort(v[i].begin(),v[i].end(),greater<int>());
  dfs(0,0,0);

  cout<<ans<<endl;
}


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

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

	int N; cin >> N;
	long a[110000], b[110000];
	for (int i = 0; i <= N; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> b[i];
	}
	long sum = 0;
	for (int i = 0; i < N; i++) {
		if (b[i] > a[i]) {
			b[i] -= a[i];
			sum += a[i];
		}
		else {
			sum += b[i];
			continue;
		}

		if (b[i] > a[i+1]) {
			sum += a[i + 1];
			a[i + 1] = 0;
		}
		else {
			sum += b[i];
			a[i + 1] -= b[i];
		}
	}
	cout << sum;
}

Measured memory_bytes: 1792
let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let ds = Array.init n @@ fun i -> Scanf.scanf " %d" @@ fun b -> a_s.(i) - b
let sl, nl = Array.fold_left (fun (s, n) d -> if d < 0 then s + abs d, n + 1 else s, n) (0, 0) ds
let s = ref 0
let _ = if sl = 0 then print_endline "0" else Array.(sort (fun x y -> y - x) ds; iteri (fun i d -> if d > 0 then (s := !s + d; if !s >= sl then (Printf.printf "%d\n" @@ nl + i + 1; exit 0)) else (print_endline "-1"; exit 0)) ds)

Measured memory_bytes: 6016
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define inf 1000000000
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define yoi cout<<"yo"<<endl;
#define debug(i) cout<<i<<endl;
const int mod=1e9 +7;
int main(){
IOS;
lli n,i;
cin>>n;
lli a[n];
for(i=0;i<n;i++){
    cin>>a[i];
}
lli val[n];
val[0]=0;
for(i=0;i<n;i++){
    if(i%2==0)
        val[0]+=a[i];
    else val[0]-=a[i];
}
val[0]/=2;
for(i=0;i<n-1;i++){
    val[i+1]=a[i]-val[i];
}
for(i=0;i<n;i++){
    cout<<2*val[i]<<" ";
}
cout<<endl;
}


Measured memory_bytes: 2944
#include <stdio.h>

int main(void) {
	int a,b;
	while(1){
		scanf("%d%d",&a,&b);
		if(a>=b){if(a==0&&b==0){break;}
		else{printf("%d %d\n",b,a);}}
			else{
			printf("%d %d\n",a,b);}
			}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>

using namespace std;

int main(void){
	while( 1 ){
		int fives = 0;
		int n;

		cin >> n;
		if( n == 0 ) break;

		for(int i = n; i >= 1; i--){
			int t = i;
			while( 1 ){
				if( t > 0 && t % 5 == 0 ){
					t /= 5;
					fives++;
				}else break;
			}
		}
		cout << fives << endl;
	}
	return 0;
}

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

long long gcd(long long a,long long b){long long r,tmp;if(a < b){tmp = a;a = b;b = tmp;}r = a % b;while(r != 0){a = b;b = r;r = a % b;}return b;}

long long prime_factorization(long long a, set<long long> &prime_factor)
{
    long long i,sq;
    if(a % 2 == 0){ //偶数の場合
        prime_factor.insert(2);
        return prime_factorization(a / 2, prime_factor); //2で割った値で再帰
    }
    sq = sqrt(a);
    for(i = 3; i <= sq;i += 2){ //3以上√a以下の奇数の場合
        if(a % i==0){
            prime_factor.insert(i);
            return prime_factorization(a / i, prime_factor); //割れた値で再帰
        }
    }
    //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
    if(a!=1){ //aが1でないなら、a自身は素数
        prime_factor.insert(a);
    }
    return 0;
    
}

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

    long long divisor = gcd(a, b);

    set<long long> prime_factor;
    long long ans = 1;

    prime_factorization(divisor, prime_factor);

    cout << prime_factor.size() + 1 << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
inp = sys.stdin.buffer.readline
def inpS(): return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines 

def check(n):
  x = str(n)
  if len(x) != N:
    return False
  for s, c in SC:
    if x[s-1] != str(c):
      return False
  return True
  
N, M = map(int, inp().split())
SC = [tuple(map(int, inp().split())) for _ in range(M)]

for i in range(1001):
  if check(i):
    print(i)
    exit()
print(-1)    
      

Measured memory_bytes: 3064
#include<cstdio>
const long long mod = 1e9+7;
long long f[4005], invf[4005];

long long power(long long a,long long b){ 
    long long res = 1;
    while(b!=0){
        if(b%2) res = res*a%mod;
        a = a*a%mod;
        b /= 2;
    }
    return res;
}

long long inv(long long u){ return power(u,mod-2); }

void preWork(int n){
    f[0] = 1;
    for(int i = 1; i <= n; i++) f[i] = f[i-1]*(long long)i%mod;
    invf[n] = inv(f[n]);
    for(int i = n-1; i >= 0; i--) invf[i] = invf[i+1]*(long long)(i+1ll)%mod;
}

long long comb(int n,int m){
    if(m>n || m<0) return 0;
    else return f[n]*invf[n-m]%mod*invf[m]%mod;
}

long long getWay(int x,int y){
    if(x==0 && y==0) return 1;
    else return comb(x+y-1,y-1);
}

int main(){
    preWork(4000);
    int n;
    scanf("%d",&n);
    long long ans = 0;
    for(int i = 1; i*3 <= n; i++){
        int left = n-3*i;
        long long add = getWay(left,i);
        ans = (ans+add)%mod;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T, class U>T rem(T a, U b) { return a - b*floor(a/b); }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vll X(N);
        rep(i, 0, N) cin >> X[i];
        vll cop(X);
        sort(all(cop));

        ll leftpos = N/2-1;
        ll rightpos = N/2;
        ll left = cop[leftpos];
        ll right = cop[rightpos];

        //cout << leftpos << ' ' << rightpos << endl;

        rep(i, 0, N) {
                ll pos = lower_bound(all(cop), X[i]) - cop.begin();
                if (pos <= leftpos) {
                        cout << right << endl;
                } else {
                        cout << left << endl;
                }
        }
}

Measured memory_bytes: 5376
#include <stdio.h>
#include <limits.h>

#define DISH_NUM (5) 

int main (void) {
    int i, ans = 0, temp, min_rem = INT_MAX, rem;
    int dish[DISH_NUM];
    scanf("%d%d%d%d%d", &dish[0], &dish[1], &dish[2], &dish[3], &dish[4]);

    for (i=0; i<DISH_NUM; i++) {
        rem = dish[i] % 10;
        /* 10 で割ったときの余りが 0 ならそのまま足す */
        if ( rem == 0 ) {
            ans += dish[i];
            continue;
        }
        /* 最小の余りを記録する */
        if ( rem < min_rem ) {
            min_rem = rem;
        }
        /* dish[i] の待ち時間を 1 の位で切り上げて ans に足す */
        temp = dish[i] / 10;
        ans += temp * 10 + 10;
    }
    /* 最小の余りのものを最後に頼むのが最短なので帳尻を合わせる */
    if ( min_rem != INT_MAX ) {
        ans -= (10 - min_rem);
    }

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


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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 () {
  int n;
  cin >> n;
  vi a(n);
  vvi x(n), y(n);
  rep(i,n) {
    cin >> a[i];
    x[i] = vi(a[i]);
    y[i] = vi(a[i]);
    rep(j,a[i]) {
      cin >> x[i][j] >> y[i][j];
      x[i][j]--, y[i][j];
    }
  }

  int ans = 0;
  rep(b,1<<n) {
    bool ok = true;
    rep(i,n) {
      if (!bit(b,i)) continue;
      rep(j,a[i]) {
        if (bit(b,x[i][j])^y[i][j]) {
          ok = false;
          break;
        }
      }
      if (!ok) break;
    }
    if (ok) ans = max(ans, pcnt(b));
  }

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
using namespace std;
typedef struct {
    int nums[6];
    int *top, *bottom, *forward, *back, *left, *right;
} dice;
void init_dice(dice *d) {
    d->top = d->nums;
    d->forward = d->top + 1;
    d->right = d->forward + 1;
    d->left = d->right + 1;
    d->back = d->left + 1;
    d->bottom = d->back + 1;
}
void rotate_horizontal(dice *d) {
    int *tmp = d->forward;
    d->forward = d->right;
    d->right = d->back;
    d->back = d->left;
    d->left = tmp;
}
void rotate_vertical(dice *d) {
    int *tmp = d->top;
    d->top = d->forward;
    d->forward = d->bottom;
    d->bottom = d->back;
    d->back = tmp;
}
void set_top(dice *d, int top) {
    if (*(d->top) == top) {
        return;
    } else if (*(d->bottom) == top) {
        rotate_vertical(d);
        rotate_vertical(d);
    } else {
        while (*(d->forward) != top) {
            rotate_horizontal(d);
        }
        rotate_vertical(d);
    }
}
void set_forward(dice *d, int forward) {
    while (*(d->forward) != forward) {
        rotate_horizontal(d);
    }
}
int main(void){
    dice *d = (dice *)malloc(sizeof(dice));
    for (int i = 0; i < 6; i++) {
        cin >> d->nums[i];
    }
    init_dice(d);
    int loop;
    cin >> loop;
    for (int i = 0; i < loop; i++) {
        int top, forward;
        cin >> top >> forward;
        set_top(d, top);
        set_forward(d, forward);
        cout << *(d->right) << endl;
    }
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int d, g;
    cin >> d >> g;
    vector<vector<int>> v;
    REP(i,d) {
        // 0-p 1-c 2-pointsum 3-2+c  
        vector<int> p(4);
        cin >> p[0] >> p[1];
        p[2] = p[0] * (i+1) * 100;
        p[3] = p[2] + p[1];
        v.push_back(p);
    }
    int ans = 1e5;
    // 0-pbit 1-pcount 2-pointsum 3--pnumcount
    vector<vector<int>> v2;
    REP(i,1 << d) {
        bitset<10> bs(i);
        bool b = false;
        for(auto x:v2) {
            if ((x[0] | i) == x[0]) b = true;
        }
        if (b) continue;

        vector<int> p(3+d);
        p[0] = i;
        REP(j,d) {
            if (bs[j]) {
                p[1] += v[j][0];
                p[2] += v[j][3];
                p[3+j] = v[j][0];
            }
        }
        if (p[2] >= g) {
            v2.push_back(p);
            ans = min(ans,p[1]);
        }
    }

    for(auto x:v2) {
        REP(i,d) {
            if (x[3+i] == 0) continue;
            int psum = x[2] - v[i][1] - (i+1) * 100;
            int pcount = x[1] - 1;
            int picount = x[3+i]-1;
            if (psum < g) continue;
            while(psum >= g) {
                ans = min(ans,pcount);
                if (picount == 0) break;
                picount--;
                pcount--;
                psum -= (i+1) * 100;
            }
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

int main(){
	int n,w;

	while(~scanf("%d %d",&n,&w)){
		if(n==0) break;

		map<int,int> freq;
		int last = 0;
		freq[0] = 0;
		for(int i=0;i<n;i++){
			int v;
			scanf("%d",&v);
			
			for(int i=0,j=0;i<=100;i+=w,j++){
				if(i <= v && v < i + w){
					freq[j]++;
					last = max(j,last);
					break;
				}
			}
		}


		int maxv = 0;
		int num = 0;
		for(int i=0,j=0;i<=100;i+=w,j++){
			if(maxv < freq[j]){
				maxv = freq[j];
				num = freq[j];
			}
		}

		double used = 0.0;
		int idx = 0;
		for(double h = 1.0; h>=0-EPS; h-=1.0/last){
			used += h * freq[idx]/num;
			idx++;
		}

		used += 0.01;

		printf("%lf\n",used);
	}
}

Measured memory_bytes: 1224
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    var (rectangle, diamond) = Pair(0, 0)
    while (sc.hasNext()) {
        val (a, b, c) = sc.next().split(",").map { Integer.parseInt(it) }
        if (a*a+b*b==c*c) rectangle++
        if (a==b) diamond++
    }
    println(rectangle)
    println(diamond)
}


Measured memory_bytes: 33368
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
using namespace std;
const int INF=(int)0x3f3f3f3f;
const int MOD=(int)1e9+7;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a,b;
    cin>>a>>b;
    cout<<(a<b?0:10);
    return 0;
}



Measured memory_bytes: 3500
#include<iostream>
#include<queue>
#include<stack>
#include<numeric>
#include<cstring>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<unordered_set>
#include<climits>
#include<cmath>

using namespace std;
#define ll long long
#define pp pair<int,int>
#define ppl pair<ll,ll> 

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int n;
	cin>>n;

	int*arr=new int[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];

	if(n==1)
		cout<<"0\n";

	else
	{
		vector<int> dp(n,0);
		dp[1]=abs(arr[1]-arr[0]);

		for(int i=2;i<n;i++)
			dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));

		cout<<dp[n-1]<<'\n';
	}

	return 0;
}

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

n,m = map(int, input().split())

a = []
b = []

for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())   


#上段が一致している箇所を探索
upperMatched = []

b0 = b[0]
for i in range(n-m+1):
    for j in range(n-m+1):
        #print("-----")
        #print("i:",i,"j:",j)
        #print("a[j][i:i+m]:", a[j][i:i+m])
        if b0 == a[j][i:i+m]:
            #print("--upper found--")
            #print("i:",i,"j:",j)
            upperMatched.append([i,j])
            #print("---------------")
#print(upperMatched)

#一か所も一致がなければ
if len(upperMatched) == 0:
    print("No")
    exit()

#print("--------------")
#そうでなければ、上段以降が一致しているか確認
for uM in upperMatched:
    isMatched = True
    i = uM[0]
    j = uM[1]

    for r in range(1, m):
        #print("b[r]:",b[r])
        #print("a[i+r][j:j+m]:",a[i+r][j:j+m])
        if b[r] == a[i+r][j:j+m]:
            pass
        else:
            isMatched = False
    if isMatched:
        print("Yes")
        exit()
    else:
        pass

print("No")


Measured memory_bytes: 3064
Sa = input()
Sb = input()
Sc = input()
pl = 0
while(True):
  if len(Sa)==0 and pl==0:
    print("A")
    break
  elif len(Sb)==0 and pl==1:
    print("B")
    break
  elif len(Sc)==0 and pl==2:
    print("C")
    break
  if pl == 0:
    s = Sa[0]
    if s == "a":
      pl = 0
    elif s == "b":
      pl = 1
    else:
      pl = 2
    Sa = Sa[1:]
  elif pl == 1:
    s = Sb[0]
    if s == "a":
      pl = 0
    elif s == "b":
      pl = 1
    else:
      pl = 2
    Sb = Sb[1:]
  else:
    s = Sc[0]
    if s == "a":
      pl = 0
    elif s == "b":
      pl = 1
    else:
      pl = 2
    Sc = Sc[1:]

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n,h,w;cin>>n>>h>>w;
  int ans=0;
  for(int i=0;i<n;i++){
    int a,b;cin>>a>>b;
    if(a>=h&&b>=w)ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>
#include<bitset>
#include<stack>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll, ll> lltpl;



/******************************************************************************************/


const int IINF = 1e9 + 7;
const ll LINF = 1e18 + 7;
const ll MOD = 1e9 + 7;



template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}

//グラフの隣接リスト
vector<int> g[1010];
int n, m;

vector<int> bfs(int now) {

	vector<int> dist(n, IINF), prev(n, -1);
	queue<int> que;
	dist[now] = 0;

	que.push(now);
	while (!que.empty()) {

		int v = que.front();
		que.pop();
		for (int nxt : g[v]) {
			if (dist[nxt] != IINF) {
				continue;
			}
			prev[nxt] = v;
			dist[nxt] = dist[v] + 1;
			que.push(nxt);
		}
	}

	pii best(IINF, -1);

	for (int i = 0; i < n; i++)
	{
		if (i == now) {
			continue;
		}
		for (int nxt : g[i]) {
			if (nxt == now) {
				best = min(best, pii(dist[i], i));
			}
		}
	}

	if (best.first == IINF) {
	
		return vector<int>(n + 10);
	}
	int to = best.second;
	vector<int> res;
	while (to != -1) {
		res.push_back(to);
		to = prev[to];
	}

	return res;
}


int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		int s, t;
		cin >> s >> t;
		s--;
		t--;
		//頂点sから頂点tへの有向辺
		g[s].push_back(t);
	}
	

	vector<int> ans(n + 10);
	for (int i = 0; i < n; i++)
	{
		vector<int> now = bfs(i);
		if (now.size() < ans.size()) {
			ans = now;
		}
	}

	if (ans.size() == n + 10) {
		cout << "-1" << endl;
	}
	else
	{
		cout << ans.size() << endl;
		for (int v : ans) {
			cout << v + 1 << endl;
		}
	}
	
}



Measured memory_bytes: 512
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<int,int>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
int n,m;
cin>>n>>m;
V<P> d(n),c(m);
for(int i=0;i<n;i++)cin>>d[i].fi>>d[i].se;
for(int i=0;i<m;i++)cin>>c[i].fi>>c[i].se;
for(int i=0;i<n;i++){
int res=INT_MAX,p;
for(int j=0;j<m;j++){
    if(chmin(res,abs(d[i].fi-c[j].fi)+abs(d[i].se-c[j].se)))p=j+1;
}
cout<<p<<endl;
}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	int k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	int sum=0;
	for(int i=0;i<k;i++)
	{
		sum+=a[i];
	}
	cout<<sum;
}

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

int main(){
	int W,H,x,y,r;
	cin>>W>>H>>x>>y>>r;
	if(x-r<0||x+r>W)cout<<"No"<<endl;
	else if(y-r<0||y+r>H)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 3100
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<iterator>
#include<string>
#include<sstream>
#include <unordered_map>
#include<cmath>
using namespace std;
#define ll long long

int a[110];
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    int t; t=1;
    while(t--){
       int x,n; cin>>x>>n;
       for(int i=1;i<=n;++i){
           int p; cin>>p; a[p]=1;
       }
       int mi=1000,pos=0;
       for(int i=0;i<110;++i){
           if(!a[i]&&abs(i-x)<mi){
               mi=abs(i-x); pos=i;
           }
       }
       cout<<pos<<"\n";
    }    
}

Measured memory_bytes: 3652
use proconio::input;
use proconio::marker::Usize1;

fn main() {
    input! {
        d: usize,
        c: [i32;26],
        s: [[i32;26]; d],
        t: [Usize1; d],
    }

    let mut last = vec![0 as usize; 26];
    let mut score = 0;

    for i in 0..d {
        score += s[i][t[i]];
        last[t[i]] = i + 1;
        for j in 0..26 {
            score -= (c[j] * ((i + 1 - last[j]) as i32));
        }
        println!("{}", score)
    }
}


Measured memory_bytes: 2196
#include<bits/stdc++.h>
using namespace std;
#define fo(a,b) for(int a=0;a<b;a++)
#define V vector
signed main(){
  int n,m;
  cin>>n>>m;
  V<int> a(n+1);
  fo(i,m){
    int b,c;
    cin>>b>>c;
    if(b==1)a[c]++;
    if(c==n)a[b]+=10;
  }
  for(int i=1; i<=n; i++){
    if(a[i]==11){
      cout<<"POSSIBLE"<<endl;
      return 0;
    }
  }
  cout<<"IMPOSSIBLE"<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
typedef pair<int,int> pint;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=1e9+10;

int N;
int a[101000];
map<int,int>mp;

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

	return 0;
}


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

int main() {
  
  int X, Y; cin >> X >> Y;
  
  for (int i = 0; i <= X; i++) {
    
    int crane = i, turtle = X - i;
    
    int sum = crane * 2 + turtle * 4;
    
    if (sum == Y) { cout << "Yes" << endl; return 0; }
    
  }
  
  cout << "No" << endl;
  
}

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

#define INF 1e9
using namespace std;

int main() {

    long long N; cin >> N;

    vector<long long> t(5);
    for (int i = 0; i < 5; ++i) {
        cin >> t[i];
    }

    long long t_min = 0;
    t_min = *min_element(t.begin(), t.end());

    long long ans = 0;

    if (N <= t_min) {
        ans = 5;
    } else {
        if (N % t_min == 0) {
            ans = N / t_min + 4;
        } else {
            ans = N / t_min + 5;
        }
     }

    cout << ans << endl;
}

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

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

int main()
{
    const char *weekday[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

    char inp[10];
    scanf("%s", inp);

    for (int i = 0; i < 7; i++)
        if (strcmp(inp, weekday[i]) == 0) {
            printf("%d\n", 7 - i);
        }

    return 0;
}


Measured memory_bytes: 256
N,M,X = map(int,input().split())
a = input().split()
cost1 = 0
cost2 = 0
sum_cost = 0

for i in range(M):
  a[i] = int(a[i])
  sum_cost += 1
  if(0< a[i] <X):
   cost1 += 1
 
cost2 = sum_cost - cost1
if(cost1 < cost2):
  print(cost1)
else:
  print(cost2)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep_1(i, n) for (int(i) = 0; (i) <= (n); (i)++)
#define rep_2(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

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

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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n, k, x, y = [ii() for _ in range(4)]
    if n <= k:
        print(n * x)
    else:
        print(k * x + (n - k) * y)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int H, W;
  cin>>H>>W;
  vector<string> A(H);
  for(int i=0;i<H;++i) cin>>A[i];
  queue<tuple<int, int, int> > que;
  for(int i=0;i<H;++i) {
    for(int j=0;j<W;++j) {
      if(A[i][j]=='#') que.push(make_tuple(i, j, 0));
    }
  }
  tuple<int, int, int> state;
  int x, y, cost;
  int ans = 0;
  while(!que.empty()) {
    state = que.front();que.pop();
    x = get<0>(state);
    y = get<1>(state);
    cost = get<2>(state);
    ans = max(ans, cost);
    if(x>0 && A[x-1][y]=='.') {
      A[x-1][y] = '#';
      que.push(make_tuple(x-1, y, cost+1));
    }
    if(x<H-1 && A[x+1][y]=='.') {
      A[x+1][y] = '#';
      que.push(make_tuple(x+1, y, cost+1));
    }
    if(y>0 && A[x][y-1]=='.') {
      A[x][y-1] = '#';
      que.push(make_tuple(x, y-1, cost+1));
    }
    if(y<W-1 && A[x][y+1]=='.') {
      A[x][y+1] = '#';
      que.push(make_tuple(x, y+1, cost+1));
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 17084