akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N, K,t, ans = 0,top=0; cin >> N >> K;
	VLL A(N);
	for (int i = 0;i < N;i++) {
		cin >> t;
		A[t-1]++;
	}
	sort(all(A));
	int tmp = 0;
	for (int i = 0;i < N;i++) {
		if (A[i] != 0) tmp++;
	}
	int sum = 0;
	for (int i = N-tmp;;i++) {
		if (tmp - sum <= K) break;
			ans += A[i];
			sum++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
def create(num)
  Array.new(num){ Array.new(num) }
end

def input(array, num)
  num.times do |i|
    input = gets.chomp.split('')
    input.each_with_index do |c, j|
      array[i][j] = c
    end
  end
end

n, m = gets.chomp.split(' ').map(&:to_i)

a = create(n)
b = create(m)
input(a, n)
input(b, m)

def check(a, b, i, j)
  b.length.times do |k|
    b.length.times do |l|
      return false if a[i+k][j+l] != b[k][l]
    end
  end
  true
end

(n-m+1).times do |i|
  (n-m+1).times do |j|
    is_match = check(a, b, i, j)
    if is_match
      puts 'Yes'
      exit
    end
  end
end
puts 'No'


Measured memory_bytes: 1916
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    private static final int MOD = (int) Math.pow(10, 9);
    private static final int[][] DIRECTIONS = {{1, 1}, {0, 1}, {-1, 1}, {1, 0}, {-1, 0}, {0, -1}};

    public static void main(String[] args) {
        FastReader sc = new FastReader();
        int a = sc.nextInt();
        String s = sc.next();
        String t = sc.next();
        String res = "";

        for (int i = 0; i < s.length(); i++) {
            res = res + s.charAt(i) + t.charAt(i);
        }

        System.out.println(res);
        System.exit(0);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try{
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 20052
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> C(n-1);
  vector<int> S(n-1);
  vector<int> F(n-1);
  for(int i=0;i<n-1;i++){
    int c,s,f;
    cin >> c >> s >> f;
    C.at(i) = c;
    S.at(i) = s;
    F.at(i) = f;
  }
  for(int i=0;i<n-1;i++){
    int time = 0;
    int now = i;
    while(now<n-1){
      if(now!=i){
        time =  max(S.at(now),F.at(now)*((time+F.at(now)-1)/F.at(now)));
      }else{
        time += S.at(now);
      }
      time += C.at(now);
      now ++;
    }
    cout << time <<endl;
  }
  cout << 0 <<endl;
}
      
      
      
      
    
    

Measured memory_bytes: 256
<?php
fscanf(STDIN,"%d %d %d %d",$a,$b,$c,$d);
while (true) {
    if (($c -= $b) < 1) {
        echo 'Yes'.PHP_EOL;
        break;
    }
    
    if (($a -= $d) < 1) {
        echo 'No'.PHP_EOL;
        break;
    }
}

Measured memory_bytes: 15960
import java.util.Scanner;

class Main
{
    static int N;
    static int[]A = new int[10000000];

    public static void maxHeapify(int i)
    {
	int l = 2 * i;
	int r = 2 * i + 1;
	int largest;

	if(l <= N && A[l] > A[i])
	    largest = l;
	else 
	    largest = i;

	if(r <= N && A[r] > A[largest])
	    largest = r;

	if(largest != i)
	    {
		int b = A[i];
		A[i] = A[largest];
		A[largest] = b;
		maxHeapify(largest);
	    }
    }

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

	N = In.nextInt();

	for(int i = 1; i <= N; i++)
	    A[i] = In.nextInt();
	
	for(int i = N / 2; i >= 1; i--)
	    maxHeapify(i);
	
	for(int i = 1; i <= N; i++)
	    System.out.print(" " + A[i]);
	
	System.out.println();
    }
}

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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	
	int x, a;
	cin >> x >> a;
	if (x < a) cout << 0;
	else cout << 10;
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



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

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

    string s,t; cin>>s>>t;
    int ans=size(t);
    for(size_t i=0; i+t.size()<=s.size(); i++)
    {
        int err=0;
        for(size_t j=0; j<size(t); j++)
        {
            if(s[j+i]!=t[j])
            {
                err++;
            }
        }
        ans=min(ans,err);
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


void solve(){
    ll A, B, N;
    cin >> A >> B >> N;
    ll mi = min(B-1, N);
    cout << (A * mi) / B << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}


Measured memory_bytes: 3648
#include <stdio.h>

int main() {
  long int k,i;
  scanf("%ld",&k);
  long int a[k];
  for (i=0;i<k;i++) {
    scanf("%ld",&a[i]);
  }
  long int nmin, nmax, check, p, q;
  nmin = 2;
  nmax = 2;
  check = 1;
  for (i=k-1;i>-1;i=i-1) {
    if (nmin%a[i] == 0) {
      p = (nmin/a[i])*a[i];
      q = (nmax/a[i])*a[i]+a[i]-1;
    } else {
      if (nmin/a[i]!=nmax/a[i]) {
        p = (nmin/a[i]+1)*a[i];
        q = (nmax/a[i])*a[i]+a[i]-1;
      } else {
        check = 0;
      }
    }
    nmin = p;
    nmax = q;
  }

  if (check == 0) {
    printf("%d\n",-1);
  } else {
    printf("%ld %ld\n",nmin,nmax);
  }
  return 0;
}


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

#define ll long long
#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define repr(i,n,m) for(int i=m; i<n; i++)
#define MAX 100
#define MOD 1000000007
#define pb push_back
#define debug(x) cout << x << endl;
#define END cout << endl;

int main() {
  int i,n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  multiset<ll> ms;
  rep(i,n) ms.insert(a[i]);
  ll res = 0;
  while (!ms.empty()) {
    auto itr = ms.end();
    itr--;
    int x = *itr;
    ms.erase(itr);
    for (i = 1; i <= x; i *= 2);
    if (ms.find(i-x) != ms.end()) {
      ms.erase(ms.find(i-x));
      res++;
    }
  }
  cout << res << endl;
}

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

int main(){
    int N;
    string S;
    cin >> N >> S;
    int n = S.length();
    if(n <= N) cout << S << endl;
    else{
        for(int i = 0; i < N; i++){
            cout << S[i];
        }
        cout << "..." << endl;
    }
    return 0;
}

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

using namespace std;

const int HUGEI = 2147483647;  // (1 << 31) - 1
const long long HUGEL = 9223372036854775807;  // (1 << 63) - 1
const string ABC = "abcdefghijklmnopqrstuvwxyz";
const int MAX = 10001;

bool dp[MAX];

int main(void) {
    int n;
    vector <int> sn;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        sn.push_back(a);
    }

    for (int i = 1; i <= n; i++) {
        dp[i] = false;
    }
    dp[0] = true;

    for (int i = 0; i < n; i++) {
        int s = sn[i];
        for (int j = MAX - 1; j >= 0; j--) {
            if (j >= s) {
                dp[j] |= dp[j - sn[i]];
            }
        }
    }

    int res = 0;
    for (int j = 0; j < MAX; j++) {
        if (dp[j] && j % 10 != 0) {
            res = j;
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split()))
ans = 1
zero = 0
over = 0
for i in range(len(a)) :
	if a[i] == 0 :
		zero = 1
for i in range(len(a)) :
	if over : break
	ans *= a[i]
	if ans > 1e18 :
		over = 1
if zero : print(0)
elif over : print(-1)
else : print(ans)

Measured memory_bytes: 21660
#include <stdio.h>
int main(){
  int a, b, c, d, e, f, g, h, sum;
  while(1){
    scanf("%d",&a);
  b  = 1000 - a;
  c  = b / 500;
  d  = b % 500 / 100;
  e  = b % 500 % 100 / 50;
  f  = b % 500 % 100 % 50 / 10;
  g  = b % 500 % 100 % 50 % 10 / 5;
  h  = b % 500 % 100 % 50 % 10 % 5;

  sum = c + d + e + f + g + h;
  if( a == 0 ) break;
  else{
    printf("%d\n",sum); }}
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pll pair<ll,ll>
#define pb push_back
#define F first
#define S second
#define I insert
#define vll vector<ll>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()

#define endl '\n'

ll power(ll a, ll b, ll mod){ ll c = 1; while(b>0){ if(b%2) c*=a, c%=mod; b/=2; a*=a; a%=mod; } return c; }
 
const ll N = (1e5) + 10;
const ll M = 320;
const ll Mod = 1e9 + 7;
ll x[N];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout<<setprecision(25);
    ll n,k,i,j,pos;
    cin>>n>>k; 
    for(i=0;i<n;i++) cin>>x[i];
    ll ans = 1e15;
	k--;
	for(i=0;i<n;i++){
		if(i+k >= n) break;
		ans = min(ans, abs(x[i]) + abs(x[i+k]-x[i]));
		ans = min(ans, abs(x[i+k]) + abs(x[i+k]-x[i]));
	}
	cout<<ans<<endl;
    return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<ll> b(n-1);
	rep(i,n-1) cin >> b[i];
	ll ans = b[0];
	rep(i,n-1){
		if(i != n-2)ans += min(b[i],b[i+1]);
		else ans +=b[i];
	}
	cout << ans << endl;
	return 0;
}





Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
	  int N = sc.nextInt();
      int ac=0,wa=0,tle=0,re=0;
      for(int i=0;i<N;i++){
        String s = sc.next();
        if(s.equals("AC")){
          ac++;
        }else if(s.equals("WA")){
          wa++;
        }else if(s.equals("TLE")){
          tle++;
        }else{
          re++;
        }
      }
      System.out.println("AC x "+ac);
      System.out.println("WA x "+wa);
      System.out.println("TLE x "+tle);
      System.out.println("RE x "+re);
    }
}

Measured memory_bytes: 58600
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define vll vector<ll>
#define fo(i, n) for(int i=0;i<n;i++)
#define MOD 1000000007
 
int main() {
 
 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ios_base& scientific (ios_base& str);
	ll t=0;
	cin >> t;
	cout << 2 * 3.14159 * t;
	return 0;
}

Measured memory_bytes: 3792
#include <iostream>
using namespace std;
int a[1000];

void display(int n){
	for(int i=0;i<n;i++){
		if(i != 0){
			cout<<" ";
		}
		cout<<a[i];
	}
	cout<<endl;
}

int main(){
	int N;
	cin>>N;
	for(int i=0;i<N;i++) cin>>a[i];
	display(N);
	
	for(int i=1;i<N;i++){
		int t = a[i];
		int j = i-1;
		while(j >= 0 && a[j] > t){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = t;
		
		display(N);		
	}
	
	return 0;
}

Measured memory_bytes: 1160
package main

import (
	"fmt"
	"io"
	"os"
)

func main() {
	sc := NewScanner(os.Stdin)
	n, m, k := sc.Int(), sc.Int(), sc.Int()

	a := make([]int, n+1)
	b := make([]int, m+1)

	for i := range a[1:] {
		a[i+1] = a[i] + sc.Int()
	}
	for i := range b[1:] {
		b[i+1] = b[i] + sc.Int()
	}

	search := func(upperBound int) int {
		l, r := 0, len(b)-1
		i := len(b) >> 1
		for l <= r {
			n := b[i]
			if n == upperBound {
				return i
			}
			if n < upperBound {
				l = i + 1
			} else {
				r = i - 1
			}
			i = l + (r-l)>>1
		}
		return i
	}

	var max int

	for i, v := range a {
		rest := k - v
		if rest < 0 {
			break
		}

		indexOfB := search(rest)
		if i+indexOfB > max {
			max = i + indexOfB
		}
	}

	fmt.Println(max)
}

// library generated by https://github.com/murosan/gollect

type Scanner struct {
	r     io.Reader
	buf   []byte
	split func(byte) bool
	size, eof,
	start, end int
}

func NewScanner(r io.Reader) *Scanner { return NewScannerSize(r, 4096) }
func NewScannerSize(r io.Reader, size int) *Scanner {
	return &Scanner{
		r:     r,
		buf:   make([]byte, size),
		split: func(b byte) bool { return b == ' ' || b == '\n' },
		size:  size, start: size, end: size,
	}
}

func (s *Scanner) Int() int { return ParseInt(s.bytes()) }

func (s *Scanner) bytes() []byte { b, _ := s.next(); return b }
func (s *Scanner) next() (b []byte, size int) {
	for n := 0; ; {
		for i := s.end; i < s.size; i++ {
			if s.split(s.buf[i]) || i == s.eof {
				b, size = s.buf[s.start:i], i-s.start
				s.start, s.end = i+1, i+1
				return
			}
		}
		s.end = s.size
		if n++; n == 2 {
			panic("lack of buffer size")
		}
		s.read()
	}
}
func (s *Scanner) read() {
	copy(s.buf, s.buf[s.start:s.end])
	s.end -= s.start
	s.start = 0
	n, _ := s.r.Read(s.buf[s.end:])
	s.eof = s.end + n
}

func ParseInt(b []byte) (n int) {
	for _, ch := range b {
		if ch -= '0'; ch <= 9 {
			n = n*10 + int(ch)
		}
	}
	if b[0] == '-' {
		return -n
	}
	return
}


Measured memory_bytes: 5068
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#define ll long long
#define rep(i, a, b) for(int i = a; i <= b; i++)
void read(int &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
void read(ll &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
using namespace std;
const int maxn = 200010;
int n, a[maxn];
ll dp[maxn][5];
int main()
{
    read(n);
    rep(i, 1, n) read(a[i]);
    rep(i, 1, n) {
        dp[i][0] = dp[i - 1][0];
        rep(j, 1, 4) dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]);
        dp[i][0] += a[i], dp[i][4] += a[i];
        if(a[i] == 0) dp[i][1] += 2;
            else dp[i][1] += a[i] & 1;
        if(a[i] == 0) dp[i][3] += 2;
            else dp[i][3] += a[i] & 1;
        if(a[i] % 2 == 0) dp[i][2]++;
    }
    ll ans = dp[n][0];
    rep(j, 1, 4) ans = min(ans, dp[n][j]);
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 8832
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
#include <cctype>
#include <iterator>
////////////////////////////////////////////////
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  string s;
  cin >> s;
  int n = s.size();
  char x = s[0];
  bool ok = true;
  REP(i, n) {
    if (s[i] != x) {
      ok = false;
      break;
    }
  }
  if (ok) {
    cout << n << endl;
    return 0;
  }
  int r = n;
  int l = 1;
  auto check = [&](int k) -> bool {
    // cout << k << " " << n - k + 1 << " " << k - 1 << endl;
    if (n - k + 1 > k - 1) return true;
    char x = s[n - k + 1];
    // cout << s.substr(n - k + 1, 2 * k - n - 1) << endl;
    for (int i = n - k; i <= k - 1; i++) {
      if (s[i] != x) {
        return false;
      }
    }
    return true;
  };

  while (r - l > 1) {
    int c = (r + l) / 2;
    // cout << c << " " << check(c) << endl;
    if (check(c)) {
      l = c;
    } else {
      r = c;
    }
  }
  cout << l << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <bitset> 
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define dd(x) cout<<#x<<" = "<<x<<" "
#define mes(p) memset(p,0,sizeof(p))
#define all(x) x.begin(),x.end()
#define rson mid+1,r,rt<<1|1
#define sz(x) (int)x.size()
#define lson l,mid,rt<<1
#define mp make_pair 
#define pb push_back
#define ls (rt<<1)
#define se second
#define rs (ls|1)
#define fi first
//typedef pair <int ,int > pi;
typedef vector <int > vi;
typedef long long ll;
const int maxn=1e3+5;
const int mod= 1e9+7;
const double pi = acos(-1);
double dp[maxn], ans;
int n, m;
vi e[maxn];
void solve(int b){
	dp[n] = 0;
	for(int i=n-1;i>0;i--){
		double sum = 0;
		double num = sz(e[i]);
		double ma = 0;
		for(auto u:e[i]){
			sum += dp[u];
			ma = max(ma, dp[u]);
		}
		if(num >= 2 && i==b){
			num--;
			sum -= ma;
		}
		dp[i] = sum / num + 1;
	}
	ans = min(ans, dp[1]);
}
int main(){
	scanf("%d%d", &n, &m);
	rep(i,0,m){
		int x, y;
		scanf("%d%d", &x,&y);
		e[x].pb(y);
	}
	ans = 1e18;
	rep(i,1,n+1)
		solve(i);
	printf("%.10f", ans);
	return 0; 
}


Measured memory_bytes: 1408
import math
 
PI = math.pi
A, B, H, M = map(int, input().split())
 
arg_a = (float(H) + float(M)/60) / 12.0 * 360
arg_b = float(M) / 60.0 * 360
 
 
C = math.sqrt(A*A + B*B - 2*A*B* math.cos((arg_a-arg_b)/360*2*PI))
print(C)

Measured memory_bytes: 9412
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<int> qi;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<vl> mat;
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define ft first
#define sd second
#define elif else if
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mp make_pair
#define fr(i,n)for(ll i=0;i<(n);i++)
ll ans[1000000];
vl tree[1000000];
void dfs(ll pre,ll now,ll &w){
    ans[now] += w;
    for(ll i:tree[now]){
        if(i!=pre) dfs(now,i,ans[now]);
    }
}
int main(){
    ll n,q;cin>>n>>q;
    fr(i,n-1){
        ll a,b;cin>>a>>b;
        a--;
        b--;
        tree[a].pb(b);
        tree[b].pb(a);
    }
    fr(i,n)ans[i] = 0;
    fr(i,q){
        ll p,x;cin>>p>>x;
        p--;
        ans[p] += x;
    }
    ll start = 0;
    dfs(-1,0,start);
    fr(i,n){
        cout << ans[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 44672
import java.io.PrintWriter;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int r = Integer.parseInt(sc.next());
		int g = Integer.parseInt(sc.next());
		int ans =g*2 - r;
		out.println(ans);
		out.flush();	
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;

int main()
{
    vector<string> days = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string d;
    cin >> d;
    cout << 7 - distance(days.begin(), find(days.begin(), days.end(), d)) << endl;
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
void solve() {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int no;
		cin >> no;
		if ((i & 1) && (no & 1))
			ans++;
	}
	cout << ans;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	solve();
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using ll = unsigned long long int;
using namespace std;
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)

int main() {
    fastIO;
    string s;
    cin >> s;
    sort(s.begin(), s.end());

    string t;
    cin >> t;
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

    if (s < t)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
int main(){
    string s;
    cin>>s;
    if(s[0]=='R' && s[1]=='R'){
        if(s[2]=='R')cout<<3<<endl;
        else cout<<2<<endl;
    }
    if(s[0]=='R' && s[1]=='S'){
        cout<<1<<endl;
    }
    if(s[0]=='S' && s[1]=='R'){
        if(s[2]=='R')cout<<2<<endl;
        else cout<<1<<endl;
    }
    if(s[0]=='S'&&s[1]=='S'){
        if(s[2]=='R')cout<<1<<endl;
        else cout<<0<<endl;
    }
}

Measured memory_bytes: 3616
def readinput():
    a,b=list(map(int,input().split()))
    return a,b

def main(a,b):
    if b<=a:
        return 1
    x=b-a
    q=x//(a-1)
    r=x%(a-1)
    if(r==0):
        return q+1
    else:
        return q+2

def main2(a,b):
    nc=1
    ntap=0
    while(nc<b):
        ntap+=1
        nc+=a-1
    return ntap

if __name__=='__main__':
    a,b=readinput()
    ans=main2(a,b)
    print(ans,end='')


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll a,b,c;
    cin>>a>>b>>c;
    if(a==b+c||b==a+c||c==a+b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n;
  std::string s;
  cin >> n >> s;
  int r = 0, b = 0;
  for (auto c : s) {
    if (c == 'R')
      r++;
    else
      b++;
  }
  if (r > b) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  cout << endl;

  return 0;
}


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

ac, wa = [0]*N, [0]*N

for i in range(M):
    p, s = input().split()
    if s == 'WA' and ac[int(p)-1] == 0:
            wa[int(p)-1] += 1
    elif s == 'AC' and ac[int(p)-1] == 0:
            ac[int(p)-1] += 1
print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i, j in enumerate(ac) if j != 0]])))


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

typedef long long ll;

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

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

  int g=A[0];
  for(int i=1; i<N; i++){
    g = gcd(g,A[i]);
  }

  if(K%g==0 && K<=Ma) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vvi vector<vi>
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;

int main() {
  char a;
  cin >> a;
  if(isupper(a)) {
    cout << "A" << endl;
  }else{
    cout << "a" << endl;
  }
}


Measured memory_bytes: 3632
N, A, B = map(int, input().split())
S = input()

p = 0
q = 0

for i in range(N):
    if S[i] == 'a':
        if p < A + B:
            print('Yes')
            p += 1
        else:
            print('No')
    elif S[i] == 'b':
        if q < B and p < A + B:
            print('Yes')
            p += 1
            q += 1
        else:
            print('No')
    else:
        print('No')

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

int main(){
  int n, m;
  cin >> n >> m;
  int a[m];
  int s = 0;
  rep(i,m) {
    cin >> a[i];
    s += a[i];
  }
  cout << (n-s >= 0 ? n-s : -1) << endl;

  return 0;
}


Measured memory_bytes: 3644
#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>
#include <random>

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

const int L=5e5+1;
int N;
int M;
int dist[L];
P pc[L];
map<P,vector<int>> cp;

vector<P> path[L];
int main() {
	scanf("%d%d",&N,&M);
	for(int i=1;i<=N+2*M;i++){
		dist[i]=1e8;
	}
	dist[0]=0;
	vector<P> cur,nex;
	cur.push_back(P(0,1));
	for(int i=0;i<M;i++){
		int u=N+2*i+1;
		int v=N+2*i+2;
		int c;
		int p,q;
		scanf("%d%d%d",&p,&q,&c);
		path[u].push_back(P(p,0));
		path[p].push_back(P(u,1));
		path[v].push_back(P(q,0));
		path[q].push_back(P(v,1));
		path[u].push_back(P(v,0));
		path[v].push_back(P(u,0));
		cp[P(p,c)].push_back(u);
		pc[u]=P(p,c);
		cp[P(q,c)].push_back(v);
		pc[v]=P(q,c);
	}
	while(cur.size()||nex.size()){
		if(cur.size()==0){
			cur.swap(nex);
		}
		int d=cur.back().first;
		int c=cur.back().second;
		cur.pop_back();
		if(dist[c]<d)continue;
		//cerr << c << ", " << d << endl;
		for(auto i:cp[pc[c]]){
			if(dist[i]>d){
				dist[i]=d;
				cur.push_back(P(d,i));
			}
		}
		cp[pc[c]].clear();
		for(auto p:path[c]){
			int r=d+p.second;
			int i=p.first;
			if(dist[i]>r){
				dist[i]=r;
				if(r==d){
					cur.push_back(P(r,i));
				}
				else{
					nex.push_back(P(r,i));
				}
			}
		}
	}
	int m=dist[N];
	if(m==1e8){
		puts("-1");
	}
	else{
		printf("%d\n",m);
	}


	return 0;
}



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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int val; scanf("%d", &val);
  vector<int> D;
  for (int i = 0; i < 4; ++i) {
    D.push_back(val % 10);
    val /= 10;
  }
  reverse(D.begin(), D.end());

  int ans = -1;
  for (int i = 0; i < (1 << 3); ++i) {
    int sum = D[0];
    for (int j = 0; j < 3; ++j) {
      if (i & (1 << (2 - j))) { sum += D[j + 1]; }
      else { sum -= D[j + 1]; }
    }
    if (sum == 7) {
      ans = i;
      break;
    }
  }
  string ops = "-+";
  printf("%d", D[0]);
  for (int i = 1; i <= 3; ++i) {
    printf("%c%d", ops[(ans >> (3 - i)) & 1], D[i]);
  }
  printf("=7\n");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

int main(){
    std::ios_base::sync_with_stdio(false);

    int n; cin >> n;
    std::vector<string> s(n); rep(i,n) cin >> s[i];
    
    int ans = 0;

    int lb=0, ra=0, lbra=0;

    rep(i,n){
        int cnt = 0;
        for(int j=0;j<s[i].size()-2;j++){
            if(s[i][j]=='A' && s[i][j+1]=='B') cnt++;
        }
        ans+=cnt;

        if(s[i][0]=='B' && s[i][s[i].size()-1]=='A'){
            lbra++; continue;
        } else if (s[i][0]=='B'){
            lb++;
        } else if (s[i][s[i].size()-1]=='A'){
            ra++;
        }
    }

    //cout << lbra << " " << lb << " " << ra << endl;


    if(lbra>0){
        ans+= lbra-1;
        lbra = 1;
    }

    if(ra>0 && lbra==1){
        lbra = 0; ans++;
    }

    if(lb>0 && lbra==1){
        lbra = 0; ans++;
    }

    int x = min(ra,lb);
    ans+=x;
    ra-=x;
    lb-=x;

    cout << ans << endl;
    

    return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

void output(vector<long long> v){
    int k = 0;
    while(any_of(all(v), [](long long a) {return a >= 50; } )){
        int maxi = 0;
        int p;
        rep(i,v.size()){
            if(maxi < v[i]){
                maxi = v[i];
                p = i;
            }
        }
        rep(i,v.size()){
            if(p == i) v[i] -= 50;
            else v[i]++;
        }
        k++;
    }
    show(k)
}

int main(){
    long long k;
    cin >> k;

    if(k < 50LL){
        int a[2] = {1,1};
        rep(i,k){
            a[(i % 2) ^ 0] += 2;
            a[(i % 2) ^ 1] -= 1;
        }
        cout << 2 << endl;
        cout << a[0] << ' ' << a[1] << endl;
    }else{
        vector<long long> v;
        rep(i,50) v.emplace_back(50 - 1 + k / 50);

        rep(i,k % 50){
            v[i] += 50;
            rep(j,50){
                if(i != j) v[j]--;
            }
        }
        cout << 50 << endl;
        rep(i,50){
            cout << v[i] << (i == 49 ? '\n' : ' ');
        }
        //output(v);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<pair<int,int> > a(n), b;
	for(int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
	sort(a.begin(), a.end());
	int ans = n;
	for(int i = 0; i < n; i++) for(int j = 0; j < n; j++){
		int p = a[i].first - a[j].first, q = a[i].second - a[j].second;
		set<pair<int,int>>seen;
		int now = 0;
		b = a;
		sort(b.begin(), b.end(), [&](pair<int,int> x, pair<int,int> y){
			if(x.first != y.first){
				if(p > 0) return x.first < y.first;
				return x.first > y.first;
			}
			if(q > 0) return x.second < y.second;
			return x.second > y.second;
		});
		for(int k = 0; k < n; k++){
			now += 1 - seen.count({b[k].first - p, b[k].second - q});
			seen.insert({b[k].first, b[k].second});
		}
		ans = min(ans, now);
	}
	cout << ans << endl;
	return 0;
}


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

const int MAX_N = 105;

int N;
char moji[11];
pair<pair<string, int>, int> A[MAX_N];

int main() {
  cin >> N;

  for (int i = 0; i < N; i++) {
    int P;
    cin >> moji >> P;
    string S = moji;
    A[i] = make_pair(make_pair(S, -P), i);
  }

  sort(A, A + N);
  
  for (int i = 0; i < N; i++) {
    cout << A[i].second + 1 << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        int k=scan.nextInt();
        int ans=n;
        HashMap<Integer,Integer> hm = new HashMap<Integer,Integer>();
        HashSet<Integer> hs = new HashSet<Integer>();
        for(int i=0;i<n;i++){
            hm.put(i+1,scan.nextInt());
        }
        for(int i=0;i<k;i++){
            int A=scan.nextInt();
            int B=scan.nextInt();
            if(hm.get(A) < hm.get(B)    ){
                hs.add(A);
            }
            else if(hm.get(A) > hm.get(B)   ){
                hs.add(B);
            }
            else{
                hs.add(A);
                hs.add(B);
            }
        }
        System.out.println(n-hs.size());
        
    }
}


Measured memory_bytes: 75148
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
//#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define drep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define Maxe(x) *max_element(all(x))
#define Mine(x) *min_element(all(x))
#define Size(x) ((ll)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
#define Fi first
#define Se second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo
//mint,dijkstra,gyakugen

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll x;
        cin>>x;
        ll res=0;
        ll now=0;
        while(1){
            res++;
            now+=x;
            if(now%360==0)break;
        }
        cout<<res<<endl;
    }

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

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

    string s;
    ll k;
    cin>>s>>k;

    for(int i=0;i<s.size();i++){
        if(i==k-1){
            cout<<s[i]<<endl;
            break;
        }
        if(s[i]!='1'){
            cout<<s[i]<<endl;
            break;
        }
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int dp[1001][1001];

int main() {
	string s1, s2;
	cin >> s1 >> s2;
	int A = s1.size(), B = s2.size();
	rep(i, A + 1) dp[i][0] = i; rep(i, B + 1) dp[0][i] = i;
	FOR(i, 1, A + 1) FOR(j, 1, B + 1) {
		int cost = (s1[i - 1] == s2[j - 1]) ? 0 : 1;
		int tmp = min(dp[i - 1][j] + 1, dp[i][j - 1] + 1);
		dp[i][j] = min(tmp, dp[i - 1][j - 1] + cost);
	}
	cout << dp[A][B] << endl;
	return 0;
}

Measured memory_bytes: 7084
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int X; cin >> X;
	cout << (((X == 7) || (X == 5) || (X == 3)) ? "YES" : "NO") << endl;
}

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


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

int main() {
int n,d;
cin >> n >> d;
int a = d* 2 + 1;
cout << (n+a-1)/a << endl;
}
  


Measured memory_bytes: 256
n, k = map(int, input().split())
mod = 10**9+7

ans = 0
for i in range(k, n+2):
    min_ = i*(i+1)//2
    max_ = (n+1)*(n+2)//2-(n+1-i)*(n+1-i+1)//2
    #print(min_, max_)
    ans += max_ - min_ +1
print(ans%mod)


Measured memory_bytes: 9140
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        if (n == 2)
        {
            Console.WriteLine(-1);
            return;
        }
        if (n == 3)
        {
            Console.WriteLine(
@"
eei
i.i
iee
");
            return;
        }
        if (n == 4)
        {
            Console.WriteLine(
@"
aacd
bbcd
cdaa
cdbb
");
            return;
        }
        if (n == 5)
        {
            Console.WriteLine(
@"
a.bcc
a.bd.
.eedf
ggi.f
hhijj
");
            return;
        }
        else
        {
            var res = Enumerable.Range(0, n).Select(_ => Enumerable.Repeat('.', n).ToArray()).ToArray();
            res[0][0] = 'a';
            res[0][1] = 'a';
            res[0][n - 1] = 'a';
            res[1][n - 1] = 'a';
            res[n - 1][n - 1] = 'a';
            res[n - 1][n - 2] = 'a';
            res[n - 1][0] = 'a';
            res[n - 2][0] = 'a';

            res[1][0] = 'b';
            res[2][0] = 'b';
            res[n - 1][1] = 'b';
            res[n - 1][2] = 'b';
            res[n - 2][n - 1] = 'b';
            res[n - 3][n - 1] = 'b';
            res[0][n - 2] = 'b';
            res[0][n - 3] = 'b';
            char c1 = 'c';
            char c2 = 'd';
            for (int i = 1; i < n - 3; i++)
            {
                    res[i][i + 1] = c1;
                    res[i][i + 2] = c1;
                    res[i + 1][i] = c2;
                    res[i + 2][i] = c2;
                    var tmp = c1;
                    c1 = c2;
                    c2 = tmp;
            }
            Console.WriteLine(string.Join("\n", res.Select(x => string.Join("", x))));
        }
    }
}


Measured memory_bytes: 28480
package main
import (
	"fmt"
)
func main(){
	var n, m, i, l, r int
	fmt.Scan(&n, &m)
	min:=0
	max:=100001
	for i=0;i<m;i++{
		fmt.Scan(&l, &r)
		if l>min{
			min=l
		}
		if r<max{
			max=r
		}
	}
	t:=max-min
	if t<0{
		fmt.Println(0)
	}else{
		fmt.Println(max-min+1)
	}
}


Measured memory_bytes: 5504
#include<stdio.h>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
    long long int n,k=0;
    cin>>n;
    while(n>0)
    {
        if(n%3!=0 && n%5!=0)
        {
            k=k+n;
        }
        n--;
    }
    cout<<k<<endl;


    return 0;
}


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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, b, e) for (i64 i = (b); i <= (e); ++i)
#define repr(i, b, e) for (i64 i = (b); i >= (e); --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// input
void input() {}
template <class Head, class... Tail>
void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

// outs
void outs() {}
template <class Head, class... Tail>
void outs(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  outs(forward<Tail>(tail)...);
}

template <class T>
void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void outs(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// outl
void outl() {}
template <class Head, class... Tail>
void outl(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  outl(forward<Tail>(tail)...);
}

template <class T>
void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// outn
void outn() {}
template <class Head, class... Tail>
void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

// dump
template <class T>
void dump_(const char *s, T&& x) {
  clog << '{';
  while(*s != '\0') clog << *(s++);
  clog << ": " << x << '}' << "\n";
}

template <class Head, class... Tail>
void dump_(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  dump_(s, forward<Tail>(tail)...);
}
// }}} End

inline vector<int> digit(unsigned long long n) {
  vector<int> ret;
  do { ret.push_back(n % 10); n /= 10; } while (n > 0);
  return ret;
}

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

  var(i64, N);

  i64 norm = 0;
  for (auto e : digit(N)) {
    norm += e;
  }

  outl((N % norm == 0) ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

diff = [0] * N
for n in range(N):
  ave_temperature = T - H[n] * 0.006
  diff[n] = abs(A - ave_temperature)
  
print(diff.index(min(diff)) + 1)

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  int ans = 1;
  for(int i=1;i<n;i++) if(s[i]!=s[i-1]) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 3748
// In the name of God
#include <bits/stdc++.h>

using namespace std;
#define Size(x) ((int)(x).size())
#define pb push_back
#define int long long
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const int INF = 1e9 + 10;
const int MN = 1e5 + 10;

vector<int>vec;
int arr[MN] , n;
int uni[MN] , un;
ll fen[2][MN];
int ans[MN];

void add(int id,int p,int val){
	for(p++;p<MN;p+=p&-p) fen[id][p] += val;
}

ll get(int id,int p){
	ll ret = 0;
	for(;p;p-=p&-p) ret += fen[id][p];
	return ret;
}

int32_t main()
{
	ios_base :: sync_with_stdio(false) ,cin.tie(0) , cout.tie(0);
	cin >> n;
	uni[un++] = 0;
	for(int i=0;i<n;++i){
		cin >> arr[i];
		uni[un++] = arr[i];
	}
	sort(uni , uni+un);
	un = unique(uni , uni+un) - uni;

	for(int i=0;i<n;++i) arr[i] =lower_bound(uni , uni+un , arr[i]) - uni;
	int mx = -1;
	for(int i=0;i<n;++i){
		if(arr[i] > mx) vec.pb(i) , mx = arr[i];
	}
	int p = n-1;
	ll cur_s = 0;
	for(int i=Size(vec)-1;~i;--i){
		while(p >= 0 && p >= vec[i]){
			add(0 , arr[p] , 1);
			add(1 , arr[p] , uni[arr[p]]);
			--p;
		}
		int x = 0;
		if(i) x = arr[vec[i-1]];
	   	int num = get(0 , MN-1) - get(0 , x+1);
		ll sum = get(1 , MN-1) - get(1 , x+1);
		ans[vec[i]] = (sum-cur_s) - 1ll*num*uni[x];
		cur_s += ans[vec[i]];	
	}
	for(int i=0;i<n;++i) cout << ans[i] << '\n';
	return 0;
}


Measured memory_bytes: 5876
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    int n,x,y;
    cin >> n >> x >> y;
    x--; y--;
    vector<int> ans(n,0);
    rep(i,n) {
        vector<int> dis(n,inf);
        queue<int> q;
        dis[i] = 0;
        q.push(i);
        auto add = [&](int ni,int d) {
            if(ni < 0 || ni >= n) return;
            if(dis[ni] != inf) return;
            dis[ni] = d;
            q.push(ni);
        };
        while (!q.empty()) {
            int ni = q.front();
            q.pop();
            add(ni-1,dis[ni]+1);
            add(ni+1,dis[ni]+1);
            if(ni == x) add(y,dis[ni]+1);
            if(ni == y) add(x,dis[ni]+1);
        }
        rep(j,n) ans[dis[j]]++;
    }
    rep2(i,1,n) cout << ans[i]/2 << endl;
}


Measured memory_bytes: 384