akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> A(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A.at(i).at(j);
    }
  }
  int h = 0;
  int w = 0; // eliminated numbers
  bool incomplete = true;
  while (incomplete){
    int count = 0;
    for (int i = 0; i < H - h; i++){
      bool white_flag = true;
      for (int j = 0; j < W; j++) {
        white_flag *= (A.at(i).at(j) == '.');
      }
      if (white_flag) {
        A.erase(A.begin()+i);
        h++;
        break;
      }
      count++;
    } 
    if (count == H - h) break;
  }
  while (incomplete){ 
    int count = 0;
    for (int j = 0; j < W -w; j++) {
      bool white_flag = true;
      for (int i = 0; i < H - h; i++){
        white_flag *= (A.at(i).at(j) == '.');
      }
      if (white_flag){
        for(int i = 0; i < H -h; i++){
          A.at(i).erase(A.at(i).begin()+j);
        }
        w++;
        break;
      }
      count++;
    }
    if (count == W -w) break;
  }
  
  for (int i = 0; i < H -h; i++){
    for (int j = 0; j < W - w; j++) {
      cout << A.at(i).at(j);
      if (j == W - w - 1) {
        cout << endl;
      }
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
    
  lint n; cin >> n;
  string s; cin >> s;
  string t = s;
  int d = 0;
  for(int i = 0; i < t.size(); i++) {
    if(t[i] == '(') d++;
    else d--;
    if(d == -1) {
      d = 0;
      s = '(' + s;
    }
  }

  int cnt = 0;
  for(int i = 0; i < s.size(); i++) {
    if(s[i] == '(') cnt++;
    else cnt--;
  }

  for(int i = 0; i < cnt; i++) s = s + ')';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<long long> A(N), B(N);
	for (int i = 0; i < N; ++ i) cin >> A[i] >> B[i];

	long long c = 0, r = 0;
	for (int i = N-1; i >= 0; -- i) {
		auto x = (A[i] + c + B[i]-1) / B[i] * B[i];
		auto y = x - (A[i] + c);
		c += y;
		r += y;
	}
	cout << r << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 998244353LL

bool dbgflag = false;


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15);
  
  ll n, k;
  cin >> n >> k;
  vector<ll> p(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  sort(p.begin(), p.end());
  ll ans = 0;
  for (int i = 0; i < k; i++) ans += p[i];
  cout << ans << endl;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);  cin.tie(0) ; cout.tie(0);
#define debug(x) cout << #x << " : " << x << endl;
#define pi 3.14159265359
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
using ll = long long int;
using db = double;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
const int MOD = 1e9+9;

void solve()
{
    int ac = 0 , tle = 0 ,re = 0, wa = 0;
    int n;
    cin >> n ;
    while(n--)
    {
        string s;
        cin >> s;
        if(s == "AC") ac++;
        if(s == "WA") wa++;
        if(s == "TLE") tle++;
        if(s == "RE") re++;
    }
    printf("AC x %d\n",ac);
    printf("WA x %d\n",wa);
    printf("TLE x %d\n",tle);
    printf("RE x %d\n",re);
}

int main()
{
    fastio;

    ll t = 1;
    // cin >> t;
    while(t--)
       solve();
    return 0;
}

Measured memory_bytes: 3696
#include<stdio.h>
int main(void)
{
        int a,b;
        scanf("%d %d",&a,&b);
        if(a < b){
                printf("a < b\n");
        }else if(a > b){
                printf("a > b\n");
        }else{
                printf("a == b\n");
        }
        return 0;
}

Measured memory_bytes: 580
#include<stdio.h>

int main(){
  int N = 0 ;
  int i = 0 ;
  int p = 0 ;
  int max = 0 ;
  int sum = 0 ;
  scanf("%d", &N) ;
  for(i = 0; i < N; i++){
    scanf("%d", &p) ;
    if(max < p) max = p ;
    sum += p ;
  }
  printf("%d\n", sum - max / 2) ;
  return 0 ;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC097.B
{
    class Program
    {
        static void Main ()
        {
            int x = int.Parse (Console.ReadLine ());
            int max = 1;
            for (int p = x - 1; p >= 2; p--)
            {
                int b = (int) (Math.Pow (x, 1d / p) + 1e-10);
                Console.Error.WriteLine ($"p = {p}, b = {b}");
                if (b <= 1) continue;
                max = Math.Max ((int) Math.Pow (b, p), max);
                Console.Error.WriteLine ($"b = {b}, p = {p}, max = {max}");
            }
            Console.WriteLine (max);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner ()
        {
            s = new string[0];
            i = 0;
        }

        public string Next ()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine ();
            while (st == "") st = Console.ReadLine ();
            s = st.Split (cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next ();
            i = 0;
            return s[i++];
        }

        public int NextInt ()
        {
            return int.Parse (Next ());
        }
        public int[] ArrayInt (int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextInt () + add;
            }
            return Array;
        }

        public long NextLong ()
        {
            return long.Parse (Next ());
        }

        public long[] ArrayLong (int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextLong () + add;
            }
            return Array;
        }

        public double NextDouble ()
        {
            return double.Parse (Next ());
        }

        public double[] ArrayDouble (int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDouble () + add;
            }
            return Array;
        }

        public decimal NextDecimal ()
        {
            return decimal.Parse (Next ());
        }

        public decimal[] ArrayDecimal (int N, decimal add = 0)
        {
            decimal[] Array = new decimal[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDecimal ();
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13268
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var strs = Console.ReadLine().Split();
            var A = int.Parse(strs[0]);
            var B = int.Parse(strs[1]);

            var sum = 0;
            if (A > B)
            {
                sum += A;
                A--;
            }
            else
            {
                sum += B;
                B--;
            }

            sum += Math.Max(A, B);

            Console.WriteLine(sum);
        }
    }
}


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

int main() {
    int N, Y;
    cin >> N >> Y;

    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= N - i; j++) {
            int k = N - i - j;
            if (10000*i + 5000*j + 1000*k == Y) {
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }

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


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

int main() {
	double sum,sumv;
	while(cin>>sum){
	sumv=sum;
	for (int i = 0; i < 5; ++i) {
		sum=sum+sumv*2;
		sumv=sumv*2;
		if(i!=4){sum=sumv/3.0+sum;
		sumv=sumv/3;}
	}
	printf("%.10f\n",sum);
	}
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int mod = 1000000007;

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];

    vvi dp(h, vi(w, 0));

    int ans=0;

    rep(i, h)rep(j, w){
        if(i==0&&j==0){
            if(s[0][0]=='#') ans++;
            continue;
        }
        int up = INF;
        int left = INF;
        if(i!=0){
            up = dp[i-1][j];
            if(s[i-1][j]=='.' && s[i][j]=='#') up+=1000;
            else up++;
        }
        if(j!=0){
            left = dp[i][j-1];
            if(s[i][j-1]=='.' && s[i][j]=='#') left+=1000;
            else left++;
        }
        dp[i][j] = min(up, left);
    }

    ans += dp[h-1][w-1]/1000;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#[allow(dead_code)]
fn main() {
    let (a, b) = (i::s(), i::s());
    if a.len() != b.len() {
        println!("{}", if a.len() > b.len() { "GREATER" } else { "LESS" });
        return;
    }
    for i in 0..a.len() {
        if a[i] == b[i] {
            continue;
        }
        println!("{}", if a[i] > b[i] { "GREATER" } else { "LESS" });
        return;
    }
    println!("{}", "EQUAL");
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }
    pub fn str() -> String {
        read()
    }
    pub fn s() -> Vec<char> {
        str().chars().collect()
    }
    pub fn i() -> i64 {
        read()
    }
    pub fn u() -> usize {
        read()
    }
    pub fn u2() -> (usize, usize) {
        (read(), read())
    }
    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }
    pub fn u4() -> (usize, usize, usize, usize) {
        (read(), read(), read(), read())
    }
    pub fn u5() -> (usize, usize, usize, usize, usize) {
        (read(), read(), read(), read(), read())
    }
    pub fn u6() -> (usize, usize, usize, usize, usize, usize) {
        (read(), read(), read(), read(), read(), read())
    }
    pub fn f() -> f64 {
        read()
    }
    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }
    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }
    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }
    pub fn iv3(n: usize) -> Vec<(i64, i64, i64)> {
        (0..n).map(|_| iv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }
    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }
    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }
    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }
    pub fn uv4(n: usize) -> Vec<(usize, usize, usize, usize)> {
        (0..n)
            .map(|_| uv(4))
            .map(|a| (a[0], a[1], a[2], a[3]))
            .collect()
    }
    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }
    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=1; i<=(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N;
    scanf("%d",&N);
    ll ans=1;
    const ll mod=1e9+7;
    rrep(i,N) {
        ans=(ans*i)%mod;
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
int main(void){
    int n;
    ll b=0,m=0;
    string s;
    cin>>s;
    n=s.length();
    for(int i=0;i<n;i++){
        if(s[i]=='B'){
            b++;
        }else{
            m+=b;
        }
    }
    cout<<m<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <map>
using ll=long long;
using namespace std;

int main(){
    ll N,P;
    cin>>N>>P;
    string S;
    cin>>S;

    if(P==2 || P==5){
        ll ans=0;
        ll num;
        for(int i=0;i<N;i++){
            num=((int)S[i]-'0');
            if(num%P==0){
                ans+=i+1;
            }
        }
        cout<<ans<<endl;

        return 0;
    }
    map<ll,ll> r;
    ll keta=1;
    ll tmp=0;
    for(ll i=N-1;i>=0;i--){
        tmp+=keta*((int)S[i]-'0');
        tmp%=P;
        r[tmp]++;
        keta*=10;
        keta%=P;
    }
    ll ans=0;
    for(auto p:r){
        if(p.first==0){
            ans+=(p.second+1)*p.second/2;
        }else{
            ans+=p.second*(p.second-1)/2;
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 4140
#include <iostream>
using namespace std;
int main(){
	long long int n,m;
	cin>>n>>m;
	if(m>=n&&(n>=0||m<=0))
	{
		cout<<m-n;
		
	}else if(m>=n){
	cout<<abs(m+n)+1;
		
		}else if(n*m>0){
		
		cout<<n-m+2;
		
		}else
		{
			cout<<abs(n+m)+1;
		}
	
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    set<int> st;
    st.insert(a);
    st.insert(b);
    st.insert(c);
    if (st.size() == 2)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

using namespace std;

int main()
{
  int a, b, x;
  cin >> a >> b >> x;
  int ans = 1000000000;
  for (int i = 0;; i++)
  {
    ans = min(ans, b * i + (x - 500 * i + 999) / 1000 * a);
    if (i * 500 > x)
      break;
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3100
w = int(raw_input())
n = int(raw_input())

arr = range(1, w+1)
for i in range(n):
  a, b = map(int, raw_input().split(','))
  arr[a-1], arr[b-1] = arr[b-1], arr[a-1]

for a in arr:
  print '%d'%a

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

using namespace std;

typedef long long ll;

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#else
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    int k, s;
    cin >> k >> s;
    int ans = 0;
    for (int a = 0; a <= k; a++)
    {
        for (int b = 0; b <= k; b++)
        {
            int c = s - a - b;
            if (c >= 0 && c <= k)
            {
                ans++;
            }
        }
    }
    cout << ans << '\n';
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2e18
typedef long long ll;
using namespace std;
ll dp[55][55][2502];
ll ar[55];
int main()
{
     ll n,a,j;
     ll i;
     cin>>n>>a;
     for(i=1;i<=n;i++)
     cin>>ar[i];
     for(i=0;i<=n;i++)
     dp[i][0][0]=1;	
     for(i=1;i<=n;i++)
     {
     	for(j=0;j<=i;j++)
     	{
     		for(ll k=1;k<=2500;k++)
     		{
     			if(k-ar[i]>=0 && j>0)
     			dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-ar[i]];
     			else
     			dp[i][j][k]=dp[i-1][j][k];
			 }
		 }
	 }
	 ll count=0;
	 	for(j=0;j<=n;j++)
	 		count=count+dp[n][j][j*a];
	 cout<<count-1<<endl;
	 return 0;		
}

Measured memory_bytes: 26368
#include<iostream>
#include<cmath>
#include<climits>
using namespace std;
static const int MAX_H = 25;
static const int MAX_W = 25;

int H, W;
int a[MAX_H][MAX_W];

int main(){
	cin >> H >> W;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++) cin >> a[i][j];
	}
	int ans = INT_MAX;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			int sum = 0;
			for(int k = 0; k < H; k++){
				for(int l = 0; l < W; l++){
					sum += a[k][l] * min(abs(i - k), abs(j - l));
				}
			}
			ans = min(ans, sum);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <fstream>

using namespace std;

ifstream fin("../data.txt");

int n, k, ans;


int main() {

  cin >> n >> k;
  ans = k;
  for (int i = 1; i < n; i++) {
    ans *= (k-1);
  }

  cout << ans;

  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<string> v;
  map<string,int> memo;
  rep(i,N){
    string s;
    cin >> s;
    memo[s]++;
    v.push_back(s);
  }

  bool flg = true;
  FOR(it,memo) if(it->second >= 2) flg = false;
  
  REP(i,1,N){
    if(v[i-1][v[i-1].size()-1] != v[i][0]) flg = false;
  }

  if(flg) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<unistd.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ST first
#define ND second
#define ll long long
#define ld long double
using namespace std;
using namespace __gnu_pbds;
 
// replace ll with pair if multiset needed
typedef tree<int, null_type, greater<int >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set secik;
 
const ll INF = 1e9 + 9;
const ll MOD = 1e9 + 7;
const long long LINF = (ll)1e18 + 3;
 
// secik.insert({x, t++});
// secik.erase(secik.lower_bound({x,-1}));
// *secik.find_by_order(x)).first << "\n";
// secik.order_of_key(x)
 
//random_device device;
//mt19937 gener(device());
//uniform_int_distribution<int> gen(0,n-1);


int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	int n,k; cin >> n >> k;
	vector<int> skoki(n);
	for(int i = 0; i < n; i++) cin >> skoki[i];

	vector<bool> dp(k+1);
	dp[0] = 0;
	for(int i = 1; i <= k; i++){
		for(auto it : skoki){
			if(i - it < 0) continue;
			if(dp[i - it] == 0) dp[i] = 1;
		}
	}

	if(dp[k]) cout << "First\n";
	else cout << "Second\n";


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main() {
	int a, b, c; cin >> a >> b >> c;
	cout << ((a * b) / 2) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ull binpowmod(ull x,ull y,ull p)/* (x^y)%p in O(log y) */{ull res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
ull gcd(ull x,ull y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
bool comp(pair<int,int> x,pair<int,int> y)
{
    if(x.first<y.first)
        return true;
    else if(x.first==y.first)
        return x.second>y.second;
    else
        return false;
}
bool comp_pairs_by_s(pair<ll,ll> &x ,pair<ll,ll> &y)
{
    return x.second<y.second;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}

class cmp      //comparator for priority_queue 
{               //declaration: priority_queue<int,vector<int>,cmp>
public:         
    bool operator()(pair<int,int> A,pair<int,int> B)
    {
        if(abs(A.first-A.second)==abs(B.first-B.second))
            return A.first>B.first;
        return abs(A.first-A.second)<abs(B.first-B.second);
    }
};
// int prime[100005]={0};
// void sieve(void)
// {
//  int i,j;
//  for(i=0;i<100005;i++)
//         prime[i]=1;
//  prime[0]=0,prime[1]=0;
//  for(i=2;i<=sqrt(100005);i++){
//      if(prime[i]){
//          for(j=i*i;j<100005;j+=i){
//              prime[j]=0;
//          }
//      }
//  }
    
// }
void swap(int &x,int &y){
    int temp=x;
    x=y;
    y=temp;
}

void solve()
{   
    double r;
    cin>>r;
    cout<<fixed;
    cout<<setprecision(5);
    cout<<(double)((double)22/7)*r*2;

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


Measured memory_bytes: 3740
#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 K, X;
  cin >> K >> X;
  if (K*500>=X){
  	cout << "Yes" << endl;
  }
  else{
  	cout << "No" << endl;
  }
  return 0;
}


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

int main()
{
    int n, m, l;
    cin>>n>>m>>l;
    long long a[n][m], b[m][l], c[n][l];

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < l; j++)
            c[i][j]=0;
    }
    

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
            cin>>a[i][j];
    }
    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < l; j++)
            cin>>b[i][j];
    }

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < l; j++)
        {
            for (int k = 0; k < m; k++)
                c[i][j] += a[i][k] * b[k][j];
        }
    }


    for (int i = 0; i < n; i++)
    {
        cout<<c[i][0]<<std::flush;
        for (int j = 1; j < l; j++)
            cout<<' '<<c[i][j];
        cout<<endl;
    }
    

    return 0;
}


Measured memory_bytes: 3324
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	string s;
	cin >> s;

	vector<int> rs(n), bs(n), gs(n);
	for (int i = 1; i < n; ++i) {
		rs[i] = rs[i - 1];
		bs[i] = bs[i - 1];
		gs[i] = gs[i - 1];

		if (s[i] == 'R') {
			++rs[i];
		}
		else if (s[i] == 'B') {
			++bs[i];
		} else {
			++gs[i];
		}
	}

	long long triplets = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (s[j] != s[i]) {
				char c;
				if ((s[i] == 'R' && s[j] == 'B') || (s[i] == 'B' && s[j] == 'R')) {
					c = 'G';
				}
				else if ((s[i] == 'G' && s[j] == 'B') || (s[i] == 'B' && s[j] == 'G')) {
					c = 'R';
				} else {
					c = 'B';
				}

				if (c == 'B') {
					triplets += bs[n - 1] - bs[j];
				}
				else if (c == 'R') {
					triplets += rs[n - 1] - rs[j];
				} else {
					triplets += gs[n - 1] - gs[j];
				}

				if (j + (j - i) < n && s[j + (j - i)] == c) {
					--triplets;
				}
			}
		}
	}

	cout << triplets << "\n";

	return 0;

}

Measured memory_bytes: 3672
#include<stdio.h>
#include<math.h>
int ifcl(int p0[2],int p1[2],int p2[2],int p3[2]){
  long long x=p0[0],x0=p1[0]-x,x1=p2[0]-x,x2=p3[0]-x,x3=x2-x1,x4=x0-x1,x5=-x1;
  long long y=p0[1],y0=p1[1]-y,y1=p2[1]-y,y2=p3[1]-y,y3=y2-y1,y4=y0-y1,y5=-y1;
  long long x7=x2-x0,y7=y2-y0;  
  long long c1=(x0*y1-y0*x1)*(x0*y2-y0*x2),c2=(x3*y4-y3*x4)*(x3*y5-y3*x5);
  long long d1=x1*x4+y1*y4,d2=x2*x7+y2*y7,d3=x1*x2+y1*y2,d4=x4*x7+y4*y7;
  if(c1==0&&c2==0)return (d1<0&&d2>0&&d3>0&&d4<0)?0:1;
  return (c1<=0&&c2<=0)?1:0;
}
double dMIN(double a,double b){return a<b?a:b;}
double dspl(int p0[2],int p1[2],int p2[2]){
  int a=p0[1]-p1[1],b=p0[0]-p1[0],c=p0[0]*p1[1]-p1[0]*p0[1];
  int d=p2[1]-p1[1],e=p2[0]-p1[0],f=p2[1]-p0[1],g=p2[0]-p0[0];
  if(a*d+b*e<0||a*f+b*g>0)return dMIN(hypot(d,e),hypot(f,g));
  return abs(p2[0]*a-p2[1]*b+c)/hypot(a,b);
}
double dsll(int *p0,int *p1,int *p2,int *p3){
  double l=dMIN(dMIN(dspl(p2,p3,p0),dspl(p2,p3,p1)),
		dMIN(dspl(p0,p1,p2),dspl(p0,p1,p3)));
  if(ifcl(p0,p1,p2,p3))l=0;
  return l;
}
int main(){
  int p[4][2],n,i;
  scanf("%d",&n);
  while(n--){
    for(i=0;i<8;i++)scanf(" %d",&p[i/2][i%2]);
    printf("%.9f\n",dsll(p[0],p[1],p[2],p[3]));
  }
  return 0;
}

Measured memory_bytes: 652
s=input()
if s=="SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)

Measured memory_bytes: 3060
import numpy as np

N, M = map(int, input().split())
lamplist = [0]*M
for i in range(M):
    A = list(map(int, input().split()))
    lamplist[i] = A
oddeven_ans = list(map(int, input().split()))

switch = np.zeros(N)
ans = 0
numofswitch = np.zeros(M)

for s in range(M):
    numofswitch[s] = lamplist[s][0]
    del lamplist[s][0]

for j in range(2 ** N):
    ansflag = 0

    for k in range(N):
        switch[k] = j % 2
        j //= 2
    for p in range(M):
        numofshining = 0
        for r in lamplist[p]:
            if switch[r-1] == 1:
                numofshining += 1

        if numofshining % 2 != oddeven_ans[p]:
            ansflag = 1
    if ansflag == 0:
        ans += 1

print("{}".format(ans))


Measured memory_bytes: 14448
#include<iostream>
#include<cmath>
using namespace std;
int main() {
    long long n;
    long long p;
    cin >> n >> p;
    long long cnt = 1;
    if (n == 1) {
        cout << p << endl;
        return 0;
    }
    long long beki = 1;
    for (long long i = 2; p >= pow(i, n); ++i) {
        beki = 1;
        for (int j = 0; j < n; ++j) {
            beki *= i;
        }
        while (1) {
            if (p % beki == 0) {
                p /= beki;
                cnt *= i;
            } else {
                break;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}




Measured memory_bytes: 256
#include<stdio.h>
#define MAX 500000
int H;
void maxHeapify(int *A,int i){
    int l,r,largest;
    int v;
    l=2*i;
    r=2*i+1;
    if(l<=H && A[l]>A[i])largest = l;
    else largest = i;
    if(r<=H && A[r]>A[largest])largest = r;
    if(largest!=i){
        v=A[i];
        A[i]=A[largest];
        A[largest]=v;
        maxHeapify(A,largest);
    }
}
void MaxHeap(int *A){
    int i;
    for(i=H/2;i>=1;i--){
        maxHeapify(A,i);
    }
}
int main(){
    int Heap[MAX+1];
    int i;
    scanf("%d",&H);
    for(i=1;i<=H;i++){
        scanf("%d",&Heap[i]);
    }
    MaxHeap(Heap);
    for(i=1;i<=H;i++){
        printf(" %d",Heap[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 3804
a= [int(input()) for i in range(4)] 

#print(a)
#print(a[0],a[1],a[2],a[3])
if a[1] > a[0]:
  a[1] = a[0]
  
sum = a[1]*a[2] + a[3]*(a[0]-a[1]) 
print(sum)

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

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

	vector<pair<int, int>>p(n);
	for(auto&e:p)cin>>e.first>>e.second;

	int ans=1001;
	for(auto e:p) {
		if(e.second<=t)ans=min(ans, e.first);
	}
	if(ans==1001)cout<<"TLE";
	else cout<<ans;
	cout<<endl;

	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	N, s := ReadInt(), ReadString()

	for _, v := range []string{"SS", "SW", "WS", "WW"} {
		if t := check(N, s, v); t != "" {
			fmt.Println(t)
			return
		}
	}
	fmt.Println(-1)
}

func check(N int, s string, v string) string {
	t := make([]byte, N)
	copy(t, v)
	for i := 2; i < N; i++ {
		if (t[i-1] == 'S' && s[i-1] == 'o') || (t[i-1] == 'W' && s[i-1] == 'x') {
			t[i] = t[i-2]
		} else {
			t[i] = not(t[i-2])
		}
	}

	for i := 0; i < N; i++ {
		if (t[i] == 'S' && s[i] == 'o') || (t[i] == 'W' && s[i] == 'x') {
			if t[(N+i-1)%N] != t[(i+1)%N] {
				return ""
			}
		}
		if (t[i] == 'S' && s[i] == 'x') || (t[i] == 'W' && s[i] == 'o') {
			if t[(N+i-1)%N] == t[(i+1)%N] {
				return ""
			}
		}
	}
	return string(t)
}

func not(a byte) byte {
	if a == 'W' {
		return 'S'
	} else {
		return 'W'
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }


Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std;
const int maxn=200005;
int a[maxn],tot=0;
int dp[maxn],head[maxn];
int ans[maxn];
struct node{
	int next,to;
}edge[maxn*2];
void add_edge(int u,int v){
	tot++;
	edge[tot].next=head[u];
	edge[tot].to=v;
	head[u]=tot;
}
//lower bound
int binary_search(int low,int high,int key){
	int mid,ans=1;
	while(low<=high){
		mid=(high+low)>>1;
		if(dp[mid]>=key) ans=mid,high=mid-1;
		else low=mid+1;
	}
	return ans;
}
void dfs(int u,int fa,int pos){
	int pre,tmp;
	if(dp[pos]<a[u]) pos++,tmp=pos;
	else tmp=binary_search(1,pos,a[u]);
	pre=dp[tmp];
	dp[tmp]=a[u];
	ans[u]=pos;
	for(int i=head[u];i;i=edge[i].next){
		int v=edge[i].to;
		if(v==fa) continue;
		dfs(v,u,pos);
	}
	dp[tmp]=pre;
}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n-1;i++){
		int tmp,tmp2;
		scanf("%d%d",&tmp,&tmp2);
		add_edge(tmp,tmp2);
		add_edge(tmp2,tmp);
	}
	//memset(dp,0x3f,sizeof(dp));
	dp[1]=a[1];
	dfs(1,0,1);
	for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
}

Measured memory_bytes: 23416
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
  int a,b,h;
  cin>>a>>b>>h;
  cout<<(a+b)*h/2<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
using namespace std;
using ll = long long;
const int INF = -100100100;
typedef pair<int,int> P;

int main(){
    vector<int> c(6);
    ll x;
    cin >> x;
    int i = 0;
    for(auto y : {500,5,100,50,10,1}){
        c[i] = (int)x/y;
        x -= (int)x/y * y;
        ++i;
    }
    cout << c[0] * 1000 + c[1] * 5 << endl;
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    bool flg = true;
    for(int i = 0; i < s.size(); i++){
        if((i+1) % 2 == 0){
            if((s.at(i) != 'L')
            && (s.at(i) != 'U')
            && (s.at(i) != 'D')
            ){
                flg = false;
            }
        }
        else{
            if((s.at(i) != 'R')
            && (s.at(i) != 'U')
            && (s.at(i) != 'D')
            ){
                flg = false;
            }
        }
    }
    if(flg == true){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<set>
#include<string>
#include <sstream>

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

using namespace std;


int main(){
  long ii,jj,kk;
  vector<int> ret;
  int n;
  vector<int> a;
  int q;

  cin >> n;

  a.resize(n);

  for(ii=0;ii<n;ii++){
    cin >> a[ii];
  }

  cin >> q;

  int c,b,e;
  long long int val;
  for(ii=0;ii<q;ii++){
    cin >> c >> b >> e;

    if(c == 0){
      val = 10e10;
      for(jj=b;jj<e;jj++){
        if(val > a[jj]){
          val = a[jj];
        }
      }
    }
    else{
      val = -10e10;
      for(jj=b;jj<e;jj++){
        if(val < a[jj]){
          val = a[jj];
        }
      }
    }
    cout << val << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3124
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int MM = 100002;
int N, mod=1e9+7; vector<int> adj[MM]; ll dp[MM][2];
void dfs(int u, int pa){
    dp[u][0] = 1; dp[u][1] = 1;
    for(int v: adj[u]){
        if(v == pa) continue;
        dfs(v, u); dp[u][0] = (dp[u][0] * dp[v][1])%mod; dp[u][1] = (dp[u][1] * (dp[v][0] + dp[v][1]))%mod;
    }
}
int main(){
    scanf("%d", &N);
    for(int i=1, u, v; i<N; i++){
        scanf("%d %d", &u, &v); adj[u].push_back(v); adj[v].push_back(u);
    }
    dfs(1, 0);  printf("%lld\n", (dp[1][0] + dp[1][1])%mod);
}

Measured memory_bytes: 12800
N = int(input())
list6 = [6**x for x in range(0,7) ]
list9 = [9**x for x in range(0,6) ]
result = {}

def f(x):
    if x < 6:
        return x
    elif x in result:
        return result[x] 
    else:
        max6 = max(y for y in list6 if y <= x)
        max9 = max(y for y in list9 if y <= x)
        x6 = x - max6
        x9 = x - max9
        result[x] = min(f(x6)+ 1,f(x9)+ 1)
        return result[x]

print(f(N))

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <cstring>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

constexpr int MOD = 1'000'000'007;

LL dp[10001][100][2] = {};

void solve() {
    string s;
    int d;
    cin >> s >> d;
    int n = s.size();
    dp[0][0][0] = 1;
    REP(i,0,n) {
        REP(j,0,d) {
            REP(k,0,2) {
                int c = s[i] - '0';
                REP(l,0,10) {
                    if (!k && l >= c) break;
                    dp[i+1][(j+l)%d][1] += dp[i][j][k];
                    if (dp[i+1][(j+l)%d][1] >= MOD) dp[i+1][(j+l)%d][1] -= MOD;
                }
                if (!k) dp[i+1][(j+c)%d][0] = dp[i][j][0];
            }
        }
    }
    cout << (dp[n][0][0] + dp[n][0][1] - 1 + MOD) % MOD << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 15872
def eat(a,d):
  days=2
  choco=1
  cnt=1
  flg=True
  while flg:
    days=cnt*a+1
    if days<=d:
      choco+=1
      cnt+=1
    else:
      flg=False
  return choco

n=int(input())
d,x=map(int,input().split())
sum=0
for i in range(n):
  a=int(input())
  sum+=eat(a,d)
print(sum+x)  
    
     

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
const int MAX = 25;
const int NIL = -1;

struct Node
{
	int parent,left,right;
};

Node T[MAX];
int D[MAX];
int H[MAX];

void setDepth(int u, int d)
{
	if (u == NIL)
	{
		return;
	}

	D[u] = d;
	setDepth(T[u].left, d+1);
	setDepth(T[u].right, d+1);
}

int setHeight(int u)
{
	int h1 = 0, h2 = 0;
	if (T[u].left != NIL)
	{
		h1 = setHeight(T[u].left) + 1;
	}

	if (T[u].right != NIL)
	{
		h2 = setHeight(T[u].right) + 1;
	}

	 return H[u] = max(h1,h2);
}

int getsibling(int u)
{
	if (T[u].parent == NIL)
	{
		return NIL;
	}
	else
	{
		if ((T[T[u].parent].left != u)&&(T[T[u].parent].left != NIL))
		{
			return T[T[u].parent].left;
		}

		if ((T[T[u].parent].right != NIL)&&(T[T[u].parent].right != u))
		{
			return T[T[u].parent].right;
		}

		return NIL;
	}
}

void print(int u)
{
	cout << "node " << u << ": ";
	cout << "parent = " << T[u].parent << ", ";
	cout << "sibling = " << getsibling(u) << ", ";
	int d = 0;
	if (T[u].left != NIL) d++;
	if (T[u].right != NIL) d++;
	cout << "degree = " << d << ", ";
	cout << "depth = " << D[u] << ", ";
	cout << "height = " << H[u] << ", ";
	if ((T[u].parent == NIL))
	{
		cout << "root" << endl;
	}
	else if ((T[u].left == NIL)&&(T[u].right == NIL))
	{
		cout << "leaf" << endl;
	}
	else
	{
		cout << "internal node" << endl;
	}
}

int main()
{
	int n,v,l,r;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		T[i].parent = NIL;
	}

	for (int i = 0; i < n; ++i)
	{
		cin >> v >> l >> r;
		T[v].left = l;
		T[v].right = r;
		if (l != NIL)
		{
			T[l].parent = v;
		}

		if (r != NIL)
		{
			T[r].parent = v;
		}
	}

	int root;
	for (int i = 0; i < n; ++i)
	{
		if (T[i].parent == NIL) root = i;
	}

	setDepth(root, 0);
	setHeight(root);

	for (int i = 0; i < n; ++i)
	{
		print(i);
	}
	return 0;
}


Measured memory_bytes: 3096
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  ll X;in(X);
  out(X/500*1000+X%500/5*5);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll a, b;
	cin >> a >> b;
	cout << a*b << endl;

}



Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e,f,g,h,i,j;
    cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
    cout<<a+b+c+d+e+f+g+h+i+j<<endl;
}


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

int main() {
    int n;
    cin >> n;
    vector<long long> a(n);
    for(int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    
    vector<long long> sum(n + 1);
    for(int i = 0; i < n; i++)
    {
        sum.at(i + 1) = sum.at(i) + a.at(i);
    }
    
    map<long long, int> m;
    long long ans = 0;
    for(int i = 0; i <= n; i++)
    {
        m[sum.at(i)]++;
        ans += m[sum.at(i)] - 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 15872
def solve(s):
  if len(s) == 2: return (1, 2) if s[0] == s[1] else (-1, -1)
  for i in range(len(s) - 2):
    for j in range(3):
      a = i+j
      b = i+(j + 1)%3
      if s[a] == s[b]: return (min(a,b) + 1, max(a,b) + 1)
  return (-1, -1)
  
print(*solve(input()))

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    string str;

    cin >> str;
    
    for(int i = str.size() - 2; i > 0; --i)
    {
        if(i % 2 == 0) continue;

        bool isSame = true;
        for(int j = 0, half = (i + 1) / 2; j < half; ++j)
        {
            if(str[j] != str[half + j])
            {
                isSame = false;
                break;
            }
        }

        if(isSame)
        {
            cout << i + 1 << endl;
            break;
        }
    }


    return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $x);

$happy = 0;

if (intdiv($x, 500) !== -1) {
  $happy += intdiv($x, 500) * 1000;
}

if (intdiv($x, 500) !== -1) {
  $happy += intdiv($x%500, 5) * 5;
}

echo $happy;


Measured memory_bytes: 4728
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;




signed main() {
    int n;
    cin >> n;
    vll a(n);
    ll xall = 0;
    rep(i, n) {
        cin >> a[i];
        xall ^= a[i]; //全入力のXORをとる
    }
    rep(i, n) {
        printf("%lld ", xall^a[i]);
    }
}

Measured memory_bytes: 4816
n=int(input())
a=list(map(int,input().split()))

rate = [1,400,800,1200,1600,2000,2400,2800]


color=[0]*8
free=0

for i in range(n):
    r=a[i]
    if 1<=r and r<=399:
        color[0]=1
    elif 400<=r and r<=799:
        color[1]=1
    elif 800<=r and r<=1199:
        color[2]=1
    elif 1200<=r and r<=1599:
        color[3]=1
    elif 1600<=r and r<=1999:
        color[4]=1
    elif 2000<=r and r<=2399:
        color[5]=1
    elif 2400<=r and r<=2799:
        color[6]=1
    elif 2800<=r and r<=3199:
        color[7]=1
    else:
        free+=1

num = sum(color)

ans_1 = num
#全員レート3200
if ans_1==0:
    ans_1=1

ans_2 = num+free


print(ans_1,ans_2)

Measured memory_bytes: 9040
import sys

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

if A+B-1 > N or A*B < N:
    print (-1)
    sys.exit()

ans = []

for i in range(N-A+1,N+1,1):
    ans.append(i)

now = []
for i in range(1,N-A+1,1):

    now.append(i)

    if len(now) == B-1:
        now.reverse()

        for j in now:
            ans.append(j)
        now = []

now.reverse()
for j in now:
    ans.append(j)

print (" ".join(map(str,ans)))


Measured memory_bytes: 104300