akhauriyash/Code-Regression huggingface dataset:
//atcoder clange
#include <stdio.h>

int main(void){
    int N;
    N = 15;
    char a[N];
  int i=0;
   scanf("%s", a);//数値の取得
  int counto= 0;
  int countx = 0;
  while(a[i] != '\0'){
		if(a[i] == 'o'){
          counto++;
        
        }else if(a[i] == 'x'){
         countx++; 
         
        }
    if(countx >= 8){
     printf("NO");
      return 0;
    }
    i++;
  }
  int ans = 0;
  ans = i - counto;

  
if(i == 15){
if(counto >= 8){
    printf("YES");
  
      return 0;
  }else if(countx >= 8){
	printf("NO");
 
    return 0;
  }
}else if(i != 15){
  if(ans <= 8){
  printf("YES");
  
      return 0;
  } else{
printf("NO");
    
    return 0;
	
  }
  
  
}

    
  return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define mp make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define MOD 1000000007

ll p[55],b[55];
ll n,x;

ll dfs(ll i, ll j){
  if(i == 0){
    if(j < 1) return 0;
    else return 1;
  }
  if(j < 1) return 0;
  if(j <= p[i-1] + b[i-1] + 1) return dfs(i-1,j-1);
  if(j == p[i-1] + b[i-1] + 2) return p[i-1] + 1;
  if(j <= p[i] + b[i] - 1) return p[i-1] + 1 + dfs(i-1,j-(p[i-1] + b[i-1] + 2));
  else return p[i];

}

int main(){
  cin >> n >> x;
  p[0] = 1;
  b[0] = 0;
  for(int i = 0; i < 51; i++){
    p[i+1] = (p[i]<<1) + 1;
    b[i+1] = (b[i]<<1) + 2;
  }
  cout << dfs(n,x) << endl;
  return 0;
}

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

long long gcd(long long a,long long b){
  if (a%b==0 )return b;
  else return gcd(b,a%b);
}
int main() {
  int n; cin>>n;
  vector<long long>vec(n);
  for(int i=0;i<n;i++){
    cin>>vec[i];
  }

  bool can=true;
  for(int i=0;i<n-1;i++){
    if(vec[i]==vec[i+1])continue;
    else if(vec[i]<vec[i+1]) vec[i+1]--;
    else{
      can=false;
      break;
    }
  }
  if(can) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
      
    
}


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

#define ll long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
const int MAXN = 2e5+5;
const int MOD= 998244353;
int n,b[MAXN];
struct node{
    int x,y;
}a[MAXN];
bool cmp(node a,node b){
    return a.x<b.x;
}
ll dp[MAXN];
stack<pair<int,int> >st;
int main()
{
    scanf("%d",&n);
    rep(i,1,n){
        scanf("%d%d",&a[i].x,&a[i].y);
        a[i].y+=a[i].x-1;
    }
    sort(a+1,a+n+1,cmp);
    rep(i,1,n)b[i]=a[i].x;
    dp[n+1]=1;
    while(!st.empty())st.pop();
    per(i,n,1){
        int y=a[i].y;
        while(!st.empty()&&y>=st.top().first){
            y=max(y,st.top().second);
            st.pop();
        }
        st.push(make_pair(a[i].x,y));
        int p=upper_bound(b+1,b+n+1,y)-b;
        dp[i]=(dp[i+1]+dp[p])%MOD;
    }
    printf("%lld\n",dp[1]);
}


Measured memory_bytes: 4992
# edges[src][dst] = cost
def bellman(start, n, edges)
    dist = Array.new(n+1, Float::INFINITY)
    prev = Array.new(n+1)
    dist[start] = 0
    n.times do |i|
        update = false
        edges.length.times do |src|
            edges[src].each do |dst, cost|
                if dist[dst] > dist[src] + cost
                    update = true
                    prev[dst] = src
                    if i == n - 1
                        dist[dst] = -Float::INFINITY
                    else
                        dist[dst] = dist[src] + cost
                    end
                end
            end
        end
        break unless update
    end
    return dist, prev
end



N, M = gets.split.map(&:to_i)

edges = Array.new(N+1){Hash.new}
M.times do |i|
    a, b, c = gets.split.map(&:to_i)
    edges[a][b] = -c
end

dist, _ = bellman(1, N, edges)

if dist[N] == -Float::INFINITY
    puts 'inf'
else
    puts -dist[N]
end

Measured memory_bytes: 4348
A, B = list(map(int, input().split()))

def gcd(a,b):
    r = divmod(a,b)[1]
    if r == 0:
        return int(b)
    else:
        return gcd(b,r)

def fact(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n = n // 2
    k = 3
    while k * k <= n:
        if n % k == 0:
            a.append(k)
            n = n // k
        else:
            k = k + 2
    if n != 1:
        a.append(n)
    return a


print(len(list(set(fact(gcd(A,B)))))+1)



Measured memory_bytes: 38384
#from math import gcd
from fractions import gcd

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

# step 1
aa = a // c
if (a % c == 0):
    aa -= 1
bb = b // c
ans = bb - aa

# step 2
aa = a // d
if (a % d == 0):
    aa -= 1
bb = b // d
ans += bb - aa

'''
Python3.5
>>
最大公約数
import math
z = math.gcd(a,b)
最小公倍数
z = (a * b)//math.gcd(a,b)

Python3.4
from fractions import gcd
'''
# step 3
z = (c * d) // gcd(c, d)

aa = a // z
if (a % z == 0):
    aa -= 1
bb = b // z
ans -= bb - aa

tar = b - a + 1 - ans
print(tar)


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

using namespace std;

int main(){
	string s;
	cin  >> s;
	for(int i = 0; i < s.length(); i++){
		if(i % 2 == 0){
			if(s[i] != 'R' && s[i] != 'U' && s[i] != 'D'){
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			if(s[i] != 'L' && s[i] != 'U' && s[i] != 'D'){
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
  
using namespace std;
int n;
 
int main() {
	cin >> n;
	int ans = 1;
	for (int i=1;;i++) {
		ans *= 2;
		if (ans > n) break;
	}
	cout << ans/2 << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO.Pipes;
using System.Runtime;
 
namespace Csharponly
{
    class Program
    {
        static public void Main()
        {
        int[] NK = Arrayint();
		int[] N = new int[NK[0]];

        for(int i = 0; i < NK[1]; i++)
        {
            int d = Oneint();
            int[] A = Arrayint();
            for(int j = 0; j < d; j++)
            {
                N[A[j]-1]++;
            }
        }

        int ans = 0;
        for(int i = 0; i < NK[0]; i++){
            if(N[i] == 0){
                ans++;
            }
        }
		Console.WriteLine(ans);
 
        }
 
　　　　//一つの文字列を受け渡す
        static string Onestring()
        {
            return Console.ReadLine();
        }
 
        //複数の文字列を配列で受け渡す
        //文字列と文字列の間は" "で区切る
        static string[] Arraystring()
        {
            return Console.ReadLine().Split(' ');
        }
 
        //一つの数字を受け渡す
        static int Oneint()
        {
            return int.Parse(Console.ReadLine());
        }
 
        //複数の数字を配列で受け渡す
        //数字と数字の間は" "で区切る
        static int[] Arrayint()
        {
            String[] input_line = Console.ReadLine().Split(' ');
            int[] input_num = new int[input_line.Length];
            for (int i = 0; i < input_line.Length; i++)
            {
                input_num[i] = int.Parse(input_line[i]);
            }
            return input_num;
        }
    }
}

Measured memory_bytes: 27620
#include<bits/stdc++.h>
const int maxs=1e9+1;
int a[100002];
using namespace std;
int main()
{
int n,i,j,k;
    cin>>n;
    int maxs=0;
  for(i=0;i<n;i++)
  {
      cin>>a[i];
  }
  sort(a,a+n);
  int be=1,ed=n-1,s=0,t=0;
   long long sum=0;
    while(be<=ed)
    {
        int t1=abs(a[be]-a[t]),t2=abs(a[be]-a[s]),t3=abs(a[ed]-a[s]),t4=abs(a[ed]-a[t]);
      if(t1>=t2&&t1>=t3&&t1>=t4)
      {
          sum+=t1;
          t=be;be++;
      }
      else if(t2>=t3&&t2>=t1&&t2>=t4)
      {
          sum+=t2;
          s=be;be++;
      }
      else if(t3>=t1&&t3>=t2&&t3>=t4)
      {
          sum+=t3;
          s=ed;ed--;
      }
      else if(t4>=t3&&t4>=t1&&t4>=t2)
      {
          sum+=t4;
          t=ed;ed--;
      }
    }
    cout<<sum<<endl;
return 0;
}


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

using namespace std;

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

int main(int argc, char const *argv[]) {
	int n;
	std::cin >> n;
	int count = 0;
	for (size_t i = 0; i < n; i++) {
		int x;
		std::cin >> x;
		while (true) {
			if (x % 2 == 0) {
				count++;
				x /= 2;
			}
			else {
				break;
			}
		}
	}
	std::cout << count << '\n';
	return 0;
}


Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int S;
    cin >> S;
    int h = S / 3600;
    S %= 3600;
    int m = S / 60;
    S %= 60;
    int s = S;
    printf("%d:%d:%d\n", h, m, s);
}



Measured memory_bytes: 3160
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    char str1[100],str2[100];
    cin>>str1>>str2;
    char str3[200];
    strcpy(str3,str1);  
    strcat(str3,str1);
    if(strstr(str3,str2)==NULL)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 3120
#include<stdio.h>
int search(int[], int, int);

int main(){
  int i, n, q, key, cnt=0;
  int S[10000], T[500];

  scanf("%d", &n);

  for( i = 0 ; i < n ; i++ ){
    scanf("%d", &S[i]);
  }

  scanf("%d", &q);

  for( i = 0 ; i < q ; i++ ){
    scanf("%d", &T[i]);
    if( search(S, n, T[i])) cnt++;
  }
  printf("%d\n", cnt);
  return 0;
}


int search(int S[], int n, int t){
  int i=0;
  S[n] = t;
  while( S[i] != t ) i++;
  return i != n;
}



Measured memory_bytes: 2136
import java.util.Scanner;
public class Main
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        
        int board = input.nextInt(),
            player1 = input.nextInt(),
            player2 = input.nextInt();
        
        while(true)
        {
            if((player1 + 1) != player2)
                player1++;
            else
                player1--;
            if(player1 < 1)
            {
                System.out.println("Borys");
                break;
            }
            
            if((player2 - 1) != player1)
                player2--;
            else
                player2++;
            if(player2 > board)
            {
                System.out.println("Alice");
                break;
            }
        }
    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
 
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

int main() {
    int n;
    cin >> n;
    if(n % 2 == 0){
        cout << n;
    }else{
        cout << n * 2;
    }
    
    return 0;
}

Measured memory_bytes: 3520
#include <iostream>
using namespace std;
int main(void){
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    double ans = (double)w*h/2;
    int num = (w==x*2 && h==y*2) ? 1 : 0; //中心にあったら無限 中心になかったら中心を通らす線しかない
    printf("%.10f %d\n", ans, num);
}


Measured memory_bytes: 256
listA=list(map(int,input().split()))
a=listA[0]
b=listA[1]
c=listA[2]
d=listA[3]
if(abs(a-c)<=d):
    print('Yes')
elif((abs(a-b)<=d)&(abs(b-c)<=d)):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
#include<cstdlib>
#include<memory>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
 
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

template <typename Type=int> class SegmentTree{
    public:
        int strnum;
        int strbeg;
        int nodemax;
        std::unique_ptr<Type[]> node;
        std::unique_ptr<std::pair<int,int>[]> noderange;

        SegmentTree(int a){
            strnum=a;
            strbeg=1;
            while(strbeg<strnum)strbeg*=2;
            strbeg-=1;
            nodemax=strbeg*2+1;
            node.reset(new Type[nodemax]);
            noderange.reset(new std::pair<int,int>[nodemax]);
            noderange[0]=std::make_pair(0,nodemax-strbeg-1);
            for(int i=1;i<nodemax;i++){
                int parent=(i-1)/2;
                int parentleft=noderange[parent].first;
                int parentright=noderange[parent].second;
                if(parent*2+1==i){
                    noderange[i]=std::make_pair(parentleft,(parentright+parentleft)/2);
                }
                else{
                    noderange[i]=std::make_pair((parentleft+parentright)/2+1,parentright);
                }
            }
        }
        Type operation(Type left,Type right){
            return min(left,right);
        }
        Type operation(Type left,Type center,Type right){
            return min(min(left,center),right);
        }
        void init(Type in){
            REP(i,nodemax)node[i]=in;
        }
        void showstr(){
            REP(i,nodemax){
                long long int& n=node[i];
                printf("%lld ",n);
            }
            printf("\n");
        }
        void showrange(){
            REP(i,nodemax){
                std::pair<int,int>& n=noderange[i];
                printf("[%d:%d:%d] ",i,n.first,n.second);
            }
            printf("\n");
        }
        void update(int i,Type x){
            i+=strbeg;
            node[i]=x;
            while(i>0){
                i=(i-1)/2;
                node[i]=operation(node[2*i+1],node[2*i+2]);
            }
        }
        Type find(int l,int r,int n=0){
            std::pair<int,int> ran=noderange[n];
            int center=(ran.first+ran.second)/2;
            if(l==ran.first&&r==ran.second)return node[n];
            else if(center<l)return find(l,r,2*n+2);
            else if(center>=r)return find(l,r,2*n+1);
            else return operation(find(l,center,2*n+1),find(center+1,r,2*n+2));
        }
};

int main()
{
    int n,q;
    scanf("%d %d\n",&n,&q);
    SegmentTree<long long int> a(n);
    a.init(((1<<30)-1)*2+1);
    long long int b,x,y;
    REP(i,q){
        scanf("%lld %lld %lld\n",&b,&x,&y);
        if(b==0){
            a.update(x,y);
        }
        else{
            printf("%lld\n",a.find(x,y));
        }
    }
    return 0;
}


Measured memory_bytes: 7048
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  ll x;
  cin >> x;
  ll n = 100;
  int i = 0;
  while(n < x){
    n += n/100;
    i++;
  }
  cout << i << endl;
}

Measured memory_bytes: 3612
#include <stdio.h>
int main(void){
    int n,k;
    int x[100000];
    
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%d",&x[i]);
    }
    int min=300000000;
    for(int j=0;j<n-k+1;j++){
        min=fmin(x[j+k-1]-x[j]+fmin(abs(x[j]),abs(x[j+k-1])),min);
    }
    printf("%d",min);
}

Measured memory_bytes: 2508
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
//#include <intrin.h>  //AtCoder (gcc) 上ではこれがあると動かない。__popcnt用のincludeファイル。
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const ll INF = 2e9;
const ll large_P = 1e9 + 7;



//繰り返し2乗法
//N^aの、Mで割った余りを求める。
ll my_pow(ll N, ll a, ll M) {
	ll tempo;
	if (a == 0) {
		return 1;
	}
	else {
		if (a % 2 == 0) {
			tempo = my_pow(N, a / 2, M);
			return (tempo * tempo) % M;
		}
		else {
			tempo = my_pow(N, a - 1, M);
			return (tempo * N) % M;
		}
	}
}



//N_C_a を M で割った余り
ll my_combination(ll N, ll a, ll M) {
	ll answer = 1;

	rep(i, a) {
		answer *= (N - i);
		answer %= M;
	}

	rep(i, a) {
		answer *= my_pow(i + 1, M - 2, M);
		answer %= M;
	}

	return answer;
}



ll my_gcd(ll& a, ll& b) {
	if (b == 0) return a;
	ll temp = a % b;
	return my_gcd(b, temp);
}



// long long型 n を、base 進法での、i 桁目の数が入った vector にする。
void ll_to_vector(ll base, ll n, vector<ll>& v) {
	ll tempo = n;

	ll n_digit = floor(log10(n) / log10(base)) + 1;
	v.assign(n_digit, 0);

	//ll n_digit = v.size();

	for (ll i = 0; i < n_digit; i++) {
		v.at(i) = tempo / pow(base, n_digit - 1 - i);
		tempo -= v.at(i) * pow(base, n_digit - 1 - i);
	}
}







signed main() {
	string S; cin >> S;
	int res = 0;

	if (S == "SUN") res = 7;
	else if (S == "MON") res = 6;
	else if (S == "TUE") res = 5;
	else if (S == "WED") res = 4;
	else if (S == "THU") res = 3;
	else if (S == "FRI") res = 2;
	else res = 1;

	cout << res << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define pb push_back
#define en "\n"
#define ITER(i,a) for( typeof(a.begin()) i=a.begin();i!=a.end();i++)
#define mod 1000000007
#define mpp make_pair
#define mes(a,b) memset((a),(b),sizeof((a))
typedef map<int,int> MI;
typedef pair<int,int>   PI;
typedef vector<int> VI;
typedef long long int LL;

int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a[3];
    for(int i=0;i<3;i++)
    cin>>a[i];
    sort(a,a+3);
    if(a[0]==5 && a[1]==5 && a[2]==7)
    cout<<"YES";
    else
    cout<<"NO";
	return 0;
}


Measured memory_bytes: 3612
using System;

namespace Program
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int x = Convert.ToInt32(input[0]);
            int y = Convert.ToInt32(input[1]);
            int z = Convert.ToInt32(input[2]);

            int result = (x - z) / (y + z);
            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 13396
import heapq

X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
all_list = []

for p in P:
    all_list.append([-p, "A"])

for q in Q:
    all_list.append([-q, "B"])
for r in R:
    all_list.append([-r, "C"])
heapq.heapify(all_list)

ans = 0
count = 0
X_count = 0
Y_count = 0
while count < X+Y:
    pop = heapq.heappop(all_list)
    if pop[1] == "A" and X_count < X:
        ans -= pop[0]
        X_count += 1
        count += 1
    elif pop[1] == "B" and Y_count < Y:
        ans -= pop[0]
        Y_count += 1
        count += 1
    elif pop[1] == "C":
        ans -= pop[0]
        count += 1
print(ans)

Measured memory_bytes: 128620
#include<cstdio>
#include<vector>
const int psz = 200003;
int n;
int a[200100];
int powt[200100];
int smod[2] = { 998244353, (7 << 26) + 1 };
int pord[2] = { 3, 3 };
long long int vd[1 << 19];
long long int ftmp[1 << 19];
int mpow(int x, int y, int mod) {
	if (y == 0)return 1;
	long long int p = mpow(x, y / 2, mod);
	p *= p;
	p %= mod;
	if (y % 2 == 1) {
		p *= x;
		p %= mod;
	}
	return p;
}
void fft(int tn, int mod, int w, long long int* v) {
	if (tn == 0)return;
	if (tn == 1) {
		long long int iv = v[0];
		v[0] += v[1];
		if (v[0] >= mod)v[0] -= mod;
		v[1] = iv + mod - v[1];
		if (v[1] >= mod)v[1] -= mod;
		return;
	}
	for (int i = 0; i < (1 << (tn - 1)); i++) {
		ftmp[i] = v[i * 2];
		ftmp[i + (1 << (tn - 1))] = v[i * 2 + 1];
	}
	for (int i = 0; i < (1 << tn); i++) {
		v[i] = ftmp[i];
	}
	int wsq = ((long long int)w)*w%mod;
	fft(tn - 1, mod, wsq, v);
	fft(tn - 1, mod, wsq, v + (1 << (tn - 1)));
	for (int i = 0; i < (1 << tn); i++) {
		ftmp[i] = v[i];
	}
	long long int wpow = 1;
	for (int i = 0; i < (1 << (tn - 1)); i++) {
		v[i] = (ftmp[i] + ftmp[i + (1 << (tn - 1))] * wpow) % mod;
		v[i + (1 << (tn - 1))] = (ftmp[i] * 2 + mod - v[i]) % mod;
		wpow *= w;
		wpow %= mod;
	}
}
void fftsq(int tn, int mod, int w) {
	int primord = mpow(w, (mod - 1) >> tn, mod);
	int sord = mpow(primord, mod - 2, mod);
	int sdiv = mpow(2, mod - 1 - tn, mod);
	fft(tn, mod, primord, vd);
	for (int i = 0; i < (1 << tn); i++) {
		vd[i] *= vd[i];
		vd[i] %= mod;
	}
	fft(tn, mod, sord, vd);
	for (int i = 0; i < (1 << tn); i++) {
		vd[i] *= sdiv;
		vd[i] %= mod;
	}
}
std::vector<long long int> square(std::vector<int>&v) {
	int s = v.size();
	if (s <= 6) {
		std::vector<long long int> result;
		result.resize(s * 2);
		for (int i = 0; i < s; i++) {
			for (int j = 0; j < s; j++) {
				result[i + j] += v[i] * v[j];
			}
		}
		return result;
	}
	int tn = 0;
	for (;;) {
		if ((1 << tn) >= s)break;
		tn++;
	}
	int d = 1 << (tn + 1);
	for (int i = 0; i < d; i++) {
		vd[i] = 0;
	}
	for (int i = 0; i < s; i++) {
		vd[i] = v[i];
	}
	fftsq(tn + 1, smod[0], pord[0]);
	std::vector<long long int> result;
	result.resize(s * 2);
	for (int i = 0; i < s * 2; i++) {
		result[i] = vd[i];
	}
	for (int i = 0; i < d; i++) {
		vd[i] = 0;
	}
	for (int i = 0; i < s; i++) {
		vd[i] = v[i];
	}
	fftsq(tn + 1, smod[1], pord[1]);
	for (int i = 0; i < s * 2; i++) {
		while (result[i] % smod[1] != vd[i])result[i] += smod[0];
	}
	return result;
}
int main() {
	long long int pd = 1;
	for (int i = 0; i == 0 || pd != 1; i++) {
		powt[pd] = i;
		pd *= 2;
		pd %= psz;
	}
	scanf("%d", &n);
	std::vector<int> ptable;
	ptable.resize(psz);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		if (a[i] != 0) {
			ptable[powt[a[i]]]++;
		}
	}
	std::vector<long long int> rtable = square(ptable);
	for (int i = 0; i < ptable.size(); i++) {
		rtable[i * 2] -= ptable[i];
	}
	long long int ans = 0;
	pd = 1;
	for (int i = 0; i < rtable.size(); i++) {
		ans += pd * rtable[i] / 2;
		pd *= 2;
		pd %= psz;
	}
	printf("%lld\n", ans);
	return 0;
}


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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
bool chmax(T &a, const T &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

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

  int x;
  cin >> x;
  int y = 360;

  cout << 360 / gcd(x, y) << '\n';
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
char dat[100005];
bool zz[100005];
int main()
{
	int n;
	scanf("%d%s",&n,&dat);
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<2;j++)
		{
			zz[0]=i;
			zz[1]=j;
			for(int k=1;k<n-1;k++)
			{
				zz[k+1]=zz[k-1]^zz[k]^(dat[k]=='x');
			}
			if((dat[n-1]=='x')==(zz[n-2]^zz[n-1]^zz[0]) && (dat[0]=='x')==(zz[n-1]^zz[0]^zz[1]))
			{
				for(int k=0;k<n;k++) printf("%c",zz[k]?'W':'S');
				printf("\n");
				return 0;
			}
		}
	}
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 512
let [|N;S|] =
    stdin.ReadLine().Split()
    |> Array.map int
let A =
    stdin.ReadLine().Split()
    |> Array.map int
let Mod = 998244353

let initialArray = Array.create (S+1) 0
Array.set initialArray 0 1
let folder (state:int[],commited: int[]) item =
    let newState =
        state
        |> Array.mapi (fun i value ->
            if i - item < 0 then value
            else (value + state.[i-item]) % Mod)
    let newCommited =
        commited
        |> Array.mapi (fun i value -> (value + newState.[i]) % Mod)
    Array.set newState 0 ((newState.[0]+1) % Mod)
    (newState, newCommited)

Array.scan folder (initialArray,initialArray) A
|> (fun arr -> arr.[N])
|> (fun (_,x) -> x.[S])
|> stdout.WriteLine

Measured memory_bytes: 100540
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(int argc, char **argv) {
	int n;
	cin >> n;
	cout << (n * 800 - n / 15 * 200) << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 0;
        for(int i = 0;i < N;i++){
            int a = sc.nextInt();
            while(true){
                if(a%2 == 0){
                    a /= 2;
                    ans++;
                }else{
                    break;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35288
import sys
sys.setrecursionlimit(10 ** 7)
n = int(input())
edges = [[] for _ in range(n)]
for i in range(1, n):
    a = int(input())
    edges[a-1].append(i)

def dfs(frm, cur):
    res = []

    for to in edges[cur]:
        if frm == cur:
            continue

        res.append(dfs(cur, to)+1)

    if len(res) == 0:
        return 0

    res.sort(reverse=True)
    res = [res[i] + i for i in range(len(res))]
    return max(res)

print(dfs(-1, 0))



Measured memory_bytes: 142488
import java.util.*


var MAX = 10000001
var factor = IntArray(10000001)

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var kotlin=scan.nextLine().toInt()
    var ans : Long = 0
    generatePrimeFactors()
    for(i in 1..kotlin)
        ans+= (i*calculateNoOFactors(i))
    println(ans)
}

fun generatePrimeFactors() {
    factor[1] = 1
    for (i in 2 until MAX)
        factor[i] = i

    run {
        var i = 4
        while (i < MAX) {
            factor[i] = 2
            i += 2
        }
    }

    var i = 3
    while (i * i < MAX) {

        if (factor[i] == i) {
            var j = i * i
            while (j < MAX) {
                if (factor[j] == j) factor[j] = i
                j += i
            }
        }
        i++
    }
}

fun calculateNoOFactors(n: Int): Long {
    if (n == 1) return 1
    var ans : Long = 1

    var dup = factor[n]
    var c = 1
    var j = n / factor[n]
    while (j != 1) {
        if (factor[j] === dup) c += 1 else {
            dup = factor[j]
            ans = ans * (c + 1)
            c = 1
        }

        j = j / factor[j]
    }

    ans = ans * (c + 1)
    return ans
}

Measured memory_bytes: 75996
#include<cstdio>
#include<algorithm>
using namespace std;
int n, m, D[1010][1010], dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 }, head ,tail;
struct point {
	int x, y;
}Q[1010000];
char p[1010][1010];
void Put(int x, int y, int d) {
	if (x<1 || x>n || y<1 || y>m)return;
	if (D[x][y] <= d)return;
	D[x][y] = d;
	Q[++tail] = { x,y };
}
int main() {
	int i, j;
	scanf("%d%d", &n, &m);
	for (i = 1; i <= n; i++) {
		scanf("%s", p[i] + 1);
		for (j = 1; j <= m; j++) {
			D[i][j] = 1e9;
			if(p[i][j]=='#')Put(i, j, 0);
		}
	}
	while (head < tail) {
		point t = Q[++head];
		for (i = 0; i < 4; i++) {
			Put(t.x + dx[i], t.y + dy[i], D[t.x][t.y] + 1);
		}
	}
	printf("%d\n", D[Q[tail].x][Q[tail].y]);
}

Measured memory_bytes: 13056
while True:
    n=int(input())
    min=1000
    max=0
    sum=0
    if n==0:
        break
    for i in range(n):
        tennsuu=int(input())
        sum+=tennsuu
        if tennsuu<min:
            min=tennsuu
        if tennsuu>max:
            max=tennsuu
    print((sum-min-max)//(n-2))


Measured memory_bytes: 5588
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(ReadLine());
        string S = ReadLine();

        int min = 0;
        int now = 0;
        foreach (var i in S)
        {
            if (i == '(') now++;
            else now--;
            min = Min(min, now);
        }
        string first = "";
        for (int i = 0; i < -min; i++)
        {
            first += "(";
        }
        string last = "";
        for (int i = 0; i < now-min; i++)
        {
            last += ")";
        }
        WriteLine(first + S + last);
    }
}


Measured memory_bytes: 27556
a = list(map(int, input().split()))
if a[0] <= 599:
  print(8)
elif a[0] <= 799:
  print(7)
elif a[0] <= 999:
  print(6)
elif a[0] <= 1199:
  print(5)
elif a[0] <= 1399:
  print(4)
elif a[0] <= 1599:
  print(3)
elif a[0] <= 1799:
  print(2)
else:
  print(1)

Measured memory_bytes: 9188
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

S = input()
N = len(S)
K = INT()

dp0 = list2d(N+1, 107, 0)
dp1 = list2d(N+1, 107, 0)
dp0[0][0] = 1
for i in range(N):
    num = int(S[i])
    for j in range(107):
        for k in range(10):
            nxt = j+1 if k != 0 else j
            if nxt == 107:
                continue
            if k < num:
                dp1[i+1][nxt] += dp0[i][j]
                dp1[i+1][nxt] += dp1[i][j]
            elif k == num:
                dp0[i+1][nxt] += dp0[i][j]
                dp1[i+1][nxt] += dp1[i][j]
            else:
                dp1[i+1][nxt] += dp1[i][j]
ans = dp0[N][K] + dp1[N][K]
print(ans)


Measured memory_bytes: 3412
#include <iostream>
using namespace std;
int main()
{
    int N, K;
    cin >> N >> K;

    int* p = new int[N];

    int i = 0;
    while (i < N) {
        cin >> p[i];
        i++;
    }
    //int* prs = new int[K];
    int a = 0;
    i = 0;
    int j = 0;
    int min = 0; // index
    while (i < K) {
        while (j < N)
        {
            if (p[j] <= p[min]) {
                min = j;
            }
            j++;
        }
        j = 0;
        
        a += p[min];
        p[min] = 1001;

        min = 0;

        i++;
    }

    cout << a;

    return 0;
}

Measured memory_bytes: 3224
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string word;
  int field[100][100] = {0},x = 0,c = 0;
  while(getline(cin,word)){
    int a = 0,b = 0;
    for(int i=0; i<word.size(); i++){
      if(word[i] == ','){
	field[a][x] = b;
	b = 0;
	a++;
      }
      else{b = b*10+word[i]-'0';}
    }
    field[a][x] = b;a++;
    if(c<a){c = a;}
    x++;
  }
  for(int i=1; i<c; i++){
    for(int j=0; j<i+1; j++){
      if(j == 0){field[j][i]+=field[j][i-1];}
      else if(j == i){field[j][i]+=field[j-1][i-1];}
      else{field[j][i]+=max(field[j-1][i-1],field[j][i-1]);}
    }
  }
  for(int i=c; i<c*2; i++){
    for(int j=0; j<c*2-i-1; j++){
      field[j][i]+=max(field[j][i-1],field[j+1][i-1]);
    }
  }
  cout <<field[0][c*2-2]<<endl;
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  string s;
  cin>>s;
  string t=s;
  sort(t.begin(),t.end());
  t.erase(unique(t.begin(),t.end()),t.end());
  cout<<(s.size()==t.size()?"yes":"no")<<endl;
  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }


int
main(void){  
  int n;
  cin >> n;

  int ans = 0;
  FOR(i, 1, n+1){
    int itmp=0;
    FOR(j, 1, i){
      if(i%j == 0) itmp++;
    }
    if(itmp == 7 && i%2 != 0) ans++;
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 int main(){
   int n,b,c,d=0;
//n=10;
   cin>>n;
   vector<int> a(n);
  rep(i,n)cin>>a.at(i); 
   sort(a.begin(),a.end());
  //rep(i,n)cout<<a.at(i)<<endl;
   vector<int> x;
   b=a.at(n-1)-a.at(0);
      c=a.at(0);
 if(b>0){
   rep(j,b){
     rep(i,n){
    d+=(c-a.at(i))*(c-a.at(i));
     }
       x.push_back(d);
     d=0;
    c++;
   }
}
   if(b==0)cout<<0<<endl;
   else{
   sort(x.begin(),x.end());
   cout<<x.at(0)<<endl;
   }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int x;
	cin >> x;
	if (x == 7 || x == 5 || x == 3) {
		cout << "YES" << endl;
	}
	else {
		cout<<"NO"<<endl;
	}
}

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

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int a, b;
	cin >> a >> b;
	
	int ans = 0;

	if( abs(a - b) > 1 ) ans = 2 * max(a, b) - 1;
	else if( abs(a - b) == 1 ) ans = max(a, b) + min(a, b);
	else ans = 2 * max(a, b);
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int main() {
    int n, k,count=0; cin>>n>>k;
    vector<int> x(n);
    rep(i,n) {
        cin>>x[i];
        count+=min(x[i],abs(x[i]-k));
    }
    cout<<count*2<<endl;
}

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

int pro(vector<int> a, vector<int> b){
  int p=0;
  for(int i=0;i<26;i++){
    p += a.at(i)*b.at(i);
  }
  return p;
}

int main(){
  int N;
  string s;
  cin >>N>>s;
  vector<int> a(26),b(26);
 
  int p;
  int ma = 0;
  int x;
  for(int i=1;i<N;i++){
     for(int i=0;i<26;i++){
    a.at(i) = 0;
    b.at(i) = 0;
  }
    for(int j=0;j<i;j++){
      x = s[j];
      x -=97;
      a.at(x) = 1;
    }   
    for(int j=i;j<N;j++){
      x = s[j];
      x -=97;
      b.at(x) = 1;
    }
    p =pro(a,b);
    ma = max(ma,p);
  }
  cout << ma << endl;
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

int answer = 0;

void count(int a, int b){
  answer += b - a + 1;
}

int main(){
  int n;
  cin >> n;
  vector<int> l(n, 0);
  vector<int> r(n, 0);

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

  for (int i = 0; i < n; i++) {
    count(l[i],  r[i]);
  }

  cout << answer << endl;



}


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

using namespace std;


const int N = 3000 + 5;

int dp[N][N];
pair < int , int > p[N][N];

string getString(){
    char s[N];
    scanf("%s" , s);
    return string(s);
}

void solve(int testCase){

    string s = getString();
    string t = getString();

    int n = s.length();
    int m = t.length();

    for(int i = 1 ; i <= n ; i ++){
            for(int j = 1 ; j <= m ; j ++){
                    if(s[i-1] == t[j-1]){
                            p[i][j] = {i - 1 , j - 1};
                            dp[i][j] = 1 + dp[i-1][j-1];
                    }
                    else {
                            if(dp[i-1][j] > dp[i][j-1]){
                                    p[i][j] = {i - 1 , j};
                                    dp[i][j] = dp[i-1][j];
                            }
                            else {
                                    p[i][j] = {i , j - 1};
                                    dp[i][j] = dp[i][j-1];
                            }
                    }
            }
    }

    int x = n , y = m;
    string ans = "";
    while( x > 0 && y > 0 ){
            int px = p[x][y].first;
            int py = p[x][y].second;

            if(dp[px][py] == dp[x][y] - 1){
                    ans += s[x-1];
            }

            x = px;
            y = py;
    }

    reverse(ans.begin() , ans.end());
    printf("%s\n" , ans.c_str());
}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}



Measured memory_bytes: 105984
#include<stdio.h>
#include<stdlib.h>

int cmp(const int *a,const int *b){
  return *b-*a;
}
int main(){
  int k,n,l[50],i,sum=0;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++) scanf("%d",&l[i]);
  qsort(l,n,sizeof(int),cmp);
  for(i=0;i<k;i++) sum+=l[i];
  printf("%d",sum);
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
	int n, num, d, rev = 0;
	cin>>num;
	n =num;
	do
	{	
	d= num % 10;
    rev = (rev * 10) + d;
    num= num / 10;
}
while(num != 0);
   if (n == rev) 
         cout<<"Yes";
    
        else
	  	cout<<"No";
	  	return 0;
	  
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void)
{
   int i,m, f, r;
   

    for(i=0; i<=50; i++){
    scanf("%d %d %d", &m, &f, &r);
    if(m == -1 && f == -1 && r == -1) break;
    if(m==-1 || f==-1 || m+f<30)
    printf("F\n");
        
        else if(m+f>=80)
            printf("A\n");
        else if(m+f>=65 && m+f<80)
            printf("B\n");
        else if(m+f>=50 && m+f<65)
            printf("C\n");
        else if(m+f>=30 && m+f<50 && r>=50)
            printf("C\n");
        else if(m+f>=30 && m+f<50)
            printf("D\n");
    
    
    }
    return 0;

    
}



Measured memory_bytes: 2108
#include <stdio.h>
int main(void){
    int n;
    scanf("%d",&n);
    int d[n-1];
    for (int i = 0 ;i<n;i++){
        scanf("%d",&d[i]);
    }
    int c =0;
    for(int x=0;x<n;x++){
        for(int y=0;y<x;y++){
            c+=(d[x]*d[y]);
        }
    }
    printf("%d",c);
  return 0;
}

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

using namespace std;

struct cht {
	deque<pair<long, long>> l;
	void operator()(long a, long b) {
		while (l.size() > 1 && (a - l[1].first)*(l[0].second - l[1].second) <= (l[0].first - l[1].first)*(b - l[1].second))
			l.pop_front();
		l.emplace_front(a, b);
	}
	long operator[](long x) {
		auto y = l.back().first*x + l.back().second;
		for (long z; l.size() > 1; y = z) {
			z = l.rbegin()[1].first*x + l.rbegin()[1].second;
			if (y <= z) break;
			l.pop_back();
		}
		return y;
	}
};
int main() {
	long n, c, d = 0;
	cin >> n >> c;
	cht l;
	for (int i = 0; i < n; i++) {
		long h;
		scanf("%ld", &h);
		if (i) d = l[h] + h * h;
		l(-2 * h, h*h + c + d);
	}
	cout << d << endl;
	return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
int a, b, m;

int main() {
    cin >> a >> b >> m;
    vector<int> av(a, 0);
    vector<int> bv(b, 0);
    for(int i = 0; i < a; ++i) cin >> av.at(i);
    for(int i = 0; i < b; ++i) cin >> bv.at(i);
    int sum = 1e9+7;
    for(int i = 0; i < m; ++i) {
        int x, y, c;
        cin >> x >> y >> c;
        x--; y--;
        int total = av.at(x) + bv.at(y) - c;
        sum = min(sum, total);
    }

    sort(av.begin(), av.end());
    sort(bv.begin(), bv.end());

    sum = min(sum, av.at(0)+bv.at(0));
    cout << sum << endl;
}

Measured memory_bytes: 1024
n = int(input())
l = list(map(int, input().split()))
if n == 1:
    print('Yes')
    exit(0)

for i in range(n-1, 0, -1):
    if l[i-1] - l[i] == 1:
        l[i-1] = l[i]
    elif l[i-1] - l[i] > 1:
        print('No')
        exit(0)

print('Yes')

Measured memory_bytes: 14396
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

######################################################

N=intput()

def rec(l,num):
    if len(l)==N:
        print(''.join(l))
    else:
        for i in range(num):
            ll = deepcopy(l)
            ll.append(ntos(i))
            rec(ll,num)
        ll = deepcopy(l)
        ll.append(ntos(num))
        rec(ll,num+1)
rec([],0)

Measured memory_bytes: 85720
#include <iostream>
#include <tuple>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

using RESTAURANT = tuple<int, string, int>;

int main ()
{
    int n;
    cin >> n;
    vector<RESTAURANT> r;
    int i;
    for (i = 1; i <= n; ++i)
    {
        string tmpS;
        int tmpP;
        cin >> tmpS >> tmpP;
        r.push_back(make_tuple(i, tmpS, tmpP));
    }

    sort(r.begin(), r.end(), [](const RESTAURANT &a, const RESTAURANT &b){
        int compVal = get<1>(a).compare(get<1>(b));
        bool ret = (compVal < 0);
        // cout << get<1>(b) << endl;
        // cout << compVal << endl;
        if (compVal == 0)
        {
            // cout << get<2>(a) << endl;
            // compVal = ((get<2>(a) > get<2>(b)) ? 1: -1);
            // cout << compVal << endl;
            ret = (get<2>(a) > get<2>(b));
        }
        // return compVal;
        return ret;
    });

    for (auto && item: r)
    {
        // cout << get<0>(item) << get<1>(item) << endl;
        cout << get<0>(item) << endl;
    }
    
    // for (i = 0; i < n; ++i) cout << get<0>(r[i]) << get<1>(r[i]) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

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

    int N;
    cin >> N;

    ll MAX = 55556;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i < MAX; ++i) {
        if (!is_prime[i])
            continue;
        for (int j = 2 * i; j < MAX; j += i)
            is_prime[j] = 0;
    }

    rep(i, MAX) {
        if (is_prime[i] && i % 5 == 1) {
            cout << i << " ";
            N--;
            if (N == 0)
                break;
        }
    }
}

Measured memory_bytes: 3616
#include<stdio.h>
int main(void)
{
	int i,a[i],s,b[i],t;
	s=0;
	t=0;
	for(i=0;i<4;i++){
		scanf("%d",&a[i]);
		s+=a[i];
	}
	for(i=0;i<4;i++){
		scanf("%d",&b[i]);
		t+=b[i];
	}
	if(s>t){
		printf("%d\n",s);
	}
	else{
		printf("%d\n",t);
	}
	return 0;
}



Measured memory_bytes: 2112