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

typedef struct {
  int x, y;
  int cnt;
} House;

typedef struct {
  int x, y;
  int c;
} Flower;

typedef struct {
  int w;
  double a;
} Wind;

double d[3];

double dist(int x1, int y1, int x2, int y2){
  return fabs(sqrt(pow((double)(x1 - x2), 2.0) + pow((double)(y1 - y2), 2.0)));
}

bool clash(Wind w, House h, Flower f){
  // 距離
  if(dist(h.x, h.y, f.x, f.y) <= w.a){
    double angle;
    if(h.x == f.x && h.y > f.y){
      angle = 90;
    }else if(h.x == f.x && h.y < f.y){
      angle = 270;
    }else if(h.y == f.y && h.x > f.x){
      angle = 0;
    }else if(h.y == f.y && h.x < f.x){
      angle = 180;
    }else{
      double x, y;
      x = (double)(h.x - f.x);
      y = (double)(h.y - f.y);

      angle = atan(fabs(y) / fabs(x));
      angle *= 180 / M_PI; // 度数法へ

      if(x < 0 && y > 0){
	angle = 180 - angle;
      }else if(x < 0 && y < 0){
	angle = 180 + angle;
      }else if(x > 0 && y < 0){
	angle = 360 - angle;
      }
    }

    double up = (double)w.w + d[f.c] / 2;
    double low = (double)w.w - d[f.c] / 2;

    if(up >= 360){
      // 扇形を分割(x軸をまたぐ)
      if(angle <= up - 360 || angle >= low){
	return true;
      }else{
	return false;
      }
    }else if(low <= 0){
      if(angle <= up || angle >= low + 360){
	return true;
      }else{
	return false;
      }
    }else{
      // 扇形を分割する必要がない
      if(low <= angle && angle <= up){
	return true;
      }else{
	return false;
      }
    }
  }else{
    return false;
  }
}

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

  Flower temp;
  temp.x = 0;
  temp.y = 0;
  temp.c = 0;

  while(1){
    int H, R;
    cin >> H >> R;
    if(H == 0 && R == 0) break;

    House h[105];
    for(int i = 0;i < H;++i){
      cin >> h[i].x >> h[i].y;
      h[i].cnt = 0;
    }
    
    int U, M, S;
    cin >> U >> M >> S >> d[0] >> d[1] >> d[2];
    
    Flower f[35];
    int i, j;
    for(i = 0;i < U;++i){
      cin >> f[i].x >> f[i].y;
      f[i].c = 0;
    }
    for(j = 0;j < M;++j){
      cin >> f[i + j].x >> f[i + j].y;
      f[i + j].c = 1;
    }
    for(int k = 0;k < S;++k){
      cin >> f[i + j + k].x >> f[i + j + k].y;
      f[i + j + k].c = 2;
    }
    
    Wind w;
    for(i = 0;i < R;++i){
      cin >> w.w >> w.a;
      for(int j = 0;j < H;++j){
	bool flag = true;
	for(int k = 0;k < U + M + S && flag;++k){
	  if(/*あたり判定*/clash(w, h[j], f[k])){
	    flag = false;
	  }
	}

	if(flag && /*自分の梅とのあたり判定*/clash(w, h[j], temp)){
	  ++h[j].cnt;
	}
      }
    }

    vector<int> vec;    
    int maxim = 0;
    for(i = 0;i < H;++i){
      if(maxim == h[i].cnt){
	vec.push_back(i + 1);
      }
      else if(maxim < h[i].cnt){
	vec.clear();
	vec.push_back(i + 1);
	maxim = h[i].cnt;
      }
    }
    
    if(maxim == 0){
      cout << "NA" << endl;
    }else{
      for(int i = 0;i < vec.size();++i){
	cout << vec[i];
	
	if(i == vec.size() - 1){
	  cout << endl;
	}else{
	  cout << ' ';
	}
      }
    }

    /*
    cout << "!";
    for(int i = 0;i < H;++i){
      cout << h[i].cnt << ' ';
    }
    cout << endl;
    */

  }

  return 0;
}




Measured memory_bytes: 3692
package main
import . "fmt"
func main() {
  var h,w int
  var s []string
  var m [][]int
  Scan(&h,&w)
  s = make([]string,h)
  m = make([][]int,h+2)
  for i:=0;i<h;i++ {
    Scan(&s[i])
    m[i] = make([]int,w+2)
  }
  m[h] = make([]int,w+2)
  m[h+1] = make([]int,w+2)
  for i:=1;i<h+1;i++ {
    for j:=1;j<w+1;j++ {
      if s[i-1][j-1:j] == "." { continue }
      m[i-1][j-1]++
      m[i-1][j]++
      m[i-1][j+1]++
      m[i][j-1]++
      m[i][j] = -1000000
      m[i][j+1]++
      m[i+1][j-1]++
      m[i+1][j]++
      m[i+1][j+1]++
    }
  }
  for i:=1;i<h+1;i++ {
    for j:=1;j<w+1;j++ {
      if m[i][j] < 0 {
        Print("#")
      } else {
        Print(m[i][j])
      }
    }
    Println()
  }
}

Measured memory_bytes: 640
#include<stdio.h>
typedef long long LL;
#define REP(j,k,n) for(LL j=k;j<(LL)n;j++)
#define rep(i,N) REP(i,0,N)
const int MOD=998244353;
inline LL Pow(LL x,LL y){LL z=1;x%=MOD;while(y){if(y&1){z=(z*x)%MOD;}x=(x*x)%MOD;y>>=1;}return z%MOD;}
int main(void)
{
  int A,B,C,D,ans=0,dp[3001]={0};LL sum;
  if(!scanf("%d %d %d %d",&A,&B,&C,&D))return 0;
  dp[A]=1;
  rep(i,D-B)
  {
    sum=0;
    REP(j,1,C+1)
    {
      sum=(sum*(B+i)%MOD+dp[j])%MOD;
      dp[j]=(dp[j]*(j-1)+sum)%MOD;
    }
  }
  rep(i,C+1)ans=(ans+dp[i]*Pow(D,C-i)%MOD)%MOD;
  return printf("%d\n",ans<0?ans+MOD:ans),0;
}

Measured memory_bytes: 1744
#include <stdio.h>

int main()
{
    int a,b,c;
    scanf("%d %d %d", &a, &b, &c);
    if((a==b && a != c) || (a==c && a != b) || (c==b && a != c))
    printf("Yes");
    else
    printf("No");

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main()
{
    char w[101];
    int a[27]={0};
    scanf("%s",w);
    int i,l,f=0;
    l=strlen(w);
    for(i=0;i<l;i++){
        a[w[i]-97]++;
    }
    for(i=0;i<26;i++){
        if(a[i]%2==1) {
            f=1;
            break;
        }
    }
    if(f==1) printf("No\n");
    else printf("Yes\n");
   return 0;
}


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

int main() {
    int v[3];
    
    cin >> v[0] >> v[1] >> v[2];
    
    sort(v, v + 3, greater<int>());
    
    cout << (v[0] * 10) + v[1] + v[2] << endl;
    return 0;
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

vector<int> g[300005];

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n, m; cin >> n >> m;
	vector<int> h(n + 1);
	rep(i, 1, n + 1) cin >> h[i];
	rep(i, 0, m) {
		int a, b; cin >> a >> b;
		g[a].push_back(b); g[b].push_back(a);
	}
	int ans = 0;
	rep(i, 1, n + 1) {
		bool gd = true;
		for (int x : g[i]) if (h[x] >= h[i]) gd = false;
		if (gd) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 13496
#A: Add Sub Mul
a,b = map(int, input().split())
if a + b >= a - b and a + b >= a * b:
    print(a + b)
elif a - b >= a + b and a - b >= a * b:
    print(a - b)
elif a * b >= a + b and a * b >= a - b:
    print(a * b)

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

int main() {
	int n, m;
	std::cin >> n >> m;
	std::vector<std::pair<int, int>>v(m);
	for (int i = 0; i < m; i++) {
		int a, b;
		std::cin >> a >> b;
		a--;
		b--;
		v[i].first = b;
		v[i].second = a;
	}
	std::sort(v.begin(), v.end());

	int ans = 0, time = 0;

	for (auto i : v) {
		if (i.second < time)continue;
		time = i.first;
		ans++;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h> 
using namespace std;
typedef long long intl;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	int n;
	cin>>n;
	string s;
	cin>>s;
	vector <int> evfact(n+2,0);
	for(int i=1;i<n+2;i++){
		int p=0;
		int aux=i;
		while(aux%2==0){
			aux/=2;
			p++;
		}
		evfact[i]=evfact[i-1]+p;
	}
	bool uno=false;
	for(int i=0;i<n;i++){
		if(s[i]=='2'){
			uno=true;
		}
	}
	if(uno){
		int ans=0;
		for(int i=0;i<n;i++){
			if(evfact[n-1]==evfact[n-1-i]+evfact[i]){
				ans+=(s[i]-'0');
			}
		}
		cout<<ans%2<<endl;
	}
	else{
		int ans=0;
		for(int i=0;i<n;i++){
			if(evfact[n-1]==evfact[n-1-i]+evfact[i]){
				if(s[i]=='3'){
					ans+=1;
				}
			}
		}
		if(ans%2==0){
			cout<<0<<endl;
		}
		else{
			cout<<2<<endl;
		}
	}
	
}


Measured memory_bytes: 5276
fun main(args: Array<String>) {
    val (a, b, c, x, y) = readLine()?.split(" ")?.map { it.toInt() } ?: return

    var result = Int.MAX_VALUE

    for (abp in 0..(Math.max(x, y) * 2) step 2) {
        val ap = Math.max(x - (abp / 2), 0)
        val bp = Math.max(y - (abp / 2), 0)
        val amount = a * ap + b * bp + c * abp
        if (amount < result) {
            result = amount
        }
    }
    println(result)
}

Measured memory_bytes: 37944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "
int main(){
    int n,a,b;cin>>n>>a>>b;
    co(min(n*a,b));
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n,a,b,ans=0;
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++){
        int tth=i/10000;
        int th=(i%10000)/1000;
        int h=(i%10000%1000)/100;
        int t=(i%10000%1000%100)/10;
        int o=i%10000%1000%100%10;
        int e=tth+th+h+t+o;
        if(a<=e && e<=b)ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[200100],b[200100];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	vector<int> v;
	for(int i=n;i>=1;i--){
		b[i]=a[i];
		for(int j=2;i*j<=n;j++){
			b[i]^=b[i*j];
		}
		if(b[i]) v.push_back(i);
	}
	printf("%d\n",v.size());
	for(int i=0;i<v.size();i++){
		if(i) putchar(' ');
		printf("%d",v[i]);
	}
	puts("");
	return 0;
}

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;
#define LL long long

LL N,M,K,ans,r,t,a;

string s,f;
int main() {
	cin >> N;
	M = K = 1;
	for (int i = 0; i < N; i++) {
		cin >> t >> a;
		if (M%t != 0) {
			if (K%a != 0) {
				r = max(M / t + 1, K / a + 1);
			}
			else {
				r = max(M / t + 1, K / a);
			}
		}
		else {
			if (K%a != 0) {
				r = max(M / t, K / a + 1);
			}
			else {
				r = max(M / t, K / a);
			}
		}
		M = t*r;
		K = a*r;
	}
	
	cout << M+K<<endl;

	return 0;

}


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

int main() {
  int N;
  cin >> N;
  
  
  int max = 0;
  map<string, int> S;
  for (int i = 0; i < N; i++){
    string s;
    cin >> s;
    int n = S[s] + 1;
    S[s] = n;    
    if(n > max){
      max = n;
    }
  }
  
  vector<string> r;
  for (auto s: S){
    if (s.second == max){
      r.push_back(s.first);
    }
  }
  sort(r.begin(), r.end());
  
  for(auto s: r){
    cout << s << endl;
  }
}



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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



int n, k, a[101010];
void solve(){
	cin >> n >> k;
	int pos = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(a[i] == 1) pos = i;
	}
	
	k--;
	cout << (pos+k-1)/k+(n-1-pos-((k-pos%k)%k) +k-1)/k << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

int main(){

  int H, W; cin >> H >> W;
  
  int check[H][W];
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      check[i][j] = -1;
    }
  }
  
  
  char A[H][W];
  queue <pair<int, int> > que;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cin >> A[i][j];
      if (A[i][j] == '#'){
        check[i][j] = 0;
        que.push(make_pair(i, j));
      }
    }
  }

  int dx[4] = {1, 0, -1, 0};
  int dy[4] = {0, 1, 0, -1};
  
  while (!que.empty()){
    pair<int, int> P = que.front(); que.pop();

    for (int i = 0; i < 4; i++){
      int nx = P.first + dx[i];
      int ny = P.second + dy[i];

      if (0 <= nx && nx < H && 0 <= ny && ny < W && check[nx][ny] == -1){
        que.push(make_pair(nx, ny));
        check[nx][ny] = check[P.first][P.second] + 1;
      }
    }
  }
  
  int ans = 0;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      if (ans < check[i][j]){
        ans = check[i][j];
      }
    }
  }
  cout << ans << endl;
  

  return 0;
}


Measured memory_bytes: 13328
N = int(input())
A = list(map(int, input().split()))

def insertionSort(A, N):
    for k in range(len(A)):
        if k != len(A) - 1:
            print(A[k], end=" ")
        else:
            print(A[k])
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        for k in range(len(A)):
            if k != len(A) - 1:
                print(A[k], end=" ")
            else:
                print(A[k])



insertionSort(A, N)


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

int month[] = {31,29,31,30,31,30,31,31,30,31,30,31};
string date[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};

int main(){
	int M, D;
	while( cin >> M >> D, M ){
		int d = 3;
		for(int i=0; i<M-1; i++ ){
			d += month[i];
		}
		d += D;
		d %= 7;
		cout << date[d] << endl;
	}
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

ll H, W;
vector<vector<ll>> a;

int main(){

    cin >> H >> W;
    a.resize(H+1, vector<ll>(W+1, 0));
    
    rep(h, 1, H+1){
        rep(w, 1, W+1){
            cin >> a[h][w];
        }
    }

    vector<pair<pair<ll, ll>, pair<ll, ll>>> move;
    bool f = false;
    
    rep(h, 1, H+1){
        if(h%2 == 1){
            rep(w, 1, W){
                if(a[h][w]%2 == 1){
                    move.push_back({{h,w},{h,w+1}});
                    a[h][w+1]++;
                }
            }
            if(h != H && a[h][W]%2 == 1){
                move.push_back({{h,W},{h+1,W}});
                a[h+1][W]++;
            }
        }else{
            for(ll w = W; w > 1; w--){
                if(a[h][w]%2 == 1){
                    move.push_back({{h,w},{h,w-1}});
                    a[h][w-1]++;
                }
            }
            if(h != H && a[h][1]%2 == 1){
                move.push_back({{h,1},{h+1,1}});
                a[h+1][1]++;
            }
        }
    }

    cout << move.size() << endl;
    for(auto m : move){
        cout << m.first.first << " " << m.first.second << " ";
        cout << m.second.first << " " << m.second.second << endl;
    }
    return 0;
}

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

#define int long long int 
const int mod=1e9+7;
int32_t main()
{
    int n,k;
    cin>>n>>k;
    int x=n,y=0;
    int make=0,last_make=0;
    for(int i=0;i<k;i++)
    {
        make+=y;
        y++;
        last_make+=x;
        x--;
    }
    int ans=(last_make-make+1)%mod;
      for(int i=k+1;k<=n && make<=last_make;k++)
      {
          make+=y;
          y++;
          last_make+=x;
          x--;
          ans=(ans+(last_make-make+1)%mod)%mod;
      }
      cout<<ans<<endl;
}

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=1e9+7;

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


int main(){
    int N; cin >> N;
    ll ans=0;
    for(int i=1; i<=N; i++){
        ans+=(N-1)/i;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<float>A(n);
  for(int i=0;i<n;i++)
    cin>>A[i];
  sort(A.begin(),A.end());
  float sum=A[0];
  for(int i=1;i<n;i++){
    sum+=A[i];
    sum/=2;
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int ret=0;
	int x,n,y=-1;
	cin>>n;
	while(n--){
		cin>>x;
		ret+=max(x,y)-x;
		y=max(x,y);
	}
	cout <<ret<<endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false); //cin.tie(NULL); cout.tie(NULL)
#define mp make_pair
#define pb push_back
#define fs first
#define sc second

using namespace std;
typedef long long ll;
typedef long double ld;


/* BIEN CUC BO BEGIN*/
	int a, b, c;
/* BIEN CUC BO END*/

void solve(){
	cin >> a >> b >> c;
	cout << (a*b)/2;
}	

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

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,Q = map(int,readline().split())
ABPX = list(map(int,read().split()))
AB = iter(ABPX[:N+N-2])
PX = iter(ABPX[N+N-2:])

graph = [[] for _ in range(N+1)]
for a,b in zip(AB,AB):
    graph[a].append(b)
    graph[b].append(a)

val = [0] * (N+1)
for p,x in zip(PX,PX):
    val[p] += x

from collections import deque
stack = deque([1])

parent = [0] * (N+1)
while stack:
    x = stack.popleft()
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)
        val[y] += val[x]
print(*val[1:])

Measured memory_bytes: 77564
#include<stdio.h>
#include<string.h>


int main()
{
    char a[20], b[20], c[20];
    scanf("%s %s %s", a,b,c);
    int len_a = strlen(a);
    int len_b = strlen(b);
    if((a[len_a-1] == b[0]) && b[len_b-1] == c[0])
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cstdlib>
using namespace std;
long int n,arr[100001],memo[100001],i,ans;

int dp(long int k)
{
	if(k==1)
	{
		ans=0;
		memo[k-1]=ans;
		//cout<<"one";
		return ans;
	}
	else if(k==2)
	{
		ans=abs(arr[k-1]-arr[0]);
		memo[k-1]=ans;
		//cout<<"two";
		return ans;
	}
	else if(memo[k-1]==-1)
	{
		ans=min((abs(arr[k-1]-arr[k-2])+dp(k-1)),(abs(arr[k-1]-arr[k-3])+dp(k-2)));
		memo[k-1]=ans;
		//cout<<"three";
		return ans;
	}
	else
	{
		//cout<<"four";
		ans=memo[k-1];
		return ans;
	}
}
int main()
{
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(i=0;i<n;i++)
		memo[i]=-1;
	cout<<dp(n)<<endl;
}

Measured memory_bytes: 4096
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		
		int[] leadingNum = new int[n];
		
		int index = 0;
		for(int i =0;i<n-1;i++) {
			index = scanner.nextInt();
			leadingNum[index-1]++;
		}
		for (int i : leadingNum) {
			System.out.println(i);
        }
    }

}

Measured memory_bytes: 61492
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <functional>
#include <cassert>
#include <cctype>
#include <string>
#include <sstream>
#include <bitset>
using namespace std;
typedef long long int LL;
const int MAXN = 100000 + 24;
int main() {
#ifdef kirito
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif // kirito
	int n;
	while (~scanf("%d", &n)) {
		vector<int>vec;
		while (n) {
			vec.push_back(n % 10);
			n /= 10;
		}
		bool flag = false;
		for (int i = 0; i <= 1; i++) {
			if (vec[i] == vec[i + 1] && vec[i] == vec[i + 2]) {
				flag = true; break;
			}
		}
		printf(flag ? "Yes\n" : "No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int
main(void)
{
	int x, y, z, a;

	scanf("%d%d%d", &x, &y, &z);
	if (y < x) {
		a = x;
		x = y;
		y = a;
	}
	if (z < x) {
		printf("%d %d %d\n", z, x, y);
	} else if (z < y) {
		printf("%d %d %d\n", x, z, y);
	} else {
		printf("%d %d %d\n", x, y, z);
	}

	return 0;
}


Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> tri(3);
  for(int i = 0;i< 3;i++){
    int a;
    cin >> a;
    tri.at(i) = a;
  }
  sort(tri.begin(), tri.end());
  cout << (tri.at(0)*tri.at(1))/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    cout << min(a, b) << " " << max(0, a+b-n);

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main()
{
    long long n,i,seven=0,rem=0;
    scanf("%lld", &n);
    if(n%2==0) printf("-1");
    else
    {
        for(i=1; i<=1000000; i++)
        {
            seven=seven*10+7;
            seven%=n;
            if(seven==0) {printf("%lld",i); return 0;}
        }
        printf("-1");
    }
}


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

void operation(int*a, int*b){
    int c = *a;
    *a = *b;
    *b = c % *b;    
}

int main(){
    //input
    int a, b;
    cin >> a;
    cin >> b;
    
    //eucleadian algorithm
    //make a greater than b
    if(a < b){
        //change values
        int c = a;
        a = b;
        b = c;
    }
    
    //cout << "input : a = " << a << " b = " << b <<  endl;
    //computation
    while(b>0){
        //cout << " a = " << a << " b = " << b <<  endl;
        operation(&a, &b);
    }
    
    //output
    cout << a << endl;
}

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

using namespace std;

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

   int count=0;
   int answer=0;

   for(int i=0;i<S.size();++i){
      if(S[i]=='A'||S[i]=='T'||S[i]=='G'||S[i]=='C')  count++;
      else count = 0;
      if(count>answer) answer=count;
   }

   cout << answer << endl;

   return 0;

}


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

int N, M, K, A[409], B[409], C[409], pre[20][1 << 19], par[1 << 19][20], ret[20][1 << 19], dp[21][1 << 19], mod = 1000000007;
vector<pair<int, int>>X[20];

int main() {
	cin >> N >> M >> K; N--;
	for (int i = 1; i <= K; i++) {
		cin >> A[i] >> B[i] >> C[i]; A[i]--; B[i]--;
		X[A[i]].push_back(make_pair(B[i], C[i]));
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j < (1 << N); j++) {
			if ((j&(1 << (i - 1))) != 0) continue;
			// 0 : 左に進む
			// 1 : 右に進む
			int L = -1;
			for (int k = i - 2; k >= 0; k--) {
				if ((j&(1 << k)) != 0) { L = k; break; }
			}
			if (L == -1) pre[i][j] = -1;
			else pre[i][j] = (j&((1 << L) - 1)) + (1 << (i - 1));
		}
	}
	for (int i = 0; i < (1 << N); i++) {
		int bit[20]; for (int j = 0; j < N; j++) bit[j] = (i / (1 << j)) % 2;
		for (int j = 0; j <= N; j++) par[i][j] = -1; par[i][0] = 0;
		int cx = 0, R = 0;
		for (int j = 0; j < N; j++) {
			cx += bit[j]; R += bit[j] * (1 << j);
			if (bit[j] == 1) par[i][cx] = R;
		}
	}
	dp[0][0] = 1;
	for (int i = 0; i < M; i++) {
		for (int j = 0; j <= N; j++) { for (int k = 0; k < (1 << N); k++) ret[j][k] = 0; }
		for (int j = 0; j < (1 << N); j++) ret[0][j] = dp[i][j];
		for (int j = 1; j <= N; j++) {
			for (int k = 0; k < (1 << N); k++) {
				ret[j][k] += ret[j - 1][k];
				if ((k&(1 << (j - 1))) == 0) {
					if (pre[j][k] != -1) ret[j][k] += ret[j - 1][pre[j][k] + ((k >> j) << j)];
					if (ret[j][k] >= mod) ret[j][k] -= mod;
				}
			}
		}
		for (int j = 0; j < (1 << N); j++) {
			bool flag = false;
			for (int k = 0; k < X[i].size(); k++) {
				int I = (j / (1 << X[i][k].first)) % 2;
				if (I != X[i][k].second) { flag = true; break; }
			}
			if (flag == true) continue;
			for (int k = 0; k <= N; k++) {
				if (par[j][k] == -1) break;
				dp[i + 1][j] += ret[N][par[j][k]];
				if (dp[i + 1][j] >= mod) dp[i + 1][j] -= mod;
			}
		}
	}
	int sum = 0;
	for (int i = 0; i < (1 << N); i++) {
		sum += dp[M][i]; sum %= mod;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 164224
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    s = input().split(" ")
    if s[0] == "insert":
        a.appendleft(int(s[1]))
    elif s[0] == "delete":
        if int(s[1]) in a:
            a.remove(int(s[1]))
    elif s[0] == "deleteLast":
        a.pop()
    elif s[0] == "deleteFirst":
        a.popleft()
b = list(a)
for i in range(len(b)):
    if i == len(b)-1:
        print(b[i])
    else:
        print(b[i],end=" ")

Measured memory_bytes: 48140
var
x,y:integer;
a,b:char;
begin
readln(x,y);
if x in[1,3,5,7,8,10,12] then a:='a'
  else if x in[4,6,9,11] then a:='b'
                         else a:='c';
if y in[1,3,5,7,8,10,12] then b:='a'
  else if y in[4,6,9,11] then b:='b'
                         else b:='c';
if a=b then writeln('Yes')
       else writeln('No');
end.

Measured memory_bytes: 128
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n;
int dp[22][(1<<22)];
int compat[22][22];
int solve(int compat[][22],int i,int womenSubset,int N){
    if(i==N+1){
        if(womenSubset == 0)
            return 1;
        return 0;
        }
        if(dp[i][womenSubset] != -1){return dp[i][womenSubset];}
        long ans=0;
        for(int women=0;women<N;women++){
            int available = womenSubset & (1<<women) ? 1 : 0;
            if(available && compat[i][women+1]){
                ans = (ans + solve(compat, i+1, womenSubset^(1<<women), N))%1000000007;
            }

        }
        return dp[i][womenSubset] = ans;
}
int32_t main() {
    cin>>n;
    memset(compat,0,sizeof compat);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cin>>compat[i][j];
        }
    }
    memset(dp,-1,sizeof dp);
    cout<<solve(compat, 1, (1<<n)-1, n);
}


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

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> x(n);
  rep(i, n) cin >> x[i];

  ll ans = 1'000'000'000;
  rep(i, n - k + 1) {
    if (x[i + k - 1] < 0) {
      ans = min(ans, -x[i]);
      continue;
    }
    if (0 < x[i]) {
      ans = min(ans, x[i + k - 1]);
      continue;
    }

    if (-x[i] < x[i + k - 1]) {
      ans = min(ans, -2 * x[i] + x[i + k - 1]);
    } else {
      ans = min(ans, -x[i] + 2 * x[i + k - 1]);
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            if (A > B) {
                int temp = A;
                A = B;
                B = temp;
            }
            int C = in.nextInt();
            out.println(A < C && C < B ? "Yes" : "No");
        }

    }
}



Measured memory_bytes: 22868
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
int DBG = 1;										/* デバッグプリント 提出時は0 */
/* main *************************************************************/
int main()
{
	int		a,b,c,i,j,k,n,m,x,y,ans = 0;
	char	s[5];
	int		al[27]={0};

	scanf("%s", s);
	for(i=0;i<4;i++) {
		al[s[i]-'A']++;
	}
	for(i=0;i<27;i++) {
		if ((al[i]!=0)&&(al[i]!=2)) {
			printf("No\n");
			return 0;
		}
	}
		
	printf("Yes\n");

	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main(void){
   int a,b,c,d,r;
   double f;
   scanf("%d %d",&a,&b);
   d=a/b;
   r=a%b;
   f=a/(double)b;
   printf("%d %d %f",d,r,f);
    return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
using namespace std;

const double PI=acos(-1);

int main(){
    int n;
    cin >> n;
    
    vector<int> p(n);
    int min = 99999999, cnt = 0;
    for(int i = 0; i < n; i++){
        cin >> p[i];
        min = std::min(min, p[i]);
        if(min == p[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

typedef long long ll;
using namespace std;

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

	char a[26];
	int c[26];
	for (int i = 0;i < 26;i++){
		a[i] = '*';
		c[i] = 0;
	}	

	string s,t; cin >> s >> t;

	for (int i = 0;i < s.size();i++){
		int sn = s[i] - 'a';
		if(a[sn] == '*'){ 
			a[sn] = t[i];
			c[t[i] - 'a']++;
			if(c[t[i] - 'a'] == 2){
				cout << "No" << endl;
				return 0;
			}
		}else if(a[sn] != t[i]){
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;

}



Measured memory_bytes: 916
from fractions import gcd
A,B=map(int,input().split())
s=set()
x=gcd(A,B)
y=2
while y*y<=x:
  while x%y==0:
    s.add(y)
    x//=y
  y+=1
if x>1:
  s.add(x)
print(len(s)+1)

Measured memory_bytes: 5048
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int c[][]=new int[4][2];
		while(sc.hasNext()){
			double r=sc.nextDouble();
			double l=sc.nextDouble();
			if(r>=1.1){
				c[0][0]++;
			}
			else if(r>=0.6){
				c[1][0]++;
			}
			else if(r>=0.2){
				c[2][0]++;
			}
			else{
				c[3][0]++;
			}
			
			if(l>=1.1){
				c[0][1]++;
			}
			else if(l>=0.6){
				c[1][1]++;
			}
			else if(l>=0.2){
				c[2][1]++;
			}
			else{
				c[3][1]++;
			}
		}
		for(int i=0;i<4;i++){
			for(int j=0;j<2;j++){
				if(j==1) System.out.print(" ");
				System.out.print(c[i][j]);
			}
			System.out.println();
		}
	}
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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


int N, W;
const int MAX_N = 105;
const int MAX_W = 100005;
int w[MAX_N];
ll v[MAX_N];
ll dp[MAX_N][MAX_W];

void solve() {
    cin >> N >> W;
    rep(i, N) cin >> w[i] >> v[i];

    dp[0][0] = 0;
    rep(i, N+1){
        rep(j, W+1){
            if(j-w[i] < 0){
                dp[i+1][j] = dp[i][j];
            }else{
                dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i]);
            }
        }
    }

    cout << dp[N][W] << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 83584
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1000000007;

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
	LL n,m;
	cin >> n >> m;
	
	LL ans = 0;
	if(n*2 < m) {
		ans += n;
		m -= n*2;
		ans += m/4;
	}
	else {
		ans += m/2;
	}

	cout << ans;
}



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

struct RMQ {
	using type = int;
	static type id1() { return INT_MAX; }
	static type id2() { return -1; }
	static type op1(const type& l, const type & r) { return min(l, r); }
	static type op2(const type& l, const type & r) { return r != -1 ? r : l; }
};

template <typename M>
class LazySegmentTree {
	using T = typename M::type;
	using func_t = function<T(T, T)>;
	const int n;
	vector<T> data, lazy;
	int size(int n) {
		int res = 1;
		while (res < n) res <<= 1;
		return res;
	}
	void push(int node) {
		if (lazy[node] == M::id2()) return;
		if (node < n) {
			lazy[node * 2] = M::op2(lazy[node * 2], lazy[node]);
			lazy[node * 2 + 1] = M::op2(lazy[node * 2 + 1], lazy[node]);
		}
		data[node] = M::op2(data[node], lazy[node]);
		lazy[node] = M::id2();
	}
	void suc(int l, int r, int node, int lb, int ub, T val) {
		if (ub <= l || r <= lb) return;
		push(node);
		if (l <= lb && ub <= r) {
			lazy[node] = val;
			return;
		}
		int c = (lb + ub) / 2;
		suc(l, r, node * 2, lb, c, val);
		suc(l, r, node * 2 + 1, c, ub, val);
		data[node] = M::op1(M::op2(data[node * 2], lazy[node * 2]), M::op2(data[node * 2 + 1], lazy[node * 2 + 1]));
	}
	T sub(int l, int r, int node, int lb, int ub) {
		if (ub <= l || r <= lb) return M::id1();
		push(node);
		if (l <= lb && ub <= r) {
			return data[node];
		}
		int c = (lb + ub) / 2;
		return M::op1(sub(l, r, node * 2, lb, c), sub(l, r, node * 2 + 1, c, ub));
	}
public:
	LazySegmentTree(int n_) : n(size(n_)), data(n * 2, M::id1()), lazy(n * 2, M::id2()) {}
	void update(int l, int r, T val) {
		suc(l, r + 1, 1, 0, n, val);
	}
	T find(int l, int r) {
		return sub(l, r + 1, 1, 0, n);
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, q, com, x, y, val;
	cin >> n >> q;
	LazySegmentTree<RMQ> st(n);
	while (q--) {
		cin >> com >> x >> y;
		if (com) {
			printf("%d\n", st.find(x, y));
		}
		else {
			cin >> val;
			st.update(x, y, val);
		}
	}
	return 0;
}

Measured memory_bytes: 4924
using System;

namespace V0019{
    public class Program{
        public static void Main(string[] args){
            var ans = new[]{
                1,
                1,
                2,
                6,
                24,
                120,
                720,
                5040,
                40320,
                362880,
                3628800,
                39916800,
                479001600,
                6227020800,
                87178291200,
                1307674368000,
                20922789888000,
                355687428096000,
                6402373705728000,
                121645100408832000,
                2432902008176640000,
            };
            Console.WriteLine(ans[int.Parse(Console.ReadLine())]);
        }
    }
}

Measured memory_bytes: 9044
import math
mod=10**9+7
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod
def div(a, b):
    return mul(a, pow(b, mod-2,mod))
x,y=map(int,input().split())
x,y=min(x,y),max(x,y)
s=y-x
if (x-s)<0 or 3*((x-s)//3)+2*s!=y:
  print(0)
else:
  a=(x-s)//3
  b=(y-2*s)//3+s
  A=1
  B=1
  C=1
  for i in range(1,a+b+1):
    A*=i
    A%=mod
  for i in range(1,a+1):
    B*=i
    B%=mod
  for i in range(1,b+1):
    C*=i
    C%=mod
  print(div(A,mul(B,C)))

Measured memory_bytes: 9120
#include <iostream>

#include <fstream>

#include <vector>
#include <set>
#include <string>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

#include <algorithm>
#include <iomanip>
#include <cmath>
#include <random>
#include <cstdlib>
#include <ctime>
#include <utility>

using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define F first
#define S second
#define forcin(n, a) for(int i = 0; i < n; ++i) {cin >> a[i];}
#define forcout(n, a) for(int i = 0; i < n; ++i) {cout << a[i] << " ";}
#define PI acos(-1)
#define forup(st, fin) for(int i = st; i < fin; ++i)
#define fordown(st, fin) for(int i = st; i >= fin; --i)
#define reverse_all(v) reverse(v.begin(), v.end())
#define sort_all(v) sort(v.begin(), v.end())
#define sort_allr(v) sort(v.rbegin(), v.rend())

///#define cin in
///#define cout out
///#define int long long

const ll MAXL = 1e18;
const int N = 10005000;

vector<ll> add, h, d;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand(time(NULL));
    int h, w;
    cin >> h >> w;
    vector<vector<int> > v(h + 2, vector<int> (w + 2));
    for (int i = 1; i <= h; ++i) {
        for (int j = 1; j <= w; ++j) {
            char c;
            cin >> c;
            if (c == '#') {
                v[i][j] = 1;
            } else {
                v[i][j] = 0;
            }
        }
    }
    for (int i = 1; i <= h; ++i) {
        for (int j = 1; j <= w; ++j) {
            if (v[i][j]) {
                if (v[i - 1][j] || v[i + 1][j] || v[i][j - 1] || v[i][j + 1]);
                else {
                    cout << "No\n";
                    return 0;
                }
            }
        }
    }
    cout << "Yes\n";
    return 0;
}
/*
 2 1 1
10 15
6 1

3 0 3
10 8
7 11
5 2
 */

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <string>
#include <sstream>
#include <cstdio>
using namespace std;

int main() {
  string s;
  while(getline(cin,s)) {
    stringstream ss;
    ss << s;
    stack<double> st;
    while(ss >> s) {
      if(s=="+") {
	double x=st.top();
	st.pop();
	double y=st.top();
	st.pop();
	st.push(x+y);
      } else if(s=="-") {
	double x=st.top();
	st.pop();
	double y=st.top();
	st.pop();
	st.push(y-x);
      }	else if(s=="/") {
	double x=st.top();
	st.pop();
	double y=st.top();
	st.pop();
	st.push(y/x);
      } else if(s=="*") {
	double x=st.top();
	st.pop();
	double y=st.top();
	st.pop();
	st.push(x*y);
      } else {
	stringstream tt;
	tt << s;
	double x;
	tt >> x;
	st.push(x);
      }
    }
    printf("%.6f\n",st.top());
    st.pop();
  }
  return 0;
}


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

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    if (a < 0 && b > 0) {
        cout << "Zero" << endl;
    }
    else if (a > 0 && b > 0) {
        cout << "Positive" << endl;
    }
    else {
        if (((abs(a)-abs(b))+1)%2) {
            cout << "Negative" << endl;
        }
        else {
            cout << "Positive" << endl;
        }
    }
}


Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {
  val n = StdIn.readInt()
  val d = for(i <- 1 to n)yield{
    val Array(d1,d2,_*) = StdIn.readLine().split(' ').map(_.toInt)
    (d1,d2)
  }

  val ans = d.map(tup => if(tup._1 == tup._2) true else false)
    .scanLeft(0)((sum,b) => if(b) sum + 1 else 0)
    .max >= 3

  print(if (ans) "Yes" else "No")


}







Measured memory_bytes: 54960
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define mod 1000000007
#define inf 9999999999999999ll
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll gcdExtended(ll a, ll b, ll *x, ll *y); 
  
// Function to find modulo inverse of a 
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
    if (g != 1) 
        return -1;
    else
    { 
        // m is added to handle negative x 
        ll res = (x%m + m) % m; 
        return res; 
    } 
} 
  
// C function for extended Euclidean Algorithm 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    // Base Case 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1; // To store results of recursive call 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
  
    // Update x and y using results of recursive 
    // call 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
} 

int main()
{
    fast
    ll n,k;
    cin>>n>>k;
    vi a(n,0);
    for(ll i=0;i<n;i++)
        cin>>a[i];
    sort(a.begin(),a.end());
    ll ans=0;
    ll comb=1;
    for(ll i=k-1;i<n;i++)
    {
        ans+=comb*a[i];
        ans%=mod;
        ans-=comb*a[n-i-1];
        ans+=mod;
        ans%=mod;

        comb = comb*(i+1);
        comb%=mod;
        comb*=modInverse(i+2-k,mod);
        comb%=mod;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 1024
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
 
using ll = long long;
using P = std::pair<ll, ll>;
 
#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
ll pow_mod(ll a, ll b, ll mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  ll x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;



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

  ll x,y;
  std::cin>>x>>y;

  if((x+y)%3!=0){
    std::cout<<0;
    return 0;
  }

  ll cnt=(x+y)/3;

  if(x<cnt||y<cnt){
    std::cout<<0;
    return 0;
  }

  ll ans=1;

  rep(i,0,x-cnt){
    ans=(ans*(x+y-2*cnt-i))%MOD;
    ans=(ans*pow_mod(i+1,MOD-2,MOD))%MOD;
  }

  std::cout<<ans;

  return 0;
}

Measured memory_bytes: 256
L,R = map(int, input().split())
n = 2019
if R-L >= n or L%n == 0 or R%n == 0 or L%n >= R%n:
    print(0)
else:
    L %= n
    R %= n
    numbers = []
    for i in range(R-L):
        for j in range(i+1,R-L+1):
            numbers.append( ((L+i) * (L+j)) % n )
    print(min(numbers))

Measured memory_bytes: 75336
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int a, b, k; cin >> a >> b >> k;
  if(a <= k){
    cout << 0 << " " << max(0LL, b - (k - a)) << endl;
  }else{
    cout << a - k << " " << b << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main () {
	int N, M, sum = 0;
	int T[100000];
	scanf ("%d", &N);
	for (int i=0; i<N; i++) {
		scanf ("%d", T+i);
		sum += T[i];
	}
	scanf ("%d", &M);
	for (int i=0; i<M; i++) {
		int p, x;
		scanf ("%d %d", &p, &x);
		printf ("%d\n", sum - T[p-1] + x);
	}
	return 0;
}

Measured memory_bytes: 128
# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<" :"<<x<<endl;
# define EPS 1e-12
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };

int maxi = 1000000;
int main()
{
	vector<int> a;
	for (int i = 0;; i++)
	{
		int I = pow(2, i);
		if (I > maxi)break;
		for (int j = 0;; j++)
		{
			int J = pow(3, j);
			if (I*J>maxi)break;
			for (int k = 0;; k++)
			{
				int K = pow(5, k);
				a.push_back(I*J*K);
				if (I*J*K > maxi)break;
			}
		}
	}
	sort(ALL(a));
	int m, n;
	while (cin >> m >> n&&(m||n))
	{
		int ans = 0;
		for (auto it = lower_bound(ALL(a), m); *it <= n; it++)ans++;
		cout << ans << endl;
	}
}

Measured memory_bytes: 3308
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    int n; cin >> n;
    string s, t;
    cin >> s >> t;
    string ans;
    rep(i,n){
        ans += s[i];
        ans += t[i];
    }


    cout << ans;
}

Measured memory_bytes: 256