akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array
#define deb(x) cout << #x << " = " << x << endl
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll N = 2e5 + 1;

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
inline ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
struct comp
{
    bool operator()(const pair<ll, ll> &x, const pair<ll, ll> &y) const
    {
        return x.first < y.first;
    }
};
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwr(ll x, ll n)
{
    if (n == 0)
        return 1;
    if (n & 1)
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    else
        return pwr(mul(x, x), n / 2);
}
ll modInv(ll n)
{
    return pwr(n, mod - 2);
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}

int main()
{
    IOS;
    int t = 1;
    // cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int d1[n], d2[n];

        for (int i = 0; i < n; i++)
        {
            cin >> d1[i] >> d2[i];
        }
        bool f = false;
        for (int i = 0; i < n; i++)
        {
            int j = i;
            while (j < n && d1[j] == d2[j])
                j++;
            if (j - i >= 3)
            {
                f = true;
            }
        }
        if (f)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define FORR(i, a, b) for (int i = a; i <= b; i++)
#define REP(i, a, b) for (int i = b - 1; i >= a; i--)
#define FORI(i, a, b, inc) for (int i = a; i <= b; i += inc)
#define FORRI(i, a, b, inc) for (int i = a; i < b; i += inc)
#define REPD(i, a, b, dec) for (int i = b - 1; i >= a; i -= dec)
#define SORT(a, n) sort(a, a + n, greater<int>())
#define PREC(n) cout << fixed << setprecision(n)
#define ULL unsigned long long
#define FT first
#define SN second
#define Vsort(v) sort(v.begin(), v.end())
#define FORV(it, l) for (auto it : l)
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define RESET(a, b) memset(a, b, sizeof(a))
#define PI acos(-1)
#define S " "
//#define VSE(v) v.begin(), v.end()
typedef vector<int> VC;
typedef vector<long long> VCL;
typedef vector<VC> VCC;
typedef pair<int, int> PR;
typedef vector<PR> VPR;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef set<PR> STP;

void solve()
{
    /*Md. Bokhtiar Nadeem Shawon
    Institute of Information Technology
    Jahangirnagar University
    */
    LL m, n, k, x, mx = 0;
    cin >> n >> m >> k;
    VCL v1(n + 1, 0), v2(m + 1, 0);
    FORR(i, 1, n)
    {
        cin >> x;
        v1[i] = v1[i - 1] + x;
    }
    FORR(i, 1, m)
    {
        cin >> x;
        v2[i] = v2[i - 1] + x;
    }
    FORR(i, 0, n)
    {
        if (k >= v1[i])
        {
            LL diff = k - v1[i];
            auto xd = upper_bound(v2.begin(), v2.end(), diff);
            x = xd - v2.begin();
            x--;
            mx = max(mx, i + x);
        }
    }
    cout << mx << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    /*cin >> t;
    while (t--)*/
    solve();
    return 0;
}

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

using namespace std;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n;
	cin >> n;
	vector<int> A(n);
	for (auto &i: A)cin >> i;

	vector<int> B = A;
	sort(B.begin(), B.end());
	int odd = 0;
	for (int i = 0; i < A.size(); ++i) {
	  int j = lower_bound(B.begin(), B.end(), A[i]) - B.begin();
	  if ((i - j) % 2)
		++odd;
	}
	cout << odd / 2 << '\n';

  return 0;
}


Measured memory_bytes: 1024
import fractions

A, B = map(int, input().split())

x = fractions.gcd(A, B)

C = []

def cal(i):
    for j in range(2, int(-(-i**0.5//1))+1):
        while True:
            if i%j == 0:
                i //= j
                C.append(j)
            else:
                break
    if i != 1:
        C.append(i)
        
    return set(C)

print(1+len(cal(x)))

Measured memory_bytes: 5048
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

N = int(input())
edge = [[] for i in range(N + 1)]
for i in range(N - 1):
    a, b, c = [int(t) for t in input().split()]
    edge[a].append((b, c))
    edge[b].append((a, c))

Q, K = [int(t) for t in input().split()]

def dfs(s):
    '''Kからの距離を計算'''
    global dist
    work = [s]
    while len(work) > 0:
        s = work.pop()
        for t, c in edge[s]:
            if dist[t] == None:
                dist[t] = dist[s] + c
                work.append(t)

dist = [None] * (N + 1)  # Kからの距離
dist[K] = 0
dfs(K)

for i in range(Q):
    x, y = [int(t) for t in input().split()]
    print(dist[x] + dist[y])


Measured memory_bytes: 44560
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a+b==15) {
			System.out.println("+");
		}else {
			if(a*b==15) {
				System.out.println("*");
			}else {
				System.out.println("x");
			}
		}
	}

}

Measured memory_bytes: 23636
#include "bits/stdc++.h"
using namespace std;
const int N = 2e5 + 5;
bool p[N];
void sieve(){
	p[0] = 1;
	p[1] = 1;
	for(int i = 2 ; i * i < N ; ++i){
		if(!p[i]){
			for(int j = i * i ; j < N ; j += i){
				p[j] = 1;
			}
		}
	}
}
int sum[N];
void pre(){
	sum[0] = 0;
	for(int i = 1 ; i < N - 2 ; i += 2){
		sum[i] = sum[i - 1];
		if(!(p[i] | p[i + 1 >> 1])){
			++sum[i];
		}
		sum[i + 1] = sum[i];
	}
}
int q , l , r;
int main(){
	sieve();
	pre();
	scanf("%d" , &q);
	while(q--){
		scanf("%d %d" , &l , &r);
		printf("%d\n" , sum[r] - sum[l - 1]);
	}
}

Measured memory_bytes: 1664
def dice():
    dnum = list(map(int,input().split()))
    up = dnum[0]
    un = dnum[5]
    ri = dnum[2]
    le = dnum[3]
    fr = dnum[1]
    ba = dnum[4]
    tmp = int(0)
    tmp2 = int(0)
    ordertmp = input()
    order = list(ordertmp)
    
    for x in order :
        if (x == "S"):
            tmp = fr
            tmp2 = un
            fr = up
            up = ba
            un = tmp
            ba = tmp2

        elif (x == "N"):
            tmp = un
            tmp2 = up
            up = fr
            un = ba
            fr = tmp
            ba = tmp2

        elif (x == "E"):
            tmp = up
            tmp2 = un
            up = le
            un = ri
            ri = tmp
            le = tmp2

        elif (x == "W"):
            tmp = un
            tmp2 = up
            up = ri
            un = le
            ri = tmp
            le = tmp2
    print(up)

dice()



Measured memory_bytes: 5608
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

#include <functional>
#include <climits>

//SegmentTree<int> seg(N,[](int a,int b){return min(a,b);},INT_MAX);
template< typename T>
class SegmentTree{
public:

  using F = function<T(T,T)>;

  int n;
  vector<T> tree;
  const F operation;
  const T def;

  SegmentTree(int size,F _operation,T _def):operation(_operation),def(_def){
    n=1;
    while(n<size) n*=2;
    tree.resize(2*n-1,def);
  }

  void initialize(vector<T> v){
    int vSize=v.size();
    n=1;
    while(n<vSize) n*=2;
    tree.resize(2*n-1,def);

    for(int i=0;i<vSize;i++) tree[i+n-1]=v[i];
    for(int i=n-2;i>=0;i--) tree[i]=operation(tree[2*i+1],tree[2*i+2]);
  }

  void update(int index,T value){
    index+=n-1;

    tree[index]=value;
    while(index>0){
      index=(index-1)/2;
      tree[index]=operation(tree[2*index+1],tree[2*index+2]);
    }
  }

  T query(int a,int b,int k=0,int l=0,int r=-1){//[a,b),getMin(a,b,0,0,-1)
    if(r<0) r=n;

    if(r<=a||b<=l) return def;
    else if(a<=l&&r<=b) return tree[k];
    else{
      T lval=query(a,b,2*k+1,l,(l+r)/2);
      T rval=query(a,b,2*k+2,(l+r)/2,r);
      return operation(lval,rval);
    }
  }
};

struct Node{
  ll l,r,sum,ans;
};

int N,Q;
vector<ll> A;

Node f(Node a,Node b){
  Node res;
  res.l=max(a.l,a.sum+b.l);
  res.r=max(b.r,b.sum+a.r);
  res.sum=a.sum+b.sum;
  res.ans=max(a.r+b.l,max(a.ans,b.ans));

  return res;
}

int main(){
  cin>>N>>Q;
  A.resize(N);
  rep(i,N) cin>>A[i];

  SegmentTree<Node> seg(N+1,f,Node{0,0,0,0});
  for(int i=0;i<N;i++){
    ll v=max(0ll,A[i]);
    seg.update(i,Node{v,v,A[i],v});
  }

  while(Q--){
    cout<<seg.query(0,N).ans<<endl;
    ll x,a;
    cin>>x>>a;
    x--;
    ll v=max(0ll,a);
    seg.update(x,Node{v,v,a,v});
  }
  cout<<seg.query(0,N).ans<<endl;
  

  return 0;
}



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

int main(void){
    int n;
    int flag = 0;
    cin >> n;
    int m = n;
    while(m >= 0){
        if(m%7 == 0){
            flag = 1;
            break;
        }
        m -= 4;
    }
    while(n >= 0 && flag == 0){
        if(n%4 == 0){
            flag = 1;
            break;
        }
        n -= 7;
    }

    if(flag == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

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

int main(){
    int h, w, d, n; cin>>h>>w>>d>>n;
    int sy, sx;
    vector<string> s(h);
    for(int i=0; i<h; i++){
        cin>>s[i];
        for(int j=0; j<w; j++){
            if(s[i][j] == 'D'){
                sy = i;
                sx = j;
                s[i][j] = '.';
            }
        }
    }

    vector<int> r;
    r.emplace_back(0);
    for(int i=0; i<d; i++){
        int x; cin>>x;
        r.emplace_back(x);
    }
    r.emplace_back(100);

    vector<vector<int>> ban(h, vector<int>(w, 0));
    for(int i=0; i<n; i++){
        int x, y, s; cin>>x>>y>>s;
        for(int j=max(0, y-r[s+1]); j<=min(h-1, y+r[s+1]); j++){
            for(int k=max(0, x-r[s+1]); k<=min(w-1, x+r[s+1]); k++){
                ban[j][k]++;
            }
        }

        if(s == 0) continue;

        for(int j=max(0, y-r[s]); j<=min(h-1, y+r[s]); j++){
            for(int k=max(0, x-r[s]); k<=min(w-1, x+r[s]); k++){
                ban[j][k]--;
            }
        }
    }

    vector<pair<int, int>> Pair;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(s[i][j] == '#') continue;
            if(ban[i][j] == n){
                Pair.emplace_back(i, j);
            }
        }
    }

    if(Pair.size() == 0){
        cout << "Broken" << endl;
        return 0;
    }

    queue<pair<int, int>> que;
    que.emplace(sy, sx);
    vector<vector<bool>> visited(h, vector<bool>(w, false));
    visited[sy][sx] = true;
    while(que.size()){
        int cy, cx;
        tie(cy, cx) = que.front();
        que.pop();

        for(int i=0; i<4; i++){
            int ny = cy + dy[i];
            int nx = cx + dx[i];

            if(!(0 <= ny && ny < h && 0 <= nx && nx < w)) continue;
            if(s[ny][nx] == '#') continue;
            if(visited[ny][nx]) continue;

            visited[ny][nx] = true;
            que.emplace(ny, nx);
        }
    }

    bool isYes = false;
    bool isNo = false;
    for(int i=0; i<Pair.size(); i++){
        int cy, cx;
        tie(cy, cx) = Pair[i];

        if(visited[cy][cx]){
            isYes = true;
        }
        else{
            isNo = true;
        }
    }

    if(isYes && isNo){
        cout << "Unknown" << endl;
    }
    else if(isYes){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int main() {
	int n;
	scanf("%d", &n);
	int mn = INT_MAX;
	int sum = 0;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
		if (a[i] % 10 != 0) mn = min(mn, a[i]);
		sum += a[i];
	}
	if (mn == INT_MAX) printf("0\n");
	else if (sum % 10) printf("%d\n", sum);
	else printf("%d\n", sum - mn);
}


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

using namespace std;

int cnt, m;
int G[100]={1};

void insertionSort(int *A, int n, int g){
  for(int i=g;i<n;i++){
    int v=A[i];
    int j=i-g;

    while(j>=0&&A[j]>v){
      A[j+g]=A[j];
      j-=g;
      cnt++;
    }

    A[j+g]=v;
  }
}

void shellSort(int *A, int n){
  cnt=0;

  for(int i=1;i<100;i++){
    G[i]=3*G[i-1]+1;
    if(G[i]>n){
      m=i;
      break;
    }
  }

  for(int i=0;i<m;i++){
    insertionSort(A, n, G[m-i-1]);
  }
}

int main(){

  int n, a[1000000];

  cin>>n;
  for(int i=0;i<n;i++) cin>>a[i];

  shellSort(a, n);

  cout<<m<<endl;

  for(int i=0;i<m;i++){
    cout<<(i?" ":"");
    cout<<G[m-i-1];
  }
  cout<<endl;

  cout<<cnt<<endl;

  for(int i=0;i<n;i++) cout<<a[i]<<endl;

  return 0;
}



Measured memory_bytes: 6996
#include <cstdio>
#include <cstring>
#include <algorithm>
#define max_m 262144
using namespace std;
int a[max_m],b[max_m];
void deal(int x,int y){
	if(a[y]>a[x]){
		b[x]=max(a[x],b[y]);
		a[x]=a[y];
	}
	else
		a[y]>b[x]&&(b[x]=a[y]);
//	printf("*%d %d %d\n",x,a[x],b[x]);
}
int maxify(int&x,const int&y){
	return y>x?(x=y):x;
}
int main(){
	int n,m;
	scanf("%d",&n);
	m=1<<n;
	for(int i=-1; ++i<m; scanf("%d",a+i));
	memset(b,0,sizeof(b));
	for(int i=1,x=1; (x<<=1)<=m; i=x)
		for(int j=0; j<m; j+=x)
			for(int k=0; k<i; ++k)
				deal(j|i|k,j|k);
	for(int i=0,ans=0; ++i<m; printf("%d\n",maxify(ans,a[i]+b[i])));
	return 0;
}

Measured memory_bytes: 5228
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
    int n,x[100], y[100];
    cin>>n;
    for(int i=0; i<n; i++)cin>> x[i];
    for(int i=0; i<n; i++)cin >> y[i];
    
    double d[4];
    for(int i=0;i<4; i++) d[i]=0.0;
    
    for(int p=1; p<=3; p++){
        for(int i=0; i<n; i++){
            d[p] += pow(fabs(x[i] - y[i]), p);
        }
        d[p] = pow(d[p], 1.0/p);
    }
    
    for(int i=0; i<n; i++){
        d[0]= (d[0]<fabs(x[i]-y[i])?fabs(x[i]-y[i]):d[0]);
    }
    
    printf("%lf\n",d[1]);
    printf("%lf\n",d[2]);
    printf("%lf\n",d[3]);
    printf("%lf\n",d[0]);
    
    return 0;
}


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

int main(){
	ios::sync_with_stdio(false);
	ll H,W,M; cin>>H>>W>>M;
	map<int,int> h,w;
	map<pair<int,int>,int> hw;

	
	rep(i,M){
		int a,b; cin>>a>>b;
		h[a]++;
		w[b]++;
		hw[pair(a,b)]++;
	}

	int hmax=0 ,wmax=0;
	// 最大値を取得する
	for(auto x:h){
		hmax = max(hmax, x.second);
	}
	for(auto y:w){
		wmax = max(wmax, y.second);
	}

	// 最大値を取る行と列を取得
	vector<int> hnum,wnum;
	for(auto x:h){
		if(hmax == x.second) hnum.push_back(x.first);
	}
	for(auto y:w){
		if(wmax == y.second) wnum.push_back(y.first);
	}

	if((H*W-max(H,W)) < W){
		cout << hmax + wmax - 1 << endl; return 0;
	}

	bool flg=false;
	for(int i=0; i<hnum.size(); i++){
		for(int j=0; j<wnum.size(); j++){
			if(!hw[pair(hnum[i],wnum[j])]){
				flg = true;
				break;
			}
		}
		if(flg) break;
	}

	if(flg){
		cout << hmax + wmax << endl;
	}else{
		cout << hmax + wmax - 1 << endl;
	}

	// cerr << "hmax: " << hmax << endl;
	// cerr << "wmax: " << wmax << endl;
	
}


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

using namespace std;

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

	if(b > 0 && d > 0) {
		cout << max(a * c,b * d) ;
	} else if(b > 0 && d <0 && a > 0){
		cout << max(b * c,a * d) ;
	} else if(b < 0 && a < 0 && c > 0){
		cout << max(a * d, b * c);
	} else if(a < 0 && c > -1 || c < 0 && a > -1) {
		cout << max(a*c, b * d);
	} else {
		cout << max(b * d, a * c);
	}

	return 0;
}

Measured memory_bytes: 3624
module app;

import std.conv;
import std.stdio;
import std.string;

void main()
{
	auto input = parseInput();
	auto output = input.a >= 3200 ? input.s : "red";
	writefln("%s", output);
}

struct Input
{
	uint a;
	string s;
}

Input parseInput()
{
	Input input = void;
	input.a = readln().strip().to!uint;
	input.s = readln().strip();
	return input;
}


Measured memory_bytes: 256
def jp(Y):
    if Y > 1988:
        return f"H{Y-1988}"
    elif Y > 1925:
        return f"S{Y-1925}"
    elif Y > 1911:
        return f"T{Y-1911}"
    elif Y > 1911:
        return f"T{Y-1911}"
    else:
        return f"M{Y-1867}"

def meiji(Y):
    return f"{1867+Y}"

def taisho(Y):
    return f"{1911+Y}"

def syowa(Y):
    return f"{1925+Y}"

def heisei(Y):
    return f"{1988+Y}"

E, Y = map(int, input().split())
print([jp(Y), meiji(Y), taisho(Y), syowa(Y), heisei(Y)][E])



Measured memory_bytes: 5612
q,h,s,d = map(int, raw_input().split())
n = int(raw_input())
if q * 4 < s:
    s = q * 4
if h * 2 < s:
    s = h * 2
if s * 2 < d:
    d = s * 2
print (n / 2) * d + (n % 2) * s


Measured memory_bytes: 2568
from copy import copy

n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)

edge_set = [set() for i in range(n)]
edge_id = 0

def dfs(p,v,se):
    global edge_id
    edge_set[v] = se
    for to in G[v]:
        if to != p:
            nset = copy(se)
            nset.add(edge_id)
            edge_id += 1
            dfs(v,to,nset)

dfs(-1,0,set())

m = int(input())
edge_set2 = []
for i in range(m):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    edge_set2.append(edge_set[a]^edge_set[b])

from itertools import combinations
ans = 0
for i in range(m):
    op = -1 if i%2 else 1
    for c in combinations(range(m), i+1):
        s = set()
        for j in c:
            s |= edge_set2[j]
        rem = n-1 - len(s)
        ans += op*(1<<rem)
ans = 2**(n-1) - ans
print(ans)



Measured memory_bytes: 42960
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, ans=0;
    cin >> n;
    string s;
    cin >> s;
    
    for(int i=1;i<n;i++){
        int count=0;
        for(char c='a';c<='z';c++){
            bool right=false, left=false;
            
            for(int j=0;j<i;j++){
                if(s[j]==c) left=true;
            }
            for(int j=i;j<n;j++){
                if(s[j]==c) right=true;
            }
            if(right==true && left==true) count++;
            
        }
        if(ans<count) ans=count;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int w,h,c,x,a,b;
	scanf("%d %d %d",&w,&h,&c);
	if(w>h){
		x=h;
	}
	if(h>w){
		x=w;
	}
	while(1){
		if(h%x==0&&w%x==0){
			break;
		}
		x=x-1;
	}
	a=(h/x)*(w/x);
	b=a*c;
	printf("%d\n",b);
	return 0;
}


Measured memory_bytes: 2760
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    vector<int> decimal(7);
    decimal[6] = 5000000;
    for(int i=5; i>=0; --i)
        decimal[i] = decimal[i+1] / 2;

    int n;
    cin >> n;

    while(--n >= 0){
        string s;
        cin >> s;

        unsigned a = 0;
        for(int i=0; i<8; ++i){
            int b;
            if(isdigit(s[i]))
                b = s[i] - '0';
            else
                b = s[i] - 'a' + 10;
            a <<= 4;
            a += b;
        }

        bool sign = false;
        if(a & (1u<<31)){
            sign = true;
            a &= ~(1u<<31);
        }

        int x = 0;
        for(int i=0; i<7; ++i){
            if(a & 1)
                x += decimal[i];
            a >>= 1;
        }

        ostringstream oss;
        if(sign)
            oss << '-';
        oss << a << '.' << setfill('0') << setw(7) << x;

        string ret = oss.str();
        while(ret[ret.size()-2] != '.' && ret[ret.size()-1] == '0')
            ret.resize(ret.size() - 1);
        cout << ret << endl;
    }

    return 0;
}

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

int main() {
	long long n, m; cin >> n >> m;
	vector<pair<long long, long long>> d(n);
	for (int i = 0; i < n; i++)
	{
		long long a, b;
		cin >> a >> b;
		d[i] = make_pair(a, b);
	}
	sort(d.begin(), d.end());

	long long res = 0;
	int i = 0;
	while (m > 0)
	{
		long long buy = min(m, d[i].second);
		res += d[i].first * buy;
		m -= buy;
		i++;
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 4752
#include <iostream>
#include <vector>
 
class Road{
private:
    int col,row,close_num, goal_num;
    std::vector<int> close_x;
    std::vector<int> close_y;
     
public:
    Road(int a, int b, int n){
        col = a;
        row = b;
        close_num = n;
        close_x.resize(n);
        close_y.resize(n);
        goal_num = 0;
    }
	
	~Road() = default;
     
    void inPoint(){
        for(int i=0; i<close_num; ++i){
            std::cin >> close_x[i] >> close_y[i];
        }
    }
     
    void go_road(int now_x,int now_y){
        if(now_x == col && now_y == row){
            ++goal_num;
            return;
        }
         
        if(now_x+1 <= col)
            if(isGo(now_x+1, now_y)) go_road(now_x+1, now_y);
         
        if(now_y+1 <= row)
            if(isGo(now_x, now_y+1)) go_road(now_x, now_y+1);
    }

    int isGo(int x, int y){
        for(int i=0; i<close_num; ++i){
            if(x == close_x[i] && y == close_y[i]) return 0;
        }
        return 1;
    }
     
    void showGoal(){ std::cout << goal_num << std::endl; }
};
 
int main(){
    int a,b;
 
    while(std::cin >> a >> b){
        if(a == 0 && b == 0) break;
         
        int n;
        std::cin >> n;
         
        Road road(a,b,n);
        road.inPoint();
        road.go_road(1,1);
        road.showGoal();
    }
     
    return 0;
}

Measured memory_bytes: 1200
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-04-02 22:20:12
                2020-04-02 22:28:10
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rev(x) greater<(x)>()
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

LL modpower(LL n, LL m, LL mod) {
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod) {
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod) {
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

int gcd(int k, int l) {
    if (l > 0) return gcd(l, k%l);
    else return k;
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    vector<int> a(3);
    for (int i = 0; i < 3; i++)
        cin >> a[i];

    sort(all(a));

    int ans = a[2] - a[0];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve()
{
    int n; cin >> n;
    int first = INT_MAX;
    int mark[n+5] = {};
    for(int i = 1; i <= sqrt(n)+10; i++)
    {
        for(int j = 1; j <= sqrt(n)+10; j++)
        {
            for(int k = 1; k <= n; k++)
            {
                ll sum = (i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(k*i);
                if(sum > n)
                {
                    first = k;
                    break;
                }
                else
                {
                    mark[sum]++;
                }
            }
        }
    }
    for(int i = 1; i <= n; i++)
    {
        cout << mark[i] << endl;
    }
}
int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 3548
#include <stdio.h>


long big(long a, long b) {
	if (a > b) {
		return a;
	}
	else {
		return b;
	}
}

long gcd(long a, long b) {
	long tmp, r;

	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

int main() {
	long N, A[100000], i, L[100000], R[100000], MAX;

	scanf("%ld", &N);
	for (i = 0; i < N; i++) {
		scanf("%ld", &A[i]);
	}

	L[0] = A[0];
	for (i = 1; i < N - 1; i++) {
		L[i] = gcd(L[i - 1], A[i]);
	}

	R[N - 1] = A[N - 1];
	for (i = N - 2; i > 0; i--) {
		R[i] = gcd(R[i + 1], A[i]);
	}

	MAX = big(L[N - 2], R[1]);
	for (i = 1; i < N - 1; i++) {
		MAX = big(MAX, gcd(L[i - 1], R[i + 1]));
	}

	printf("%ld\n", MAX);

return 0;
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int main() {
  int K, X, l, r; cin >> K >> X;
  l = X - K + 1; r = X + K - 1;
  if(l < -1000000) l = -1000000;
  if(r > 1000000) r = 1000000;
  for(int i = l; i <= r; i++) cout << i << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int L = in.nextInt();
        int R = in.nextInt();
        int d = in.nextInt();

        int ans = 0;
        for (int i = L; i <= R; i++) if (i % d == 0)
            ans++;
        out.println(ans);

        out.flush();
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}



Measured memory_bytes: 32544
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
#endif

	
		int n;
		cin>>n;
		vector<int> a(n+1);
		bool flag=0;
		for(int i=1;i<=n;i++)
		{
			cin>>a[i];
			if(a[i]%2==0)
			{
				if(a[i]%3!=0 && a[i]%5!=0)
				{
					flag=1;
				}
			}
		}

		if(flag)
		{
			cout<<"DENIED"<<endl;
		}
		else
		{
			cout<<"APPROVED"<<endl;
		}




	
	return 0;
}	

Measured memory_bytes: 3584
n,m = map(int, input().split()) 

pena=[0]*(n+1)
seitou=[0]*(n+1)

for i in range(m):
    p,s = map(str,input().split()) 
    p=int(p)
    if s=="WA" and seitou[p]==0:
        pena[p]+=1
    if s=="AC":
        seitou[p]=1

pena_kazu=0

for i in range(1,n+1):
    if seitou[i]==1:
        pena_kazu+=pena[i]

seitou_kazu=sum(seitou)

print(str(seitou_kazu)+" "+str(pena_kazu))

Measured memory_bytes: 10252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

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

Measured memory_bytes: 256
// Abhishek Chaturvedi- abhishekchaturvedi10oct //

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define endl            "\n"
#define inf             2e18+1
#define ninf            -2e18+1
#define mod             1000000007
#define eps             1e-9
#define ff              first
#define ss              second
#define int             long long
#define ld              long double
#define str             string 
#define pb              emplace_back
#define mp              make_pair
#define vi              vector<int>
#define si              set<int>
#define pii             pair<int,int>
#define psi             pair<str,int>
#define mii             map<int,int>
#define msi             map<str,int>
#define maxheap         priority_queue<int>
#define minheap         priority_queue<int,vi,greater<int>>
#define sz(x)           (int)x.size()
#define all(x)          x.begin(),x.end()
#define allr(x)         x.rbegin(),x.rend()
#define gcd(x,y)        __gcd(x, y)
#define arrsz(x)        sizeof(x)/sizeof(x[0])
#define sp(x,y)         fixed<<setprecision(y)<<x
#define tc(x)           int x; cin>>x; while(x--)
#define loopf(i,x,y)    for(int i=x;i<=y;i++)
#define loopb(i,x,y)    for(int i=x;i>=y;i--)
#define in(x,n)         int x[n];loopf(i,0,n-1) cin>>x[i];
#define out(x)          for(auto i:x) cout<<i<<" "; cout<<endl;
#define init(x,n,y)     int x[n];loopf(i,0,n-1) x[i]=y;
void fastIO(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

void solve(){  
    int n,k; cin>>n>>k; in(a,n); init(dp,n,inf); dp[0]=0;
    loopf(i,1,n-1){
        loopf(j,1,k){
            if(i>=j){
                dp[i]=min(abs(a[i]-a[i-j])+dp[i-j],dp[i]);
            }
            else break;
        }
    } 
    cout<<dp[n-1];
}

int32_t main(){
    
    fastIO();

    //tc(t){
        solve();
    //}

    return 0;
}

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

using namespace std;

int main(){
    int a[3];
    for(int i = 0;i < 3;i++){
        cin >> a[i];
    }
    sort(a,a+3);
    if(a[0]+a[1] == a[2])cout<< "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {


    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine().trim());
        String[] s=br.readLine().split(" ");
        long[] a=new long[n];
        long res=0;
        for(int i=0;i<n;i++){
            a[i]=Long.parseLong(s[i].trim());
        }

        long last=a[0];
        for(int i=1;i<n;i++){
            if(a[i]<last){
                res+=(last-a[i]);
            }
            last=Math.max(last,a[i]);
        }
        System.out.println(res);





    }






}


Measured memory_bytes: 61744
a, b = map(int, input().split())
# a <= x * 1.08 < a + 1
# b <= x * 1.1 < b + 1
x_min = min(int(a / 0.08), int(b / 0.1))
x_max = max(int((a + 1) / 0.08), int((b + 1) / 0.1))
for x in range(x_min, x_max + 1):
    if int(x * 0.08) == a and int(x * 0.1) == b:
        print(x)
        break
else:
    print(-1)


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

int main(){
    int n, out,tmp, runner, score;
    string str;

    cin >> tmp;
    n = tmp;
    cin.get();
    while (n--){
	out = runner = score = 0;
	while (out!=3){
	    getline(cin, str);
	    if (str == "HIT"){
		runner++;
		if (runner == 4){
		    runner--;
		    score++;
		}
	    }
	    else if (str == "HOMERUN"){
		score += runner += 1;
		runner = 0;
	    } else if (str == "OUT") out++;
	}
	cout << score << endl;
    }
}

Measured memory_bytes: 0
S = input()
T = input()
al = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

setS = []
cnt = 0
for i in range(len(S)):
  if S[i] not in setS:
    S = S.replace(S[i],al[cnt])
    cnt += 1
    setS.append(S[i])

setT = []
cnt = 0
for i in range(len(T)):
  if T[i] not in setT:
    T = T.replace(T[i],al[cnt])
    cnt += 1
    setT.append(T[i])

if S == T:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define mkp(a,b) make_pair(a,b)
#define PI 3.14159265359
#define mset(arr,val) memset(arr,val,sizeof arr)
#define MAXN (ll)2e5+1
#define eb emplace_back
#define mod (long long)(1e9+7)
#define FILE_READ freopen("input.txt","r",stdin)
#define FILE_WRITE freopen("output.txt","w",stdout)
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long ul;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
//    FILE_READ;
//    FILE_WRITE;

    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;++i) cin>>a[i];
    set<int> st;
    st.insert(-1);
    int ans=0;
    for(int i=0;i<n;++i) {
        if(a[i]>=*st.rbegin()) {
            ++ans;
        }
        st.insert(a[i]);
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 256
import sys

def i2s():
    return sys.stdin.readline().rstrip()

def ii2ss(n):
    return [sys.stdin.readline() for _ in range(n)]

def sp2nn(sp, sep=' '):
    return [int(s) for s in sp.split(sep)]

def ss2nn(ss):
    return [int(s) for s in list(ss)]

def main(s):
    dic = {
        'A': 'T',
        'T': 'A',
        'C': 'G',
        'G': 'C',
    }
    print(dic[s])

main(i2s())

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

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
#define CININIT cin.tie(0),ios::sync_with_stdio(false)
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main(){
    CININIT;

    string s;
    string left = "qwertasdfgzxcvb";
    string right = "yuiophjklnm";

    map<char,int> m;
    for(char c:left) m[c] = 0;
    for(char c:right) m[c] = 1;

    while(cin>>s){
        if(s=="#") break;
        vector<int> x(s.size()+1);
        for(int i=0;i<s.size();i++) x[i] = m[s[i]];
        x[s.size()] = x[s.size()-1];

        int cnt=0;
        for(int i=0;i<s.size();i++){
            if(x[i]!=x[i+1]) cnt++;
        }
        cout << cnt << endl;
    }
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define maxn 500005
using namespace std;
const int mod = 998244353;
int n,m,ans,fac[maxn],inv[maxn];
int Pow(int a,int b){int s=1;for(;b;b>>=1,a=1ll*a*a%mod) b&1&&(s=1ll*s*a%mod);return s;}
int C(int n,int m){return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;}
int main()
{
	scanf("%d%d",&n,&m); if(n>m) swap(n,m);
	for(int i=fac[0]=inv[0]=1;i<=m;i++) fac[i]=1ll*fac[i-1]*i%mod;
	inv[m]=Pow(fac[m],mod-2);
	for(int i=m-1;i>=1;i--) inv[i]=1ll*inv[i+1]*(i+1)%mod;
	for(int i=0;i<=n;i++) ans=(ans+(i&1?-1:1)*1ll*C(n,i)*C(m,i)%mod*fac[i]%mod*Pow(m+1,n-i)%mod*Pow(n+1,m-i))%mod;
	printf("%d\n",(ans+mod)%mod);
}

Measured memory_bytes: 7704
#include <string>
#include <algorithm>
#include <iostream>
#include <cctype>
#include <cassert>
using namespace std;
typedef long long ll;
string s;

int number(size_t &c){
  int res = 0;
  while(c < s.size() && isdigit(s[c])){
    res = res * 10 + s[c++] - '0';
  }
  return res;
}

char expr(int n, int &rest, size_t &cur){
  size_t end;
  size_t  cur2 = cur;
  
  while(n--){
 
    while(cur2 < s.size() && s[cur2] != ')'){
  
      if(!isdigit(s[cur2])){
	if(rest == 0) {
	  return s[cur2];
	}else{
	  cur2++;
	  rest--;
	}
      }else{
	int num = number(cur2);
	if(s[cur2] == '('){
	  cur2++;
	  char ch = expr(num, rest, cur2);
	  if(ch != '*') return ch;
	  assert(s[cur2] == ')');
	  cur2++;
	}else{
	  if(rest < num){
	    return s[cur2];
	  }else{
	    rest -= num;
	    cur2++;
	  }
	}
      }
    }
    end = cur2;
    cur2 = cur;
  }
  cur = end;
  return '*';
}
  
int main(){
  size_t cur;
  int ind;
  while(cin >> s >> ind && (s != "0" || ind != 0)){
    cur = 0;
    char res = expr(1, ind, cur);
    if(res != '*') cout << res << endl;
    else cout << 0 << endl;
  }
  return 0;
}
  

Measured memory_bytes: 928
//Hey u r far away to know this
#include <bits/stdc++.h>
using namespace std;
#define     ff      	    	first
#define     pb 	         	push_back
#define     ss          		second
#define     ll      	    	long long
#define     MAX  	       	5000
#define     mpi         		map<int, int>
#define     mpll        		map<ll, ll>
#define     pll         		pair<ll, ll>
#define     plld        		pair<ll, double>
#define     SKILLER     		ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     vi          		std::vector<int>
#define     vll         		std::vector<ll>
#define     vs          		std::vector<string>
#define     vvi         		std::vector<std::vector<int>>
#define     vvll        		std::vector<std::vector<ll>>
#define     all(v)      		v.begin(), v.end()
#define     allr(v)      		v.rbegin(), v.rend()
#define     loop(i, a, b) 	for(int i = a; i < b; i++)
#define 	  debug(x) 		cout << x <<" " <<"\n";
#define 	  debug1(x, y) 	cout << x << " " << y  << "\n";
#define 	  debug2(x, y, z) 	cout << x << " " << y << " " << z<<"\n";
#define 	  int 			ll
const   int N = 1e6+5, Mod = 1e9 + 7;
int32_t main(){
    	SKILLER;
    
      ll a, b , c , k; cin >> a >> b >> c >> k;
      int x = min(k, a);
      ll sum = x;
      k -= x;
      if(k > 0){
      	k -= b;
      	if(k > 0){
      		x = min(k, c);
      		sum -= x;
      	}
      }
      cout << sum;

    	return 0;
}

Measured memory_bytes: 3692
#include <iostream>

int main(){
  long n;
  std::cin >> n;
  std::string s;
  std::cin >> s;

  long left = 0, right = 0;
  for(long i = 0; i < n; ++i){
    if(s[i] == '.')
      ++right;
  }

  long min = right;
  for(long i = 0; i < n; ++i){
    if(s[i] == '.')
      --right;
    else
      ++left;

    long sum = left + right;
    if(sum < min)
      min = sum;
  }

  std::cout << min << std::endl;
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		String s=scanner.next();
		StringBuilder sb=new StringBuilder(s);
		String sf=sb.reverse().toString();
		char[] ch=sf.toCharArray();
		String s2=String.valueOf(ch);
	
		for (int i=0;i<ch.length;i++) {
			if (ch[i]=='b') {
				ch[i]='d';
				continue;
			}
			if (ch[i]=='d') {
				ch[i]='b';
				continue;
			}
			if (ch[i]=='p') {
				ch[i]='q';
				continue;
			}
			if (ch[i]=='q') {
				ch[i]='p';
				continue;
			}
		}
		String s1=String.valueOf(ch);
		
		if (s1.equals(s)) {
			System.out.print("Yes");
		}else {
			System.out.print("No");
		}
	}
}

Measured memory_bytes: 27476
#include <iostream>
#include <string>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include <numeric>
#include <algorithm>

using namespace std;


int main()
{
    int64_t a,b;
    cin >> a >> b;
    
    for(int i = 0; i < 10; ++i){
        int n = b * 10 + i;
        if(floor(n * 0.08) == a){
            cout << n << '\n';
            return 0;
        }
    }
    cout << "-1\n";
    
    return 0;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;


ll N, D, A;
pll M[200010];

signed main(){
    cin >> N >> D >> A;
    ll X, H;
    REP(i, N){
        cin >> X >> H;
        M[i] = pll(X, H);
    }
    sort(M, M + N);
    ll left = 0, right = N - 1;
    ll sum = 0;
    while(M[right].first - M[left].first > 2 * D){
        ll Xl = M[left].first, Xr = M[right].first;
        ll Hl = ((M[left].second + A - 1) / A), Hr = ((M[right].second + A - 1) / A);
        for(int i = left; M[i].first <= Xl + 2 * D; i++){
            M[i].second = max(0LL, M[i].second - Hl * A);
        }
        sum += Hl;
        for(int i = right; M[i].first >= Xr - 2 * D; i--){
            M[i].second = max(0LL, M[i].second - Hr * A);
        }
        sum += Hr;
        while(M[left].second <= 0 && left < N - 1) left++;
        while(M[right].second <= 0 && right > 0) right--;
    }
    ll max_H = 0;
    for(int i = left; i <= right; i++) max_H = max(max_H, M[i].second);
    sum += (max_H + A - 1) / A;
    PRINT(sum);
    return 0;
}

Measured memory_bytes: 3328
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int n,m,cnt,idx;
int dfn[100001];
vector<int> G[100001];
inline int Tjcv(int u,int fa)
{
    int child=0,lowu;
    lowu=dfn[u]=++idx;
    for(int i=0,v;i<G[u].size();i++)
    {
        v=G[u][i];
        if(v!=fa)
        {
            if(!dfn[v])
            {
                ++child;
                int lowv=Tjcv(v,u);
                lowu=min(lowu,lowv);
                if(lowv>dfn[u])
                {
                    ++cnt;
                }
            }
            else
            {
                lowu=min(lowu,dfn[v]);
            }
        }
    }
    return lowu;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=0,u,v;i<m;i++) 
    {
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    for(int i=1;i<=n;i++) 
    {
        if(!dfn[i])
        {
            Tjcv(i,-1);
        }
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
using namespace std;

int main(){

    int n;
    cin >> n;

    vector<int> v(n);
    int max = 0;
    for(int i = 0; i < n; i++){
        cin >> v[i];
        max += v[i];
    }

    sort(v.begin(), v.end());
    for(int i = 0; i < n; i++){
        if(max % 10 != 0){
            cout << max << endl;
            return 0;
        } 
        if(v[i] % 10 != 0){
            cout << max - v[i] << endl;
            return 0;            
        }
    }

    cout << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define optimize ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define INF 2000000020LL
#define ALL(x) x.begin(), x.end()
#define UNIQUE(c) (c).resize(unique(ALL(c)) - (c).begin())
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define POS(n, x) (lower_bound(ALL(n), x) - (n).begin())
#define ll long long
#define ld long double
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define PB push_back
#define EB emplace_back
#define MOD 1000000007
#define PRIME 101 
#define MAXN 200020
#define MAXL 23
#define endl '\n'

using namespace std;

// (1 + sqrt(5)) / 2
const ld GOLDEN_RATIO = 1.6180339887498949025257388711906969547271728515625;
const ld PI = 2.0 * acos(0.0);
const int BLOCK = 333;

int dp[MAXN];
vi grafo[MAXN];

int solve(int u)
{
	if(dp[u] != -1) return dp[u];

	int ans = 1;

	for(auto v : grafo[u])
		ans = max(ans, 1 + solve(v));

	return dp[u] = ans;
}

int main(int argc, char const *argv[])
{
	optimize;
	
	memset(dp, -1, sizeof dp);

	int N, M, u, v;

	cin >> N >> M;

	while(M--)
	{
		cin >> u >> v;

		grafo[u].PB(v);
	}

	int ans = 0;

	for(int i = 1; i <= N; i++)
		// cerr << solve(i) << endl;
		ans = max(ans, solve(i));

	cout << ans - 1 << endl;

	return 0;
}

Measured memory_bytes: 14248