akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	int ans=0;
	rep(i,n-1)if(s[i]==s[i+1])ans++;
	cout<<min(n-1,ans+k*2)<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;using ll = long long;using ld = long double;using P = pair<ll,ll>;
#define rt "\n"
#define sp " "
#define test1 cout << "test1" << endl;
#define test2 cout << "test2" << endl;
#define fixprecision(n) fixed; cout << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
#define iikae auto&
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, s, N) for(ll i{N - 1}; i > s - 1; i--)
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
struct UnionFind{vector<ll> par;UnionFind(ll n) : par(n, -1){}void init(ll n){par.assign(n, -1);}ll root(ll x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(ll x, ll y){return root(x) == root(y);}bool merge(ll x, ll y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};

int main(){
  kyopro;
  string S;
  cin >> S;
  char now = '0';
  ll sum{};
  for(auto&& c : S){
    if(now == c) sum++;
    if(now == '0') now = '1';
    else now = '0';
  }
  cout << min(sum, (ll)S.size() - sum) << rt;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  string s,t;
  cin>>s>>t;
  string u;
  int i=0;
  while(i<s.size()){
    u+=s[i];
    if(i<t.size()) u+=t[i];
    i++;
  }
  cout<<u<<endl;
}

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

typedef long long int LL;
#define REP(n) for(LL i = 0; i < (n); i++)
#define COUT(val) cout << (val) << endl
#define CIN(val) cin >> (val)
#define SORT(vec) sort(vec.begin(), vec.end())
#define SORT_GRE(vec) sort(vec.begin(), vec.end(), greater<LL>())

int main(){
    string s;
    int cou = 0;
    cin >> s;
    REP(3){
        if(s[i] == 'o') cou++;
    }
    cout << 700+100*cou << endl;
    return 0;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N;
int A[310][310];
int D[310][310];
int G[310][310];

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

	cin >> N;
	priority_queue<pii, vector<pii>, greater<pii>> pq;
	rep(i, 0, N)rep(j, 0, N)
	{
		cin >> A[i][j];
		if (i == j)
		{
			D[i][j] = 0;
			G[i][j] = 0;
		}
		else
		{
			D[i][j] = INF;
			G[i][j] = INF;
		}
	}

	rep(i, 0, N)rep(j, i + 1, N)
	{
		pq.push(mp(A[i][j], i * 300 + j));
	}

	while (!pq.empty())
	{
		auto p = pq.top();
		pq.pop();

		int mind = INF;
		int s = p.second / 300;
		int t = p.second % 300;
		rep(i, 0, N)
		{
			if (D[s][i] != INF && D[i][t] != INF)
			{
				if (chmin(mind, D[s][i] + D[i][t]))
				{
					D[s][t] = D[t][s] = D[s][i] + D[i][t];
				}
			}
		}

		if (mind < p.first)
		{
			cout << -1 << endl;
			return 0;
		}

		if (p.first == mind)continue;

		G[s][t] = p.first;
		G[t][s] = p.first;
		D[s][t] = D[t][s] = p.first;
	}

	int ans = 0;
	rep(i, 0, N)rep(j, i + 1, N)
	{
		if (G[i][j] != INF)
		{
			ans += G[i][j];
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3576
# D - Grid Components

A, B = map(int, input().split())
A -= 1
B -= 1
grid = [['#'] * 100 for _ in range(50)]
grid.extend([['.'] * 100 for _ in range(50)])

for i in range(1, A+1):
    tmp_q = (i * 2) - 1
    q = tmp_q % 100
    tmp_p = tmp_q // 100 + 1
    p = (tmp_p * 2) - 1
    grid[p][q] = '.'

for j in range(1, B+1):
    tmp_q = (j * 2) - 1
    q = tmp_q % 100
    tmp_p = tmp_q // 100 + 1
    p = (tmp_p * 2) - 1
    p += 50
    grid[p][q] = '#'

print('100 100')

for i in range(100):
    print(''.join(map(str, grid[i])))

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

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


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;


    void solve()
    {
        WriteLine(cin.nextint / 3);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

int main() {
	int h,n; cin >> h >> n;
  	vector<int> a(n);
  	for (int i=0; i<n; i++) cin >> a[i];
    int sum = accumulate(a.begin(), a.end(), 0);
    if (h <= sum) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3708
n = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
ans += A[0]
for i in range((n-2) // 2):
    ans += 2 * A[i+1]
if n % 2 != 0:
    ans += A[(n-1)//2]
print(ans)

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

#define SZ(x) (((int)x.size()))
#define all(x) (x).begin(), (x).end()
#define pb push_back

typedef long long ll;
typedef long double ld;

using namespace std;

ll x;

ll p(ll a)
{
    return a * a * a * a * a;
}

int main()
{
    cin >> x;
    for (ll i = 0; ; i++)
    {
        for (ll j = -i; j <= i; j++)
        {
            if (p(i) - p(j) == x)
            {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
	return 0;
}


Measured memory_bytes: 3620
#include<iostream> 
using namespace std; 
 
int main()
{
	int a, b, c;  
	cin >> a >> b >> c; 
	if (a+b==c||a+c==b||b+c==a)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <valarray>
#include <algorithm>
#include <utility>

using namespace std;

int main() {
	int size = 0, ans = 0;
	string s;
	cin >> s;
	for (auto i : s)
	{
		if ((i == 'A' || i == 'C') || (i == 'G' || i == 'T')) {
			size++;
		}
		else {
			ans = max(ans, size);
			size = 0;
		}
	}
	ans = max(ans, size);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<sstream>
#include<math.h>
#define rep(i,n) for(int i =0;i<(int)(n);i++)
typedef long long ll;
using namespace std;
int main() {
	int n;
	cin >> n;
	cout << n * n*n << endl;
	return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
H = list(map(int,input().split()))
counter = [1] * N
for i in range(M):
    A,B = map(int,input().split())
    if H[A-1] > H[B-1]:
        counter[B-1] = 0
    if H[A-1] < H[B-1]:
        counter[A-1] = 0
    if H[A-1] == H[B-1]:
        counter[A-1] = 0
        counter[B-1] = 0
print(sum(counter))

Measured memory_bytes: 20144
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int R,G,B,N,ans = 0;
	cin>>R>>G>>B>>N;
	for (int i = 0;i * R <= N; ++i)
		for (int j = 0;j * G <= N; ++j)
		{
			int t = i * R + j * G;
			if (t <= N &&(N - t) % B == 0)
				++ans;
		}
	cout<<ans;
			
}

Measured memory_bytes: 256
import heapq
n,m = (int(i) for i in input().split())
A = [-int(i) for i in input().split()]
heapq.heapify(A)
for _ in range(m):
    tmp = heapq.heappop(A)
    tmp /= 2
    heapq.heappush(A,int(tmp))
print(-sum(A))


Measured memory_bytes: 14180
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
 
class Program
 {
        static void Main(string[] args)
        {
        	string[] nab = Console.ReadLine().Split(' ');
          	int n = int.Parse(nab[0]);
            int a = int.Parse(nab[1]);
            int b = int.Parse(nab[2]);
            string s = Console.ReadLine();
          	
          	int limit = a+b;
          	int all = 0; 
          	int rankb = 0;
          	for(int i = 0 ; i < n ;i++){
              if(s[i].ToString() == "a"){
              	if(all < limit){
              		Console.WriteLine("Yes");
                  	all++;
                }else{
	                Console.WriteLine("No");
                }
              }else if(s[i].ToString() == "b"){
                rankb++;
                if(all < limit && rankb <= b){
              		Console.WriteLine("Yes");
                  	all++;
                }else{
	                Console.WriteLine("No");
                }
              }else {
              	Console.WriteLine("No");
              }
              
            }
　　　　　}
 }


Measured memory_bytes: 32308
#include<bits/stdc++.h>
int a,s,n;
std::bitset<1<<22>d;     
main(){
    std::cin>>n;d|=1;
    while(n--)std::cin>>a,s+=a,d|=(d<<a);
	while(!d[++s/2]);std::cout<<s/2;
}

Measured memory_bytes: 1792
N = int(input())
activity = [list(map(int, input().split())) for i in range(N)]

dp = [[0]*3 for i in range(N+1)]
for i in range(N):
    for k in range(3):
        dp[i+1][k] = max(
            dp[i][k-1] + activity[i][k],
            dp[i][k-2] + activity[i][k]
        )
print(max(dp[N]))




Measured memory_bytes: 75224
#include <iostream>
#include <cstdio>
using namespace std;

long long fib[50] = {};

void Fib(long long n) {
    if(n == 0 || n == 1) fib[n] = 1;
    else fib[n] =  fib[n -1] + fib[n - 2];
}

int main(void) {
    int n;
    scanf("%d", &n);
    
    for(int i = 0; i < 50; ++i) Fib(i);
    
    printf("%d\n", fib[n]);
    
    return 0;
}


Measured memory_bytes: 3204
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int n, p, k, count;
	vector<int> num(1000000, 1);
	while(cin>>n){
		count=0;
		num[0]=0; num[1]=0;
		for(int i=4; i<=n; i+=2){
		num[i]=0;
		}
		for(int i=0; i<=n; i++){
			p = i+i+3;
			for(k=p+p; k<=n; k+=p){
				num[k]=0;
			}
		}
		for(int i=0; i<=n; i++){
			if(num[i]==1)
				count++;
		}
		cout<<count<<endl;
	}
	return 0;
}


Measured memory_bytes: 6596
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

class Main {
	public static void main (String[] args) throws java.lang.Exception{
		int n=0;
		long sum=1;
		ArrayList<Integer> h = new ArrayList<Integer>();

		Scanner scan = new Scanner(System.in);
		n=scan.nextInt();

		for(int i=0; i<n; i++) h.add(scan.nextInt());

		scan.close();

		Collections.sort(h);
		Collections.reverse(h);

		for(int i=0; i<n; i++) sum += (long)Math.max((h.get(i) - i/4), 0);

		System.out.println(sum);
	}
}

Measured memory_bytes: 20724
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] yoho = br.readLine().toCharArray();
		char[] result = br.readLine().toCharArray();

		int count = 0;

		for (int i = 0; i < yoho.length; i++) {
			if (yoho[i] == result[i])
				count++;
		}

		System.out.println(count);
	}

}


Measured memory_bytes: 22996
# include<stdio.h>
int main(void) {
    int a,b,k;
    scanf("%d%d",&a,&b);
    if((a+b)%2 != 0) {
        printf("IMPOSSIBLE\n");
        return 0;
    }
    printf("%d\n", (a+b)/2);
    return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep (i, n) cin >> a[i];
    ll res = 0;
    rep (i, 60) {
        ll one = 0;
        rep (j, n) if (a[j] & (1ll << i)) one++;
        res += (((((1ll << i) % MOD) * one) % MOD) * (n - one)) % MOD;
        res %= MOD;
    }
    cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 2560
import java.util.*;

/**
 * Created by Harry on 4/1/20.
 */
public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        List<Integer>[] graph = new ArrayList[n+1];
        int[] in = new int[n+1];
        for(int i=0; i<m; i++){
            int from = scanner.nextInt();
            int to = scanner.nextInt();
            if(graph[from]==null){
                graph[from] = new ArrayList<>();
            }
            graph[from].add(to);
            in[to]++;
        }

        Queue<Integer> q = new LinkedList<>();
        for(int node=1; node<=n; node++){
            if(in[node]==0){
                q.offer(node);
            }
        }

        int res = 0;
        int[] len = new int[n+1];
        while(!q.isEmpty()){
            int node = q.poll();
            if(graph[node]==null) continue;
            for(int next : graph[node]){
                len[next] = Math.max(len[next], len[node]+1);
                res = Math.max(res, len[next]);
                if(--in[next]==0){
                    q.offer(next);
                }
            }
        }
        System.out.print(res);
    }
}


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

int main () {
    long long  a, b, k, k1;
    cin >> a >> b >> k;
    k1 = min(a, k); 
    a -= k1;
    b -= min(b, k-k1);
    cout << a << " " << b << endl;
    return 0;
}

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

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

int main(void){
    int num[3];

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> num[0] >> num[1] >> num[2];
    sort(num, num + 3);
    cout << num[2] * 10 + num[1] + num[0] << "\n";
    return 0;
}


Measured memory_bytes: 256
while True:
    n,m=map(int,input().split())
    if n==0 and m==0:
        break
    else:
        s=sorted(list(map(int,input().split())))
        ans=0
        for i in range(n):
            for j in reversed(range(i+1,n)):
                if s[i]+s[j]>m:
                    continue
                else:
                    ans=max(ans,s[i]+s[j])
                    break
        if ans==0:
            print("NONE")
        else:
            print(ans)



Measured memory_bytes: 5636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define ull unsigned long long

int compare_smallorder(const void *a, const void *b){return *(int*)a - *(int*)b;}

int main(){
    int n,a[200002]={},b[200002]={},i,dp[1000002]={},j,ans=0,num=0;
    scanf("%d",&n);
    for (i=0; i<n; i++) scanf("%d",&a[i]);
    if (n==1) {
        printf("%d",1);
        return 0;
    }
    qsort(a, n, sizeof(a[0]), compare_smallorder);
    for (i=0; i<n-1; i++) {
        if (a[i]!=a[i+1]) {
            b[num]=a[i];num++;
        }else dp[a[i]]=1;
    }
    if (num==0) {
        printf("%d",0);
        return 0;
    }else b[num]=a[n-1];
    for (i=0; i<n; i++) {
        for (j=2; j*a[i]<=a[n-1]; j++) dp[j*a[i]]=1;
    }
    for (i=0; i<n; i++) if (dp[a[i]]==0) ans++;
    printf("%d",ans);
    return 0;
}


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

int	main(void)
{
  	char	s[100];
  	int		num;
  	int		i;
  	int		len;
  
  	num = scanf("%s", s);
  	if (num != 1)
      	return (0);
  
  	len = strlen(s);
  
  	for (i = 0; i < len; i++)
    {
      	printf("%s", "x");
    }
  	return (0);
}

Measured memory_bytes: 128
n = gets.to_i
a,b=gets.split.map(&:to_i)
ps = gets.split.map(&:to_i)

p1=ps.select{|p|p<=a}.length
p2=ps.select{|p|a<p&&p<=b}.length
p3=ps.select{|p|b<p}.length

p [p1,p2,p3].min


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll A, B, C; cin >> A >> B >> C;
    string ans = "No";
    if (A > B){if (A >= C && C >= B){ans = "Yes";}}
    else if (A < B){if (A <= C && C <= B){ans = "Yes";}}
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


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

    ll b[n-1];
    inrep(n-1,b);
    ll a[n] = {};
    
    a[0] = linf;
    rep(i,0,n-1){
	a[i+1] = linf;
	a[i] = min(a[i],b[i]);
	a[i+1] = min(a[i+1],b[i]);
    }

    ll ans = 0;
    rep(i,0,n)ans += a[i];
    P(ans);
    return  0;
}


Measured memory_bytes: 256
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
l = []
mod = []
for i in range(5):
    num = ii()
    l.append((num+9)//10*10)
    if num%10 == 0:
        mod.append(10)
    else:
        mod.append(num%10)
a = 10-min(mod)
print(sum(l)-a)



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

using namespace std;

const int max_n = 100111, mod = 1000000007;

int mul(int x, int y) {
    return (1LL * x * y) % mod;
}

int power(int a, int b) {
    if (b == 0) {
        return 1 % mod;
    }
    if (b % 2 == 0) {
        return power(mul(a, a), b / 2);
    }
    return mul(a, power(a, b - 1));
}

int inv(int x) {
    return power(x, mod - 2);
}

const int max_f = 100111;

int f[max_f], rf[max_f];

void get_all_f() {
    f[0] = rf[0] = 1;
    for (int i = 1; i < max_f; ++i) {
        f[i] = mul(i, f[i - 1]);
    }
    rf[max_f - 1] = inv(f[max_f - 1]);
    for (int i = max_f - 2; i > 0; --i) {
        rf[i] = mul(i + 1, rf[i + 1]);
    }
}

int get_c(int n, int k) {
    if (n < k) {
        return 0;
    }
    return mul(f[n], mul(rf[k], rf[n - k]));
}

int n, k, dp[max_n];
vector<int> g[max_n];

void dfs(int v, int p) {
    dp[v] = 1;
    int cnt = 0;
    for (int to : g[v]) {
        if (to == p) {
            continue;
        }
        dfs(to, v);
        dp[v] = mul(dp[v], dp[to]);
        ++cnt;
    }
    if (v != 1) {
        dp[v] = mul(dp[v], mul(get_c(k - 2, cnt), f[cnt]));
    } else {
        dp[v] = mul(dp[v], mul(get_c(k, cnt + 1), f[cnt + 1]));
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    get_all_f();
    scanf("%d%d", &n, &k);
    for (int i = 1; i < n; ++i) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(1, -1);
    printf("%d\n", dp[1]);
    return 0;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
    int K;
    cin >> K;
    K--;
    cout << a[K] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

signed main() {
	int n,z,w;
	std::cin >> n >> z >> w;
	std::vector<int> a(n);
	rep(i,n) std::cin >> a[i];
	if(n==1) {
		print(std::abs(a[0]-w));
		return 0;
	}
	print(std::max(std::abs(a[n-1]-w),std::abs(a[n-1]-a[n-2])));
	return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	sps := sprimes(1e6 + 10)
	as := make([]int, n)
	g := 0
	pm := make(map[int]int)
	for i := 0; i < n; i++ {
		as[i] = nextInt()
		g = gcd(g, as[i])
		pf := primeFactoriation(as[i], sps)
		for p := range pf {
			pm[p]++
		}
	}

	if g != 1 {
		fmt.Println("not coprime")
		return
	}

	for p, c := range pm {
		if p > 1 && c > 1 {
			fmt.Println("setwise coprime")
			return
		}
	}

	fmt.Println("pairwise coprime")
}

func sprimes(n int) []int {
	ps := make([]int, n+1)
	for i := 0; i <= n; i++ {
		ps[i] = i
	}
	for i := 2; i*i <= n; i++ {
		if ps[i] == i {
			for j := i + i; j <= n; j += i {
				if ps[j] == j {
					ps[j] = i
				}
			}
		}
	}
	return ps
}

func primeFactoriation(n int, sps []int) map[int]int {
	pm := make(map[int]int)
	for n != 1 {
		pm[sps[n]]++
		n /= sps[n]
	}
	return pm
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 42284
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
void fp(bool flag, string s, string t){
    if(flag)cout << s << endl;
    else cout << t << endl;
}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n;
    cin >> n;
    cout << 800 * n - (n / 15 * 200) << endl;
    return 0;
}

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

int H, W, A[500][500];

int main(){
    cin >> H >> W;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++)    cin >> A[i][j];
    }

    int N = 0;
    vector< pair<int, int> > ans1;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(j+1 < W && A[i][j] % 2 == 1){
                A[i][j]--;
                A[i][j+1]++;
                N++;
                ans1.push_back( make_pair(i, j) );
            }
        }
    }

    vector< pair<int, int> > ans2;
    for(int i=0;i<H;i++){
        if(i+1 < H && A[i][W-1] % 2 == 1){
            A[i][W-1]--;
            A[i+1][W-1]++;
            N++;
            ans2.push_back( make_pair(i, W-1) );
        }
    }

    cout << N << endl;
    for(int i=0;i<ans1.size();i++){
        cout << ans1[i].first + 1 << " " << ans1[i].second + 1 << " ";
        cout << ans1[i].first + 1 << " " << ans1[i].second + 2 << endl;
    }
    for(int i=0;i<ans2.size();i++){
        cout << ans2[i].first + 1 << " " << ans2[i].second + 1 << " ";
        cout << ans2[i].first + 2 << " " << ans2[i].second + 1 << endl;
    }
}

Measured memory_bytes: 4212
S = input().rstrip()
N = len(S)
ans = 0
from collections import Counter
for i in range(N):
    for j in range(i + 1, N + 1):
        flag = 1
        s = S[i:j]
        c = Counter(s)
        for k in c.keys():
            if k != "A" and k != "C" and k != "G" and k != "T":
                flag = 0
                break
        if flag:
            ans = max(ans, len(s))       

print(ans)

Measured memory_bytes: 38532
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"
  int N, tmp;
  cin >> N;
  vi X(N), Y(N);
  REP(i, N) {
    cin >> tmp;
    X.at(i) = tmp;
    Y.at(i) = tmp;
  }
  sort(X.begin(), X.end());
  int s = X.at((N / 2) - 1), l = X.at(N / 2);
  for (auto a : Y) {
    if (a <= s)
      cout << l << endl;
    else if (a >= l)
      cout << s << endl;
  }
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;

void solve()
{
	int flag=0;
	string s;
	cin>>s;
	int n=s.length();
	for(int i=0;i<n;i++)
	{
		if(s[i]!=s[n-i-1])
			{flag=1;break;}
	}
	for(int i=0;i<(n-1)/2;i++)
	{
		if(s[i]!=s[(n-2*i-3)/2])
			{flag=1;break;}	
	}
	string sp="";
	for(int i=(n+1)/2;i<n;i++)
	{
		sp+=s[i];
	}
	for(int i=0;i<sp.length();i++)
	{
		if(sp[i]!=sp[sp.length()-i-1])
			{flag=1;break;}
	}
	if(flag==1)
		cout<<"No";
	else
		cout<<"Yes";
}
 
int main()
{
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int H,W;
		int i,j,k,n;
	while(1){
		scanf("%d %d",&H,&W);
		if(H == 0 && W == 0)break;
			for(i = 0; i < H; i++){
				for(j = 0; j < W; j++){
					k = i % 2;
					n = j % 2;
					if(k == 0 && n == 0){
						printf("#");
					}
					else if(k == 1 && n == 0){
						printf(".");
					}
					else if(k == 0 && n == 1){
						printf(".");
					}
					else if(k == 1 && n == 1){
						printf("#");
					}
			}
				printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2604
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfenv>
#include <cfloat>
#include <cinttypes>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstdbool>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctgmath>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <strstream>
#include <tuple>
#include <typeinfo>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>

#define fori(n) for(long long i=0;i<n;i++)
#define forr(i,x,y) for(long long i=x;i<y;i++)
#define forj(n) for(long long j=0;j<n;j++)
#define ll long long
#define d7 1000000007
#define en cout<<"\n";

using namespace std;

void dfs(ll s, vector<bool> &v, vector<ll> adj[]){
    if(v[s]) return;
    v[s]=true;
    //cout<<s+1<<" ";
    for(auto u: adj[s]){
        if(!v
           [u]){
            dfs(u,v,adj);}
    }
}
ll binomialCoeff(ll n, ll k){
   ll C[n + 1][k + 1];ll i, j;
   for (i = 0; i <= n; i++){
       for (j = 0; j <= min(i, k); j++){
           if (j == 0 || j == i){C[i][j] = 1;}
           else{C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);}}}
   return C[n][k];
}
void bfs(vector<ll> &dis, vector<ll> adj[], ll s, vector<ll> &parent){
    dis[s]=0;
    //parent[s]=-1;
    queue<ll> q;
    q.push(s);
    while(!q.empty()){
        ll z=q.front();
        //cout<<z<<" ";
        q.pop();
        for(auto v:adj[z]){
            if(dis[v]==0){
            q.push(v);
            dis[v]=dis[z]+1;
                parent[v]=z;
            }
        }
    }
}

ll modexp(ll x, ll n,ll m){
    if(n==0) return 1%m;
    ll u=modexp(x,n/2,m);
    u=(u*u)%m;
    if(n%2==1) u=(u*x)%m;
    return u;
}

ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b, a%b);
}

tuple<ll,ll,ll,ll> expA(tuple<ll,ll,ll,ll> v, ll n){
    if(n==0){return {1,0,1,0};}
    if(n==1){return v;}
        ll x1,y1,z1,w1;
        ll x2,y2,z2,w2;
        tie(x1,y1,z1,w1) = expA(v, n/2);
        x2=(x1*x1+y1*z1)%d7;
        y2=(x1*y1+y1*w1)%d7;
        z2=(z1*x1+w1*z1)%d7;
        w2=(z1*y1+w1*w1)%d7;
    if(n%2==0){
        return {x2,y2,z2,w2};
    }
    else{
        return {x2+z2,y2+w2,x2,y2};
    }
}

int main(){
    
    ll n;
    cin>>n;
    
    ll sum=0;
    fori(n){
        if((i+1)%5==0||(i+1)%3==0) continue;
        sum+=i+1;
    }
    cout<<sum;
    
    return 0;
}


Measured memory_bytes: 3632
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_11_A&lang=jp
  * Structure and Class - Dice I
  */
object Main {

  class Dice(numbers: IndexedSeq[Int]) {
    def rotateTo(direction: Char): Dice = {
      direction match {
        case 'N' => new Dice(IndexedSeq(numbers(1), numbers(5), numbers(2), numbers(3), numbers(0), numbers(4)))
        case 'S' => new Dice(IndexedSeq(numbers(4), numbers(0), numbers(2), numbers(3), numbers(5), numbers(1)))
        case 'W' => new Dice(IndexedSeq(numbers(2), numbers(1), numbers(5), numbers(0), numbers(4), numbers(3)))
        case 'E' => new Dice(IndexedSeq(numbers(3), numbers(1), numbers(0), numbers(5), numbers(4), numbers(2)))
      }
    }

    def apply(number: Int): Int = {
      numbers(number)
    }
  }

  def main(args: Array[String]): Unit = {
    val dice = new Dice(io.StdIn.readLine().split(" ").map(_.toInt))
    val operations = io.StdIn.readLine()
    val operatedDice = operations.foldLeft(dice)(_.rotateTo(_))
    println(operatedDice(0))
  }
}

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

int main() {
    int n, k;
    cin >> n >> k;
    double a = 1.0 / n;
    double b = 1.0 / 2;
    double ans = 0.0;
    //現在の得点 = i
    for (int i = 1; i <= n; i++)
    {
        int cnt = 0, memo = i;
        while (k > memo)
        {
            memo *= 2;
            cnt++;
        }
        ans += a * pow(b, cnt);
    }
    printf("%.12f\n", ans);
    return 0;
}

Measured memory_bytes: 4084
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<random>

//使い方がよくわからない
#include<stack>
#include<queue>
#include<bitset>
#include<sstream>
#include <iomanip>

#define rep(i,n) for(int i=0;i<(n);i++) 
#define rep1(i,n) for(int i=1;i<(n);i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]){
    double a,b,x;
    cin >> a >> b >> x;
    double v = a*a*b;
    double c;
    if(x<(v*0.5)){
        c = (a*b*b)/x/2;
        std::cout << std::setprecision(10) <<(atan(c)/acos(-1)*180) << endl;
        return 0;
    }else{
        c = 2*(v-x)/(a*a*a);
        std::cout << std::setprecision(10) <<(atan(c)/acos(-1)*180) << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#undef int
#define mk make_pair
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;
#define mod 1000000007

int N, a[200005];

signed main()
{
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        a[i] = a[i] - (i + 1);
    }
    sort(a, a + N);
    int ans = 0;
    for(int i = 0; i < N; i++){
        ans += abs(a[i] - a[N / 2]);
    }
    cout << ans << endl;

    return 0;
}

/*

*/


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

int main()
{
    int n;
    std::cin >> n;
    
    std::vector<int> p(n);

    for (int i = 0; i < n; ++i)
        std::cin >> p.at(i);
    
    int count = 0;
    for (int i = 1; i < n - 1; ++i) {
        if ((p.at(i-1) - p.at(i)) * (p.at(i) - p.at(i+1)) > 0) {
            ++count;
        }
    }
    std::cout << count << std::endl;

    return 0;
}

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

int main(){
   long long int a, b, n;
   long long int res=0;
   cin >> a >> b >> n;
   long long int i=min(n,b-1);
   res=floor(a*i/b);
/*
   while (i<=n && (i/b)<1){
       long long int tmp=floor(a*i/b);
       res=max(res,tmp);
       ++i;
   }
*/
   cout << res << endl;
}

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

using namespace std;

int main(void)
{
  string s;
  cin >> s;

  bool a = false;
  bool b = false;
  bool c = false;
  if (s[0] == 'A') a = true;

  for (int i = 2; i < s.size() - 1; ++i) {
    if (s[i] == 'C') {
      b = true;
      break;
    }
  }

  int count = 0;
  for (int i = 1; i < s.size(); ++i) {
    if (islower(s[i])) ++count;
  }
  c = count == (s.size() - 2);

  cout << (a && b && c ? "AC" : "WA") << endl;

  return 0;
}

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

using namespace std;

void solve() {
  int N;
  cin >> N;
  vector<vector<int>> L(N), R(N);
  int64_t res = 0;
  for (int i = 0; i < N; i++) {
    int k, l, r;
    cin >> k >> l >> r;
    res += min(l, r);
    k--;
    if (l > r) {
      L[k].emplace_back(abs(l - r));
    } else {
      if (k + 1 < N) R[k + 1].emplace_back(abs(l - r));
    }
  }
  priority_queue<int, vector<int>, greater<int>> que;
  for (int i = 0; i < N; i++) {
    if (!L[i].empty()) {
      for (auto x : L[i]) {
        que.push(x);
      }
    }
    while ((int)que.size() > i + 1) {
      que.pop();
    }
  }
  while (!que.empty()) {
    res += que.top();
    que.pop();
  }
  for (int i = N - 1; i > -1; i--) {
    if (!R[i].empty()) {
      for (auto x : R[i]) {
        que.push(x);
      }
    }
    while ((int)que.size() > N - i) {
      que.pop();
    }
  }
  while (!que.empty()) {
    res += que.top();
    que.pop();
  }
  cout << res << '\n';
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  for (int i = 0; i < T; i++) {
    solve();
  }
  return 0;
}


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

using namespace std;
using ll = long long;
ll pow(ll n, ll m);
int main() {
	ll n, m;
	cin >> n >> m;
	ll k;
	k=pow( n,  m);
	cout << k << endl;
	
	
}
ll pow(ll n, ll m) {
	ll res = 1;
	int z = 1000000007;
	while (m > 0) {
		if (m & 1) {
			res *= n;
			res = res%z;
		}
		n = n*n;
		n = n%z;
		m >>= 1;
	}
	return res;
}

Measured memory_bytes: 3060
/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog ender-zzm.enbar.cn
*/
#include <bits/stdc++.h>
using namespace std;

inline int read(){
    register int x = 0, flag = 1;
    register char ch;
    while (!isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), isdigit(ch = getchar()));
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define For(i, x, y) for (int i = (x); i <= (y); i++) 
#define Rep(i, x, y) for (int i = (x); i >= (y); i--) 

const int maxn = 4010;
const int maxm = 4010;
int n, m, k;
int head[maxn], net[maxm], to[maxm], tot;
inline void add(int x, int y) {
	net[++tot] = head[x]; head[x] = tot; to[tot] = y;
}
int deep[maxn];
struct Point {
	int x, y;
}que[maxn];
void dfs(int x, int cant, int fa) {
	deep[x] = deep[fa] + 1;
	for (int i = head[x]; i; i = net[i]) {
		int v = to[i];
		if (v == fa || v == cant) continue;
		dfs(v, cant, x);
	}
}
int main() {
	n = read(), k = read();
	for (int i = 1; i < n; i++) {
		int x, y;
		x = read(), y = read();
		add(x, y), add(y, x);
		que[i].x = x, que[i].y = y;
	}
	if (k % 2 == 0) {
		int ans = n + 1;
		deep[0] = -1;
		for (int i = 1; i <= n; i++) {
			int tmp = 0;
			dfs(i, 0, 0);
			for (int j = 1; j <= n; j++) {
				if (deep[j] > (k / 2)) tmp++;
			}
			ans = min(ans, tmp);
		}
		cout << ans << endl;
		return  0;
	}
	if (k % 2 == 1) {
		int ans = n + 1;
		deep[0] = -1;
		for (int i = 1; i <= n - 1; i++) {
			int x, y, tmp = 0;
			x = que[i].x, y = que[i].y;
			dfs(x, y, 0); dfs(y, x, 0);
			for (int j = 1; j <= n; j++) {
				if (deep[j] > (k / 2)) tmp++;
			}
			ans =min(ans, tmp);
		}
		cout << ans << endl;
	}
	return 0;
}


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

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

		if( a >= b )
		{
		cout << "No" << endl;
		}else{
			if( b >= c)
			{
			cout << "No" << endl;
			}else{
			cout << "Yes" << endl;
			}
		}

}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define ALL(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define sz(x) (long long)(x.size())
#define lt(x) (long long)(x.length())
#define MOD 1000000007 
#define mx 52

long long dep[mx][mx][mx * mx];
long long n, a[mx], k;


long long dp(long long now, long long ambil, long long sum){
	if(now == n){
		if(ambil == 0)
			return 0;
		if(sum % ambil == 0 && sum / ambil == k)
			return 1;
		return 0;
	}
	long long &ret = dep[now][ambil][sum];
	if(ret != -1)
		return ret;
	ret = dp(now + 1, ambil, sum) + dp(now + 1, ambil + 1, sum + a[now]);
	return ret;
}

int main(){
	reset(dep, -1);
	cin >> n >> k;
	for(long long i = 0; i < n; i++)
		cin >> a[i];
	cout << dp(0, 0, 0) << endl;	
}

Measured memory_bytes: 57344
#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;

//i*2^X>=K
//2^X>=
int main() {
	long long N, K;
	cin >> N >> K;
	vector<long long> ruiseki(N + 2);//ruiseki(i):0~iまでの総和
	for (size_t i = 1; i <= N+1; i++)
	{
		ruiseki.at(i) = ruiseki.at(i - 1) + (i);
		ruiseki.at(i) %= mod;
		//cout << ruiseki.at(i)<<endl;
	}

	long long unchoose = 0;
	long long ans = 0;
	for (size_t i = K; i <= N+1; i++)
	{
		if (i == N + 1)
		{
			ans++;
			continue;
		}
		unchoose = N + 1 - i;
		//i個選んだ値の最大値:
		ans += (ruiseki.at(N)-ruiseki.at(unchoose-1)-ruiseki.at(i-1)+1) % mod;
		ans %= mod;
		while (ans < 0)
		{
			ans += mod;
		}
		//cout<< (ruiseki.at(N) - ruiseki.at(unchoose-1)) % mod<<endl;

	}
	while (ans<0)
	{
		ans += mod;
	}
	cout << ans;
}

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

using namespace std;

int k=0,res=0;
string n="";
int dp[101][4][2];

int main()
{
	cin >> n >> k;	
	dp[0][0][0] = 1;
	for (int i=0; i<n.size(); i++)	
	{
		int x = (n[i]-'0');
		for (int j=0; j<4; j++)
		{
			for (int s=0; s<2; s++)
			for (int l=0; l<10; l++)
			{
				int ni=i+1,nj=j, ns=s;
				if (l!=0)
					nj++;	
				if (nj>k)
					continue;
				if (ns==0)
				{
					if (l>x)
						continue;
					if (l<x)
						ns = 1;
				}
				dp[ni][nj][ns]+=dp[i][j][s];
			}
		}
	}
	cout << dp[n.size()][k][0]+dp[n.size()][k][1];
	return 0;
}


Measured memory_bytes: 256