akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0216
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                int n = RInt();
                if (n == -1) break;

                int cost = 1150;
                if (10 < n) { cost += 125 * Math.Min(n - 10, 10); }
                if (20 < n) { cost += 140 * Math.Min(n - 20, 10); }
                if (30 < n) { cost += 160 * (n - 30); }
                Console.WriteLine(4280 - cost);

            }

        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 15908
#include <iostream>

using namespace std;

int main(void){
  int n, x[100000];
  int i, c = 0;
  
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> x[i];
  }
  for(i = 1; i < n; i++){
    if(x[i-1] < x[i]){
      x[i]--;
    }
    else if(x[i-1] == x[i]){
    }
    else{
      c = 1;
      break;
    }
  }
  if(c == 0){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
  return 0;
}

Measured memory_bytes: 640
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
    var S = parseInt(chunk);
    var h = Math.floor(S/3600);
    var m = Math.floor(S/60)%60;
    var s = S%60;
    console.log(h+":"+m+":"+s);
});

Measured memory_bytes: 15492
N=int(input())
import math
def primes(x):
  if x < 2: return []
  primes = [i for i in range(x)]
  primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
  for prime in primes:
    if prime > math.sqrt(x): break
    if prime == 0: continue
    for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

  return [prime for prime in primes if prime != 0]

A=primes(55555)
B=[]
cnt=0
for i in A:
  if i%5==1:
    B.append(i)
    cnt+=1
    if cnt==N:
      print(*B)
      exit()

Measured memory_bytes: 5272
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((ll)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
typedef long long ll;
ll INF = 1e18;
using namespace std;
  

constexpr ll mod = 1e9+7;
template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
   if((x += p.x) >= mod) x -= mod;
   return *this;
 }

  ModInt &operator-=(const ModInt &p) {
   if((x += mod - p.x) >= mod) x -= mod;
   return *this;
  }

  ModInt &operator*=(const ModInt &p) {
   x = (int) (1LL * x * p.x % mod);
   return *this;
  }

  ModInt &operator/=(const ModInt &p) {
   *this *= p.inverse();
   return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
   int a = x, b = mod, u = 1, v = 0, t;
   while(b > 0) {
     t = a / b;
     swap(a -= t * b, b);
     swap(u -= t * v, v);
   }
   return ModInt(u);
  }

  ModInt pow(int64_t n) const {
   ModInt ret(1), mul(x);
   while(n > 0) {
     if(n & 1) ret *= mul;
     mul *= mul;
     n >>= 1;
   }
   return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
   return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
   int64_t t;
   is >> t;
   a = ModInt< mod >(t);
   return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< mod >;



int main(){
  ll N,K;
  cin >> N >> K;
  
  vector<ll> S1(N);
  vector<ll> S2(N);
  
  vector<ll> A(N);
  
  rep(i,N){
    ll a;
    cin >> A[i];
  }
  
  rep(i,N){
    ll count1 = 0;
    ll count2 = 0;
    rep(j,N){
      if(A[i]>A[j]){
        count1 += 1;
        if(j>i)count2 += 1;
      }
    }
    S1[i] = count1;
    S2[i] = count2;
  }
  
  ll sum1 = 0;
  ll sum2 = 0;
  
  for(ll n: S1){
    sum1 += n;
  }
  
  for(ll n: S2){
    sum2 += n;
  }
  
  // ll ans = ( ( (sum2%MOD) * (K%MOD) )%MOD ) + ( (((sum1%MOD)*(((K-1)%MOD)*(K%MOD))%MOD)%MOD)*modinv(2, MOD)%MOD );
  modint ans = 0;
  
  modint s1,s2,k,km1,n2;
  s1 = sum1;
  s2 = sum2;
  k = K;
  km1 = K-1;
  n2 = 2;

  ans = ( ( sum2 * K )%mod ) + ( ((sum1*((K-1)/2*K)%mod)%mod) );
  ans = (s2 * k + s1*km1*k/n2);
  
  cout << ans << endl;




  return 0;
}


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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    StringBuilder ans = new StringBuilder();
    ans.append(str[1] + str[0]);
    System.out.println(ans);
  }
}

Measured memory_bytes: 24660
#include<cstdio>
#include<cmath>
int main(){
    double x[4],y[4];
    while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf\n",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3])!=-1){
        bool is=true;
        double radsum=0;
        for(int i=0;i<4;i++){
            int a=i,b=(i+1)%4,c=(i+2)%4;
            radsum+=acos((pow(x[a]-x[b],2)+pow(y[a]-y[b],2)+pow(x[b]-x[c],2)+pow(y[b]-y[c],2)-pow(x[c]-x[a],2)-pow(y[c]-y[a],2))/(2*sqrt(pow(x[a]-x[b],2)+pow(y[a]-y[b],2))*sqrt(pow(x[b]-x[c],2)+pow(y[b]-y[c],2))));
        }
        if(radsum<M_PI*2)printf("NO\n");
        else printf("YES\n");
    }
}

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

using namespace std;

using int64 = long long;

struct INFTY {
  const int64 infll = (1LL << 62) - 1;
  const int inf = (1 << 30) - 1;

  operator int64() { return infll; }

  operator int() { return inf; }
} inf;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< class T >
struct CumulativeSum {
  vector< T > data;

  CumulativeSum(int sz) : data(sz, 0) {};

  void add(int k, T x) {
    data[k] += x;
  }

  void build() {
    for(int i = 1; i < data.size(); i++) {
      data[i] += data[i - 1];
    }
  }

  T query(int k) {
    if(k < 0) return (0);
    return (data[min(k, (int) data.size() - 1)]);
  }
};


int main() {
  string S, T;
  cin >> S >> T;
  int Q;
  cin >> Q;
  CumulativeSum< int > X(S.size()), Y(T.size());
  for(int i = 0; i < S.size(); i++) X.add(i, S[i] == 'A');
  for(int i = 0; i < T.size(); i++) Y.add(i, T[i] == 'A');
  X.build();
  Y.build();
  while(Q--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    --a, --b, --c, --d;
    --a, --c;
    int AA = X.query(b) - X.query(a);
    int BB = (b - a) - AA;

    int CC = Y.query(d) - Y.query(c);
    int DD = (d - c) - CC;
    if((AA + BB * 2) % 3 == (CC + DD * 2) % 3) puts("YES");
    else puts("NO");
  }
}


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

typedef struct student {
    int A;
    int B;
} st;

int
cmp(const void *a, const void *b)
{
    return ((st *)a)->A - ((st *)b)->A;
}

int
main(int argc, char *argv[])
{
    int N;
    st ss[100000];
    int i;

    scanf("%d", &N);
    for (i=0; i<N; i++) {
        scanf("%d", &((ss+i)->A));
        (ss+i)->B = i+1;
    }
    qsort(ss, N, sizeof(st), cmp);
    for (i=0; i<N; i++) {
//        printf("(%d) ", (ss+i)->A);
        printf("%d ", (ss+i)->B);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
const int N = 200005;
 
const ll MOD = 1e9+7;
ll a[N];
ll sum[N];
ll powermod(ll a,ll b){
	ll ret = 1;
	while(b){
		if(b&1){
			ret *= a;
			ret %= MOD;
		}
		b >>= 1;
		a *= a;
		a %= MOD;
	}
	return ret;
}
 
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n;
	cin>>n;
	
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	
	for(int i=n;i>0;i--){
		sum[i] = sum[i+1] + a[i+1];
		sum[i] %= MOD;
	}
	
	ll ans = 0;
	for(int i=1;i<=n;i++){
		ans += (sum[i] * a[i])%MOD;
		ans %= MOD;
	}
	cout<<ans;
	
	
	return 0;
}


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

using namespace std;

int main(){
    int n, k, q;
    cin >> n >> k >> q;

    int points[n];
    fill(points, points+n, k-q);
    for (int i=0; i<q; i++){
        int a;
        cin >> a;
        points[a-1]++;
    }
    for (int i=0; i<n; i++) {
        cout << (points[i]>0?"Yes\n":"No\n");
    }
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace AtcoderProblem
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int len = S.Length - 1;
            string M = S.Substring(len);
            string answer;
            if(M == "s")
            {
                answer = S + "es";
            }
            else
            {
                answer = S + "s";
            }
            Console.WriteLine(answer);

        }         
    }
}


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int a, b;
  cin >> a >> b;
  int ans = 0;
  while (a <= b) ans++, a *= 2;
  cout << ans << '\n';
  return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using cd = complex<ld>;

const int N = 350;

int dp[N][N];
char a[N][N];
char b[N][2];
int cost[N][N];

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

  int h, w;
  cin >> h >> w;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> a[i][j];
    }
  }
  const int INF = 1'000'000'000;
  int res = 0;
  for (int col = 0; col + 1 < w; col++) {
    for (int i = 0; i < h; i++) {
      b[i][0] = a[i][col];
      b[i][1] = a[i][col + 1];
    }
    for (int i1 = h - 1; i1 >= 0; i1--) {
      for (int i2 = h - 1; i2 >= 0; i2--) {
        cost[i1][i2] = cost[i1 + 1][i2 + 1] + (a[h - 1 - i1][col] == a[h - 1 - i2][col + 1]);
      }
    }
    for (auto &i : dp) {
      for (auto &j : i) {
        j = INF;
      }
    }
    for (int i1 = h; i1 >= 0; i1--) {
      for (int i2 = h; i2 >= 0; i2--) {
        if (i1 == h && i2 == h) {
          dp[i1][i2] = 0;
        } else {
          if (i1 + 1 <= h) {
            dp[i1][i2] = min(dp[i1][i2], dp[i1 + 1][i2] + cost[i1][i2]);
          }
          if (i2 + 1 <= h) {
            dp[i1][i2] = min(dp[i1][i2], dp[i1][i2 + 1] + cost[i1][i2]);
          }
        }
      }
    }
    res += dp[0][0];
  }
  cout << res;
  return 0;
}


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

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int v=sc.nextInt(), e=sc.nextInt();
        Node[] nodes=new Node[v];
        for(int i=0;i<v;i++) nodes[i]=new Node(i);
        for(int i=0;i<e;i++){
            int v1=sc.nextInt(), v2=sc.nextInt();
            long w=sc.nextLong();
            nodes[v1].edges.add(new Edge(v1, v2, w));
            nodes[v2].edges.add(new Edge(v2, v1, w));
        }
        sc.close();
        Edge[] mst=prim(v, nodes);
        long ans=0;
        for(Edge edge:mst) ans+=edge.cost;
        System.out.println(ans); 
    }

    public static Edge[] prim(int n, Node[] nodes){
        HashSet<Integer> connected=new HashSet<>();
        connected.add(0);
        PriorityQueue<Edge> pq=new PriorityQueue<>((u, v)->u.cost>v.cost?1:u.cost<v.cost?-1:0);
        for(Edge e:nodes[0].edges) pq.add(e);
        Edge[] ret=new Edge[n-1];
        int index=0; 
        while(pq.size()>0 && connected.size()<n){
            Edge e=pq.poll();
            if(!connected.contains(e.u)){
                ret[index++]=e;
                connected.add(e.u);
                for(Edge edge:nodes[e.u].edges){
                    if(!connected.contains(edge.u) || !connected.contains(edge.v)) pq.add(edge);
                }
            }
            else if(!connected.contains(e.v)){
                ret[index++]=e;
                connected.add(e.v);
                for(Edge edge:nodes[e.v].edges){
                    if(!connected.contains(edge.u) || !connected.contains(edge.v)) pq.add(edge);
                }
            }
        }
        return ret;
    }

    static class Node{
        int id;
        long value;
        Node prev;
        ArrayList<Edge> edges;
        public Node(int id){
            this.id=id;
            this.value=Long.MAX_VALUE;
            edges=new ArrayList<Edge>();
        }
        @Override public boolean equals(Object o){
            if(! (o instanceof Node)) return false;
            Node n=(Node) o;
            if(n.id==id) return true;
            else return false;
        }
        @Override public int hashCode(){return id;}
    }

    static class Edge{
        int u, v;
        long cost;
        public Edge(int u, int v, long cost){
            this.u=u;
            this.v=v;
            this.cost=cost;
        }
    }
}




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

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

int main(){
    int a, b; cin >> a >> b;
    
    cout << gdb(a, b) << endl;
    
    return 0;
}



Measured memory_bytes: 3088
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
AGC023 B
"""

from itertools import product

n = int(input())
sli = [input() for i in range(n)]

ans = 0
for k in range(n):
    if all((sli[i][j] == sli[(j+k) % n][(i-k) % n] for i, j in product(range(n), repeat=2))):
        ans += n

print(ans)



Measured memory_bytes: 43228
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int a[210],b,ans=10000;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b=0;
        while(a[i]%2==0){
            b++;
            a[i]/=2;
        }
        ans=min(ans,b);
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define ll long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define testcase ll T; cin >> T; for (ll tc = 1; tc <= T; tc++)
#define M 1000000007
#define MM 998244353
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
#define r2 1.41421356237
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod;assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  //testcase {
  int n;
  cin>>n;
  vector<ll>v(n),vv(n);
  for(int i=0;i<n;i++) { cin>>v[i]; }
  	vv[0]=v[0];
  for(int i=1;i<n;i++) {
  	vv[i]=(vv[i-1]%M+v[i]%M)%M;
  	//cout<<vv[i]<<'\n';
  }
  ll ans=0;
  for(int i=n-1;i>0;i--) {
  	ans+=(v[i]*vv[i-1])%M;
  	ans%=M;
  	//cout<<ans<<'\n';
  }
  cout<<ans;
  //}  
  return 0;
}

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

ll nck(ll n, ll k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  if(k == 0 || k == n) return 1;
  ll nume = 1, deno = 1;
  for(int i=0; i<k; i++){
    nume *= (n-i);
    deno *= (i+1);
  }
  return (ll)(nume/deno);
}

int main(){
    ll N, K;
    cin >> N >> K;
    ll ans = K;
    rep(i, 0, N-1) ans *= (K-1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 764
R, C, K = map(int, input().split())
RC = [[0] * C for _ in range(R)]
for _ in range(K):
    r, c, v = map(int, input().split())
    RC[r-1][c-1] = v


def solve():
    memo = [[0] * 4 for _ in range(C+1)]
    prev = [[0] * 4 for _ in range(C+1)]
    for r in range(1,R+1):
        prev, memo = memo, prev
        for c in range(1,C+1):
            v = RC[r-1][c-1]
            memo[c][0] = max(prev[c][3], memo[c-1][0])
            memo[c][1] = max(memo[c][0] + v, memo[c-1][1])
            memo[c][2] = max(memo[c][1], memo[c-1][1] + v, memo[c-1][2])
            memo[c][3] = max(memo[c][2], memo[c-1][2] + v, memo[c-1][3])
    return memo[-1][3]

if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 141380
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <bitset>
#include <cstdlib>
using namespace std;

int main()
{
    int X;
    cin >> X;
    int step = 1;
    while ((step * (step + 1)) / 2 < X)
    {
        step++;
    }
    cout << step << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N;
  cin >> N;
  string S;
  cin >> S;

  int B = 0;
  rep(i, N) {
    B += (S[i] == 'B');
  }

  int ans = 0;
  rep(r, N) {
    rep(g, N) {
      if (S[r] != 'R' || S[g] != 'G')
        continue;
      ans += B;

      int diff = abs(r - g);
      int migi = max(r, g) + diff, hidari = min(r, g) - diff;
      int naka = ((r + g) % 2 == 0 ? (r + g) / 2 : r);
      if (migi < N)
        ans -= (S[migi] == 'B');
      if (hidari >= 0)
        ans -= (S[hidari] == 'B');
      ans -= (S[naka] == 'B');
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3640
/**
题目：
链接：
题意：
思路：
*/
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<bitset>
using namespace std;
const int maxn = 5005;
const int inf = 0x3f3f3f3f;
typedef long long ll;
int a[maxn];
int n , k;
int b[maxn];
bitset<maxn> dp;
int judge(int x)
{
    if(a[x]>=k) return 1;
    ///剔除当前数，剩余的数dp一发；存在性判断.
    dp.reset();
    dp[0] = 1;
    for(int i = 0; i < n; i++){
        if(i==x) continue;
        dp|=(dp<<a[i]);
    }
    for(int i = k-1; i >= k-a[x]; i--){
        if(dp[i]){
            return 1;
        }
    }
    return 0;
}
int solve()
{

    sort(a,a+n);
    /*
    int lo = -1, hi = n;
    while(hi-lo>1){
        int m = (lo+hi)/2;
        if(judge(m)) hi = m;
        else lo = m;
    }
    return hi;
    */
    int lo = 0, hi = n-1;
    int mas = -1;///这里必须-1，因为我后面+1了，如果不这样的话，结果>=1;
    while(lo<=hi){
        int m = (lo+hi)/2;
        if(judge(m)) hi = m-1;
        else{
            lo = m+1;
            mas = max(mas,m);
        }
    }
    return mas+1;///下标是mas，所以要再加一；
}
int main()
{
    while(scanf("%d%d",&n,&k)==2)
    {
        for(int i = 0; i < n; i++){
            scanf("%d",&a[i]);
        }
        printf("%d\n",solve());
    }
    return 0;
}


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

typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
using namespace std;

int H, W;
string board[50];
bool used[50][50];

int dfs(int h, int w) {
    if (h < 0 || h >= H || w < 0 || w >= W || used[h][w] || board[h][w] == '.') return 0;

    used[h][w] = true;
    int ret = 1;
    ret += dfs(h + 1, w);
    ret += dfs(h - 1, w);
    ret += dfs(h, w + 1);
    ret += dfs(h, w - 1);
    return ret;
}

int main() {
    cin >> H >> W;
    REP(i, H) cin >> board[i];
    REP(i, H) REP(j, W) {
        if (board[i][j] == '#' && !used[i][j])
            if (dfs(i, j) <= 1) {
                cout << "No" << endl;
                return 0;
            }
    }
    cout << "Yes" << endl;
    return 0;
}

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

is_true = True
d = {}
for i in range(M):
    s, c = map(int, input().split())
    if s == 1 and c == 0:
        if N == 1:
            d[s] = c
        else:
            is_true = False
            break
    elif s not in d:
        d[s] = c
    else:
        if d[s] != c:
            is_true = False
            break

if is_true:
    for x in range(1, N+1):
        if x not in d:
            if x == 1 and N != 1:
                d[x] = 1
            else:
                d[x] = 0

    new = sorted(d.items())
    ans = ''
    for k in new:
        ans += str(k[1])

    if len(ans) == N:
        print(ans)
    else:
        print('-1')
else:
    print('-1')


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

int main() {

    int a, b, c;
    int n;

    cin >> n;

    while( cin >> a >> b >> c ) {

        if ( a*a+b*b==c*c || b*b+c*c==a*a || c*c+a*a==b*b ) cout << "YES" << endl;
        else    cout << "NO" << endl;

    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ld long double
#define int long long
using namespace std;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e17;
int dx[] = {0,0,-1,1,-1,-1,1,1};
int dy[] = {1,-1,0,0,1,-1,-1,1};
int dp[N][3], a[N], b[N], c[N];
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
	int n;
	cin >> n;
	int arr[n];
	for(int i = 1; i <= n; i++){
		cin >> a[i] >> b[i] >> c[i];
	}
	dp[1][0] = a[1];
	dp[1][1] = b[1];
	dp[1][2] = c[1];
	for(int i = 2; i <= n; i++){
		dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
		dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]);
		dp[i][2] = max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
	}
	cout << max(max(dp[n][1], dp[n][0]), dp[n][2]);
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

using namespace std;

typedef long long ll;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>pb_ds;

#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
#define pi pair<int,int>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define mod 1000000007
#define pai acos(-1)
#define N 100005

int ar[N][3],dp[N][3];

int main ()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int n;cin>>n;
   for(int i=1;i<=n;i++) cin>>ar[i][0]>>ar[i][1]>>ar[i][2];
   for(int i=n;i>=1;i--){
      dp[i][0]=max(dp[i+1][1],dp[i+1][2])+ar[i][0];
      dp[i][1]=max(dp[i+1][0],dp[i+1][2])+ar[i][1];
      dp[i][2]=max(dp[i+1][0],dp[i+1][1])+ar[i][2];
   }
   cout<<max(dp[1][0],max(dp[1][1],dp[1][2]))<<"\n";
   return 0;
}


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

int main() {
	// your code goes here
	int n;
	cin >> n;
	vector<vector<int> > dp(n+1, vector<int>(3, 0));
	for(int i=0; i<n; i++){
		vector<int> util(3);
		cin >> util[0] >> util[1] >> util[2];
		for(int j=0; j<3; j++){
			dp[i+1][(j+1)%3]=max(dp[i+1][(j+1)%3], dp[i][j]+util[(j+1)%3]);
			dp[i+1][(j+2)%3]=max(dp[i+1][(j+2)%3], dp[i][j]+util[(j+2)%3]);
		}
	}
	cout << max(max(dp[n][0], dp[n][1]), dp[n][2]) << endl;
	return 0;
}

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

int main(void) {
  int N;
  int R;

  scanf("%d %d", &N, &R);

  if (N >= 10) { // 参加回数(N)が10回以上
  // 内部レーティング(R)をそのまま出力
    printf("%d\n", R);
  }
  else { // 参加回数が10回未満
    // 内部レーティングを補正して出力
    printf("%d\n", R + (100 * (10 - N)));
  }

  return (0);
}

Measured memory_bytes: 128
#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 rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define dump(x) cerr<<#x<<": "<<x<<endl
#define debug(x) cerr<<#x<<": "<<x<<" ("<<__LINE__<<")"<<endl
using namespace std;
using vint = vector<int>;
using vdouble = vector<double>;
using vstring = vector<string>;
using ll = long long;
using vll = vector<ll>;
using P = pair<int, int>;

int main() {
    int n; cin >> n;
    vint p(n);
    rep(i, n) cin >> p[i];
    vint a(n), b(n);
    rep(i, n) {
        a[i] = n * i + 1;
        b[n-i-1] = n * i + 1;
    }
    rep(i, n) {
        b[p[i]-1] += i;
    }
    rep(i, n-1) cout << a[i] << " ";
    cout << a.back() << endl;
    rep(i, n-1) cout << b[i] << " ";
    cout << b.back() << endl;
    return 0;
}


Measured memory_bytes: 896
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
#define foreach(x,a) for(auto &x:a)
typedef long long ll;
const ll MOD = 1e9+7;
//}}}

pair<int, int> p[100000];
int b[100000];
int main(){
  int N, M;
  cin >> N >> M;
  rep(i, M){
    int a, b;
    cin >> a >> b;
    p[i] = make_pair(a, b);
  }
  sort(p, p + M);
  int ans = 1;
  int pos = p[0].second;
  rep(i, M){
    int l = p[i].first;
    int r = p[i].second;
    if(r < pos){
      pos = r;
    }else if(pos <= l){
      ans++;
      pos = r;
    }
  }
  cout << ans << endl;
  return 0;
} 


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int N;cin>>N;
	vector<int>x(N),y(N),d(N);
	int xmaxR=-1e9,xmaxL=-1e9,xminR=1e9,xminL=1e9;
	int ymaxU=-1e9,ymaxD=-1e9,yminU=1e9,yminD=1e9;
	int dxmax=-1e9,dxmin=1e9,dymax=-1e9,dymin=1e9;
	for(int i=0;i<N;i++)
	{
		cin>>x[i]>>y[i];
		char c;cin>>c;
		d[i] = c;
		if(d[i]=='R')
		{
			xmaxR = max(xmaxR, x[i]);
			xminR = min(xminR, x[i]);
			
			dymax=max(dymax, y[i]);
			dymin=min(dymin, y[i]);
		}
		else if(d[i]=='L')
		{
			xmaxL = max(xmaxL, x[i]);
			xminL = min(xminL, x[i]);
			
			dymax=max(dymax, y[i]);
			dymin=min(dymin, y[i]);
		}
		else if(d[i]=='U')
		{
			ymaxU = max(ymaxU, y[i]);
			yminU = min(yminU, y[i]);
			
			dxmax=max(dxmax, x[i]);
			dxmin=min(dxmin, x[i]);
		}
		else if(d[i]=='D')
		{
			ymaxD = max(ymaxD, y[i]);
			yminD = min(yminD, y[i]);
			
			dxmax=max(dxmax, x[i]);
			dxmin=min(dxmin, x[i]);
		}
	}
	
	vector<double>t;
	t.push_back(0);
	if(xmaxL>xmaxR)t.push_back((xmaxL-xmaxR)*0.5);
	if(xminL>xminR)t.push_back((xminL-xminR)*0.5);
	if(dxmax>xmaxR)t.push_back(dxmax-xmaxR);
	if(dxmin<xminL)t.push_back(xminL-dxmin);
	if(dxmax<xmaxL)t.push_back(xmaxL-dxmax);
	if(dxmin>xminR)t.push_back(dxmin-xminR);
	if(ymaxD>ymaxU)t.push_back((ymaxD-ymaxU)*0.5);
	if(yminD>yminU)t.push_back((yminD-yminU)*0.5);
	if(dymax>ymaxU)t.push_back(dymax-ymaxU);
	if(dymin<yminD)t.push_back(yminD-dymin);
	if(dymax<ymaxD)t.push_back(ymaxD-dymax);
	if(dymin>yminU)t.push_back(dymin-yminU);
	
	double ans = 1e18;
	for(int j=0;j<t.size();j++)
	{
		double time = t[j];
		if(time > 3e8)continue;
		
		double xmin = 1e9, xmax = -1e9;
		double ymin = 1e9, ymax = -1e9;
		
		for(int i=0;i<N;i++)
		{
			double x1 = x[i];
			double y1 = y[i];
			
			if(d[i]=='R')x1+=time;
			else if(d[i]=='L')x1-=time;
			else if(d[i]=='U')y1+=time;
			else if(d[i]=='D')y1-=time;
			
			xmin = min(xmin, x1);
			xmax = max(xmax, x1);
			ymin = min(ymin, y1);
			ymax = max(ymax, y1);
		}
		
		ans = min(ans, (xmax-xmin) * (ymax-ymin));
	}
	cout<<fixed<<setprecision(10)<<ans<<endl;
		
	
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define REPe(i, n) for(int i = 0; i <= (int)(n); ++i)
#define REPi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define REPei(i, a, b) for(int i = int(a); i <= int(b); ++i)

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

    int N;
    int Y;
    int ansA = -1, ansB = -1, ansC = -1;
    int flag = 0;
    int sumMoney;
    cin >> N >> Y;

    REPe(i, N) {
        REPe(j, N-i) {
            if(N-i-j >= 0)sumMoney = i*10000 + j*5000 + (N-i-j)*1000;
            if(Y == sumMoney) {
                ansA = i;
                ansB = j;
                ansC = N - i - j;
                flag = 1;
                break;
            }
        }
        if(flag == 1) break;
    }
    cout << ansA << " " << ansB << " " << ansC;

}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class task
{
    public int time { get; set; }
    public int limit { get; set; }
}

class Program
{
    static void Main(string[] args)
    {
        int i = 0;
        var tasks = new List<task>();
        var retValue = "Yes";

        int N = int.Parse(Console.ReadLine());
        while (i < N)
        {
            var t = new task();
            // スペース区切りの整数の入力
            string[] input = Console.ReadLine().Split(' ');
            t.time = int.Parse(input[0]);
            t.limit = int.Parse(input[1]);
            tasks.Add(t);
            i++;
        }

        int now = 0;
        var ordertasks = tasks.OrderBy(r => r.limit).ThenByDescending(r => r.time).ToArray();
        foreach(var rec in ordertasks)
        {
            if (now + rec.time > rec.limit)
            {
                retValue = "No";
                break;
            }
            now += rec.time;
        }

        //出力
        Console.WriteLine(retValue);
    }
}

Measured memory_bytes: 35880
#include <iostream>
#include <string>
#include <cctype>

using namespace std;

int main()
{
    string word;
    char lower[1000] = {0};
    cin >> word;
    for (auto i = 0; i < word.size(); ++i) lower[i] = tolower(word[i]);
    lower[word.size()] = '\0';
    string word_lower(lower);

    int count = 0;
    string each_t;
    while (cin >> each_t) {
        if (each_t == "END_OF_TEXT") break;
        for (auto i = 0; i < each_t.size(); ++i) lower[i] = tolower(each_t[i]);
        lower[each_t.size()] = '\0';
        string each_t_lower(lower);
        if (word_lower == each_t_lower) ++count;
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3128
A=[]
while True:
    try:
        A.append(list(map(int,input().split())))
              
 
    except:
        break;
#2列めがT以下で且つ、コストが最小なものを抽出
T = A[0][1]
Tc = 0
min = A[1][0] #最小を7とす
 
for i in range(1, len(A)):
  j = int(i)
  if A[j][1] <= T:
    Tc = Tc+1
    if A[j][0] <= min:
      min = A[j][0]
     
      
if Tc == 0:
  print("TLE")
else:
  print(min)

Measured memory_bytes: 3064
using System;

class Program
{
    static void Main()
    {
        string[] s;

        int n = int.Parse(Console.ReadLine());

        s = Console.ReadLine().Split(' ');
        int[] S = new int[n];
        for (int i = 0; i < n; i++) S[i] = int.Parse(s[i]);
        
        int q = int.Parse(Console.ReadLine());

        s = Console.ReadLine().Split(' ');
        int[] T = new int[q];
        for (int i = 0; i < q; i++) T[i] = int.Parse(s[i]);

        int c = 0;

        for (int i = 0; i < q; i++)
        {
            for (int j = 0; j < n; j++)
            {
                if (T[i] == S[j])
                {
                    c++;
                    break;
                }
            }
        }

        Console.WriteLine(c.ToString());
    }
}


Measured memory_bytes: 9668
n,m=gets.split.map(&:to_i)
l=[0]*(n+1)
a=[0]*(n+1)
m.times do
  p,s=gets.chomp.split
  p=p.to_i
  if a[p]==0
    if s=="WA"
      l[p]+=1
    else
      a[p]=1
    end
  end
end
puts a.inject(:+)
c=0
1.upto(n) do |i|
  if a[i]==1
    c+=l[i]
  end
end
puts c


Measured memory_bytes: 3324
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
    int z;
    string x;
    getline(cin,x);
    z=x.length();
    for(int i=0; i<z; i++)
    {
        if(i==5||i==13)
        {
            cout<<" "<<x.at(i+1);
            i++;
        }
        else
            cout<<x.at(i);

    }
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
hantei = True
for i in a:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            hantei = False
            break

if hantei == True:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 2940
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        Set<Integer> S = new HashSet();
        int ans = -1;
        int cnt = 0;
        for (int sum = 0; true; ) {
            cnt++;
            sum = (sum * 10 + 7) % n;
            if (sum % n == 0) {
                ans = cnt;
                break;
            }
            if (S.contains(sum)) break;
            S.add(sum);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 102864
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *					# ll = deepcopy(l)
from heapq import *					# heappush(hp,x)
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize				# minn = -maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *				# pre = [0] + list(accumulate(l))
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	a,b,c,k = l
	if(k <= a):
		return k
	elif(k <= a+b):
		return a
	else:
		return a-(k-a-b)
	

l = list(map(int, stdin.readline().rstrip().split()))
ans = solve(l)
print(ans)



Measured memory_bytes: 81088
n,q=map(int,input().split())
edge=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    edge[a-1].append(b-1)

base_score = [0]*n
for i in range(q):
    p,x=map(int,input().split())
    base_score[p-1] += x
    
score=[0]*n

for i,bs in enumerate(base_score):
    score[i] = bs
    for j in edge[i]:
        base_score[j] += bs

print(*score)

Measured memory_bytes: 49456
#include<stdio.h>

int main(){
	
	int N,ans=0,i;
	char S[100010];
	
	scanf("%d",&N);
	scanf("%s",S);
	
	for(i=0;i<N-1;i++){
		if(S[i]!=S[i+1]){
			ans++;
		}
	}
	
	
	printf("%d",ans+1);
	
	return 0;
}

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

typedef long long lint; typedef pair<int, int> ii;
const int MOD = 1'000'000'007, MOD2 = 1'000'000'009;
const int INF = 0x3f3f3f3f; const lint BINF = 0x3f3f3f3f3f3f3f3fLL;

int n, a[100005], b[100005], c[100005];

int solve(){
	cin >> n;
	for(int i=0;i<n;i++) cin >> a[i];
	for(int i=0;i<n;i++) cin >> b[i];
	for(int i=0;i<n;i++) cin >> c[i];
	sort(a, a+n); sort(b, b+n); sort(c, c+n);
	lint ans = 0;
	for(int i=0;i<n;i++){
		int lo = lower_bound(a, a+n, b[i]) - a;
		int hi = n - (upper_bound(c, c+n, b[i]) - c);
		ans += 1LL * lo * hi;
	}
	cout << ans << endl;
	return 0;
}

int main(){
	ios::sync_with_stdio(0);
	// int t; cin >> t; while(t--)
	solve();
	// cout << (solve() ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <cmath>
#include <cstring>
using namespace std;

#define pi acos(-1)

int to_int(string s){
    int number = 0;
    for(int i=0;i<s.size();i++){
        number *= 10;
        number += s[i] - '0';
    }
    return number;
}

string to_str(int n){
    string s;
    while(n!=0){
        s += n % 10 + 48;
        n /= 10;
    }
    reverse(s.begin(),s.end());
    return s;
}

bool isLeapYear(int year)
{
    if(((year % 4 == 0 ) && (year % 100 != 0)) || (year % 400 == 0))
        return true;
    else
        return false;
}

bool isPrime(int n)
{
    if(n ==1)
        return false;
    if (n == 2)
        return true;
    if ((n & 1)==0)
        return false;
    for (int i = 3; i*i <= n;i+=2) {
        if (n%i == 0)
            return false;
    }

    return true;
}

bool isPalindrome(string s)
{
    for(int i=0,j=s.size()-1 ; i< s.size()/2 && j >= s.size()/2;i++,j--){
            if(s[i] == s[j])
                continue;
            else{
                return false;
            }
        }
    return true;
}

bitset <1000001> primeArr;
void sieve()
{
    int num_sqrt = sqrt(1000000);
    primeArr[1] = 1;
    for(int i=4;i<=1000000;i+=2)
        primeArr[i] = 1;

    for(int i=3;i<=num_sqrt;i+=2){
        for(int j=2;i*j<=1000000;j++)
            primeArr[i*j] = 1;
    }
}

long long fibo(vector <int> &arr, int n)
{
    if(n == 1 || n == 0){
        arr[n] = 1;
        return 1;
    }
    if(arr[n] != 0)
        return arr[n];

    long long memo = fibo(arr, n-1) + fibo(arr, n-2);
    arr[n] = memo;
    return memo;
}


long long permutation(int np, int rp) {
    long long n=1, r=1;
    for(int i=1;i<=np;i++){
        n*=i;
    }
    for(int i=1;i<=np-rp;i++){
        r*=i;
    }

    return n/r;
}

bool comp(pair <int, int> a, pair <int, int> b)
{
    if( a.first > b.first)
        return true;
    else if(a.first == b.first)
        return a.second<b.second;
    else
        return false;
}

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


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


public class Main {
    private static int MOD = 1000000007;


    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String str = br.readLine();
        String[] split = str.split(" ");
        int n = Integer.parseInt(split[0]);
        int m = Integer.parseInt(split[1]);

        split = br.readLine().split(" ");

        int total = 0;

        List<Integer> hyous = new ArrayList<>();
        for (String s : split) {
            int hyou = Integer.parseInt(s);
            total += hyou;
            hyous.add(hyou);
        }

        hyous.sort(Collections.reverseOrder());

        int ikichi = total / (4 * m);
        int amari = total % (4 * m);
        if(amari != 0) {
            ikichi++;
        }
        for (int i = 0; i < m; i++) {
            int hyou = hyous.get(i);
            if (hyou < ikichi) {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");

    }
}


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

int main(){
  int ant[5];
  int k;
  for(int i=0;i <5 ;i++){
    cin >> ant[i];
  }
  cin >> k;
  string ans ="Yay!";
  for(int i=0; i<5 ;i++){
    for (int j=i; j<5;j++){
      if(abs(ant[i]-ant[j])>k){
        ans =":(";
        break;
      } 
    }
  }
  cout << ans<<endl;
  return 0;

}


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

int main() {
  vector<char> c[10];
  c[1].push_back('.');
  c[1].push_back(',');
  c[1].push_back('!');
  c[1].push_back('?');
  c[1].push_back(' ');
  c[2].push_back('a');
  c[2].push_back('b');
  c[2].push_back('c');
  c[3].push_back('d');
  c[3].push_back('e');
  c[3].push_back('f');
  c[4].push_back('g');
  c[4].push_back('h');
  c[4].push_back('i');
  c[5].push_back('j');
  c[5].push_back('k');
  c[5].push_back('l');
  c[6].push_back('m');
  c[6].push_back('n');
  c[6].push_back('o');
  c[7].push_back('p');
  c[7].push_back('q');
  c[7].push_back('r');
  c[7].push_back('s');
  c[8].push_back('t');
  c[8].push_back('u');
  c[8].push_back('v');
  c[9].push_back('w');
  c[9].push_back('x');
  c[9].push_back('y');
  c[9].push_back('z');

  int n;
  cin >> n;
  while(n--) {
    string s;
    cin >> s;
    string t="";
    int cnt=-1;
    for(int i=0; i<s.size(); i++) {
      if(s[i]!='0') {
	cnt++;
      } else {
	int x=(int)s[i-1]-48;
	if(cnt!=-1) t+=c[x][cnt%c[x].size()];
	cnt=-1;
      }
    }
    cout << t << endl;
  }
  return 0;
}


Measured memory_bytes: 1232
//#pragma GCC optimize("-Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//#pragma GCC target("avx2")  //Enable AVX
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//order_of_key(x) : number of items less than x
//find_by_order(x) : iterator to x

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()

const ld pi=3.14159265359;
ll INF=1e18+10;
ll MOD=998244353;
ll mod=1e9+7;

inline ll add(ll a,ll b,ll m){
    if((a+b)>=m)return (a+b)%m;
    return a+b;
}

inline ll mul(ll a,ll b,ll m){
    if((a*b)<m)return a*b;
    return (a*b)%m;
}

ll expo(ll a,ll b,ll m){
    if(b<0)return expo(expo(a,m-2,m),-b,m);
    ll res=1;
    while(b>0){
        if(b&1)res=mul(res,a,m);
        a=mul(a,a,m);
        b=b/2;
    }
    return res;
}

int main()
{
    string s;
    cin>>s;
    ll ans = 0;
    rep(i,0,3){
        int cur = 0;
        bool cant = false;
        rep(j,i,3){
            if(s[j]!='R')break;
            else {
                ans = max(ans, j-i+1);
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3628
#include <iostream>                                                      
using namespace std;                                                     
                                                                         
int main() {                                                             
  int a, b;                                                              
  char op;                                                               
  while (true) {                                                         
    cin >> a >> op >> b;                                                 
    if (op=='?') {                                                       
      break;                                                             
    }                                                                    
    int ans;                                                             
    switch (op) {                                                        
    case '+':                                                            
      ans = a+b;                                                         
      break;                                                             
    case '-':                                                            
      ans = a-b;                                                         
      break;                                                             
    case '*':                                                            
      ans = a*b;                                                         
      break;                                                             
    case '/':                                                            
      ans = a/b;                                                         
      break;                                                             
    default:                                                             
      break;                                                             
    }                                                                    
    cout << ans << endl;                                                 
  }                                                                      
  return 0;                                                              
}                                                                        
                             

Measured memory_bytes: 3044