akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 5005;
const int P = 1e9 + 7;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
void update(int &x, int y) {
	x += y;
	if (x >= P) x -= P;
}
int power(int x, int y) {
	if (y == 0) return 1;
	int tmp = power(x, y / 2);
	if (y % 2 == 0) return 1ll * tmp * tmp % P;
	else return 1ll * tmp * tmp % P * x % P;
}
int dp[MAXN][MAXN];
int main() {
	int n, m; read(n), read(m);
	for (int i = 1; i <= m; i++)
		dp[0][i] = 1;
	for (int i = 1; i <= n; i++) {
		int sum = 0;
		for (int j = 1; j <= m; j++) {
			update(dp[i][j], 1ll * dp[i - 1][j] * (j + 1) % P);
			update(dp[i][j], sum);
			sum = (2ll * sum + 1ll * dp[i - 1][j] * j) % P;
		}
	}
	
	cout << dp[n][m] << endl;
	return 0;
}


Measured memory_bytes: 101320
#include<iostream>

int main(){

  int h, w;
  while(1){
    std::cin >> h >> w;
    if(h == 0 && w == 0) break;

    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
	if(i == 0 || i == h-1){
	  std::cout << '#';
	}else if (j == 0 || j == w -1){
	  std::cout << '#';
	}else{
	  std::cout << '.';
	}
      }
      std::cout << std::endl;
    }
    std::cout << std::endl;
  }
  return 0;
}

Measured memory_bytes: 3000
#!/usr/bin/env python3
import sys
import math

def solve(R: int):

    print(R*math.tau)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9176
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);

		int X = sc.nextInt();
		int Y = sc.nextInt();

		for (int a=0; a <= X; a++) {
			int ans = a * 2 + (X - a) * 4;
			if (ans == Y) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

	private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}

Measured memory_bytes: 32724
def main():
    ans = [-1, -1, -1]
    N,M = map(int, input().split())

    acc = True

    for i in range(M):
        s,c = map(int, input().split())
        if ans[s-1] != -1 and ans[s-1] != c:
            acc = False
            break
        ans[s-1] = c

    if acc == False:
        print(-1)
        return

    for i in range(0,1000):
        a1 = i//100
        a2 = (i%100)//10
        a3 = (i%10)

        if N == 1:
            if a3 != ans[0] and ans[0] != -1:
                continue
        elif N == 2:
            if (a2 != ans[0] and ans[0] != -1) or (a3 != ans[1] and ans[1] != -1):
                continue
        else:
            if ans[0] != -1:
                if a1 != ans[0]:
                    continue
            if ans[1] != -1:
                if a2 != ans[1]:
                    continue
            if ans[2] != -1:
                if a3 != ans[2]:
                    continue

        if len(str(i)) != N:
            continue

        print(i)
        return

    print(-1)

main()

Measured memory_bytes: 38384
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

using ld=long double;

vector<long long int> divisor(long long int n) {
	vector<long long int> res;
	for (long long int i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			res.push_back(i);
			if (i * i != n) res.push_back(n / i);
		}
	}
	sort(begin(res), end(res));
	return res;
}

int get_sa(string a, string b) {
	int asize(a.size());
	bool flag=false;
	bool rev_flag=false;
	{
		for (int i = 0; i < asize; ++i) {
			if (a[i] == b[i])continue;
			else {
				if (i >= asize - 3) {
					int anum=stoi(a.substr(i));
					int bnum=stoi(b.substr(i));
					return bnum-anum;
				}
				else {
					return 10000;
				}
			}
		}
	}

	return 0;
}

int main() {	
	string st;cin>>st;
	if (st.size() == 2) {
		cout<<abs(st[0]-st[1])<<endl;
		return 0;
	}
	int N(st.size());
	int ans=8;
	{
		vector<vector<vector<int>>>dp(N + 1, vector<vector<int>>(20, vector<int>(20)));
		dp[0][0][19] = 1;
		for (int l = 0; l < N; ++l) {
			for (int ma = 0; ma < 20; ++ma) {
				for (int mi = 0; mi < 20; ++mi) {
					if (!dp[l][ma][mi])continue;
					for (int use = 1; use <= 2; ++use) {
						if (l + use>N)continue;
						else {
							int num = stoi(st.substr(l, use));
							if (num >= 20)continue;
							dp[l + use][max(ma, num)][min(mi, num)] = true;
						}
					}
				}
			}
		}
		for (int ma = 0; ma < 20; ++ma) {
			for (int mi = 0; mi < 20; ++mi) {
				if (dp[N][ma][mi]) {
					ans = min(ans, ma - mi);
				}
			}
		}
	}
	auto divs(divisor(N));
	for (auto div : divs) {
		if(div==N)continue;
		int nans=0;
		vector<int>v(1,0);
		for (int i = 0; i < N / div-1; ++i) {
			string sta=st.substr(i*div,div);
			string stb=st.substr((i+1)*div,div);
			int sa=get_sa(sta,stb);
			if (abs(sa) > 10) {
				v.clear();
				break;
			}
			else {
				v.push_back(v.back()+sa);
			}
		}
		if (!v.empty()) {
			ans=min(ans,*max_element(v.begin(),v.end())-*min_element(v.begin(),v.end()));
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 241276
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <vector>
#include <map>
#include<cstdio>
#include<functional>
#include <bitset>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define ll long long
using namespace std;
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;

int main()
{
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	ll ans = 0;
	ans = a * c;
	ans = max(ans, a * d);
	ans = max(ans, b * c);
	ans = max(ans, b * d);
	cout << ans << endl;
	//cout << fixed << setprecision(10) << ans << endl;
	system("pause");
}



Measured memory_bytes: 3696
# r * g * bを計算する
# その中からj-i = k-j を満たすものを引く
# 2j = i + k
n = gets.chomp.to_i
# s = gets.chomp.chars
s = gets.chomp

h = Hash.new(0)

c_map = {
    'R' => 0,
    'G' => 1,
    'B' => 2
}


s.each_char do |c|
  h[c_map[c]] += 1
end

ans = h[0] * h[1] * h[2]

0.upto(n-2) do |i|
  i.upto(n-1) do |j|
    k = 2 * j - i
    next if k >= n

    ans -= 1 if s[i] != s[j] && s[j] != s[k] && s[k] != s[i]
  end
end

p ans

Measured memory_bytes: 14316
#include <iostream>
using namespace std;
int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int counter=0;
    for (int i=a;i<=b;i++) {
        if (c%i == 0) {
            counter++;
        }
    }
    printf("%d\n", counter);
}


Measured memory_bytes: 3216
#include "bits/stdc++.h"

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

int n, m;
int K[20];
vector<int> s[20];
int p[20];

int ans;

int main(void){
	cin>>n>>m;
	for (int i = 0; i < m; i++) {
		cin>>K[i];
		for (int j = 0; j < K[i]; j++) {
			int x; cin>>x; x--;
			s[i].push_back(x);
		}
	}
	for (int i = 0; i < m; i++) cin>>p[i];

	for (int i = 0; i < (1 << n); i++) {
		bool can = true;
		for (int j = 0; j < m; j++) {
			int cnt = 0;

			for (int k = 0; k < K[j]; k++) {
				if (i & (1 << s[j][k])) cnt++;
			}

			if (cnt % 2 != p[j]) can = false;
		}

		if (can) ans++;
	}

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

Measured memory_bytes: 256
N,M = map(int, input().split())

St = [list(map(int, input().split())) for _ in range(N)]
Pt = [list(map(int, input().split())) for _ in range(M)]

for a,b in St:
    dis = [abs(a-c) + abs(b-d) for c,d in Pt]
    print(dis.index(min(dis)) + 1)

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int N;
    cin >> N;
    vector<int>A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<int>l(N);
    vector<int>r(N);
    l[0] = A[0]; r[N-1] = A[N-1];
    for(int i = 1; i < N; i++) {
        l[i] = __gcd(l[i-1],A[i]);
        r[N-i-1] = __gcd(r[N-i],A[N-i-1]);
    }
    int ans = 0;
    for(int i = 0; i < N; i++) {
        if(i == 0) {
            ans = max(ans,r[1]);
        }
        else if(i+1 == N) {
            ans = max(ans,l[i-1]);
        }
        else {
            ans = max(ans,__gcd(r[i+1],l[i-1]));
        }
    }
    cout << ans << endl;
}

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

long N, M;
vector<long> L;
vector<long> X;

int main(){
    scanf("%ld%ld", &N, &M);
    long x;
    for(int i=0; i<M; i++){
        scanf("%ld", &x);
        X.push_back(x);
    }
    if(M<=N){
        printf("%d\n", 0);
        return 0;
    }
    sort(X.begin(), X.end());
    long sum = 0;
    for(long i=0;i<M-1; i++){
        L.push_back(X[i+1]-X[i]);
    }
    sum = *(X.end()-1) - *X.begin();
    sort(L.begin(), L.end(), greater<long>());
    for(long i=0; i<N-1; i++){
        sum -= L[i];
    }
    printf("%ld", sum);
}


Measured memory_bytes: 2548
#include <iostream>
#include <cstring>

const int MAXN = 100001;

int N;
int ret = 0;
int counter[MAXN];

int main() {
    std::cin >> N;
    memset(counter, 0, sizeof(counter));
    for (int i = 0;i < N;i ++) {
        int v;
        std::cin >> v;
        if (v > N) ret ++;
        else {
            counter[v] ++;
        }
    }
    for (int i = 1;i <= N;i ++) {
        if (counter[i] >= i) ret += counter[i] - i;
        else ret += counter[i];
    }
    std::cout << ret << std::endl;
    return 0;
}

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

#define MODSIZE 1000000007

ll reppow(ll x,ll n){
  ll res = 1;

  while(n > 0){
    if(n & 1) res = res*x % MODSIZE;
    x = x*x % MODSIZE;
    n >>= 1;
  }

  return res;
}

int main(){
  ll n,k;
  int i,j;
  ll ans;

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

  ll t1,t2;
  ll X,Y;

  for(i = 1;i <= k;i++){
    ll r = n - k + 1;
    X = 1; Y = 1;

    for(j = 0;j < i;j++){
      X = X*(r - j) % MODSIZE;
      Y = Y*(j + 1) % MODSIZE;
    }

    Y = reppow(Y,MODSIZE - 2);

    t1 = X*Y % MODSIZE;

    r = k - 1;
    X = 1; Y = 1;
    for(j = 0;j < i - 1;j++){
      X = X*(r - j) % MODSIZE;
      Y = Y*(j + 1) % MODSIZE;
    }

    Y = reppow(Y,MODSIZE - 2);

    t2 = X*Y % MODSIZE;

    ans = t1*t2 % MODSIZE;

    printf("%lld\n", ans);
  }

  return 0;
}

Measured memory_bytes: 256
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;

int main() {
	int N;
	cin >> N;
	if (N % 2 == 0)cout << N << endl;
	else cout << N * 2 << endl;

	return(0);
}

Measured memory_bytes: 256
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	result := []string{}
	count := 0

	for i := 1; scanner.Scan(); i++ {
		if err := scanner.Err(); err != nil {
			// エラー処理
			break
		}
		if i == 1 {
			data := fmt.Sprint(scanner.Text())
			data_format := strings.Split(data, "")
			for k := 0; k < len(data_format); k++ {
				moji := fmt.Sprint(data_format[k])
				result = append(result, moji)
			}
			
		}
		break
	}

	for k := 0; k < len(result); k++ {
		for i := 0; i < len(result); i++ {
			if result[k] == result[i] {
				count = count + 1
			}
		}
		if count > 1 {
			fmt.Println("no")
			break
		}
		if k == len(result) - 1 {
			fmt.Println("yes")
			break
		}
		count = 0
	}


}

Measured memory_bytes: 640
#include <iostream>

using namespace std;
int main()
{
    int N;
    int a;
    int b;
    int c;
    cin >> a;
    cin >> b;
    cin >> c;
    
    if( a > b ){
        N = a;
        a = b;
        b = N;
    }
    
    if( b > c ){
        N = b;
        b = c;
        c = N;
        if( a > b ){
            N = a;
            a = b;
            b = N;
        }
    }
    
    cout << a << " " << b << " " << c << endl;
}

Measured memory_bytes: 3092
import java.util.Arrays;
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 = new int[a];
        Long total = (long) 0;
        for(int i = 0; i < a; i++) {
            b[i] = sc.nextInt();
            total += b[i];
        }
        int max = Arrays.stream(b).max().getAsInt();
        int min = Arrays.stream(b).min().getAsInt();
        //long total = Arrays.stream(b).sum();
        System.out.println(min + " " + max + " " + total);
    }

}


Measured memory_bytes: 46236
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

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

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

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

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

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

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

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

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> &str {
    input!{
        source = src,
        n: usize,
        an: [usize; n],
    }

    let an_len = an.len();
    let mut an2 = an;
    an2.sort();
    an2.dedup();

    return if an_len == an2.len() {
        "YES"
    } else {
        "NO"
    };
}


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

int main(){
    ll n, k; cin >> n >> k;
    vector<double> lis(n);
    vector<double> plis(n);
    for(int i = 0; i < n; i++){
        cin >> lis[i];
    }
    double ans = 0;
    double a = 0;
    for(int i = 0; i < n; i++){
        double k = (lis[i] * (lis[i]+1)) / 2;
        plis[i] = k / lis[i];
    }
    for(int i = 0; i < k; i++){
        ans += plis[i];
    }
    double ch = ans;
    for(int i = k; i < n; i++){
        ch = ch - plis[i-k] + plis[i];
        ans = max(ch, ans);
    }
    cout << std::fixed << std::setprecision(15) << ans << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl

ld A, B, V, W, T;

bool solve() {
    if (W >= V) return false;
    return abs(A-B)/(V-W) <= T;
}

int main() {
    cout << fixed << setprecision(15);
    cin >> A >> V >> B >> W >> T;
    YES(solve());
}

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

int main(){
  int h,w,k;
  cin>>h>>w>>k;
  vector<vector<bool>> x(h,vector<bool>(w,false));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      char s;
      cin>>s;
      if(s=='#') {x[i][j]=true;}
    }
  }
  int ans=0;
  for(int i=0;i<(1<<h);i++){
    for(int j=0;j<(1<<w);j++){
      vector<vector<bool>> v(h,vector<bool>(w,false));
      for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
          v[i][j]=x[i][j];
        }
      }
      for(int l=0;l<h;l++){
        if(i&(1<<l)){
          for(int m=0;m<w;m++){
            v[l][m]=false;
          }
        }
      }
      for(int l=0;l<w;l++){
        if(j&(1<<l)){
          for(int m=0;m<h;m++){
            v[m][l]=false;
          }
        }
      }
      int cnt=0;
      for(int l=0;l<h;l++){
        for(int m=0;m<w;m++){
          if(v[l][m]){
            cnt+=1;
          }
        }
      }
      if(cnt==k){
        ans+=1;
      }
    }
  }
  cout<<ans;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<cctype>
using namespace std;

int main(){
char ch;

while(1){
scanf("%c",&ch);
if(isalpha(ch)){
if(islower(ch)) printf("%c",toupper(ch));
else printf("%c",tolower(ch));
}else printf("%c",ch);
if(ch=='\n') break;
}
return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<cctype>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cctype>
#include<cstring>
#include<utility>
#include<cmath>
#include <string>
using namespace std;


int main() {
    int N, K, x[50], y[50];
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
    }

    long long ans = (1LL << 62);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < N; k++) {
                for (int l = 0; l < N; l++) {
                    int count = 0;
                    for (int m = 0; m < N; m++) {
                        if (x[i] <= x[m] && x[j] >= x[m] && y[k] <= y[m] && y[l] >= y[m]) count++;
                    }
                    if (count >= K) {
                        ans = min(ans, 1LL * (x[j] - x[i]) * (y[l] - y[k]));
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
    /* code */
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if(m1 != m2) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

string s;

int main(){
	cin >> s;
	REP(i, s.size()){
		int k = s[i] - 'A';
		k = (k + 23) % 26;
		s[i] = 'A' + k;
	}
	cout << s << endl;
}

Measured memory_bytes: 1180
/**akshaykumar99**/

#include<bits/stdc++.h>
using namespace std;

#define f(i,x,n) for(i=x;i<n;i++)
#define pu push_back           
#define pp pop_back
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int MOD=1e9+7 ;
const long long INF=1e15;
const long long LINF=LLONG_MAX;

typedef long long ll;
typedef long double ld;
typedef vector<ll> lvc;
typedef pair<ll,ll> lpr;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
 
  int n,i;
  cin>>n;
  vector<string> v(n);
  f(i,0,n)
  {
    cin>>v[i];
    sort(all(v[i]));
  }
  map<string,int> m;
  int k=0;
  f(i,0,n)
  {
    if(!m.count(v[i]))
        m[v[i]]=k++;
  }
 // cout<<k<<" ";
  vector<vector<int> > vv(k);
  f(i,0,n)
  {
      vv[m[v[i]]].pu(i);
  }  
  ll ans=0;
  f(i,0,k)
  {
      ans+=(vv[i].size()*(vv[i].size()-1))/2;
  }
  cout<<ans<<endl;

}

Measured memory_bytes: 22144
"use strict";
const main = arg => {
  let N = arg.split("\n")[0].split(" ")[0];
  let rows = arg.split("\n").slice(1, N+1);
  let sortRows = rows.sort();
  let joinSortRows = sortRows.join("");
  console.log(joinSortRows);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7500
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cstdint>
#include <initializer_list>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//const int mod = 1e9+7;
const int N = 6;
char mt[N][N];
int h,w,k;
ll res;
inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

inline int popcount(int x) {
    int cnt = 0;
    while(x) {
        cnt += (x & 1);
        x >>= 1;
    }
    return cnt;
}

void bruteforce() {
    int mxh = (1 << h);
    int mxw = (1 << w);
    for(int i = 0; i < mxh; i ++) {
        for(int j = 0; j < mxw; j ++) {
            int cnt = 0;
            for(int r = 0; r < h; r ++) {
                if(((i >> r) & 1)) continue;
                for(int c = 0; c < w; c ++) {
                    if((j >> c) & 1) continue;
                    cnt += (mt[r][c] == '#'); 
                }
            }
            if(cnt == k) res ++;
        }
    }
}

int main() {
    quickread();
    cin >> h >> w >> k;
    string line;
    for(int i = 0; i < h; i ++) {
        cin >> line;
        for(int j = 0; j < w; j ++) mt[i][j] = line[j];
    }
    bruteforce();
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll a, m;
string s;

int main(){
	cin >> a >> s;
	if(a >= 3200){
		cout << s << endl;
	}
	else{
		cout << "red" << endl;
	}
	
	return 0;
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
char s[3252];
ll dp[3252][3252];

int main(){
  scanf("%d",&n);
  scanf("%s",s);
  dp[0][0] = 1;
  FOR(i,1,n){
    if(s[i-1] == '<'){
      ll sm = 0;
      REP(j,i+1){
        dp[i][j] = sm;
        if(j==i)break;
        sm += dp[i-1][j];
        sm %= MOD;
      }
    }else{
      ll sm = 0;
      FORR(j,0,i+1){
        dp[i][j] = sm;
        if(j==0)break;
        sm += dp[i-1][j-1];
        sm %= MOD;
      }
    }
  }
  ll ans = 0;
  REP(i,n)ans = (ans+dp[n-1][i]) % MOD;
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 76416
import Data.Traversable
import Data.List

main :: IO ()
main = do
  t <- read <$> getLine
  ps <- for [1..t] $ \x ->
    read <$> getLine
  putStrLn . show . solve $ ps

solve :: [Int] -> Int
solve ps =
  let (x:xs) = reverse . sort $ ps
  in x `div` 2 + sum xs


Measured memory_bytes: 508
#include <algorithm>
#include <iostream>
#define rep(S, L) for (int i = S; i < L; ++i)
using namespace std;

int main() {
  int v[3] = {};
  cin >> v[0];
  cin >> v[1];
  cin >> v[2];
  sort(v, v + 2);

  int ans = v[0] * v[1] / 2;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3156
#include <functional>
#include <vector>
#include <iostream>
using namespace std;

int n, m;
vector<int> adj[100100];
pair<int, int> es[100100];
int deg[100100] = {};
bool st[100100] = {}, conn[100100] = {};

void mkst(int i) {
    conn[i] = true;
    for (int e : adj[i]) {
        int j = i^es[e].first^es[e].second;
        if (!conn[j]) { st[e] = true; mkst(j); }
    }
}

void dfs(int i, int p) {
    for (int e : adj[i]) {
        int j = i^es[e].first^es[e].second;
        if (j != p && st[e]) {
            dfs(j, i);
            if (deg[j]&1) {
                swap(es[e].first, es[e].second);
                deg[j]++; deg[i]++;
            }
        }
    }
}

int main() {
    cin >> n >> m;
    if (m % 2) { cout << "-1\n"; return 0; }
    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >> v;
        u--; v--;
        es[i] = {u, v};
        adj[u].push_back(i);
        adj[v].push_back(i);
        deg[u]++;
    }
    mkst(0);
    dfs(0, -1);
    for (int i = 0; i < m; i++) cout << es[i].first+1 << ' ' << es[i].second+1 << endl;
}


Measured memory_bytes: 16000
#include<iostream>
#include<vector>

int main(void){
    int n;
    std::cin >> n;
    std::vector<int> p(n);
    for(int i = 0; i < n; i++){
        std::cin >> p[i];
    }
    int ans = 0;
    for(int i = 1; i < n-1; i++){
        int cnt = 0;
        if(p[i] < p[i+1]) cnt++;
        if(p[i] < p[i-1]) cnt++;
        if(cnt == 1) ans++;
    }
    std::cout << ans << std::endl;
    return 0;
}

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

int main() {
  std::string a;
  cin >> a;
  if(a=="A")cout << 'T' << endl;
  if(a=="T")cout << 'A' << endl;
  if(a=="G")cout << 'C' << endl;
  if(a=="C")cout << 'G' << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>

using namespace std;

struct BINNODE {
	int parent;
	int left;
	int right;

	BINNODE () { // default constructor
		parent=-1;
		left=-1;
		right=-1;
	}
};

void make_node(vector<int>& pre, vector<int>& in, pair<int,int> pre_indx, pair<int,int> in_indx, int parent, vector<BINNODE>& node) {
	int pre_found=pre_indx.first, in_found=in_indx.first;

	node[pre[pre_indx.first]].parent=parent;

	while(pre[pre_indx.first]!=in[in_found]) {
		++in_found;
		++pre_found;
	}

	if(in_found==in_indx.first) {
		node[pre[pre_indx.first]].left=-1;
	} else {
		node[pre[pre_indx.first]].left=pre[pre_indx.first+1];
		make_node(pre,in,{pre_indx.first+1,pre_found},{in_indx.first,in_found-1},pre[0],node);
	}
	if(in_found==in_indx.second) {
		node[pre[pre_indx.first]].right=-1;
	} else {
		node[pre[pre_indx.first]].right=pre[pre_found+1];
		make_node(pre,in,{pre_found+1,pre_indx.second},{in_found+1,in_indx.second},pre[0],node);
	}
	return;
}


void postorderwalk(vector<BINNODE>&node, int root) {
	if(root==-1) return;
	postorderwalk(node,node[root].left);
	postorderwalk(node,node[root].right);
	if(node[root].parent==-1) {
		printf("%d\n",root);
	} else {
		printf("%d ",root);
	}
	return;
}

int main() {
	int n;
	int i;
	int root;
	vector<int> pre,in;
	vector<BINNODE> node;
	scanf("%d",&n);
	node.resize(n+1);
	pre.resize(n);
	in.resize(n);
	for(i=0; i<n; ++i) {
		scanf("%d",&pre[i]);
	}
	for(i=0; i<n; ++i) {
		scanf("%d",&in[i]);
	}
	root=pre[0];
	make_node(pre,in,{0,n-1},{0,n-1},-1,node);
	postorderwalk(node,root);
	return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
using namespace std;

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

  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC088_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int cardAmount = int.Parse(Console.ReadLine());
            string input = Console.ReadLine();
            string[] str = input.Split(' ');
            int[] cardNum = new int[cardAmount];
            for (int i = 0; i < cardAmount; i++)
            {
                cardNum[i] = int.Parse(str[i]);
            }

            Array.Sort(cardNum);
            Array.Reverse(cardNum);

            int AliceCount = 0;
            int BobCount = 0;
            for (int i = 0; i < cardAmount; i += 2)
            {
                AliceCount += cardNum[i];
            }

            for (int i = 1; i < cardAmount; i += 2)
            {
                BobCount += cardNum[i];
            }

            Console.WriteLine(AliceCount - BobCount);
        }
    }
}


Measured memory_bytes: 13140
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <math.h>
#include <vector>
#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <algorithm>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define N 100010
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define inf 1000000007
#define mod 1000000007
#define pii pair <int, int>
#define all(x) x.begin(), x.end()
#define FOR(i, x, y) for (int i = x; i <= y; i++)

using namespace std;

string s;
int n;

set<string>S;
int k;
int main()
{
	cin >> s >> k;
	n = s.length();
//	cout << s.substr(2,3) << "\n";
	FOR (i,1,min(n,100)) {
//		S.insert(s.substr(0,i));
		string t;
		FOR (h,0,i-1)
			t+=s[h];
		S.insert(t);
		FOR (h,i,n-1) {
			reverse(all(t));
			t.pop_back();
			reverse(all(t));
			t+=s[h];
			S.insert(t);
		}
	}

	while (k>1 && !S.empty())
		k--,S.erase(*S.begin());
	cout << *S.begin();
//	for (auto i: S)
//		cout << i << "\n";
}


Measured memory_bytes: 66560
#include <stdio.h>

int main()
{
	int i, N;
	long long a[100001], x;
	scanf("%d %lld", &N, &x);
	for (i = 1; i <= N; i++) scanf("%lld", &(a[i]));
	
	long long ans = 0;
	if (a[1] > x) {
		ans += a[1] - x;
		a[1] = x;
	}
	for (i = 2; i <= N; i++) {
		if (a[i] + a[i-1] > x) {
			ans += a[i] + a[i-1] - x;
			a[i] = x - a[i-1];
		}
	}
	
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 896
n, a, b = map(int, input().split())
s = input()

total_cnt = 0
b_cnt = 0
ans = ["No"]*n

for i in range(n):
    if total_cnt >= a+b:
        break
    if s[i] == "c":
        continue
    if s[i] == "a":
        total_cnt += 1
        ans[i] = "Yes"
    if s[i] == "b":
        b_cnt += 1
        if b_cnt <= b:
            total_cnt += 1
            ans[i] = "Yes"

for i in range(n):
    print(ans[i])


Measured memory_bytes: 4784
/* ***************************************
Author        :Scau.ion
Created Time  :2017/10/08 20:05:12 UTC+8
File Name     :ion.cpp
*************************************** */

#include <bits/stdc++.h>
using namespace std;

#define LL long long
#define ULL unsigned long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<PII>
#define X first
#define Y second
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define IN freopen("in", "r", stdin);
#define OUT freopen("out", "w", stdout);

int main()
{
    IOS;
    char s[100];
    cin>>s;
    int n = strlen(s);
    s[n - 8] = '\0';
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
def f(a, b, c):
    x = sorted([a, b, c])
    if (x[0] == x[1] and x[1] != x[2]) or (x[0] != x[1] and x[1] == x[2]):
        print('Yes')
    else:
        print('No')

a, b, c = map(int, input().split())
f(a, b, c)


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b){
    if(b==0){
        return a;
    }else{
        return gcd(b,a%b);
    }
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
int main(void){
    int n;
    std::cin >> n;
    ll a[3000];
    ll t=0;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        t+=(a[i]-1);
    }
    std::cout << t << std::endl;
}


Measured memory_bytes: 256
n = int(input())
t = [int(x) for x in input().split()]
v = [int(x) for x in input().split()]
tTotal = sum(t)*2
speed = [min(i/2,(tTotal-i)/2) for i in range(tTotal+1)]
#?

start=0
end=0
#iter through segments
for i in range(n):
    end += t[i]*2
    for j in range(tTotal+1):
        speed[j] = min(speed[j], v[i] + max(0, -(j-start)/2, (j-end)/2))
    start = end

print(sum(speed)/2)


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

signed main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3628
import java.util.*;
import java.math.BigInteger;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double pai = Math.PI;
    double a = sc.nextDouble();
    double b = sc.nextDouble();
    double h = sc.nextDouble();
    double m = sc.nextDouble();
    // 時針は分針にも影響されることに注意
    double cosC = Math.cos(Math.abs(30*(h+m/60) - 6*m) / 180 * pai);
    double ansPow = b*b + a*a - 2*a*b*cosC;
    System.out.println(Math.pow(ansPow, 0.5));
  }
}


Measured memory_bytes: 37540
'''
n = int(input())
l = list(map(int, input().split()))

for x in range(0,n)[::-1]:
	print(str(l[x]), end="")
	if x+1:


		print(" ",end ="")
print()
'''

N = int(input())
table = list(map(int,input().split()))

table.reverse()

print(' '.join(map(str,table)))


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

const double PI = acos(-1);

int main() {
  int a, b, h, m; cin >> a >> b >> h >> m;
  double h_rad = double (60 * h + m) / 720 * 2 * PI;
  double m_rad = double (m) / 60 * 2 * PI;
  
  double xh = a * cos(h_rad), yh = a * sin(h_rad);
  double xm = b * cos(m_rad), ym = b * sin(m_rad);
  
  double dx = xh - xm, dy = yh - ym;
  double ans = sqrt(dx * dx + dy * dy);
  
  printf("%.10f\n", ans);
  
  return 0;
}

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

using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

string make( vector<int> a, int N ){

}

int main() {

    int N;
    cin >> N;
    vector<int> array(N);
    string _arr = "";
    string _p = "", _q = "";
    iota(array.begin(), array.end(), 1);
    REP(i, N){
        char p; cin >> p;
        _p += p;
    }
    // cout << _p << endl;
    REP(i, N){
        char q; cin >> q;
        _q += q;
    }
    int a, b, i = 0;
    do{
        _arr = "";
        REP(i, N){_arr += '0' + array[i];}
        i++;
        if(_arr == _p)a = i;
        if(_arr == _q)b = i;
        // cout << _arr << endl;
    }while(next_permutation(array.begin(), array.begin()+N));
    
    cout << abs(a-b) << endl;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int ct[N];
int l[N];
int a[N];
int n,q;
int main(){
    scanf("%d%d",&n,&q);
    iota(l,l+N,0);
    for (int i = 1; i <= n; i++){
        scanf("%d",&a[i]);
        ct[l[a[i]]]++;
        l[a[i]]--;
    }
    for (int i = 1; i <= n; i++){
        //printf("%d -> %d: %d\n",i,i-1,ct[i]);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++){
        if (ct[i] == 0) ans++;
    }
    //printf("now have %d\n",ans);
    while (q--){
        int x,y;
        scanf("%d%d",&x,&y);
        //printf("changing %d %d -> %d\n",x,a[x],y);
        if (l[a[x]] + 1 > 0){
            ct[l[a[x]]+1]--;
            //printf("updated ct[%d]\n",l[a[x]]+1);
            if (ct[l[a[x]]+1] == 0) ans++;
        }
        l[a[x]]++;
        if (l[y] > 0){
            ct[l[y]]++;
            //printf("updated ct[%d] -> %d\n",l[y],ct[l[y]]);
            if (ct[l[y]] == 1) ans--;
        }
        l[y]--;
        a[x] = y;
        //for (int i = 1; i <= n; i++) printf("%d ",a[i]);
        //printf("\n");
        //for (int i = 1; i <= n; i++) printf("%d -> %d\n",i,l[i]);
        //for (int i = 1; i <= n; i++) printf("%d %d\n",i,ct[i]);
        printf("%d\n",ans);

    }
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
	int n;
	cin >> n;
	vector<double> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	double ans = 0;
	for (int i = 0; i < n; i++){
		ans += 1/a[i];
	}
	ans = 1/ans;
	cout << setprecision(20) << ans << '\n';
}

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

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


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    int n; std::cin >> n;
    map<string, int> cnt;
    rep(i, n) {
        string s; std::cin >> s;
        cnt[s]++;
    }
    std::cout << "AC x " << cnt["AC"] << "\n";
    std::cout << "WA x " << cnt["WA"] << "\n";
    std::cout << "TLE x " << cnt["TLE"] << "\n";
    std::cout << "RE x " << cnt["RE"] << "\n";
}


Measured memory_bytes: 3660
# -*- coding: utf-8 -*-
from sys import stdin
input = stdin.readline

X, Y = map(int,input().split())
t = 2*X - Y/2
k = Y/2 - X
if (k >= 0 and t >= 0 and k <= X and t <= X and Y%2 == 0):
    print("Yes")

else:
    print("No")

Measured memory_bytes: 9184
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations, accumulate
from operator import add, mul, sub, itemgetter, attrgetter


import sys
# sys.setrecursionlimit(10**6)
# readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(readline())


def read_int_n():
    return list(map(int, readline().split()))


def read_float():
    return float(readline())


def read_float_n():
    return list(map(float, readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def ep(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.perf_counter()
        ret = f(*args, **kwargs)
        e = time.perf_counter()

        ep(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


@mt
def slv(N, A):
    M = Mod(10**9 + 7)
    def lcm(a, b):
        return a // math.gcd(a, b) * b
    b = reduce(lcm, A)
    ans = 0
    for a in A:
        ans = M.add(ans, M.div(b, a))
    return ans


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()


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

typedef long long ll;
using namespace std;

int main(void){
    int N;
    cin >> N;
    int a[N][2];
    for(int i = 0 ; i < N ; i++)
    {
        cin >> a[i][0] >> a[i][1];
    }
    int Res = 0;
    int iBuf = 0;
     for(int i = 0 ; i < N ; i++)
    {
        if(a[i][0] == a[i][1])
        {
            iBuf++;
        }
        if(Res < iBuf)
            {
                Res = iBuf;
            }
        if(a[i][0] != a[i][1])
        {
            
            iBuf = 0;
        }
        
    }
    if(Res >= 3)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <limits>
#include <queue>
#include <vector>

using namespace std;

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

  int n;
  cin >> n;
  vector<int> a(3 * n);
  for (int i = 0; i < a.size(); i++) {
    cin >> a[i];
  }

  vector<int64_t> left(n + 1);
  {
    priority_queue<int64_t, vector<int64_t>, greater<int64_t>> q;
    for (int i = 0; i < n; i++) {
      left[0] += a[i];
      q.push(a[i]);
    }
    for (int k = n; k < 2 * n; k++) {
      q.push(a[k]);
      left[k + 1 - n] = left[k - n] + a[k] - q.top();
      q.pop();
    }
  }

  vector<int64_t> right(n + 1);
  {
    priority_queue<int64_t, vector<int64_t>> q;
    for (int i = 3 * n - 1; i >= 2 * n; i--) {
      right[n] += a[i];
      q.push(a[i]);
    }
    for (int k = 2 * n - 1; k >= n; k--) {
      q.push(a[k]);
      right[k - n] = right[k + 1 - n] + a[k] - q.top();
      q.pop();
    }
  }

  int64_t ans = numeric_limits<int64_t>::min();
  for (int i = 0; i <= n; i++) {
    ans = max(ans, left[i] - right[i]);
  }
  cout << ans << endl;
  return 0;
}


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

#define ll long long int

int main()
{
    int n;
  cin>>n;
  string str;
  map<string,int>mp;
  for(int i=0;i<n;i++)
  {
    cin>>str;
    mp[str]++;
  }

    cout<<"AC x "<<mp["AC"]<<"\n";
    cout<<"WA x "<<mp["WA"]<<"\n";
    cout<<"TLE x "<<mp["TLE"]<<"\n";
    cout<<"RE x "<<mp["RE"]<<"\n";
  
    
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define mod 998244353
#define SYOU(x) fixed<<setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
using pii=pair<int, int > ;
lol p[100010];
lol q[100010];
lol r[100010];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  lol n,m,k;
  string s,w;
  lol a,b,c,x,y;
  cin >>x>>y>>a>>b>>c;
  priority_queue<pii> que;
  for(int i=0;i<a;i++){
    cin >>p[i];
    que.emplace(p[i],1);
  }
  for(int i=0;i<b;i++){
    cin >>q[i];
    que.emplace(q[i],2);
  }
  for(int i=0;i<c;i++){
    cin >>r[i];
    que.emplace(r[i],3);
  }
  lol ans=0;
  int red=x;
  int gre=y;
  int muu=x+y;
  int kazu=x+y;
  while(1){
    lol e,f;
    e=que.top().fi;
    f=que.top().se;
    que.pop();
    if(f==1){
      if(red!=0){
        red--;
        kazu--;
        ans+=e;
      }else continue;
    }
    if(f==2){
      if(gre!=0){
        gre--;
        kazu--;
        ans+=e;
      }else continue;
    }
    if(f==3){
      if(muu!=0){
        muu--;
        kazu--;
        ans+=e;
      }else continue;
    }
    if(kazu==0) break;
  }
  cout <<ans<<'\n';
  return (0);
}


Measured memory_bytes: 8560
n,k=map(int,input().split())
li=list(map(int,input().split()))
kai=[0]
for i in range(1,1001):
  kai.append(kai[i-1]+i)
ka=[0]+[kai[i]/i for i in range(1,len(kai))]
lis=[ka[i] for i in li]

ans=sum(lis[:k])
mx=ans
for i in range(len(li)-k):
  ans-=lis[i]
  ans+=lis[i+k]
  mx=max(ans,mx)
print(mx)


Measured memory_bytes: 32296