akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    int N;
    cin >> N;
    int M;
    cin >> M;
    vector<int> AC(N + 1);
    vector<int> WA(N+1);
    int nac = 0;
    for(int i =0; i < M; i++){
        int p;
        string s;
        cin >> p >> s;
        if(AC[p]) continue;
        else{
            if(s == "AC"){
                AC[p] = 1;
                nac++;
            }
            else WA[p]++;
        }
    }
    int npena = 0;
    for(int i = 1; i <= N; i++){
        if(AC[i]) npena += WA[i];
    }
    cout << nac << " " << npena << endl;
}

Measured memory_bytes: 1024
package main

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

func main() {
    var fp *os.File = os.Stdin
    reader := bufio.NewReaderSize(fp, 1024)

    line := readLine(reader)
    arr := strings.Split(line, " ")
    N, _ := strconv.Atoi(arr[0])
    M, _ := strconv.Atoi(arr[1])
    var res []int = make([]int, N)

    for i := 0; i < M; i++ {
        arr := strings.Split(readLine(reader), " ")
        n, _ := strconv.Atoi(arr[0])
        res[n-1]++
        m, _ := strconv.Atoi(arr[1])
        res[m-1]++
    }

    for _, v := range res {
        fmt.Println(v)
    }
}

func readLine(reader *bufio.Reader) string {
    buf := make([]byte, 0, 1024)

    for {
        l, p, _ := reader.ReadLine()

        buf = append(buf, l...)

        if !p {
            break
        }
    }

    return string(buf)
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

int main() {
  int n;cin>>n;
  vector<int> v;
  int l=1;
  while(n>0){
    if(n>=l){
      v.push_back(l);
      n-=l;
      ++l;
    } else {
      break;
    }
  }
  for(int i=0;i<n;++i) ++v[v.size()-1-i];
  for(int j=0;j<v.size();++j) cout << v[j] << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i > 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int main() {
  int k, x;
  cin >> k >> x;
  FOR(i, max(-1000000, x - k + 1), min(x + k, 1000000)) {
    cout << i << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main{
    public static void main(String args[])throws IOException{
      try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
        //input
        int n = Integer.parseInt(br.readLine());;
        String str = br.readLine();

        if(n%2 != 0){
          System.out.println("No");
        }else{
          String tmp_str = str.substring(0, n/2);
          tmp_str = tmp_str + tmp_str;
          if(str.equals(tmp_str)){
            System.out.println("Yes");
          }else{
            System.out.println("No"); 
          }
        }
        
      }
    }
}

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

struct RollingHash {
  static constexpr int SIZE = 2;
  static constexpr array<uint64_t, SIZE> mod = {1000000007, 1000000009};
  static constexpr array<uint64_t, SIZE> base = {1009, 1007};
  const int n;
  vector<vector<unsigned>> h, pw;

  RollingHash(const string& s) : n(s.length()) {
    h.assign(SIZE, vector<unsigned>(n + 1, 0));
    pw.assign(SIZE, vector<unsigned>(n + 1, 1));
    for (int i = 0; i < SIZE; i++) {
      for (int j = 0; j < n; j++) {
        h[i][j + 1] = (h[i][j] * base[i] + s[j]) % mod[i];
        pw[i][j + 1] = pw[i][j] * base[i] % mod[i];
      }
    }
  }

  inline unsigned get(int l, int r, int k) const {
    return (h[k][r] + (mod[k] - h[k][l]) * pw[k][r - l]) % mod[k];
  }

  bool match(int l1, int r1, int l2, int r2) const {
    for (int i = 0; i < SIZE; i++) {
      if (get(l1, r1, i) != get(l2, r2, i)) return false;
    }
    return true;
  }

  int lcp(int i, int j) {
    int ok = 0;
    int ng = min(n - i, n - j) + 1;
    while (ng - ok > 1) {
      int m = (ok + ng) / 2;
      (match(i, i + m, j, j + m) ? ok : ng) = m;
    }
    return ok;
  }
};
constexpr array<uint64_t, RollingHash::SIZE> RollingHash::mod; 
constexpr array<uint64_t, RollingHash::SIZE> RollingHash::base; 

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  RollingHash rh(s);
  auto f = [&](int x) {
    using P = pair<unsigned, unsigned>;
    map<P, int> mp;
    for (int i = 0; i + x - 1 < n; i++) {
      P p = {rh.get(i, i + x, 0), rh.get(i, i + x, 1)};
      if (mp.find(p) != end(mp)) {
        if (i - mp[p] >= x) return true;
      } else {
        mp[p] = i;
      }
    }
    return false;
  };
  int ok = 0, ng = n / 2 + 1;
  while (ng - ok > 1) {
    int m = (ok + ng) / 2;
    (f(m) ? ok : ng) = m;
  }
  cout << ok << endl;
}


Measured memory_bytes: 640
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

LL sum;
int main() {
	map<LL,LL> done;
	int N;
	cin >> N;
	done[0]=1;
	LL ret=0;
	for(int i=0;i<N;i++){
		LL A;
		cin >> A;
		sum+=A;
		ret+=done[sum];
		done[sum]++;
	}
	cout << ret << endl;

	return 0;
}



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

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

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

int main() {
    string s;
    map<string, int> m;
    for (int i = 0; i < 26; ++i) {
        m[string{char(i/5+'1'), char(i%5+'1')}] = 'a'+i;
    }
    m["62"] = '.';
    m["63"] = '?';
    m["64"] = '!';
    m["65"] = ' ';
    while(getline(cin, s)){
        if(s.size()&1){
            puts("NA");
            continue;
        }
        string ans;
        for (int i = 0; i < s.size(); i += 2) {
            if(m.count(s.substr(i, 2))){
                ans += m[s.substr(i, 2)];
            }else{
                ans.clear();
                break;
            }
        }
        if(ans.empty()) puts("NA");
        else cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 3192
#include "bits/stdc++.h"
#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)
using namespace std;

int main(){
    
    int a,b = 0;
    
    rep(i,0,10){
        cin >> a ;
        b += a;
    }
    cout << b << endl;
    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
using namespace std;
using namespace __gnu_pbds;
 
#define debug(s) cout << #s << " = " << s << endl
#define all(v) (v).begin(), (v).end()
#define mem(a,val) memset(a, val, sizeof a)
 
#define maxn 100010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;
 
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll solve(ll l) {
  if (l % 4 == 0) return l;
  if (l % 4 == 1) return 1;
  if (l % 4 == 2) return l + 1;
  return 0;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll l, r;
  cin >> l >> r;
  l--;
  ll cl = solve(l);
  ll cr = solve(r);
  ll ans = cl ^ cr;
  cout << ans << endl;
}





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

using namespace std;

typedef long long int ll;

const int N = 1e7 + 5;

vector < ll > f (N, 1);

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

  for (int i = 2; i < N; i++) {
    for (int j = i; j < N; j += i) f[j]++;
  }

  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i <= n; i++) ans += i * f[i];

  cout << ans << '\n';
}


Measured memory_bytes: 81252
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

#define ll         long long
#define PI         acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

int N;
int A[100];
int res_a = 0;
int res_b = 0;

int main(){
    cin >> N;
    for (size_t i = 0; i < N; i++) {
      cin >> A[i];
    }
    sort(A, A + N, greater<int>());
    for (int i = 0; i < N; ++i) {
      if (i % 2 == 0) {
        res_a += A[i];
      } else {
        res_b += A[i];
      }
    }
    
    cout << res_a - res_b; 
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 rep(i, s, N) for(ll i{s}; i < N; i++)
#define iikae auto&
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

int main(){
  kyopro;
  ll N, M;
  cin >> N >> M;
  vector<vector<ll>> s(M);
  for(auto&& i : s){
    ll k;
    cin >> k;
    i.resize(k);
    for(auto&& youso : i){
      cin >> youso;
      --youso;
    }
  }
  vector<ll> p(M);
  for(auto&& youso : p){
    cin >> youso;
  }
  ll ans{};
  //すべてのスイッチの組み合わせに対して検査
  rep(suitchi, 0, 1 << N ){
    ll yuukou = 1;
    //ある組み合わせに対しすべての電球で調査
    rep(j, 0, M){
      iikae denkyu = s.at(j);
      ll onnnokazu{};
      //ある電球に対し、スイッチの偶奇を調査
      for(auto&& arusuitchi : denkyu){
        if ((suitchi >> arusuitchi) % 2){
          onnnokazu++;
        }
      }
      //条件に反しない電球があれば無効化
      if(onnnokazu % 2 != p.at(j)) yuukou = 0;
    }
    ans += yuukou;
  }
  cout << ans << rt;
}

Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

a=int(input())
print(a+a**2+a**3)

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

using namespace std;

const int MAXK=200111;

int N, M, K;

struct Node{
	int x, y;
	Node(){}
	Node(int _x, int _y){x=_x;y=_y;}
} T[MAXK], At;

bool cmpxy(Node A, Node B){
	if(A.x==B.x)	return A.y<B.y;
	return A.x<B.x;
}

void Go(Node &at, Node P){
	P.x-=(at.x-1);P.y-=(at.y-1);
	if(P.x<P.y){
		at.x+=P.x-1;at.y+=P.x-1;
	}
	else if(P.y<P.x){
		at.x+=P.x-2;at.y+=P.x-1;
	}
	else	{at.x+=P.x-1;at.y+=P.x-2;}
}

int main(){
	ios_base::sync_with_stdio(false);
	
	cin >> N >> M >> K;
	
	for(int i=1;i<=K;++i)	cin >> T[i].x >> T[i].y;
	
	sort(T+1, T+K+1, cmpxy);
	T[++K]=Node(N+1, 0);
	
	At=Node(1, 1);
	for(int i=1;i<=K;++i){
		if(i>1 && T[i].x==T[i-1].x)	continue;
		Go(At, T[i]);
		if(At.x!=T[i].x)	break;
	}
	
	cout << At.x << endl;
	
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define N_MAX 1000
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

bool pn_flag[N_MAX]; //prime_numbers(素数)の略。配列のfalseのところが素数となる。
int exp[N_MAX]; //exponent(べき指数)の略　素数のべき指数の数を保存する変数。


void pn(int n){ //prime_numbers(素数)の略
  for(int i = 2; i <=n; i++){
    for(int j = 2*i; j <=n; j+=i){
      pn_flag[j] = 1;
    }
  }
}

ull fpn(int N){//factorization_in_prime_numbers(素因数分解)の略
  ull cnt=1;
  int n;
  for(int i = 2; i <= N; i++){
    n = i;
    for(int j = 2; j <= i; j++){
      if(pn_flag[j] == 0){
        while(n%j == 0){
          n /= j;
          exp[j]++;
        }
      }
    }
  }

  for(int i = 2; i <= N; i++){
    if(exp[i] != 0){
      exp[i]++;
      cnt *= exp[i];
      cnt %= 1000000007;
    }
  }
  return cnt;
}

int main(){
  int N;
  ull cnt=0;
  cin >> N;
  pn(N);
  cout << endl;
  cnt = fpn(N);
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <deque>

using namespace std;
int main(int argc, char const *argv[])
{
	string A,B,C;
	cin>> A >> B >> C;

	deque<char> sA,sB,sC;

	for(auto ch : A){
		sA.push_back(ch);
	}

	for(auto ch : B){
		sB.push_back(ch);
	}

	for(auto ch : C){
		sC.push_back(ch);
	}

	char curr = 'a';

	while(true){
		if(curr == 'a'){
			if (sA.empty()){
				cout << "A" << endl;
				break;
			}
			curr = sA.front();
			sA.pop_front();
		}
		else if(curr == 'b'){
			if (sB.empty()){
				cout << "B" << endl;
				break;
			}
			curr = sB.front();
			sB.pop_front();
		}
		else if(curr == 'c'){
			if (sC.empty()){
				cout << "C" << endl;
				break;
			}
			curr = sC.front();
			sC.pop_front();
		}

	}
	return 0;
}

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

constexpr long long N = 111100;
long long int Q, r, l, a[111111];
bool b[111111];
vector<long long> p, L;

int main(){
    b[0] = b[1] = true;
    for(long long int i = 2; i < N; ++i){
        if(!b[i])p.push_back(i);
        for(long long int j = i * i; j < N; j += i){
            b[j] = true;
        }
    }
    for(int i = p.size() - 1; i >= 0; --i){
        if(!b[(p[i] + 1) / 2])++a[p[i]];
    }
    partial_sum(a, a + N, a);
    scanf("%lld", &Q);
    for(int i = 0; i < Q; ++i){
        scanf("%lld%lld", &l, &r);
        cout << a[r] - a[l - 1] << endl;
    }
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main(void){
        int a, b;
        
        while(cin >> a >> b) {
                if(a == 0 && b == 0) {
                        break;
                }

                for(int i = 0; i < a; i++) {
                        for(int j = 0; j < b; j++) {
                                cout << "#";
                        }
                        cout << endl;
                }
                cout << endl;
        }
                
        return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

int n;
vvi to;

int solve(int sv) {
  queue<int> q;
  vi dist(n,INF);
  q.push(sv);
  dist[sv] = 0;
  int res = 0;
  while (sz(q)) {
    int v = q.front(); q.pop();
    maxs(res,dist[v]+1);
    for (int u : to[v]) {
      if (dist[u] != INF) continue;
      dist[u] = dist[v]+1;
      q.push(u);
    }
  }
  rep(i,n) {
    for (int j : to[i]) {
      if (abs(dist[i]-dist[j]) != 1) return -1;
    }
  }
  return res;
}

int main() {
  scanf("%d",&n);
  to = vvi(n);
  rep(i,n) {
    string s;
    cin>>s;
    rep(j,n) {
      if (s[j] == '1') {
        to[i].pb(j);
      }
    }
  }
  int ans = -1;
  rep(i,n) maxs(ans,solve(i));
  cout<<ans<<endl;
  return 0;
}






















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

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

Measured memory_bytes: 5184
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		int[] t = new int[N];
		for(int i = 0 ; i < N ; i++) {
			t[i] = sc.nextInt();
		}
		long total = 0;
		for(int i = 0 ; i < N ; i++) {
			if(i == N - 1) {
				total += T;
			} else if(T <= t[i + 1] - t[i]) {
				total += T;
			} else if(T > t[i + 1] - t[i]){
				total += t[i + 1] - t[i];
			}
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 65192
#include<bits/stdc++.h>
using namespace std;
int  main()
{
    long long n;cin>>n;
    if(n&1)
    {
        printf("%.7f\n",(long long)((n+1LL)>>1)/(double)n);
    }
    else printf("%.7f\n",0.5);
    return 0;
}


Measured memory_bytes: 256
//
//  ALDS1_4_B_BinarySearch.cpp
//  test
//
//  Created by Sajor on 2019/3/29.
//  Copyright © 2019年 Sajor. All rights reserved.
//

#include<cstdio>
#include<algorithm>

using namespace std;

bool binarySearch(int *a, int b, int n){
    return binary_search(a, a+n, b);
}

int main()
{
    int i, n, m, S[100005], count=0, b;
    scanf("%d", &n);
    for(i=0; i<n; i++)
        scanf("%d", &S[i]);
    scanf("%d", &m);

    for(i=0; i<m; i++){
        scanf("%d", &b);
        if(binarySearch(S, b, n)) count++;
    }
    
    printf("%d\n", count);
    
    //        scanf("%d", &T[i]);
    
    
    
}



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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s;
    cin >> s;
    int n = s.length();

    vector<int> sa = suffix_array(s), lcp = lcp_array(s, sa);
    cout << ((long long) n * n + n) / 2 - accumulate(lcp.begin(), lcp.end(), 0LL) << "\n";

    return 0;
}


Measured memory_bytes: 15616
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		Queue<Long> que = new ArrayDeque();
		Long lastScore = 0L;
		for(int i=0; i<N; i++) {
			long a = Long.parseLong(sc.next());
			que.add(a);
			if(que.size()>K) {
				if(que.peek() < a) {
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
				que.poll();
			}
		}
	}
}



Measured memory_bytes: 65128
#include <bits/stdc++.h>
#define rep(begin, end) for (i=begin;i<end;i++)
#define repj(begin, end) for (j=begin;j<end;j++)
#define init(arr, end, val) for (i=0;i<end;i++) arr[i] = val;
#define printint(i0, i1) printf("%d %d\n", i0, i1)

using namespace std;
typedef long long int ll;
const int inf = 1000000000;
const int mod = 1000000007;
const int nil = -1;
ll i, n, m, k, ans = 0;
ll a=0, front=0;

int main() {
    scanf(" %lld", &n);
    rep(0,n) {
        front = a;
        scanf(" %lld", &a);
        if (front > a) {
            ans += front - a;
            a = front;
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 3836
# -*- coding: utf-8 -*-
def prim(edges, *, start=0, adj_matrix=False, default_value=float('inf')):
    '''
    Returns the Minimum Spanning Tree(MST) of a given graph

    # sample input when given as adjacency matrix
    edges = [[0, 2, 5, 4, inf, inf],           # node 0
             [2, 0, inf, 3, 6, inf],           # node 1
             [5, inf, 0, 2, inf, 6],           # node 2
             [4, 3, 2, 0, 2, inf],             # node 3
             [inf, 6, inf, 2, 0, 4],           # node 4
             [inf, inf, 6, inf, 4, 0]]         # node 5

    # sample input when given not as adjacency matrix
    edges = [[(1, 2), (2, 5), (3, 4)],         # node 0
             [(0, 2), (3, 3), (4, 6)],         # node 1
             [(0, 5), (3, 2), (5, 6)],         # node 2
             [(0, 4), (1, 3), (2, 2), (4, 2)], # node 3
             [(1, 6), (3, 2), (5, 4)],         # node 4
             [(2, 6), (4, 4)]]                 # node 5
    '''

    n = len(edges)
    mst = []
    cost = 0
    T = [start]

    while True:
        tmp_edges = [(cost, (u, v)) for u in T for v, cost in enumerate(edges[u]) if cost != default_value and v not in T] if adj_matrix else\
                    [(cost, (u, v)) for u in T for v, cost in edges[u] if v not in T]

        if tmp_edges:
            min_cost, min_edge = min(tmp_edges)
            mst.append(min_edge)
            cost += min_cost
            T.append(min_edge[1])

        else:
            if len(mst) != n - 1:
                raise NoSpanningError(
                    'There is no spanning tree in this graph (search started from node{})'.
                    format(start))

            else:
                return mst, cost


class NoSpanningError(Exception):
    pass


if __name__ == '__main__':
    '''
    an example of using this function
    AIZU ONLINE JUDGE - ALDS_1_12_A
    '''

    n = int(input())
    edges = [[int(cost) if int(cost) != -1 else float('inf') for cost in input().split()] for i in range(n)]

    print(prim(edges, adj_matrix=True)[1])



Measured memory_bytes: 6472
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (int i=0;i<n;i++)
//#include <bits/stdc++.h>
using namespace std;

const long int INF=1000000007;

long long f(int n,long int m){
    long long y=1;
    for (long int i=0;i<m;i++){
        y=y*n;
        y=y%INF;
    }
    return y;
}

int main(){
    long int N;
    cin>>N;
    long long ans=f(10,N)-2*f(9,N)+f(8,N);
    ans=(ans+2*INF)%INF;

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1e9+7;
void solve()
{
    ll x;
    cin>>x;
    ll ans=0, org=100;
    while(org<x)
    {
        org=floor(1.01*org);
        ans++;
    }
    cout<<ans;
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
        solve();
}

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

using namespace std;

const long long md=1e9+7;
long long n,k,cnt[2020][2020];

int main()
{
	cin>>n>>k;
	for(int i=0;i<=2005;i++)
	{
		cnt[i][0]=1;
		for(int j=1;j<=i;j++)
			cnt[i][j]=(cnt[i-1][j-1]+cnt[i-1][j])%md;
	}
	
	for(int i=1;i<=k;i++)
		cout<<(cnt[k-1][i-1]*cnt[n-k+1][i])%md<<endl;
	return 0;
}

Measured memory_bytes: 30464
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef long long ll;
using namespace std;

const int N=400010;
char S[N],T[N];
int n,m,K,x0,y0,l,r,u,d;

int main(){
	scanf("%d%d%d%d%d",&n,&m,&K,&x0,&y0);
	scanf("%s%s",S+1,T+1);
	rep(i,1,K){
		if (S[i]=='L') l++;
		if (S[i]=='R') r++;
		if (S[i]=='U') u++;
		if (S[i]=='D') d++;
		if (y0-l<1 || y0+r>m || x0-u<1 || x0+d>n){ puts("NO"); return 0; }
		if (T[i]=='L' && y0+r>1) r--;
		if (T[i]=='R' && y0-l<m) l--;
		if (T[i]=='U' && x0+d>1) d--;
		if (T[i]=='D' && x0-u<n) u--;
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 640
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

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

int f(int x) {
	int ret = 0;
	while ((ret + 1) * (ret + 1) <= x) ret++;
	return ret;
}

int main() {
	int x;
	cin >> x;
	if (x == 1) {
		cout << 1 << endl;
		return 0;
	}
	int ans = 0;
	while (ans == 0) {
		for (int i = 2; i <= f(x); i++) {
			int tmp = x;
			while (tmp % i == 0) tmp /= i;
			if (tmp == 1) {
				ans = x;
				break;
			}
		}
		x--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;
int c[3];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	for(int i = 0; i < n; i++)
	{
		int x; cin>>x;
		if(x&1) c[0]++;
		else if(x%4==0) c[2]++;
		else c[1]++;
	}
	if(c[1]==0)
	{
		if(c[0]-c[2]<=1)
		{
			cout<<"Yes\n";
		}
		else
		{
			cout<<"No\n";
		}
	}
	else
	{
		if(c[0]>c[2])
		{
			cout<<"No\n";
		}
		else
		{
			cout<<"Yes\n";
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll a,b,c,x,count=0;
    cin>>a>>b>>c>>x;
    //cerr<<a<<" "<<b<<" "<<c<<" "<<x<<endl;
    for(int i=0;i<=a;i++)
    {
      for(int j=0;j<=b;j++)
      {
        for(int k=0;k<=c;k++)
        {
          if(i*500+j*100+k*50==x)
          {
            count++;
          }

        }
      }
    }
    cout<<count<<endl;
}
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())
 
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll, ll> P;
//const int MAX=;
 
int main(){
	int N;
	cin>>N;
	ll x[50], y[50];
	rep(i,N)cin>>x[i]>>y[i];
	
	int sc=0;
	multiset<P> st;
	
	rep(i,N)rep(j,N)if(i!=j)st.insert(make_pair(x[i]-x[j], y[i]-y[j]));
	for(auto it=st.begin(); it!=st.end(); it++){
		P p=*it;
		sc=max(sc, (int)st.count(p));
	}
	cout<<N-sc<<endl;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main{
    class Hand{
	String str;
	int type;
	boolean res = false;
	int draw=0;
	int w1, w2;

	Hand(){
	}
	Hand(String str, int type, int w1, int w2){
	    this.str = str;
	    this.type = type;
	    this.w1 = w1;
	    this.w2 = w2;
	}

	void tcount(Hand a[], int n){
	    int win = 0, lose = 0;
	    if(w1 < w2){
		for(int i = 0; i < n; i++){
		    if(a[i].type == this.type){
			draw++;
		    } else if(w1 <= a[i].type && a[i].type <= w2){
			lose++;
		    } else {
			win++;
		    }
		}
	    } else {
		for(int i = 0; i < n; i++){
		    if(a[i].type == this.type){
			draw++;
		    } else if(w1 <= a[i].type || a[i].type <= w2){
			lose++;
		    } else {
			win++;
		    }
		}
	    }
	    if(lose == 0 && draw < n){
		res = true;
	    }
	}
    }

    public Main(){
	Scanner sc = new Scanner(System.in);

	while(true){
	    int n = sc.nextInt();
	    if(n == 0){
		break;
	    }
	    Hand hand[] = new Hand[n];

	    for(int i = 0; i < n; i++){
		String str = sc.next();
		if(str.equals("Rock")){
		    hand[i] = new Hand(str, 0, 8, 14);
		} else if(str.equals("Fire")){
		    hand[i] = new Hand(str, 1, 9, 0);
		} else if(str.equals("Scissors")){
		    hand[i] = new Hand(str, 2, 10, 1);
		} else if(str.equals("Snake")){
		    hand[i] = new Hand(str, 3, 11, 2);
		} else if(str.equals("Human")){
		    hand[i] = new Hand(str, 4, 12, 3);
		} else if(str.equals("Tree")){
		    hand[i] = new Hand(str, 5, 13, 4);
		} else if(str.equals("Wolf")){
		    hand[i] = new Hand(str, 6, 14, 5);
		} else if(str.equals("Sponge")){
		    hand[i] = new Hand(str, 7, 0, 6);
		} else if(str.equals("Paper")){
		    hand[i] = new Hand(str, 8, 1, 7);
		} else if(str.equals("Air")){
		    hand[i] = new Hand(str, 9, 2, 8);
		} else if(str.equals("Water")){
		    hand[i] = new Hand(str, 10, 3, 9);
		} else if(str.equals("Dragon")){
		    hand[i] = new Hand(str, 11, 4, 10);
		} else if(str.equals("Devil")){
		    hand[i] = new Hand(str, 12, 5, 11);
		} else if(str.equals("Lightning")){
		    hand[i] = new Hand(str, 13, 6, 12);
		} else {
		    hand[i] = new Hand(str, 14, 7, 13);
		}
	    }
	    for(int i = 0; i < n; i++){
		hand[i].tcount(hand, n);
	    }
	    int f = 0;
	    for(int i = 0; i < n; i++){
		if(hand[i].res){
		    f = 1;
		    System.out.println(hand[i].str);
		    break;
		}
	    }
	    if(f == 0){
		System.out.println("Draw");
	    }
	}
    }

    public static void main(String[] args){
	new Main();
    }
}

Measured memory_bytes: 13000
#include<iostream>
#include<math.h>

using namespace std;

int main(){
  int n;
  int V[100000];
  int root;
  int sum=0;
  cin>>n;
  for(int i=0;i<n;i++)cin>>V[i];

  for(int i=0;i<n;i++){
    root = sqrt(V[i]);
    for(int j=2;;j++){
      if(j > root){
	sum++;break;
      }
      if(V[i] % j == 0)break;
    }
  }
  cout<<sum<<endl;

  return 0;
}

Measured memory_bytes: 3072
n,k = map(int,input().split())
st = []
for i in range(k):
  x,y = map(int,input().split())
  st.append((x,y))
total = [1]

for i in range(1,n):
  s = 0
  for (x,y) in st:
    if i > y:
      s = (s + total[i-x] - total[i-y-1]) % 998244353
    elif i >= x:
      s = (s + total[i-x]) % 998244353
  total.append((s+total[-1]) % 998244353)   
  
print((total[-1]-total[-2]) % 998244353)
  
  
    
  

Measured memory_bytes: 85016
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/














int X, A;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> X >> A;

	if (X < A) cout << 0 << endl;
	else cout << 10 << endl;
}







Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  
  int result = 0;
  if(n - k >= 0){
    result += k * x;
    result += (n - k) * y;
  }
  else{
    result += n * x;
  }
  
  cout << result << endl;
}

Measured memory_bytes: 3624
import heapq

N, M  = map(int, input().split())
A = list(map(int, input().split()))
A = [-a for a in A]
queue = []
for a in A:
    heapq.heappush(queue, a)

for _ in range(M):
    a = -heapq.heappop(queue)
    a //= 2
    heapq.heappush(queue, -a)

print(-sum(queue))


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

using namespace std;

typedef long long ll;

void print(vector<vector<char>> c) {
  int h = c.size();
  int w = c[0].size();
  for(int i = 0; i < h; ++i) {
    for(int j = 0; j < w; ++j) {
      cout << c[i][j];
    }
    cout << endl;
  }
}

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

  int h, w, k;
  cin >> h >> w >> k;
  vector<vector<char>> c(h, vector<char> (w));
  for(int i = 0; i < h; ++i) {
    getchar();
    for(int j = 0; j < w; ++j) {
      cin >> c[i][j];
    }
  }

  int ans = 0;
  for(int i = 0; i < (1 << h); ++i) {
    for(int j = 0; j < (1 << w); ++j) {
      vector<vector<char>> temp = c;
      for(int y = 0; y < h; ++y) {
        for(int x = 0; x < w; ++x) {
          if((i & (1 << y)) || (j & (1 << x))) {
            temp[y][x] = 'R';
          }
        }
      }

      int cnt = 0;
      for(int y = 0; y < h; ++y) {
        for(int x = 0; x < w; ++x) {
          if(temp[y][x] == '#') ++cnt;
        }
      }

      if(cnt == k) {
        ++ans;
      }
    }
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3644
import scala.annotation.tailrec

object Main extends App {

  import scala.io.StdIn._

  solve
  @tailrec
  def solve: Unit = {
    val n = readLine.trim.toInt
    if (n == 0) return
    val teams = Array.tabulate(n){_ ⇒
      val arg = readLine.trim.split(' ')
      (arg.head, Result(arg.tail.map(_.toInt)))
    }.sortBy(_._2)
    println(teams.map{_._1}.mkString("\n"))
    solve
  }
  object Result{
    def apply(result: Array[Int]): Result = {
      Result(result.count(_ == 0), result.count(_ == 2), result.count(_ == 1))
    }
  }
  case class Result(win: Int, draw: Int, lose: Int) extends Ordered[Result] {
    override def compare(that: Result): Int = if (win == that.win) lose.compare(that.lose) else that.win.compare(win)
  }
  implicit class Extension[T](value :T){
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}


Measured memory_bytes: 44888
from sys import stdin
import fractions

A,B,K = [int(x) for x in stdin.readline().rstrip().split()]

x = fractions.gcd(A,B)

res = []
for i in range(x+1,0,-1):
  if A%i == 0 and B%i == 0:
    res.append(i)

print(res[K-1])    


    


      

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

int main(){
    int cnt0 = 0;
    int cnt1 = 0;
    char S[100000];
    scanf("%s", S);

    for (int i=0; S[i]; i++){
        if(S[i] == '0')
            cnt0++;
        if(S[i] == '1')
            cnt1++;
    }
    if (cnt0 < cnt1)
        printf("%d\n",cnt0 * 2);
    else
        printf("%d\n",cnt1 * 2);
    return 0;
}

Measured memory_bytes: 2220
N,K = map(int,input().split())
mod_num = 10**9+7

def mul(a,b):
    return ((a % mod_num) * (b % mod_num)) % mod_num

def power(x,y):
    if y==0:                 
        return 1     
    elif y==1:                    
        return x % mod_num
    elif y%2 == 0:
        return power(x, y//2)**2 % mod_num
    else:
        return power(x, y//2)**2 * x % mod_num
    
def div(a,b):
    return mul(a, power(b, mod_num-2))


ans = N-K+1
ans %= mod_num
print(ans)

for i in range(1,K):
    if N-K+1-i>0:
        ans = mul(ans,K-i)
        ans = mul(ans,N-K+1-i)
        ans = div(ans,i)
        ans = div(ans,i+1)
        print(ans)
    else:
        print(0)

Measured memory_bytes: 47452
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    double a,b,x;cin>>a>>b>>x;
    x/=(a*a);
    double ans;
    if(x*2>=b){
        ans=(double)90-atan(a/((double)2*(b-x)))*(double)180/M_PI;
    }else{
        ans=(double)90-atan(a*(double)2*x/b/b)*(double)180/M_PI;
    }
    cout<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define db double
#define pint pair<int,int>
#define mk make_pair
#define pb push_back
#define eb emplace_back
#define ins insert
#define fi first
#define se second
#define Rep(x,y,z) for(int x=y;x<=z;x++)
#define Red(x,y,z) for(int x=y;x>=z;x--)
using namespace std;
const int MAXN=1e5+5;
char buf[1<<12],*pp1=buf,*pp2=buf,nc;int ny;
inline char gc() {return pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;for(ny=1;nc=gc(),(nc<48||nc>57)&&nc!=EOF;)if(nc==45)ny=-1;if(nc<0)return nc;
	for(x=nc-48;nc=gc(),47<nc&&nc<58&&nc!=EOF;x=(x<<3)+(x<<1)+(nc^48));return x*ny;
}
char s[MAXN];int n,a[MAXN],last[MAXN],fa[MAXN],tot;
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	scanf("%s",s+1),n=strlen(s+1);
	Rep(i,1,n)a[i]=s[i]-'0';
	Rep(i,1,n)if(a[i]&&!a[n-i])return puts("-1"),0;
	if(!a[1])return puts("-1"),0;
	int tmp=0;
	Rep(i,2,n)if(a[i]){
		last[i]=++tot;
		fa[last[tmp]]=tot;
		Rep(j,1,i-tmp-1)fa[++tot]=last[i];
		tmp=i;
	}
	last[n]=++tot,fa[last[tmp]]=tot;
	Rep(j,1,n-tmp-1)fa[++tot]=last[n];
	Rep(i,1,n)if(fa[i])cout<<fa[i]<<" "<<i<<'\n';
	return 0;
}





Measured memory_bytes: 4904
S = input()

S = list(S)

ls = len(S)
count = 0
ans = 0

for i in range(ls):
      if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
          count += 1
          if count >= ans:
              ans = count
      else:
          count = 0

print(ans)

Measured memory_bytes: 9068
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
using ll = long long;
using P = pair<int,int>;

int main() {
  int x, a;
  cin >> x >> a;

  if(x<a){
    cout << 0 << endl;
  }
  else if(x>=a){
    cout << 10 << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    string s;
    cin >> s;
    string a = "CODEFESTIVAL2016";
    int ans = 0;
    rep(i,len(a)) if(a[i] != s[i]) ans++;
    cout << ans << endl;
    
    
    

    return 0;
}


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

using namespace std;

int main(){
    int N,M,i;
    cin>>N>>M;
    vector<int> hw(M);

    int sum=0;
    
    for(i=0;i<M;i++){
        cin>>hw[i];
        sum=sum+hw[i];
    }
    int day;
    day=N-sum;

    if(day>=0){
        cout<<day<<endl;
    }else{
        cout<<-1<<endl;
    }
}

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

int main() {
    int n;
    scanf("%d", &n);

    map<ll, int> mp;

    rep(i, n) {
        ll t; cin >> t;
        mp[t]++;
    }

    ll ans=0;
    for (auto & t : mp) {
        if (t.second % 2) ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
bool debug = false;
int tmp_iA,tmp_iB;

int main() {
  int N; cin >> N; // 頂点の数（２～８）
  int M; cin >> M; // 辺の数（０～N(N-1)/2)
  // 辺の有無を２次元配列（裏表）に為、頂点全列挙順列に対し、最後まで辿れるか、判定する。
  vector<vector<bool>> Hen(8,vector<bool>(8,false));  // 辺有無２次元真偽配列
  int a,b;
  rep(i,M){
    cin >> a >> b;
    Hen.at(a-1).at(b-1) = Hen.at(b-1).at(a-1) = true;   // 繋がってるフラグを裏表で持つ。頂点番号は０からＮ－１
  }
  int Ans = 0; // 最後まで行けるパス数
  vector<int> Choten;
  rep(i,N){Choten.push_back(i);}  // 全頂点の数値配列。ソート済み。

  do{   // 頂点全列挙順列に対する処理
    if(Choten.at(0)!=0){continue;}  // 開始点が０で無い場合、除外

    bool Through = true;
    rep(i,N-1){
//      cout << "i:" << i << " Hen:"  << Hen.at(Choten.at(i)).at(Choten.at(i+1)) << endl;
      if(!Hen.at(Choten.at(i)).at(Choten.at(i+1))){
        Through = false;
        break;
      }
    }
    if ( Through ) { Ans+=1; }
  } while(next_permutation(Choten.begin(),Choten.end()));
  cout << Ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <algorithm>

using namespace std;

int main() {
    string S;

    cin >> S;
    
    if (S.size()%2==1) {
        cout << "No" << endl;
        return 0;
    }
    int cnt=0;
    for (auto i = 0; i < S.size()-1; i++) {
        if (S[i]=='h' && S[i+1]=='i') {
            cnt++;
            i++;
        }
    }
    if (cnt==S.size()/2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;



}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <tuple>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
    ll n, k, r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;

    ll ans = 0;
    for (int i = 0; i < k; i++) {
        int idx = i;
        while (idx < n) {
            int sub = 0;
            while (idx + sub < n && t[idx] == t[idx + sub]) sub += k;
            if (char(t[idx]) == 'r') ans += ((sub / k - 1) / 2 + 1) * p;
            if (char(t[idx]) == 's') ans += ((sub / k - 1) / 2 + 1) * r;
            if (char(t[idx]) == 'p') ans += ((sub / k - 1) / 2 + 1) * s;
            idx += sub;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 512
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
typedef double lf;
typedef long double Lf;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

#define TRACE(x) cerr << #x << "  " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define _ << " " <<

#define fi first
#define sec second
#define mp make_pair

const int MAXN = 110;

int n, p[MAXN * 3], sol;

int main() {
	scanf("%d",&n);
	REP(i, 2 * n) scanf("%d",&p[i]);
	sort(p, p + 2 * n);
	REP(i, 2 * n) {
		sol += p[i];
		i++;
	}
	
	printf("%d\n",sol);
	return 0;
}


Measured memory_bytes: 256