akhauriyash/Code-Regression huggingface dataset:
/*
author : seryu
title : ABC176A_"Takoyaki"
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define mreps(i,j,n) for(int i = j; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;
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; }

void solve()
{
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n+x-1)/x*t << endl;
    return;	
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

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

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

  string s;
  int w;
  cin >> s >> w;
  for(int i = 0; i < s.length(); i=i+w){
    cout << s[i];
  }
  cout << endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline LL gl()
{
	LL f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int INF = 0x3f3f3f3f;

int main()
{
	//File("");
	int a = gi(), b = gi();
	for (int i = 1; i <= 10000; i+=1)
	{
	    if (floor((double)i * 0.08) == a && floor((double)i * 0.1) == b)
	    {
	        printf("%d\n", i);
	        return 0;
	    }
	}
	puts("-1");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstring>
#include<bitset>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<numeric>
#include<set>
using namespace std;

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

#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)

long long INF=1e9;
const long long mod=2019;
#define ll long long

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

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<stdio.h>

typedef long long ll;
using namespace std;

int main() {

	ll N;
	ll ans = 0;
	string a;
	cin >> N;
	cin >> a;
	
	for (int i = 0; i < a.size(); i++) {
		if (a[i] != a[i + 1]) {
			ans++;
		}
	}

	cout << ans;


	return 0;

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a[4];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3,greater<int>());
    int res=a[0]*10+a[1]+a[2];
    cout<<res<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;

int dest[100005];
vector<pair<int, int>> adj[100005];
int vis[100005];
vector<int> sol;

void dfs(int x)
{
    if (vis[x])
        return;

    vis[x] = 1;
    for (auto p : adj[x])
        dfs(p.first);
    sol.push_back(x);
}

int main()
{
    int n, m;
    cin >> n >> m;
    vector<tuple<int, int, int>> v;
    for (int i = 0; i < m; ++i)
    {
        int l, r, d;
        cin >> l >> r >> d;
        adj[l].emplace_back(r, d);
    }
    for (int i = 1; i <= n; ++i)
        dfs(i);

    reverse(all(sol));
    for (int x : sol)
    {
        for (auto p : adj[x])
        {
            int y, d;
            tie(y, d) = p;
            if (!dest[x]) dest[x] = 1;
            if (!dest[y]) dest[y] = dest[x] + d;
            if (dest[y] != dest[x] + d)
                return cout << "No", 0;
        }
    }
    cout << "Yes";
}


Measured memory_bytes: 11512
import numpy as np
import sys

A = []
for i in range(3):
    A.append([j for j in map(int,input().split())])
A = np.array(A)
N = int(input())
numbers = []
for n in range(N):
    numbers.append(int(input()))

for number in numbers:
    A = np.where(A==number,0,A)

for a in A:
    if np.array_equal(a,np.array([0,0,0])):
        print('Yes')
        sys.exit()
for a in A.T:
    if np.array_equal(a,np.array([0,0,0])):
        print('Yes')
        sys.exit()
if 0 == A[0][0] and 0 == A[1][1] and 0 == A[2][2]:
    print('Yes')
    sys.exit()
elif 0 == A[0][2] and 0 == A[1][1] and 0 == A[2][0]:
    print('Yes')
    sys.exit()

print('No')

Measured memory_bytes: 12500
#include <algorithm>
#include <bitset>
// #include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <chrono>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPC(i, a) REP(i, 0, a)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)
#define RREPC(i, a) RREP(i, a, 0)
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr ll LL2_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

static map<type_index, const char *const> scanType = { { typeid(int), "%d" },
{ typeid(ll), "%lld" },
{ typeid(double), "%lf" },
{ typeid(char), "%c" } };

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
// static boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
	 //INFILE();

	 ll l;
	 cin >> l;
	 string s;
	 cin >> s;
	 vector<ll> v(l);

	 ll count = 0, minCount;
	 for (int i = 0; i < l; i++) {
		 v[i] = count;
		 if (s[i] == '#') count++;
	 }

	 minCount = count;
	 count = 0;
	 for (int i = l - 1; i >= 0; i--) {
		 if (s[i] == '.') count++;
		 v[i] += count;
		 if (v[i] < minCount) minCount = v[i];
	 }

	 cout << minCount << endl;
	return 0;
}

template <class T> static void scan(vector<T> &v) {
	auto tFormat = scanType[typeid(T)];
	for (T &n : v) {
		scanf(tFormat, &n);
	}
}

static void scan(vector<string> &v, bool isWord) {
	if (isWord) {
		for (auto &n : v) {
			cin >> n;
		}
		return;
	}

	int i = 0, size = static_cast<int>(v.size());
	string s;
	getline(cin, s);

	if (s.size() != 0) {
		i++;
		v[0] = s;
	}

	for (; i < size; ++i) {
		getline(cin, v[i]);
	}
}

//static boost::dynamic_bitset<> scan(char trueValue) {
//	string s;
//	getline(cin, s);
//
//	if (s.size() == 0) {
//		getline(cin, s);
//	}
//
//	for_each(begin(s), end(s),
//		[trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
//	return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
//}


Measured memory_bytes: 2172
import java.util.Scanner;

public class Main {

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

		if((a + b)%2 == 0) {
			System.out.println((a+b)/2);
		}else {
			System.out.println((a+b)/2 + 1);
		}

	}

}


Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    int ma = 0;
    for(int i=0;i<n;i++){
        set<char> x;
        set<char> y;
        for(int j=0;j<i;j++){
            x.insert(s[j]);
        }
        for(int j=i;j<n;j++){
            y.insert(s[j]);
        }
        set<char> z;
        set_intersection(x.begin(),x.end(),y.begin(),y.end(),inserter(z,z.end()));
        ma = max((int)z.size(),ma);
    }
    cout << ma << endl;
}


Measured memory_bytes: 256
h,w=map(int,input().split())
if(h%3==0 or w%3==0):
    print(0)
    quit()
def main(h,w):
    a=h
    for i in range(1,h//2+1):
        l=[i*w,(h-i)*(w//2),(h-i)*(w-w//2)]
        a=min(max(l)-min(l),a)
    return a
print(min(main(h,w),main(w,h)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<int,ll> PIL;
typedef pair<ll,int> PLI;
typedef pair<pair<int, int>, int> PPI;
typedef bitset<60> Bitset;
const ll INFL = 1LL << 60;
const int INF = 1000000005;
const int MAX = 300000;
const int MOD = 1000000007;
struct Graph{int to; ll cost;};
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
//------------------------------------------------------------------------------------------------------------------------------
int main(void) {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    int n,x;cin>>x>>n;
    bool a[105];
    for(int i = 0; i <= 101; i++) a[i] = 0;
    for(int i = 0; i < n; i++){
        int p;cin>>p;
        a[p] = 1;
    }
    int ans = -INF;
    for(int i = 0; i <= 101; i++) {
        if(!a[i] && (abs(i-x)<abs(ans-x))) ans = i;
    }
    cout<<ans<<endl;

  
}

Measured memory_bytes: 3656
#include <iostream>

using namespace std;

int main() {
  int n, k;
  string s;
  cin >> n >> s >> k;

  char c = s.at(k - 1);

  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) != c) {
      s.at(i) = '*';
    }
  }

  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char str[1005];
	int i = 0;
	
	fgets(str, 1000, stdin);
	
	while (str[i] != '\n'){
		if ('a' <= str[i] && str[i] <= 'z'){
			 str[i] += 'A' - 'a';
		}
		i++;
	}
	printf("%s", str);
	
	return (0);
}

Measured memory_bytes: 524
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

constexpr static ll MOD = 1000000007ll;
constexpr static int INF = 1 << 28; // for x <= 10^9
constexpr static ll INFL = 1ll << 60; // for x <= 10^19

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

    if (s.length() == 2) {
        if (s[0] == s[1]) {
            cout << 1 << " " << 2 << endl;
            return 0;
        } else {
            cout << "-1 -1" << endl;
            return 0;
        }
    }

    for (int i = 0; i < s.length() - 2; i++) {
        if (s[i] == s[i + 1]) {
            cout << i + 1 << " " << i + 2 << endl;
            return 0;
        }

        if (s[i] == s[i + 2]) {
            cout << i + 1 << " " << i + 3 << endl;
            return 0;
        }

        if (s[i + 1] == s[i + 2]) {
            cout << i + 2 << " " << i + 3 << endl;
            return 0;
        }
    }

    cout << "-1 -1" << endl;
}


Measured memory_bytes: 512
def prime_factorize(n):
    a = [1]
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A,B = map(int,input().split())
div_A = set(prime_factorize(A))
div_B = set(prime_factorize(B))
A_and_B = div_A & div_B
print(len(A_and_B))

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

void solve(){
	ll n, m;
	cin >> n >> m;
	if (n > m) {
		swap(n, m);
	}
	ll ans = 0ll;
	if (n == 1 && m == 1) {
		ans = 1;
	} else if (n == 1) {
		ans = m - 2;
	} else {
		ans = (n - 2) * (m - 2);
	}
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

ll H, W, N, ans[11];
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, dy[8] = {1, 1, 0, -1, -1, -1, 0, 1}, y, x, cnt;

int main()
{
    scanf("%d%d%d", &H, &W, &N);
    set<pair<int, int>> st, br;
    ans[0] = (H - 2) * (W - 2);
    for (int i = 0; i < N; i++)
    {
        scanf("%d%d", &y, &x);
        br.insert({--y, --x}), st.insert({y, x});
        for (int i = 0; i < 8; i++)
        {
            int ny = y + dy[i], nx = x + dx[i];
            if (ny < 1 || ny > H || nx < 1 || nx > W)
                continue;
            st.insert({ny, nx});
        }
    }
    for (auto &p : st)
    {
        y = p.first, x = p.second, cnt = 0;
        cnt += (br.find(p) != br.end());
        for (int i = 0; i < 8 && cnt != -1; i++)
        {
            int ny = y + dy[i], nx = x + dx[i];
            if (ny < 0 || ny >= H || nx < 0 || nx >= W)
                cnt = -1;
            cnt += (br.find({ny, nx}) != br.end());
        }
        if (cnt != -1)
            ans[cnt]++, ans[0]--;
    }
    for (int i = 0; i < 10; i++)
        printf("%lld\n", ans[i]);
}

Measured memory_bytes: 49152
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
const int maxn = 1e5+10;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
int d[4][2]={1,0,0,1,-1,0,0,-1};
int flag[150];
int main() {
    ios::sync_with_stdio(0);
    // #ifdef Uncle_drew
    // freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
    // #else
    // #endif
    int n,k;
    cin>>n>>k;
    for(int i=1,mid,a;i<=k;i++){
        cin>>mid;
        while(mid--){
            cin>>a;
            flag[a]=1;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(flag[i]==0)  ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
 
#define rep(i,n) for(int i=0;i<(int)(n);i++)

typedef long long ll;

int main() {
    int N; cin >> N;
    double ans=0;
    rep(i,N){
        double a; cin >> a;
        ans += 1.0/a;
    }
    ans = 1.0/ans;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000007
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
typedef long long lli;

int main()
{
    char s, ans;
    scanf("%c",&s);
    switch(s) {
        case 'A': ans = 'T'; break;
        case 'T': ans = 'A'; break;
        case 'G': ans = 'C'; break;
        case 'C': ans = 'G'; break;
    }
    printf("%c",ans);

    return 0;
}


Measured memory_bytes: 128
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        List<int> wait = new List<int>();
        int ans = 0;
        for (int i = 0; i < 5; i++)
        {
            int cin = int.Parse(Console.ReadLine());
            ans += cin;
            if (cin % 10 != 0)
            {
                ans += 10 - cin % 10;
                wait.Add(10 - cin % 10);
            }
        }
        if (wait.Count != 0) Console.WriteLine(ans - wait.Max());
        else Console.WriteLine(ans);
    }
}

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

#define SZ(x) ((int(x.size())))

typedef long long ll;
typedef long double ld;

using namespace std;

const int maxn = 510;
char c[maxn][maxn];
int h, w;

int main()
{
	cin >> h >> w;
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
			cin >> c[i][j];
	}
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			if ((!(i & 1) || c[i][j] == '#' || j == 0) && j < w - 1)
				cout << '#';
			else
				cout << '.';
		}
		cout << endl;
	}
	cout << endl;
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			if ((i & 1 || c[i][j] == '#' || j == w - 1) && j > 0)
				cout << '#';
			else
				cout << '.';
		}
		cout << endl;
	}
	return 0;
}

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

int main() {
  int a,b,c,x;
  cin >> a >> b>> c;
  x = a;
  a = b;
  b = x;
  x = a;
  a = c;
  c = x;
  cout << a << " " <<  b << " " << c << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>


int main(){
	int a, b, c, d, p, x, y;
	scanf("%d %d %d %d %d", &a, &b, &c, &d, &p);
	x = a*p;
	if(p <= c) y = b;
	else y = b + d*(p - c);
	if(x < y) printf("%d\n",x);
	else printf("%d\n",y);
	return 0;
}

Measured memory_bytes: 596
class Dice
  def initialize(b,s,e,w,n,vals)
    @bottom=b
    @s,@e,@w,@n=s,e,w,n
    @vals=vals
  end

  def move(n)
    case n
    when "S"
      @n=@bottom
      @bottom=@s
      @s=7-@n
    when "N"
      @s=@bottom
      @bottom=@n
      @n=7-@s
    when "E"
      @w=@bottom
      @bottom=@e
      @e=7-@w
    when "W"
      @e=@bottom
      @bottom=@w
      @w=7-@e
    end
  end

  def top
    puts @vals[6-@bottom]
  end
end

vals=gets.split
d=Dice.new(6,2,3,4,5,vals)
gets.chomp.chars{|c| d.move(c)}
d.top

Measured memory_bytes: 6108
def traverse  now
	if $list[now] == 1
		return nil
	else
		$list[now] = 1
		$time += 1
		$data[now].sta = $time
		$n.times do |i|
		 traverse i if $m[now][i] == 1
		end
		$time += 1
		$data[now].end = $time
	end
end

D = Struct.new(:sta, :end)
$n = gets.to_i
$time = 0
$m = Array.new($n){Array.new($n){0}}
$data = Array.new($n){D.new}
$list = Array.new($n){0}
$n.times do
	s = gets.split.map(&:to_i)
	i = s[0] - 1
	s[1].times do |l|
		j = s[l + 2] - 1
		$m[i][j] = 1 
	end
end

$n.times do |i|
	traverse i if $list[i] == 0
end


$n.times do |i|
	puts "#{ i + 1 } #{$data[i].sta} #{$data[i].end}"
end

Measured memory_bytes: 8864
from collections import Counter

n,x,y=map(int,input().split())

x-=1
y-=1

dist=[]
for i in range(n-1):
  for j in range(i+1,n):
    dist.append(min(j-i,abs(i-x)+1+abs(j-y)))

c=Counter(dist)
for i in range(1,n):
  print(c[i])

Measured memory_bytes: 67804
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

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

    int n;
    cin >> n;

    int b = 1;
    int px = 0, py = 0, pt = 0;
    for (int i = 0; i < n; i++) {
        int t, x, y;
        cin >> t >> x >> y;

        int dx = x - px;
        int dy = y - py;
        int dt = t - pt;
        int d = abs(dx) + abs(dy);

        if (!(d <= dt && d % 2 == dt % 2)) b = 0;

        px = x;
        py = y;
        pt = t;
    }

    cout << (b ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    bool flag = false;
    cin>>n;
    if(n>81){
        cout<<"No"<<endl;
        return 0;
    }
    
    for(int i = 1 ;i < 10;i++){
        if(n%i==0 && n/i<10){
            flag = true;
        }
    }
   if(flag){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int n;
	while(cin>>n){
		int cnt=0;
		for(int a=0;a<10;a++)
			for(int b=0;b<10;b++)
				for(int c=0;c<10;c++)
					for(int d=0;d<10;d++)
						if(a+b+c+d==n) cnt++;
		cout<<cnt<<endl;
	}
}

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

int main() {
    int n;
    cin >> n;
    map<string, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        mp[s]++;
    }
    cout << mp.size() << endl;
    return 0;
}

Measured memory_bytes: 19224
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair

using namespace std;

int main(){
    
    ll n;
    cin >> n;

    vector<double> p(n + 1);
    for(int i = 1;i <= n;i++) cin >> p[i];

    double dp[n + 1][n + 1];
    rep(i,n + 1) 
        rep(j,n + 1)
            dp[i][j] = 0.0;

    dp[0][0] = 1.0;

    for(int i = 1;i <= n;i++){
        for(int j = 0;j <= n;j++){
            if(j == 0){
                dp[i][j] += dp[i-1][j] * (1 - p[i]);
            }
            else{
                dp[i][j] += dp[i-1][j-1] * p[i];
                dp[i][j] += dp[i-1][j] * (1 - p[i]);
            }
        }
    }

    /*rep(i,n + 1){
        rep(j,n + 1){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }*/

    double ans = 0.0;
    for(int i = n/2 + 1;i <= n;i++){
        ans += dp[n][i];
    }

    cout << fixed << setprecision(12) <<  ans << endl;
    
    return 0;
}

Measured memory_bytes: 70528
#include <cstdio>
#include <utility>
#include <string>
using namespace std;

#define gcu getchar_unlocked
#define ii inline int in
#define is inline bool scan
ii(int c) {
	int n = 0;
	bool minus = false; if (c == '-') minus = true, c = gcu();
	do {n = 10 * n + (c - '0'), c = gcu();} while (c >= '0');
	//return n; }
	return minus ? -n : n; }
ii() {return in(gcu());}
is(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
is(char &c){c=gcu();gcu();return c!=EOF;}
is(string &s){int c; s = "";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#undef ii
#define pcu putchar_unlocked
template <typename T>
void out(T n) {
	static char buf[20];
	char *p = buf;
	if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
void out(const char *s){while(*s)pcu(*s++);}
void out(char c){pcu(c);}
void out(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
void out(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//void out(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef svo

int main() {
	int c = 0;
	for (string s; scan(s);) {
		int i = 0, j = s.size() - 1;
		for (; i < j; i++, j--)
			if (s[i] != s[j])
				break;
		c += i >= j;
	}
	out(c, '\n');
}


Measured memory_bytes: 2508
#include <algorithm>
#include <chrono>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef int Int;

#define KIND 26
//#define KIND 2
Int D;
Int c[KIND];
Int s[400][KIND];
Int last[KIND];

std::chrono::time_point<std::chrono::steady_clock> start;

Int range(Int l, Int r) {
	Int len = r - l - 1;
	return -len * (len + 1) / 2;
}

void tic() {
	start = std::chrono::steady_clock::now();
}

double toc() {
	auto now = std::chrono::steady_clock::now();
	std::chrono::duration<double> duration = now - start;
	return duration.count();
}

struct ContestInfo {
	set<Int> held[KIND];
	vector<Int> t;
	int D;
	Int score = 0;
	ContestInfo(int D) : D(D) {
		t.resize(D, -1);
		for (int i = 0; i < KIND; i++) {
			held[i].insert(-1);
			held[i].insert(D);
			score += c[i] * range(-1, D);
		}
	}

	void add(int d, int q) {
		if (t[d] != -1) {
			cout << "Add failed" << endl;
			exit(1);
		}
		t[d] = q;
		score += s[d][q];
		held[q].insert(d);
		auto it = held[q].find(d);
		auto rit = next(it);
		auto lit = prev(it);
		score -= c[q] * range(*lit, *rit);
		score += c[q] * range(*it, *rit);
		score += c[q] * range(*lit, *it);
	}

	void erase(int d) {
		if (t[d] == -1) {
			cout << "erase failed" << endl;
			exit(1);
		}
		int q = t[d];
		t[d] = -1;
		score -= s[d][q];
		auto it = held[q].find(d);
		auto rit = next(it);
		auto lit = prev(it);
		score += c[q] * range(*lit, *rit);
		score -= c[q] * range(*it, *rit);
		score -= c[q] * range(*lit, *it);
		held[q].erase(it);
	}

	void change(int d, int q) {
		erase(d);
		add(d, q);
	}

	void output() {
		for (int i = 0; i < D; i++) {
			cout << t[i] + 1 << endl;
		}
	}
};

int main() {
	tic();
	cin >> D;
	for (Int i = 0; i < KIND; i++) {
		cin >> c[i];
	}
	for (Int d = 0; d < D; d++) {
		for (Int i = 0; i < KIND; i++) {
			cin >> s[d][i];
		}
	}

	ContestInfo ci(D);

	for (int d = 0; d < D; d++) {
		Int t;
		t = rand() % KIND;
		ci.add(d, t);
	}
	Int current_score = ci.score;

	while (toc() < 1.9) {
		Int d, q;
		d = rand() % D;
		q = rand() % KIND;
		int old = ci.t[d];
		ci.change(d, q);
		Int new_score = ci.score;
		if (new_score < current_score) {
			ci.change(d, old);
		} else {
			current_score = new_score;
		}
	}
	ci.output();
	return 0;
}


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

int main(){
	long long n,cnt,ans1=0,ans2=0,sum; cin>>n;
	for(long long i=1;i*i<=n;i++)
		if(n%i==0) cnt=i,sum=n/cnt;;
	while(cnt)
		ans1++,cnt/=10;
	while(sum)
		ans2++,sum/=10;
	cout<<max(ans1,ans2)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  int N,M;
  long long H[100010];
  cin >> N >> M;
  for(int i=0;i<N;i++) cin >> H[i];
  int G[N]={0};
  for(int i=0;i<M;i++){
    int a,b;
    cin >> a >>b;
    if(H[a-1]>H[b-1]){G[b-1]++;}
    if(H[a-1]==H[b-1]){G[a-1]++;G[b-1]++;}
    if(H[a-1]<H[b-1]){G[a-1]++;}
  }
  int count =0;
  for(int i=0;i<N;i++){if(G[i]==0)count++;}
  cout << count << endl;
}

Measured memory_bytes: 4808
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
ll C;
ll x[100100];
ll v[100100];
ll L[100100];
ll R[100100];
int main(){
	scanf("%d %lld",&N,&C);
	for(int i=0;i<N;i++){
		scanf("%lld %lld",&x[i],&v[i]);
	}
	ll sum = 0ll;
	for(int i=0;i<N;i++){
		if(i>0)L[i] = max(L[i],L[i-1]);
		sum += v[i];
		L[i] = max(L[i],sum-x[i]*2ll);
	}
	sum = 0ll;
	for(int i=N-1;i>=0;i--){
		if(i<N-1)R[i] = max(R[i],R[i+1]);
		sum += v[i];
		R[i] = max(R[i],sum-(C-x[i])*2ll);
	}
	ll ans = 0ll;
	sum = 0ll;
	for(int i=0;i<N;i++){
		sum += v[i];
		ans = max(ans,sum-x[i]+R[i+1]);
	}
	sum = 0ll;
	for(int i=N-1;i>=0;i--){
		sum += v[i];
		if(i>0)ans = max(ans,sum-(C-x[i])+L[i-1]);
		else ans = max(ans,sum-(C-x[i]));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define mem0(x) memset(x,0,sizeof(x))
#define meminf(x) memset(x,0x3f,sizeof(x))
#define VI vector<int>
#define VL vector<ll>
using namespace  std;

const ll modd = 1e9+7;

ll qpow(ll a,ll b){
    ll ans = 1,base =a;
    while(b){
        if(b&1){
            ans = (ans * base)%modd;
        }
        base = (base *base )%modd;
        b>>=1;
    }
    return ans;
}
int main(){
    ios::sync_with_stdio(0);
    int n;cin>>n;
    if(n==1) {
        cout<<0;return 0;
    }
    cout<< (ll)((qpow(10,n) + qpow(8,n) - qpow(9,n)*2)%modd+modd)%modd;

    
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define reps(i, n , m) for(ll i = n; i <= m; i++)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
const int mod = 1000000007; 
long long inv[200000],fact[200000],ifact[200000];
long long comb(ll n, ll k){
	if(n<k)return 0;
	else if (n<0||k<0) return 0;
	else return fact[n] * ifact[k] % mod * ifact[n-k] % mod;
}
 
 
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	/*inv[1] = fact[0] = fact[1] = ifact[0] = ifact[1] = 1; for (int i=2;i<200000;i++){ inv[i] = (mod - mod / i) * inv[mod % i] % mod; fact[i] = fact[i-1] * i % mod;ifact[i] = ifact[i-1] * inv[i] % mod;
	}*/ //nCr
	ll L,R;
	cin>>L>>R;
	if(R-L>=7000){
		cout<<0<<endl;
		return 0;
	}
	ll ans=2019;
	reps(i,L,R-1){
		reps(j,i+1,R){
			ll t=0;
			t=(i*j);
			t%=2019;
			//if(t==0){cout<<i<<999<<j<<endl;break;}
			ans=min(ans,t);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt(), k = in.nextInt();
			int[] a = in.nextIntArray(n);
			Arrays.sort(a);
			int min = a[0];
			for (int i = 1; i < n; i++) {
				min = Math.min(gcd(min, a[i]), min);
			}

			if (k > a[n-1]) {
				out.println("IMPOSSIBLE");
				return;
			}
			if (k % min == 0) {
				out.println("POSSIBLE");
			} else {
				out.println("IMPOSSIBLE");
			}

		}
	}

	public static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 35580
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iostream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <bitset>
# include <set>
# include <cmath>
# include <algorithm>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-3
# define MOD 1000000007
# define INF 1000000000
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define FO(i,a,n) for(int i=a; i<n; ++i)
# define bug puts("H");
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
int Scan() {
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
const int N=100005;
//Code begin...

int main ()
{
    int a, b, c;
    scanf("%d%d%d",&a,&b,&c);
    int sum=100*a+10*b+c;
    puts(sum%4?"NO":"YES");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(s.size()<=k) cout<<s<<endl;
	else{
		cout<<s.substr(0,k);
		cout<<"..."<<endl;
	}
}

Measured memory_bytes: 3652
#include <stdio.h>

long max(long a,long b, long c){
  if(a <= b){
    if(b <= c) return c;
    else return b;
  }else{
    if(a <= c) return c;
    else return a;
  }
}

int main(){
  int n;
  scanf("%d", &n);
  long T[n],A[n];
  long sum,sum_pre;
  long t,t_pre,a,a_pre;
  sum_pre = 1;
  t_pre = 1;
  a_pre = 1;
  long ratio;
  for(int i = 0; i < n; ++i){
    scanf("%ld %ld", &T[i], &A[i]);
    sum = T[i] + A[i];
    t = T[i];
    a = A[i];
    ratio = 1 + max((sum_pre-1)/sum, (a_pre-1)/a, (t_pre-1)/t);//max(ceil(pre/now))
    sum *= ratio;
    t *= ratio;
    a *= ratio;
    sum_pre = sum;
    t_pre = t;
    a_pre = a;
  }
  
  printf("%ld\n", sum);
  return 0;
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int h, n, a, sum = 0;

    cin>> h>> n;


    for(int  i= 0; i<n; i++)
    {
        cin>> a;
        sum+= a;
    }


    cout << (sum>= h? "Yes\n" : "No\n");


    return 0;
}




Measured memory_bytes: 3664
import java.io.*;
class Main{
    public static void main(String[] args){
        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);
        try{
            int a = Integer.parseInt(br.readLine().trim());
            int b = Integer.parseInt(br.readLine().trim());
            int h = Integer.parseInt(br.readLine().trim());
            int s = (a + b) * h / 2;
            System.out.println(s);
        }catch(Exception e){
            System.out.println(e);
        }
    }
}


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

using state = tuple<int,int>;

int main(void){

	int n;
	while(cin >> n,n){

		vector<int> x(n),y(n);
		rep(i,n) cin >> x[i] >> y[i];
		vector<int> a(4),b(4);
		rep(i,4) cin >> a[i] >> b[i];
	
		const int offset = 20005;
		const int total = 40010;
		vector<state> events[total];

		rep(i,n){
			const int cur = i;
			const int nxt = (i+1)%n;
			if(x[cur]==x[nxt]){
				int ly = y[cur], uy = y[nxt];
				if(ly > uy) swap(ly,uy);
				events[x[cur]+offset].push_back(state(ly,uy));
			}
		}

		const int from = min({a[0],a[1],a[2],a[3]});
		const int to = max({a[0],a[1],a[2],a[3]});


		const int bl = min({b[0],b[1],b[2],b[3]});
		const int bu = max({b[0],b[1],b[2],b[3]});
		
		//cerr << "Range: " << from << " " << to << endl;
		//cerr << "Range: " << bl << " " << bu << endl;
		

		int ans = 0LL, cur = 0; 
		set<state> s;

		rep(i,total){
			const int cx = i - offset;
			bool change = false;

			for(auto &e:events[i]){
				change = true;
				if(s.find(e)!=end(s)){
					s.erase(e);
				}else{
					s.insert(e);
				}
			}

			if(cx == from or cx == to) change = true;

			if(change){
				vector<int> imos(total,0);

				for(auto &e:s){
					int ly,uy;
					tie(ly,uy) = e; 
					imos[ly+offset]++;
					imos[uy+offset]++;
				}

				rep(j,total) if(j-1>=0) imos[j] = (imos[j] + imos[j-1]) % 2;

				cur = 0;
				rep(j,total){
					const int cy = j - offset;
					if(from <= cx and cx < to and bl <= cy and cy < bu) continue;
					cur += imos[j];
				}
			}
			ans += cur;
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 4180
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



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

using namespace std;
int a,b,c,d;
int k1,k2;
string s;

int main(){
  cin >> a >> b >> c;
  a -=b;
  cout << a%c << endl;
  
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f;
double x,y;
bool w[10005],s[10005];
int main()
{
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	for(int i=0;i*100<=f;i+=a)
		for(int j=0;j*100+i*100<=f;j+=b)
			w[i+j]=1;
	for(int i=0;i<=f;i+=c)
		for(int j=0;j<=f;j+=d)
			s[i+j]=1;
	for(double i=1;i*100<=f;++i)
		if(w[(int)i])
		{
			double m;
			for(int j=i*e;j>=1;--j) if(i*100+j<=f && s[j]) {m=j;break;}
			if(!x || m/i>y/x) x=i,y=m;
		}
	printf("%.0lf %.0lf\n",x*100+y,y);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 0x7fffffff
#define ll long long
#define REP(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
string solve (int n)
{
        int rem=0;
        while(n)
            {
                rem = n % 10;
                if (rem==7) return "Yes";
                n = n / 10;
            }
            return "No";
}
int main() {
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL);
        // Code Starts...
        int n;
        cin>>n;
        cout<<solve(n)<<endl;
        // Code Ends...
        return 0;
}


Measured memory_bytes: 3604
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

	int n,m;
  cin>>n>>m;
  string s;
  cin>>s;
  int c=0;
  rep(i,s.size()-1)c+=s[i]!=s[i+1];
  c=max(0ll,c-2*m);
  cout<<n-c-1<<endl;
}


Measured memory_bytes: 512
n = int(input())
a = [int(i) for i in input().split()]

cnt = 0
ans = 30
for i in range(n):
	while a[i]%2 == 0:
		a[i] //= 2 
		cnt += 1 
	if ans > cnt:
		ans = cnt
	cnt = 0
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, n) for(int i=n; i>=0; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> T vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> T adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    set<ll> a;
    ll n, tmp;
    cin >> n;
    rep(i, n){
        cin >> tmp;

        if(a.find(tmp) == a.end()){
            a.insert(tmp);
        }else{
            a.erase(tmp);
        }
    }

    cout << a.size() << endl;

    return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  int N, K;
  cin >> N >> K;

  int64_t pat = K;
  for (int i = 2; i <= N; i++) {
    pat *= (K - 1);
  }

  cout << pat << '\n';

  return 0;
}


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

void North(void);
void South(void);
void West(void);
void East(void);
void Right(void);
void Left(void);
void Init(void);

using namespace std;

int DiceTop = 1;
int DiceBottom = 6;
int DiceWest = 4;
int DiceEast = 3;
int DiceSouth = 2;
int DiceNorth = 5;
int DiceSum = 1;

int main(void)
{
    int n;
    string str;

    while (1){
        scanf("%d", &n);

        if (n == 0){
            break;
        }

        for (int i = 0;i < n;i++){
      
            cin >> str;

            if (str == "North"){
                North();
            }
            else if (str == "South"){
                South();
            }
            else if (str == "West"){
                West();
            }
            else if (str == "East"){
                East();
            }
            else if (str == "Right"){
                Right();
            }
            else if (str == "Left"){
                Left();
            }
        }
        printf("%d\n", DiceSum);
        Init();
    }
 
    return 0;
}

void North(void)
{
    int tmp;

    tmp = DiceTop;
    DiceTop = DiceSouth;
    DiceSouth = DiceBottom;
    DiceBottom = DiceNorth;
    DiceNorth = tmp;

    DiceSum += DiceTop;
}

void South(void)
{
    int tmp;

    tmp = DiceTop;
    DiceTop = DiceNorth;
    DiceNorth = DiceBottom;
    DiceBottom = DiceSouth;
    DiceSouth = tmp;

    DiceSum += DiceTop;
}

void West(void)
{
    int tmp;

    tmp = DiceTop;
    DiceTop = DiceEast;
    DiceEast = DiceBottom;
    DiceBottom = DiceWest;
    DiceWest = tmp;

    DiceSum += DiceTop;
}

void East(void)
{
    int tmp;

    tmp = DiceTop;
    DiceTop = DiceWest;
    DiceWest = DiceBottom;
    DiceBottom = DiceEast;
    DiceEast = tmp;

    DiceSum += DiceTop;
}

void Right(void)
{
    int tmp;

    tmp = DiceSouth;
    DiceSouth = DiceEast;
    DiceEast = DiceNorth;
    DiceNorth = DiceWest;
    DiceWest = tmp;

    DiceSum += DiceTop;
}

void Left(void)
{
    int tmp;

    tmp = DiceSouth;
    DiceSouth = DiceWest;
    DiceWest = DiceNorth;
    DiceNorth = DiceEast;
    DiceEast = tmp;

    DiceSum += DiceTop;
}

void Init(void)
{
    DiceTop = 1;
    DiceBottom = 6;
    DiceWest = 4;
    DiceEast =3;
    DiceSouth = 2;
    DiceNorth = 5;
    DiceSum = 1;
}

Measured memory_bytes: 0