akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef double          D;
typedef long long int   LL;
typedef long double     LD;
#define OR              ||
#define AND             &&
#define nl              '\n'
#define S               string
#define inf             INT_MAX
#define SQR(a)          (a) * (a)
#define pb              push_back
#define GCD(a, b)       __gcd(a, b)
#define PI              2.0*acos(0.0)
#define pii             pair<int,int>
#define pll             pair<long long,long long>
#define LCM(a, b)       (a * b) / GCD(a, b)
#define mem(a,b)        memset(a,b,sizeof(a))
#define srtv(v)         sort(v.begin(),v.end())
#define T               int t; cin>>t; while(t--)
#define Rep(i,a,b)      for(int i = a; i <= b; i++)
#define rep(i,a,b)      for(int i = a; i >= b; i--)
#define boost           ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inout           freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)

#define si(x)           scanf("%d",&x)
#define pi(x)           printf("%d",x)
#define ss(str)         scanf("%s",str)
#define pl(x)           printf("%lld",x)
#define sl(x)           scanf("%lld",&x)
#define sii(x,y)        scanf("%d %d",&x,&y)
#define sll(x,y)        scanf("%lld %lld",&x,&y)
#define siii(x,y,z)     scanf("%d %d %d",&x,&y,&z)
#define slll(x,y,z)     scanf("%lld %lld %lld",&x,&y,&z)
using namespace std;

/*
int bs(int l,int r,int n)
{
    int mid,res=inf;

    while(l<=r)
    {
        mid=l+(r-l)/2;

        if(check(mid,n))
        {
            r=mid-1;
            res=min(res,mid);
        }
        else
            l=mid+1;

    }

    return res;
}
*/


//--------------------------code starts here---------------------------------------

//int a[100005];

int main()
{

    int n;
    cin>>n;

    S s="ACL";

    Rep(i,1,n)
    {
        cout<<s;
    }


    return 0;
}


Measured memory_bytes: 3612
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < k; i++)
typedef long long ll;
typedef pair<int,int> Pii;
int main(){
	int n;
	while(scanf("%d",&n),n){
		string str;
		cin >> str;
		int mem[12]={0};
		int ba = 0;
		int index = 0;
		while(index < str.size()){
			int player = index % n;
			if(str[index] == 'S'){
				mem[player]++;
				ba += mem[player];
				mem[player] = 0;
			}
			else if(str[index] == 'L'){
				mem[player]++;
				mem[player] += ba;
				ba = 0;
			}
			else {
				mem[player]++;
			}
			index++;
		}
		sort(mem,mem+n);
		rep(i,n){
			printf("%d ",mem[i]);
		}
		printf("%d\n",ba);	
	}
	return 0;
}

Measured memory_bytes: 1248
#include<stdio.h>
main() {
	int a, b, c, d, e;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	scanf("%d", &d);
	if (a > b) {
		e = b;
	}
	else if (a < b) {
		e = a;
	}
	else {
		e = a;
	}
	if (c > d) {
		e = e + d;
	}
	else if (c < d) {
		e = e + c;
	}
	else {
		e = e + c;
	}
	printf("%d", e);
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int i;
	int n, x;

	scanf("%d", &n);
	
	for (i = 1; i <= n; i++){
		if (i % 3 == 0){
			printf(" %d", i);
		}
		else {
			x = i;
			while (x > 0){
				if (x % 10 == 3){
					printf(" %d", i);
					break;
				}
				x /= 10;
			}
		}
	}
	printf("\n");
	
	return (0);
}



Measured memory_bytes: 2036
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <limits>
#include <utility>
#include <algorithm>

typedef long long ll;

template<typename T>
T gcd(T a, T b)
{
    if (a < b) {
        std::swap(a, b);
    }
    
    return b ? gcd(b, a % b) : a;
}

int main(int argc, char *argv[])
{
    ll k;
    ll sum = 0;

    std::cin >> k;

    for(int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                sum += gcd<int>(a, gcd<int>(b, c));
            }
        }
    }

    std::cout << sum << std::endl;

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


int main() {
	string s; cin >> s;
	string t; cin >> t;
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == t[i])cnt++;
	}
	cout << cnt << endl;




	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl
#define dv(name, value) cerr << (name) << " is " << (value) << endl
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl


void solve(long long A, long long B){
  cout << 6 - A - B << endl;
}

signed main(){
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  solve(A, B);
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
constexpr ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
struct mint{
    using ull=unsigned long long int;
    ull v;
    mint(ll vv=0){s(vv%mod+mod);}
    mint& s(ull vv){
        v=vv<mod?vv:vv-mod;
        return *this;
    }
    //オーバーロード
    mint operator-()const{return mint()-*this;}//符号反転
    mint&operator+=(const mint&val){return s(v+val.v);}
    mint&operator-=(const mint&val){return s(v+mod-val.v);}
    mint&operator*=(const mint&val){
        v=ull(v)*val.v%mod;
        return *this;
    }
    mint&operator/=(const mint&val){return *this*=val.inv();}
    mint operator+(const mint&val){return mint(*this)+=val;}
    mint operator-(const mint&val){return mint(*this)-=val;}
    mint operator*(const mint&val){return mint(*this)*=val;}
    mint operator/(const mint&val){return mint(*this)/=val;}
    mint pow(ll n)const{
        mint res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1;
        }
        return res;
    }
     mint inv()const{return pow(mod-2);}
    //拡張ユークリッドの互除法
    /* mint inv()const{
        int x,y;
        int g=extgcd(v,mod,x,y);
        assert(g==1);
        if(x<0)x+=mod;
        return mint(x);
    }*/
    friend ostream& operator<<(ostream&os,const mint&val){
        return os<<val.v;
    }//出力
    bool operator<(const mint&val)const{return v<val.v;}
    bool operator==(const mint&val)const{return v==val.v;}
    bool operator>(const mint&val)const{return v>val.v;}
};
ll n;//n項前のフィボナッチ数列　O(n^3 log k)
vector<mint> matmul(vector<mint> &dp,vector<vector<mint>> &mat){
    vector<mint> res(n,0);
    for(int i=0;i<n;i++)for(int j=0;j<n;j++)res[i]+=mat[i][j]*dp[j];
    return res;
}
vector<vector<mint>> update(vector<vector<mint>> &mat){
    vector<vector<mint>> res(n,vector<mint>(n,0));
    for(int i=0;i<n;i++)for(int j=0;j<n;j++)for(int k=0;k<n;k++)res[i][j]+=mat[i][k]*mat[k][j];
    return res;
}
void matpow(vector<mint> &dp,vector<vector<mint>> &mat,ll k){
    while(k){
        if(k&1)dp=matmul(dp,mat);
        mat=update(mat);
        k>>=1;
    }
}
int main(){
cin>>n;
ll k;
cin>>k;
V<V<mint>> mat(n,V<mint>(n));
V<mint> dp(n,1);
for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        int a;cin>>a;
        mat[i][j]=mint(a);
    }
}
matpow(dp,mat,k);
mint ans=0;
for(int i=0;i<n;i++)ans+=dp[i];
cout<<ans<<"\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vvll vector<vll>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define pii pair<int, int>
#define vpli vector<pair<long long, int>>
#define deb(x) cout << "deb " << #x << " " << x << endl
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define endl "\n"
template <typename T>
void printvec(vector<T> &v, int n, int start = 0)
{
    //cout << "\nprinting vector\n";
    for (int i = start; i < n; i++)
    {
        cout << v[i] << " ";
    }
    cout << "done printing";
    cout << endl;
}
const int mod = 1e9 + 7;

void solve()
{
    int n,x,t;
    cin>>n>>x>>t;
    cout<<(n/x)*t + (n%x != 0)*t<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3568
A = [[0]*3 for _ in range(3)]
for i in range(3):
    A[i] = list(map(int,input().split()))

N = int(input())
B = [0 for i in range(N)]
for i in range(N):
    B[i] = int(input())

Bingo = [[False]*3 for _ in range(3)]
for k in range(9):
    i = k // 3
    j = k % 3
    for b in B:
        if A[i][j] == b:
            Bingo[i][j] = True

for i in range(3):
    if Bingo[i][1] and Bingo[i][2] and Bingo[i][0] == True:
        print("Yes")
        exit()
    if Bingo[1][i] and Bingo[2][i] and Bingo[0][i] == True:
        print("Yes")
        exit()

if Bingo[1][1] and Bingo[2][2] and Bingo[0][0] == True:
    print("Yes")
    exit()
if Bingo[0][2] and Bingo[1][1] and Bingo[2][0] == True:
    print("Yes")
    exit()

print("No")

     




Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vi cnt(n, 0);
    rep(i, n-1) {
        if (s[i] == 'A' && s[i+1] == 'C') {
            cnt[i+1]++;
        }
    }
    vi ans(n+1, 0);
    rep(i, n) ans[i+1] = ans[i] + cnt[i];

    while (q--) {
        int l, r;
        cin >> l >> r;
        l--; r--;
        cout << ans[r+1] - max(ans[l], ans[l+1]) << endl;
    }
}

Measured memory_bytes: 1872
import sys
import copy
h,w,k = map(int, sys.stdin.readline().rstrip("\n").split())
labyrinth = []
for _ in range(h): 
    l = list(sys.stdin.readline().rstrip("\n"))
    labyrinth.append(l)
l_h = [format(i, 'b').zfill(h) for i in range(2**h)]
l_w = [format(i, 'b').zfill(w) for i in range(2**w)]
ans = 0
for hi in l_h:
    for wi in l_w:
        labyrinth_new = copy.deepcopy(labyrinth)
        s = 0
        for hii in range(h):
            if hi[hii] == '1':
                labyrinth_new[hii] = ['r']*w
        for wii in range(w):
            if wi[wii] == '1':
                for _ in range(h):
                    labyrinth_new[_][wii] = 'r'
        for _ in range(h):
            s += labyrinth_new[_].count('#')
        if s == k:
            ans += 1
print(ans)

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

using namespace std;

int main()
{    
    int n;
    vector<int> array;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int tmp;
        cin>>tmp;
        array.push_back(tmp);
    }
    
    int count=0;
    for(int i=1;i<n-1;i++)
    {
        auto itr=array.begin()+i;
        vector<int> array2(3);
        copy(itr-1,itr+2,array2.begin());
        sort(array2.begin(),array2.end());
        if(*itr==array2[1])
        {
            if(*itr!=array2[0] && *itr!=array2[2])
            {
                count++;
            }
        }
    }
    cout<<count<<endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define reads(s) string s; cin >> s;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define setprec cout << fixed << showpoint << setprecision(20);
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	read(n);
	readarr(a, n);
	sort(a + 1, a + n + 1);
	int pro = 1;
	
	FOR (i, 1, n)
	{
	    int x = inf/pro;
	    if (a[i] > x) {cout << -1; return 0;}
	    
	    pro *= a[i];
	    if (pro > inf) {cout << -1; return 0;}
	    if (!pro) {cout << 0; return 0;}
	}
    
    print(pro);	
}



















Measured memory_bytes: 4388
def merge(A, left, mid, right):
    count = 0
    INF = 1000000000000000000000
    n1 = mid - left
    n2 = right - mid

    L = [A[left+i] for i in range(n1)]
    R = [A[mid+i] for i in range(n2)]
    L.append(INF)
    R.append(INF)

    i, j = 0, 0
    for k in range(left, right):
        count += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
    return count


def merge_sort(A, left, right):
    if left+1 < right:
        mid = (left + right) // 2
        count_left = merge_sort(A, left, mid)
        count_right = merge_sort(A, mid, right)
        count = merge(A, left, mid, right)
        return count + count_right + count_left
    return 0


def main():
    global A
    n = int(input())
    A = list(map(int, input().split()))
    count = merge_sort(A, 0, len(A))
    print(" ".join([str(a) for a in A]))
    print(count)

main()



Measured memory_bytes: 66784
import sys
input = sys.stdin.readline

n,m=map(int,input().split())
M=set(tuple(map(int,input().split())) for _ in range(m))
d={i:set() for i in range(1,n+1)}
for i,j in M:
    d[i].add(j)
    d[j].add(i)

vis=set()
res = 0
for i in range(1,n+1):
    if i not in vis:
        stack = [i]
        ans = 1
        vis.add(i)
        while stack:
            curr = stack.pop()
            for j in d[curr]:
                if j not in vis:
                    stack.append(j)
                    ans+=1
                    vis.add(j)
        res = max(ans,res)
print(res)




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

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int x; cin >> x;
	if(x == 1)cout << 0 << '\n';
	else cout << 1 << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k;
  cin >> k;
  cout << (k/2)*((k+1)/2) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 100005;
const int mod = 1000000007;

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n,m,k;
  cin>>n>>m>>k;
  int mx = max(n,m);
  cout<<(k+mx-1)/mx<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(void) {
    int a, b, c, d;
    std::cin >> a >> b >> c >> d;
    while (true) {
        if (c > b) {
            c -= b;
        } else {
            std::cout << "Yes" << std::endl;
            break;
        }
        if (a > d) {
            a -= d;
        } else {
            std::cout << "No" << std::endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3592
while True:
    H,W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for j in range(W):
            if (i + j + 1) % 2 == 0:
                print(".", end="")
            else:
                print("#", end="")
        print("")
    print("")

Measured memory_bytes: 9048
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.sportmeet", "r", stdin );
	string str = "";
	int n;

	while (getline (cin, str ) ){
		stringstream ssn(str);
		ssn >> n;

		if (n == 0 ){
			break;
		} // end if

		int i,j;
		map <int, int> rank;

		for (i = 0; i < n; ++i){
			int c1;
			vector <int> m(4, 0), s(4, 0);
			int total = 0;
			getline (cin, str );
			stringstream ss(str);
			ss >> c1;
			for (j = 0; j < 4; ++j){
				ss >> m[j] >> s[j];
			} // end for
			total += accumulate (m.begin(), m.end(), 0 );
			total *= 60;
			total += accumulate (s.begin(), s.end(), 0 );
			rank[total] = c1;
		} // end for

		map<int,int>::iterator it = rank.begin();
		cout << (*it).second << endl;
		++it;
		cout << (*it).second << endl;
		map<int, int>::reverse_iterator itr = rank.rbegin();		
		++itr;
		cout << (*itr).second << endl;
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1076
N = int(input())
temp = 0
ans = 0

if N < 105:
    print(0)
    exit()

else:
    for i in range(105, N+1, 2):
        for j in range(1, N+1):
            if i % j == 0:
                temp += 1

        if temp == 8:
            ans += 1
            temp = 0
        else:
            temp = 0

print(ans)

Measured memory_bytes: 3064
'use strict'

const main = (input) => {
    input = input.split(' ').map(v => parseInt(v))
    const x = input[0]
    const a = input[1]
    const b = input[2]
    const absA = Math.abs(x - a)
    const absB = Math.abs(x - b)
    if(absA < absB){
        console.log('A')
    }else{
        console.log('B')
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

Measured memory_bytes: 11468
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main() {
    int A,B; cin>>A>>B;
    if(A>B){
        cout<<2*A-1<<endl;
    }else if (B>A){
        cout<<2*B-1<<endl;
    }
    else{
        cout<<A+B<<endl;
    }
}

Measured memory_bytes: 256
import java.awt.geom.*;
import java.util.*;
 
public class Main {
    Scanner sc = new Scanner(System.in);
 
    public static void main(String[] args) {
        new Main(); 
    }
 
    public Main() {
    	new aoj0058().doIt();
    }
    class aoj0058{
    	void doIt(){
    		while(sc.hasNext()){
    			Point2D p1 = new Point2D.Double(sc.nextDouble(),sc.nextDouble());
    			Point2D p2 = new Point2D.Double(sc.nextDouble(),sc.nextDouble());
    			Point2D p3 = new Point2D.Double(sc.nextDouble(),sc.nextDouble());
    			Point2D p4 = new Point2D.Double(sc.nextDouble(),sc.nextDouble());
    			Point2D p12 = sub(p1,p2);
    			Point2D p34 = sub(p3,p4);
                if(Math.abs(dot(p12,p34))<1e-10)System.out.println("YES");
                else System.out.println("NO");
            }
    	}
    	Point2D sub(Point2D p2, Point2D p1) {
            double x = p2.getX() - p1.getX();
            double y = p2.getY() - p1.getY();
            return new Point2D.Double(x, y);
        }
    	double dot(Point2D p1, Point2D p2){
            return p1.getX() * p2.getX() + p1.getY() * p2.getY();
        }
    }
}

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

int main()
{
    int N,W;
    cin>>N>>W;
    pair<int,int> arr[N+1];
    for(int i=1;i<=N;i++)
    cin>>arr[i].first>>arr[i].second;
    long long int dp[N+1][W+1];
    for(int i=0;i<=N;i++)
    dp[i][0]=0;
    for(int i=0;i<=W;i++)
    dp[0][i]=0;
    for(int i=1;i<=N;i++)
    {
        for(int j=1;j<=W;j++)
        {
            if(arr[i].first>j)
            dp[i][j]=dp[i-1][j];
            else
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-arr[i].first]+arr[i].second);
        }
    }
    /*for(int i=1;i<=N;i++)
    {
        for(int j=1;j<=W;j++)
        {cout<<dp[i][j]<<" ";}
        cout<<"\n";
    }*/
    cout<<dp[N][W]<<"\n";
    
}

Measured memory_bytes: 79104
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {
	static int[] numStack = new int[100];
	static int numOfs= 0;

	public static void main(String[] args) throws Exception {
		BufferedReader breader = getReader();
		String[] elm = getAry(breader);
		for( int i = 0 ; i < elm.length ; i++ ) {
			if (elm[i].equals("+") == true) {
				numPush(numPop()+numPop());
			} else if ( elm[i].equals("-") == true ) {
				numPush(-(numPop()-numPop()));
			} else if ( elm[i].equals("*") == true ) {
				numPush(numPop()*numPop());
			} else {
				numPush(Integer.valueOf(elm[i]));
			}
		}
		System.out.println(numPop());
	}
	public static void numPush(int n) {
		numStack[numOfs++] = n;
	}
	public static int numPop() {
		return(Integer.valueOf(numStack[--numOfs]));
	}
	public static BufferedReader getReader() {
		return( new BufferedReader(new InputStreamReader(
				System.in)));
	}
	public static int getInt(BufferedReader br)throws Exception {
		String line = br.readLine();
		return Integer.valueOf(line);
	}
	public static String[] getAry(BufferedReader br)throws Exception {
		String line = br.readLine();
		String[] nstr = line.split(" ");
		return nstr;
	}
	public static int[] getIntAry(BufferedReader br)throws Exception {
		String line = br.readLine();
		String[] nstr = line.split(" ");
		int[] n = new int[nstr.length];
		for( int i=0 ; i < nstr.length ; i++ ) {
			n[i] = Integer.valueOf(nstr[i]);
		}
		return n;
	}
	public static int cardComp(String left, String right) {
		char l = left.charAt(1);
		char r = right.charAt(1);
		return(l-r);
	}
	public static int[] getAryMl(BufferedReader br)throws Exception {
		int n = getInt(br);
		int[] ary = new int[n];
		for( int i=0 ; i < n ; i++ ) {
			ary[i] = getInt(br);
		}
		return ary;
	}
	public static void putAry(int[] ary, int num) {
		for( int i = 0; i < num ; i++ ) {
			System.out.print(ary[i]);
			if ( i < num-1) {
				System.out.print(" ");
			}
		}
		System.out.println("");
	}
	public static void putAry(int[] ary) {
		putAry(ary, ary.length ) ;
	}
	public static boolean isPrime(int n) {
		int r = (int)Math.sqrt((double)n)+1;
		for( int j = 2 ; j < r ; j += 1) {
			if ( n%j == 0 ) {
				return false;
			}
		}
		return true;
	}

}

Measured memory_bytes: 17044
S = input()
T = input()
def solve(i):
  flag = True
  for j in range(len(T)):
    if i+j < len(S) and (S[i+j] == "?" or S[i+j] == T[j]):
      continue
    else:
      flag = False
      break
  return flag
anslist = []
for i in range(len(S)):
  if solve(i):
    anstmp = S[:i] + T + S[i+len(T):]
    anstmp = anstmp.replace("?", "a")
    anslist.append(anstmp)
if len(anslist) > 0:
  anslist.sort()
  ans = anslist[0]
else:
  ans = "UNRESTORABLE"
print(ans)

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

int main()
{
	int A, B, C;

	cin >> A >> B >> C;

	int ans = 0;
	for( int i = 0; i < 10000; i++ ) {
		int n = i + 1;
		if( ( n * A ) % B == C ) {
			ans = 1;
		}
	}
	if( ans ) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}


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

std::vector<std::string> t{"Sunny","Cloudy","Rainy"};

int main(int argc, char** argv) {
  std::string S;
  std::cin >> S;
  if (t[0] == S) std::cout << t[1] << '\n';
  else if (t[1] == S) std::cout << t[2] << '\n';
  else if (t[2] == S) std::cout << t[0] << '\n';
}


Measured memory_bytes: 256
N=int(input())
L=input()
L=L.rstrip().split(" ")
list1=[]
for i in range(N):
    list1.append(int(L[i]))
#print(list1)
count=0
for j in range(1,N):
    if list1[j]==list1[j-1]:
        count+=1
        list1[j]=-1
#print(list1)
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define prt_cs                  printf("Case %lld: ",cs)
#define sqr(x)                  (x)*(x)
#define ms(a,b)                 memset(a, b, sizeof(a))
#define db                      double
#define ll                      long long int
#define MOD                     1000000007
#define PI                      2*acos(0.0)
#define pii                     pair< int, int >
#define READ                    freopen("in.txt","r",stdin)
#define WRITE                   freopen("out.txt","w",stdout)
#define gcd(a, b)               __gcd(a, b)
#define lcm(a, b)               (((a)*(b))/gcd(a,b))
#define MAX                     100005

using namespace std;

ll h[MAX],dp[MAX];//[102];

ll solve(int n,int k)
{
    if(n==0)
    {
        return 0;
    }
    if(dp[n]!=-1)return dp[n];
    ll ans=0,r1=MOD;
    for(int i=1;i<=min(n,k);i++)
    {
//        if(n-i<0)continue;
        ll m = abs(h[n]-h[n-i])+solve(n-i,k);
        r1=min(r1,m);
//    cerr<<n<<" "<<r1<<endl;
    }
    ans=r1;
    return dp[n]=ans;
}


int main()
{
//    READ;
//    WRITE;
    int n,k;
    scanf("%d %d",&n,&k);
    ms(dp,-1);
//    ms(;
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&h[i]);
    }
    ll ans=solve(n-1,k);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 9600
#define _CRT_SECURE_NO_WARNINGS
#include<algorithm>
#include<cstdio>

int main(){
	int n, a[3];
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		for(int j = 0; j != 3; ++j )
			scanf("%d", a+j);
		std::sort(a, a + 3);
		puts(a[2] * a[2] == a[0] * a[0] + a[1] * a[1] ? "YES" : "NO");
	}
	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<queue>
#include<vector>
#define LL long long
#define ULL unsigned long long
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define itn int
#define pritnf printf
#define mp make_pair
#define pb push_back
using namespace std;

int n;

int main(){
	cin>>n;
	if (n%2){
		printf("%d",(n/2)*(n/2+1));
	}
	else{
		printf("%d",(n/2)*(n/2));
	}
	return 0;
}

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


int main() {
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    string s; cin >> s;
    while (s.length() > 2) {
        s.pop_back(); s.pop_back();
        int mid = s.length() / 2;

        bool succeed = true;
        for (int i = 0, j = mid; i < mid && j < s.length(); i++, j++) {
            if (s[i] != s[j]) {
                succeed = false;
                break;
            }
        }
        if (succeed) {
            cout << s.length() << '\n';
            return 0;
        }
    }

    if (s[0] == s[1]) {
        cout << "1\n";
    } else {
        cout << "0\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll MOD=1000000007;

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> a(m,0),b(n,0);
    int ans=inf;
    vector<vector<int>> e(n,vector<int>(m));
    rep(i,n){
        rep(j,m) {cin >> e[i][j];
        e[i][j]--;}
    }
    rep(i,m){
        int k=0;
        vector<int> c(m,0);
        rep(j,n){
            c[e[j][b[j]]]++;
            k=max(k,c[e[j][b[j]]]);
        }
        int u;
        rep(j,m){
            if (c[j]==k) u=j;
        }
        ans=min(ans,k);
        a[u]=-1;
        if (i==m-1) break;
        rep(i,n){
            while(true){
                if (a[e[i][b[i]]]!=-1) break;
                b[i]++;
            }
        }
    }   
    cout << ans << endl;                 
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI=acos(-1);
const int INF = numeric_limits<int>::max();

int main(){
    int n;
    cin >> n;
    vector<double> x(n), y(n);
    rep(i, n) {
        cin >> x[i] >> y[i];
    }
 
    double ans=0.0;
    rep(i, n) {
        rep(j, n) {
            ans += sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]));
        }
    }
 
    ans /= n;
 
    cout << fixed << setprecision(10) << ans << endl;

    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)

#define MAX 100

int main(){
    long long int a,b,c;
    double buf;
    int A[MAX],B[MAX],Q,cnt;
    
    scanf("%d",&Q);

    REPI(Q){
        scanf("%d %d",&A[i],&B[i]);
    }

    REPI(Q){
        a = min(A[i],B[i]);
        b = max(A[i],B[i]);
        
        if(a==b || a+1==b){
            printf("%lld\n",(a-1)*2);
            continue;
        }
        
        c = (int)sqrt((double)(a*b));

        if(c*c==a*b){
            c--;
        }

        if(c*(c+1)>=a*b){
            printf("%lld\n",(c-1)*2);
        }else{
            printf("%lld\n",2*c-1);
        }
    }

    return 0;
}



Measured memory_bytes: 256
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	s, _ := next(), next()
	a, b := nextInt(), nextInt()
	u := next()
	if u == s {
		puts(a-1, b)
	} else {
		puts(a, b-1)
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

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

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 998244353;
const ll INF = mod * mod;
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);

void chmin(int &a, int b) {
	a = min(a, b);
}
void chmax(int &a, int b) {
	a = max(a, b);
}
ll mod_pow(ll a, ll n, ll m = mod) {
	a %= 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;
}

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

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


void solve() {
	int a, b; cin >> a >> b;
	int h, m; cin >> h >> m;
	ld t1 = 2 * pi*(ld)(60*h+m) / 720.0;
	ld t2 = 2 * pi*(ld)(m) / 60.0;
	ld t = abs(t1 - t2);
	if (t >= pi) {
		t = 2 * pi - t;
	}
	//cout << t << "\n";
	ld ans = sqrtl(a*a + b * b - 2 * a*b*cos(t));
	cout << ans << "\n";
}

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

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

void solve() {
	int n; cin >> n;
	vector<int> v(n);
	rep(i, 0, n) cin >> v[i];
	ll ans = 0;
	rep(i, 1, n) {
		if (v[i] < v[i-1]) {
			ans += v[i-1] - v[i];
			v[i] += v[i-1] - v[i];
		}
	}
	cout << ans << endl;
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif

	int t = 1;
	// cin >> t;
	while(t--) {
		solve();
	}

	return 0;
}


Measured memory_bytes: 3956
/*input
3 3
1
3
1
3
1
3


*/ 
#include <iostream>
#include <bits/stdc++.h>
#include <math.h> 
    
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define gc getchar_unlocked
#define fo(i,n) for(ll i=0;i<n;i++)
#define Fo(i,k,n) for(ll i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define int long long
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define ms(a,x) memset(a, x, sizeof(a));
#define endl "\n"
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 1000000001;
const int MAX = 1e5+1;

int32_t main() {
    IOS;
	int n,k;cin>>n>>k;
	multimap<int,int> mx;
	for(int i=0;i<k;i++){
		int d;cin>>d;
		for(int j=1;j<=d;j++){
			int x ;cin>>x;
			//mx[x] = i;
			mx.insert({x,i});
		}
	}
	int ans= 0;
	for(int i=1;i<=n;i++){
		if(mx.find(i)==mx.end())ans++;
	}
	cout<<ans<<endl;
	return 0;
}






Measured memory_bytes: 4136
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}
ll mod=1000000007;
ll combi(ll N_, ll C_) {
    const int NUM_=400001;
    static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
    if (fact[0]==0) {
        inv[1]=fact[0]=factr[0]=1;
        for (int i=2;i<=NUM_;++i) inv[i] = inv[mod % i] * (mod - mod / i) % mod;
        for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mod, factr[i]=factr[i-1]*inv[i]%mod;
    }
    if(C_<0 || C_>N_) return 0;
    return factr[C_]*fact[N_]%mod*factr[N_-C_]%mod;
}
int main(){
    int b,w;
    cin >> b >> w;
    const ll inv2 = (mod + 1) / 2;
    ll x = 0;
    ll y = 0;
    ll temp  = inv2;
    for(int i = 0; i < b + w; i++){
        cout << (1-x+y+mod)%mod*inv2%mod << "\n";
        x = (x + combi(i,b-1) * temp) % mod;
        y = (y + combi(i,w-1) * temp) % mod;
        temp = temp * inv2 % mod;
    }
}

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

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

	string ans = "No";

	if (a == b && a != c) {
		ans = "Yes";
	}

	if (a == c && a != b) {
		ans = "Yes";
	}

	if (b == c && a != c) {
		ans = "Yes";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pi 3.1415926536
#define pb push_back
#define N 1000000007
#define M 998244353
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define nrep(i,a,b) for(int i=a;i>=b;i--)
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll t,i,j,q,x,y,l,r,flag = 0,h,m,n,k;
    cin>>n;
    ll a[n+5];
    rep(i,1,n){
    	cin>>a[i];
    	if(a[i] == 0) flag =1;
	}
	if(flag){
		cout<<0;
	}else{
		ll ans = a[1];
		rep(i,2,n){
			h = (ll)1e18/ans;
			if(a[i]>h){
				cout<<-1;
				return 0;
			}
			ans *= a[i];
		}
		cout<<ans;
		
	}
}

Measured memory_bytes: 4400
// vim: shiftwidth=2 expandtab foldmethod=marker

// include {{{
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <utility>
#include <cstdlib>
#include <random>
#include <chrono>
// }}}

// debug(...) {{{
#ifdef LOCAL_DEBUG
#include "./debug.h"
#else
bool debug_enabled = false;
#define debug(...)
#define debugn(...)
#define debug_reset()
#endif

#include <cstdio>

template<class T>
std::string bin(int bits, const T& x) {
  char buf[bits + 1];
  buf[bits] = '\0';
  for(int i = 0; i < bits; i++) {
    if((x >> i) & 1) {
      buf[bits - i - 1] = '1';
    } else {
      buf[bits - i - 1] = '0';
    }
  }
  return std::string(buf);
}
std::string bin(int x) {
  if(x < 0) return bin(32, x);
  for(int i = 4; i < 31; i++) {
    int y = 1 << i;
    if(x < y) return bin(i, x);
  }
  return bin(32, x);
}
// }}}

// misc {{{
using namespace std;
template<class T, class U>

using umap = unordered_map<T, U>;
template<class T>
using uset = unordered_set<T>;

typedef long long ll;

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

template<class T>
void sort(T& arr) {
  std::sort(arr.begin(), arr.end());
}
template<class T, class By>
void sort_by(T& arr, By by) {
  std::sort(arr.begin(), arr.end(), [by](auto l, auto r){return  by(l) < by(r); });
}

template<class T>
void reverse(T& arr) {
  std::reverse(arr.begin(), arr.end());
}

class Random {
  public:
  std::uniform_int_distribution<> uniform_int;
  std::mt19937 rnd;
  std::bernoulli_distribution bern_dist;
  int uniform(int l, int r) {
    return uniform_int(rnd, std::uniform_int_distribution<>::param_type(l, r));
  }
  int next(int N) {
    return uniform(0, N - 1);
  }
  int bern(double p) {
    return bern_dist(rnd, std::bernoulli_distribution::param_type(p));
  }
};

template <class A>
ostream& out_vec(const vector<A>& x, const string& sep) {
  rep(i, x.size()) {
    cout << x[i];
    if(i < x.size() - 1)
      cout << sep;
  }
  return cout;
}
// }}}

// main {{{
void solve();
int main() {
  cout << setprecision(20);
  solve();
}
// }}}

void solve() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) {
    cin >> S[i];
  }
  vector<vector<int>> htable(H, vector<int>(W));
  vector<vector<int>> vtable(H, vector<int>(W));

  rep(h, H) {
    rep(w, W) {
      int w2 = w;
      while(w2 < W && S[h][w2] == '.') ++w2;
      int l = w2 - w;
      for(; w < w2; ++w) htable[h][w] = l;
    }
  }
  rep(w, W) {
    rep(h, H) {
      int h2 = h;
      while(h2 < H && S[h2][w] == '.') ++h2;
      int l = h2 - h;
      for(; h < h2; ++h) vtable[h][w] = l;
    }
  }
  int ans = 0;
  rep(h, H) {
    rep(w, W) {
      if(S[h][w] == '.') {
        int num = htable[h][w] + vtable[h][w] - 1;
        ans = max(ans, num);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 37760
#include <queue>
#include <vector>
#include <iostream>
#include <functional>
#include <string>

using namespace std;
int main() {
    string x;
    std::cin >> x;
    int len=x.size();
    x+='0';
    int a=0;
    for (int i=0;i<len;++i) {
        int d=x[i]-'0';
        if (d>=6 || (d==5 && x[i+1]-'0'>=5)){
            a+=10-d;
            ++x[i+1];
        } else
            a+=d;
    }
    cout<< a + (x[len]-'0') <<endl;
}

Measured memory_bytes: 1412
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+10;

int n,a[N],f[N];
vector<int> E[N];

void dfs(int u) {
	for(auto v:E[u]) dfs(v);
	vector<bool> dp(a[u]+1);
	dp[0]=1;
	int sum=0;
	for(auto v:E[u]) {
		vector<bool> new_dp(a[u]+1);
		for(int i=a[u];~i;i--) {
			if(i>=a[v]) new_dp[i]=new_dp[i]|dp[i-a[v]];
			if(i>=f[v]) new_dp[i]=new_dp[i]|dp[i-f[v]];
		}
		swap(dp,new_dp);
		sum+=a[v]+f[v];
	}
	bool fl=0;
	for(int i=a[u];~i;i--)
		if(dp[i]) {
			f[u]=sum-i;fl=1;break;
		}
	if(!fl) cout<<"IMPOSSIBLE",exit(0);
}

int main() {
	cin>>n;
	for(int i=2,fa;i<=n;i++) cin>>fa,E[fa].push_back(i);
	for(int i=1;i<=n;i++) cin>>a[i];
	dfs(1);
	cout<<"POSSIBLE";
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mp make_pair
typedef pair<int,int> pii;
typedef priority_queue<int,vector<int>,greater<int> > small_heap;
typedef priority_queue<int> big_heap;
ll n,c1,c2;
int main()
{
    scanf("%lld",&n);
    if(n&1){
        cout<<0<<endl;
        return 0;
    }
    for(ll i=10;i<=n;i*=5){
        c1+=n/i;
    }
    cout<<c1<<endl;
    return 0;
}

Measured memory_bytes: 256