akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll MOD;
ll add(ll x, ll y) {
	x += y;
	x %= MOD;
	if (x < 0) x += MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	x %= MOD;
	if (x < 0) x += MOD;
	return x;
}
ll mult(ll x, ll y) {
	x *= y;
	x %= MOD;
	if (x < 0) x += MOD;
	return x;
}

const int N = 505;
ll dp[N][N];
pii a[N];
int bal[N];
int n;

ll solve(int k) {
	for (int i = 0; i <= 2 * n; i++)
		for (int j = 0; j <= k; j++)
			dp[i][j] = 0;
	dp[0][0] = 1;
	for (int i = 0; i < 2 * n; i++)
		for (int j = 0; j <= k; j++) {
			ll w = dp[i][j];
			if (w == 0) continue;
			if (a[i].second == -1) {
				int b = a[i].first - bal[i] - j;
				if (b > 0)
					dp[i + 1][j] = add(dp[i + 1][j], mult(w, b));
			} else {
				int b = a[i].second - (i + (k - j) + bal[2 * n] - bal[i]);
				if (b > 0)
					dp[i + 1][j] = add(dp[i + 1][j], mult(w, b));
				b = a[i].first - bal[i] - j;
				if (j < k && b > 0)
					dp[i + 1][j + 1] = add(dp[i + 1][j + 1], mult(w, b));
			}
		}
	return dp[2 * n][k];
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%lld", &n, &MOD);
	for (int i = 0; i < 2 * n; i++) {
		int x = 0;
		while(i * i + x * x < n * n) x++;
		int y = x;
		while(y < 2 * n && i * i + y * y <= 4 * n * n) y++;
		if (x == 0) {
			a[i] = mp(y, -1);
		} else {
			a[i] = mp(x, y);
		}
	}
	sort(a, a + 2 * n);
//	for (int i = 0; i < 2 * n; i++)
//		eprintf("%d %d\n", a[i].first, a[i].second);
	for (int i = 0; i < 2 * n; i++) {
		bal[i + 1] = bal[i];
		if (a[i].second == -1)
			bal[i + 1]++;
	}
	ll ans = 0;
	for (int k = 0; k <= n; k++) {
		ll w = solve(k);
//		eprintf("%d %lld\n", k, w);
		if (k % 2 == 0)
			ans = add(ans, w);
		else
			ans = sub(ans, w);
	}
	printf("%lld\n", ans);

	return 0;
}


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

int main()
{
    int n, res = 0;

    int C[20], V[20];

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

    for (int i = 0; i < n; i++)
    {
        if (V[i] > C[i])
        {
            res += (V[i] - C[i]);
        }
    }

    cout << res;
    return 0;
}

Measured memory_bytes: 256
//go:generate echo "https://atcoder.jp/contests/abc099/tasks/abc099_c"
package main

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

type scanner struct{ *bufio.Scanner }

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) Int() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func (s *scanner) IntSlice(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func (s *scanner) IntSlice2(l, n int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := 0; i < n; i++ {
		sl[i] = s.Int()
	}
	return sl
}

func ipow(x, n int) int {
	if n == 0 {
		return 1
	}
	a := ipow(x, n>>1)
	a *= a
	if n&1 != 0 {
		a *= x
	}
	return a
}

func solve(n int) int {
	t := make([]int, n+1, n+1)
	for i := range t {
		t[i] = math.MaxInt64
	}
	t[0] = 0
	for i := 0; i < n; i++ {
		if v := t[i] + 1; v < t[i+1] {
			t[i+1] = v
		}
		for _, k := range []int{6, 9} {
			j := 1
			p := i + ipow(k, j)
			for p <= n {
				if v := t[i] + 1; v < t[p] {
					t[p] = v
				}
				j++
				p = i + ipow(k, j)
			}
		}
	}
	return t[n]
}

func main() {
	scan := newScanner(os.Stdin)
	n := scan.Int()
	fmt.Println(solve(n))
}


Measured memory_bytes: 2588
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
#include <functional>
using namespace std;
typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA cerr << "AAAAA" << endl
#define debug_ cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

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

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

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from, to}}的に使う。
const ll LINF = 1001002003004005006ll;
const ll INF = 1001001001;
const double pi = acos(-1);

int main()
{
    ll n;
    cin >> n;
    string s;
    vector<ll> a = {
        1,
        27, 703, 18279, 475255, 12356631, 321272407, 8353082583, 217180147159, 5646683826135, 146813779479511, 3817158266467287};
    vector<ll> b = {1,
                    27,
                    677,
                    17577,
                    456977,
                    11881377,
                    308915777,
                    8031810177,
                    208827064577,
                    5429503678977,
                    141167095653377,
                    3670344486987777};
    int digit = 0;
    for (int i = 0; i < a.size() - 1; i++)
    {
        if (a[i] <= n && n < a[i + 1])
        {
            digit = i + 1;
        }
    }
    if (digit == 0)
    {
        digit = b.size() - 1;
    }
    n -= a[digit - 1] - 1;
    // debug(n);
    // debug(digit);
    for (int i = digit - 1; i >= 0; i--)
    {
        if (i == 0)
        {
            s.push_back(n - 1 + 'a');
            break;
        }
        int ans = (n - 1) / (b[i] - 1);
        s.push_back(ans + 'a');
        n = n - ans * (b[i] - 1);
    }
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 3608
import sys
import math

theta = math.pi / 3
cos_theta = math.cos(theta)
sin_theta = math.sin(theta)

def calc_pdr(pd):
	pdr_x = cos_theta * pd[0] - sin_theta * pd[1]
	pdr_y = sin_theta * pd[0] + cos_theta * pd[1]

	return [pdr_x, pdr_y]

def make_coch(l):
	num_points = len(l) 
	if num_points == 2:
		p0 = l[0]
		p1 = l[1]

		pd = [(x1 - x0) / 3 for (x1, x0) in zip(p1, p0)]
		pa = [x0 + xd for (x0, xd) in zip(p0, pd)]
		pc = [x0 + 2 * xd for (x0, xd) in zip(p0, pd)]
		pdr = calc_pdr(pd)

		pb = [xa + xdr for (xa, xdr) in zip(pa, pdr)]

		return [p0, pa, pb, pc, p1]
	else:
		l_ret = []
		
		l_ret += make_coch([l[0], l[1]])
		for i in range(1, num_points - 1):
			nl = make_coch([l[i], l[i + 1]])
			l_ret += nl[1:]
		
		return l_ret
	
#fin = open("test.txt", "r")
fin = sys.stdin

n = int(fin.readline())

p0 = [0.0, 0.0]
p1 = [100.0, 0.0]	
l = [p0, p1]

for i in range(n):
	l = make_coch(l)

for p in l:
	print("{0:.5f} {1:.5f}".format(p[0], p[1]))
	

Measured memory_bytes: 8436
#include<bits/stdc++.h>
#define int long long
using namespace std;
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; }

const int INF=1e18;

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

    int N,M; cin>>N>>M;
    vector<int> a(M),t(M);
    for(int i=0;i<M;i++){
        int k; cin>>a[i]>>k;
        while(k--){
            int c; cin>>c;
            c--;
            t[i]|=1<<c;
        }
    }

    vector<int> dp(1<<N,INF);
    dp[0]=0;
    for(int i=0;i<M;i++){
        for(int S=0;S<(1<<N);S++){
            chmin(dp[S|t[i]],dp[S]+a[i]);
        }
    }
    int ans=dp[(1<<N)-1];
    cout<<(ans==INF? -1:ans)<<endl;
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
void solve(){
    int n;
    cin >> n;
    bool is = true;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if (x % 2 == 0) {
            if (x % 5 != 0 && x % 3 != 0) is = false;
        }
    } 
    if (is) cout << "APPROVED";
    else cout << "DENIED";
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

Measured memory_bytes: 256
# bc137_c.py
import math
def nCr(n,r):
    if n < 2:
        return 0
    ans = int(math.factorial(n)/(math.factorial(n-r)*math.factorial(r)))
    return ans 
import collections
N = int(input())
L = []
for i in range(N):
    S = input()
    S = sorted(S)
    L.append(str(S))
C = collections.Counter(L)
ans = 0
for i in C.values():
    ans += nCr(i,2)
print(ans)

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

#define maxn 111111
typedef pair<int, int> pii;
pii a[maxn];
int b[maxn], c[maxn];
int n;

bool cmp1(int x, int y)
{
    return a[x].first < a[y].first;
}

bool cmp2(int x, int y)
{
    return a[x].second < a[y].second;
}

struct edge
{
    int x, y, z;
    edge(int x = 0, int y = 0, int z = 0): x(x), y(y), z(z) {}
    friend bool operator <(edge x, edge y)
    {
        return x.z < y.z;
    }
};
edge e[maxn * 2];
int m;

void add_edge(int x, int y, int z)
{
    e[++m] = edge(x, y, z);
}

int fa[maxn];

int find(int x)
{
    return fa[x] == x ? x : fa[x] = find(fa[x]);
}

bool unite(int x, int y)
{
    x = find(x), y = find(y);
    if (x == y)
    {
        return 0;
    }
    fa[x] = y;
    return 1;
}

long long solve()
{
    for (int i = 1; i <= n; i++)
    {
        fa[i] = i;
    }
    long long res = 0;
    sort(e + 1, e + 1 + m);
    for (int i = 1; i <= m; i++)
    {
        if (unite(e[i].x, e[i].y))
        {
            res += e[i].z;
        }
    }
    return res;
}


int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i].first >> a[i].second;
    }
    for (int i = 1; i <= n; i++)
    {
        b[i] = c[i] = i;
    }
    sort(b + 1, b + 1 + n, cmp1);
    sort(c + 1, c + 1 + n, cmp2);

    for (int i = 1; i < n; i++)
    {
        add_edge(b[i], b[i + 1], a[b[i + 1]].first - a[b[i]].first);
        add_edge(c[i], c[i + 1], a[c[i + 1]].second - a[c[i]].second);
    }

    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 4864
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;

int g[100001][3];
int dp[100001][3];

int main(){
    int N; cin >> N;
    rep(i, 0, N){
        int a, b, c;
        cin >> a >> b >> c;
        g[i][0] = a; g[i][1] = b; g[i][2] = c;
    }
    dp[0][0] = g[0][0];
    dp[0][1] = g[0][1];
    dp[0][2] = g[0][2];
    for(int i=1; i<N; i++){
        dp[i][0] = max(dp[i-1][1] + g[i][0], dp[i-1][2] + g[i][0]);
        dp[i][1] = max(dp[i-1][0] + g[i][1], dp[i-1][2] + g[i][1]);
        dp[i][2] = max(dp[i-1][0] + g[i][2], dp[i-1][1] + g[i][2]);
    }
    cout << max(max(dp[N-1][0], dp[N-1][1]), dp[N-1][2]) << endl;

    return 0;

}




Measured memory_bytes: 2560
def move(a, A, c):

  c.remove(a)
  if(c==[]):
    return 1
  if(not a in A):
    return 0
  sum = 0
  for i in A[a]:
    if(i in c):
      sum += move(i, A, list(c))

  return sum


N, M = map(int, input().split())

A = {}
c = []

for i in range(M):
  a, b = map(int, input().split())

  if(not a in c):
    c.append(a)
  if(not b in c):
    c.append(b)

  if(a in A):
    A[a].append(b)
  else:
    A[a] = [b]
  if(b in A):
    A[b].append(a)
  else:
    A[b] = [a]

print(move(1, A, c))



Measured memory_bytes: 3064
#include <stdio.h>

int IP(int );

int IP(int a){
  int i;

  if(a<2){
    return 0;
  }
  else if(a ==2 ){
    return 1;
  }
  if(a%2==0){
    return 0;

  }
  
  for(i=3;i*i <= a; i+=2)
    {
      if( a%i == 0 ){
	return 0;

      }
    }
  
  return 1;
}



int main(){
  int num,a,i;
  int count=0;

  scanf("%d",&num);
  
  for(i=0;i<num;i++){
    scanf("%d",&a);
    if( IP(a) ) count++;
  }

  printf("%d\n", count);


  return 0;
  
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

int D;
int c[26], s[365][26], t[26], last[26], ans[366];

void calc(int idx){
    for (int i = idx; i < D; ++i) {
        ans[i + 1] = ans[i] + s[i][t[i]];
        last[t[i]] = i + 1;
        for (int j = 0; j < 26; ++j)
            ans[i + 1] -= c[j] * (i + 1 < last[j] ? i + 1 : i + 1 - last[j]);
    }
}

void greedy(){
    for (int i = 0; i < D; ++i) {
        int maidx = 0;
        for (int k = 0; k < 26; ++k) {
            int res = ans[i] + s[i][k], old = last[k];
            last[k] = i + 1;
            for (int j = 0; j < 26; ++j)
                res -= c[j] * (i + 1 - last[j]);

            if (ans[i + 1] < res) {
                ans[i + 1] = res;
                maidx = k;
            }
            last[k] = old;
        }
        t[i] = maidx;
        last[t[i]] = i + 1;
    }
}

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

    cin >> D;
    for (int i = 0; i < 26; ++i)
        cin >> c[i];
    for (int i = 0; i < D; ++i)
        for (int j = 0; j < 26; ++j)
            cin >> s[i][j];

    greedy();
    for (int i = 0; i < D;++i)
        cout << t[i] + 1 << '\n';

    return 0;
}


Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
const int inf=0x7fffffff;
const int mod=1e9+7;
const int eps=1e-6;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
signed main()
{
    IOS;
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=10000;i++)
    {
        if(i*8/100==a&&i*10/100==b)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 n;
  cin >> n;
  vector<int> d(3);
  rep(i,3) cin >> d[i];
  vector<P> q;
  rep(i,n) {
    string s;
    cin >> s;
    int a = 0, b = 1;
    if (s == "AB") a = 0, b = 1;
    if (s == "AC") a = 0, b = 2;
    if (s == "BC") a = 1, b = 2;
    q.emplace_back(a,b);
  }
  string ans;
  auto add = [&](int a, int b) {
    d[a]++;
    d[b]--;
    ans += 'A'+a;
  };
  q.emplace_back(0,1);
  rep(i,n) {
    int a = q[i].first;
    int b = q[i].second;
    if (!d[a] && !d[b]) {
      cout << "No" << endl;
      return 0;
    }
    if (!d[a]) {
      add(a,b);
    } else if (!d[b]) {
      add(b,a);
    } else {
      int na = q[i+1].first;
      int nb = q[i+1].second;
      if (a == na || a == nb) {
        add(a,b);
      } else {
        add(b,a);
      }
    }
  }
  cout << "Yes" << endl;
  rep(i,n) {
    cout << ans[i] << endl;
  }
  return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vvll = vector<vll>;
using vst = vector<st>;
using vch = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
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 ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main(){
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << b - (b / c + b / d - b / ( c * d / GCD(c, d))) - ((a - 1) - ((a - 1) / c + (a - 1) / d - (a - 1) / (c * d / GCD(c, d)))) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int i,a,b,r,temp;

  scanf("%d%d",&a,&b);

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

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

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

  return 0;
}

Measured memory_bytes: 592
/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=a; i<(int)b; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int maxN = 3e5+2;


void solve()
{
    string s;
    cin >> s;

    int cnt = 0;

    if(s[0] == 'R' and s[1] == 'R' and s[2] == 'R') cnt = 3;
    else if(s[0] == 'R' and s[1] == 'R') cnt = 2;
    else if(s[1] == 'R' and s[2] == 'R') cnt = 2;
    else if(s[0] == 'R' or s[1] == 'R' or s[2] == 'R') cnt = 1;

    prin(cnt);
}

int main()
{
    int t = 1;
    // scn(t);
    
    while(t --) {
        solve();
    }
    return 0;
}

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

using namespace std;

int p, q;
map<int, int> RestExist, LastPos;
string AnsNumber;

bool solve() {
	int rest;

	RestExist[p%q] = 0;
	p *= 10;
	for (int i = 1; i < 82; i++) {
		rest = p%q;
		AnsNumber += p / q + '0';
		//cout << "i=" << i << "   Ans=" << AnsNumber << "   rest=" << rest << endl;
		if (rest == 0) {
			return false;
		}

		if (RestExist.find(rest) != RestExist.end()) {
			LastPos[rest] = i;
			//LastPos.insert(pair<int, int>(rest, i));
			return true;
		}
		RestExist[rest] = i;
		//RestExist.insert(pair<int, int>(rest, i));
		p = rest * 10;
	}
	return false;
}

int main() {
	int  startPos, endPos, index;

	while (cin >> p >> q) {
		AnsNumber = "";
		RestExist.clear();
		LastPos.clear();
		if (solve()) {
			cout << AnsNumber << endl;
			startPos = RestExist[LastPos.begin()->first];
			endPos = LastPos.begin()->second;
			for (index = 0; index < startPos; index++) {
				cout << " ";
			}
			for (; index < endPos; index++) {
				cout << "^";
			}
			cout << endl;
		}
		else {
			cout << AnsNumber << endl;
		}

	}

	return 0;
}


Measured memory_bytes: 3208
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;
long long int gcd(long long int x, long long int y){
  return y!=0 ? gcd(y, x%y) : x;
}
long long int lcm(long long int x, long long int y){
  return x*y/gcd(x, y);
}
long long int factorial(long long int x){
  return x==0 ? 1 : x*factorial(x-1);
}
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main(){
  int i, j, n, d, ans=0, k;
  double tmp;
  cin >> n >> d;
  int x[n][d];
  for(i=0; i<n; i++)
    for(j=0; j<d; j++)
      cin >> x[i][j];
  for(i=0; i<n; i++)
    for(j=i+1; j<n; j++){
      tmp=0.0;
      for(k=0; k<d; k++)
	tmp+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      tmp=sqrt(tmp);
      if(ceil(tmp)==floor(tmp))
	ans++;
    }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    
int N;
cin >> N;
string s;
long long  a[5]={};
rep(i,N){
cin >> s;
    if(s[0]=='M'){
    a[0]++;
    }
    else if(s[0]=='A'){
    a[1]++;
    }
    else if(s[0]=='R'){
    a[2]++;
    }
    else if(s[0]=='C'){
    a[3]++;
    }
    else if(s[0]=='H'){
    a[4]++;
    }
}


long long  Answer=0;

Answer+=a[0]*a[1]*a[2];
Answer+=a[1]*a[2]*a[3];
Answer+=a[2]*a[3]*a[4];
Answer+=a[3]*a[4]*a[0];
Answer+=a[4]*a[0]*a[1];

Answer+=a[0]*a[2]*a[4];
Answer+=a[0]*a[2]*a[3];
Answer+=a[0]*a[1]*a[3];
Answer+=a[1]*a[3]*a[4];
Answer+=a[1]*a[2]*a[4];


cout <<Answer<<endl;
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const double PI=acos(-1);


void solve(long long A, long long B, long long H, long long M){
    // b^2+c^2-2*b*c*cos theta
    double theta1, theta2;
    theta2 = M * 6;
    theta1 = H * 30 + M * 0.5;
    double ans = A * A + B * B - 2 * A * B * cos((theta1-theta2) * PI / 180);
    cout << setprecision(10) << pow(ans, 0.5) << endl;

}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long H;
    scanf("%lld",&H);
    long long M;
    scanf("%lld",&M);
    solve(A, B, H, M);
    return 0;
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<sstream>
using namespace std;
  
#define sf scanf
#define pf printf
#define pfn printf("\n");
#define pfk printf(" ");
#define pf0 printf("0");
#define pf1 printf("1");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfdd(n,m) scanf("%d%d",&n,&m);
#define sfld(n) scanf("%lld",&n);
#define sfldd(n,m) scanf("%lld%lld",&n,&m);
#define sflf(n) scanf("%lf",&n);
#define sflff(n,m) scanf("%lf%lf",&n,&m);
#define sfc(n) scanf("%c",n);
#define sfcc(n,m) scanf("%c%c",n,m);
#define sfs(n) scanf("%s",n);
#define sfss(n,m) scanf("%s%s",n,m);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);
  
#define csh(a,n) memset(a,n,sizeof(a));
int arr[3];
int main(){
	int n;
	ll sum=1;
	ll mod=1000000007;
	cin>>n;
	for(int i=0;i<n;i++){
		ll a;
		cin>>a;
		int count=0;
		for(int j=0;j<3;j++){
			if(arr[j]==a){
				count++;
				if(count==1){
					arr[j]++;
				}
			}
		}
		sum*=count;
		sum%=mod;
	}
	cout<<sum<<endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

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

    int n, q, b, e, k;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    cin >> q;
    rep(i, q) {
        cin >> b >> e >> k;
        cout << count(v.begin() + b, v.begin() + e, k) << "\n";
    }
}



Measured memory_bytes: 3228
#include <stdio.h>
  
int main(void)
{
int n, num[100];
int i;
  
scanf("%d", &n);
  
for(i=0;i<n;i++)
scanf("%d", &num[i]);
  
for(i--;i>0;i--)
printf("%d ", num[i]);
printf("%d\n", num[0]);
 
return 0;
}

Measured memory_bytes: 596
while STDIN.gets do
  a,b,c,d,e,f = $_.split(" ").map(&:to_i)

  //
  ratio = d.to_f/a
  aa = a * ratio
  bb = b * ratio
  cc = c * ratio

  coe_y = bb - e
  right = cc - f
  y = right / coe_y

  //
  coe_x = a
  right = c - b*y
  x = right / coe_x

  puts "%.3f %.3f" % [x,y]

end

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

int main() {
    int N; cin >> N; int c=0;
    for(int i=1; i<=N; i++){
        string S;
        S=to_string(i);
        if(S.size()%2==1){
            c++;
        }
    }
    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main()
{
    char ser[102];
    int a=0,b=0;
    while(1){
        scanf("%s",ser);
        if(ser[0]=='0')break;
        for(int i=1;ser[i]!='\0';i++){
            if(ser[i]=='A')a++;
            else b++;
        }
        if(a>b)a++;
        else b++;
        cout<<a<<" "<<b<<endl;
        a=0;b=0;
    }
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String[] mark = { "S", "H", "C", "D" };
		String[] allCard = new String[52];
		for (int x = 0; x < 4; x += 1) {
			for (int y = 0; y < 13; y += 1) {
				for (int z = 0; z < 52; z += 1) {
					allCard[13 * x + y] = (mark[x] + " " + Integer
							.toString(y + 1));
				}
			}
		}
		int n = Integer.parseInt(in.readLine());
		String[] myCard = new String[n];
		for (int i = 0; i < n; i += 1) {
			String[] inputMyCard = in.readLine().split(" ");
			String thisMark = inputMyCard[0];
			int num = Integer.parseInt(inputMyCard[1]);
			myCard[i] = thisMark + " " + Integer.toString(num);
		}
		for (int p = 0; p < n; p += 1) {
			for (int q = 0; q < 52; q += 1) {
				if (myCard[p].equals(allCard[q])) {
					allCard[q] = null;
				} else {
					continue;
				}
			}
		}
		for (int s = 0; s < 52; s += 1) {
			if (allCard[s] != null) {
				System.out.println(allCard[s]);
			}
		}
	}
}

Measured memory_bytes: 17476
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ii pair<ll,pair<int,int>>
#define ll long long
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define orta ((bas+son)>>1)
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define inf 2000000000
#define N 100005
#define MOD 1000000007
using namespace std;
 
int n;
char s[N];
int dp[N][16];

int mul(int x,int y) {return (ll)x*y%MOD;}

int add(int x,int y) {

	x+=y;

	return x%MOD;

}

int main() {
 
 	scanf("%s",s+1);

 	n=strlen(s+1);

 	reverse(s+1,s+1+n);

 	//pre();

 	dp[0][0]=1;

 	int val=1;

 	for(int i=0;i<n;i++,val*=10,val%=13) {

 		for(int m=0;m<13;m++) {

 			if(s[i+1]=='?') {

 				for(int v=0;v<10;v++) {

 					int nmd=(m+v*val)%13;

 					dp[i+1][nmd]=add(dp[i+1][nmd],dp[i][m]);

 				}

 			}
 			else {

 				int nmd=(m+(s[i+1]-'0')*val)%13;

 				dp[i+1][nmd]=add(dp[i+1][nmd],dp[i][m]);

 			}

 		}

 	}

 	printf("%d",dp[n][5]);

}

Measured memory_bytes: 6656
using System;

class ABC_126_B
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();

        int A = int.Parse(s.Substring(0, 2));
        int B = int.Parse(s.Substring(2, 2));

        bool isYYMM = false;
        bool isMMYY = false;

        if (0 < A && A < 13)
        {
            isMMYY = true;
        }
        if (0 < B && B < 13)
        {
            isYYMM = true;
        }

        if(isYYMM && isMMYY)
        {
            Console.WriteLine("AMBIGUOUS");
        }
        else if(isYYMM)
        {
            Console.WriteLine("YYMM");
        }
        else if (isMMYY)
        {
            Console.WriteLine("MMYY");
        }
        else
        {
            Console.WriteLine("NA");
        }

    }
}

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

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second　//pairの二つ目の要素

int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    ll pat=a+b;
    ll ans=n/pat*a;
    if(n%pat>a) ans+=a;
    else ans+=n%pat;
    cout<<ans<<endl;
    return 0;
}

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


int main() {

    int n;
    std::cin >> n;

    std::vector<int> a;
    for (int i=0; i<n; i++) {
        int b;
        std::cin >> b;
        a.push_back(b);
    }

    std::sort(a.begin(), a.end());
    for (auto v : a) std::cerr << v << ", ";
    std::cerr << std::endl;

    const int N = a.back();

    const int R_ideal = (N + 1) / 2;

    std::cerr << "R_ideal = " << R_ideal << std::endl;

    a.pop_back();

    int p = 0;

    for (p=0; p<n-1; p++) {
        if (a.at(p) >= R_ideal) break;
    }

    if (p == n-1) p--;

    int R = a.at(p);

    const int p_alt = p - 1;

    if (0 <= p_alt && p_alt <= n-1) {
        int diff     = std::abs(R_ideal - a.at(p));
        int diff_alt = std::abs(R_ideal - a.at(p_alt));
        if (diff_alt < diff) R = a.at(p_alt);
    }

    std::cout << N << " " << R << std::endl;

    return 0;

}


Measured memory_bytes: 892
#include <stdio.h>

int main(void) {
	int n, i;
	int min_value;
	int max = 0;
	int R;
	if (scanf("%d", &n) != 1 || n < 2) return 1;
	if (scanf("%d", &min_value) != 1) return 1;
	if (scanf("%d", &R) != 1) return 1;
	max = R - min_value;
	if (min_value > R) min_value = R;
	for (i = 2; i < n; i++) {
		int R;
		if (scanf("%d", &R) != 1) return 1;
		if (max < R - min_value) max = R - min_value;
		if (min_value > R) min_value = R;
	}
	printf("%d\n", max);
	return 0;
}



Measured memory_bytes: 2140
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let h = read::<i64>();
  let w = read::<i64>();
  let mut map: Vec<Vec<char>> = vec![];

  for i in 0..h {
    let row = read::<String>();
    map.push(row.chars().collect())
  }

  for i in 0..h {
    for j in 0..w {
      let i_size = i as usize;
      let j_size = j as usize;
      let mut cnt = 0;
      if map[i_size][j_size] == '#' {
        continue;
      }

      // 左上
      if 0 < i && 0 < j && map[i_size - 1][j_size - 1] == '#' {
        cnt += 1;
      }
      // 上
      if 0 < i && map[i_size - 1][j_size] == '#' {
        cnt += 1;
      }
      // 右上
      if 0 < i && j + 1 < w && map[i_size - 1][j_size + 1] == '#' {
        cnt += 1;
      }
      // 左
      if 0 < j && map[i_size][j_size - 1] == '#' {
        cnt += 1;
      }
      // 右
      if j + 1 < w && map[i_size][j_size + 1] == '#' {
        cnt += 1;
      }
      // 左下
      if i + 1 < h && 0 < j && map[i_size + 1][j_size - 1] == '#' {
        cnt += 1;
      }
      // 下
      if i + 1 < h && map[i_size + 1][j_size] == '#' {
        cnt += 1;
      }
      // 右下
      if i + 1 < h && j + 1 < w && map[i_size + 1][j_size + 1] == '#' {
        cnt += 1;
      }
      map[i_size][j_size] = cnt.to_string().chars().nth(0).unwrap();
    }
  }

  for i in map {
    let mut s = String::from("");
    for j in i.iter() {
      s.push_str(&j.to_string());
    }
    println!("{}", s);
  }
}



Measured memory_bytes: 4352
def main():
    n, m = map(int, input().split())
    ab = [input().split() for _ in [0]*m]
    cnt = 0
    ac_list = [False]*n
    cnt_list = [0]*n
    for a, b in ab:
        if b == "WA":
            cnt_list[int(a)-1] += 1
        else:
            if ac_list[int(a)-1] == False:
                cnt += cnt_list[int(a)-1]
                ac_list[int(a)-1] = True
    print(sum(ac_list), cnt)


main()


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

int main() {
  long long n,p,gc = 0,kc = 0,ans = 1;
  cin >> n >> p;
  for(int i = 0;i < n;i++){
    int a;
    cin >> a;
    if(a%2 == 0) gc++;
    else kc++;
  }
  if(kc == 0){
    if(p == 0) ans <<= n;
    else ans = 0;
  }
  else{
    ans <<= n-1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll n,m;
ll dp[1000][1000];
ll mod=1000000007;
int main()
{
    cin>>n>>m;
    char a[n][m];
    dp[0][0]=1;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
        {
            cin>>a[i][j];
            if(i!=0)
            {
            if(a[i-1][j]=='.')
                dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;
            }
            if(j!=0)
            {
            if(a[i][j-1]=='.')
                dp[i][j]=(dp[i][j]+dp[i][j-1])%mod;
            }
  //          cout<<dp[i][j]<<" ";
        }
    //    cout<<"\n";
    }
    cout<<dp[n-1][m-1];
}


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

#define itn long long
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)(n);i>=0;--i)
#define debug(x) cout << #x << "=" << (x) << endl;
const ll MOD=1e9+7;

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<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end

void solve(){
  while(1){
    int n,r;
    cin>>n>>r;
    if(!(n|r))return;
    vector<int> A(n);
    rep(i,n)
      A[n-1-i]=i+1;
    rep(i,r){
      int p,c;
      cin>>p>>c;--p;
      vector<int> newA(n,0);
      for(int j=p;j<p+c;j++)
        newA[j-p]=A[j];
      for(int j=0;j<p;j++)
        newA[j+c]=A[j];
      rep(j,n)
        if(!newA[j])
          newA[j]=A[j];
      A=newA;
    }
    cout<<A[0]<<endl;
  }
}
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
#define vecmin(A) *min_element(A.begin(),A.end())
#define vecmax(A) *max_element(A.begin(),A.end())
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector<int> a(n),b(n),c(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  rep(i,n) cin >> c[i];
  sort(a);
  sort(b);
  sort(c);
  ll ans = 0;
  rep(i,n){
    int ok = -1;
    int ng = n;
    while(abs(ok-ng)>1){
      int mid = (ok+ng)/2;
      if(a[mid]<b[i]) ok = mid;
      else ng = mid;
    }
    int arange = ok + 1;
    ok = n;
    ng = -1;
    while(abs(ok-ng)>1){
      int mid = (ok+ng)/2;
      if(c[mid]>b[i]) ok = mid;
      else ng = mid;
    }
    int crange = n - ok;
    ans += (ll)arange*crange;
  }
 cout << ans << endl; 
}


Measured memory_bytes: 1408
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[][] A = new int[3][3];
        boolean[][] plotA = new boolean[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                A[i][j] = Integer.parseInt(sc.next());
                plotA[i][j] = false;
            }
        }
        int N = Integer.parseInt(sc.next());
        for(int i=0;i<N;i++){
            int num = Integer.parseInt(sc.next());
            for(int j=0;j<3;j++){
                for(int k=0;k<3;k++){
                    if(num == A[j][k]){
                        plotA[j][k] = true;
                    }
                }
            }
        }
        boolean isBingo = false;
        for(int i=0;i<3;i++){
            if(plotA[i][0] && plotA[i][1] && plotA[i][2])isBingo = true;
            if(plotA[0][i] && plotA[1][i] && plotA[2][i])isBingo = true;
        }
        if(plotA[0][0] && plotA[1][1] && plotA[2][2])isBingo = true;
        if(plotA[0][2] && plotA[1][1] && plotA[2][0])isBingo =true;
        System.out.println(isBingo ? "Yes" : "No");
    }
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loop2(num) for (lli j = 0 ; j < num ; j ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }
#define looppu(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . push_back (x) ;}
#define loopin(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . insert (x) ;}

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back ()
#define pof pop_front ()

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve ()
{
    int a[3];
    loopcin(3,a);
    cout << a[2] << ' ' << a[0] << ' ' << a[1] << endl ;
}

signed main ()
{
    fastio
    solve ();
    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
#ifndef DEBUG
#pragma GCC optimize("O3,unroll-loops")
#pragma loop_opt(on)
#endif
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#define FAST ;
#else
#define FAST ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define cerr
#endif
#define _ <<' '<<
#define Fr(i, s, e) for(auto i = s; i < e; ++i)
#define All(v) v.begin(),v.end()
#define Ft first
#define Sd second
using ll = long long;
using pii = pair<int, int>;
constexpr ll MOD = 1e9+7;

signed main() {
    FAST;

    int n;
    cin >> n;
    vector<int> a(n+2,0);
    Fr(i, 0, n) cin >> a[i+1];
    int tot = 0;
    Fr(i, 1, n+2) tot += abs(a[i] - a[i-1]);
    auto d = [](int x, int y) {
        if (x == y) return 0;
        return (x-y)/abs(x-y);
    };
    Fr(i, 0, n)
        cout << tot - (d(a[i],a[i+1])+d(a[i+1],a[i+2]) ? 0 : min(abs(a[i]-a[i+1]),abs(a[i+1]-a[i+2])))*2 << endl;

}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int main(){
	long long N,x;
	cin>>N>>x;
	if(2*N-1==x||x==1){
	   cout<<"No"<<endl;
	   return 0;
	}
	if(N==2){
	   if(x==2){
	      cout<<"Yes"<<endl;
	      cout<<1<<endl;
	      cout<<2<<endl;
	      cout<<3<<endl;
	   }else{
	      cout<<"No"<<endl;
	   }
	   return 0;
	}
	cout<<"Yes"<<endl;
	if(x==2*N-2){
	   long long a=1;
	   REP(i,N-2){
	      while(x-2<=a&&a<=x+1)a++;
	         cout<<a<<endl;
	         a++;
	       }
	       cout<<x-1<<endl;
	       cout<<x<<endl;
	       cout<<x+1<<endl;
	       cout<<x-2<<endl;
	       REP(i,N-3){
	       while(x-1<=a&&a<=x+2)a++;
	           cout<<a<<endl;
	           a++;
	       }
	       return 0;
	}
	long long a=1;
	REP(i,N-2){
	    while(x-1<=a&&a<=x+2)a++;
	    cout<<a<<endl;
	    a++;
	}
	cout<<x+1<<endl;
	cout<<x<<endl;
	cout<<x-1<<endl;
	cout<<x+2<<endl;
	REP(i,N-3){
	    while(x-1<=a&&a<=x+2)a++;
	    cout<<a<<endl;
	    a++;
	}
	return(0);
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const ll MOD = 998244353 ;
const int MAXN = 55;
//EAZY..PIZZIIEE

void solve(){
    int n, m;
    cin >> n >> m;
    cout << (n * (n - 1)/2) + (m * (m - 1)/2 ) << '\n';
}

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

Measured memory_bytes: 256
def resolve():
    a,b = input().split()
    a = int(a)
    c = int(b.replace('.', ''))
    d = str(a * c)
    if len(d) < 3:
        d = '0' * (3 - len(d)) + d
    if b.find('.') == -1:
        print(d)
    else:
        l = len(b) - b.find('.') - 1
        print(d[:-l])


if __name__ == "__main__":
    resolve()



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

int main() {
  int n,a;
  cin >> n >> a;
  if( (n%500) == 0 )
    cout << "Yes" << endl;
  else if( (n%500) <= a )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9 + 7;
const int INF = 2e18;

signed main() {
    int N;
    cin >> N;
    vector<int> P(N);
    cin >> P;
    int ans = N;
    {
        // explore left
        vector<int> count(N + 5, -1);
        for (int i = 0; i < N; i++) {
            if (count[P[i] - 1] == -1) count[P[i]] = 1;
            else count[P[i]] = count[P[i] - 1] + 1;
        }
        for (int i = 1; i <= N; i++) ans = min(ans, N - count[i]);
    }
    {
        // explore right
        vector<int> count(N + 5, -1);
        for (int i = N - 1; i >= 0; i--) {
            if (count[P[i] + 1] == -1) count[P[i]] = 1;
            else count[P[i]] = count[P[i] + 1] + 1;
        }
        for (int i = 1; i <= N; i++) ans = min(ans, N - count[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3456
#include <iostream>
#include <string.h>
#include <algorithm>

struct Seg
{
	int val,num;
	Seg()
	{}
	Seg(int a,int b) 
	:
	val(a),
	num(b)
	{}
	bool operator < (const Seg &cmp) const
	{
		return val < cmp.val;
	}
}s[100003];

int main()
{
	int n;
	unsigned long long k,d = 0;
	scanf("%d",&n);
	std::cin>>k;
	int a, b;
	for(int j = 0; j < n; j++)
	{
		scanf("%d %d",&a,&b);
		s[j] = Seg(a,b);
	}
	std::sort(s,s+n);
	int i = 0;
	for(; i < n && k > d; ++i)
	{
		d += s[i].num;
	}
	printf("%d",s[i -1].val);
	return 0;
}

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

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();

//		W = in.readLine();
		String[] Ws = W.split(" ");

		int A = Integer.parseInt(Ws[0]);
		int B = Integer.parseInt(Ws[1]);

		if(A >= 10 || B >= 10){
			System.out.println(-1);
		}else{
			System.out.println(A*B);
		}

	}
}


Measured memory_bytes: 23124
<?php
  fscanf(STDIN,"%d%d", $n,$k);
  $s = trim(fgets(STDIN));
  if($s[$k-1] == "A") $s[$k-1] = "a";
  else if($s[$k-1] == "B") $s[$k-1] = "b";
  else $s[$k-1] = "c";
  echo $s;

Measured memory_bytes: 16076
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int h, w;
  cin >> h >> w;
  vector<vector<int>> a(h, vector<int>(w));
  rep(i, 0, h) rep(j, 0, w) cin >> a[i][j];

  vector<tuple<int, int, int, int>> v;
  rep(i, 0, h) rep(j, 0, w) {
    if (a[i][j] & 1) {
      if (j < w - 1) {
        a[i][j + 1]++;
        a[i][j]--;
        v.emplace_back(i + 1, j + 1, i + 1, j + 2);
      } else {
        if (i < h - 1) {
          a[i + 1][j]++;
          a[i][j]--;
          v.emplace_back(i + 1, j + 1, i + 2, j + 1);
        }
      }
    }
  }

  cout << v.size() << endl;
  for (auto vv : v) {
    cout << get<0>(vv) << " " << get<1>(vv) << " " << get<2>(vv) << " "
         << get<3>(vv) << endl;
  }
}


Measured memory_bytes: 6260
#include <stdio.h>

#define MAX (20)

int main(){

    int H, h;
    int W, w;

    // 値の入力
    scanf("%d %d", &H, &W);
    scanf("%d %d", &h, &w);

    printf("%d", H*W-(W*h+H*w-h*w));

}

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

const int maxN=100;
const int maxL=12;
const int inf=2147483647;

int n;
set<string> St;
string str;

int main(){
	cin>>n;
	cin>>str;St.insert(str);
	for (int i=2;i<=n;i++){
		char lst=str[str.size()-1];
		cin>>str;
		if ((St.count(str))||(str[0]!=lst)){
			printf("No\n");return 0;
		}
		St.insert(str);
	}
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 256