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

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

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

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

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

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

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

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

fn main() {
    input! {
        n: usize,
        s: String
    }
    let ans = if &s[..(n / 2)] == &s[(n / 2)..] {
        "Yes"
    } else {
        "No"
    };
    println!("{}", ans);
}


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

using namespace std;

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

    char s[4];
    for (int i=N;i<=999;i++) {
        snprintf(s, sizeof(s), "%d", i);
        if (s[0]==s[1] && s[1]==s[2]) {
            cout << s << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]int, N)
	B := make([]int, N)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < N; i++ {
		A[i] = nextInt(sc)
		B[i] = nextInt(sc)
	}
	ans := 0
	for i := len(A) - 1; i >= 0; i-- {
		A[i] += ans
		if A[i]%B[i] != 0 {
			if A[i] > B[i] {
				ans += B[i] - (A[i]-B[i])%B[i]
			} else {
				ans += B[i] - A[i]
			}
		}
	}
	fmt.Println(ans)
}
func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n, m;
    cin >> n >> m;
    vector<string> a(n);
    vector<string> b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    rep(d1, n-m+1) rep(d2, n-m+1) {
        bool ok = true;
        rep(i, m) rep(j, m) {
            if (b[i][j]!=a[i+d1][j+d2]) ok = false;
        }
        if (ok) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    
    cout << "No" << endl;
    return 0;
}


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

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(void){
   int s;
   cin >> s;
   COMinit();
   long long ans = 0;
   for(int i=1;i<=s/3;i++){
       ans += COM(s-2*i-1,i-1); 
       ans %= MOD;
   }
   cout << ans << endl;
}

Measured memory_bytes: 15580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int cnt[5];
int main(){
	rep(x,3){
		int a,b; cin>>a>>b;
		cnt[a]++; cnt[b]++;
	}
	sort(cnt+1,cnt+5);
	if(cnt[1] == 1 && cnt[2] == 1 && cnt[3] == 2 && cnt[4] == 2){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
}

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

#define ll long long

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    string s[n], t[m];
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> t[i];
    }
    for (int i = 0; i < n - m; i++) {
        for (int j = 0; j < n - m; j++) {
            bool foun = true;
            for (int r = 0; r < m; r++) {
                for (int c = 0; c < m; c++) {
                    if (t[r][c] != s[i + r][j + c]) {
                        foun = false;
                        break;
                    }
                }
            }
            if (foun) {
                cout << "Yes" << '\n', exit(0);
            }
        }
    }
    if (n == m && n == 1) {
        cout << "Yes" << '\n';
    } else cout << "No" << '\n';
    return 0;
}

Measured memory_bytes: 256
import sys

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

memo = [[sys.maxsize]*(N+1) for _ in range(N+1)]
for i in range(1,N+1):
  memo[i][i] = 0

lst = []
for _ in range(M):
  a,b,c = map(int, input().split())
  memo[a][b] = c
  memo[b][a] = c
  lst.append((a,b,c))
  
for k in range(1,N+1):
  for i in range(1,N+1):
    for j in range(1,N+1):
      memo[i][j] = min(memo[i][j], memo[i][k] + memo[k][j])
      
cnt = 0
for a,b,c in lst:
  if memo[a][b] < c:
    cnt += 1
    
print(cnt)

Measured memory_bytes: 9252
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <ctype.h>
#include <set>
#include <map>
#include <list>

#define MAXN 10000000
using namespace std;

int N;
int L;
int T;
int x[100050];
int w[100050];
int zuihou[100050];

int main()
{
	//freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d%d%d",&N,&L,&T);
    for(int i=1;i<=N;i++)
    {
        scanf("%d%d",&x[i],&w[i]);
    }
    for(int i=1;i<=N;i++)
    {
        if(w[i]==2)
        {
            w[i]=-1;
        }
    }
    for(int i=1;i<=N;i++)
    {
        zuihou[i]=(x[i]+T*w[i])%L;
        if(zuihou[i]<0)
        {
            zuihou[i]+=L;
        }
    }
    sort(zuihou+1,zuihou+N+1);
    int sum=0;
    long long woca=0;
    for(int i=1;i<=N;i++)
    {
        woca+=x[i];
        sum+=w[i];
    }
    woca+=((long long)T)*sum;
    long long help=((long long)N)*L;
    woca=woca%help;
    if(woca<0)
    {
        woca+=help;
    }
    long long zheli=0;
    for(int i=1;i<=N;i++)
    {
        zheli+=zuihou[i];
    }
    zheli=zheli%help;
    int i=0;
    while(1)
    {
        if(zheli==woca || zheli-help==woca) break;
        zheli+=L;
        i++;
    }
    i++;
    for(int j=i;j<=N;j++)
    {
        printf("%d\n",zuihou[j]);
    }
    for(int j=1;j<i;j++)
    {
        printf("%d\n",zuihou[j]);
    }


	return	0;
}


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

long long md(pair<long long,long long> x,pair<long long,long long> y){
    return max(x.first,y.first)-min(x.first,y.first)+max(x.second,y.second)-min(x.second,y.second);
}

int main(){
    int N,K,ans=0;
    cin >> N >> K;
    for(int i=0;i<N;i++){
        int h;
        cin >> h;
        if(h>=K)
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int A,B,C,D;cin>>A>>B>>C>>D;
  int l=A+B;
  int r=C+D;
  if(l>r){
    P("Left");
    return 0;
  }else if(l==r){
    P("Balanced");
    return 0;
  }else{
    P("Right");
    return 0;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactice problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main()
{ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ll h,w,m;
    cin>>h>>w>>m;
    vector<ii> v;
    map<ll, ll> m1;
    map<ll, ll> m2;
    set<ii> s1;
    map<ll, set<ll>> r_corr_c;
    for (int i = 0; i < m; ++i)
    {
        ll a,b;
        cin>>a>>b;
        m1[a]++;
        m2[b]++;
        s1.insert({a, b});
        r_corr_c[a].insert(b);
    }

    ll max_row=0;
    for (auto i = m1.begin(); i != m1.end(); ++i)
    {
        max_row = max(max_row, i->S);
    }

    ll max_col=0;
    for (auto i = m2.begin(); i != m2.end(); ++i)
    {
        max_col = max(max_col, i->S);
    }

    set<ll> rows;
    for (auto i = m1.begin(); i != m1.end(); ++i)
    {
        if(i->S==max_row){
            rows.insert(i->F);
        }
    }

    set<ll> cols;
    for (auto i = m2.begin(); i != m2.end(); ++i)
    {
        if(i->S==max_col){
            cols.insert(i->F);
        }
    }

    ll fg=0;
    ll ans=max_row+max_col;
    // we need to find one that donot have a common bomb
    // if none then ans-1
    for (auto i = r_corr_c.begin(); i != r_corr_c.end(); ++i)
    {
        if(rows.find(i->F)!=rows.end()){
            set<ll> rem;
            for (auto j = i->S.begin(); j != i->S.end(); ++j)
            {
                if(cols.find(*j)!=cols.end()){
                    rem.insert(*j);
                }
            }
            if(rem.size()!=cols.size()){
                fg=1;
                break;
            }
        }
    }

    if(fg==1){
        cout<<ans;
    }
    else{
        cout<<ans-1;
    }

    return 0;
}

Measured memory_bytes: 130116
#include <bits/stdc++.h>
    #define int long long
    #define endl '\n'
    #define modulo 1000000007
    using namespace std;
    int32_t main()
    {
    iostream::sync_with_stdio(0);
    cin.tie(0);
    string f,l;
    bool YYMM=0,MMYY=0;
    char buff;
    cin>>buff;
    f+=buff;
    cin>>buff;
    f+=buff;
    cin>>buff;
    l+=buff;
    cin>>buff;
    l+=buff;
    if((f[0]=='0'||f[1]<'3')&&(f[0]!='0'||f[1]!='0')){
    MMYY=1;
    }
    if((l[0]=='0'||l[1]<'3')&&(l[0]!='0'||l[1]!='0'))
    YYMM=1;
    if(MMYY&&YYMM)
    cout<<"AMBIGUOUS";
    else if(MMYY){
    cout<<"MMYY";
    }
    else if(YYMM)
    cout<<"YYMM";
    else
    cout<<"NA";
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	final Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {
		new Main().B();
	}
	
	void B(){
		while(sc.hasNext()){
			char[] R=sc.next().toCharArray();
			if(R[0]=='-')	break;
			char[] G=sc.next().toString().toCharArray(),dd=sc.next().toCharArray();
			char now=G[0];
			int gi=1,ri=0,di=0;
			StringBuilder d=new StringBuilder(),r=new StringBuilder();
			while(true){
				//System.out.println("N"+now);
				if(di<dd.length){
					if(now==dd[di]){
						d.append(now);
						di++;
						now=R[ri++];
					}else{
						r.append(now);
						if(gi+1>G.length)	break;
						now=G[gi++];
					}
				}else{
					r.append(now);
					break;
				}
			}
			while(gi<G.length)	r.append(G[gi++]);
			//System.out.println("D:"+d);
			//System.out.print("ANS=");
			System.out.println(r);
		}
	}
	void A(){
		while(true){
			int W = sc.nextInt(), Q = sc.nextInt();
			if(W == 0 && Q == 0){
				break;
			}
			int [] b = new int[W];
			Arrays.fill(b, -1);
			while(Q-- > 0){
				String  str = sc.next();
				int id = sc.nextInt();
				if(str.equals("s")){
					int x = sc.nextInt();
					boolean flg2 = true;
					for(int i=0; i <= W - x; i++){
						boolean flg = true;
						for(int j= i; j < i + x; j++){
							if(b[j] != -1){
								flg = false;
								break;
							}
						}
						if(flg){
							flg2 = false;
							System.out.println(i);
							for(int j = i; j < i + x; j++){
								b[j] = id;
							}
							break;
						}
					}
					if(flg2){
						System.out.println("impossible");
					}
				}
				else{
					for(int i=0; i < W; i++){
						if(b[i] == id){
							b[i] = -1;
						}
					}
				}
				//debug
//				System.out.print("DEB= ");
//				for(int i=0; i < b.length; i++){
//					System.out.print(b[i]);
//				}
//				System.out.println();
			}
			System.out.println("END");
		}
	}
}

Measured memory_bytes: 12000
#include<stdio.h>
#include<algorithm>
#include<iostream>

using namespace std;


int n;
int tmp [200002] ;
int tmp1 [200002] ;
int main ()
{
    while (scanf ("%d", &n) !=EOF)
    {
        for (int i=0;i<n;i++)
            {scanf ("%d",&tmp[i]);
            tmp1[i] =tmp[i] ;
            }
        sort (tmp , tmp +n  ) ;
        int t;
        int mid =(n-1)/2 ;
        int midnum = tmp [mid] ;
        t=tmp[mid+1] ;
        for (int i=0;i<n;i++)
        {
            if (tmp1[i]<= midnum ) printf ("%d\n" ,t);
            else printf ("%d\n" ,midnum);
        }

    }

    return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <vector>
using namespace std;
bool move(int &t0,int &sX,int &sY,int eX,int eY,int t)
{
	while (sX!=eX){
		if (sX<eX){
			sX++;
		}else{
			sX--;
		}
		t0++;
		if (t0>t){
			return false;
		}
	}
	while (sY!=eY){
		if (sY<eY){
			sY++;
		}else{
			sY--;
		}
		t0++;
		if (t0>t){
			return false;
		}
	}
	if (t0==t){
		return true;
	}
	if (t0<t){
		if (t0%2==t%2){
			return true;
		}else{
			return false;
		}
	}
	return false;
}
int main(int argc, char* argv[])
{
	int N;
	cin>>N;
	int i;
	int t0=0,x0=0,y0=0,t,x,y;
	for (i=0;i<N;i++){
		cin>>t>>x>>y;
		if (move(t0,x0,y0,x,y,t)){
			continue;
		}else{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

int main ( )  {
	int a [4] ;

	for ( int i = 0 ; i < 4 ; ++ i )  {
		int c ;
		while ( isspace ( c = getchar ( ) ) ) ;
		a [i] = c - 48 ;
	}

	for ( int i = 0 ; i < 8 ; ++ i )  {
		int res ( a [0] ) ;
		for ( int j = 0 ; j < 3 ; ++ j )
			if ( ( i >> j ) & 1 )  {
				res += a [j + 1] ;
			}  else  {
				res -= a [j + 1] ;
			}
		if ( res == 7 )  {
			for ( int j = 0 ; j < 7 ; ++ j )
				if ( j & 1 )  {
					int k = j >> 1 ;
					putchar ( ( i >> k ) & 1 ? '+' : '-' ) ;
				}  else  {
					printf ( "%d", a [j >> 1] ) ;
				}
			puts ( "=7" ) ;
			return 0 ;
		}
	}
}


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

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

template<class T, class U> void chmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> void chmin(T &a, U b) { if (b < a) a = b; }

using ll = long long;
using ld = long double;
using namespace std;

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

  string s, t; cin >> s >> t;
  
  reverse(all(s));
  if (s == t) cout << "YES\n";
  else cout << "NO\n";
  
  return (0);
}

Measured memory_bytes: 3548
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[m];
        int[] b = new int[m];
        for (int i = 0 ; i < m ; i++) {
            a[i] = sc.nextInt() - 1;
            b[i] = sc.nextInt() - 1;
        }
        Set<Long> pair = new HashSet<>();
        for (int i = 0 ; i < m ; i++) {
            pair.add((long) a[i] * 100000 + b[i]);
        }
        int[] c = new int[h];
        int[] d = new int[w];
        for (int i = 0 ; i < m ; i++) {
            c[a[i]]++;
            d[b[i]]++;
        }
        int hmax = 0;
        int wmax = 0;
        for (int i = 0 ; i < h ; i++) {
            if (c[i] > hmax) {
                hmax = c[i];
            }
        }
        for (int i = 0 ; i < w ; i++) {
            if (d[i] > wmax) {
                wmax = d[i];
            }
        }
        Set<Integer> seth = new HashSet<>();
        Set<Integer> setw = new HashSet<>();
        for (int i = 0 ; i < h ; i++) {
            if (c[i] == hmax) {
                seth.add(i);
            }
        }
        for (int i = 0 ; i < w ; i++) {
            if (d[i] == wmax) {
                setw.add(i);
            }
        }

        if ((long) seth.size() * setw.size() > m) {
            System.out.println(hmax + wmax);
            return;
        }

        for (int x : seth) {
            for (int y : setw) {
                long key = (long) 100000 * x + y;
                if (!pair.contains(key)) {
                    System.out.println(hmax + wmax);
                    return;
                }
            }
        }
        System.out.println(hmax + wmax - 1);


    }

}


Measured memory_bytes: 111584
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	ld l ;
	cin >> l ;
	ld ans = l*l*l/27;
	cout << fixed << setprecision(12) << ans ;
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3748
#include <iostream>

using namespace std;

int solve(int a, int b, int c){
    int max = 10*a+b+c;
    if(max<=a+10*b+c) {
        max = a + 10 * b + c;
    }

    if(max<=a+b+10*c){
        max = a+b+10*c;
    }
    return max;
}

int main(){
    int a, b, c;
    cin>>a>>b>>c;

    cout<<solve(a,b,c)<<endl;

    return 0;
}

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

int main(){

  vector<int> prime(MAX,1);
  vector<int> ans;
  
  prime[0] = 0;
  prime[1] = 0;
  prime[2] = 1;
	
  for(int i=4;i<MAX;i+=2)
	prime[i] = 0;
	
  for(int i=3;i<sqrt(MAX);i+=2)
	for(int j=i+i;j<MAX;j+=i)
	  prime[j] = 0;
  
  int n;
  
  while(cin>>n){
	int cnt = 0;
	for(int i=0;i<=n;++i)
	  if(prime[i]==1)
		cnt++;
	cout<<cnt<<endl;
  }
	
  return 0;
  
}



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

int main() {
    string a, b;
    cin >> a >> b;
    string h = "H", d = "D";

    if(a == h){
        if(b == h){
            cout << h << endl;
        }
        else if(b == d){
            cout << d << endl;
        }
    }
    else if(a == d){
        if(b == h){
            cout << d << endl;
        }
        else if(b == d){
            cout << h << endl;
        }
    }


    return 0;
}

Measured memory_bytes: 256
function MainA(input) {
	input = input.split("\n");
	var a = input[0];
	var e = input[4];
	var k = input[5];
	var result = (e - a > k) ? ":(" : "Yay!";

	console.log('%s',result);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
MainA(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=1;i<=N;i++){
    int k;
    cin>>k;
    A[k-1]=i;
  }
  for(int i=0;i<N;i++){
    cout<<A[i];
    if(i<N-1)
      cout<<' ';
    else
      cout<<endl;
  }
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
static const long long INF = 1LL<<59;
static const long long MOD = (ll)1e9+7;

#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i, n) for(ll i=0;i<n;i++)
#define SZ(v) (ll)((v).size())
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).begin(), (v).end())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

void solve() {
    ll N, H;
    cin >> N >> H;
    vll A(N), B(N);
    REP(i, N) cin >> A[i] >> B[i];
    DESC(A);DESC(B);
    ll mxA = A[0];
    ll ans = 0;
    REP(i, N) {
        
        if(B[i] > mxA) {
            H -= B[i];
            ans++;
            if(H<=0) break;
        }
    }
    ans += max(0LL, (ll)ceil(H / (double)mxA));
    out(ans);
}

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

Measured memory_bytes: 1792
n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
i = 0
count = 0
while i < n-2
  a = [arr[i],arr[i+1],arr[i+2]].sort
  count += 1 if a[1] == arr[i+1]
  i += 1
end
puts count

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

int main() {
    string s;
    cin >> s;
    
    if(s == "SUN") {
        cout << 7;
    }
    else if(s == "MON") {
        cout << 6;
    }
    else if(s == "TUE") {
        cout << 5;
    }
    else if(s == "WED") {
        cout << 4;
    }
    else if(s == "THU") {
        cout << 3;
    }
    else if(s == "FRI") {
        cout << 2;
    }
    else if(s == "SAT") {
        cout << 1;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import os

def main():
	n = int(input())
	a_list = list(map(int, input().split()))
	count = 0
	result = [0]*n
	result_str = ""
	for i,v in enumerate(a_list):
		result[v-1] = i+1
	for i in result:
		result_str += str(i) + " "	
	print(result_str)

if __name__ == "__main__":
	main()


Measured memory_bytes: 13880
#include<iostream>
#include<algorithm>
#include<queue>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>

using namespace std;
const int maxn = 2e5 + 7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
typedef long long ll;

int n;
ll a[maxn];
ll b[maxn];
ll sum;
map<ll, ll>mp;
int main(){
	cin >> n;
	int p = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		if(mp[a[i]] == 0) b[++p] = a[i];
		mp[a[i]]++;
	}
	for(int i = 1; i <= p; i++) sum += (mp[b[i]] * (mp[b[i]] - 1)) / 2;
	for(int i = 1; i <= n; i++){
		cout << sum - mp[a[i]] + 1 << endl;
	}
}

Measured memory_bytes: 12032
from sys import stdin

N, Q = [int(x) for x in stdin.readline().rstrip().split()]
S = stdin.readline().rstrip()

ac_idx = [0]
count = 0

for i in range(N-1):
  if S[i]=="A" and S[i+1]=="C":
    count+=1
  ac_idx.append(count)

for j in range(Q):
  l,r = [int(x) for x in stdin.readline().rstrip().split()]
  print(ac_idx[r-1]-ac_idx[l-1])
  


Measured memory_bytes: 6384
{-# LANGUAGE ScopedTypeVariables, LambdaCase #-}

import qualified Data.List as List
import qualified Data.Set as Set

main :: IO ()
main = do
    [x, a, b] :: [Int] <- map read . words <$> getContents
    putStrLn $ if abs (x - a) < abs (x - b) then "A" else "B"

Measured memory_bytes: 508
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main{

    static class Edge implements Comparable<Edge>{
        public int s;
        public int t;
        public int x;
        public Edge(int s, int t, int x) {
            this.s = s;
            this.t = t;
            this.x = x;
        }
        public int compareTo(Edge o) {
            return x-o.x;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            int n = sc.nextInt();
            if(n==0)break;
            int m = sc.nextInt();
            PriorityQueue<Edge> q = new PriorityQueue<Edge>();
            for(int i=0;i<m;i++){
                String[] s = sc.next().split(",");
                q.add(new Edge(Integer.parseInt(s[0]), Integer.parseInt(s[1]), Integer.parseInt(s[2])/100-1));
            }
            UnionFind union = new UnionFind(n);
            int c = 0;
            while(union.num>1){
                Edge e = q.poll();
                if(!union.find(e.s, e.t)){
                    union.union(e.s, e.t);
                    c+=e.x;
                }
            }
            System.out.println(c);
        }
    }

    static class UnionFind {
        final int[] tree;
        int num;
        public UnionFind(int n) {
            this.tree = new int[n];
            Arrays.fill(tree, -1);
            num=n;
        }

        // merge the set contains x and the set contains y
        void union(int x, int y) {
            x = root(x);
            y = root(y);
            if(x != y) {
                if(tree[x] < tree[y]) {
                    x ^= y; y ^= x; x^= y;
                }
                tree[x] += tree[y];
                tree[y] = x;
                num--;
            }
        }
        // decide if x and y belong to the same set
        boolean find(int x, int y) {
            return root(x) == root(y);
        }
        int root(int x) {
            return tree[x] < 0 ? x : (tree[x] = root(tree[x]));
        }
        // return size of the set contains x
        int size(int x) {
            return -tree[root(x)];
        }
        // return the number of sets
        int getNum() {
            return num;
        }
    }
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cerr <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}


using namespace std;

int main() {
	char s[20];
	scanf("%s", s);
	bool same = true;
	int k = strlen(s);
	FOR(i,1,k) if (s[i] != '9') same = false;
	printf("%d\n", (k-1)*9+(s[0]-'0')-1+ ( same ? 1 : 0));
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

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

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

    int sp = n % 2 == 0 ? 1 : 2;

    ll dp[n][sp+1];
    fill(&dp[0][0], &dp[n][0], -3e14);
    for (int i = 0; i < n; i++) {
        if (i <= sp) {
            dp[i][i] = a[i];
        }
        for (int j = 0; j <= sp; j++) {
            for (int k = 0; k <= j && i - 2 - (j - k) >= 0; k++) {
                dp[i][j] = max(dp[i][j], dp[i-2-(j-k)][k] + a[i]);
            }
        }
    }

    ll ans = -3e14;
    for (int j = 0; j <= sp && n - 1 - j >= 0; j++) {
        ans = max(ans, dp[n-1-sp+j][j]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8660
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextDouble();
        double m = sc.nextDouble();
        double kaku = 0;
        double ans;
        kaku = ((h + m / 60) * 30 ) - m * 6;
        if(kaku > 180){
         kaku = 360 - kaku; 
        }
        
        ans = a * a + b * b - 2 * a * b * Math.cos(kaku*(Math.PI/180));
        ans = Math.sqrt(ans);
        
      	System.out.println(ans);
 
    }
}

Measured memory_bytes: 37048
N, Y = gets.chomp.split(" ").map(&:to_i)
flag = 0
catch(:hoge) do
  for i in 0..N do
    for j in 0..(N - i) do
      if 10000 * i + 5000 * j + 1000 * (N - i - j) == Y
        puts "#{i} #{j} #{N - i - j}"
        flag = 1
        throw(:hoge)
      end
    end
  end
end
if flag == 0
  puts "-1 -1 -1"
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
struct ka{

int val;
int wt;};
int main() {
	//code

	int N,W;
	    cin>>N>>W;
	    vector<ka>arr(N+1);
	    for(int i=1;i<=N;i++)
	    {
	        cin>>arr[i].wt;
	        cin>>arr[i].val;
	    }

	    ll dp[N+1][W+1];
	    for(int w=0;w<=W;w++)
	    dp[1][w]=0;

	    dp[1][arr[1].wt]=arr[1].val;

	    for(int i=2;i<=N;i++)
	    {
	    for(int w=0;w<=W;w++)
	    {
	    dp[i][w]=dp[i-1][w];
	    if(arr[i].wt <=w)

	    {

dp[i][w]=max(dp[i][w],arr[i].val+dp[i-1][w-arr[i].wt]);	    }
	    }
	    }

    cout<<*max_element(dp[N],dp[N]+W+1);




}


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

const int MAX = 36;

struct Tramp
{
	char suit, value;
};

void BubbleSort(struct Tramp t[], int n) {
	bool flag = true;
	
	
	for (int i = 0; i < n - 1; i++) {
		flag = false;
		for (int j = n - 1; j > i; j--) {
			if (t[j].value < t[j - 1].value) {
				swap(t[j], t[j - 1]);
				flag = true;
			}
		}
		if (!flag) {
			return;
		}
	}

}


void SelectionSort(struct Tramp t[], int n) {
	//int i = 0;
	//int j = 0;
	
	for (int i = 0; i < n; i++) {
		int minj = i;
		for (int j = i; j < n; j++) {
			if (t[minj].value > t[j].value) {
				minj = j;
			}
		}
		if (minj != i) {
			swap(t[i], t[minj]);
		}
	}

}

bool IsStable(const struct Tramp t1[], const struct Tramp t2[], const int n) {
	for (int i = 0; i < n; i++) {
		if (t1[i].suit != t2[i].suit) {
			return false;
		}
	}

	return true;
}

void Output(struct Tramp t[], int n) {
	for (int i = 0; i < n; i++) {
		if (i) cout << ' ';
		cout << t[i].suit << t[i].value;
	}
}

int main() {
	struct Tramp T1[MAX], T2[MAX];
	int n;
	//char ch;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> T1[i].suit >> T1[i].value;
	}

	for (int i = 0; i < n; i++) T2[i] = T1[i];

	BubbleSort(T1, n);
	SelectionSort(T2, n);

	Output(T1, n);
	cout << endl;
	cout << "Stable" << endl;
	Output(T2, n);
	cout << endl;
	if (IsStable(T1, T2, n)) {
		cout << "Stable" << endl;
	}
	else {
		cout << "Not stable" << endl;
	}
}


Measured memory_bytes: 3104
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>

#define X first
#define Y second
#define PB push_back

using namespace std;

typedef long long ll;
typedef pair < int, int > pii;
typedef vector < int > vi;

const int N = 2e5 + 500;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int LOG = 20;
const int OFF = (1 << LOG);

int A[N], n, P[N], k;

void odradi(){
	memset(P, 0, sizeof(P));
	for(int i = 0;i < n;i++){
		P[max(i - A[i], 0)]++;
		P[min(A[i] + i + 1, n)]--;
	}
	for(int i = 0;i < n;i++){
		if(i) 
			P[i] += P[i - 1];
		A[i] = P[i];
	}
}

int main(){
	scanf("%d%d", &n, &k);
	for(int i = 0;i < n;i++)
		scanf("%d", A + i);
	for(int j = 0;j < k;j++){
		odradi();
		bool nastavi = 0;
		for(int i = 0;i < n;i++)
			nastavi |= (A[i] != n);
		if(!nastavi)
			break; 
	}	
	for(int i = 0;i < n;i++)
		printf("%d ", A[i]);
	printf("\n");	
	return 0;
}

Measured memory_bytes: 3296
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int main(){
	ll a,b;
	scanf("%lld%lld",&a,&b);
	puts(a%500<=b?"Yes":"No");
}

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

int main() {

  int a,b,c,d,e,p,q,i;
p=0;
	cin >>  a >> b;	
	  vector<int> vec(a);
  for (i = 0; i < a; i++) {
    cin >> vec.at(i);
	}
sort(vec.begin(), vec.end());
for (i = 0; i < b; i++) {
  p=p+vec.at(i);
	}
cout << p<< endl;

}

Measured memory_bytes: 3624
N,L=map(int,input().split(" "))
if N<2 or N > 200 or L<-100 or L>100:
	print ('Illegal')
else:
	s=L*N+N*(N+1)/2-N
	e=1-L

	if e<=0:
		e=1
	elif e>N:
		e=N
	s=s-(L+e-1)
	print(int(s))


Measured memory_bytes: 2940
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,t;
cin>>n;
vector<vector<ll>> graph(n);
for(int i=0;i<n-1;i++){
  int a,b;
  cin>>a>>b;
  a--;b--;
  graph[a].push_back(b);
  graph[b].push_back(a);
}
//vector<bool> d1(n,true);
vector<ll> d1(n,-1);
queue<P> q;
q.push(P(0,0));
while(!q.empty()){
    P p=q.front();
    q.pop();
    int now=p.fi,point=p.se;
    d1[now]=point;
    for(int v: graph[now]){
        if(d1[v]!=-1)continue;
        q.push(P(v,point+1));
    }
}
vector<ll> d2(n,-1);
q.push(P(n-1,0));
while(!q.empty()){
    P p=q.front();
    q.pop();
    int now=p.fi,point=p.se;
    d2[now]=point;
    for(int v: graph[now]){
        if(d2[v]!=-1)continue;
        q.push(P(v,point+1));
    }
}
int cnt=0;
for(int i=0;i<n;i++){
    if(d1[i]<=d2[i])cnt++;
}
if(cnt>n/2)cout<<"Fennec"<<endl;
else cout<<"Snuke"<<endl;
}

Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>
#include <map>
#include <time.h>
#include <iomanip>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int dp[2001][2001];

signed main() {
  int n, m;
  cin >> n >> m;

  int s[2001], t[2001];

  rep(i, 0, n) cin >> s[i];
  rep(i, 0, m) cin >> t[i];

  rep(i, 0, n) {
    int cnt = 1;
    rep(j, 0, m) {
      if(s[i] == t[j]) dp[i + 1][j + 1] += dp[i][j] + cnt;
      if(dp[i][j]) dp[i + 1][j] += dp[i][j], cnt += dp[i][j];
      dp[i + 1][j + 1] %= mod;
      dp[i + 1][j] %= mod;
    }
  }
  int ans = 1;
  rep(i, 0, m) ans = (ans + dp[n][i]) % mod;
  rep(i, 0, n + 1) ans = (ans + dp[i][m]) % mod;

  cout << ans << endl;
}


Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793;
const int MAX_N = 2e5;

int d, c[365], s[365][26], t[365], last[26], m;
ll point[365];
map<int, vector<int>> mp;

void input(){
  cin >> d;
  rep(i, 26) cin >> c[i];
  rep(i, d){
    rep(j, 26){
      cin >> s[i][j];
    }
  }
  rep(i, d){
    int k;
    cin >> k;
    k--;
    t[i] = k;
  }
  fill(last, last+26, 0);
  cin >> m;
}

int p_calc(){
  ll res = 0;
  int last[26];
  fill(last, last+26, 0);
  rep(i, d){
    res += s[i][t[i]];
    rep(i, 26) last[i]++;
    last[t[i]] = 0;
    rep(j, 26){
      res -= c[j]*last[j];
    }
  }
    
  return res;
}
  
  
int main(){
  input();
  
  rep(i, m){
    int p, q;
    cin >> p >> q;
    p--;q--;
    t[p] = q;
    cout << p_calc() <<endl;
  }
    
}

  
  
  

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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  if (n == a.size())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define c(n) cin>>n
#define co(n) cout<<n<<endl
using namespace std;

int main(){
  long a,b,c=0,d=-1,e,f,g,h,n,m,mx=0,x,y,ans=0;
  cin>>n>>y;
  rep(i,0,n+1){
    rep(j,0,n-i+1){
      a=n-i-j;
      if(i*1e4+j*5e3+a*1e3==y){
        co(i<<" "<<j<<" "<<a);
        d=y;
        break;
      }
    }
    if(d==y) break;
  }
  if(d!=y) co(-1<<" "<<-1<<" "<<-1);
    
  return 0;
}

Measured memory_bytes: 256
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N = int(sys.stdin.buffer.readline())
A = list(map(int, sys.stdin.buffer.readline().split()))

cum = np.array(A, dtype=int).cumsum().tolist()

left_i = [None] * N
right_i = [None] * N
l = 1
r = 3
ans = INF
# 真ん中の切る位置を決めたとき、左右それぞれの切る位置も決まる
for i in range(2, N - 1):
    while l + 1 < i and abs(cum[l - 1] * 2 - cum[i - 1]) > abs(cum[l] * 2 - cum[i - 1]):
        l += 1
    while r + 1 < N and abs(cum[r - 1] * 2 - cum[i - 1] - cum[N - 1]) > abs(cum[r] * 2 - cum[i - 1] - cum[N - 1]):
        r += 1

    s1 = cum[l - 1]
    s2 = cum[i - 1] - s1
    s3 = cum[r - 1] - s2 - s1
    s4 = cum[N - 1] - s3 - s2 - s1
    ans = min(ans, max(s1, s2, s3, s4) - min(s1, s2, s3, s4))
print(ans)


Measured memory_bytes: 30708
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = 1e9 + 7; constexpr ll LINF = 1ll << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

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

    write((3 * A + B) / 2);
}

Measured memory_bytes: 256
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if x in a and y in a:
  print("Yes")
elif x in b and y in b:
  print("Yes")
elif x in c and y in c:
  print("Yes")
else:
  print("No")


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

typedef pair<double,double> P;

double calc(double x, double l, double _l) {
    double ret = x + sqrt((l + _l) * (l + _l) - (l - _l) * (l - _l));
    return ret;
}

int main() {
    int n;
    cin >> n;
    vector<double> v(n);
    for (auto &i : v) cin >> i;

    vector<double> p;
    p.push_back(0.);
    for (int i = 1; i < n; i++) {
        double x = 0.;
        for (int j = 0; j < i; j++) {
            x = max(x, calc(p[j], v[i], v[j]));
        }
        p.push_back(x);
    }

    double l = 0., r = 0.;
    for (int i = 0; i < n; i++) {
        l = min(l, p[i] - v[i]);
        r = max(r, p[i] + v[i]);
    }

    printf("%.9f\n", r - l);

    return 0;
}

Measured memory_bytes: 3324
#include <stdio.h>
#include <string.h>

int main()
{
    char s[12], t[12];
    scanf(" %s %s", s, t);
    int l = strlen(t);
    t[l-1] = '\0';

    if(strcmp(s, t) == 0)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


Measured memory_bytes: 1660
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
int vec[]={  2,  7, 17, 37, 47, 67, 97,107,127,137,157,167,197,227,257,277,307,317,337,347,367,397,457,467,487,547,557,577,587,607,617,647,677,727,757,787,797,827,857,877,887,907,937,947,967,977,997,1087,1097,1117,1187,1217,1237,1277,1297};
typedef long int li;

int main(){
  int n; cin >>n;
  rep(i,n){
    printf("%d ",vec[i]);
  }
}

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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s;
	bool ans = 0;
	cin >> s;
	for (auto i:s) {
		if (i == '7') ans = 1;
	}
	cout << (ans ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h> 
using namespace std;
#define ll long long
int n;
deque<ll> a;


int main(){
	cin >> n;
	for(int i= 0;i<n;++i){
		int x;
		cin >> x;
		a.push_back(x);
	}
	ll l = 0,r = 0;
	while(!a.empty()){
		if (l<r){
			l+= a.front();
			a.pop_front();
		}else{
			r+= a.back();
			a.pop_back();
		}
	}
	cout << abs(l-r) << endl;
}


Measured memory_bytes: 1920
while True:
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=='?':
        break
    if op=='+':
        print(a+b)
    if op=='-':
        print(a-b)
    if op=='*':
        print(a*b)
    if op=='/':
        print(a//b)


Measured memory_bytes: 5592
using System;
using System.Collections.Generic;
using System.Text;

class TEST{
	static void Main(){
		while(true){
			String[] S=new String[3];
			S[0]=Console.ReadLine();
			if(S[0]=="-")break;
			S[1]=Console.ReadLine();
			S[2]=Console.ReadLine();
			Sol mySol=new Sol(S);
			mySol.Solve();
		}
	}
}

class Sol{
	String[] S;
	public Sol(String[] s_){
		S=s_;
	}
	
	
	public void Solve(){
		int[] p=new int[2];
		int pd=0;//下のポインタ
		int pr=0;
		
		char[] Ans=new char[S[1].Length];
		
		int ul=1;//上か左か
		p[0]=0;p[1]=0;
		
		while(pr<Ans.Length){
			if(S[ul][p[ul]]==S[2][pd]){
				if(ul==1){p[ul]++;ul=0;
				}else {p[ul]++;}
				
				if(pd<S[2].Length-1)pd++;
			}else{
				Ans[pr]=S[ul][p[ul]];
				pr++;
				
				if(ul==0){p[ul]++;ul=1;
				}else{p[ul]++;}
			}
		}
		Console.WriteLine(new String(Ans));
	}
}

Measured memory_bytes: 5296
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF (int)1e9
#define MOD 0
//#define int ll
using namespace std;
typedef vector<int> vi;

signed main(){
    ll a[6],n,ch;
    ll ans = 0;
    cin >> n;
    rep(i,5) {
        cin >> a[i];
    }
    rep(i,5) {
        if(i == 0) {
            ch = 0;
            ans += n/a[0]; 
            if(n%a[0] != 0) {
                ans++;    
            }
        } else {
            if(a[i] >= a[ch]) {
                ans += 1;
            } else {
                ans += 1 + n/a[i] - n/a[ch];
                if(n%a[i] != 0) ans++;
                if(n%a[ch] != 0) ans--;
                ch = i;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
s = str(input())

if s == 'SAT':
    print('1')
elif s == 'FRI':
    print('2')
elif s == 'THU':
    print('3')
elif s == 'WED':
    print('4')
elif s == 'TUE':
    print('5')
elif s == 'MON':
    print('6')
elif s == 'SUN':
    print('7')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#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()
const int INF=1000000001;
const double PI=3.141592653589;
const ll LMAX=1000000000000001;


int main(){
  int n; cin>>n;
  vector<string> s(n);
  vector<int> a(n);
  string S;
  rep(i,n) cin>>s[i]>>a[i];
  cin>>S;
  int ans=0;
  bool f=0;
  rep(i,n){
    if(f){
      ans+=a[i];
    }
    if(s[i]==S) f=1;
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
a,b=map(int,input().split())
i=1

while True:
  p=i*8//100
  q=i//10
  if p==a and q==b:
    break
  i+=1
  if i>=(a+1)*13 and i>(b+1)*10:
    print(-1)
    exit()
print(i)

Measured memory_bytes: 3064