akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pp         pop_back`
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define PI         2*acos(0.0)
#define lb         lower_bound
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define btpc       __builtin_popcountll
#define spc(x)     cout<<fixed<<setprecision(x)

const   long long  cs=2e5+5;
const   long long  inf=1e18;
const   long long  mod=1e9+7;
void solve()
{
    int64_t t,n,m,a,b,c,d,e,i,j,k,x,y,cnt=0,cnt1=0;
    bool flag = false;   
    
    cin>>a>>b;
    n=2019;
    if(a%n==0 || b%n==0) 
    {
        cout<< 0 <<endl;
        return ;
    }
    if(abs(a-b)>=n)
    {
        cout<< 0 <<endl;
        return ;
    }
    cnt=inf;
    for(i=a;i<b;i++){
        for(j=i+1;j<=b;j++){
            n = i%2019;
            m = j%2019;
            cnt=min(cnt,(n*m)%2019);
        }
    }
    cout<<cnt<<endl;

}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

    // freopen ("input.txt","r",stdin);
    // freopen ("output.txt","w",stdout);

    // int32_t tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

template <int mod>
struct ModInt {
  int x;
  ModInt(): x(0) {}
  ModInt(long long a) { x = a % mod; if (x < 0) x += mod; }
  ModInt &operator+=(ModInt that) { x = (x + that.x) % mod; return *this; }
  ModInt &operator-=(ModInt that) { x = (x + mod - that.x) % mod; return *this; }
  ModInt &operator*=(ModInt that) { x = (long long) x * that.x % mod; return *this; }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt inverse() {
    int a = x, b = mod, u = 1, v = 0;
    while (b) { int t = a / b; a -= t * b; u -= t * v; swap(a, b); swap(u, v); }
    return ModInt(u);
  }
  #define op(o, p) ModInt operator o(ModInt that) { return ModInt(*this) p that; }
    op(+, +=) op(-, -=) op(*, *=) op(/, /=)
  #undef op
  friend ostream& operator<<(ostream &os, ModInt m) { return os << m.x; }
};

using mint = ModInt<2019>;

void solve() {
  string s;
  cin >> s;
  int n = sz(s);
  vector<mint> mod(n + 1);
  rrep(i, n) {
    mint x = s[i] - '0';
    mod[i] = mod[i + 1] + exp((mint) 10, n - i - 1) * x;
  }
  i64 ans = 0;
  map<int, int> cnt;
  repc(i, n) cnt[mod[i].x]++;
  each(c, cnt) {
    ans += (i64) c.second * (c.second - 1) / 2;
  }
  cout << ans << endl;
}

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

int main(){
  
  int n;
  cin>>n;
  int a[n];
  vector<int> b={},c={},d={};
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++){
    if(i==0) c.push_back(a[i]);
    else if(i%2==1) b.push_back(a[i]);
    else d.push_back(a[i]);
  }
  if(n%2==0){
    reverse(b.begin(),b.end());
    for(int i=0;i<b.size();i++) cout<<b[i]<<" ";
    cout<<c[0]<<" ";
    for(int i=0;i<d.size();i++) cout<<d[i]<<" ";
  }
  else{
    reverse(d.begin(),d.end());
    for(int i=0;i<d.size();i++) cout<<d[i]<<" ";
    cout<<c[0]<<" ";
    for(int i=0;i<b.size();i++) cout<<b[i]<<" ";
  }
  cout<<endl;
  
}

Measured memory_bytes: 3956
#include<stdio.h>
int main(void){
	int a,b,c,d;
	scanf("%d %d %d",&a ,&b ,&c);
	if(a>b){
		d=a;
		a=b;
		b=d;
	}
	if(b>c){
		d=b;
		b=c;
		c=d;
	}
	if(a>b){
		d=a;
		a=b;
		b=d;
	}
	printf("%d %d %d\n",a,b,c);
	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
#define rd() abs((int)rng())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 3e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0);
	int n; cin >> n;
	cout << 180 * (n - 2) << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	if(n==(n&-n))return printf("No"),0;
	printf("Yes\n");
	printf("%d %d\n",n+1,n+2);
	for(int i=2;i+1<=n;i+=2)
	{
		printf("%d %d\n",i,i+1);
		printf("%d %d\n",i+n,i+n+1);
		printf("%d %d\n",1,i);
		printf("%d %d\n",1,i+n+1);
	}
	if(n%2==0)
	{
		printf("%d %d\n",n,2*n-1);
		printf("%d %d\n",2*n,(n^(n-1)^1));
	}
	return 0;
}


Measured memory_bytes: 2304
n = int(input())
v = list(map(int,input().split()))
v.sort()
s = 0
for i in range(n):
    if i == 0:
        s = 0
    elif i == 1:
        s += (v[1] + v[0])/2
    else:
        s = (v[i] + s)/2

print(s)

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

struct edge{
public:
    int to,cost;
};

vector<edge> G[100001];
int n;
bool passed[100001];
const int mod=10007;
int maxCost;
int sumCost;
int cnt;

//vector<int> p;
void dfs(int s,bool first,int from){
    if(!first)
        passed[s]=true;
    for(int i = 0; i < G[s].size(); i++){
        edge &e=G[s][i];
        if(passed[e.to]||e.to==from)
            continue;
        sumCost+=e.cost;
        if(maxCost<e.cost){
            cnt=1;maxCost=e.cost;
        }
        else if(maxCost==e.cost)
            cnt++;
        dfs(e.to,false,s);
        break;
    }
}

int main(){
    while(cin>>n&&n!=0){
        maxCost=0;
        for(int i = 0; i < n; i++)
            G[i].clear();
        fill(passed,passed+n,false);
        for(int i = 0; i < n; i++){
            for(int j = 0; j < 2; j++){
                int to,cost;
                cin>>to>>cost;
                edge e;
                e.to=to;e.cost=cost;
                G[i].push_back(e);
            }
        }
        int mul=1;
        for(int i = 0; i < n; i++){
            if(passed[i])
                continue;
            maxCost=0;
            sumCost=0;
            cnt=0;
            dfs(i,true,-1);
            // ツづづ個陛督づーツ催ュツづゥツつゥ
  //          int maxNum=-1;
//            int sum=0;
//            int cnt=0;
            //for(int j = 0; j < p.size(); j++){
            //    if(maxNum==-1||maxNum<p[j]){
            //        maxNum=p[j];
            //        cnt=1;
            //    }
            //    else if(maxNum==p[j])
            //        cnt++;
            //}
            mul*=cnt;
            mul%=mod;
        }
        cout<<mul%mod<<endl;
    }

    return 0;
}

Measured memory_bytes: 2320
#include<stdio.h>
#include<string.h>
int f(int q[],int j,int t){
  int r[10];
  for(;j<10;j++){
    switch(q[j]){
    case 0:
      break;
    case 1:
      if(j<8&&q[j+1]&&q[j+2]){
	memcpy(r,q,sizeof(int)*10);
	r[j]--;
	r[j+1]--;
	r[j+2]--;
	if(f(r,j+1,t))
	  return 1;
      }
      return 0;
    case 2:
      if(j<8&&q[j+1]>1&&q[j+2]>1){
	memcpy(r,q,sizeof(int)*10);
	r[j]-=2;
	r[j+1]-=2;
	r[j+2]-=2;
	if(f(r,j+1,t))
	  return 1;
      }
      if(t==0){
	memcpy(r,q,sizeof(int)*10);
	r[j]-=2;
	if(f(r,j+1,1))
	  return 1;
      }
      return 0;
    case 3:
      if(j<8&&q[j+1]>2&&q[j+2]>2){
	memcpy(r,q,sizeof(int)*10);
	r[j]-=3;
	r[j+1]-=3;
	r[j+2]-=3;
	if(f(r,j+1,t))
	  return 1;
      }
      if(t==0&&j<8&&q[j+1]&&q[j+2]){
	memcpy(r,q,sizeof(int)*10);
	r[j]-=3;
	r[j+1]--;
	r[j+2]--;
	if(f(r,j+1,1))
	  return 1;
      }
      memcpy(r,q,sizeof(int)*10);
      r[j]-=3;
      if(f(r,j+1,t))
	return 1;
      return 0;
    case 4:
      if(j<8&&q[j+1]>3&&q[j+2]>3){
	memcpy(r,q,sizeof(int)*10);
	r[j]-=4;
	r[j+1]-=4;
	r[j+2]-=4;
	if(f(r,j+3,t))
	  return 1;
      }
      if(t==0&&j<8&&q[j+1]>1&&q[j+2]>1){
	memcpy(r,q,sizeof(int)*10);
	r[j]-=4;
	r[j+1]-=2;
	r[j+2]-=2;
	if(f(r,j+1,1))
	  return 1;
      }
      if(j<8&&q[j+1]&&q[j+2]){
	memcpy(r,q,sizeof(int)*10);
	r[j]-=4;
	r[j+1]--;
	r[j+2]--;
	if(f(r,j+1,t))
	  return 1;
      }
      return 0;
    }
  }
  return 1;
}
int main(){
  int i;
  int n,a[9],p[10],q[10];
  char s[14];
  while(scanf("%s",s)!=-1){
    n=0;
    memset(p,0,sizeof(p));
    for(i=0;i<13;i++)
      p[s[i]-'0']++;
    for(i=1;i<10;i++){
      if(p[i]<4){
	memcpy(q,p,sizeof(p));
	q[i]++;
	if(f(q,1,0)){
	  a[n]=i;
	  n++;
	}
      }
    }
    for(i=0;i<n-1;i++)
      printf("%d ",a[i]);
    if(n)
      printf("%d\n",a[i]);
    else
      puts("0");
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (map.keySet().contains(a)) {
				map.put(a, map.get(a) + 1);
			} else {
				map.put(a, 1);
			}
		}
		
		int sum = 0;
		for (int key : map.keySet()) {
			int v = map.get(key);
			sum += v >= key ? v - key : v;
		}
		
		System.out.println(sum);
	}
}


Measured memory_bytes: 62068
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
#include <utility>
typedef long long ll;
using namespace std;

struct Node{
  ll dist;
  vector<int> to;
  vector<ll> cost;

  Node(){
    to.clear();
    cost.clear();
  }
};

struct Tree{
  int n;
  vector<Node> node;

  Tree(int N){
    n = N;
    node.clear();
    node.resize(N);
  }

  void input(int a,int b,ll c){
    node[a].to.push_back(b);
    node[a].cost.push_back(c);
    node[b].to.push_back(a);
    node[b].cost.push_back(c);
  }

  void DFS(int prev,int cur,ll cost){
    node[cur].dist = cost;

    for(int i=0;i<node[cur].to.size();i++){
      if(node[cur].to[i]==prev) continue;
      else DFS(cur,node[cur].to[i],cost+node[cur].cost[i]);
    }

    return;
  }

  ll calc(int x,int y){
    return node[x].dist + node[y].dist;
  }
};

int main(void){
  int n, q, k, i;
  int a, b, x, y;
  ll c;

  cin >> n;
  Tree tree(n);

  for(i=0;i<n-1;i++){
    cin >> a >> b >> c;
    --a;
    --b;
    tree.input(a,b,c);
  }

  cin >> q >> k;
  --k;
  tree.DFS(-1,k,0);

  for(i=0;i<q;i++){
    cin >> x >> y;
    --x;
    --y;
    cout << tree.calc(x,y) << endl;
  }

  return 0;
}


Measured memory_bytes: 16640
#include<iostream>
#include<string>

int main(void){
        std::string S, T;
        std::cin >> S >> T;
        int counter = 0;
        for(int i = 0; i < S.length(); i++)
                if(S[i] != T[i]) counter++;
        std::cout << counter << std::endl;
        return 0;
}

Measured memory_bytes: 3840
#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;

int main()
{
//	cut here before submit 
//	freopen ("testcase.DL", "r", stdin );
	int w;
	scanf ("%d", &w );
	vector<int> a (w+1, 0 );
	for (int i = 1; i <= w; i++ ) a[i] = i;
	int n;
	scanf ("%d", &n );
	rep (i, n ){
		string s = "";
		cin >> s;
		rep (j, s.length() ){
			if (s[j] == ',' ) s[j] = ' ';
		} // end rep
		stringstream ss (s );
		int b1, b2;
		ss >> b1 >> b2;
		swap (a[b1], a[b2] );
	} // end rep
	for (int i = 1; i <= w; i++ ){
		printf ("%d\n", a[i] );
	} // end for

	return 0;
}

Measured memory_bytes: 1268
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
min = [(a-1)%10,(b-1)%10,(c-1)%10,(d-1)%10,(e-1)%10].min
min += 1
sum = 0
sum += a + (10 - a%10)%10
sum += b + (10 - b%10)%10
sum += c + (10 - c%10)%10
sum += d + (10 - d%10)%10
sum += e + (10 - e%10)%10
sum -= 10 - min
puts sum

Measured memory_bytes: 14264
using System;
using System.Linq;

namespace EnEx
{
    class Program
    {
        public static void Main(string[] args)
        {
            double remnat;
            double oput;
            double[] tNumber = Console.ReadLine().Split().Select(double.Parse).ToArray();

            // 2.6666666667
            // 2.6666666666666665
            // 26666666666.766663
            // 2.6666666667666665
            // 2.6666666667
            var ans = tNumber[0] / tNumber[1];

            if (ans > 0.0)
            {
                var n = ans * 10000000000;
                // 1で割った剰余を出す
                remnat = n % 1;
                if (remnat !=0)
                {
                    var deci = 1 - remnat;

                    oput = (n + deci) / 10000000000;
                    Console.Write(oput);
                }
                else
                {
                    if (n > 0.0)
                    {
                        // 990000000000
                        // 0.0100000000
                        // 0.0100000000
                        oput = (n / 10000000000);
                       var strOput = string.Format("{0:0.0000000000}",oput);
                        Console.Write(strOput);
                    }
                }

            }

        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <string>
#include <limits>
#include <numeric>
#include <type_traits>

using namespace std;
#define ll long long int

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

int main(){
  int a,b,k,ans,ch;
  cin >> a >> b >> k;
  int n = gcd(a ,b);
  //cout << n << endl;
  for(int i = n; 0 < i; --i){
    if( i == 0) continue;
    int ch_a = a % i;
    int ch_b = b % i;
    if(ch_a == 0 && ch_b == 0){
      ++ch;
      if(ch == k){
        ans = i;
        break;
      }
      //cout << "ch = " << ch << endl;
      //cout << "ans = "<< ans << endl;
    }
  }

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


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vec> mat;
int main(){
    ll n,k,H[200001];
    cin>>n>>k;
    rep(i,n) cin>>H[i];
    sort(H,H+n,greater<ll>());
    ll ans=0;
    if(k>=n){
        cout<<0;
        return 0;
    }
    rep(i,n-k) ans+=H[i+k];
    cout<<ans;
}

Measured memory_bytes: 1792
#include<iostream>
//#include<algorithm>
//#include<cmath>
//#include<string>
//#include<cctype>
#include <vector>
using namespace std;
int main() {
	int i, c, m, n, b;
	while (cin >> m >> n, m || n) {
		vector<int> a(7368792,0);
		b = m;
		while (1) {
			if (!a[b]) {
				if (!n) { cout << b << endl; break; }
				for (i = b; i < 7368792; i += b)
					a[i] = 1;
				n -= 1;
			}
			b++;
		}
	}
	return 0;
}

Measured memory_bytes: 31776
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int P=1e9+7;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int inc(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
const int N=55;
int C[N][N],f[N][N],n,res;
int main(){
	scanf("%d",&n);
	fp(i,0,n){
		C[i][0]=1;
		fp(j,1,i)C[i][j]=inc(C[i-1][j],C[i-1][j-1]);
	}
	f[1][0]=f[1][1]=1;
	fp(i,1,n-1)fp(j,0,i)if(f[i][j]){
		R int ret=f[i][j];
		fp(k,0,n-i)fp(l,0,n-i-k)
			if(k+l&&k+l>=j&&((k+l-j)&1^1))
				upd(f[i+k+l][abs(j+((k+l-j)>>1)-k)],mul(ret,mul(C[i+k+l][k+l],C[k+l][k])));
	}
	printf("%d\n",f[n][0]);
	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"
#include "cmath"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<ll> > mat;

int main()
{
  ll n;
  cin >> n;
  cout << n * (n - 1) / 2 << "\n";
}

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

class Program
{
    public static void Main(string[] args)
    {
        string s = Console.ReadLine();
        string t = Console.ReadLine();

        int count = 0;

        for(int i=0;i < s.Length; i++)
        {
            if (s[i] == t[i])
                count++;
        }

        Console.WriteLine(count);
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1000000000+5;
const int N=2e5+5;
const ll oo=1e18+5;
const ll mod=998244353;

struct point{
	ll x,y;
};

bool cmp(const point& a,const point& b){
	return a.x+a.y<b.x+b.y;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int n;
	cin>>n;
	vector<point> a(n),b(n);
	for(int i=0;i<n;++i){
		cin>>a[i].x>>a[i].y;
		b[i].x=-a[i].x;
		b[i].y=a[i].y;
	}
	sort(all(a),cmp);
	sort(all(b),cmp);
	cout<<max(abs(a[0].x-a.back().x)+abs(a[0].y-a.back().y),abs(b[0].x-b.back().x)+abs(b[0].y-b.back().y));
	return 0;
}


Measured memory_bytes: 9520
import java.util.*;
public class Main {
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args) {
 
    while(kbd.hasNext()){
        int h = kbd.nextInt();
        int w = kbd.nextInt();
        if(!(h==0 && w==0)){
        for(int i=h; i>0; i--){
            for(int j=w; j>0; j--){
            System.out.print("#");
            }
            System.out.println();
        }
        System.out.println();
        }
    }
    }
}

Measured memory_bytes: 24948
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    int a,b;
    cin >> a >> b;
    if (a+b >= 10) {
        cout << "error" << "\n";
    } else {
        cout << a+b << "\n";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=998244353;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
string s;
vi a,b;

int main(){
	cin>>s;
	n=s.size();
	for(int i=0;i<n;i++){
		if(s[i]=='0'){
			a.push_back(i);
			a.push_back(i);
		}
		if(s[i]=='1'){
			a.push_back(i);
			b.push_back(i);
		}
		if(s[i]=='2'){
			b.push_back(i);
			b.push_back(i);
		}
	}
	int h=a.size(),w=b.size();
	vvi dp(h+1,vi(w+1));
	dp[0][0]++;
	for(int i=0;i<=h;i++) for(int j=0;j<=w;j++){
		if(i<h&&a[i]<=(lower_bound(a.begin(),a.end(),a[i])-a.begin())+min(j,(int)(lower_bound(b.begin(),b.end(),a[i])-b.begin()))) (dp[i+1][j]+=dp[i][j])%=mod;
		if(j<w&&b[j]<=min(i,(int)(lower_bound(a.begin(),a.end(),b[j])-a.begin()))+(lower_bound(b.begin(),b.end(),b[j])-b.begin())) (dp[i][j+1]+=dp[i][j])%=mod;
	}
	cout<<dp[h][w]<<endl;
}

Measured memory_bytes: 18048
#include <stdio.h>
 
int c, p, l, lp;
long long r;

void write(long long n) {
  if(n) {
    write(n / 10);
    putchar_unlocked('0' + n % 10);
  }
}
        
int main() {
  for(; (c = getchar_unlocked()) != EOF && c > ' '; r += ++l) {
    if(c != p) { 
      if(c == '<')
        r -= l < lp ? l : lp;
      p = c, lp = l, l = 0;
    }
  }
  if(p == '>')
    r -= l < lp ? l : lp;
  write(r);
  putchar_unlocked('\n');
  return 0;
}

Measured memory_bytes: 128
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

print(lcm(t))

Measured memory_bytes: 5044
if __name__ == '__main__':
    s = input()
    K = int(input())
    # s = 'aba'
    # s = 'atcoderandatcodeer'
    # K = 5

    candidates = set()
    for start in range(0, len(s)):
        for length in range(1, K + 1):
            candidates |= {s[start:start + length]}

    candidates = sorted(candidates)
    print(candidates[K - 1])


Measured memory_bytes: 4592
s = input()
t = input()

l_s = len(s)
l_t = len(t)

res = l_t
for i in range(l_s - l_t + 1):
    cnt = 0
    for j in range(l_t):
        if t[j] != s[i+j]:
            cnt+=1
    if res > cnt:
        res = cnt
print(res)


Measured memory_bytes: 9004
N, A = map(int, input().split())
X = [int(x) - A for x in input().split()]

import functools
@functools.lru_cache(maxsize=None)
def f(acc, left):
    if not left: return 0
    ret = 0
    y = acc + left[0]
    ret += 1 if y == 0 else 0
    ret += f(y, left[1:])
    ret += f(acc, left[1:])
    return ret
print(f(0, tuple(X)))

Measured memory_bytes: 13400
let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let rec f n = if n <= 0 then 1 else 3 * f (n - 1)
let _ = f n - Array.fold_left (fun c a -> c * if a mod 2 = 0 then 2 else 1) 1 a_s |> Printf.printf "%d\n"

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

//関数定義
//最大公約数
ll gcd(ll a, ll b);

//最小公倍数
ll lcm(ll a, ll b);

int main() {
  // ========================================================
  ll n, k, m;
  cin >> n >> k;
  m = k;
  FOR(i, 1, 100000) {
    if (i > 1) m *= k;
    if (m > n) {
      cout << i << endl;
      return 0;
    }
  }
}

//最大公約数
ll gcd(ll a, ll b) {
  if (!b) return a;
  return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

Measured memory_bytes: 256
' Imports System.Collections.Generic
' Imports System.Globalization
' Imports System.IO
' Imports System.Linq
' Imports System.Text
' Imports System.Text.RegularExpressions

Class Main
    Public Shared Sub Main()
        Dim N As Integer = Console.ReadLine()
        Dim ans As Integer = 0
        For i As Integer = 1 To N
            If (Math.Floor(Math.Log10(i)) + 1) Mod 2 = 1
                ans += 1
            End If
        Next
        Console.WriteLine(ans)
        Return
    End Sub
End Class

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

int main() {
  int n,a,b,pointa,pointb;
  while(cin >> n) {
    if(n == 0) break;
  pointa = 0;
  pointb = 0;
    for(int i=0;i<n;i++) {
      cin >> a >> b;
      if(a > b) {
        pointa += a + b;
      }
      else if(b > a) {
        pointb += a + b;
      }
      else {
        pointa += a;
        pointb += b;
      }
    }
    cout << pointa << " " << pointb << endl;
  }
}

Measured memory_bytes: 0
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

n, m = input_a
s, c = m.times.map{gets.split.map(&:to_i)}.transpose

if m == 0
  puts 0 if n == 1
  puts 10 if n == 2
  puts 100 if n == 3
  exit
end

1000.times do |num|
  numbers = num.to_s.chars.map(&:to_i)
  if numbers.length == n
    cnt = Array.new(m, 0)
    m.times do |i|
      cnt[i] += 1 if numbers[s[i] - 1] == c[i]
    end
    if cnt.inject(:+) == m
      puts num
      exit
    end
  end
end
puts -1

Measured memory_bytes: 1788
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
import copy
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, K = getlist()
	A = getlist()
	if K >= 40:
		ans = [N] * N
		print(*ans)
		return

	for i in range(K):
		imos = [0] * (N + 1)
		for j in range(N):
			left = max(0, j - A[j])
			right = min(N, j + A[j] + 1)
			imos[left] += 1
			imos[right] -= 1

		for j in range(N):
			imos[j + 1] += imos[j]

		A = copy.deepcopy(imos[:-1])

	print(*A)

if __name__ == '__main__':
	main()

Measured memory_bytes: 177404
#include <stdio.h>
	int main(void){
		int i,j,n,m,a[1000][1000],b[1000],c[1000];
		scanf("%d %d",&n,&m);
		for(i=0;i<n;i++){	
			for(j=0;j<m;j++){
				scanf("%d",&a[i][j]);
			}
		}
		for(i=0;i<m;i++){
			scanf("%d",&b[i]);
		}
		for(i=0;i<n;i++){
			c[i]=0;
			for(j=0;j<m;j++){
				c[i]+=a[i][j]*b[j];
			}
		}
		for(i=0;i<n;i++){
			printf("%d\n",c[i]);
		}
	return 0;
}

Measured memory_bytes: 2740
#include "bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;
const int INF = 1 << 30;
const long long MOD = 1000000000 + 7;
const double PI = acos(-1);

void DFS(int N, vector<vector<int>> &bits, vector<int> vec) {
	if (vec.size() == N)bits.push_back(vec);
	else {
		vector<int> tmp = vec;
		tmp.push_back(1);
		DFS(N, bits, tmp);
		tmp = vec;
		tmp.push_back(0);
		DFS(N, bits, tmp);
	}
}

int main() {
	int N, M; cin >> N >> M;
	vector<vector<int>> D(M);
	rep(i, M) {
		int k; cin >> k;
		rep(j, k) {
			int s; cin >> s;
			D[i].push_back(s);
		}
	}
	vector<int> p(M);
	rep(i, M)cin >> p[i];

	vector<vector<int>> bits;
	DFS(N, bits, vector<int>());

	int ans = 0;
	rep(i, bits.size()) {
		int count2 = 0;
		rep(j, M) {
			int count = 0;
			rep(k, D[j].size()) {
				if (bits[i][D[j][k] - 1] == 1)++count;
			}
			if (p[j] == (count % 2))++count2;
			else break;
		}
		if (count2 == M)++ans;
	}
	cout << ans;

}

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

const int MAX_N = 1e6;
int64_t n;
int64_t a[MAX_N + 1];

void solve() {
    a[0] = 0;
    for (int64_t i = 1; i <= MAX_N; i++) {
        if (i % 3 == 0 || i % 5 == 0) {
            a[i] = a[i - 1];
        } else {
            a[i] = a[i - 1] + i;
        }
    }
    cout << a[n] << endl;
}

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

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

using namespace std;

#define rep(i,n) for(i=0;i<n;i++)

int main(){
    int x;cin>>x;
    if(x==2){
        cout<<2<<endl;
        return 0;
    }

    int prime;
    for(int i=x/2*2+1;;i+=2){
        bool isPrime=true;
        for(int j=3;j<i;j++){
            if(i%j==0){
                isPrime=false;
                break;
            }
        }
        if(isPrime){
            prime=i;
            break;
        }
    }
    cout<<prime<<endl;
    return 0;
}

Measured memory_bytes: 888
import sys
def input():
	return sys.stdin.readline()[:-1]

k, q = map(int, input().split())
D = list(map(int, input().split()))

def solve(n, x, m):
	ds = [x%m for x in D]
	nums = [(n-1)//k + (i < ((n-1)%k)) for i in range(k)]
	zero = sum([num for num, d in zip(nums, ds) if d == 0])
	cum = x%m + sum([num * d for num, d in zip(nums, ds)])
	decr = cum // m
	return n-1 - zero - decr

for _ in range(q):
	n, x, m = map(int, input().split())
	print(solve(n, x, m))

Measured memory_bytes: 100828
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Collection;
import java.io.IOException;
import java.util.stream.Collectors;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.stream.Stream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.LinkedList;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CPushpush solver = new CPushpush();
        solver.solve(1, in, out);
        out.close();
    }

    static class CPushpush {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            int n = in.ints();
            int[] a = in.ints(n);

            LinkedList<Integer> list = new LinkedList<>();
            for (int i = 0; i < n; i++) {
                if (i % 2 == 0) {
                    list.addFirst(a[i]);
                } else {
                    list.addLast(a[i]);
                }
            }
            if (n % 2 == 0) {
                Collections.reverse(list);
            }
            out.println(list.stream().map(Object::toString).collect(Collectors.joining(" ")));
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

        public int[] ints(int length) {
            return IntStream.range(0, length).map(x -> ints()).toArray();
        }

    }
}



Measured memory_bytes: 66216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<(n);i++)
#define Fr(i,n) for(int i=0;i++<(n);)
#define ifr(i,n) for(int i=(n)-1;i>=0;i--)
#define iFr(i,n) for(int i=(n);i>0;i--)

const ll MOD=998244353;

ll ad(ll x,ll y=0){
  return (x+y)%MOD;
}

ll mlt(ll x,ll y=1){
  return (x*y)%MOD;
}

ll pwr(ll x,ll y){
  ll pw[32]={},w=1;
  pw[0]=x;
  fr(i,31) pw[i+1]=mlt(pw[i],pw[i]);
  fr(i,32){
    w=mlt(w,1+(y%2)*(pw[i]-1));
    y/=2;
  }
  return w;
}

ll inv(ll x){
  return pwr(x,MOD-2);
}

ll fc[1010] = {1};

ll fct(ll x) {
    if (fc[x] == 0) fc[x] = mlt(x, fct(x - 1));
    return fc[x];
}

ll ifc[1010] = {1};

ll ifct(ll x) {
    if (ifc[x] == 0) ifc[x] = inv(fct(x));
    return ifc[x];
}

void initfct(ll x) {
    ifct(x);
    ifr(i, x) ifc[i] = mlt(ifc[i + 1], i + 1);
}

ll comb(ll n, ll r) {
    if (n < 0 || r < 0 || n < r) return 0;
    return mlt(fct(n), mlt(ifct(r), ifct(n - r)));
}

int main(){
    initfct(1005);
    ll n,a[310],s=0,ans=0;
    vector<ll> dp[310],dp2[310]={};
    cin>>n;
    Fr(i,n){
        cin>>a[i];
        s+=a[i];
    }
    fr(i,n+1){
        dp[i].resize(s+1);
        dp2[i].resize(s+1);
    }
    dp[0][0]=1;
    dp2[0][0]=1;
    Fr(i,n){
        fr(j,s+1){
            dp[i][j]=ad(dp[i][j],mlt(2,dp[i-1][j]));
            if(j>=a[i]) dp[i][j]=ad(dp[i][j],dp[i-1][j-a[i]]);
            if(1-s%2){
                dp2[i][j]=ad(dp2[i][j],dp2[i-1][j]);
                if(j>=a[i]) dp2[i][j]=ad(dp2[i][j],dp2[i-1][j-a[i]]);
            }
        }
    }
    fr(j,s+1){
        if(2*j>=s) ans=ad(ans,dp[n][j]);
    }
    if(s%2) cout<<ad(pwr(3,n),MOD-mlt(3,ans))<<endl;
    else cout<<ad(pwr(3,n)+mlt(3,dp2[n][s/2]),MOD-mlt(3,ans))<<endl;
}

Measured memory_bytes: 424064
#include <stdio.h>

// positive only
int get_int() {
    int n = 0;
    int c = getchar_unlocked();
    if(c < 48 || 57 < c) return -1;
    while(47 < c && c < 58) {
        n = 10 * n + (c & 0xf);
        c = getchar_unlocked();
    }
    return n;
}
// arr should be sorted
void *binary_search(const int key, const int *arr, const int N){
    int left = 0;
    int right = N;
    int mid;
    while(left < right) {
        mid = left + ((right - left) / 2);
        if(arr[mid] == key) return (void *)(arr + mid);
        else if(arr[mid] > key) right = mid;
        else left = mid + 1;
    }
    return NULL;
}
int main(int argc, char **argv) {
    int n = get_int();
    int s[100001];
    for(int i = 0; i < n; ++i) {
        s[i] = get_int();
    }
    int q = get_int();
    int cnt = 0;
    int t;
    while(q--) {
        binary_search(get_int(), s, n) && cnt++;
    }
    printf("%d\n", cnt);
}



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

// Shortening code
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

// Macros
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = a; i >= b; i--)

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    // Your code
    double n;
    cin >> n;
    cout << 2 * n * M_PI;
    return 0;
}

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

int main() {
  ll n,m;
  cin >> n >> m;
  rep(i,(m+1)/2){
    cout << i+1 << " " << (m+1)/2*2-i << endl;
  }
  rep(i,m/2){
    cout << n-m/2*2+i << " " << n-i << endl;
  }
  return 0;
}


Measured memory_bytes: 3596
#include <stdio.h>

int main(void){
    int n,p;
    while(1){
        int map[50]={0},sign=0;
        scanf("%d %d",&n,&p);
        int stone=p;
        if(n==0 && p==0)
            break;
        while(map[sign] != p-1 || stone != 1){
            if(stone == 0){
                stone=map[sign];
                map[sign]=0;
            }
            else{
                stone--;
                map[sign]++;
            }
            sign++;
            if(sign == n)
                sign=0;
        }
        printf("%d\n",sign);
    }
    return 0;
}

Measured memory_bytes: 600
/*mokosucio's file*/
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define fs first
#define sc second
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using ll = long long;
const ll inf = 1e9+5; 

const double PI =  3.14159265;

int main(){
	IO;
	string n;
	cin>>n;
	bool seven = false;
	forn(i,3){
		if(n[i]=='7') seven = true;
	}

	(seven)?cout<<"Yes\n":cout<<"No\n";
	return 0;
}



Measured memory_bytes: 3608
#include <iostream>
int main(void)
{
    int a, b;
    std::cin >> a >> b;
    if ((a % 2 == 0 && b % 2 == 0) || (a % 2 == 1 && b % 2 == 1))
    {
        int c = (a + b) / 2;
        std::cout << c << std::endl;
    }
    else
    {
        std::cout << "IMPOSSIBLE" << std::endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

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

	if (N % 2 == 0) cout << N / 2 << endl;
	else if (N % 2 != 0) cout << N / 2 + N % 2 << endl;

	return 0;
}

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

typedef long long ll_t;

#define PERR(fmt, ...) \
    do { \
        fprintf(stderr, fmt, ##__VA_ARGS__); \
    } while (0) 

char S[101];

int main() {
   scanf("%s", S);
   int n = strlen(S);
   int i = 0;
   while (i < n && S[i] != 'C')
       ++i;
   if (S[i] == 'C') {
       i++;
       while (i < n && S[i] != 'F')
          ++i;
       if (S[i] == 'F')
         printf("Yes\n");
       else
         printf("No\n");
   } else {
       printf("No\n");
   }
   return 0;
}

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

int main() {
  int n;
  std::cin >> n;
  int s[n];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    std::cin >> s[i];
    sum += s[i];
  }
  std::sort(s, s + n);
  if (sum % 10 == 0) {
    for (int i = 0; i < n; i++) {
      if (s[i] % 10 != 0) {
        sum -= s[i];
        break;
      }
    }
  }
  if (sum % 10 == 0) {
    std::cout << 0 << "\n";
  } else {
    std::cout << sum << "\n";
  }
  return 0;
}

Measured memory_bytes: 256
x1, y1, x2, y2 = [int(elem) for elem in input().split(' ')]

diff = (x2 - x1, y2 - y1)
x3 = -diff[1] + x2
y3 = diff[0] + y2
x4 = -diff[0] + x3
y4 = -diff[1] + y3
print(x3, y3, x4, y4)

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

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define for1(i, a, b) for (int i = (int)a; i < (int)(b); ++i)
#define rfor1(i, a, b) for (int i=(int)b-1;i>=(int)a;i--)
#define for2(i, a, b) for (int i = (int)a; i <= (int)(b); ++i)
#define for3(i, a, b) for (int i = (int)a; i < (int)(b); i=i+2)
#define for4(i, a, b) for (int i = (int)a; i <= (int)(b); i=i+2)
#define tc(t) int t; cin>>t; while(t--)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int R, C, r, c;
    cin >> R >> C >> r >> c;
    cout << (R - r) * (C - c) << "\n";

}






Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 100005
#define MOD 1000000007
using namespace std;
using LL = long long;
int n;
LL dp[M][2];
vector<int> e[M];
void dfs(int cur,int fa) {
    dp[cur][0] = dp[cur][1] = 1;
    for (int i: e[cur]) if (i!=fa) {
        dfs(i, cur);
        dp[cur][0] *= (dp[i][0] + dp[i][1]);
        dp[cur][0] %= MOD;
        dp[cur][1] = (dp[cur][1] * dp[i][0]) % MOD;
    }
}
int main()
{
    scanf("%d", &n);
    REP(i,1,n-1) {
        int x, y;
        scanf("%d %d", &x, &y);
        e[x].push_back(y);
        e[y].push_back(x);
    }

    dfs(1, -1);
    printf("%lld\n", (dp[1][0] + dp[1][1]) % MOD);
    return 0;
}


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

int main(){
  int a,b,c,x,y,ans=0;cin>>a>>b>>c>>x;
  rep(i,a){
    rep(j,b){
      rep(k,c){
        y=i*500+j*100+k*50;
        if(x==y)ans++;
      }
    }
  }
  cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int a[200];
signed main(){
	int n,x;cin>>n>>x;
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	int cnt=0;
	rep(i,n){
		if(x<a[i]){
			if(x)cnt++;
			break;
		}
		x-=a[i];
		cnt++;
	}
	if(x)cnt--;
	cout<<max(0,cnt)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  string n;
  cin>>n;
  ll now=0;
  for(int i=0;i<n.size();i++){
    now+=n[i]-'0';
    now%=9;
  }
  if(now==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3752
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
const int mod=1000*1000*1000+7;

using namespace __gnu_pbds;
using namespace std;


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

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

i64 po(i64 a,i64 b)
{

i64 ans=1;
  while(b)
  {
    if(b&1)
    {ans=ans*a%mod;

    }
a=a*a%mod;
b/=2;

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

    // ifstream fin(".in");
    // ofstream fout(".in");
i64 n,k;
cin>>n>>k;
vi64 arr(n),left(n,0),right(n,0);
forn(i,n)cin>>arr[i];
ford(i,n)
{
  fore(j,i,n-1)
  {
    if(arr[i]>arr[j])left[i]++;
  }
}

forn(i,n)
{
  ford(j,i)
  {
    if(arr[i]>arr[j])right[i]++;
  }
}
i64 pre=po(2,mod-2);
i64 ans=0;
i64 ls=0,rs=0;
forn(i,n)
{
ls+=left[i];
rs+=right[i];
ls%=mod;
rs%=mod;

}
ans=ls*(k+1)+rs*(k-1);
ans%=mod;
ans*=k;
ans%=mod;
ans*=pre;
ans%=mod;

cout<<ans;
    return 0;
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef vector<pii> vpii;
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
    tree_order_statistics_node_update> ost;

const int N=2100;
char f[N][N];
int root[N][N], nr[N][N], nl[N][N], nd[N][N], nu[N][N];

void dfs(int x, int y) {
    if(f[x-1][y]=='1') {
        f[x-1][y]='.'; nu[x][y]++; dfs(x-1, y);
    }
    if(f[x+1][y]=='1') {
        f[x+1][y]='.'; nd[x][y]++; dfs(x+1, y);
    }
    if(f[x][y-1]=='1') {
        f[x][y-1]='.'; nl[x][y]++; dfs(x, y-1);
    }
    if(f[x][y+1]=='1') {
        f[x][y+1]='.'; nr[x][y]++; dfs(x, y+1);
    }
}

int main() {
    int i, j, n, m, q, x1, x2, y1, y2, ans;
    scanf("%d%d%d", &n, &m, &q);
    for(i=1; i<=n; i++) scanf("%s", f[i]+1);
    for(i=1; i<=n; i++) for(j=1; j<=m; j++) if(f[i][j]=='1') {
        root[i][j]=1;
        f[i][j]='.';
        dfs(i, j);
    }
    for(i=1; i<=n; i++) for(j=1; j<=m; j++) {
        nl[i][j]+=nl[i-1][j];
        nr[i][j]+=nr[i-1][j];
        nd[i][j]+=nd[i][j-1];
        nu[i][j]+=nu[i][j-1];
        root[i][j]+=root[i-1][j]+root[i][j-1]-root[i-1][j-1];
    }
    while(q--) {
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
        ans=root[x2][y2]-root[x1-1][y2]-root[x2][y1-1]+root[x1-1][y1-1];
        ans+=nr[x2][y1-1]-nr[x1-1][y1-1];
        ans+=nl[x2][y2+1]-nl[x1-1][y2+1];
        ans+=nd[x1-1][y2]-nd[x1-1][y1-1];
        ans+=nu[x2+1][y2]-nu[x2+1][y1-1];
        printf("%d\n", ans);
    }
    return 0;
}

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

int main() {
  string str;
  cin >> str;
  
  int digit = 4;
  int in_number[digit];
  
  transform(begin(str), end(str), in_number, [](char c){return c - '0';});

  int same_num = 1;
  int prev_num = 0;
  for (int i = 0; i < digit; i++) {
  	if (prev_num == in_number[i]) {
    	same_num++;
    } else {
    	same_num = 1;
    }
    
    if (same_num == 3) {
    	cout << "Yes" << endl;
      	return 0;
    }
    
    prev_num = in_number[i];
  }
  
  cout << "No" << endl;
}

Measured memory_bytes: 256
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N, u, v;
vector<int> G[100010];
pii D[100010];

void dfs(int v, int t, int c, int pre)
{
	if (t == 0)D[v].first = c;
	else D[v].second = c;

	for (auto e : G[v])
	{
		if (e == pre)continue;
		dfs(e, t, c + 1, v);
	}
}

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

	cin >> N;
	cin >> u >> v;
	u--, v--;

	int a, b;
	rep(i, 0, N - 1)
	{
		cin >> a >> b;
		a--, b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	dfs(u, 0, 0, -1);
	dfs(v, 1, 0, -1);

	int ans = 0;
	rep(i, 0, N)
	{
		if (D[i].first < D[i].second)
		{
			chmax(ans, D[i].second - 1);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 12544