akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <limits>
#include <math.h>
#include <tuple>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "string.h"
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <set>

using namespace std;

int main() {
    int A, B, K;
    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &K);
    for (int i = A; i <= B; i++) {
        if (i - A <= K - 1 || B - i <= K - 1) {
            printf("%d\n", i);
        }
    }
    return 0;
}

Measured memory_bytes: 256
a = int(input())
ar = list(map(int,input().split(" ")))
br = []
for r in ar:
    if r % 2 == 0:
        br.append(r)
count = 0
for r in br:
    while r % 2 != 1:
        r /= 2
        count += 1
print(count)

Measured memory_bytes: 4148
if __name__ == "__main__":
	MOD = 10 ** 9 + 7
	N=int(input())
	A=list(map(int,input().split()))

	Asum = sum(A) % MOD

	ans = 0
	for n in range(N-1):
		Asum -= A[n]
		ans += ((A[n] * Asum) % MOD)

	print(ans % MOD)


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

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    int dmax = 100000;
    vector<int> cnt(dmax+1);
    rep(i,n){
        cin >> d[i];
        cnt[d[i]]++;
    }
    rep(i,dmax) cnt[i+1]+=cnt[i];
    if(n%2){
        cout << 0 << endl;
        return 0;
    }
    int ans = 0;
    rep(i,dmax+1) if(cnt[i]==n/2) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3996
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab = sorted(ab, key=lambda ab:ab[0])

ans = 0
total = 0
for i in range(n):
  num = m - total
  if ab[i][1]<num:
    total += ab[i][1]
    ans += ab[i][0]*ab[i][1]
  else:
    total += num
    ans += num*ab[i][0]
    break
print(ans)


Measured memory_bytes: 29796
//header{{{
//#define _GLIBCXX_DEBUG
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost::multiprecision;  
//using namespace boost::math;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int_fast64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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


signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout.setf(ios_base::fixed);
    cout.precision(10);

    int n;
    cin >> n;

    cout << 1000 * updiv(n, 1000) - n << '\n'; 

    return 0;
}


Measured memory_bytes: 3644
package main

import "fmt"

func main() {
        var x, y int
        fmt.Scanf("%d %d", &x, &y)

        var result int
        switch x {
        case 1:
                result += 300000
        case 2:
                result += 200000
        case 3:
                result += 100000
        }
        switch y {
        case 1:
                result += 300000
        case 2:
                result += 200000
        case 3:
                result += 100000
        }

        if x == 1 && y == 1 {
                result += 400000
        }

        fmt.Println(result)
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N;
  cin >> N;
  for (int x = 1; x <= N; ++x) {
    if (int(floor(1.08 * x)) == N) {
      cout << x << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}


Measured memory_bytes: 256
s = input()
x = 0
a = s.count("dream")
b = s.count("dreamer")
c = s.count("erase")
d = s.count("eraser")
reigai1 = s.count("dreamerase")
reigai2 = s.count("dreameraser")
reigai1 = reigai1-reigai2
b = b-reigai1-reigai2
a = a-reigai1-reigai2
c = c-reigai1-reigai2
d = d-reigai2
a2 = a-b
c2 = c-d
# print(a,b,c,d)
# print(a2,c2)
# print(reigai1,reigai2)
# print(a2*5+b*7+c2*5+d*6+reigai1*10+reigai2*11)
if a2*5+b*7+c2*5+d*6+reigai1*10+reigai2*11 == len(s):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9232
import sys
sys.setrecursionlimit(1000000)
while True:
  w,h=map(int,input().split())
  if w==0:
    break
  mp=["X"+input()+"X" for _ in range(h)]
  mp.insert(0,"X"*(w+2))
  mp.append('X'*(w+2))

  visited_w=[[False]*(w+2) for _ in range(h+2)]
  visited_b=[[False]*(w+2) for _ in range(h+2)]
  vec=((0,1),(0,-1),(1,0),(-1,0))

  def search(x,y,visited):
    for dx, dy in vec:
      nx,ny=x+dx,y+dy
      if not visited[ny][nx] and mp[ny][nx]==".":
        visited[ny][nx]=True
        search(nx,ny,visited)

  for y in range(1,h+1):
    for x in range(1,w+1):
      if mp[y][x]=="W":
        search(x,y,visited_w)
      elif mp[y][x]=="B":
        search(x,y,visited_b)

  ans_w=ans_b=0

  for y in range(1,h+1):
    for x in range(1,w+1):
      if visited_w[y][x] and not visited_b[y][x]:
        ans_w +=1
      elif not visited_w[y][x] and visited_b[y][x]:
        ans_b+=1
  print(ans_b,ans_w)



Measured memory_bytes: 6836
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> h(n);
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  int ans=0;
  for(int i=0;i<n;i++){
    if(h[i]>=k){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <numeric>
 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll K,N;
map<ll,ll> a,b;
ll ans;
string S;
 
 
int main(){
    cin >> N>>S;
    int before = 0;
    for(int i=0;i<N;i++){
        if(before == 0){
            if(S[i]=='A'){
                before = 1;
            }else if(S[i] == 'A'){
                before = 1;
            }else{
                before = 0;
            }
        }else if(before == 1){
            if(S[i] == 'B'){
                before = 2;
            }else if(S[i] == 'A'){
                before = 1;
            }else{
                before = 0;
            }
        }else if(before == 2){
            if(S[i] == 'C'){
                ans++;
                before = 0;
            }else if(S[i] == 'A'){
                before = 1;
            }else{
                before = 0;
            }
        }
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 256
n = int(input().strip())
l = []
 
for i in range(n):
    x, y = map(int, input().split())
    a = y + x
    b = y - x
    l.append([x, y, a, b])
 
la = sorted(l, key=lambda z: z[2])
lb = sorted(l, key=lambda z: z[3])
 
print(max(abs(la[0][0] - la[-1][0]) + abs(la[0][1]-la[-1][1]),
          abs(lb[0][0] - lb[-1][0]) + abs(lb[0][1]-lb[-1][1])
          )
      )

Measured memory_bytes: 61168
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());
#define usort(a) sort(a.rbegin(),a.rend());

using namespace::std;

ll int jo(ll int a, ll int b){//累乗
    ll int num=1;
    rep(i,0,b) num=num*a;
    return num;
}
char tobig(char s){//char大文字化
  return (s-0x20);
}
char tolow(char s){//char小文字化
  return (s+0x20);
}
int ctoi(char a){//char->int
  if('0'<=a&&a<='9') return (a-'0');
  return -1;
}
 
ll int gcd(ll int a,ll int b) {//最大公約数
  if(a<b) return gcd(b,a);
  int c;
  while ((c=a%b)) {
    a=b;
    b=c;
  }
  return b;
}
ll int lcm(ll int a,ll int b){//最小公倍数
 return (a*b)/gcd(a,b);
}
ll int NotMinus(ll int a){
  if(a>0) return a;
  else return 0;
}


int main(){
  ll int A,B,K;
  cin>>A>>B>>K;
  cout<<NotMinus(A-K)<<" "<<NotMinus(B-(NotMinus(K-A)));
  
}
// int *p = new int[N];

//  sort(変数名.begin(),変数名.end());//昇順ソート
//  sort(変数名.rbegin(),変数名.rend());//降順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順

//cout.fill('0');
//cout<<setw(N)<<value;  //整数の左側を0梅して指定桁数出力

Measured memory_bytes: 256
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String x;for(int T=s.nextInt(),t=0,i;t++<T;System.out.print(x)){char[][]d=new char[8][];for(x="Data "+t+":\n",i=0;i<8;++i)d[i]=s.next().toCharArray();Stack<int[]>l=new Stack<int[]>();int[]a={s.nextInt()-1,s.nextInt()-1},b;for(l.add(a);l.size()>0;)if(0<=(a=l.pop())[0]&&a[0]<8&&0<=a[1]&&a[1]<8&&d[a[1]][a[0]]>48)for(d[a[1]][a[0]]=48,i=-3;i<4;l.add(b),(b=a.clone())[1]+=i++,l.add(b))(b=a.clone())[0]+=i;for(char[]c:d)x+=new String(c)+"\n";}}}

Measured memory_bytes: 11000
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}

bool comp(const int &a, const int &b){
  return a > b;
}

int main(int argc, char const* argv[])
{
  int n, m;
  cin >> n >> m;
  vector<int> a(n), b(m);
  rep(i, n)cin >> a[i];
  rep(i, m)cin >> b[i];
  sort(all(a), comp);
  sort(all(b), comp);
  rep(i, n - 1){
    if(a[i] == a[i+1]){
      cout << 0 << endl;
      return 0;
    }
  }
  rep(i, m - 1){
    if(b[i] == b[i+1]){
      cout << 0 << endl;
      return 0;
    }
  }
  ll res = 1;
  for(int i = n * m; i > 0; i--){
    int ai = lower_bound(all(a), i, comp) - a.begin();
    int bi = lower_bound(all(b), i, comp) - b.begin();
    bool ax = (ai < n && a[ai] == i);
    bool bx = (bi < m && b[bi] == i);
    if(ax && !bx){
      res = (res * bi) % mod;
    }else if(!ax && bx){
      res = (res * ai) % mod;
    }else if(!ax && !bx){
      res = (res * (ai * bi - n * m + i)) % mod;
      if(res < 0)res += mod;
    }
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}

constexpr ll LNF = 1LL<<50;

constexpr int INF = 1e9+7;

const long double PI=3.14159265358979323846;


vector<int> dx = {1,0,-1,1,-1,0};
vector<int> dy = {1,1,1,0,0,-1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0;
    int left = 0, right = n-1;
    while(left<right){
        if(s[left]=='W'){
            while(left<right){
                if(s[right]=='R'){
                    right--;
                    ans++;
                    break;
                }
                right--;
            }
        }
        left++;
    }
    cout << ans << endl;
} 

Measured memory_bytes: 3736
#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	string str;
	
	getline(cin, str);
	int n = str.size();
	for(int i = 0; i < n; i++){
		
		string sub = str.substr(i, 5);
		if (sub == "apple"){
			str.replace(i, 5, "peach");
			i += 4;
		}
		else if(sub == "peach"){
			str.replace(i, 5, "apple");
			i += 4;
		}
	}
	puts(str.c_str());
	return(0);
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.rbegin(); itr != x.rend(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

using llong = long long int;

const static int MAX = 999999;
const static int MOD = 1000000007;
const static int IINF = INT_MAX;
const static llong LINF = LLONG_MAX;
const static int dx[4] = {1, 0, -1, 0};
const static int dy[4] = {0, 1, 0, -1};

template<typename T> T my_gcd(T a, T b) {
    return (a ? my_gcd(b % a, a) : b);
}
template<typename T> T my_lcm(T a, T b) {
    return a * b / my_gcd(a, b);    
}

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    llong n, k;
    cin >> n >> k;
    int i = 0;
    while (pow(k, i) <= n) {
        ++i;
    }

    cout << i << endl;

    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stack>
#include <cstdlib>
using namespace std;

int main()
{
	stack<int> ans;
	char s[100];
	while (scanf("%s",s)!=EOF)
	{
		if(s[0]=='+')
		{
			int a=ans.top();
			ans.pop();
			int b=ans.top();
			ans.pop();
			ans.push(a+b);
		}
		else if (s[0]=='-')
		{
			int a=ans.top();
			ans.pop();
			int b=ans.top();
			ans.pop();
			ans.push(b-a);
		}
		else if (s[0] == '*')
		{
			int a=ans.top();
			ans.pop();
			int b=ans.top();
			ans.pop();
			ans.push(a*b);
		}
		else
		{
			ans.push(atoi(s));
		}
	}

	printf("%d\n",ans.top());
	return 0;
}


Measured memory_bytes: 2764
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int INF = 2e9;

bool f(string& s, string& t, int& now, int& d) {
	int a = 0, b = d + 1;
	rep(i, 0, s.size()) {
		if (t[i] == 'L' || t[i] == 'U') b++;
		if (t[i] == 'R' || t[i] == 'D') a--;
		a = max(a, 0); b = min(b, d + 1);
		if (a >= b - 1) return false;
		if (s[i] == 'L' || s[i] == 'U') a++;
		if (s[i] == 'R' || s[i] == 'D') b--;
		if (a >= b - 1) return false;
	}
	return (now > a && b > now);
}

int main() {
	int h, w, n; cin >> h >> w >> n;
	int x, y; cin >> x >> y;
	string s, t; cin >> s >> t;
	reverse(s.begin(), s.end());
	reverse(t.begin(), t.end());
	string sx, sy, tx, ty;
	rep(i, 0, n) {
		if (s[i] == 'L' || s[i] == 'R') {
			sx += s[i]; sy += 'A';
		}
		else {
			sx += 'A'; sy += s[i];
		}
		if (t[i] == 'L' || t[i] == 'R') {
			tx += t[i]; ty += 'A';
		}
		else {
			tx += 'A'; ty += t[i];
		}
	}
	if (f(sx, tx, y, w) && f(sy, ty, x, h))printf("YES");
	else printf("NO");
}

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

int main() {
  int n;
  cin>>n;
  string a;
  cin>>a;
  int b=0;
  for(int i=0;i<a.size();i++){
    cin>>a.at(i); 
        if(i!=0&&a.at(i)!=a.at(i-1)){
      b++;
        }
  }
  cout<<b+1;
}

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

using i32 = int_fast32_t;
using i64 = int_fast64_t;

template<i64 M>
struct modint {
    i64 x;

    constexpr modint(const i64 y = 0) noexcept : x(y >= 0 ? y % M : (M - (-y) % M) % M) {}

    constexpr modint operator-() const noexcept { return modint(-x); }
    constexpr modint operator+(const modint &rhs) const noexcept { return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const noexcept { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const noexcept { return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const noexcept { return modint(*this) /= rhs; }

    constexpr modint &operator+=(const modint &rhs) noexcept {
        x += rhs.x;
        if (x >= M) x -= M;
        return *this;
    }

    constexpr modint &operator-=(const modint &rhs) noexcept {
        if (x < rhs.x) x += M;
        x -= rhs.x;
        return *this;
    }

    constexpr modint &operator*=(const modint &rhs) noexcept {
        x = x * rhs.x % M;
        return *this;
    }

    constexpr modint &operator/=(const modint &rhs) noexcept {
        i64 a = rhs.x, b = M, u = 1, v = 0;
        while (b > 0) {
            i64 t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        *this *= u;
        return *this;
    }

    friend ostream &operator<<(ostream &os, const modint &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, modint &a) {
        i64 t;
        is >> t;
        a = modint(t);
        return is;
    }
};

constexpr i64 MOD = 1e9 + 7;
using m64 = modint<MOD>;

int main() {
    i32 n, k;
    cin >> n >> k;

    i64 t = n, b = 0;
    m64 tsum = 0, bsum = 0;
    for (i32 i = 0; i < k; i++) {
        tsum += t, bsum += b;
        t--, b++;
    }

    m64 ans = 0;
    for (i32 i = k; i <= n+1; i++) {
        ans += tsum - bsum + 1;
        tsum += t, bsum += b;
        t--, b++;
    }

    cout << ans << endl;
}


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

signed main()
{
    long long A;
    scanf("%lld", &A);
    string B;
    cin >> B;
    B.erase(B.size() - 3, 1);
    ll b = stoll(B);
    cout << A * b / 100 << endl;

    return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;



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

    int c;

    if(n % 2 == 0)
        c = n / 2 - 1;
    else
        c = n / 2;

        cout << c;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<sstream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<math.h>
#include<iterator>

using namespace std;


int main(){
  int n;
  long long a=0,b=0;
  cin >> n;
  vector<int> T(n),A(n);
  for (int i = 0; i < n; i++) {
    cin >> T[i] >> A[i];
  }
  a=T[0];
  b=A[0];
  for (int i = 1; i < n; i++) {
    long long c,d;
    c = (a+T[i]-1)/T[i];
    d = (b+A[i]-1)/A[i];
    a = max(c,d)*T[i];
    b = max(c,d)*A[i];
  }

  cout << (a+b)<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
      String po[]=sc.nextLine().split("",0);
      int count=0;
      for(int i=0;i<3;i++){
      if(po[i].equals("1"))count++;
      }
      System.out.println(count);
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
int main() {
    int n; cin >> n;
    double sum = 0;
    rep(i, n) {
        double x; string u; cin >> x >> u;
        if (u == "JPY") {
            sum += x;
        } else {
            sum += x * 380000.0;
        }
    }
    
    cout << fixed << setprecision(6) << sum << endl;
    
}


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

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE "file"

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

long long mod = 1e9 + 7;
long long dp[55][5][5];

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    string s[2];
    cin >> s[0] >> s[1];
    vector<bool> type;
    for(int i = 0; i < n; i++)
    {
        if(s[0][i] == s[1][i])
            type.pb(0);
        else
            type.pb(1), i++;
    }
    if(type[0])
    {
        for(int i = 0; i < 3; i++)
        {
            for(int j = 0; j < 3; j++)
            {
                if(i == j)
                    continue;
                dp[0][i][j] = 1;
            }
        }
    }
    else
    {
        for(int i = 0; i < 3; i++)
            dp[0][i][i] = 1;
    }
    for(int i = 1; i < type.size(); i++)
    {
        if(type[i])
        {
            for(int a = 0; a < 3; a++)
            {
                for(int b = 0; b < 3; b++)
                {
                    if(a == b)
                        continue;
                    for(int c = 0; c < 3; c++)
                    {
                        for(int d = 0; d < 3; d++)
                        {
                            if(a == c || b == d)
                                continue;
                            dp[i][a][b] += dp[i - 1][c][d];
                            if(dp[i][a][b] >= mod)
                                dp[i][a][b] -= mod;
                        }
                    }
                }
            }
        }
        else
        {
            for(int a = 0; a < 3; a++)
            {
                for(int b = 0; b < 3; b++)
                {
                    for(int c = 0; c < 3; c++)
                    {
                        if(a == b || a == c)
                            continue;
                        dp[i][a][a] += dp[i - 1][b][c];
                        if(dp[i][a][a] >= mod)
                            dp[i][a][a] -= mod;
                    }
                }
            }
        }
    }
    long long ans = 0;
    for(int i = 0; i < 3; i++)
    {
        for(int j = 0; j < 3; j++)
        {
            ans += dp[type.size() - 1][i][j];
            if(ans >= mod)
                ans -= mod;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	sl := []int{64, 32, 16, 8, 4, 2, 1}

	for _, s := range sl {
		if s <= n {
			fmt.Println(s)
			return
		}
	}
}


Measured memory_bytes: 512
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e18;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W, x, y, z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;

ll arr[100000];
map<int, int> cnt;
int main() {
	cin >> N >> T;
	rep(i, N) {
		cin >> arr[i];
	}
	priority_queue<ll> que;
	ll maxrange = 0;
	rep(i, N-1) {
		que.push(arr[N - 1 - i]);
		ll range = que.top() - arr[N - 2 - i];
		if (cnt.find(range) == cnt.end()) cnt[range] = 1;
		else cnt[range]++;
		maxrange = max(maxrange, range);
	}
	cout << cnt[maxrange] << endl;
}


Measured memory_bytes: 6516
X = int(input())

ans = 0

while(True):
  count = 0
  for i in range(1, X+1):
    if i == 1 or i == X:
      continue

    if X % i == 0:
      count += 1

  if count == 0:
    ans = X
    break
  else:
    X += 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
typedef long long ll;
using namespace std;
int main(void){
    string s;cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int l=0,r=s.length()-1,num=0;
    while(r>=l){
        if(s[l]==s[r]){
            r--;l++;
        }
        else{
            num++;
            r--;
            l++;
        }
    }
    cout<<num<<endl;
}

Measured memory_bytes: 256
import networkx as nx
from networkx.algorithms.flow import network_simplex

MAX = 10**9
n, k = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
s, t = 2 * n, 2 * n + 1

G = nx.DiGraph()
G.add_node(s, demand=-n*k)
G.add_node(t, demand=n*k)
G.add_edge(s, t, weight=MAX, capacity=n*k)

for i in range(n):
	G.add_edge(s, i, weight=0, capacity=k)
	G.add_edge(n + i, t, weight=0, capacity=k)
	for j in range(n):
		G.add_edge(i, n + j, weight=MAX-a[i][j], capacity=1)

flow_cost, flow_dict = network_simplex(G)
print(n * k * MAX - flow_cost)

ans = [["." for _ in range(n)] for _ in range(n)]
for fr in flow_dict.keys():
	if 0 <= fr < n:
		for to, flow in flow_dict[fr].items():
			if flow == 1:
				ans[fr][to - n] = "X"

print(*["".join(x) for x in ans], sep="\n")

Measured memory_bytes: 54860
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) ((a).begin(), (a).end())
typedef long long ll;
// const long long INF = 1LL << 60;
const int INF = 1010101010;
// using Graph = vector<vector<int>>;
const int MOD = 1000000007;

int main() {
  string s, t;
  cin >> s >> t;
  bool ok = true;
  rep(i, 26) {
    char c = (int)(i + 'a');
    char tt = 'A';

    rep(j, s.length()) {
      if (s[j] == c) {  //もしaを見つけたら
        if (tt == 'A') {
          tt = t[j];
        } else {
          if (tt != t[j]) ok = false;
        }
      }
    }
  }
  rep(i, 26) {
    char c = (int)(i + 'a');
    char ss = 'A';

    rep(j, s.length()) {
      if (t[j] == c) {  //もしaを見つけたら
        if (ss == 'A') {
          ss = s[j];
        } else {
          if (ss != s[j]) ok = false;
        }
      }
    }
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

using namespace std;

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

    bool p = (s[0] == 'R');
    bool q = (s[1] == 'R');
    bool r = (s[2] == 'R');

    if(p && q && r) {
        cout << "3" << endl;
    } else if((p && q) || (q && r)) {
        cout << "2" << endl;
    } else if(p || q || r) {
        cout << "1" << endl;
    } else {
        cout << "0" << endl;
    }

    return 0;
}


Measured memory_bytes: 3616
S = list(input())
l = len(S)
i = l - 2
while 2 <= i:
    flag = True
    k = i//2
    for j in range(0,k):
        if S[j] != S[j+k]:
            flag = False
            break
    if flag:
        print(i)
        exit()
    i -= 2    

Measured memory_bytes: 2940
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>

using namespace std;
typedef long long ll;
ll a[200000], sum[200001] = {}, ans = 5000000000000000;
int main() {
  int n;

  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    sum[i + 1] = sum[i] + a[i];
  }
  for (int i = 0; i < n; i++) {
    ans = min(ans, max(sum[n] - sum[i], sum[i]) - min(sum[n] - sum[i], sum[i]));
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 3328
//----------ACCIDENTAL COMPETITIVE PROGRAMMER---------------------

#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
using namespace std;

#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair


const LL MOD = (1e9) + 7 ;
const LD EPS = 0.0000001 ;

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    LL r, d, x; cin >> r >> d >> x;
    for (int i = 1; i <= 10; i++){
    	x = (x * r) - d;
    	cout << x << endl;
    }

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fore(i,a,b) for(int i=a;i<b;i++)
#define mp make_pair
#define vll vector<ll>
#define vi vector<int>
#define vvi vector<vi>
#define fst first
#define snd second
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define pb push_back
#define pii pair<int,int>
#define FIFO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define RFWF freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
using namespace std;

int main() {
	string s;
	int k;
	cin>>k>>s;
	fore(i,0,min(k,sz(s))) cout<<s[i];
	if(sz(s)>k) cout<<"...";
	return 0;
}


Measured memory_bytes: 3624
N = int(input())
H = list(map(int, input().split()))

cnt = 0
cntmax = 0

for i in range(N-1):
    if H[i] >= H[i+1]:
        cnt += 1
    else:
        if cnt > cntmax:
            cntmax = cnt
        cnt = 0
        
if cnt > cntmax:
    cntmax = cnt
    
print(cntmax)

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

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

  ll n, ans = 0;
  cin >> n;

  for (ll i = 1; i <= n; ++i) {
    ll x = n / i;
    ans += (x * (x+1) / 2) * i;
  }

  cout << ans << '\n';

  return (0);
}


Measured memory_bytes: 3620
N, Q = input().strip().split()
N = int(N)
Q = int(Q)
S = input()
 
counts = [0 for _ in range(len(S))]
for i in range(1, len(S)):
  if S[i] == 'C' and S[i-1] == 'A':
    counts[i] = counts[i-1] + 1
  else:
    counts[i] = counts[i-1]
    
for q_i in range(Q):
  l, r = input().strip().split()
  l = int(l)-1
  r = int(r)-1  
  print(counts[r] - counts[l])

Measured memory_bytes: 6180
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>
#include <stack>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define mkpr(x,y) make_pair(x,y)
#define all(x) x.begin(),x.end()

typedef long long int ll;

ll general,total;
//ll chk[55];
//ll num[55];
//ll num2[55];
//ll num[ten5];
//ll num2[ten5];
//char cmap[10][10];
//priority_queue<ll> pqll;   //decrease
//priority_queue<double> pqd;
//stack<int> stk;
//vector<pair<ll,ll>> vpll;
//vector<pair<double,double>> vpdd;
vector<ll> vll[ten52];
//vector<double> vd;
//deque<ll> deq[55];
//list<int> li;
//set<int> sint;
set<ll> sll;
//map<ll,ll> mp;

/*ll cmp(pair<ll,ll> a,pair<ll,ll> b)
{
    return a.first<b.first;
    //arrising
}*/

bool dfs(int n,int des)
{
    int i;
    for(i=0;i<vll[n].size();i++)
        if(vll[n][i]==1) return true;
    return false;
}

int main()
{
    double ans=0.0,half,d,d1,d2;
    //float f,g,h;
    //string s,s1;
    //char now,pre,c1,c2;
    long long int sum,sum2,n1,n2,n3;
    long long int m,n,o,i,j,k=1;
    long long int a,a1,a2,a3,a4,a5,a6;
    sum=sum2=n1=n2=n3=0;
    a=a1=a2=a3=a4=a5=a6=0;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>a1>>a2;
        vll[a2].pb(a1);
    }
    for(i=0;i<vll[n].size();i++)
    {
        if(dfs(vll[n][i],1))
        {
            cout<<"POSSIBLE";
            return 0;
        }
    }
    cout<<"IMPOSSIBLE";
    return 0;
}





Measured memory_bytes: 8832
/*input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
*/

#include<bits/stdc++.h>
using namespace std;
#define mx 5001
#define ll long long
ll J[mx], B[mx];
ll ara[mx];
int n;
void rec(int pos)
{
	if(pos == n) {
		J[n] = 0;
		B[n] = 0;
		return;
	}
	ll &ret = J[pos];
	if(ret != -1) return;
	rec(pos+1);
	if(ara[pos] % 2 == 0){
		J[pos] = 2ll * J[pos+1] + 1;
		B[pos] = 2ll * B[pos+1];
	}
	else{
		J[pos] = J[pos+1] + B[pos+1];
		B[pos] = J[pos] + 1;
	}
	// cout << ara[pos] << " -> " << J[pos] << " " << B[pos] << endl;
}

int main()
{
	int p;
	memset(J, -1, sizeof J);
	memset(B, -1, sizeof B);
	scanf("%d %d", &n, &p);
	for(int i = 0; i<n; i++)
		scanf("%lld", &ara[i]);
	rec(0);
	ll ans ;
	if(p) ans = B[0];
	else ans = J[0] + 1;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 384
a,b,c,x,y=map(int,input().split())
ans=min(x,y)*2*c
if x>y:
    ans+=(x-y)*a
else:
    ans+=(y-x)*b
anss=min(max(x,y)*2*c,a*x+b*y)
print(min(anss,ans))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
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 dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

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

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
int main(){
  int n,k;  cin >>n>>k;
  bool h[10] = {true};
  vector<int> d(k);
  rep(i,0,k){
    int x;  cin >> x;
    d[i] = x;
    h[x] = false;
  }
  rep(i,n,100000){
    ll st=i;
    set<int> s;
    while(st){
      s.insert(st%10);
      st /= 10;
    }
    bool ok=true;
    for(int i=0 ; i<k ; i++){
      if(s.count(d[i])) ok=false;
    }
    if(ok){
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cctype>

using namespace std;
#define H 30
#define W 30
#define N 4
#define INF 10000
int w, h;
int board[H][W];
int C[N];

bool invalid(int x, int y){
    return (x < 0 || x >= w || y < 0 || y >= h);
}

int dijkstra(){
    int d[H][W][N];
    int dx[N] = {1, 0, -1, 0};
    int dy[N] = {0, 1, 0, -1};
    bool used[H][W][N];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            for (int k = 0; k < N; k++) {
                d[i][j][k] = INF;
                used[i][j][k] = false;
            }
        }
    }
    d[0][0][0] = 0;
    while (true) {
        int x = -1, y, z;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                for (int k = 0; k < N; k++) {
                    if (!used[i][j][k] && (x == -1 || d[i][j][k] < d[y][x][z])) {
                        y = i; x = j; z = k;
                    }
                }
            }
        }
        if (x == -1) {
            break;
        }
        used[y][x][z] = true;
        for (int i = 0; i < N; i++) {
            int mx = x + dx[i];
            int my = y + dy[i];
            if (invalid(mx, my)) {
                continue;
            }
            int k;
            for (int j = 0; j < N; j++) {
                if ((z + j) % N == i) {
                    k = j;
                    break;
                }
            }
            if (board[y][x] == 4) {
                d[my][mx][i] = min(d[my][mx][i], d[y][x][z] + C[k]);
                continue;
            }
            if (board[y][x] == k) {
                d[my][mx][i] = min(d[my][mx][i], d[y][x][z]);
            }
            else {
                d[my][mx][i] = min(d[my][mx][i], d[y][x][z] + C[k]);
            }
        }
    }
    int ans = INF;
    for (int i = 0; i < N; i++) {
        ans = min(ans, d[h-1][w-1][i]);
    }
    return ans;
}

int main()
{
    while (true) {
        cin >> w >> h;
        if (w == 0 && h == 0) {
            break;
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cin >> board[i][j];
            }
        }
        for (int i = 0; i < N; i++) {
            cin >> C[i];
        }
        cout << dijkstra() << endl;
    }
    return 0;
}

Measured memory_bytes: 1180
from collections import defaultdict
n,m=map(int,input().split())
ps=[list(input().split()) for _ in range(m)]
ac=0
wa=0
d=defaultdict(int)
a=defaultdict(int)
for p,s in ps:
  if s=="WA":
    d[p]+=1
  elif s=="AC":
    if a[p]!=1:
      a[p]=1
      ac+=1
      wa+=d[p]
print("{} {}".format(ac,wa))

Measured memory_bytes: 41748
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,q;
	int a[100010];
	int aq[100010]={0};
	cin>>n>>k>>q;
	for(int i=0;i<q;i++)
	{
		cin>>a[i];
		aq[a[i]-1]++;
	}
	for(int i=0;i<n;i++)
	{
		if(k-q+aq[i]>0)
		{
			cout<<"Yes"<<endl;
		}
		else
		{
			cout<<"No"<<endl;
		}
	}
    return 0;	
} 	

Measured memory_bytes: 1408
def main():
    n,m,k=map(int,input().split())
    aa=list(map(int,input().split()))
    bb=list(map(int,input().split()))
    na=nb=0
    while na < n and aa[na] <= k:
        k-=aa[na]
        na+=1
    while nb < m and bb[nb] <= k:
        k-=bb[nb]
        nb+=1
    nmax=na+nb
    while na > 0:
        na-=1
        k+=aa[na]
        while nb < m and bb[nb] <= k:
            k-=bb[nb]
            nb+=1
        if na+nb > nmax:
            nmax=na+nb
    print(nmax)
main()

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

char x[105][105];

int main() {
	int a, b;
	cin >> a >> b;
	a--,b--;
	for(int i = 1;i <= 50; i++)
		for(int j = 1; j <= 100; j++)
			x[i][j] = '.';
	for(int i = 51; i <= 100; i++)
		for(int j = 1; j <= 100; j++)
			x[i][j] = '#';
	for(int i = 1;i <= 50 && b; i += 2)
		for(int j = 1; j <=100 && b; j += 2)
			x[i][j] = '#', b--;
	for(int i = 100; i > 50 && a; i-=2)
		for(int j = 1; j <= 100 && a;j += 2)
			x[i][j] = '.', a--;
	puts("100 100");
	for(int i = 1; i <= 100; i++, puts(""))
		for(int j = 1;j <= 100; j++)
			cout << x[i][j];
	return 0;
}

Measured memory_bytes: 256
// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        a: [i64; n]
    }

    let (sum, cnt, min) = a
        .into_iter()
        .fold((0, 0, std::i64::MAX), |(sum, cnt, min), x| {
            let sum = sum + x.abs();
            let cnt = if x < 0 { cnt + 1 } else { cnt };
            let min = std::cmp::min(min, x.abs());
            (sum, cnt, min)
        });
    let ans = if cnt % 2 == 0 { sum } else { sum - 2 * min };
    println!("{}", ans)
}


Measured memory_bytes: 6396
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define PI 3.14159265359

const int mod = 1e9 + 7;

vector<int> candidates;
vector<int> options = {3, 5, 7};

int choose2(int n){
  return n*(n-1)/2;
}

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

  int N;
  cin >> N;

  map<int, int> cnt_map;
  vector<int> As(N);

  rep(i, N){
    int tmp;
    cin >> tmp;
    As[i] = tmp;
    cnt_map[tmp]++;
  }

  map<int, int> normal_map;
  map<int, int> sub_map;

  int sum_all = 0;

  for(pair<int, int> p: cnt_map){
    int num = p.first;
    int cnt = p.second;

    normal_map[num] = choose2(cnt);
    sum_all += normal_map[num];

    sub_map[num] = choose2(cnt-1);
  }

  rep(i, N){
    int num = As[i];
    int diff = normal_map[num] - sub_map[num];
    cout << sum_all - diff << endl;
  }

  return 0;
}


Measured memory_bytes: 28524
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n;
  map<long long, int> mp;
  for(int i=0;i<4;i++){
    cin >> n;
    mp[n]++;
  }
  if(mp[1] and mp[7] and mp[9] and mp[4]){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int64_t n,k;
  cin>>n>>k;
  if(n<k){
    int64_t ans=min(n,k-n);
      cout<<ans<<endl;
}
  else if(n==k){
    cout<<0<<endl;
  }
  else if(n>k){
if(n%k==0){
  cout<<0<<endl;
}
    else{
int64_t ans=min(n%k,k-n%k);
  cout<<ans<<endl;
    }
  }
}


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

#define rep(i,a,b) for(int i=a;i<b;i++)



using namespace std;



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



int main(){



	int W,H,sx,sy;

	string s[25];

	bool flag[25][25];



	while(1){

		cin>>W>>H;

		if(W==0&&H==0) break;

		for(int i=0; i<H; i++){

			cin>>s[i];

			for(int j=0; j<W; j++){

				if(s[i][j] == '@'){

					sx = j;

					sy = i;

				}

				flag[i][j] = false;

			}

		}





		queue<int> qx;

		queue<int> qy;

		qx.push(sx);

		qy.push(sy);



		flag[sy][sx] = true;



		int x, y, cnt = 1;

		while(!qx.empty()){



			x = qx.front();

			y = qy.front();

			qx.pop();

			qy.pop();



			for(int k=0; k<4; k++){

				int nx = x+dx[k], ny = y+dy[k];

				if(0<=nx && nx<W && 0<=ny && ny<H){

					if(s[ny][nx] == '.' && !flag[ny][nx]){

						qx.push(nx);

						qy.push(ny);

						flag[ny][nx] = true;

						cnt++;

					}

				}

			}

		}

		cout<<cnt<<endl;



	}	



	return 0;

}

Measured memory_bytes: 3132
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <string>
#include <sstream>
int fix()
{
    //example to format floating point numbers.
    double pi = 3.141592653589793;
    double r = 3.141592653589793 * 128;
    std::ios_base::fmtflags f(std::cout.flags()); //[1]
    std::cout << "default:\n  " << pi << " " << r << "\n";
    std::cout << std::setprecision(4) << "setprecision(4):\n  " //[2]
              << pi << " " << r << "\n";
    std::cout << std::setiosflags(std::ios::fixed) << "setiosflags(std::ios::fixed):\n  " //[2]
              << pi << " " << r << "\n";
    std::cout << std::setprecision(5) << "setprecision(5):\n  " //[2]
              << pi << " " << r << "\n";
    std::cout.flags(f);
    std::cout << "reset:\n  " << pi << " " << r << "\n";
    //[1] https://stackoverflow.com/questions/2273330/restore-the-state-of-stdcout-after-manipulating-it
    //[2] https://stackoverflow.com/questions/4217510/how-to-cout-the-correct-number-of-decimal-places-of-a-double-value
    return 0;
}
void multipleLines()
{
    //example to parse multiple lines input.
    std::istringstream isin("1 2 3\n3 2 4\n0 0 0");

    for (std::string str; std::getline(isin, str);)
    {
        std::istringstream tisin(str);
        int a, b, c;
        tisin >> a >> b >> c;
        std::cout << a << " " << b << " " << c << "\n";
    }
    //[1]  https://stackoverflow.com/questions/19767644/c-parsing-input-string-to-variables
}
#include <vector>
#include <set>
#include <map>

int main()
{
    std::map<std::string, std::set<int64_t>> mCards;
    for (auto suit : {"S", "H", "C", "D"})
    {
        for (int i = 1; i <= 13; ++i)
        {
            mCards[suit].insert(i);
        }
    }

    int64_t n;
    std::cin >> n;
    for (int64_t i = 0; i < n; i++)
    {
        std::string st;
        int64_t a;
        std::cin >> st >> a;
        mCards[st].erase(a);
    }
    for (auto suit : {"S", "H", "C", "D"})
    {
        for(auto i : mCards[suit])
        {
            std::cout << suit << " " << i << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 3164
package main

import (
	"fmt"
)

func main() {
	var k, s int
	ans := 0
	fmt.Scan(&k, &s)
	for i := 0; i <= k; i++ {
		for t := 0; t <= k; t++ {
			z := s - i - t
			if 0 <= z && z <= k {
				ans++
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512