akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int H,W,i,j;
    
    while (1) {
        scanf("%d %d",&H,&W);
        if (H==0&&W==0) {
            break;
        }
        for (i=1; i<=H; i++) {
                for (j=1; j<=W; j++) {
                    if (j==1||j==W||i==1||i==H) {
                        printf("#");
                    }else{
                        printf(".");
                    }
                }
                printf("\n");
        }
        printf("\n");
    }
    return 0;
}

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

using namespace std;

const int DIM =  2e5 + 7;

int dp[DIM][2];

main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;
	
	int n = s.size();
	
	s = ' ' + s;
	
	dp[1][0] = 1;
	dp[2][1] = 1;
	
	if(s[1] != s[2])
		dp[2][0] = 2;
	
	if(s[2] != s[3] && s[1] != s[2])
		dp[3][0] = 3;
	else
	{
		dp[3][0] = 2;
	}
	
	dp[3][1] = 2;
	
	for(int i = 4; i <= n; i++)
	{
		dp[i][0] = dp[i - 1][1] + 1;
		
		if(s[i] != s[i - 1])
			dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1);
		
		dp[i][1] = dp[i - 2][0] + 1;
		
		if(s[i] != s[i - 2] || s[i - 3] != s[i - 1])
		{
			if(dp[i - 2][1] != 0)
				dp[i][1] = max(dp[i][1], dp[i - 2][1] + 1);
		}
	}
	
	cout << max(dp[n][1], dp[n][0]);
}

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


int main(){
	double W,H,x,y;
	cin>>W>>H>>x>>y;
	
	double ans;
	ans=(H*W)/2;
	
	int check=0;
	if(W==x*2&&H==y*2)
		check=1;
	
	cout<<fixed;
	cout<<setprecision(6)<<ans<<' '<<check;
	return 0;
	
	
}














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

int main() {
  int N, A, amr;
  
  cin >> N >> A;
  
  amr = N % 500;
  
  if ( amr <= A  ){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}
  

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

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

  bool Judge;

  if(S.size()%2==0) {
    for(int i=0;i<S.size()/2;i++) {
        if(S.at(2*i) == 'h' && S.at(1+2*i) == 'i') {
            Judge =true;
            } else {
                Judge =false;
                break;
            } 
    }
  } else {
      Judge =false;
  }
  
  if(Judge) {
      cout << "Yes" << endl;
  } else {
      cout << "No" << endl;
  }
}

Measured memory_bytes: 256
S = input()
A,B,C,D='dream','dreamer','erase','eraser'
flag = -1

while(1):
    if len(S)==0:
        flag = 1
        break
    elif S[-7:]==B:
        S=S[:-7]
    elif S[-5:]==A:
        S=S[:-5]
    elif S[-6:]==D:
        S=S[:-6]
    elif S[-5:]==C:
        S=S[:-5]
    else:
        break

if flag == 1:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 133916
#include <stdio.h>

int main() {
    int a, b, c, temp;
    scanf("%d %d %d", &a, &b, &c);
    if(a > b) { temp = a; a = b; b = temp; }
    if(b > c) { temp = b; b = c; c = temp; }
    if(a > b) { temp = a; a = b; b = temp; }

    printf("%d %d %d\n",a ,b ,c);

    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  i64 X, Y, A, B, C, i;
  cin >> X >> Y >> A >> B >> C;
  vi p(A), q(B), r(C);
  REP(0, A, i) {
    cin >> p[i];
  }
  REP(0, B, i) {
    cin >> q[i];
  }
  REP(0, C, i) {
    cin >> r[i];
  }
  sort(all(p), greater<i64>());
  sort(all(q), greater<i64>());
  sort(all(r), greater<i64>());

  auto pi = p.begin() + X;
  auto qi = q.begin() + Y;
  auto ri = r.begin();

  while(ri != r.end()) {
    bool pb = (pi == p.begin()), qb = (qi == q.begin());
    if(pb && qb) {
      break;
    }
    else if(pb && !qb) {
      if(*(qi-1) < *ri) {
	--qi;
	++ri;
      }
      else {
	break;
      }
    }
    else if(qb && !pb) {
      if(*(pi-1) < *ri) {
	--pi;
	++ri;
      }
      else {
	break;
      }
    }
    else {
      if(*(pi-1) <= *(qi-1) && *(pi-1) < *ri) {
	--pi;
	++ri;
      }
      else if(*(qi-1) < *(pi-1) && *(qi-1) < *ri) {
	--qi;
	++ri;
      }
      else {
	break;
      }
    }
  }

  //cout << pi - p.begin() << " " << qi - q.begin() << " " << ri - r.begin() << endl;
  
  i64 ans = accumulate(p.begin(), pi, 0LL)
		   + accumulate(q.begin(), qi, 0LL)
		   + accumulate(r.begin(), ri, 0LL);
  cout << ans << endl;

#if 0
  {
    i64 x, y;
    i64 ans = 0;
    i64 xx = 0, yy = 0;
    REP(1, X+1, x) {
      REP(1, Y+1, y) {
	i64 z = X - x + Y - y;
	if(z <= sz(r)) {
	  i64 candidate = accumulate(p.begin(), p.begin()+x, 0LL) +
	    accumulate(q.begin(), q.begin()+y, 0LL) +
	    accumulate(r.begin(), r.begin()+z, 0LL);
	  if(ans < candidate) {
	    ans = candidate;
	    xx = x, yy = y;
	  }
	}
      }
    }
    cout << ans << " " << xx << " " << yy << endl;
  }
#endif
  return 0;
}


Measured memory_bytes: 2560
input = gets.chomp.chars
stack = []
pairs = []
input.each_with_index do |char, i|
	case char
	when "\\"
		stack << i
	when "/"
		if not stack.empty?
			pairs << [stack.pop, i]
		end
	end
end

if pairs.empty?
	print "0\n0\n"
else
	#display sum
	puts pairs.inject(0){|sum, pair| sum += pair[1] - pair[0]}

	#group pairs into puddles
	pairs.sort!
	puddles = [[pairs.shift]]
	pairs.each do |pair|
		if pair[1] < puddles[-1][0][1] 
			puddles[-1] << pair
		else
			puddles << [pair]
		end
	end

	#display puddles
	print puddles.size
	puddles.each do |puddle|
		print " #{puddle.inject(0){|sum, pair| sum += pair[1] - pair[0]}}"
	end
	print "\n"
end

Measured memory_bytes: 9872
#include <bits/stdc++.h>
#define MAX 1004
#define MODULO 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
#define forn(a,b,c) for(int a=b;a<c;a++)
#define ford(a,b,c) for(int a=b;a>=c;a--)
int h,w;
ll ans, dp[MAX][MAX];
char t[MAX][MAX];
ll paths(int i,int j)
{
    if(i >= h || j >= w)
        return 0;
    if(i == h - 1 && j == w - 1)
        return 1;
    if(t[i][j] == '#')
        return 0;
    if(dp[i][j] != -1)
        return dp[i][j];
    return dp[i][j] = (paths(i + 1, j) + paths(i, j + 1)) % MODULO;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> h >> w;
    forn(i,0,h)
        forn(j,0,w)
            cin >> t[i][j];
    memset(dp, -1, sizeof(dp));
    ans = paths(0,0) % MODULO;
    cout << ans;
    return 0;
}


Measured memory_bytes: 9216
///BISMILLAH'IR  RO'HMANIR  ROH'IM
///RIFAT SHARIAR SAKIL
///SOFTWARE ENGINEERING(SUST)

#include<stdio.h>
int main()
{
    int a,b,s,i;
    scanf("%d %d",&a,&b);

    if((a>=1 && a<=9) &&(b>=1 && b<=9))
    {
        s=a*b;
        printf("%d",s);

    }
    else printf("-1");
    return 0;
}


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

#include <math.h>
#include <stdlib.h>


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

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    int ans = 1;
    int cnt = 0;
    for(int i = 1; i<= n; i++){
        int p = i;
        int c = 0;
        while(p %2 == 0){
            p /=2;
            c++;
        }
        if(c >cnt){
            ans = i;
            cnt = c;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#float型を許すな
#numpyはpythonで
#dp
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

alphasm=[chr(i) for i in range(97, 97+26)]
n=I()
s=""
while n>0:
    n-=1
    x=n%26
    s+=alphasm[x%26]
    n=(n-x)//26
u=list(reversed(s))
print("".join(u))
#for i in range(15):
# print(26**i)

Measured memory_bytes: 9392
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
using namespace std;

int n, m, r=-2, a[103];

char trans(int x) {
    if (x < 10) return x + '0';
    else return x - 10 + 'A';
}

int main() {
    scanf("%d", &n);
    if(n==0){
    	puts("0");
    	return 0;
	}
    int i = 1; m = n;
    while (m != 0) {
        a[i] = m % r;
        m /= r;
        if (a[i] < 0) a[i] -= r, m++;
        i++;
    }
    for (int j = i - 1; j >= 1; j--)
        printf("%c", trans(a[j]));
    puts("");
    return 0;
}

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

using namespace std;
typedef long long ll;
#define INF (long)(10e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)

int main(void)
{
    ll x;
    cin >> x;
    ll k;
    k = (sqrt(x*8+1)-1)/2;
    if((k+1)*k/2 < x) k++;
    cout << k << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i, x, y) for(int i = x, B = y; i <= B; i ++)
#define ff(i, x, y) for(int i = x, B = y; i <  B; i ++)
#define fd(i, x, y) for(int i = x, B = y; i >= B; i --)
#define ll long long
#define pp printf
#define hh pp("\n")
using namespace std;

const int N = 1e6 + 5;

const int mo = 998244353, ni2 = (mo + 1) / 2;

int n, x, c[N];
ll b[N];

int bz[N], p[N], p0, f[N], mu[N];

void sieve(int n) {
	fo(i, 2, n) {
		if(!bz[i]) p[++ p0] = i, f[i] = 1 - i, mu[i] = -1;
		for(int j = 1; i * p[j] <= n; j ++) {
			int k = i * p[j];
			bz[k] = 1;
			if(i % p[j] == 0) {
				f[k] = f[i];
				mu[k] = 0;
				break;
			}
			f[k] = f[i] * f[p[j]];
			mu[k] = -mu[i];
		}
	}
	f[1] = mu[1] = 1;
}

int gcd(int x, int y) { return !y ? x : gcd(y, x % y);} 

int main() {
	scanf("%d", &n);
	fo(i, 1, n) scanf("%d", &x), c[x] ++;
	n = 1e6;
	fd(i, n, 1) {
		for(int j = i; j <= n; j += i) b[i] = (b[i] + (ll) c[j] * (j / i)) % mo;
		b[i] %= mo;
		//if(b[i]) pp("%d %d\n", i, b[i]);
	}
	sieve(n);
	ll ans = 0;
	fo(i, 1, n) ans = (ans + (ll) f[i] * i % mo * b[i] % mo * b[i]) % mo;
	fo(i, 1, n) ans = (ans - (ll) i * c[i]) % mo;
	ans = (ans % mo + mo) * ni2 % mo;
	pp("%lld\n", ans);
}


Measured memory_bytes: 25600
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#ifndef debug_on
#define debug_on 0
#endif

#define dbg \
    if(debug_on) cerr << "DEBUG:"
#define ast(cond)           \
    do {                    \
        if((cond) == false) \
        {                   \
            if(debug_on)    \
            cerr << "ASSERT" << #cond " failed at line:" << __LINE__ << endl;   \
            exit(1);        \
        }                   \
    }while(0)

template<typename T>
void InvMod(T *inv_mod, T n, T r)
{
    inv_mod[0] = 1;
    if(1 <= n)
        inv_mod[1] = 1;
    for(T i = 2; i <= n; ++i)
    {
        inv_mod[i] = r - ((r / i) * inv_mod[r % i] % r);
        ast(((inv_mod[i] * i) % r) == 1);
    }
}

template<typename T>
void InvFactMod(T * inv_fact_mod, const T *inv_mod, T n, T r)
{
    inv_fact_mod[0] = 1;
    if(1 <= n)
        inv_fact_mod[1] = 1;
    for(T i = 2; i <= n; ++i)
    {
        inv_fact_mod[i] = inv_fact_mod[i - 1] * inv_mod[i] % r;
    }
}

template<typename T>
void FactMod(T * fact_mod, T n, T r)
{
    fact_mod[0] = 1;
    if(1 <= n)
        fact_mod[1] = 1;
    for(T i = 2; i <= n; ++i)
    {
        fact_mod[i] = fact_mod[i-1] * i % r;
    }
}

//const int MAX_N = 3 * 100000 + 3;
const uint64_t R = 998244353;
uint64_t N, A, B, K;

vector<uint64_t> inv_mod, inv_fact_mod, fact_mod;

uint64_t Comb(uint64_t n, uint64_t c, uint64_t r)
{
    uint64_t mul = fact_mod[n];
    mul *= inv_fact_mod[n - c];
    mul %= r;
    mul *= inv_fact_mod[c];
    mul %= r;
    dbg << "N:" << n << " c:" << c << " mul:" << mul << " " << fact_mod[n] << " " << inv_fact_mod[n-c] << " " << inv_fact_mod[c] << endl;
    return mul;
}

int main(int, char *[])
{
    cin >> N >> A >> B >> K;

    uint64_t sum = 0;
    inv_mod.resize(N + 1);
    inv_fact_mod.resize(N + 1);
    fact_mod.resize(N + 1);
    InvMod(inv_mod.data(), N, R);
    InvFactMod(inv_fact_mod.data(), inv_mod.data(), N, R);
    FactMod(fact_mod.data(), N, R);
    for(uint64_t a = 0; a <= N; ++a)
    {
        if(K < a*A) break;
        if((K - a * A) % B) continue;
        const uint64_t b = (K - a * A) / B;
        if(b > N) continue;
        dbg << "a:" << a << " b:" << b << endl;
        sum += Comb(N, a, R) * Comb(N, b, R) % R;
        sum %= R;
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 7296
import std.array;
import std.range;
import std.algorithm;
import std.conv;
import std.stdio;
import std.string;

void main(string[] args) {
    string s = readln.chomp;

    string[] words = ["dream", "dreamer", "erase", "eraser"];
    bool ans = false;

    loop: while (true) {
        if (s.length <= 0) {
            ans = true;
            break loop;
        } else {
            foreach (word; words) {
                if (s.endsWith(word)) {
                    s = s[0..($-word.length)];
                    continue loop;
                }
            }
            break loop;
        }
    }

    (ans ? "YES" : "NO").writeln;
}

Measured memory_bytes: 2556
from functools import reduce
import sys

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

N = I()
a = LI()

xor_reduce = reduce(lambda x,y:x ^ y, a)
ans = [str(xor_reduce ^ x) for x in a]
print(*ans)

Measured memory_bytes: 34652
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
typedef long long int ll;
typedef unsigned long long int ull;
ll gcd(ll x,ll y){if(!y)return x;return gcd(y,x%y);}
ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
double to_deg(double r){return r*180.0/(atan(1.0)*4.0);}
//Sieve of Eratosthenes
int isprime(int x){
    if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i<=sqrt((double)x);i++)if(x%i==0)return 0;
    return 1;
}
int asc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return 1;else if(x==y)return 0;else return -1;}
typedef struct{
    int x;
    int y;
}pair_t;

int main(){
    int n;scanf("%d",&n);
    char str[100];scanf("%s",str);
    int cnt=0;
    for(int i=0;i<n-2;i++){
        if(str[i]=='A'&&str[i+1]=='B'&&str[i+2]=='C')cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

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

  if (n >= m) {
    cout << 0 << endl;
    return 0;
  }

  sort(x.begin(), x.end(), greater<ll>());

  ll ans = x[0] - x[m-1];
  vector<ll> l(m-1);

  rep(i, m-1) l[i] = x[i] - x[i+1];
  sort(l.begin(), l.end(), greater<int>());
  rep(i, n-1) ans -= l[i];

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 1792
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(),cnt=0;
		int[][] a=new int[n][3];
		int[] ans=new int[n];
		for(int i=0;i<n;i++){
			for(int j=0;j<3;j++){
				a[i][j]=sc.nextInt();
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<3;j++){
				for(int k=0;k<n;k++){
					if(a[i][j]==a[k][j])cnt++;	
				}
				if(cnt==1)ans[i]+=a[i][j];
				cnt=0;
			}
		}
		for(int i=0;i<n;i++){
			System.out.println(ans[i]);
		}
	}	
}

Measured memory_bytes: 20844
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), k = sc.nextInt();
		int ans = 0;
		while(n > 0){
			n /= k;
			ans++;
		}
		sc.close();
		System.out.println(ans);
	}
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<int> xx(n);
  vector<int> yy(m);
  bool flag = true;
  for (int i = 0; i < n; i++) cin >> xx[i];
  for (int i = 0; i < m; i++) cin >> yy[i];
  sort(xx.begin(), xx.end());
  sort(yy.begin(), yy.end());
  for (int i = x + 1; i <= y; i++) {
    if (i > xx[n - 1] && i <= yy[0]) {
      cout << "No War" << endl;
      return 0;
    }
  }
  cout << "War" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

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

#define dump(x) cout << #x << ":" << x << endl

#define MAX 101

int N;
string message;
int a[MAX], b[MAX];

string decrypt(string str, int i, int j)
{
	string buf = str;
	int d = abs(i-j);
	buf[i] = ((buf[i] - 'a') + d) % 26 + 'a';
	buf[j] = ((buf[j] - 'a') + d) % 26 + 'a';
	str[i] = buf[j];
	str[j] = buf[i];
	return str;
}

int main()
{
	while (cin >> N, N) {
		cin >> message;
		rep(i, N) {
			int aa, bb;
			cin >> aa >> bb;
			aa--; bb--;
			a[i] = aa; b[i] = bb;
		}
		rep(i, N) {
			//dump(message);
			message = decrypt(message, a[(N-1)-i], b[(N-1)-i]);
		}
		cout << message << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
from fractions import gcd #直して
n = int(input())
a = list(map(int, input().split()))

mod = 10**9+7
l = 1
for i in range(n):
    l = a[i]*l // gcd(l, a[i])


def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

d = 0
for i in range(n):
    d += modinv(a[i])

print((l*d) % mod)


Measured memory_bytes: 68056
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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 main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	int ans = (n-1) * (m-1);
	cout << ans << endl;
	return 0;
}


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

#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i) // 0 based indexing
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (ll i = (ll)(n); i >= 1; --i) // reverse 1 based

#define ff first
#define ss second
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	for1(i,9){
		for1(j,9){
			if(i*j == n){
				cout << "Yes" ;
				return 0;
			}
		}
	}
	cout << "No";
	return 0;
}


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

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

void solve(){
	ll x;
	cin >> x;
	ll years = 0;
	ll money = 100;
	while(money < x) {
		money += (money * 1) / 100;
		++years;
	}
	cout << years;
}

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

	solve();
    
    return 0;
}


Measured memory_bytes: 3616
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>


int cmp(const int *a,const int *b){

return *a > *b ? -1 : *a < *b ? 1 : 0 ;
}
//qsort(pa,n,sizeof(int),(int(*)(const void* ,const void*))cmp);

long long int memo[100];
long long int fib(int n){
  if(n<=1){
    return n;
  }
  else{
    return fib(n-1)+fib(n-2);
  }
}

long long int fib2(int n){
  if(n<=1){
    return n;
  }
  if(memo[n]!=0){
    return memo[n];
  }
    return memo[n]=fib(n-1)+fib(n-2);

}


int main(void){
  int n,m;
  scanf("%d%d",&n,&m);

  if(n==m){
    printf("Yes");
    return 0;
  }
  else{
    printf("No");
  }


  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

#define ll long long
const long long llINF = 1LL << 60;
const int iINF = 0x20000000;
template<class T> inline bool chmin(T& a, T b) { if (b < a) { 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; }

void execute();
int main() 
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);// cin と scanfの併用禁止
    cout << fixed << setprecision(15);
    execute();
    return 0;
}

void execute()
{
    int N;
    cin >> N;

    unsigned ll mu = 0;
    unsigned ll ml = 1;
    bool over = false;
    for(int i = 0; i < N; i++){
        unsigned long long A;
        cin >> A;
        if(A == 0){
            cout << 0 << endl; 
            return;
        }

        unsigned long long Al;
        unsigned long long Au;
        Au = A / 1000000000;
        Al = A % 1000000000;
        unsigned long long m00 = ml * Al;
        unsigned long long m01 = ml * Au;
        unsigned long long m10 = mu * Al;
        unsigned long long m11 = mu * Au;

        if(1 < m11) over = true;

        mu = m00 / 1000000000;
        ml = m00 % 1000000000;
        mu += m01;
        mu += m10;
        if(m11 < 1000000000)  mu += m11 * 1000000000;
        if(1000000000 < mu) over = true;
    }

    ll m = ml + 1000000000 * mu;
    if(over || 1000000000000000000LL < m){
        cout << -1 << endl; return;
    }

    cout << m << endl; 
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;

int main(){
  int h,w; cin>>h>>w;
  string s[h];
  int l[h][w];
  int r[h][w];
  int d[h][w];
  int u[h][w];

  REP(i,h)cin>>s[i];
  //前計算
  REP(i,h){
     REP(j,w){
       if(s[i][j]=='#')l[i][j]=0;
        else if(j==0)l[i][j]=1;
       else l[i][j]=l[i][j-1]+1;
     }
     REPR(j,w-1){
        if(s[i][j]=='#')r[i][j]=0;
        else if(j==w-1)r[i][j]=1;
        else r[i][j]=r[i][j+1]+1;
     }
  }


  REP(j,w){
      REP(i,h){//i行目
          if(s[i][j]=='#')u[i][j]=0;
          else if(i==0)u[i][j]=1;
          else u[i][j]=u[i-1][j]+1;
      }
      REPR(i,h-1){
           if(s[i][j]=='#')d[i][j]=0;
          else if(i==h-1)d[i][j]=1;
          else d[i][j]=d[i+1][j]+1;
      }
  }

 ll ans=0;
 REP(i,h){
      REP(j,w){
        ll count=0;
        count=l[i][j]+r[i][j]+u[i][j]+d[i][j]-3;
        if(count>ans)ans=count;
       // cout<<i<<','<<j<<" : "<<l[i][j]<<' '<<r[i][j]<<' '<<u[i][j]<<' '<<d[i][j]<<' '<<count<<endl;
      }
 }
   cout<<ans<<endl;
}
  

Measured memory_bytes: 66816
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int N;
vector<int> A(201, 0);

int main(void){
    
    scanf("%d", &N);
    for(int i = 0; i < N; ++i) scanf("%d", &A[i]);
    
    vector<int> v;
    for(int i = 0; i < N; ++i){
        int cnt = 0;
        while(A[i] % 2 == 0){
            A[i] /= 2;
            ++cnt;
        }
        v.push_back(cnt);
    }
    printf("%d\n", *min_element(v.begin(), v.end()));
    
    return 0;
}



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

#define ll long long int
#define llu unsigned long long int
#define f(n) for(ll i=0;i<n;i++)
#define fr(n) for(ll i=n-1;i>=0;i--)
#define endl "\n"
#define mod 1000000007

using namespace std;

int main()
{
	//#ifdef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	//#endif
	std::ios_base::sync_with_stdio(false);

	ll n,q;
	string s;
	cin>>n>>s>>q;
	vector<set<ll>> v(26);
	set<ll>:: iterator itr;
	for(ll i=0;i<s.length();i++)
	{
		v[s[i]-'a'].insert(i);
	}
	//cout<<q;
	while(q--)
	{
		//cout<<"yo";
		ll t;
		cin>>t;
		if(t==1)
		{
			ll x;
			char y;
			cin>>x>>y;
			x--;
			v[s[x]-'a'].erase(x);
			s[x]=y;
			v[s[x]-'a'].insert(x);
		}
		else if(t==2)
		{
			ll x,y;
			cin>>x>>y;
			x--;
			ll c=0;
			//set<ll>::iterator itrs;
			for(ll i=0;i<26;i++)
			{
				auto itrs=v[i].lower_bound(x);
				if(itrs!=v[i].end() && *itrs<y)
					c++;
			}
			cout<<c<<endl;
		}

	}
	return 0;
}

Measured memory_bytes: 24220
n, k = map(int, input().split())
dislike = list(map(int, input().split()))
for i in range(n,10**18):
    a = str(i)
    # print(a)
    flag = True
    for j in range(len(a)):
        # print(a[j])
        for k in dislike:
            # print(k)
            if int(a[j]) == k:
                flag = False
                break
        if flag == False:
            break
    if flag == True:
        print(i)
        break

Measured memory_bytes: 3060
x,y= map(int, input().split())
c=0
if x==3:
  c+=100000
elif x==2:
  c+=200000
elif x==1:
  c+=300000
if y==3:
  c+=100000
elif y==2:
  c+=200000
elif y==1:
  c+=300000
if x==1 and y==1:
  c+=400000
print(c)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
//SET PRECIOSION   cout << fixed ;  cout << setprecision(n) << ans << endl;
#define ll long long
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector <ll> v;
bool dp[100009];
ll x,y,z,a,b,c,sum,ans,total,t,cnt,n,m,k,p,kase;
bool findAns()
{
    for(ll stone =0; stone <=k; stone++)
        for(ll &i : v)
    {
        if(i<=stone && !dp[stone-i])
            dp[stone]= true;
    }
    return dp[k];
}
int main()
{
	FAST;
	cin>>n>>k;
	v.resize(n);
	for(ll i=0; i<n; i++)
    {
        cin>>v[i];
    }
    memset(dp,false,sizeof(dp));
    if(findAns())
        cout<<"First"<<endl;
    else cout<<"Second"<<endl;
	//clear vectors and maps you idiot
	// check array size dumb
	// use long long instead of int too
	return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<pair<int,int>> AB(N);
  for(int i=0;i<N;i++)  cin >> AB.at(i).first >> AB.at(i).second;

  sort(AB.begin(),AB.end());
  int ans=AB.at(N-1).first+AB.at(N-1).second;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1152
module Main where

import Data.Set (Set)
import qualified Data.Set as Set

main :: IO ()
main =
  (read :: String -> Int) <$> getLine >>= \n ->
  (map (read :: String -> Int) . words) <$> getLine >>= \arr ->
  if Set.size (Set.fromList arr) /= n
     then putStrLn "NO"
     else putStrLn "YES"


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

int min_cost(int *arr,int n){

	int *dp = new int[n+1];
	// for(int i=0;i<=n;++i){
	// 	dp[i] = INT_MAX;
	// }


	dp[0] = 0;
	dp[1] = 0;
	dp[2] =  abs(arr[1]-arr[2]);

	// cout << min_cost(arr,n,dp);

	// delete [] dp;


	// if(dp[n]!=INT_MAX){
	// 	return dp[n];
	// }

	
	// if(n==2){
	// 	return abs(arr[1]-arr[0]);
	// }

	for(int i=3;i<=n;++i){
		int opt1 = abs(arr[i]-arr[i-1]) + dp[i-1];
		int opt2 = abs(arr[i]-arr[i-2]) + dp[i-2];
		dp[i]  = min(opt2,opt1);
	}

	
	// for(int i=0;i<=n;++i){
	// 	cout << dp[i] << " ";
	// }
	int ans = dp[n];
	delete [] dp;
	return ans;

}


int main(){

	int n;
	cin>> n;
	int arr[n+1];
	arr[0] = 0;
	for(int i=1;i<=n;++i){
		cin>>arr[i];
	}

	// int *dp = new int[n+1];
	// for(int i=0;i<=n;++i){
	// 	dp[i] = INT_MAX;
	// }
	// dp[0] = 0;
	// dp[1] = 0;
	// dp[2] =  abs(arr[1]-arr[0]);

	cout << min_cost(arr,n);

	// delete [] dp;


	return 0;
}

Measured memory_bytes: 1024
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

a = readInt()
print(a+a**2+a**3)

Measured memory_bytes: 9404
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
	for(int i=1;i<=5;++i){
		int x;
		cin>>x;
		if(x!=i) cout<<i;
	}
	return 0;
}


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

using namespace std;
int main()
{
    long long h;
    cin>>h;
    long long y=h;
    vector<pair<long long,long long>>v;
    v.push_back({y,1});
    while(y>1){
        y/=2;
        v.push_back({y,1});
    }
    v.push_back({y,1});
    sort(v.begin(),v.end());
    int n=v.size();
    for(int i=0;i<n-1;i++){
        v[i+1].second+=(v[i].second*2);
    }
    cout<<v[n-2].second;
    
}


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

int main() {
    int q;
    cin >> q;
    long b_sum, a_l_sum, a_r_sum = 0;
    long num, a, b;
    cin >> num >> a >> b;
    a_l_sum = a;
    b_sum = b;
    priority_queue<long> max_heap;
    priority_queue<long, vector<long>, greater<long> > min_heap;
    min_heap.push(a);
    for (int i = 1; i < q; i++) {
        cin >> num;
        if (num == 1) {
            cin >> a >> b;
            b_sum += b;
            max_heap.push(a);
            a_r_sum += a;
            long t = max_heap.top();
            max_heap.pop();
            a_r_sum -= t;
            min_heap.push(t);
            a_l_sum += t;
            if (max_heap.size() + 1 < min_heap.size()) {
                long t = min_heap.top();
                min_heap.pop();
                a_l_sum -= t;
                max_heap.push(t);
                a_r_sum += t;
            }
        } else {
            int count = min_heap.size() + max_heap.size();
            long t = (count & 1) ? min_heap.top() : max_heap.top();
            cout << t << ' ' << abs(- a_r_sum + a_l_sum - t * (count & 1)) + b_sum << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3828
n = int(input())
a = map(int,raw_input().split())
b = map(int,raw_input().split())
cnt = 0
for i in range(n):
    if a[i] > b[i]:
        cnt += a[i]-b[i]
    else:
        cnt -= (b[i]-a[i]) / 2
if cnt <= 0:
    print("Yes")
else:
    print("No")

# 3 7 4 7 5
# 3 7 3 8 5

Measured memory_bytes: 33308
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int MAXN = 100000;
vector<int>G[MAXN + 5];
void addedge(int u, int v) {
	G[u].push_back(v);
	G[v].push_back(u);
}
int dp[MAXN + 5];
void dfs(int rt, int pre) {
	int cnt = 0;bool flag = 0;
	for(int i=0;i<G[rt].size();i++)
		if( G[rt][i] != pre ) {
			int p = G[rt][i];
			dfs(p, rt);
			if( dp[p] == 0 ) {
				if( !flag ) flag = true;
				else dp[rt]++;
			}
			else
				dp[rt] += dp[p];
		}
}
int main() {
	int N, root = -1;
	scanf("%d", &N);
	for(int i=1;i<=N-1;i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		addedge(a, b);
	}
	for(int i=0;i<N;i++)
		if( G[i].size() > 2 )
			root = i;
	if( root == -1 ) {
		printf("1\n");
		return 0;
	}
	dfs(root, -1);
	printf("%d\n", dp[root]);
}

Measured memory_bytes: 10496
#include<iostream>

using namespace std;

int main()
{
    int n,m,sum = 0;
    cin >> n >> m;

    int ara[m];

    for(int i=0; i<m; i++){
        cin >> ara[i];
        sum += ara[i];
    }
    if(n>=sum){
        cout << n-sum;
    }
    else {
        cout << "-1";
    }
    return 0;
}


Measured memory_bytes: 3608
//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define double long double 
#define fi first
#define se second
#define pii pair<int, int>

const int INF = 1e9;
signed main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
  string s;
  cin >> s;
  int n = sz(s);
  vector<int> a(n, 0);
  if (s[0] == 'A') a[0] = 1;
  int cnt = a[0];
  for (int i = 1; i < n - 1; i++) {
    if (s[i] == 'A') {
      a[i] = ++cnt;
    } else if (s[i] == 'B' && s[i + 1] != 'C' || s[i] == 'C' && s[i - 1] != 'B') {
      cnt = 0;
    } else {
      a[i] = a[i - 1];
    }
  }
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == 'B' && s[i + 1] == 'C') {
      ans += a[i];
    }
  }
  cout << ans << "\n";
}


Measured memory_bytes: 2196
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define X first
#define Y second
#define pb push_back
#define CL(x) (x << 1)
#define CR(x) ((x << 1) + 1)
#define sqr(x) ((x) * (x))
typedef long long cc;
typedef long double ld;
typedef pair <int, int> pt;
const int N = 100005;
int n, p[N];

int main() {
    std :: ios_base :: sync_with_stdio(false); cin.tie(NULL);
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> p[i];
    int res = 0;
    for (int i = 1; i <= n; i++)
        if (p[i] == i) {
            if (i < n)
                swap(p[i], p[i + 1]);
            else {
                swap(p[i], p[i - 1]);
            }
            res++;
        }
    cout << res;
    return 0;
}


Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(N):
	if B[i] > A[i]:
		ans += A[i]
		B[i] -= A[i]

		if B[i] > A[i + 1]:
			ans += A[i + 1]
			A[i + 1] = 0
		else:
			ans += B[i]
			A[i + 1] -= B[i]
			
	elif B[i] <=A[i]:
		ans += B[i]
print(ans)


Measured memory_bytes: 24120
#include <iostream>
#include <vector>
#include <boost/range/irange.hpp>
using namespace std;
using boost::irange;
int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n, vector<int>(m));
    vector<int> b(m);
    vector<int> c(n, 0);
    for(auto&& i : a)
        for(auto&& j : i)
            cin >> j;
    for(auto&& i : b)
        cin >> i;
    for(int i : irange(0, n)) {
        for(int j : irange(0, m)) {
            c[i] += a[i][j] * b[j];
        }
    }
    for(auto&& i : c) cout << i << endl;
    return 0;
}


Measured memory_bytes: 3200
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v), std::end(v)
#define REP(i, k) for (std::decay_t<decltype(k)> i = 0; i < k; i++)
#define LOOP(k) REP (ngtkana_is_a_genius, k)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

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

    u32 n; std::cin >> n;
    u32 ans = 1;
    for (; ans*n%360; ans++);
    std::cout << ans << '\n';
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000



int main(){
	
	int N,K;
	cin>>N>>K;
	vector<int> x(N);
	
	for(int i=0;i<N;i++){
		cin>>x[i];
	}
	
	int ans = Inf;
	
	for(int i=0;i<N-K+1;i++){
		int a = x[i];
		int b = x[i+K-1];
		int c;
		if((a<0)==(b<0)){
			c = max(abs(a),abs(b));
		}
		else{
			c = abs(a)+abs(b)+min(abs(a),abs(b));
		}
		ans = min(ans,c);
	}
	
	cout<<ans<<endl;
	
    return 0;
}


Measured memory_bytes: 640
import java.util.*;
import java.math.*;

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

    for (int i = 0; i < n; i++) {
      BigInteger next = sc.nextBigInteger();

      if (!ans.equals(BigInteger.valueOf(-1))) {
        if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {
          ans = BigInteger.valueOf(-1);
        } else {
          ans = ans.multiply(next);
        }
      } else {
        if (next.equals(BigInteger.ZERO)) {
          ans = BigInteger.ZERO;
          break;
        }
      }
    }

    System.out.println(ans);
  }
}



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

bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p%i == 0) return false;
	}
	return true;
}

int n;

int main() {
	cin >> n;
	for (int i = 31; i <= 55555; i += 10) {
		if (isprime(i) == true) {
			if (i != 31) cout << " ";
			cout << i; n--;
		}
		if (n == 0) break;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
#define N 100050
#define res register long long
#define ll long long
using namespace std;
ll a[N],n,m,ans;

int main()
{
	scanf("%lld",&n);
	for(res i=1;i<=n;i++)
	scanf("%lld",&a[i]);
	for(res i=1;i<=n;i++)
    {
    	if(i>1&&a[i]&&a[i-1])
    	{
    		a[i]--,ans++;
		}
		ans+=a[i]/2,a[i]%=2;
	}
	printf("%lld",ans);
}


Measured memory_bytes: 1024
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

X1 = T1 * (A1 - B1)
X2 = T2 * (A2 - B2)

D = X1 + X2
if D == 0:
	print("infinity")
else:
	if X1 < 0:
		X1, X2 = [-X1, -X2]
	else:
		D = -D
	
	if D < 0:
		print("0")
	else:
		if X1 % D == 0:
			print((X1 // D) * 2)
		else:
			print((X1 // D) * 2 + 1)
	



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

string THIS = "this", THAT = "that";
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int main() {
	int a;
	string b;
	cin >> a;
	getline(cin, b);
	for (int c = 0; c < a; c++) {
		getline(cin, b);
		for (int d = 1; d < 26; d++) {
		l:;
			for (int e = 0; e < 26; e++) {
				if (gcd(d, 26) != 1)continue;
				string s;
				for (int f = 0; f < b.length(); f++) {
					if (b[f] == ' ')s += ' ';
					else {
						for (int g = b[f] - 'a';g<26*26+'a'; g += 26) {
							if ((g - e) % d == 0 && (g - e) / d >= 0 && (g - e) / d < 26) { s += ((g - e) / d + 'a'); goto r; }
						}
						goto l;
					r:;
					}
				}
				for (int i = 0; i < s.length() - 3; i++) {
					bool x = true, y = true;
					for (int p = 0; p < 4; p++) {
						if (s[i + p] != THIS[p])x = false;
						if (s[i + p] != THAT[p])y = false;
					}
					if (x | y) { cout << s << endl; break; }
				}
			}
		}
	}
}

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

using namespace std;


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

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

    long sum = 0;

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++)
            for (int k = 1; k <= n; k++)
                sum += gcd(i, gcd(j, k));
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
long long a,b,c,x,y,ans=0;
string s;
int main(){
  cin >> a >> b >> c >> x >> y;
  if(a+b>=2*c){
    ans+=min(x,y)*2*c;
    if(x>y){
      ans+=min((x-y)*a,(x-y)*2*c);
    }else{
      ans+=min((y-x)*b,(y-x)*2*c);
    }
  }else{
    ans+=a*x+b*y;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
print(n ** 3)

Measured memory_bytes: 5784
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}
module Main where

import Control.Arrow
import Control.Monad
import Control.Monad.ST
import Control.Monad.State.Strict
import Data.Char
import Data.Function
import Data.List
import Data.Maybe
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as C
import qualified Data.ByteString.Unsafe as B

type Parser a = C.ByteString -> Maybe (a, C.ByteString)

parseInt :: Parser Int
parseInt = C.readInt . C.dropWhile isSpace

parseInt2 :: Parser (Int, Int)
parseInt2 = runStateT $
    (,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)
 
parseInt3 :: Parser (Int, Int, Int)
parseInt3 = runStateT $
    (,,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)
 
parseInt4 :: Parser (Int, Int, Int, Int)
parseInt4 = runStateT $
    (,,,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)

main = do
  !n <- readLn :: IO Int
  !a <- U.unfoldrN n parseInt <$> C.getContents :: IO (U.Vector Int)
  let !ans = recip $ U.sum $ U.map (recip . fromIntegral) a :: Double
  print ans


Measured memory_bytes: 508
// abc153_b
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

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;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
  int h,n,a,sumNum=0;
  cin>>h>>n;
  rep(i,n){
    cin>>a;
    sumNum+=a;
  }
  if (h<=sumNum) {
    cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char s1[1001],s2[1001];
    int len1,len2,count=0,i,j,max;
    scanf("%s %s",s1,s2);
    len1=strlen(s1);
    len2=strlen(s2);
    max=0;
    for(i=0;i<=(len1-len2);i++){
        count=0;
        for(j=0;j<len2;j++){
            if(s1[i+j]==s2[j]){
                  count++;
            }
        }
        if(max<count)
            max=count;
    }
    printf("%d\n",(len2-max));
    return 0;
}


Measured memory_bytes: 1736
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
  int n,m,in=0;
  cin >> n >> m;
  int k[n],a[10000],index,count,ans;
  for (int i=0;i<n;i++){
    cin >> k[i];
    for (int j=0;j<k[i];j++){
      cin >> a[in];
      in ++;
    }
  }
  for (int i=0;i<k[0];i++){
    index = k[0];
    count = 0;
    for (int j=1;j<n;j++){
      for (int l=0;l<k[j];l++){
        if(a[index] == a[i]){
           count ++;
        }
        index ++;
      }
    }
    if(count == n-1){
      ans ++;
    }
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>

using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio{
  int it,len;
  char s[LEN + 5];
  fastio(){
    it = len = 0;
  }
  char get(){
    if(it < len) return s[it++];
    it = 0, len = fread(s,1,LEN,stdin);
    return len ? s[it++] : EOF;
  }
  bool notend(){
    char c;
    for(c = get();c == ' ' || c == '\n';c = get());
    if(it) it--;
    return c != EOF;
  }
  void put(char c){
    if(it == LEN) fwrite(s,1,LEN,stdout), it = 0;
    s[it++] = c;
  }
  void flush(){
    fwrite(s,1,it,stdout);
  }
}buff,bufo;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline ll getll(){
  char c; ll res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline void putint(int x,char suf){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[15];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline void putll(ll x,char suf){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[25];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline char get_char(){
  char c;
  for(c = buff.get();c == ' ' || c == '\n';c = buff.get());
  return c;
}
int w,h,n;
int main(){
  h = getint(), w = getint(), n = getint();
  putint((n + max(h,w) - 1)/ max(h,w),'\n');
  bufo.flush();
  return 0;
}


Measured memory_bytes: 256