akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		while(true) {
			int n = in.nextInt();
			if (n == 0) break;
			int[] a = new int[n];

			for (int i=0; i<n; i++) {
				a[i] = in.nextInt();
			}

			out.println(requireMaxSubarray(a));
		}
	}

	public static int requireMaxSubarray(int[] a) {
		int n = a.length;
		int res = a[0], max = a[0];
		for (int i=1; i<n; i++) {
			max = Math.max(a[i], max+a[i]);
			res = Math.max(res, max);
		}
		return res;
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 35436
N = int(input())
a = list(map(int,input().split()))
av = sum(a)//N
ans1 = []
ans2 = []
for i in range(N):
    ans1.append((a[i]-av)**2)
    ans2.append((a[i]-av-1)**2)

print(min(sum(ans1),sum(ans2)))

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

int n , rk[123456];

struct base {
    int w ;
    bool used ;
    int pos ; 
} rt[123456] ; 

int cmp(base x,base y) {
    return x.w<y.w ; 
}

int main() {
    scanf( "%d" , &n ) ;
    bool all0 = 0 ; 
    for ( int i = 1 ; i <= n ; i++ ) {
	scanf( "%d" , &rt[i].w ) ;
	rt[i].pos = i ;
	all0 |= rt[i].w > 0 ;
    }
    
    sort( rt+1 , rt+n+1 , cmp ) ;

    for ( int i = 0 ; i <= n+1 ; i++ ) {
	rt[i].used = false ;
	rk[rt[i].pos] = i ;
    }  

    int ans = 0 , answer = all0 , getMore = 0 ; 
    
    for ( int i = 1 ; i <= n ; i++ ) {
	rt[i].used = true ; ans++ ;
	if ( rt[i].pos == 1 ) getMore++ ;
	if ( rt[i].pos == n ) getMore++ ; 	
	if ( rt[rk[rt[i].pos-1]].used ) {
	    ans-- ; 
	}
	if ( rt[rk[rt[i].pos+1]].used ) {
	    ans-- ; 
	}
	if ( rt[i+1].w > rt[i].w || i == n ) answer = max( answer , 1+ans-getMore ) ;
    }

    printf( "%d\n" , answer ) ;
}


Measured memory_bytes: 4836
L, R = (int(x) for x in input().split())
 
min = 2020

counter1 = 0
counter2 = 0

for i in range(L, R):
    counter1 += 1
    if counter1 > 20190:
        break
    for j in range(i + 1, R + 1):
        counter2 += 1
        if counter2 > 20190:
            break
        i_ = i % 2019
        j_ = j % 2019
        mod_ij = i_ * j_ % 2019
        if min > mod_ij:
            min = mod_ij
        
 
print(min)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

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

		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] x = new int[N];
		int distance = 0;
		int right = 0;
		int left = 0;
		int min = Integer.MAX_VALUE;

		for (int i = 0; i < N; i++) {
			x[i] = sc.nextInt();
		}
		
		for (int i = 0; i + K -1 < N; i++) {
			left = x[i];
			right = x[i + K - 1];
			if (Math.abs(right) > Math.abs(left)) {
				distance = Math.abs(right - left) + Math.abs(left);
			} else {
				distance = Math.abs(right - left) + Math.abs(right);
			}
			if (min > distance) {
				min = distance;
			}
		}
		
		//出力
		System.out.println(min);

		sc.close();
	}

}

Measured memory_bytes: 49928
#include <stdio.h>
#include <math.h>
#define N 10000
int isprime(double x);

int main(){
  int num[N],i=0,j,count=0,n;
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    if (scanf("%d",&num[i])==EOF) break;
    count+=isprime((double)num[i]);
    
  }  
    printf("%d\n",count);
    return 0;
  
}

int isprime(double x) {
  int i;
  
  if (x==2)
    return 1;
  if(x< 2|| ((int)x%2)==0)
    return 0;
  
  i=3;
  while((double)i<=sqrt(x)){
    if ((int)x%i==0) return 0;
    i = i+2;
  }
  return 1;
}

Measured memory_bytes: 628
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

N = ii()
A = li()

d_o = defaultdict(int)
d_e = defaultdict(int)

for i in range(N):
    if i % 2:
        d_o[A[i]] += 1
    else:
        d_e[A[i]] += 1

l_d = sorted(list(d_o.items()), key=lambda x:x[1], reverse=True)
l_e = sorted(list(d_e.items()), key=lambda x:x[1], reverse=True)

if l_d[0][0] != l_e[0][0]:
    print(N - l_d[0][1] - l_e[0][1])
elif len(l_d) == len(l_e) == 1:
        print(N - max(l_d[0][1], l_e[0][1]))
elif len(l_d) == 1:
        #ans = min(N - l_d[0][1] - l_e[1][1], N - l_e[0][1])
        #print(ans)
        print(N - l_d[0][1] - l_e[1][1])
elif len(l_e) == 1:
        #ans = min(N - l_d[1][1] - l_e[0][1], N - l_d[0][1])
        #print(ans)
        print(N - l_d[1][1] - l_e[0][1])
else:
    ans = min(N-l_d[1][1]-l_e[0][1], N-l_d[0][1]-l_e[1][1])
    print(ans)

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

using ll = long long;

ll msb(const ll x)
{
    ll bit = 1LL << 59;
    while ((x & bit) == 0)
        bit >>= 1;
    return bit;
}

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

    if (A == B)
    {
        cout << 1 << endl;
        return 0;
    }

    const ll T = msb(A ^ B);
    A &= 2*T - 1;
    B &= 2*T - 1;
    const ll S = B == T ? 1 : 2*msb(B - T);

    // [A, T) union [T, T+S) union [T+A, 2T)
    cout << (S > A ? (2*T-A) : (T+S - A) + (T-A)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,s=0;
	cin>>a>>b>>c;
	if(c<=b)cout<<b+c<<endl;
	else{
		s=2*b,c-=b;
		s+=min(a+1,c);
		cout<<s<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

static const ll INF = 1e+18;

int main()
{
    int N, M, R;
    cin >> N >> M >> R;

    vector<int> r(R);
    for (int i = 0; i < R; ++i) {
        cin >> r[i];
        --r[i];
    }

    sort(begin(r), end(r));

    vector<vector<ll>> d(N, vector<ll>(N, INF));

    for (int i = 0; i < N; ++i) {
        d[i][i] = 0;
    }

    for (int i = 0; i < M; ++i) {
        int A, B, C;
        cin >> A >> B >> C;
        --A;
        --B;

        d[A][B] = C;
        d[B][A] = C;
    }

    for (int k = 0; k < N; ++k) {
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < N; ++j) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

    ll ans = INF;

    do {
        ll sum = 0;

        for (int i = 0; i < R-1; ++i) {
            sum += d[r[i]][r[i+1]];
        }

        ans = min(ans, sum);
    } while (next_permutation(begin(r), end(r)));

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
template <class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return 1;
	}
	return 0;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
int main() {
	ll n, c, k;
	int ans = 0;
	cin >> n >> c >> k;
	vector<ll> t(n);
	rep(i, n) { cin >> t[i]; }
	sort(all(t));
	int lim = 0;
	int cnt = 0;
	rep(i, n) {
		if (cnt == 0) {
			lim = t[i] + k;
		}
		if (lim < t[i]) {
			cnt = 0;
			ans++;
			lim = t[i] + k;
		}
		if (cnt == c) {
			cnt = 0;
			ans++;
			lim = t[i] + k;
		}
		cnt++;
	}
	cout << ans + 1 << endl;
}

Measured memory_bytes: 4056
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)


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

int main()
{
  string S;
  cin >> S;
  for (int i = 0; i < S.size(); i++) {
    for (int j = i; j < S.size(); j++) {
      string tmp = S.substr(0, i) + S.substr(j, S.size() - j);
      if (tmp == "keyence") {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
using System;

namespace KitaSoftKoubouEnshuuMondai
{
    class Program
    {
        static void Main(string[] args)
        {
            
            while (true)
            {
                string[] data = Console.ReadLine().Split(' ');
                int H = int.Parse(data[0]);
                int W = int.Parse(data[1]);

                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) Console.Write('#');
                        else if (j == 0 || j == W - 1) Console.Write('#');
                        else Console.Write('.');
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 8876
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;

int city[55];

int main(){
	int a,b;
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>a>>b;
		city[a]++;
		city[b]++;
	}
	for(int i=1;i<=n;i++){
		cout<<city[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <random>
#include <complex>
#include <assert.h>

using namespace std;
typedef long long ll;

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

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

int main() {
	string s; cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

typedef long long ll;

const int N = 50;
ll arr[N + 5];

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin>>n;
	string s;
	cin>>s;
	char c = '@';
	int tot = 0;
	for(int i = 0;i < n;i++) {
		if(c != s[i]) tot++;
		c = s[i];
	}
	cout<<tot<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define io() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); srand(time(NULL));
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

signed main(){
    io();
    int n; cin >> n;
    vector<ll> v(n);
    ll sum = 0, par = 0;
    for(int i = 0; i < n; ++i){
        cin >> v[i];
        sum += v[i];
        i % 2 ? par += (v[i] + v[i]) : i;
    }
    ll first = sum - par;
    cout << first << ' ';
    for(int i = 0; i < n - 1; ++i){
        first = v[i] + v[i] - first;
        cout << first << ' ';
    }
    return 0;
}

Measured memory_bytes: 3956
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        String a = sc.next();
        String b = sc.next();
        for(int i = 0; i < num; i++){
          System.out.print(a.substring(i, i+1) + b.substring(i, i+1));
        }
        System.out.println();
    }
}

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

vector<int> used;
vector<vector<int>> g;

bool dfs( int k ) {
    used[k] = 1;
    for ( int i = 0; i < g[k].size(); i++ ) {
        int p = g[k][i];
        if ( used[p] == 0 ) {
            dfs( p );
        }
    }
    return true;
}

int main() {
    int N, M;
    cin >> N >> M;
    int x,y,z;
    g.resize(N, vector<int>());
    for ( int i = 0; i < M; i++ ) {
        cin >> x >> y >> z;
        x--;
        y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    int cnt = 0;
    used.resize(N);
    for ( int i = 0; i < N; i++ ) {
        if ( used[i] == 0 ) {
            cnt++;
            dfs(i);
        }
    }

    cout << cnt << '\n';
    return 0;
}

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


int main(){
  long long n;
  cin >> n;
  vector<long long> a(n),b(n);
  for(long long i=0;i<n;++i){
    cin >> a[i] >> b[i];
  }
  long long ans=0;
  for(long long i=n-1;i>=0;--i){
    a[i]=a[i]+ans;
    if(a[i]%b[i]==0){
      continue;
    }else{
      ans+=b[i]-(a[i]%b[i]);
    }

  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
import scala.io.StdIn._

object Main extends App {
  val n = readInt()
  val graph = collection.mutable.Seq.fill(n, n)(0)

  for (i <- 1 to n) {
    val input = readLine().split(" ").toList.map(_.toInt)
    val u = input.head - 1
    val k = input(1)
    for (j <- 1 to k) {
      graph(u)(input(1 + j) - 1) = 1
    }
  }

  var foundTime = List.fill(n)(-1)
  var finishedTime = List.fill(n)(-1)

  var time = 0

  def search(id: Int): Unit = {
    for (i <- graph(id).indices) {
      if (graph(id)(i) == 1 && foundTime(i) == -1) {
        time += 1
        foundTime = foundTime.updated(i, time)
        search(i)
      }
    }
    time += 1
    finishedTime = finishedTime.updated(id, time)
  }

  while (foundTime contains -1) {
    time += 1
    val index = foundTime indexOf -1
    foundTime = foundTime.updated(index, time)
    search(index)
  }

  for (i <- graph.indices) {
    println(s"${i + 1} ${foundTime(i)} ${finishedTime(i)}")
  }
}

Measured memory_bytes: 46168
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;

int main()
{
    int n; cin >> n;
    int d[n];
    map<int,int> mpa,mpb;
    for(int i = 0; i < n; i++){
        cin >> d[i];
        mpa[d[i]]++;
    }
    int m; cin >> m;
    int t[m];
    for(int i = 0; i < m; i++){
        cin >> t[i];
        mpb[t[i]]++;
    }
    for(int i = 0; i < m; i++){
        if(mpa[t[i]] < mpb[t[i]]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 20608
#include <iostream>
#include <string>

using namespace std;

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

string s1[32] = {"00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111",
                 "01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111",
                 "10000", "10001", "10010", "10011", "10100", "10101", "10110", "10111",
                 "11000", "11001", "11010", "11011", "11100", "11101", "11110", "11111"};
char c1[32] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', ' ', '.',',','-','\'','?'};

char c2[32] = {' ','\'',',','-','.','?','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
string s2[32] = {"101", "000000","000011","10010001","010001","000001","100101","10011010",
                 "0101","0001","110","01001","10011011","010000","0111","10011000",
                 "0110","00100","10011001","10011110","00101","111","10011111","1000",
                 "00110","00111","10011100","10011101","000010","10010010","10010011","10010000"};

string solve(string s){
    string t;
    for(char c:s){
        rep(i,32)if(c == c1[i]) t += s1[i];
    }
    string ans;
    string temp;
    for(char c:t){
        temp += c;
        if(temp.size()<3) continue;
        rep(i,32){
            if(temp == s2[i]){
                ans += c2[i];
                temp = "";
            }
        }
    }
    return ans;
}

int main(){
    string s;
    while(getline(cin,s)){
        cout << solve(s) << endl;
    }
}

Measured memory_bytes: 1196
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

mod util {
    #[allow(dead_code)]
    pub fn chmin<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x > y && {
            *x = y;
            true
        }
    }

    #[allow(dead_code)]
    pub fn chmax<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x < y && {
            *x = y;
            true
        }
    }

    /// 整数除算切り上げ
    #[allow(dead_code)]
    pub fn roundup(a: i64, b: i64) -> i64 {
        (a + b - 1) / b
    }

    #[allow(dead_code)]
    pub fn ctoi(c: char) -> i64 {
        c as i64 - 48
    }
}

#[allow(unused_imports)]
use util::*;

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input! {
        n:usize,ds:[usize;n]
    }

    let mut ans = 0;
    for i in 0..n {
        for j in i+1..n {
            ans += ds[i] * ds[j];
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD  1000000007
#define ll long long
#define int long long
#define INF 1e18
#define ar array
#define MAX 1000004
#define wt(x) int x;cin>>x;while(x--)

typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> pbds;

void  c_p_c(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
 
#ifndef ONLINE_JUDGE
  freopen("input1.txt","r",stdin);
  freopen("output1.txt","w",stdout);
#endif
 
}
ll power(ll a,ll b,int mod){
    a=a%mod;
    if(a==0){
        return 1;
    }
    ll res=1;
    while(b){
        if(b&1){
            res=(res*a)%mod;
        }
        b>>=1;
        a=(a*a)%mod;
    }
    return res;
 }
 

 int32_t main() {

c_p_c();
string  T;
cin>>T;
string s=T;
int n=T.size();
for(int i=0;i<n;i++){
    
     if(T[i]=='?'){
        s[i]='D';
    }

}
cout<<s;
    

return 0;

}
 


   

        



Measured memory_bytes: 3756
let scan_int () = Scanf.scanf " %d" (fun x -> x)
let print_int n = Printf.printf "%d\n" n

module Union_find :
  sig
    type t
    val init  : int -> t
    val get   : t -> int -> int
    val find  : t -> int -> int
    val size  : t -> int -> int
    val unite : t -> int -> int -> unit
    val same  : t -> int -> int -> bool
  end =
  struct
    type t = int array
    let init n = Array.make (n+1) (-1)
    let get data x = data.(x)
    let rec find data x =
      if data.(x) < 0 then x
      else let _ = data.(x) <- find data data.(x) in data.(x)
    let size data x = - data.(find data x)
    let unite data x y =
      let x = find data x and y = find data y in
      if x <> y then
        if data.(x) < data.(y) then
          let _ = data.(x) <- data.(x) + data.(y) in
          data.(y) <- x
        else
          let _ = data.(y) <- data.(x) + data.(y) in
          data.(x) <- y
    let same data x y =
      let x = find data x and y = find data y in (x == y)
  end

let () =
  let n = scan_int() in
  let max_n = 100000 in
  let v = Array.make (max_n+1) [] in
  let uf = Union_find.init max_n in
  let _ =
    for i = 1 to n do
      let a = scan_int() and b = scan_int() in
      v.(a) <- b :: v.(a)
    done in
  let _ =
    for i = 1 to max_n do
      if List.length v.(i) > 1 then
        let f x = Union_find.unite uf (List.hd v.(i)) x in
        List.iter f v.(i)
    done in
  let rec calc arr i ret =
    let ret =
      if List.length v.(i) > 0 then ret + Union_find.size uf (List.hd v.(i))
      else ret in
    if i == max_n then ret
    else calc arr (i+1) ret in
  print_int (calc v 0 (-n))

Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=200005;
const int mod=1e9+7;
const double eps=1e-8;
const double PI = acos(-1.0);
#define lowbit(x) (x&(-x))
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll qpow(ll a,ll b){ll res=1;while(b){if(b&1) res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
ll inv(ll a,ll p){return qpow(a,p-2);}
int main()
{
    std::ios::sync_with_stdio(false);
    string a,b;
    cin>>a>>b;
    int la=a.length(),lb=b.length();
    int i=0,j=0;
    while(i<la&&j<lb)
    {
        cout<<a[i++];
        cout<<b[j++];
    }
    while(i<la)
        cout<<a[i++];
    while(j<lb)
        cout<<b[j++];
    cout<<endl;
    return 0;
}


Measured memory_bytes: 384
import itertools

S = input()
ans = 0
r = len(S) - 1
for t in itertools.product([0, 1], repeat=r):
    lst = [S[0]]
    for i in range(r):
        if t[i]:
            lst.append('+')
        lst.append(S[i + 1])
    ans += eval(''.join(map(str, lst)))
print(ans)


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

int main(){
  int n;
  cin >> n;
  ll a[n];
  rep(i,n) cin >> a[i];
  vector<vector<ll>> dp(n+1,vector<ll>(3,-INF));
  dp[0][1] = 0; dp[1][1] = 0; dp[1][2] = a[0];
  for(int i = 2; i <= n; i++) {
    if(i % 2 == 0) {
      dp[i][0] = dp[i-1][1];
      dp[i][1] = dp[i-1][2];
    } else {
      dp[i][0] = dp[i-1][0];
      dp[i][1] = dp[i-1][1];
    }
    dp[i][0] = max(dp[i][0],dp[i-2][0]+a[i-1]);
    dp[i][1] = max(dp[i][1],dp[i-2][1]+a[i-1]);
    dp[i][2] = max(dp[i][2],dp[i-2][2]+a[i-1]);
  }
  cout << dp[n][1] << endl;
  return 0;
}


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

int main()
{
	string S;
	cin >> S;
	if (S == "Sunny")
	{
		cout << "Cloudy" << endl;
	}
	else if (S == "Cloudy")
	{
		cout << "Rainy" << endl;
	}
	else
	{
		cout << "Sunny" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// Still trying to be normal
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e9 + 15;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    if(s=="ABC")cout<<"ARC\n";
    else cout<<"ABC\n";
    return 0;   
}

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

int main(){
	int n;
  double sum = 0;
  cin >> n;
  double A;
  string B;

  for(int i = 0; i < n; i++){
    cin >> A;
    cin >> B;
    if(B == "JPY"){
      sum += A;
    }
    else if(B == "BTC"){
      sum += A * 380000;
    }
  }

  std::cout << sum << '\n';

}


Measured memory_bytes: 768
#if 0
date +%Y.%m.%d

题解先咕着。
#endif
#include <cstdio>
#include <algorithm>
#include <vector>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 300005;
int al[maxn], ar[maxn];
std::vector<int> tor[maxn];
int ans[maxn];

struct Tree {
	int lti, rti;
	int val;
};
#define self pool[now]
#define lt pool[self.lti]
#define rt pool[self.rti]
Tree pool[maxn * 20];
int pp;

void lain(int &now, int L, int R, int p) {
	pool[++ pp] = self;
	now = pp;
	/* debug("%d %d %d %d\n", now, L, R, p); */
	++ self.val;
	if(L == R) return;
	int M = (L + R) >> 1;
	if(p <= M) lain(self.lti, L, M, p);
	else lain(self.rti, M + 1, R, p);
}

int query(int now, int L, int R, int l, int r) {
	if(!now or r < L or l > R) return 0;
	if(l <= L and R <= r) return self.val;
	int M = (L + R) >> 1;
	return query(self.lti, L, M, l, r) + query(self.rti, M + 1, R, l, r);
}

int T[maxn];

int main() {
	int n = read, m = read;

	for(int i = 1; i <= n; i ++) {
		read(al[i], ar[i]);
		tor[al[i]].push_back(ar[i]);
	}

	for(int l = 0; l <= m; l ++) {
		if(l) T[l] = T[l - 1];
		for(int r : tor[l])
			lain(T[l], 0, m, r);
	}

	for(int t = 0; t <= m; t ++)
		for(int d = 1; d <= (t ? m / t : m); d ++) {
			int l = t * d + 1, r = t * d + d;
			/* debug("%d %d : %d %d\n", t, d, l, r); */
			/* for(int i = 1; i <= n; i ++) */
			/* 	if(l <= al[i] and al[i] <= r and ar[i] >= r) */
			/* 		++ ans[d]; */
			ans[d] += query(T[r], 0, m, r, m) - query(T[l - 1], 0, m, r, m);
			/* debug("%d %d\n", query(T[r], 0, m, r, m), query(T[l - 1], 0, m, r, m)); */
		}

	for(int i = 1; i <= m; i ++)
		printf("%d\n", ans[i]);
}


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

int main(void){
  int cnt = 0;
  string s;
  cin >> s;
  for(int i=0;i<s.length();i++){
    if(s[i] == 'o') cnt++;
  }
  cout << 700+100*cnt << endl;
  
  return 0;
}

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

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

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		ArrayList<Integer>[] g = new ArrayList[n];
		for(int i = 0; i < n; i++) g[i] = new ArrayList<>();
		for(int i = 0; i < m; i++){
			st = new StringTokenizer(br.readLine());
			int u = Integer.parseInt(st.nextToken())-1;
			int v = Integer.parseInt(st.nextToken())-1;
			g[u].add(v);
		}
		st = new StringTokenizer(br.readLine());
		int s = Integer.parseInt(st.nextToken())-1;
		int t = Integer.parseInt(st.nextToken())-1;
		int[][] dist = new int[3][n];
		for(int i = 0; i < 3; i++) Arrays.fill(dist[i], -1);
		dist[0][s] = 0;
		LinkedList<Integer> q = new LinkedList<>();
		q.add(s);
		while(!q.isEmpty()){
			int u = q.removeFirst();
			for(int v: g[u]){
				boolean yes = false;
				for(int d = 0; d < 3; d++){
					if(dist[d][u] >= 0 && dist[(d+1)%3][v] < 0){
						dist[(d+1)%3][v] = dist[d][u] + 1;
						yes = true;
					}
				}
				if(yes) q.add(v);
			}
		}
		System.out.println(dist[0][t] >= 0 ? dist[0][t] / 3 : dist[0][t]);
	}
}


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

using vvc = vector<vector<char>>;
using vpii = vector<pair<int, int>>;

vpii next_step(vpii const& step, vvc& a) {
    int const d[][2] = { -1, 0, 1, 0, 0, -1, 0, 1 };
    vpii r;
    for (auto const& x : step) {
        for (auto const& y : d) {
            int i = x.first + y[0], j = x.second + y[1];
            if (a[i][j] == '.') {
                a[i][j] = '#';
                r.emplace_back(i, j);
            }
        }
    }
    return r;
}

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

    int h, w;
    cin >> h >> w;
    vvc a(h + 2);
    vpii step;
    int i = 0;
    a[i].assign(w + 2, '#');
    for (i++; i <= h; i++) {
        a[i].assign(w + 2, '#');
        for (int j = 1; j <= w; j++) {
            cin >> a[i][j];
            if (a[i][j] == '#')
                step.emplace_back(i, j);
        }
    }
    a[i].assign(w + 2, '#');

    int n = h * w - step.size();
    int ans = 0;
    while (n > 0) {
        ans++;
        step = next_step(step, a);
        n -= step.size();
    }

    cout << ans << '\n';

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  map<string, int> vote;
  for(int i = 0; i < n; ++i){
    string s;
    cin >> s;
    ++vote[s];
  }
  vector<string> name(vote.size());
  int count = 0;
  for(auto a : vote){
    if(a.second > count){
      count = a.second;
      name = {};
      name.push_back(a.first);
      continue;
    }
    if(a.second == count) name.push_back(a.first);
  }
  sort(name.begin(), name.end());
  
  for(int i = 0; i < name.size(); ++i){
    cout << name.at(i) << endl;
  }
}

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

int main() {
	int N;
	cin >> N;
	vector<long long int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	long long int output;
	for (int i = 0; i < N; i++) {
		if (A[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}
	output = A[0];
	for (int i = 1; i < N; i++) {
		if (1000000000000000000 / A[i] < output) {
			cout << -1 << endl;
			return 0;
		}
		output *= A[i];
	}

	// printf("%lld\n", output);
	cout << output << endl;

	return 0;
}

Measured memory_bytes: 4056
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

using Graph = std::vector<std::vector<int>>;
using WGraph = std::vector<std::vector<std::pair<int, long long>>>;
using ll = long long;
using namespace std;

int main() {
    int n = 0; cin >> n;
    vector<ll> a(n);
    for (int i=0; i<n; i++) {
        cin >> a.at(i);
    }

    vector<ll> dec(n, -1);
    for (int i=0; i<n; i++) {
        *(lower_bound(dec.rbegin(), dec.rend(), a.at(i)) - 1) = a.at(i);
    }

    for (int i=0; i<n; i++) {
        if (dec.at(i) == -1) {
            cout << i << endl;
            return 0;
        }
    }
    cout << n << endl;
    return 0;
}
 

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void)
{
	char str[30];
	char cYear[5] = { 0 };
	char cMonth[3] = { 0 };
	char cDay[3] = { 0 };

	int iYear;
	int iMonth;
	int iDay;


	if (scanf("%s", str) == EOF) return 0;

	memcpy(cYear, str, 4);
	memcpy(cMonth, str+5, 2);
	memcpy(cDay, str+8, 2);

	iYear = atoi(cYear);
	iMonth = atoi(cMonth);
	iDay = atoi(cDay);

	if ((iYear >= 2019) && (iMonth >= 5)) {
		puts("TBD");
	}
	else
	{
		puts("Heisei");
	}


	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _001_FindingMissingCards
{
    /*
     */

    class Program
    {
        static void Main()
        {

            int[] countAlphabet = new int[26];


            Boolean cont = true;

            while (cont)
            {
                string line = Console.ReadLine();

                if (line == null)
                {
                    cont = false;
                }
                else
                {
                    char[] ca = line.ToLower().ToCharArray();
                    for (int i = 0; i < 26; i++)
                    {
                        countAlphabet[i] += ca.Count(n => n == (char)(i + 97));
                    }
                    
                }
            }
            for (int i = 0; i < 26; i++)
            {
                Console.WriteLine("{0} : {1}",
                    (char)(i + 97),
                    countAlphabet[i]);
            }

        }
    }
}

Measured memory_bytes: 9468
#include<bits/stdc++.h>
#define MAX 220000
#define INF 1<<30
using namespace std;
class Edge{
public:
  int t,w;
  Edge(){}
  Edge(int t,int w):t(t),w(w){}
};
vector<Edge>G[MAX];
int n,d[MAX];
bool vis[MAX];
int cnt;
 
void bfs(int s){
  for(int i=0;i<n;i++)d[i]=INF;
  queue<int>q;
  q.push(s);
  d[s]=0;
  int u;
  while(!q.empty()){
    u=q.front();q.pop();
    for(int i=0;i<G[u].size();i++){
      Edge e=G[u][i];
      if(d[e.t]==INF){
        d[e.t]=d[u]+e.w;
        q.push(e.t);
      }
    }
  }
}
int solve(){
  bfs(0);
  int maxv=0;
  int tgt=0;
  for(int i=0;i<n;i++){
    if(d[i]==INF)continue;
    if(maxv<d[i]){
      maxv=d[i];
      tgt=i;
    }
  }
  bfs(tgt);
  maxv=0;
  for(int i=0;i<n;i++){
    if(d[i]==INF)continue;
    maxv=max(maxv,d[i]);
  }
  return maxv;
}

int dp[222222];

int Grundy(int x){
  int &g=dp[x];
  if(g!=-1)return g;
  if(x==0)return g=0;
  set<int>V;
  if(x>=1)V.insert(Grundy(x-1));
  if(x>=2)V.insert(Grundy(x-2));
  g=0;
  while(V.count(g))++g;
  return g;
}

int main(){
  memset(dp,-1,sizeof(dp));
  int s,t,w;
  cin>>n;
  for(int i=0;i<n-1;i++){
    scanf("%d%d",&s,&t); s--; t--;
    w=1;
    G[s].push_back(Edge(t,w));
    G[t].push_back(Edge(s,w));
  }
  int A=solve();
  A++;
  A=Grundy(A);
  //cout<<A<<endl;
  for(int i=0;i<=100;i++){
    //cout<<i<<' '<<Grundy(i)<<endl;
  }
  if(A!=2)cout<<"First"<<endl;
  else cout<<"Second"<<endl;
}

Measured memory_bytes: 35200
#ABC073-C
from collections import Counter
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
  
cnt = 0
c = Counter(a)
for i in c.values():
    if i % 2 == 0:
        continue
    else:
        cnt += 1
        
print(cnt)

Measured memory_bytes: 16636
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

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

Node *root, *NIL;   // 宣言時ポインタにはNULL(0x0)が入っているため, 木の根が設定されていなければroot == NILとなる.

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while (x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z->parent = y;
    if (y == NIL) {
        root = z;
    } else {
        if (z->key < y->key) {
            y->left = z;
        }
        else {
            y->right = z;
        }
    }
}

Node * find(Node *u, int k) {
    while (u != NIL && k != u->key) {
        if (k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}

void deleteNode(int k) {
    Node *y;
    Node *z = find(root, k);
    if (z->left == NIL && z->right == NIL) {
        if (z->parent->left == z) z->parent->left = NIL;
        else z->parent->right = NIL;
        free(z);
    } else if (z->left != NIL && z->right == NIL) {
        if (z->parent->left == z) z->parent->left = z->left;
        else z->parent->right = z->left;
        z->left->parent = z->parent;
        free(z);
    } else if (z->left == NIL && z->right != NIL) {
        if (z->parent->left == z) z->parent->left = z->right;
        else z->parent->right = z->right;
        z->right->parent = z->parent;
        free(z);
    } else {
        y = z->right;
        while (y->left != NIL) y = y->left;
        z->key = y->key;
        if (y->parent->left == y) y->parent->left = NIL;
        else y->parent->right = NIL;
        free(y);
    }
}

void inorder(Node *u) {
    if (u == NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if (u == NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int n, i, x;
    string com;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        cin >> com;
        if (com == "insert") {
            scanf("%d", &x);
            insert(x);
        } else if (com == "print") {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        } else if (com == "find") {
            scanf("%d", &x);
            Node *t = find(root, x);
            if (t != NIL) printf("yes\n");
            else printf("no\n");
        } else {
            scanf("%d", &x);
            deleteNode(x);
        }
    }

    return 0;
}


Measured memory_bytes: 21976
#include <iostream>
#include <string>
using namespace std;
int main(){
  string s;
  cin >> s;
  int i;
  int st,en;
  for(i=0;i<s.size();i++){
    if(s[i]=='A'){
      st=i;
      break;
    }
  }
  for(i=s.size()-1;i>st;i--){
    if(s[i]=='Z'){
      en=i;
      break;
    }
  }
  //  cout << s.substr(st,en) << "\n";
  cout << en-st+1 << "\n";
  return 0;
}

Measured memory_bytes: 3680
#include <stdio.h>

int main(void){
	int a, b;
	scanf("%d %d", &a, &b);
	if(a <= 5)printf("%d\n", 0);
	else if(a <= 12) printf("%d\n", b / 2);
	else printf("%d\n", b);
	return 0;
}


Measured memory_bytes: 128
import math
from itertools import accumulate


def is_prime(n):
    if n == 1:
        return 0

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return 0

    return 1


Q = int(input())
L = [0]*Q
R = [0]*Q

for i in range(Q):
    L[i], R[i] = list(map(int, input().split()))

min_L = min(L)
max_R = max(R)

check = []
for i in range(min_L, max_R+1):
    if (i % 2 == 1):
        flg = (is_prime(i) and is_prime((i+1)/2))
    else:
        flg = 0
    check.append(flg)

# 累積和
check = [0] + check
check = list(accumulate(check))

for i in range(Q):
    print(check[R[i] - min_L + 1] - check[L[i] - min_L])


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

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

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

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        if(i%2){
            if(s[i] == 'R') {
                puts("No");
                return 0;
            }
        }else {
            if(s[i] == 'L'){
                puts("No");
                return 0;
            }
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 256
N=int(input())
l=len(str(N))

def calc(st):
    st=str(st)
    if(len(st)>l):return 0
    t=calc(st+"3")
    f=calc(st+"5")
    s=calc(st+"7")
    o=0
    if(st.find("7")>=0 and st.find("5")>=0 and st.find("3")>=0 and int(st)<=N):
        o=1
    return (t+f+s+o)

print(calc(str()))







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

using namespace std;

template <typename T>
struct SegmentTree {
private:
	size_t n;
	vector<T> node;
	T M0;

public:
	SegmentTree(const vector<T>& v, T m0) {
		M0 = m0;
		n = 1;
		while (n < v.size()) { n *= 2; }
		node.assign(2*n - 1, M0);

		for (int i = 0; i < v.size(); ++i) {
			node[n - 1 + i] = v[i];
		}
		for (int i = n - 2; i >= 0; --i) {
			node[i] = merge(node[2*i + 1], node[2*i + 2]);
		}
	}

	T merge(T a, T b) { return a + b; }

	void update(int x, T val) {
		x += (n - 1);
		node[x] = val;
		while (x > 0) {
			x = (x - 1) / 2;
			node[x] = merge(node[2*x + 1], node[2*x + 2]);
		}
	}

	T query(int a, int b, int k=0, int l=0, int r=-1) {
		if (r < 0) { r = n; }
		if ((r <= a) || (b <= l)) { return M0; }
		if ((a <= l) && (r <= b)) { return node[k]; }

		T vl = query(a, b, 2*k + 1, l, (l + r) / 2);
		T vr = query(a, b, 2*k + 2, (l + r) / 2, r);
		return merge(vl, vr);
	}
};

int main() {
	int N, Q;
	string s;
	cin >> N >> s >> Q;
	vector<int> ans;
	vector<SegmentTree<int>> seg(30, SegmentTree<int>(vector<int>(N + 1, 0), 0));
	for (int i = 0; i < s.size(); ++i) {
		seg[(int)(s[i] - 'a')].update(i, 1);
	}
	for (int q = 0; q < Q; ++q) {
		int a;
		cin >> a;
		if (a == 1) {
			int b;
			char c;
			cin >> b >> c;
			--b;
			int idx = c - 'a';
			for (int i = 0; i < 30; ++i) {
				if (i == idx) {
					seg[i].update(b, 1);
				} else {
					seg[i].update(b, 0);
				}
			}
		} else {
			int l, r;
			cin >> l >> r;
			int cnt = 0;
			for (int i = 0; i < 30; ++i) {
				if (seg[i].query(l - 1, r) > 0) { ++cnt; }
			}
			ans.emplace_back(cnt);
		}
	}
	for (int v : ans) { cout << v << endl; }

	return 0;
}


Measured memory_bytes: 129924
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int h,t;
    scanf("%d%d",&h,&t);
    int cha=h*4-t;
    if(cha%2==0&&(0<=cha/2&&cha/2<=h)) puts("Yes");
    else puts("No");
    return 0;
}


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

using namespace std;

const int INF = 1e9;

int dfs(int used, int asum, int bsum, int csum, int N, int A, int B, int C, vector<int> l) {
    if (used == N) {
        if (min({asum, bsum, csum}) > 0) return abs(asum - A) + abs(bsum - B) + abs(csum - C) - 30;
        else return INF;
    } else {
        int next_n = dfs(used + 1, asum, bsum, csum, N, A, B, C, l);
        int next_a = dfs(used + 1, asum + l[used], bsum, csum, N, A, B, C, l) + 10;
        int next_b = dfs(used + 1, asum, bsum + l[used], csum, N, A, B, C, l) + 10;
        int next_c = dfs(used + 1, asum, bsum, csum + l[used], N, A, B, C, l) + 10;
        return min({next_n, next_a, next_b, next_c});
    }
}

int main() {
    int N, A, B, C;
    cin >> N >> A >> B >> C;
    vector<int> l(N);
    for (int i = 0; i < N; i++) cin >> l[i];

    cout << dfs(0, 0, 0, 0, N, A, B, C, l) << endl;
    return 0;
}

Measured memory_bytes: 256
import kotlin.math.pow
import kotlin.math.sqrt

fun main() {
    val (a, b, h, m) = readLine()!!.split(' ').map { it.toDouble() }
    val d1 = 30 * h + 0.5 * m
    val d2 = 6 * m
    val d = if (d1 > d2) d1 - d2 else d2 - d1
    val r = d * Math.PI / 180
    val c = a.pow(2) + b.pow(2) - Math.cos(r) * 2 * a * b
    println(sqrt(c))
}


Measured memory_bytes: 36664
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int n, a, ans = 0;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> a;
		while(a % 2 == 0)
		{
			++ans;
			a /= 2;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i = 0; i < N; i++) cin >> L[i];
  
  sort(L.begin(),L.end());
  
  int count = 0;
  for (int i = 0; i < N-2; i++) {
    for (int j = i+1; j < N-1; j++) {
      if (L[j+1] >= L[i] + L[j]) count += 0;
      else if (L[N-1] < L[i] + L[j]) count += N-1-j;
      else {
        int Left = j+1;
        int Right = N-1;
        while (Left + 1 != Right) {
          int pivot = Left + (Right - Left) / 2;
          if (L[pivot] >= L[i] + L[j]) Right = pivot;
          else Left = pivot;
        }
        count += Left - j;
      }
    }
  }
  
  cout << count << endl;      
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

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

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define f first
#define s second
#define sz(x) int(x.size())
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> oset;

// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

const int mod = 998244353;
const int inf = 9e18;
const int N = 1e5 + 5;

void solve(){
        int i,n;
        cin>>n;
        int ans=2;
        for(i=2;i*i<=n-1;++i){
                if((n-1)%i==0){
                        ++ans;
                        if(i!=(n-1)/i)
                                ++ans;
                }
        }
        for(i=2;i*i<=n;++i){
                if(n%i==0){
                        int m=n;
                        while(m%i==0)
                                m/=i;
                        if(m%i==1)
                                ++ans;
                        if(i!=n/i){
                                int m=n;
                                while(m%(n/i)==0)
                                        m/=n/i;
                                if(m%(n/i)==1)
                                        ++ans;
                        }
                }
        }
        if(n==2){
            cout<<1;
            return;
        }
        cout<<ans;
}

signed main(){
        fastio;
        int t;
        //cin>>t;
        t=1;
        while(t--){
                solve();
        }
        return 0;
}

Measured memory_bytes: 256