akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;

int r;

int read(){
	int t=1,s=0;
	char c=getchar();
	while((c>'9'||c<'0')&&c!='-')c=getchar();
	if(c=='-')t=-1,c=getchar();
	while(c>='0'&&c<='9')
	s=s*10+c-'0',c=getchar();
	return s*t;
}

int main(void){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d",&r);
	printf("%d",3*r*r);
}


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

vector<vector<int>> tr;
vector<int> d;
vector<int> col;

void dfs(int par, int v)
{
  col[v] = col[par]^1;
  for (auto t:tr[v]) if(t!=par) dfs(v, t);
}

int main()
{
  ll n; cin >> n;
  d.resize(n);
  col.resize(n);
  tr.resize(n);
  vector<queue<int>> q(3);
  rep(i, n) {
    int x = i+1;
    q[x%3].push(x);
  }
  for (int i=0; i<n-1; i++){
    int a, b; cin >> a >> b; a--; b--;
    tr[a].push_back(b);
    tr[b].push_back(a);
  }
  dfs(0, 0);
  int r=0, b=0;
  rep(i, n) {
    if (col[i]) r++;
    else b++;
  }

  if (r <= n/3) {
    rep(i, n) {
      if (col[i]) {
        d[i] = q[0].front(); q[0].pop();
      } else {
        if (!q[1].empty()) {
          d[i] = q[1].front(); q[1].pop();
        } else if (!q[2].empty()) {
          d[i] = q[2].front(); q[2].pop();
        } else {
          d[i] = q[0].front(); q[0].pop();
        }
      }
    }
  } else if (b <= n/3) {
    rep(i, n) {
      if (!col[i]) {
        d[i] = q[0].front(); q[0].pop();
      } else {
        if (!q[1].empty()) {
          d[i] = q[1].front(); q[1].pop();
        } else if (!q[2].empty()) {
          d[i] = q[2].front(); q[2].pop();
        } else {
          d[i] = q[0].front(); q[0].pop();
        }
      }
    }
  } else {
    rep(i, n) {
      if (col[i]) {
        if (!q[1].empty()) {
          d[i] = q[1].front(); q[1].pop();
        } else {
          d[i] = q[0].front(); q[0].pop();
        }
      } else {
        if (!q[2].empty()) {
          d[i] = q[2].front(); q[2].pop();
        } else {
          d[i] = q[0].front(); q[0].pop();
        }
      }
    }
  }
  for (int i=0; i<n; i++) {
    if (i==0) cout << d[i];
    else cout << " " << d[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 18560
#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())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  
  ll n;
  cin >>n;
  if(n%2 == 1){
    cout << 0 << endl;
    return 0;
  }
  ll ans = 0;
  for(int i=1;pow(5,i)<=n;i++){
    long long l = n/(pow((long double)5,i)*2);
    long long r = n/(long long)(pow((long double)5,i)*2);
    assert(l==r);
    ans += n/(long long)(pow((long double)5,i)*2);
  }
  cout << ans << endl;
}


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


int main(){
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    int ans = 0;
    for (int i = 0; i <= N/R; i++) {
        for (int j = 0; j <= N/G; j++) {
            if ((N-i*R-j*G) >= 0 && (N-i*R-j*G)%B == 0) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

signed main(){
  int N;
  cin>>N;
  string ans="NO";
  if(N==7||N==5||N==3)ans="YES";
  cout<<ans<<endl;
}

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

int n;
ll cnt[60] = {};

ll calc(ll x) {
    ll sum = 0;
    rep(i,60){
        if (x & bit(i)) {
            sum += bit(i) * max(cnt[i], n-cnt[i]);
        } else {
            sum += bit(i) * cnt[i];
        }
    }
    return sum;
}

int main(void){
    ll K;
    cin >> n >> K;
    vector<ll> a(n);
    rep(i,n) {
        cin >> a[i];
        rep(j,60) if(bit(j) & a[i]) {
            cnt[j]++;
        }
    }

    ll res = max(calc(0),calc(K));
    rep(i,60) {
        if (bit(i) & K) {
            res = max(res, calc((K^bit(i))|(bit(i)-1)));
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	ll n,k,l;
	cin >> n >> k;
	vector<ll> a(n);
	for(ll i = 0; i < n; i++) {
		cin >> l;
		a[i] = l;
	}
	cout << ceil((double(n - 1))/(double(k - 1))) << endl;
	
	return 0;
}

Measured memory_bytes: 1024
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n, m, c = map(int, input().split())
    b = list(map(int, input().split()))
    a = [list(map(int, input().split())) for _ in range(n)]
    ans = 0
    for i in range(n):
        sum_ = 0
        for j in range(m):
            sum_ += a[i][j] * b[j]
        sum_ += c
        if sum_ > 0:
            ans += 1
    print(ans)
            
if __name__ == '__main__':
    main()

Measured memory_bytes: 9140
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
int n,l;
string str[105];
string res;
bool cmp(string a,string b)
{
	return a<b;
}
int main()
{
  scanf("%d%d",&n,&l);
  for(int i=0;i<n;i++)
   cin>>str[i];
   sort(str,str+n,cmp);
   for(int i=0;i<n;i++)
   {
   	 res+=str[i];
   }
   cout<<res<<endl;
}

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

int main() {
  int r,d,x;
  cin>>r>>d>>x;
  
  rep(i,10){
    x= r*x-d;
    cout <<x<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
cin>>N;
char S[N];
for(int i=0;i<N;i++){
cin>>S[i];
}
cin>>K;
char a;
a = S[K-1];
for(int i = 0;i<N;i++){
  if(S[i]!=a){
    S[i]='*';
  }
}
for(int i=0;i<N;i++){
  cout<<S[i];
}
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // input
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        long c = sc.nextInt();
        long v = c - a - b;
        System.out.println(v > 0 && v * v > 4 * a * b ? "Yes" : "No");
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	int N;
	cin>>N;
	vector<int> A(N);
	ll cnt = 0;
	rep(i,N){
		cin>>A[i];
		cnt += A[i] % 2;
	}
	if(cnt%2 == 0){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
using namespace std;
int N;
int K,P;
int main()
{
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%d%d",&K,&P);
		if(K%P==0)printf("%d\n",P);
		else printf("%d\n",K%P);
	}
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000003
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds ;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;

vector <int> r , l ;

int main()
{
    int i , j, k  , m , n ;

    scanf("%d %d",&n,&k) ;

    for(i=0 ; i<n ; i++)
    {
        scanf("%d",&m) ;
        if(m<0) l.pb(-m) ;
        else r.pb(m) ;
    }

    sort(  l.begin() , l.end() ) ;

    int ans = 1000000000 ;

    for(i=1 ; i<k && i<=(int)r.size() ; i++)
    {
        if( k-i <= (int)l.size() ) ans = min( 2*r[i-1]+l[k-i-1] , ans ) ;
    }
    for(i=1 ; i<k && i<=(int)l.size() ; i++)
    {
        if( k-i <= (int)r.size() ) ans = min( 2*l[i-1]+r[k-i-1] , ans ) ;
    }

    if( (int)r.size() >=k ) ans = min(ans , r[k-1] ) ;
    if( (int)l.size() >=k ) ans = min(ans , l[k-1] ) ;

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

    return 0 ;
}


Measured memory_bytes: 1020
#include<iostream>
using namespace std;
int main(){
  long long k,a,b,ans;cin >> k >> a >> b;
  if(a+1 > k || b-a <= 2) cout << k+1 << endl;
  else{
    k -= a-1;ans = a+(b-a)*(k/2);k = k%2;
    if(k) ans++;
    cout << ans << endl;
  }
}
    

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

using namespace std;

int main(){

	stack<int> s;
	int num;
	while(cin >> num){
		if(num == 0){
			int t = s.top();s.pop();
			cout << t << endl;
		}
		else
			s.push(num);
	}


	return 0;
}

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

using lint = long long;
const lint MOD = 1e6 + 3;

lint power(lint n, lint p) {
    lint res = 1;
    while (p > 0) {
        if (p % 2 == 1) {
            res = res * n % MOD;
        }
        n = n * n % MOD;
        p /= 2;
    }
    return res;
}

lint minv(lint n) {
    return power(n, MOD - 2);
}

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

    vector<lint> fact(MOD + 10);
    fact[0] = 1;
    for (int i = 1; i < MOD + 10; i++) {
        fact[i] = i * fact[i - 1] % MOD;
    }

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        lint x, d, n;
        cin >> x >> d >> n;
        if (x == 0) {
            cout << 0 << endl;
        } else if (d == 0) {
            cout << power(x, n) << endl;
        } else {
            lint xp = x * minv(d) % MOD;
            if (xp + n - 1 >= MOD) {
                cout << 0 << endl;
                continue;
            }
            lint ans = power(d, n);
            cout << ans * fact[xp + n - 1] % MOD * minv(fact[xp - 1]) % MOD << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 8704
#include <iostream>

using namespace std;

int main()
{
int n, dp[100005],tab[100005];
cin>>n;
for(int i=1; i<=n; i++){
  cin>>tab[i];
}

dp[1]=0;
dp[2]=tab[2]-tab[1];
if(dp[2]<0)dp[2]*=-1;

for(int i=3; i<=n; i++){
  int a=tab[i]-tab[i-1];
  if(a<0)a*=-1;
  int b=tab[i]-tab[i-2];
  if(b<0)b*=-1;
  dp[i]=min(dp[i-1]+a,dp[i-2]+b);
}

cout<<dp[n];


  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define bear ryan
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define ends ' '
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll inf = 1e9;
const int maxn = 105;

ll n, k;

int main(void) {
    fastio;
    cin >> n >> k;
    cout << min(n % k, k - n % k);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<stdlib.h>
#include<queue>
#include<stack>
#include<list>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<string.h>
#include<limits.h>
#include<functional>
using namespace std;

signed main() {
	string a, b; cin >> a >> b;
	for (int i = 0; i < b.length(); i++) {
		cout << a[i] << b[i];
	}
	if (a.length() != b.length())cout << *a.rbegin();
	puts("");
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

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

int main(){
    string a, s, c;
    cin >> a >> s >> c;
    cout << 'A' << s[0] << "C" << endl;
}


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

using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;



int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall


    ini(n);
    ins(a);
    if(n>=3200){out(a);}
    else{out("red");}
    return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int a,b;
    cin >> a >> b;
    int ans = 0;
    if(a < b)
    {
        ans += b;
        b--;
    }
    else
    {
        ans += a;
        a--;
    }

    if(a < b)
    {
        ans += b;
        b--;
    }
    else
    {
        ans += a;
        a--;
    }
    cout << ans << endl;
}


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

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

  bool P = false, W = false, G = false, Y = false;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;

    if (S == "P") {
      P = true;
    }
    if (S == "W") {
      W = true;
    }
    if (S == "G") {
      G = true;
    }
    if (S == "Y") {
      Y = true;
    }
  }

  if (P && W && G && Y) {
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool bfs(vector<vector<int> >&hen)
{
	int n=hen.size();
	vector<int> tu(n);
	tu.clear();
	tu[0]=1;
	queue<int> q;
	q.push(0);
	while(!q.empty())
	{
		int town=q.front();
		q.pop();
		for(int i=0;i<n;i++)
			if(hen[town][i]==1&&tu[i]==0)
				q.push(i),tu[i]=1;
	}
	for(int i=0;i<n;i++)
		if(!tu[i])
			return 1;
	return 0;
}
int main()
{
	int ans=0;
	int n,m;
	cin>>n>>m;
	vector<vector<int> >hen(n);
	for(int i=0;i<n;i++)
		hen[i].resize(n);
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		hen[a][b]=hen[b][a]=1;
	}
	for(int i=0;i<n;i++)
		for(int j=0;j<i;j++)
		{
			if(!hen[i][j])
				continue;
			hen[i][j]=hen[j][i]=0;
			ans+=bfs(hen);
			hen[i][j]=hen[j][i]=1;
		}
	cout<<ans;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (h,n) = get!(usize, usize);
    let a = get!([usize]);
    let sum = a.into_iter().sum::<usize>();
    if sum >= h {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 10492
# Author: cr4zjh0bp
# Created: Sun Mar 22 22:02:37 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

s = ns()
n = len(s)

for i in range(n):
    if (i + 1) % 2 == 1:
        print(s[i], end="")

print()

Measured memory_bytes: 4596
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int w[]=new int[n];
		int sum=0;
		for(int i=0;i<n;i++) {
			w[i]=scan.nextInt();
			sum+=w[i];
		}
		scan.close();
		int sum2=0;
		int min=Integer.MAX_VALUE;
		for(int i=0;i<n;i++) {
			sum2+=w[i];
			if(min>Math.abs(sum-sum2*2))min=Math.abs(sum-sum2*2);

		}
		System.out.println(min);
	}
}

Measured memory_bytes: 21844
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

n = readint()
a = readints()

a.sort(reverse=1)

if n%2==0:
    print(a[0]+sum(a[1:n//2])*2)
else:
    print(a[0]+sum(a[1:n//2])*2+a[n//2])






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

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n;
  for(i=1;i<=50000;i++){
    if((int)floor(1.08000000001*i)==n){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<":("<<endl;
}

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

int main(){
	int n,k,r,s,p;
	string t;
	cin >> n >> k >> r >> s >> p >> t;
	ll ans=0;

	rep(i,k){
		bool flag=true;
		for(int j=i; j<n; j+=k){
			if(flag){
				if(t[j] == 'r'){
					ans += p;
				}else if(t[j] == 's'){
					ans += r;
				}else{
					ans += s;
				}
				if((j+k < n) && (t[j+k] == t[j])){
					flag = false;
				}

			}else{
				flag = true;
			}
		}
	}
	cout << ans << endl;
			
	return 0;
}





Measured memory_bytes: 512
from sys import stdin
def stdinput():
    return stdin.readline().strip()

class Card:
    def __init__(self, value):
        self.value = int(value[1:])
        self.value2 = value

def main():
    n = int(stdinput())
    A = list(map(Card, stdinput().split()))

    bubble_sorted = bubble_sort(A[:], len(A))
    selection_sorted = selection_sort(A[:], len(A))

    print(' '.join(map(lambda c: c.value2, bubble_sorted)))
    print('Stable' if is_stable(A, bubble_sorted) else 'Not stable')
    print(' '.join(map(lambda c: c.value2, selection_sorted)))
    print('Stable' if is_stable(A, selection_sorted) else 'Not stable')


def bubble_sort(A, N):
    for i in range(N):
        for j in range(N-1, i, -1):
            if A[j].value < A[j-1].value:
                A[j], A[j-1] = A[j-1], A[j]
    return A

def selection_sort(A, N):
    for i in range(N):
        min_idx = i
        for j in range(i+1, N):
            if A[j].value < A[min_idx].value:
                min_idx = j
        if min_idx != i:
            A[i], A[min_idx] = A[min_idx], A[i]
    return A

def is_stable(A, B):
    for i in range(1, 10):
        sub_A = list(filter(lambda c: c.value == i, A))
        sub_B = list(filter(lambda c: c.value == i, B))
        for a, b in zip(sub_A, sub_B):
            if a.value2 != b.value2:
                return False
    return True

if __name__ == '__main__':
    main()


Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N,K;
    cin>>N>>K;
    vector<ll> V(N);
    rep(i,N)cin>>V[i];

    ll ans = 0;
    //左からl個,右からr個とって、
    //負の数をK-(l + r)個捨てる
    for(int l = 0; l <= N; l++){
        for(int r = 0; r <= N; r++){
            if(l + r > K||l + r > N)continue;
            ll cnt = 0;
            priority_queue<ll, vector<ll>, greater<ll> > q;
            rep(i,l){
                q.push(V[i]);
                cnt += V[i];
            }
            rep(j,r){
                q.push(V[N-1-j]);
                cnt += V[N-1-j];
            }
            rep(_,K-(l+r)){
                if(q.empty())break;
                ll cur = q.top();
                if(cur < 0){
                    q.pop();
                    cnt -= cur;
                }
            }
            chmax(ans, cnt);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define int long long

template<int MOD> struct modint{
    int val;
    constexpr modint(int v): val(v % MOD){
        if(val < 0) val += MOD;
    }
    constexpr int getmod(){
        return MOD;
    }
    constexpr modint operator-(){
        return val? MOD - val : 0; 
    }

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


    constexpr modint& operator+=(const modint &r){
        val += r.val;
        if(val >= MOD) val -= MOD;
        return *this;
    }
    constexpr modint& operator-=(const modint& r){
        val -= r.val;
        if(val < 0) val += MOD;
        return *this;
    }
    constexpr modint& operator*=(const modint& r){
        val = (val * r.val) % MOD;
        return *this;
    }
    constexpr modint& operator/=(const modint& r){
        // ax + bz = a, ay + bw = b からスタートして
        // 右辺について互除法して係数を変えていく
        // (x, y) -> (y, x-y*(a/b)), (z, w) -> (w, z-w*(a/b))
        // 最終的に ax + bz = gcd(a, b) となるので a, b が互いに素なら x が逆元
        // z と w を覚えておく必要はない
        int a = r.val, b = MOD, x = 1, y = 0;
        while(b){
            x -= y * (a/b); swap(x, y);
            a -= b * (a/b); swap(a, b);
        }
        val = (val * x) % MOD;
        if(val < 0) val += MOD;
        return *this;
    }

    constexpr bool operator==(const modint& r){
        return val == r.val;
    }
    constexpr bool operator!=(const modint& r){
        return val != r.val;
    }

    constexpr modint modpow(int e){
        modint ans = 1, n = *this;
        while(e){
            if(e & 1) ans *= n;
            n *= n;
            e /= 2;
        }
        return ans;
    }

    friend constexpr ostream& operator<<(ostream &os, const modint<MOD>& x){
        return os << x.val;
    }
};

const int MOD = 998244353;
using mint = modint<MOD>;

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int n, k;
    cin >> n >> k;
    vector<int> l(k), r(k);
    for(int i=0; i<k; i++){
        cin >> l[i] >> r[i];
    }

    vector<mint> dp(n+1, 0);
    dp[1] = 1;
    int now = 1;
    for(; now<=n; now++){
        for(int j=0; j<k; j++){
            if(now+l[j] <= n) dp[now+l[j]] += dp[now];
            if(now+r[j]+1 <= n) dp[now+r[j]+1] -= dp[now];
        }
        if(now < n && now > 1){
            dp[now+1] += dp[now];
        }
    }
    cout << dp[n] << endl;

    return 0;
}

Measured memory_bytes: 4840
var
  a,d:array[0..100,0..100]of longint;
  b,c,e:array[0..100]of longint;
  n,m,i,j:longint;
  ch:char;
begin
  readln(n,m);
  for i:=1 to n do 
    for j:=1 to m do
	  begin
	    read(ch);
		if ch='.' then
		  begin
		    a[i,j]:=0;
			{b[i]:=b[i-1]+0;
			c[j]:=c[j-1]+0;}
		  end else
		  begin
		    a[i,j]:=1;
			inc(b[i]);
			inc(c[j]);
		  end;
		 if j=m then readln;
	  end;
  for i:=1 to n do
    for j:=1 to m do
	  begin
	    if (b[i]=0)or(c[j]=0) then d[i,j]:=0 else d[i,j]:=1;
	  end;
  for i:=1 to n do
    begin
	  if b[i-1]>0 then writeln;
	  if b[i]=0 then continue;
	  for j:=1 to m do
	    begin
		  if c[j]=0 then continue;
		  if a[i,j]=0 then write('.') else write('#');
		end;
	end;
end.
		  

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

class UnionFind {
    int n;
    vector<int> uni;
    int forest_size;
public:
    explicit UnionFind(int n) : n(n), uni(static_cast<u32>(n), -1), forest_size(n) {};

    int root(int a){
        if (uni[a] < 0) return a;
        else return (uni[a] = root(uni[a]));
    }

    bool unite(int a, int b) {
        a = root(a);
        b = root(b);
        if(a == b) return false;
        if(uni[a] > uni[b]) swap(a, b);
        uni[a] += uni[b];
        uni[b] = a;
        forest_size--;
        return true;
    }
    int size(){ return forest_size; }
    int size(int i){ return -uni[root(i)]; }
    bool same(int a, int b) { return root(a) == root(b); }
};

int main() {
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        scanf("%d %d", &a, &b);
        uf.unite(a-1, b-1);
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) ans = max(ans, uf.size(i));
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4052
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

s,t = input().split()

print(t+s)

Measured memory_bytes: 31108
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;

int main() {
	int A, B, C;
	cin >> A >> B >> C;

	int N = C / A;

	cout << N * B << endl;
}


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



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int M = cin.nextInt();
        init(M + 1);
        int[][] L = new int[N][];
        for (int i = 0; i < N; i++)
        {
            int K = cin.nextInt();
            L[i] = new int[K];
            for (int j = 0; j < K; j++)
            {
                L[i][j] = cin.nextInt();
            }

            for (int j = 0; j < K - 1; j++)
            {
                connect(L[i][j], L[i][j + 1]);
            }
        }

        for (int i = 0; i < N; i++)
        {
            if(connect(L[0][0], L[i][0]))
            {
                Console.WriteLine("NO");
                return;
            }
        }
        Console.WriteLine("YES");

    }

    int[] uni;
    void init(int N)
    {
        uni = new int[N];
        for (int i = 0; i < N; i++)
        {
            uni[i] = -1;
        }
    }

    int root(int a)
    {
        if (uni[a] < 0) return a;
        else return uni[a] = root(uni[a]);
    }

    bool connect(int a, int b)
    {
        a = root(a);
        b = root(b);
        if (a == b) return false;
        if (uni[a] > uni[b]) swap(ref a, ref b);
        uni[a] += uni[b];
        uni[b] = a;
        return true;
    }

    void swap<T>(ref T a, ref T b)
    {
        T c = a;
        a = b;
        b = c;
    }  


}



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


Measured memory_bytes: 25560
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  std::vector<int> v(3);
  rep(i,3) cin >> v[i];
  sort(v.rbegin(), v.rend());
  debug(v);
  int num; cin>>num;
  rep(i, num) {
    v[0] *= 2;
    sort(v.rbegin(), v.rend());
  }
  int sum = accumulate(ALL(v), 0);
  cout << sum << endl;

}


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

int main() {
    int n, k;
    cin >> n >> k;
    int sum = 0;
    int x;
    int min_d;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        min_d = min(x, abs(k - x));
        sum += 2 * min_d;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b){
	return a<b;
}
int main (){
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n,cmp);
	int sum=0;
	for(int i=0;i<n;i++)
		sum+=a[i];
	if(sum%10==0){
		for(int i=0;i<n;i++){
			if(a[i]%10!=0){sum-=a[i];break;}
		}
	}
	if(sum%10==0)cout<<"0"<<endl;
	else cout<<sum<<endl;
	return 0;
}

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

 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;

//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
const LL INF=LONG_MAX;
const double EPS=0.00001;
const long double PI = acos(-1.0);



int main(){
    int N;
    cin>>N;
    map<LL,int>mp;
    REP(i,N){
        LL tmp;
        cin>>tmp;
        if(mp.find(tmp)!=mp.end()){
            if(mp[tmp]==1)mp[tmp]=0;
            else mp[tmp]=1;
        }else{
            mp[tmp]=1;
        }
    }
    int res=0;
    for(auto itr:mp){
        res+=itr.second;
    }
    cout<<res<<endl;
    return 0;
}


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

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define all(a) (a.begin(), a.end())

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////
	
void solve() {
	int x1,x2,y1,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	pair<int,int> d = make_pair(x2-x1,y2-y1);
	pair<int,int> cur = make_pair(x2,y2);
	for (int i = 0; i < 2; ++i) {
		int tmp = d.second;
		d.second = d.first;
		d.first = -tmp;
		cur.first += d.first;
		cur.second += d.second;
		cout << cur.first << ' ' << cur.second << ' ';
	}
	cout << '\n';
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a > b){
            System.out.println("a > b");
        }
        else if(a == b){
            System.out.println("a == b");
        }
        else{
            System.out.println("a < b");
        }
    }
}


Measured memory_bytes: 26220
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    btn = [int(input())-1 for _ in range(N)]
    i = 0
    li = [False]*N
    #print(btn)
    
    for _ in range(N):
        li[i] = True
        k = btn[i]
        
        #print(k, li)
        if li[k]:
            print('-1')
            break
        elif k == 1:
            print(sum(li))
            break
        
        i = k
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 7852
import java.util.Scanner;

class Main {
public static void main (String[] args){
Scanner sc = new Scanner(System.in); 
int a = sc.nextInt();
int b = sc.nextInt();
if (a >= 1 && a <= 100){
if (b >= 1 && b <= 100){
System.out.println(a * b + " " + 2 * (a + b));
}
}
}
}



Measured memory_bytes: 26084
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <iomanip>
#include <fstream>
#include <cstdio>
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define repn(a,b,c) for(int a=b; a>=c; a--)
#define ll long long
#define mem(a, b) memset(a, (b), sizeof(a))
#define loop(a,b,c) for(int a = b ;a<c;a++)
#define pb(a) push_back(a)
#define MAXN 1000000000
#define fi first
#define se second
using namespace std;

ll max(ll a, ll b){
    if(a>b) return a;
    return b;
}

ll min(ll a, ll b){
    if(a>b) return b;
    return a;
}

int main(){


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

     double jpy = 380000.0;

     double tot = 0.0;

     ll n;
     cin>>n;


     rep(i,1,n){
        double x;
        string a;
        cin>>x>>a;

        if(a == "JPY"){
            tot+=x;
        }else{
            x = jpy * x;
            tot+=x;
        }
     }


     cout<<setprecision(7)<<tot<<endl;

     return 0;
}















































Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static class Solver {
		
		int a, b, c, N;
		
		void solve(FastScanner s, PrintWriter out) {
			N = s.nextInt();
			for(int k, i = 0; i < N; i++) {
				k = s.nextInt();
				if((k & 3) == 0) c++;
				else if((k & 1) == 0) b++;
				else a++;
			}
			int last = -1;
			while(N --> 0) {
				if(last == -1) {
					if(a != 0) {
						a--; last = 0;
					} else if(b != 0) {
						b--; last = 1;
					} else {
						c--; last = 2;
					}
				} else if(last == 0) {
					if(c == 0) {
						out.println("No"); return;
					}
					c--; last = 2;
				} else if(last == 1) {
					if(b == 0) {
						if(c == 0) {
							out.println("No"); return;
						}
						c--; last = 2;
					} else {
						b--; last = 1;
					}
				} else if(last == 2) {
					if(a == 0) {
						if(b == 0) {
							out.println("Yes"); return;
						}
						b--; last = 1;
					} else {
						a--; last = 0;
					}
				}
			}
			out.println("Yes");
		}
		
	}
	
	public static void main(String[] args) {
		FastScanner s = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		new Solver().solve(s, out);
		
		out.close();
	}
	
	static class FastScanner {
		
		BufferedReader br; StringTokenizer st;
		FastScanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
			st = new StringTokenizer("");
		}
		String next() {
			while(!st.hasMoreElements()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch(Exception e) {}
			}
			return st.nextToken();
		}
		
		int nextInt() { return Integer.parseInt(next()); }
		
	}
	
}


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

namespace GreedyTakahashi
{
    class Program
    {
        static void Main(string[] args)
        {
            var kx = Console.ReadLine().Split();
            int K = int.Parse(kx[0]);
            int X = int.Parse(kx[1]);
            if (K*500 >= X)
            {
                Console.WriteLine("Yes");
            } else
            {
                Console.WriteLine("No");
            }
        }
    }
}


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

int main() {

  int N ;

  cin >> N ;

  if ( N == 11 || N == 13 || N == 17 || N == 19 || N == 22|| N == 23|| N == 26|| N == 29|| N == 31
  
  || N == 33|| N == 34|| N == 37|| N == 38|| N == 39|| N == 41|| N == 43|| N == 44|| N == 46|| N == 47|| N == 50
  
  || N == 51|| N == 52|| N == 53|| N == 55|| N == 57|| N == 58|| N == 59|| N == 60|| N == 61|| N == 62
  
  || N == 65|| N == 66|| N == 67|| N == 68|| N == 69|| N == 70|| N == 71|| N == 73|| N == 74|| N == 75
  
  || N == 76|| N == 77|| N == 78|| N == 79|| N == 80|| N > 81) cout << "No"<< endl;

  else cout << "Yes" << endl;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    int n, k;
    cin >> n >> k;
    double ans[n+1];
    for (int i = 1; i <= n; i++) {
        int p; cin >> p;
        ans[i] = (p + 1) / 2.0;
        ans[i] += ans[i-1];
    }
    double mx = 0;
    for (int i = k; i <= n; i++) {
        mx = max(mx, ans[i] - ans[i-k]);
    }
    cout << fixed << setprecision(10) << mx << endl;
    return 0;
}

Measured memory_bytes: 1792
N = int(input())
if N < 10:
  print(N)
elif N < 100:
  print(9)
elif N < 1000:
  print( 9 + N - 99 )
elif N < 10000:
  print( 909 )
elif N < 100000:
  print(909 + N - 9999)
else:
  print( 90909 )
  

Measured memory_bytes: 3064
N, L = map(int, input().split())
min = 1000
min_ans = 1000
abs_a = 0
answer = 0
for i in range(1,N+1):
    a = i + L - 1
    answer += a
    abs_a = abs(a)
    if(min > abs_a):
        min = abs_a
        min_ans = a
print(answer - min_ans)

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

using namespace std;

int main() {
	int h, m, s, time;
	int timeCard[2];
	
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < 2; ++j) {
			cin >> h >> m >> s;
			//cout << h << " " << m << " " << s << endl;
			timeCard[j] = h * 3600 + m * 60 + s;
		}
		time = timeCard[1] - timeCard[0];
		cout << time / 3600 << " " << (time % 3600) / 60 << " " << (time % 3600) % 60 << endl;
	}

	return 0;
}


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

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	if(a >= 10) {
		printf("-1");
		return 0;
	}
	if(b >= 10) {
		printf("-1");
		return 0;
	}
	printf("%d", a*b);
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    string s; cin >> s;
    set<char> st;
    rep(i, 3) st.insert(s[i]);
    if(st.size()==1)cout << "No" << ln;
    else cout << "Yes" << ln;
}

Measured memory_bytes: 3608
#include<stdio.h>
int main(void){
	char s[100];
	int i,r=1;
	scanf("%s",s);
	for(i=0;s[i]!='\0';i++){
		if(i%2){
			if(s[i]!='L'&&s[i]!='U'&&s[i]!='D'){
				r=0;
			}
		}
		else{
			if(s[i]!='R'&&s[i]!='U'&&s[i]!='D'){
				r=0;
			}
		}
	}
	printf(r?"Yes":"No");
	return 0;
}

Measured memory_bytes: 1732