akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=1200005;
const ll mod=1e9+7;
inline int read()
{
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') {x=x*10+ch-'0',ch=getchar();}
    return x*f;
}
ll n,m,ans,p[N],tot;
void work()
{
	ll s=1,t=n;
	for(int i=1; i<=tot; i++){
		ll cnt=1;
		if(t%p[i]) continue;
		while(t%p[i]==0) t/=p[i],cnt++;
		s*=cnt;
	}
	if(t>1) s*=2;
	s--; ans=s;
}
int main()
{
	cin>>n; m=(ll)sqrt(n);
	for(int i=2; i<=m; i++){
		if(p[i]) continue;
		for(int j=i+i; j<=m; j+=i) p[j]=1;
	}
	for(int i=2; i<=m; i++){
		if(!p[i]) p[++tot]=i;
	} 
	n--; work(); n++;
	ll t,t2;
	for(int i=2; 1ll*i*i<=n; i++){
		t=n;
		if(t%i) continue;
		while(t%i==0) t/=i;
		if(t%i==1) ans++;
//		t2=n/t;
//		if(t2%(n/i))
	}
	cout<<ans+1<<endl;
	return 0;
}

Measured memory_bytes: 8448
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    n = II()
    ws = MII()
    ws_sums = [0]
    for w in ws: ws_sums.append(ws_sums[-1]+w)
    minv = 10**9
    for i in range(1, n):
        s1 = ws_sums[i]
        s2 = ws_sums[-1] - ws_sums[i]
        minv = min(minv, abs(s1-s2))
    print(minv)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
long long b[401][401];

int main() 
{
	int n;
	cin >> n;
	long long a[n + 1], prefixsum[n + 1];
	prefixsum[0] = 0;
	
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		prefixsum[i] = prefixsum[i - 1] + a[i];
	}
	
	for (int i = 1; i <= n; i++)
	{
		b[i][i] = 0;
		for (int j = i - 1; j >= 1; j--)
			{
				long long amin = 1e18;
				for (int k = j; k <= i - 1; k++) 
					if (amin > b[j][k] + b[k + 1][i]) amin = b[j][k] + b[k + 1][i];
				b[j][i] = amin + prefixsum[i] - prefixsum[j - 1];
			}
	}
	cout << b[1][n];
}

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

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

using namespace std;
using lint=long long;

int main(){
	int n; cin>>n;
	vector<lint> a(n);
	rep(i,n){
		string s; cin>>s;
		int j=s.find('.');
		if(j==string::npos){
			lint x=stoll(s);
			a[i]=x*lint(1e9);
		}
		else{
			lint x=stoll(s.substr(0,j));
			string t=s.substr(j+1);
			while(t.length()<9) t+='0';
			lint y=stoll(t);
			a[i]=x*lint(1e9)+y;
		}
	}

	map<pair<int,int>,lint> f;
	for(lint x:a){
		int c2=0,c5=0;
		while(x%2==0) x/=2, c2++;
		while(x%5==0) x/=5, c5++;
		++f[{c2,c5}];
	}

	lint ans=0;
	for(auto p:f) for(auto q:f) {
		int c2=p.first.first +q.first.first;
		int c5=p.first.second+q.first.second;
		if(min(c2,c5)>=18) ans+=p.second*q.second;
	}
	rep(i,n) if(a[i]%lint(1e9)==0) ans--;
	ans/=2;
	printf("%lld\n",ans);

	return 0;
}


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

int main()
{
    int n;
    string s;
    while(cin>>n)
    {

        char c;
        int ans=0;
        rep(i,n)
        {
            cin>>c;
            if(c=='R') ans++;
        }
        if(ans*2>n) cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    string S; cin >> S;
    cout << (S.at(2) == S.at(3) and S.at(4) == S.at(5) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<map>
using namespace std;
int main(){
  map<char,int>ll;
  map<int,char>sw;
  ll['S']=0,ll['H']=1,ll['C']=2,ll['D']=3;
  sw[0]='S',sw[1]='H',sw[2]='C',sw[3]='D';
 
  int n,a;
  char c;
  bool card[4][13];
  memset(card,false,sizeof(card));
 
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> c >> a;
    card[ll[c]][a-1] = true;
  }
  for(int i=0;i<4;i++){
    for(int j=0;j<13;j++){
      if(!card[i][j]){
    cout << sw[i] << " " << j+1 << endl;
      }
    }
  }
}


Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func main() {
	defer w.Flush()

	var n int
	fmt.Fscanf(r, "%d\n", &n)

	a := make([]int, n)
	for i := 0; i < n-1; i++ {
		fmt.Fscanf(r, "%d ", &a[i])
	}
	fmt.Fscanf(r, "%d\n", &a[n-1])

	invNum := 0
	for i := 0; i < n; i++ {
		if a[i] < 0 {
			invNum++
		}
	}
	ans := 0
	if invNum%2 == 0 {
		for i := 0; i < n; i++ {
			ans += int(math.Abs(float64(a[i])))
		}
		fmt.Fprintln(w, ans)
		return
	}

	minIdx := 0
	for i := 0; i < n; i++ {
		if math.Abs(float64(a[i])) < math.Abs(float64(a[minIdx])) {
			minIdx = i
		}
	}
	for i := 0; i < n; i++ {
		if i == minIdx {
			ans -= int(math.Abs(float64(a[i])))
			continue
		}
		ans += int(math.Abs(float64(a[i])))
	}
	fmt.Fprintln(w, ans)
}


Measured memory_bytes: 3072
fun main(args: Array<String>) {
    val (N, D) = readLine()!!.split(" ").map { Integer.parseInt(it) }
    val pointsList = mutableListOf<List<Int>>()
    for (i in 0 until N) {
        val list2add = readLine()!!.split(" ").map { Integer.parseInt(it) }
        pointsList.add(list2add)
    }
    var result = 0
    for (i in 0 until N) {
        for (j in i + 1 until N) {
            var sumPowerd = 0
            for (k in 0 until D) {
                sumPowerd +=
                    Math.abs(pointsList[i][k] - pointsList[j][k]) * Math.abs(pointsList[i][k] - pointsList[j][k])
            }
            val distance = Math.sqrt(sumPowerd.toDouble())
            if (Math.floor(distance) == distance) {
                result++
            }
        }

    }
    println(result)
}


Measured memory_bytes: 36004
from collections import Counter
import numpy as np
H, W = map(int, input().split())
a = []
r_idx = []
c_idx = []
#a.shape = (H, W)
for i in range(H):
    line = list(input())
    ct = Counter(line).most_common()
    if not (ct[0][1] == W and ct[0][0] == "."):
        r_idx.append(i)
    a.append(line)
a = np.array(a).T
#a.shape = (W, H)
b = []
for i in range(W):
    ct = Counter(a[i]).most_common()
    if ct[0][1] == H and ct[0][0]==".":
        continue
    b.append(a[i])

b = np.array(b).T
c = []
for idx in r_idx:
    c.append(b[idx])

for i in range(len(c)):
    print("".join(c[i]))


Measured memory_bytes: 22412
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,k,h) for(int i = k; i < h; ++i)
#define rep3(l,k,h) for(int l = k; l <= h; ++l)
#define INF LLong_MAX // long long INF
#define inf INT_MAX // int inf

typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;


int main() {
    ll n, count = 0;
    cin >> n;
    rep(i,n) {
        int a;
        cin >> a;
        while(a % 2 == 0 && a > 0) {
            a /= 2;
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
main()
{
    int n,k; scanf("%d%d",&n,&k);
  
    int ary[1<<24];
    int que[1<<24];
    int que2[1<<24];
    int *beg=que,*end=que;
    int *beg2=que2,*end2=que2;
    int sorted=0;
    int ans=0;

    for(int i=0; i<n; ++i)
    {
        scanf("%d",ary+i);
        int flag=0;

        if(i>=k)
        {
            if(*beg==i-k) ++beg;
            else flag=1;

            if(*beg2==i-k) ++beg2;
        }

        while(beg!=end && ary[*(end-1)]>ary[i])
        {
            --end;
        }
        *end++=i;

        while(beg2!=end2 && ary[*(end2-1)]<ary[i]) --end2;
        if(beg2!=end2) flag=1;
        *end2++=i;

        if(i<k)
        {
            flag=0;
            if(i+1==k) flag=1;
        }

        if(end-beg==k)
        {
            flag=0;
            sorted=1;
        }

        if(flag)
        {
            ans++;
            // printf("%d\n",i);
        }
    }

    ans+=sorted;
    printf("%d\n",ans);
}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

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

	int x, a, b; cin >> x >> a >> b;

	cout << (abs(x - a) > abs(x - b) ? 'B' : 'A') << endl;
	
	return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
ll const MOD = 1e9 + 7;
long long modPow(int x, int n){
  if(n == 0) return 1;
  if(n % 2 == 0) {
    long long sqrtX = modPow(x,n/2);
    return sqrtX * sqrtX % MOD ;
  }else{
    return x * modPow(x,n-1) % MOD;
  }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    map<int,int> mp;
    VLL a(n);
    rep(i,n){
      cin >> a[i];
      mp[a[i]]++;
    }
    sort(all(a));

    if(n % 2 == 0){
      for(int i = 1; i <= n-1; i+=2){
        if(mp[i] == 2) continue;
        else{
          cout << 0 << endl;
          return 0;
        }
      }
      cout << modPow(2,n/2) << endl;
    }else{
      for(int i = 0; i <= n-1; i+=2){
        if(i == 0){
          if(mp[0] == 1) continue;
          else{
            cout << 0 << endl;
            return 0;
          }
        }else{
          if(mp[i] == 2) continue;
          else{
            cout << 0 << endl;
            return 0;
          }
        }
      }
      cout << modPow(2,n/2) << endl;
    }

    return 0;
}


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

class MainClass {
  public static void Main (string[] args) {
	  // 入力
    var str = Console.ReadLine().Split(' ');
    //処理
    if(str.Count(n => n == "5") == 2 && str.Count(n => n == "7") == 1){
      Console.WriteLine("YES");
    }else{
      Console.WriteLine("NO");
    }
    //出力
  }
}


Measured memory_bytes: 11220
using System;
using System.Collections.Generic;


namespace ConsoleApplication12
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {

                string[] str = Console.ReadLine().Split(' ');
                int x = int.Parse(str[0]);
                int y = int.Parse(str[1]);

                if (x == 0 && y == 0)
                {
                    break;
                }
                if (x > y)
                {
                    Console.WriteLine("{0} {1}",str[1],str[0]);
                }
                if (x < y)
                {
                    Console.WriteLine("{0} {1}", str[0], str[1]);
                }
                if (x == y)
                {
                    Console.WriteLine("{0} {1}", str[0], str[1]);
                }
            }
        }
    }
}

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

typedef long lint;
typedef long long llint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }


int main(void) {
    double r;
    cin >> r;

    cout << 2*3.1415926535*r << endl;
    return 0;
}


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

public class Main {
  private static boolean debug = false;
  private static boolean elapsed = false;

  private static PrintWriter _err = new PrintWriter(System.err);

  private void solve(Scanner sc, PrintWriter out) {
    String s = sc.nextLine();
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < s.length(); ++i) {
      char ch = s.charAt(i);
      switch (ch) {
      case '0':
      case '1':
        sb.append(ch);
        break;
      case 'B':
        if (sb.length() > 0) {
          sb.deleteCharAt(sb.length() - 1);
        }
        break;
      }
    }
    out.println(sb.toString());
  }
  private long C(long n, long r) {
    long res = 1;
    for (long i = n; i > n - r; --i) {
      res *= i;
    }
    for (long i = r; i > 1; --i) {
      res /= i;
    }
    return res;
  }
  private long P(long n, long r) {
    long res = 1;
    for (long i = n; i > n - r; --i) {
      res *= i;
    }
    return res;
  }
  private long ceil2pow(long n) {
    if (n == 0) {
      return 1;
    }
    n--;
    n |= (n >>> 1);
    n |= (n >>> 2);
    n |= (n >>> 4);
    n |= (n >>> 8);
    n |= (n >>> 16);
    n++;
    return n;
  }
  /*
   * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
   * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
   */
  public static void main(String[] args) {
    long S = System.currentTimeMillis();

    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new Main().solve(sc, out);
    out.flush();

    long G = System.currentTimeMillis();
    if (elapsed) {
      _err.println((G - S) + "ms");
    }
    _err.flush();
  }
}

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

int main() {
	double	L;
	cin >> L;
	L /= 3.0;
	cout << fixed << setprecision(12) << pow(L, 3.0) << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder01
{
    class Program
    {
        static void Main(string[] args)
        {
            var inp = Console.ReadLine();
            args = inp.Split(' ');
            var a = int.Parse(args[0]);
            var b = int.Parse(args[1]);
            if (a * b % 2 == 0)
            {
                Console.Write("Even");
            }
            else
            {
                Console.Write("Odd");
            }
        }
    }
}


Measured memory_bytes: 13140
from sys import stdin

n,m = map(int, stdin.readline().split())
A = []
for _ in range(n):
    inputlist = list(map(int, stdin.readline().split()))
    A.append(inputlist)
B = []
for _ in range(m):
    inputnum = int(stdin.readline())
    B.append(inputnum)

for row in range(n):
    num = 0
    for column in range(m):
        num += A[row][column] * B[column]
    print(num)
        


Measured memory_bytes: 6016
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
#define MPlus(x,y) {x=(x+y)%M;}
#define MSub(x,y) {x=(x-y+M)%M;}
#define MMul(x,y) {x=(x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n;
  cin>>n;
  vi a(n),b(n);
  rep(i,n){
    cin>>a[i];
  }
  rep(i,n){
    cin>>b[i];
  }

  rep(i,n){
    if(a[i]>b[i]){
      cout<<-1<<endl;
      return 0;
    }
  }

  priority_queue<P> q;
  rep(i,n){
    if(a[i]==b[i])continue;
    q.push(P(b[i],i));
  }

  int ans=0;
  while(q.size()){
    P p=q.top(); q.pop();
    int x=p.S;
    int s=(b[x]-a[x])/(b[(x+1)%n]+b[(x+n-1)%n]);
    if(s==0){
      cout<<-1<<endl;
      return 0;
    }
    ans+=s;
    b[x]-=s*(b[(x+1)%n]+b[(x+n-1)%n]);
    if(b[x]>a[x]) q.push(P(b[x],x));
  }

  cout<<ans<<endl;



}

Measured memory_bytes: 9456
-- {-# LANGUAGE BangPatterns #-}
-- {-# LANGUAGE ScopedTypeVariables #-}
-- {-# LANGUAGE FlexibleContexts #-}
-- {-# LANGUAGE ViewPatterns #-}
-- {-# LANGUAGE OverloadedStrings #-}

import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.Vector.Algorithms.Merge as VAM
import qualified Data.Heap as HP
import qualified Data.ByteString.Char8 as BC
import qualified Data.Map as MP
import qualified Data.Set as ST
import qualified Data.Sequence as SQ
import Data.Array
import Data.Array.Unboxed
import Data.Array.ST
import Data.Array.IO
import Data.Maybe
import Data.Ratio
import Data.Char
import Data.Bits
import Data.List
import Data.Tuple
import Data.Functor
import Data.IORef
import Data.STRef
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Debug.Trace

--------------------------------------------------------------------------
main = do
    k <- int
    print $ foldl' (\acc (x,y,z) -> acc + (gcd z $ gcd x y)) 0 [(x,y,z) | x <-[1..k], y <-[1..k], z<-[1..k]]

--------------------------------------------------------------------------
    
-- Input Util
int :: IO Int
int = readLn 

double :: IO Double
double = readLn 

str :: IO String
str = getLine

strBC :: IO BC.ByteString
strBC = BC.getLine

sLineToIntL :: IO [Int]
sLineToIntL = getLine >>= return . map read . words

sLineToDoubleL :: IO [Double]
sLineToDoubleL = getLine >>= return . map read . words

sLineToIntV :: Int -> IO (VU.Vector Int)
sLineToIntV n = BC.getLine >>= return . VU.unfoldrN n (BC.readInt . BC.dropWhile isSpace)

sLineToDoubleV :: Int -> IO (VU.Vector Double)
sLineToDoubleV n = BC.getLine >>= return . VU.fromList . map (read . BC.unpack) . BC.words

mLinesToIntL :: Int -> IO [Int]
mLinesToIntL n = replicateM n readLn

mLinesToDoubleL :: Int -> IO [Double]
mLinesToDoubleL n = replicateM n readLn

mLinesToIntV :: Int -> IO (VU.Vector Int)
mLinesToIntV n = VU.replicateM n readLn

mLinesToDoubleV :: Int -> IO (VU.Vector Double)
mLinesToDoubleV n = VU.replicateM n (BC.getLine >>= return . read . BC.unpack)

mLinesToTupleL :: Int -> IO [(Int, Int)]
mLinesToTupleL n = replicateM n (getLine >>= return . (\[a,b] -> (a,b)) . map read . words)

mLinesToTupleV :: Int -> IO (VU.Vector (Int, Int))
mLinesToTupleV n = VU.replicateM n $ do
    bs <- strBC
    let
        Just (a, bs') = BC.readInt $ BC.dropWhile isSpace bs
        Just (b, _) = BC.readInt $ BC.dropWhile isSpace bs'
    return (a,b)
    
mLinesToTripleV :: Int -> IO (VU.Vector (Int, Int, Int))
mLinesToTripleV n = VU.replicateM n $ do
    bs <- strBC
    let
        Just (a, bs') = BC.readInt $ BC.dropWhile isSpace bs
        Just (b, bs'') = BC.readInt $ BC.dropWhile isSpace bs'
        Just (c, _) = BC.readInt $ BC.dropWhile isSpace bs''
    return (a,b,c)

-- others
strToChr :: String -> Char
strToChr [x] = x

chrToStr :: Char -> String
chrToStr x = [x]

m1 :: Int -> Int
m1 x = subtract 1 x

toDouble :: Int -> Double
toDouble x = fromIntegral x

toInt :: Double -> Int
toInt x = floor x

Measured memory_bytes: 3936
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE BangPatterns #-}
import Data.Char
import Data.List
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS
import qualified Data.IntSet as IntSet
import qualified Data.IntMap.Strict as IntMap
import Control.Monad

insert' :: Int -> Int -> IntMap.IntMap IntSet.IntSet -> IntMap.IntMap IntSet.IntSet
insert' key val = IntMap.alter (\m -> case m of
                                        Nothing -> Just $ IntSet.singleton val
                                        Just set -> Just $ IntSet.insert val set
                               ) key

forM_IntSet :: Monad m => IntSet.IntSet -> (Int -> m ()) -> m ()
forM_IntSet set f = go set
  where
    go set = case IntSet.splitRoot set of
               [] -> return ()
               [x] -> forM_ (IntSet.toList x) f
               xs -> forM_ xs go

main = do
  [n,m] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  edges <- U.replicateM m $ do
    [x,y,z] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (x-1,y-1,z)
  let graph :: IntMap.IntMap IntSet.IntSet
      graph = U.foldl' (\m (u, v, _) -> insert' u v $ insert' v u m) IntMap.empty edges
  vec <- UM.replicate n (-1)
  let find !j
        | j >= n = return Nothing
        | otherwise = do v <- UM.read vec j
                         if v == -1
                           then return (Just j)
                           else find (j+1)
  let dfs !i !value = do
        k <- UM.read vec i
        if k == -1
          then do UM.write vec i value
                  case IntMap.lookup i graph of
                    Just set -> forM_ (IntSet.toList set) $ \j -> dfs j value
                    Nothing -> return ()
          else return ()
  let loop !i = do
        mj <- find i
        case mj of
          Nothing -> return i
          Just j -> do
            dfs j i
            loop (i+1)
  result <- loop 0
  print result


Measured memory_bytes: 41340
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
int main() {
    string a ;
    int t = 0 ;
    cin >> a ;
    if (a[0] == 'o') t+= 1 ;
    if (a[1] == 'o') t+= 1 ;
    if (a[2] == 'o') t+= 1 ;
    cout << 700 + t*100 ;
    return 0 ;
}


Measured memory_bytes: 3608
#include<stdio.h>
#include<bits/stdc++.h>
int main()
{
  int mat[3][3],i,j,n,k,f=0;
  for(i=0;i<3;i++)
  {
    for(j=0;j<3;j++)
    {
      scanf("%d",&mat[i][j]);
    }
  }
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  int mark[3][3];
  for(i=0;i<3;i++)
  {
    for(j=0;j<3;j++)
    {
      //scanf("%d",&a[i][j]);
      mark[i][j]=0;
    }
  }
  for(k=0;k<n;k++)
  {
    for(i=0;i<3;i++)
    {
      for(j=0;j<3;j++)
      {
        if(a[k]==mat[i][j])
        {
          mark[i][j]=1;
        }
      }
    }
  }
  int tempr=0,tempc=0;
for(i=0;i<3;i++)
{
  tempr=0;
  tempc=0;
  for(j=0;j<3;j++)
  {
    tempr+=mark[i][j];
    tempc+=mark[j][i];
  }
  if(tempr==3||tempc==3)
  {
    f=1;
    break;
  }
}
  if(mark[0][0]==1&&mark[1][1]==1&&mark[2][2]==1)
    f=1;
  if(mark[0][2]==1&&mark[1][1]==1&&mark[2][0]==1)
    f=1;
  if(f==1)
    printf("Yes");
  else
    printf("No");
}

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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SORT(v, n) sort(v, v+n);
#define SSORT(v, n) sort(v, v+n, greater<int>())

int main(){
	string s;
	int month;
	cin >> s;
	month = stoi(s.substr(5,2));
	if(month<5) cout << "Heisei" << endl;
	else cout << "TBD" << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
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);
    }
}
#pragma endregion
#pragma region chminmax
template <typename T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

void sol(int n, vector<int> &w)
{
    vector<vector<int>> dp(n, vector<int>(n + 1));

    rep(i, n - 1)
    {
        if (abs(w[i] - w[i + 1]) < 2)
        {
            dp[i][i + 2] = 2;
        }
    }

    for (int h = 2; h <= n; h++)
    {
        for (int l = 0; l <= n - h; l++)
        {
            int r = l + h;
            if (dp[l + 1][r - 1] == r - l - 2 && abs(w[l] - w[r - 1]) < 2)
            {
                chmax(dp[l][r], 2 + dp[l + 1][r - 1]);
            }
            for (int m = l; m < r; m++)
            {
                chmax(dp[l][r], dp[l][m] + dp[m][r]);
            }
        }
    }

    cout << dp[0][n] << endl;
}

int main()
{
    while (true)
    {
        int n;
        cin >> n;
        if (!n)
            break;
        vector<int> w(n);
        rep(i, n) cin >> w[i];
        sol(n, w);
    }

    return 0;
}


Measured memory_bytes: 3284
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    r = II()
    if r < 1200:
        print("ABC")
    elif r < 2800:
        print("ARC")
    else:
        print("AGC")
    return

#B
def B():
    return

#C
def C():
    d, g = LI()
    pc = LIR(d)
    ans = float("INF")
    tokumono = list(itertools.product((0, 1), repeat=d))
    #print(tokumono)
    for toku in tokumono:
        #print(toku)
        ansa = 0
        ansb = 0
        for i in range(len(toku)):
            if toku[i] == 1:
                ansa += pc[i][0]
                ansb += pc[i][0] * (i + 1) * 100 + pc[i][1]
        for k in range(len(toku) - 1, -1, -1):
            if toku[k] == 0:
                for i in range(pc[k][0] + 1):
                    #print(ans, ansb, ansa)
                    if i == pc[k][0]:
                        ansb += pc[k][1]
                    if ansb >= g:
                        ans = min(ans, ansa)
                        break
                    ansa += 1
                    ansb += (k+1) * 100
                break

        

    print(ans)
            

    return

#D
def D():
    N, X = LI()
    def dfs(n, x):
        #print(n, x)
        if x == 1 and n > 0:
            return 0 
        elif x < 2 ** (n + 1) - 1:
            return dfs(n - 1, x - 1)
        elif x == 2 ** (n + 1) - 1:
            return 2 ** n 
        elif x == 2 ** (n + 2) - 3:
            return 2 ** (n + 1) - 1
        else:
            return dfs(n - 1, x - 2 ** (n + 1) + 1) + 2 ** n 
    a = dfs(N, X)
    print(a)
        
    return


#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 38736
#include<bits/stdc++.h>
using namespace std;
int n[10000000];
int k[10000000];
int main(){
  int a,b;
  cin>>a>>b;
  if(a<10 && b<10){
    cout<<a*b<<"\n";
  }
  else cout<<"-1"<<"\n";
  return(0);
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define FAST_IO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 100000
#define endl "\n"
#define PI 3.14159265358979323846264338327950288
 
using namespace std ;
using bigint = long long int ;
using vi = vector<int> ;
using vll = vector<long long int> ;


int main(){
    FAST_IO ;
    int N , X , T ; cin >> N >> X >> T ;
    cout << ( N + X - 1 ) / X * T << endl ;
    return 0 ;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define int long long
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
const int mod = 1000000007;
const int lim = 1e18;
using namespace std;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int binpow(int a, int n) { if(n == 0) return 1; if(n == 1) return a; int x = binpow(a, n/2); if(n%2 == 0) return x*x; return x*x*a; }

main()
{
//	freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);
	string days[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
	string s;
	cin >> s;
	if(s == days[0]) cout << 7;
	if(s == days[1]) cout << 6;
	if(s == days[2]) cout << 5;
	if(s == days[3]) cout << 4;
	if(s == days[4]) cout << 3;
	if(s == days[5]) cout << 2;
	if(s == days[6]) cout << 1;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,m,a;
    cin>>n>>m;
    vector<ll> v(n+1,-1);
    v[0]=v[1]=1;
    for(ll i=0;i<m;i++){
        cin>>a;
        v[a]=0;
    }
    for(ll i=2;i<=n;i++){
        if(v[i]!=0) v[i]=(v[i-1]+v[i-2])%1000000007;
    }
    cout<<v[n]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#define rep(i,j,n) for(i=j;i<(n);i++)

using namespace std;

int main(){
    int i;
    string s,t;
    cin>>s;
    rep(i,0,s.size()){
        if(s[i]=='B'){
            if(t.size()!=0){
                t.erase(t.end()-1);
            }
        }
        else{
            t+=s[i];
        }
    }
    cout<<t<<endl;
}


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

//get the understading what the question is trying to ask
ll GCD(ll a,ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
int main() {
  ll N;
  cin >> N;
  ll a;
  cin >> a;
  ll ans = a;
  for (ll i = 0; i < N; i++){
    ll c;
    cin >> c;
    ans = GCD(ans, c);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    int N, A, B, C, D;
    string S;
    cin >> N >> A >> B >> C >> D >> S;
    A--, B--, C--, D--;
    bool ok = true;
    for(int i = A; i < C; i++){
        if(S[i] == S[i+1] && S[i] == '#') ok = false;
    }
    for(int i = B; i < D; i++){
        if(S[i] == S[i+1] && S[i] == '#') ok = false;
    }
    if(C > D){
        bool pass = false;
        for(int i = B-1; i < D; i++){
            if(S[i] == S[i+1] && S[i] == S[i+2] && S[i] == '.') pass = true;
        }
        if(pass == false) ok = false; 
    }
    
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

#define WHITE 0
#define BLACK 1
#define INF 100000

void prim(void);

int n, d[100], color[100], pi[100], w[100][100];

int main(int argc, char const *argv[]) {
  int i,j;

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

  prim();

  return 0;
}

void prim(){
  int i,j,v,u,mincost,r=0,sum=0;

  for(i=0;i<n;i++){
    d[i] = INF;
    pi[i] = -1;
    color[i] = WHITE;
  }

  d[r] = 0;

  while (1) {
    mincost = INF;
    for(i=0;i<n;i++){
      if(color[i] != BLACK && d[i] < mincost){
        mincost = d[i];
        u = i;
      }
    }

    if(mincost == INF) break;

    color[u] = BLACK;

    for(v=0;v<n;v++){
      if(color[v] != BLACK && w[u][v] < d[v] && w[u][v] > -1){
        pi[v] = u;
        d[v] = w[u][v];
      }
    }
  }
  for(i=0;i<n;i++) if(pi[i]!=-1) sum+=w[i][pi[i]];
  printf("%d\n",sum);
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double pi = acos(-1);
const double EPS = 1e-10;

double crosss(pair<double,double> c,pair<double,double> d){
  return c.first * d.second - d.first * c.second;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<pair<double,double>> a(4);
  int n;
  pair<double,double> lineab, linecd;
  cin >> n;
  REP(i,n){
    REP(j,4){
      cin >> a[j].first >> a[j].second;
    }
    lineab.first = a[1].first - a[0].first;
    linecd.first = a[3].first - a[2].first;
    lineab.second = a[1].second - a[0].second;
    linecd.second = a[3].second - a[2].second;
    if (fabs(crosss(lineab,linecd)) < EPS) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  
  
  return 0;
}


Measured memory_bytes: 3184
#include"bits/stdc++.h"
using namespace std;

const vector<int> dx = { 1,0,-1,0,1,-1,-1,1 };
const vector<int> dy = { 0,1,0,-1,1,1,-1,-1 };

int main() {
	int H, W; cin >> H >> W;
	vector<string> field(H);
	for (int i = 0; i < H; i++)
	{
		cin >> field.at(i);
	}

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			if (field.at(i).at(j) == '#')continue;

			char cnt = '0';
			for (int k = 0; k < 8; k++)
			{
			int nx = j + dx.at(k);
			int ny = i + dy.at(k);

			if (nx < 0 || W <= nx || ny < 0 || H <= ny) continue;
			if (field.at(ny).at(nx) == '#') cnt = 1 + cnt;
			}
			field.at(i).at(j) = cnt;
		}
	}
	for (int i = 0; i < H; i++)
	{
		cout << field.at(i) << endl;
	}
}

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

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

  long long ans=0LL; int bc=0;
  for(int i=s.size()-2; i>=0; --i){
    if(s[i]=='A'&&s[i+1]!='C')ans+=bc;
    else if(s[i]=='C'&&s[i+1]=='A')continue;
    else if(s[i]=='C'&&s[i+1]=='B')continue;
    else if(s[i]=='B'&&s[i+1]=='C')++bc;
    else bc=0;
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 640
#include<stdio.h>


int main(){
	int loop,max=-1,al,total=0;
	int angka[15];
	scanf("%d",  &loop);
	
	for(int i=0; i<loop; i++){
		scanf("%d", &angka[i]);
		if(max==-1){
			max=angka[i];
			al=i;
		}
		
		if(max<angka[i]){
			max=angka[i];
			al=i;
		}
	}
	
	for(int i=0; i<loop; i++){
		if(i!=al){
			total+=angka[i];
		}
	}
	printf("%s\n", max<total?"Yes":"No");
	
	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
# B

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

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

ans = sum(b)
prev = -10
for i in range(n):
    if i > 0:
        if a[i] == a[i-1]+1:
            ans += c[a[i-1]-1]
    prev = a[i]

print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

int main(){
    int N, X, T;
    cin >> N >> X >> T;
    int ans = ceil((double)N/X) * T;
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <cstdio>
#include <chrono>
#include <random>
using namespace std;

#define DRACARYS ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define PI 3.14159265
const long long int MAXN = 2e5+10;
const long long int MINN = 1e5+10;
const long long int inf = 1e18+7;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi; 
typedef stack<int> st;

bool ch(int ind, int n, int q, string s, char qr[][2]){
    char curr=s[ind];
    for(int i=0;i<q;++i){
        if(qr[i][0]==curr){
            if(qr[i][1]=='L'){
                --ind;
                if(ind<0) return 1;
                else curr=s[ind];
            }
            else{
                ++ind;
                if(ind>=n) return 1;
                else curr=s[ind];
            }
        }
    }
    return 0;
} 
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    DRACARYS
    int n,q,a1=0,a2=0;
    string s;
    cin>>n>>q>>s;
    char qr[q][2];
    for(int i=0;i<q;++i) cin>>qr[i][0]>>qr[i][1];
    int l=0,h=n-1;
    while(l<=h){
        int mid=l+(h-l)/2;
        if(ch(mid,n,q,s,qr)) l=mid+1;
        else h=mid-1;
    }
    a1=l;
    l=0,h=n-1;
    while(l<=h){
        int mid=l+(h-l)/2;
        //cout<<l<<" "<<h<<" "<<mid<<endl;
        if(ch(mid,n,q,s,qr)) h=mid-1;
        else l=mid+1;
    }
    a2=h;
    //cout<<a1<<" "<<a2<<endl;
    cout<<max(a2-a1+1,0)<<endl;
    return 0;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
using namespace std;
long n,f[100005],kq=0,a[100005];
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n;
    for (long i=1;i<=n;i++) cin>>a[i];
    f[1]=0;
    f[2]=abs(a[1]-a[2]);
    for (long i=3;i<=n;i++)
    {
        f[i]=min(f[i-1]+abs(a[i]-a[i-1]),f[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<f[n];
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	cin>>a;
	vector<int> v;
	v.push_back(1); 
	for(int i=2;i<=sqrt(a);i++)
	for(int j=2;;j++)
	{
		int b=1;
		for(int k=1;k<j;k++)
		b*=i;
		if(b>a)
		break;
		else
		v.push_back(b); 
	}
	sort(v.begin(),v.end());
	cout<<v[v.size()-1];
	return 0;
}

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>

auto& in = std::cin;
auto& out = std::cout;

int32_t N;
bool latte[1000];
int32_t RGM = 0;
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> N;
	for (int32_t i = 0; i < N; ++i)
	{
		int32_t a;
		in >> a;
		for (int32_t i = 1; i <= 8; ++i)
		{
			if (a < 400*i) {
				latte[i-1] = true;
				break;
			}
		}
		if (a >= 3200) {
			++RGM;
		}
	}
	int32_t count = 0;
	for (auto& i : latte) {
		if (i) { ++count; }
	}
	if (count == 0) {
		out << 1<<' '<<RGM << endl; return 0;
	}

	out << count << ' ' << count+RGM << endl; return 0;

	return 0;
}
#endif


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << ", ";
#define endln cerr << "\n";
#define chkpt cerr << "-----\n";

const int maxn = 1e2 + 5;
int n, w;
int a[maxn];
int b[maxn];
long long dp[maxn][maxn * 3];

void solve() {
	cin >> n >> w;
	FOR(i, 0, n) cin >> a[i] >> b[i];
	FOR(l, 0, n) {
		FORd(i, n + 1, 0) FOR(j, 0, 3 * n + 1) {
			chkmax(dp[i + 1][j + a[l] - a[0]], dp[i][j] + b[l]);
		}
	}
	long long ans = 0;
	FOR(l, 1, n + 1) {
		if (w < (long long) a[0] * l) continue;
		FOR(j, 0, min(w - a[0] * l + 1, maxn * 3)) {
			chkmax(ans, dp[l][j]);
		}
	}
	cout << ans << "\n";
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        freopen("in.txt", "r", stdin);
        JUDGE_ONLINE = 0;
    }
    ios_base::sync_with_stdio(0); cin.tie(0);
    solve();
    if (!JUDGE_ONLINE) {
    	//freopen("out.txt", "w", stdout);
    	//cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}

Measured memory_bytes: 512
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
//typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n-1); i >= 0; i--)
#define pb push_back
#define f first
#define s second
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
const ll MOD = 1e9 + 7;
//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll x, ll y){return x / gcd(x, y) * y;};



int main(void){
  ll S;
  cin >> S;
  cout << 0 << " " << 0 << " ";
  ll x1, y1, x2, y2;
  if(S == 1000000000000000000){
    cout << 1000000000 << " " << 0 << " " << 0 << " " << 1000000000 << endl;
    return 0;
  }

  cout << 1000000000 << " " << 1 << " " << 1000000000 - (S % 1000000000) << " " << S / 1000000000 + 1 << endl;

}


Measured memory_bytes: 256
#include<cstdio>

int s[500][500];

int main() {
	int n;
	scanf("%d", &n);
	int k = 1;
	while(k*(k-1) < 2*n) k++;
	if(k*(k-1) == 2*n) {
		int ind = 1;
		for(int i=0;i<k;i++) {
			s[i][i] = ind;
			for(int j=1;i+j<k-1;j++) s[i][i+j] = ind + j;
			for(int j=0;i+j+1<k;j++) s[i+j+1][i] = ind + j;
			ind += k-i-1;
		}
		printf("Yes\n");
		printf("%d\n", k);
		for(int i=0;i<k;i++) {
			printf("%d ", k-1);
			for(int j=0;j<k-1;j++) printf("%d%c", s[i][j], j==k-2 ? '\n' : ' ');
		}
	} else {
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
#define   ll   long long int
#define   sz   200010

using namespace std;


ll num[sz];

int main()
{

    ll i,j,c=0,d,k,a,b,n;

    ll mn;

    cin>>n;
    cin>>num[1];
    c=1;
    mn=num[1];


    for(i=2;i<=n;i++)
    {
        cin>>num[i];
        if(num[i]<mn)c++;

        mn=min(mn,num[i]);
    }

    cout<<c<<endl;



    return 0;
}


Measured memory_bytes: 1792