akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    boolean flg = false;
    for(int i = 1; i <= 9; i++) {
      for(int j = 1; j <= 9; j++) {
        if(i*j==n){
          flg = true;
          break;
        }
      }
    }
    System.out.println(flg == true?"Yes":"No");
  }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int ketawa(int n) {
  int ret = 0;
  while (n >= 1) {
    ret += n % 10;
    n /= 10;
  }
  return ret;
}

int main() {
  int n;
  cin >> n;
  int ans = 1e9;
  for (int i = 1; i <= n / 2; i++) {
    ans = min(ans, ketawa(i) + ketawa(n - i));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int n, m;
int a[100010], b[100010];
int q;
int v[100010], d[100010], c[100010];
int color[100010][12];
vector<int> G[100010];

void dfs(int u, int p, int cnt, int dist, int iro){
	if(cnt >= dist) return;
	for(auto v : G[u]) {
		if(v == p) continue;
		if(color[v][dist - cnt - 1] != 0) continue;
		for (int i = dist - cnt - 1; i >= 0; --i) {
			if(color[v][i] == 0)color[v][i] = iro;
			else break;
		}
		
		dfs(v, u, cnt + 1, dist, iro);
	}
}

int main(void) {
	cin >> n >> m;
	rep(i, m) cin >> a[i] >> b[i];
	cin >> q;
	rep(i, q) cin >> v[i] >> d[i] >> c[i];
	rep(i, m) G[a[i]].pb(b[i]), G[b[i]].pb(a[i]);

	for (int i = q - 1; i >= 0; --i) {
		if(color[v[i]][d[i]] != 0) continue;
		for (int j = d[i]; j >= 0; --j) {
			if(color[v[i]][j] == 0) color[v[i]][j] = c[i];
			else break;
		}
		
		dfs(v[i], -1, 0, d[i], c[i]);
	}
	// reps(i, 1, n + 1){rep(j, 12)printf("%d ", color[i][j]); printf("\n");}
	reps(i, 1, n + 1)printf("%d\n", color[i][0]);
	return 0;
}



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

int main() {
  int N,a,b,c,d,e;
  cin >> N ;
  a = N / 1000 ;
  b = (N / 100) % 10;
  c = (N / 10) % 10;
  d = N % 10;
  e = 0;
  if ( a == b ){
	if ( b == c ){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else {
    if ( b == c ){
      if ( c == d ){
        cout << "Yes" <<endl;
      }
      else {
        cout << "No" << endl;
      }
    }
    else{
      cout << "No" << endl;
    }
  }
}

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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define per(i, b) per2(i, 0, b)
#define per2(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define ALL(c) (c).begin(), (c).end()
#define SZ(x) ((int)(x).size())

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

constexpr ll INF = TEN(18);
const int MX = 3010;

ll dp[MX][MX][4];
ll v[MX][MX];

int main() {
    int R, C, K;
    cin >> R >> C >> K;
    rep(i, K) {
        int r, c, val;
        cin >> r >> c >> val;
        --r, --c;
        v[r][c] = val;
    }

    //rep(i, MX) rep(j, MX) rep(k, 4) dp[i][j][k] = -INF;
    dp[0][0][0] = 0;

    rep(i, R) {
        rep(j, C) {
            for (int k = 2; k >= 0; --k) {
              
                    chmax(dp[i][j][k + 1], dp[i][j][k] + v[i][j]);
                
            }
            rep(k, 4) {
                
                   
                        chmax(dp[i + 1][j][0], dp[i][j][k]);
                    
                    
                        chmax(dp[i][j + 1][k], dp[i][j][k]);
                    
                
            }
        }
    }

    ll ans = 0;
    rep(k, 4) chmax(ans, dp[R - 1][C - 1][k]);
    cout << ans << endl;

    return 0;
}


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

long long const MOD = 1000000007LL;

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

    string res = "Good";
    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
    {
        res = "Bad";
    }
    
    cout << res << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
int N;
typedef pair<int, int> P;
vector<P> X;
vector<P> Y;

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

  cin >> N;
  int a;
  rep(i, N){
    cin >> a;
    P p = make_pair(a, i);
    X.push_back(p);
  }
  sort(X.begin(), X.end());

  int s_medi = X[N/2-1].first;
  int b_medi = X[N/2].first;

  rep(i, N){
    if(i<N/2){
      P p = make_pair(X[i].second, b_medi);
      Y.push_back(p);
    } else{
      P p = make_pair(X[i].second, s_medi);
      Y.push_back(p);
    }
  }

  sort(Y.begin(), Y.end());
  rep(i, N){
    cout << Y[i].second << endl;
  }

  return 0;
}

Measured memory_bytes: 5488
#include <iostream>

using namespace std;

int main(){
  int i,j,k,y=0,ch=0;
  string s;
  cin >> s;
  if(s[0]!='A')y=1;
  for(i=2;i<s.size()-1;i++){
    if(s[i]=='C'){
      ch++;
      j=i;
    }
  }
  if(ch!=1)y=1;
  for(i=1;i<s.size();i++){
    if(i!=j)if(s[i]<='Z')y=1;
  }
  if(y==1){
    cout << "WA" << endl;
  }else{
    cout << "AC" << endl;
  }
  return 0;
}


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

using namespace std;

int main()
{
    int n, a;

    cin >> n >> a;

    int rem = n % 500;
    if (rem <= a) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 888
#include<stdio.h>
#define N 100000
#define SENTINEL 2000000000

struct card{
  char suit;
  int value;
};

struct card L[N/2+2],R[N/2+2];

void merge(struct card a[],int n,int l,int mid,int r){
  int i,j,k;
  int n1=mid-l;
  int n2=r-mid;

  for(i=0;i<n1;i++)L[i]=a[l+i];
  for(i=0;i<n2;i++)R[i]=a[mid+i];
  L[n1].value=R[n2].value=SENTINEL;
  i=j=0;
  for(k=l;k<r;k++){
    if(L[i].value<=R[j].value)a[k]=L[i++];
    else a[k]=R[j++];
    
  }

}

void mergeSort(struct card a[],int n,int left,int right){
  int mid;
  if (left+1 < right){
    mid = (left + right)/2;
    mergeSort(a,n, left, mid);
    mergeSort(a,n, mid, right);
    merge(a,n, left, mid, right);
  }
}

int partition(struct card a[],int n,int p,int r){
  int i,j;
  struct card t,x;
  x=a[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(a[j].value<=x.value){
      i++;
      t=a[i];
      a[i]=a[j];
      a[j]=t;
    }
  }
  t=a[i+1];
  a[i+1]=a[r];
  a[r]=t;
  return i+1;
}

void quickSort(struct card A[],int n,int p,int r){
  int q;
  if (p < r){
    q = partition(A,n, p, r);
    quickSort(A,n, p, q-1);
    quickSort(A, n,q+1, r);
  }
}

int main(){
  int n,i,v;
  struct card a[N],b[N];
  char s[10];
  int stable=1;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%d",s,&v);
    a[i].suit=b[i].suit=s[0];
  a[i].value=b[i].value=v;
  }

  mergeSort(a,n,0,n);
  quickSort(b,n,0,n-1);

  for(i=0;i<n;i++)if(a[i].suit!=b[i].suit)stable=0;

  if(stable==1)printf("Stable\n");
  else printf("Not stable\n");
  for(i=0;i<n;i++)printf("%c %d\n",b[i].suit,b[i].value);

  return 0;
  
}



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

int main()
{
    int A,B,C,D,E,F;
    cin>>A>>B>>C>>D>>E>>F;
    int up,s,e,w,n,down;
    cin>>up>>s>>e>>w>>n>>down;
    string st="SSSSRRRRWSSSSRRRRWSSSSRRRRWSSSSRRRRW";
        REP(i,st.size())
        {
            if(A==up&&B==s&&C==e&&D==w&&E==n&&F==down){cout<<"Yes"<<endl;return 0;}
            int temp;
            if(st.at(i)=='S')
            {
                temp=s;
                s=up;
                up=n;
                n=down;
                down=temp;
            }
            if(st.at(i)=='W')
            {
                temp=w;
                w=up;
                up=e;
                e=down;
                down=temp;
            }if(st.at(i)=='R')
            {
                temp=s;
                s=e;
                e=n;
                n=w;
                w=temp;
            }
        }
        cout<<"No"<<endl;
}


Measured memory_bytes: 3220
#include <stdio.h>
#define YEN_1000  1000
#define YEN_5000 5000
#define YEN_10000 10000

int main () {

	int N, Y;
    int total = 0;
	
	scanf("%d%d", &N, &Y);
  
	for(int i = 0; i <= N; i++) {
		for(int j = 0; j + i <= N ; j++) {
          int tmp;
          tmp = N - i - j;
          total = YEN_10000 * i + YEN_5000 * j + YEN_1000 * tmp;
          if(total == Y) {
            printf("%d %d %d", i, j, tmp);
            return 0;
          }
        }
	}
  
	printf("%d %d %d", -1, -1, -1);
}

Measured memory_bytes: 1732
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    for(int i=0;;i++){
      int num = 0;
      String s = sc.next();
      if(s.equals("0")) break;
      for(int j=0;j<s.length();j++){
        num += Character.digit(s.charAt(j), 10);
     }
      System.out.println(num);
    }
  }
}



Measured memory_bytes: 26344
import sys
def input():
    return sys.stdin.readline()[:-1]
N=int(input())
A=list(map(int,input().split()))
y=0
for i in range(N-1):
    y=2*(A[i]-y//2)
l=[None]*N
l[0]=(2*A[-1]-y)//2
for i in range(1,N):
    l[i]=2*(A[i-1]-l[i-1]//2)
print(*l)

Measured memory_bytes: 14092
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		HashSet<Integer> s = new HashSet<Integer>();
		for (int i = 0; i < 3; i++) {
			s.add(sc.nextInt());
		}
		System.out.println(s.size());
	}
}


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

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)
#define forall(it, c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); ++ it)

template <typename T> inline void read(T &x) {
	x = 0; bool f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	for (;  isdigit(c); c = getchar()) x = x * 10 + (c & 15);
	if (!f) x = -x;
}

const int maxn = 3e3 + 5;
const int inf = 0x3f3f3f3f;
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
int n, m;
int a[maxn], b[maxn], c[maxn];
int d[maxn], e[maxn], f[maxn];
int scol[maxn][maxn], srow[maxn][maxn];
bool vis[maxn][maxn];
int que[maxn * maxn * 2 + 5], ql, qr;
vector <int> vx, vy;
bool ok[maxn][maxn][4];

int main() {
	read(n); read(m);
	rep(i, n) read(a[i]), read(b[i]), read(c[i]);
	rep(i, m) read(d[i]), read(e[i]), read(f[i]);
	rep(i, n) vx.pb(a[i]), vx.pb(b[i]), vy.pb(c[i]);
	rep(i, m) vx.pb(d[i]), vy.pb(e[i]), vy.pb(f[i]);
	vx.pb(0); vy.pb(0);
	vx.pb(inf); vy.pb(inf);
	sort(vx.begin(), vx.end());
	vx.erase(unique(vx.begin(), vx.end()), vx.end());
	sort(vy.begin(), vy.end());
	vy.erase(unique(vy.begin(), vy.end()), vy.end());
#define f(v, x) (lower_bound((v).begin(), (v).end(), (x)) - (v).begin())
	rep(i, n) a[i] = f(vx, a[i]), b[i] = f(vx, b[i]), c[i] = f(vy, c[i]);
	rep(i, m) d[i] = f(vx, d[i]), e[i] = f(vy, e[i]), f[i] = f(vy, f[i]);
	int sx = f(vx, 0), sy = f(vy, 0);
	rep(i, n) scol[a[i]][c[i]] ++, scol[b[i]][c[i]] --;
	rep(i, m) srow[d[i]][e[i]] ++, srow[d[i]][f[i]] --;
	rep(i, vx.size()) rep(j, vy.size()) if (i) scol[i][j] += scol[i - 1][j];
	rep(i, vx.size()) rep(j, vy.size()) if (j) srow[i][j] += srow[i][j - 1];
	rep(i, vx.size() - 1) rep(j, vy.size() - 1) {
		// up
		if (srow[i][j]) ok[i][j][0] = 0;
		else ok[i][j][0] = 1;
		// dn
		if (srow[i + 1][j]) ok[i][j][1] = 0;
		else ok[i][j][1] = 1;
		// lft
		if (scol[i][j]) ok[i][j][2] = 0;
		else ok[i][j][2] = 1;
		// rgt
		if (scol[i][j + 1]) ok[i][j][3] = 0;
		else ok[i][j][3] = 1;
	}
//	rep(i, vx.size()) printf("%d ", vx[i]); puts("");
//	rep(i, vy.size()) printf("%d ", vy[i]); puts("");
	vis[sx][sy] = 1; que[qr ++] = sx; que[qr ++] = sy;
	ll ans = 0;
	while (ql < qr) {
		int x = que[ql ++], y = que[ql ++];
//		eprintf("[%d, %d) [%d, %d) rec\n", vx[x], vx[x + 1], vy[y], vy[y + 1]);
		ans += 1LL * (vx[x + 1] - vx[x]) * (vy[y + 1] - vy[y]);
		rep(d, 4) {
			if (!ok[x][y][d]) continue;
			int nx = x + dx[d], ny = y + dy[d];
//			eprintf(" -> %d %d\n", nx, ny);
			if (nx < 0 || ny < 0 || nx >= vx.size() - 1 || ny >= vy.size() - 1) {
				puts("INF"); return 0;
			}
			if (!vis[nx][ny]) {
				vis[nx][ny] = 1; que[qr ++] = nx; que[qr ++] = ny;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 188376
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,ans=0;
  string s;
  cin>>n>>s;
  rep(i,n-2){
    if(s.at(i)=='A' && s.at(i+1)=='B' && s.at(i+2)=='C'){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

//??¨????????????????????????
//n??\????????£??´??°????´???°???????????°???????????????is_prime[]???????´?
void eratos(int n, bool is_prime[]) {
	fill(is_prime, is_prime + n + 1, true);
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i*i <= n; i++)
		if (is_prime[i]) {
			int j = i + i;
			while (j <= n) {
				is_prime[j] = false;
				j = j + i;
			}
		}
}

signed main() {
	bool is_prime[10010] = {};
	eratos(10010, is_prime);
	for (int n; cin >> n&&n;) {
		rrep(i, 0, n + 1) {
			if (is_prime[i] && is_prime[i - 2]) {
				cout << i - 2 << " " << i << endl; break;
			}
		}
	}
	return 0;
}

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

int main(){
  int a, b;
  bool ans = true;
  string s;
  cin >> a >> b >> s;
  for(int i = 0; i < a+b+1; i++){
    if(i == a){
      if(s[i] != '-') ans = false;
    }else{
      ans = false;
      for(char c = '0'; c <= '9'; c++){
        if(s[i] == c) ans = true;
      }
    }
    if(!ans) break;
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

int root(int x, int par[]){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = root(par[x], par);
  }
}

bool same(int x, int y, int par[]){
  return root(x, par) == root(y, par);
}

void unite(int x, int y, int par[]){
  x = root(x, par);
  y = root(y, par);
  if(x == y)return;
  par[x] = y;
}

signed main() {
  int n,m;cin>>n>>m;int p[110000];p[0] = INF;repd(i,1,n+1)cin>>p[i];
  int par[110000];rep(i,110000)par[i] = i;int ans = 0;
  rep(i,m){
    int x,y;cin>>x>>y;
    unite(x,y,par);
  }
  vector<int> roots;
  repd(i,1,n+1)if(par[i] == i)roots.push_back(i);
  sort(roots.begin(), roots.end());
  vector<vector<int>> nodes(roots.size()), nums(roots.size());
  repd(i,1,n+1){
    auto itr = lower_bound(roots.begin(), roots.end(), root(i, par));
    nodes[itr-roots.begin()].push_back(i);
    nums[itr-roots.begin()].push_back(p[i]);
  }
  rep(i,nums.size()){
    sort(nums[i].begin(), nums[i].end());
  }
  rep(i,nodes.size()){
    rep(j,nodes[i].size()){
      ans += (int)binary_search(nums[i].begin(), nums[i].end(), nodes[i][j]);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 12408
a = []
a << [1, 3, 5, 7, 8, 10, 12]
a << [4, 6, 9, 11]
a << [2]
x, y = gets.split.map(&:to_i)
b = []
for c in 0..2
  b[0] = c if a[c].include?(x)
  b[1] = c if a[c].include?(y)
end
if b[0] == b[1]
  puts "Yes"
  exit
else
  puts "No"
  exit
end


Measured memory_bytes: 1788
function Main(input){
  input=input.split("\n");
  num = input[0];
  var a = input[1].split(" ");
  a.sort(function(a,b){
    return parseInt(a,10) - parseInt(b,10);
  });
  for(var n = 0; n < num-1; n++){
    if(a[n]===a[n+1]){
      console.log("NO");
      return;
    }
  }
  console.log("YES");
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 34076
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <map>
 
using namespace std;
typedef long long ll;

int check(int n){
	int ans=0;
	while(n>0){
		n /= 10;
		ans++;
	
	}
	return ans;
}
int main(){
	int n;
	cin>>n;
	int ans=0;
	for(int i = 1; i <= n; i++){
		int flag = check(i);
		if(flag % 2!=0) ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
s=raw_input()
sa=0
sb=0
sc=0
for i in range(len(s)):
  if s[i]=="a":
    sa+=1
  if s[i]=="b":
    sb+=1
  if s[i]=="c":
    sc+=1
if sa==1 and sb==1 and sc==1:
    print "Yes"
else: 
    print "No"

Measured memory_bytes: 2568
N = int(input())

ans = 0

if N == 1:
    print(1)
    exit()
if N == 2:
    print(5)
    exit()
if N == 3:
    print(11)
    exit()

for i in range(1, N//2+2):
    last = N//i
    ans += ((1+last) * last // 2 * i)

ans += (N//2+2 + N) * (N - N//2 - 1) // 2

print(ans)

Measured memory_bytes: 63368
import sys

m = 1000000

k, x = [ int(x) for x in sys.stdin.readline().split() ]

i = max(-m,x-k+1)
j = min( m,x+k-1)
for i in range(i,j+1):
    if i<j: print( i,end=" ")
    else: print(i)


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

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

    ll ans = 0;
    rep(a,k+1)rep(b,k+1)rep(c,k+1) ans += gcd(a,gcd(b,c));
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
#define ll long long
using namespace std;
char a[200010],b[200010];
int ans,l;
int main()
{
    scanf("%s%s",a,b);
    int l=strlen(a);
    for(int i=0;i<l;i++)
    {
        if(a[i]!=b[i])
        {
            ans++;
        }
    }
    printf("%d",ans);
}


Measured memory_bytes: 4196
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var input = StrStdin(1)

	N, _ := strconv.Atoi(input[0][0])

	// var N int
	// fmt.Scanf("%d", &N)

	var fizz int = N / 3
	var bazz int = N / 5
	var fizzbazz int = N / 15

	var sum int = (1 + N) * N / 2
	var sumF int = 3 * (1 + fizz) * fizz / 2
	var sumB int = 5 * (1 + bazz) * bazz / 2
	var sumFB int = 15 * (1 + fizzbazz) * fizzbazz / 2

	fmt.Println(sum - sumF - sumB + sumFB)
}

func StrStdin(num int) [][]string {
	var stringInput [][]string
	scanner := bufio.NewScanner(os.Stdin)

	for i := 0; i < num; i++ {
		scanner.Scan()
		if s := scanner.Text(); s != "" {
			stringInput = append(stringInput, strings.Split(strings.TrimSpace((scanner.Text())), " "))
		} else {
			break
		}
	}

	return stringInput
}


Measured memory_bytes: 1756
'''
Created on 2020/08/29

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  A,B,N=map(int,pin().split())
  x=min(B-1,N)
  ans=int(A*x/B)-A*int(x/B)
  print(ans)
  return
main()
#解説AC

Measured memory_bytes: 9080
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <climits>

using namespace std;
#define ll long long
#define ve vector
#define umap unordered_map

int main() {
    int w1, h1, n;
    cin>>w1>>h1>>n;
    int sw=0,sh=0,sx=0,sy=0;
    int w=w1,h=h1;
    while(n--) {
        int x,y,a;cin>>x>>y>>a;
        x-=sx; y-=sy;
        w=w1-sw; h=h1-sh;
        if(a==1) {
            if(x<0) continue;
            if(x>w) {
                cout<<0<<endl;
                return 0;
            }
            sw+=x;
            sx+=x;
        } else if(a==2) {
            if(x>w) continue;
            if(x<0) {
                cout<<0<<endl;
                return 0;
            }
            sw+=(w-x);
        } else if(a==3) {
            if(y<0) continue;
            if(y>h) {
                cout<<0<<endl;
                return 0;
            }
            sh+=y;
            sy+=y;
        } else if(a==4) {
            if(y>h) continue;
            if(y<0) {
                cout<<0<<endl;
                return 0;
            }
            sh+=(h-y);
        }
    }
    w=w1-sw; h=h1-sh;
    cout<<w*h<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int H, W, h, w;
	scanf("%d %d", &H, &W);
	scanf("%d %d", &h, &w);
	printf("%d\n", H * W - h * W - w * H + h * w);
	fflush(stdout);
	return 0;
}

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

int main()
{
	int H, W;
	while (true) {
		cin >> H >> W;
		if ((H == 0) && (W == 0))break;
		for (int i = 1; i <= H; i++) {
			for (int j = 1; j <= W; j++) cout << "#";
			cout << endl;
		}
		cout << endl;
	}
	
}


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

int main()
{
    string s;
    long N,d;
    d = 0;
    cin>>N>>s;
    for (long i = 0; i <= N-2; i++)
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C')
            d++;
    cout<<d;
    return 0;
}

Measured memory_bytes: 256
solver2::Int->Int
solver2 n = (sum.(map (\ i -> (div n i) - 1)).(filter (\ i -> (mod n i  == 0) && (div n i) > (i+1) )).(takeWhile (\i -> i^2 <= n))) [1..]

main::IO()
main=do
  n<-return.read=<<getLine
  print (solver2 n)

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

int main() {
	int n; scanf("%d", &n);
	
	int A[2][n];
	for (int row = 0; row < 2; ++row) {
		for (int col = 0; col < n; ++col) {
			int a; scanf("%d", &a);

			if (row > 0 && col > 0) a += max(A[row - 1][col], A[row][col - 1]);
			else if (row > 0) a += A[row - 1][col];
			else if (col > 0) a += A[row][col - 1];

			A[row][col] = a;
		}
	}
	
	printf("%d\n", A[1][n - 1]);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int time = sc.nextInt();

		if(0<=time && time<=86400){
			int hours = time/3600;
			int minutes = (time/60)-hours*60;
			int seconds = (time%3600) - minutes*60;
			System.out.println(hours + ":" + minutes + ":" + seconds);
		}



		sc.close();
	}

}

Measured memory_bytes: 26100
#include <bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(NULL);
    cout.tie(NULL);
    ios_base::sync_with_stdio(false);
    int n,d;
    cin>>n>>d;
    vector<int> x(n),y(n);
    for(int i=0;i<n;i++)
    {
		cin>>x[i]>>y[i];
    }
    int count=0;
    for(int i=0;i<n;i++)
    {
		double dis = sqrt(pow(x[i],2) +pow(y[i],2));
		if(dis<=d)
		{
			count++;
		}
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 4772
#include<bits/stdc++.h>
using namespace std;
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define dbg(x) cerr<<#x" = "<<x<<endl
#define rep(i,a,b) for(register int i=(a),i##_end=(b);i<=i##_end;++i)
#define per(i,a,b) for(register int i=(a),i##_st=(b);i>=i##_st;--i)
#define rpg(i,x) for(register int i=fir[x];i;i=e[i].nxt)
#define ull unsigned long long
#define fi first
#define se second
#define pb push_back
#define bin(i) (1<<i)
#define cla(x) memset(x,0,sizeof x)
#define meminf(x) memset(x,127,sizeof x)
typedef pair<int,int> pa;
typedef long long LL;
const int INF = 0x7fffffff;
const int oo = 0x3f3f3f3f;
inline char nc()
{
    static char buf[100000],*p1=buf,*p2=buf;
    if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) return EOF; }
    return *p1++;
}
//#define  getchar() nc()
int a,b,c,d,s1,s2,s3,s4; 
inline int rd()
{
    int x = 0 , f = 1; char CH = getchar();
    while(CH<'0'||CH>'9') {if(CH=='-')f=0;CH=getchar();}
    while(CH>='0'&&CH<='9') {x=(x<<3)+(x<<1)+(CH-48);CH=getchar();}
    return f ? x : -x;
}
inline int work(int x,int op)
{
	if(op==1)	return x;
	if(op==2)	return -x;
}
int main()
{
	char ss[55]; scanf("%s",ss);
	a=ss[0]-'0',b=ss[1]-'0',c=ss[2]-'0',d=ss[3]-'0';
	rep(i,1,2)
		rep(j,1,2)
			rep(k,1,2) {
				s1=s2=s3=s4=0;
				s1=a;
				s2=(s1+work(b,i));
				s3=(s2+work(c,j));
				s4=(s3+work(d,k));
				if(s4==7)
				{
					cout<<a;
					if(i==1)cout<<"+";else cout<<"-";
					cout<<b;
					if(j==1)cout<<"+";else cout<<"-";
					cout<<c;
					if(k==1)cout<<"+";else cout<<"-";
					cout<<d<<"=7";
					cout<<endl;
					return 0;
				}
			}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e9
#define MOD 1000000007
typedef long long ll;
//------------------------------------------------------------------------

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

  string s; cin >> s;
  string t = s;
  reverse(all(t));
  bool flag = false;
  if(s==t) flag = true;


  string ss = s.substr(0,(s.size()-1)/2);
  string tt = ss;
  reverse(all(tt));
  bool flag2 = false;
  if(ss==tt) flag2 = true;

  string sss = s.substr((s.size()+3)/2-1,(s.size()+1-(s.size()+3)/2));
  string ttt = sss;
  reverse(all(ttt));
  bool flag3 = false;
  if(sss==ttt) flag3 = true;

  if(flag && flag2 && flag3) cout << "Yes" << endl;
  else cout << "No" << endl;

  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair < int, int > pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 100005;

vector < pii > adj[MAXN];
int siz[MAXN], n, cg, cg2, best, par[MAXN], g[MAXN];
LL ans;

inline void Dfs(int x, int p = 0)
{
	siz[x] = 1;
	for (auto e : adj[x])
		if (e.xx ^ p)
			par[e.xx] = x, Dfs(e.xx, x), siz[x] += siz[e.xx], ans += 2LL * e.yy * min(siz[e.xx], n - siz[e.xx]), g[x] = max(g[x], siz[e.xx]);
	g[x] = max(g[x], n - siz[x]);
	best = min(best, g[x]);
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	best = n = Read();
	for (int i = 1, x, y, w; i < n; i ++)
		x = Read(), y = Read(), w = Read(), adj[x].pb(mp(y, w)), adj[y].pb(mp(x, w));
	Dfs(1);
	for (int i = 1; i <= n; i ++)
		if (g[i] == best)
			if (cg)
				cg2 = i;
			else
				cg = i;
	if (cg2)
	{
		for (auto e : adj[cg])
			if (e.xx == cg2)
				ans -= e.yy;
	}
	else
	{
		int mn = 1 << 30;
		for (auto e : adj[cg])
			mn = min(mn, e.yy);
		ans -= mn;
	}

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


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

template<class T> class BIT {
  public:
    vector<T> bit;
    int size;

    BIT() {}
    BIT(int n, T v = 0) {
        size = n;
        bit.resize(size + 1, v);
    }

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

    // sum [i, j)
    T sum(int i, int j) {
        return sum(j) - sum(i);
    }

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

int main(void) {
    int n, q;
    cin >> n >> q;
    BIT<int> a(n);
    for (int i = 0; i < q; i++) {
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0) a.add(x - 1, y);
        else 
            cout << a.sum(x - 1, y) << endl;
    }
    return 0;
}

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

int main() {
    int n;
    string s;
    cin >> s;
    n = s.size();
    vector<int> ans(n);
    for(int ri=0; ri<2; ri++) {
        { // solve R
        int cnt = 0;
        for(int i=0; i<n; i++) {
            if (s[i] == 'R') cnt++;
            else {
            ans[i] += cnt/2;
            ans[i-1] += (cnt+1)/2;
            cnt = 0;
            }
        }
        }

        reverse(ans.begin(), ans.end());
        reverse(s.begin(), s.end());
        for(int i=0; i<n; i++){
        if (s[i] == 'L') s[i] = 'R';
        else s[i] = 'L';
        }
    }

    for(int i=0; i<n; i++){
        cout << ans[i] << ' ';
    }
    return 0;
}

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

using namespace std;

int main() {

    int A, B, C;
    int X;
    int ans = 0;
    const int FIFTY = 50;
    const int HUNDRED = 100;
    const int FIVE_HUNDRED = 500;

    cin >> A >> B >> C;
    cin >> X;
    int sum;

    for (int i = 0; i <= A; i++) {
        for (int j = 0; j <= B; j++) {
            for (int k = 0; k <= C; k++) {
                sum = FIVE_HUNDRED * i + HUNDRED * j + FIFTY * k;
                if(sum == X) {
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,M; cin >> N >> M;
    vector<int> d(N);
    for(int i = 0; i < N; i++){
        cin >> d.at(i);
    }
    
    set<int> s;
    for(int i = 0; i < M; i++){
        int a,b; cin >> a >> b;
        if(d.at(a-1) < d.at(b-1)) s.insert(a);
        else if(d.at(a-1) > d.at(b-1)) s.insert(b);
        else if(d.at(a-1) == d.at(b-1)){
            s.insert(a);
            s.insert(b);
        }
    }
    cout << N - s.size() << endl;
    return 0;
}

Measured memory_bytes: 6428
n, m = map(int, input().split())
stairs = [1]*(n+1)
for _ in range(m):
  stairs[int(input())] = -1

flg = False
for i in range(2,n+1):
  if stairs[i]==-1:
    pass
  elif stairs[i-1]==-1 and stairs[i-2]==-1:
    flg=True
    break
  elif stairs[i-1]==-1:
    stairs[i] = stairs[i-2]
  elif stairs[i-2]==-1:
    stairs[i] = stairs[i-1]
  else:
    stairs[i] = stairs[i-1] + stairs[i-2]
if flg:
  print(0)
else:
  print(stairs[-1]%1000000007)

Measured memory_bytes: 465928
#include<bits/stdc++.h>
using namespace std;
template<typename T> ostream& operator<<(ostream& os, vector<T> a){os<<"( ";for(T &x:a)os<<x<<" ";os<<")\n";return os;}
template<typename T> ostream& operator<<(ostream& os, set<T> a){os<<"( ";for(T x:a)os<<x<<" ";os<<")\n";return os;}
template<typename T> ostream& operator<<(ostream& os, pair<T,T> a){os<<"("<<a.first<<" "<<a.second<<") ";return os;}
template<typename T> ostream& operator<<(ostream& os, complex<T> a){os<<"(r="<<a.real()<<" i="<<a.imag()<<") ";return os;}
typedef long long ll;
typedef double dd;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<vi> vvi;
#define all(a) a.begin(),a.end()
#define DEBUG 1
#define debug(a) if(DEBUG)cout<<#a<<" = "<<a<<endl
#define x first
#define y second
//===========================Head=========================//

int main(int argc,char** argv){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int R;
    cin>>R;
    if (R<1200) cout<<"ABC"; else
    if (R<2800) cout<<"ARC"; else
    cout<<"AGC";
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	x, c, a := input()
	ans := calc(x, c, a)
	output(ans)
}

func calc(x int, c []int, a [][]int) int {
	min := -1
	perm := makeArray(len(c))
	for _, v := range perm {
		t := isFill(x, c, a, v)
		if min == -1 {
			min = t
		} else if t != -1 && t < min {
			min = t
		}
	}
	return min
}

func makeArray(n int) [][]int {
	p := make([][]int, pow2(n), pow2(n))
	for i := range p {
		p[i] = make([]int, n, n)
		d := i
		for k := n - 1; k >= 0; k-- {
			p[i][k] = d % 2
			d /= 2
		}
	}
	return p
}

func pow2(n int) int {
	s := 1
	for i := 0; i < n; i++ {
		s *= 2
	}
	return s
}

func isFill(x int, c []int, a [][]int, p []int) int {
	collect := make([]int, len(a[0]), cap(a[0]))
	for k, v := range p {
		if v == 0 {
			continue
		}
		for i := 0; i < len(a[0]); i++ {
			collect[i] += a[k][i]
		}
	}
	if isFilled(x, collect) {
		s := 0
		for k, v := range p {
			if v == 0 {
				continue
			}
			s += c[k]
		}
		return s
	}
	return -1
}

func isFilled(x int, c []int) bool {
	for _, v := range c {
		if v < x {
			return false
		}
	}
	return true
}

func output(ans int) {
	fmt.Println(ans)
}

func input() (int, []int, [][]int) {
	var n, m, x int
	fmt.Scan(&n, &m, &x)
	c := make([]int, n, n)
	a := make([][]int, n, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&c[i])
		a[i] = make([]int, m, m)
		for k := 0; k < m; k++ {
			fmt.Scan(&a[i][k])
		}
	}
	return x, c, a
}


Measured memory_bytes: 2724
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  N = 1e6 + 5;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	ll t=n;
	set<ll> s;
	map<ll,ll> M;
	for(ll i=2;1ll*i*i<=t && t!=1;i++){
		if(t%i==0){
			s.insert(i);
			while(t%i==0) t/=i,M[i]++;
		}
	}
	ll ans=0;
	for(auto c:s){
		int j=1;
		while(M[c]-j>=0) {
			ans++;
			M[c]-=j;
			j++;
		}
	}
	if(t!=1) ans++;
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>

using namespace std;
const int maxn = 102;

int d[maxn];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; ++i)
		cin >> d[i];

	for (int i = 0; i < n-1; ++i)
		for (int j = 0; j < n-i-1; ++j)
			if (d[j] > d[j+1]) {
				int tmp = d[j];
				d[j] = d[j+1];
				d[j+1] = tmp;
			}

	int res = 0;
	for (int i = 0; i < n; ++i) {
		m -= d[i];
		if (m < 0)
			break;

		if (i == n-1 && m != 0)
			break;

		res++;
	}

	printf("%d\n", res);

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a>=13){
		printf("%d\n",b);
	}
	else if(6 <= a && a<= 12){
		printf("%d\n",b/2);
	}
	else{
		printf("%d\n",0);
	}
	return 0;
}

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

using namespace std;

int c[200005];

string s[200005];

int main()
{
    string str;
    int n,a=0,b=1;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>s[i];
    }

    sort(s,s+n);

    str=s[0];
    for(int i=1; i<n; i++)
    {
        if(s[i]!=str)
        {
            str=s[i];
            c[a]=b;
            a++;
            b=1;
        }
        else
        {
            b++;
        }
    }
    c[a]=b;
    sort(c,c+a+1);


    int y=c[a],k=1;

    if(y==1)
    {
        cout<<s[0]<<endl;
    }
    for(int i=1; i<n; i++)
    {
        if(s[i-1]==s[i])
        {
            k++;
        }
        else
        {
            k=1;
        }
        if(k==y)
        {
            cout<<s[i]<<endl;
        }
    }

    return 0;
}

Measured memory_bytes: 10628
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
 
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
-- end of templete

f l a b c d = l - max (div (a+c-1) c) (div (b+d-1) d)

main = f <$> getInt <*> getInt <*> getInt <*> getInt <*> getInt >>= print

Measured memory_bytes: 3692
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    S = input()
    if S[2]==S[3] and S[4] == S[5]:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import java.util.*;
import java.io.*;

import static java.lang.System.in;

public class Main {
    static int[][] board;
    static boolean [][] vis;
    static int[] dx = new int[]{1,0,-1,0}, dy = new int[]{0,1,0,-1};
    static int H,W;
    public static void main(String[] args)throws IOException{
        Scanner sc = new Scanner(System.in);
        H = sc.nextInt(); W = sc.nextInt();
        vis = new boolean[H][W];
        board = new int[H][W];
        for(int i=0;i<H;i++){
            String cur = sc.next();
            for(int j=0;j<W;j++) {
                board[i][j] = cur.charAt(j)=='#'?1:0;
            }
        }
        long ans = 0;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(vis[i][j]||board[i][j]==0) continue;
                int total =1,white=0;
                for(int k=0;k<4;k++){
                    int r=i+dx[k],c=j+dy[k];
                    if(r>=0&&r<H&&c>=0&&c<W&&!vis[r][c]&&board[i][j]!=board[r][c]){
                        vis[i][j] = true;
                        int[] cur = dfs(i,j,r,c);
                        total += cur[0];
                        white += cur[1];
                    }
                }
                ans += ((long)(total-white))*((long)white);
            }
        }

        System.out.println(ans);
    }
    static int[] dfs(int fromR, int fromC, int row, int col){
        vis[row][col] = true;
        int tot=1;
        int white = 1-board[row][col];
        for(int k=0;k<4;k++){
            int r = row+dx[k], c = col+dy[k];
            if(r==fromR&&c==fromC) continue;
            if(r>=0&&r<H&&c>=0&&c<W&&!vis[r][c]&&board[row][col]!=board[r][c]){
                int[] cur = dfs(row,col,r,c);
                tot += cur[0];white += cur[1];
            }
        }
        return new int[]{tot,white};
    }
}


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

const string YES = "Yes";
const string NO = "No";

void solve(std::vector<std::vector<long long>> A, long long N,
           std::vector<long long> b)
{
    // table
    bool flag[3][3] = {false};
    string ans = "No";

    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            for (int k = 0; k < N; k++)
            {
                if (A[i][j] == b[k])
                    flag[i][j] = true;
            }
        }
    }

    // check
    for (int i = 0; i < 3; i++)
    {
        if (flag[i][0] && flag[i][1] && flag[i][2])
        {
            ans = "Yes";
        }
        if (flag[0][i] && flag[1][i] && flag[2][i])
        {
            ans = "Yes";
        }
    }
    if (flag[0][0] && flag[1][1] && flag[2][2])
    {
        ans = "Yes";
    }
    if (flag[0][2] && flag[1][1] && flag[2][0])
    {
        ans = "Yes";
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main()
{
    std::vector<std::vector<long long>> A(3, std::vector<long long>(3));
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            scanf("%lld", &A[i][j]);
        }
    }
    long long N;
    scanf("%lld", &N);
    std::vector<long long> b(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &b[i]);
    }
    solve(std::move(A), N, std::move(b));
    return 0;
}


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

int main() {
	int N;
	cin >> N;
	int d = 10;
	int count = 0;
	while (d <= N) {
		count += d * 9 / 10;
		d *= 100;
	}
	int i = N - d / 10 + 1;
	if (i > 0) count += i;
	cout << count << endl;
}

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

int main(){
    int n;
    cin >> n;
    ve<int> a(n),b(n+1);
    rep(i,n){
        cin >> a[i];
        b[a[i]] = (int)i;
    }
    ll ans = 0;
    set<int> s;
    s.insert(b[n]);
    s.insert(b[n-1]);
    ans += (ll)(n-1) * (1+*s.begin()) * (n-*next(s.begin()));
    s.insert(-1);
    s.insert(n);
    for (int i = n-2; i>0; i--) {
        int x = b[i];
        auto it = s.upper_bound(x);
        int y,z,w;
        y = *it;
        z = *prev(it);
        if(it != prev(s.end())){
            w = *next(it);
            ans += (ll)i * (x-z) * (w - y);
        }
        auto it2 = prev(it);
        if(it2 != s.begin()){
            ans += (ll)i * (z - *prev(it2)) * (y - x);
        }
        s.insert(x);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8720
x=int(input())
if x<600:
    print("8")
elif x<800:
    print("7")
elif x<1000:
    print("6")
elif x<1200:
    print("5")
elif x<1400:
    print("4")
elif x<1600:
    print("3")
elif x<1800:
    print("2")
else:
    print("1")


Measured memory_bytes: 61620
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1001001001;

int main(){
    int n, k; cin >> n >> k;
    vector<int> a(n);
    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    set<int> divisors;
    for(int i = 1; i*i <= sum; i++){
        if(sum % i == 0){
            divisors.insert(i);
            divisors.insert(sum/i);
        }
    }
    int ans = 1;
    for(auto x: divisors){
        vector<int> rem(n);
        for(int i = 0; i < n; i++) rem[i] = a[i] % x;
        sort(rem.begin(), rem.end());
        int tot = 0;
        for(int i = 0; i < n; i++) tot += rem[i];
        int idx = n - tot / x;
        int tmp = 0;
        for(int i = 0; i < idx; i++){
            tmp += rem[i];
        }
        if(tmp <= k) ans = max(ans, x);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3580
#include <stdio.h>

int main(int argc, char const *argv[])
{
	int N,c = 0;
	long H,W,A[1000],B[1000];
	scanf("%d%ld%ld",&N,&H,&W);
	for (int i = 0; i < N; ++i){
		scanf(" %ld%ld",&A[i],&B[i]);
		if(H <= A[i] && W <= B[i])	++c;
	}
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 128