akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { cout << p.first << ' ' << p.second; return os; }

vi32 edges[200000];

void solve() {
  int n; cin >> n;
  vector<bool> seen(200000, true);
  rep(i, n) {
    int x, y; cin >> x >> y;
    x--, y--;
    y += 100000;
    edges[x].push_back(y);
    edges[y].push_back(x);
    seen[x] = seen[y] = false;
  }
  i64 cnt_x, cnt_y;
  function<void(int)> dfs = [&](int v) {
    seen[v] = true;
    if (v < 100000) cnt_x++; else cnt_y++;
    each(u, edges[v]) {
      if (seen[u]) continue;
      dfs(u);
    }
  };
  i64 ans = 0;
  rep(i, 200000) {
    if (seen[i]) continue;
    cnt_x = 0, cnt_y = 0;
    dfs(i);
    ans += cnt_x * cnt_y;
  }
  cout << ans - n << '\n';
}


Measured memory_bytes: 11008
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const ll LL_INF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

string s;
int N;
int ans = 0;
void dfs(int i, bool mode, int res){
  if(i == N){
    ans = max(res, ans);
    return;
  }
  
  if(mode){
    dfs(i + 1, mode, res + 9);
  }else{
    if(s[i] > '0'){
      dfs(i + 1, true, res + s[i] - '0' - 1);
    }
    dfs(i + 1, false, res + s[i] - '0');
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  N = s.size();
  dfs(0, false, 0);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

struct data {
  string name;
  int point;
  int index;
  data(string S, int P, int i) : name(S), point(P), index(i) {}
};
bool comp(data d1, data d2) {
  if(d1.name == d2.name)
    return d1.point > d2.point;
  else
    return d1.name < d2.name;
}

int main() {
  int N;
  cin >> N;
  vector<data> D;
  for(int i=0; i<N; i++) {
    string S; int P;
    cin >> S >> P;
    D.push_back(data(S, P, i+1));
  }
  sort(D.begin(), D.end(), comp);
  for(int i=0; i<N; i++)
    cout << D[i].index << endl;
  return 0;
}


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

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

    vector<int> v;
    for(int i = 0; i < N; i++) {
        int z;
        cin >> z;
        z--;
        v.push_back(z);
    }

    int now = 0, c = 0;
    for(;;) {
        if(now == 1) {
            cout << c << endl;
            break;
        }
        if(c >= N) {
            cout << -1 << endl;
            break; 
        }
        c++;
        now = v[now];
    }
}

Measured memory_bytes: 3932
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    long long nowH=0;
    long long rightH;
    int kai=0;
    int maxK=0;
    for(int i=0; i<N; i++){
        cin >> rightH;
        if(rightH<=nowH){
            kai++;
        }else{
            maxK = max(maxK,kai);
            kai=0;
        }
        nowH=rightH;
    }
    maxK = max(maxK,kai);
    cout << maxK;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>
#include <cmath>

using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<long long, long long>;

const int MAXN = 1e5 + 20;

ll mod = 1e9 + 7;


ll bin_pow(ll base, ll power, ll mod){

    if (power == 0)
        return 1;

    if (power % 2 == 1){
        return (base * bin_pow(base, power - 1, mod)) % mod;
    }

    auto val = bin_pow(base, power >> 1, mod);

    return (val * val) % mod;
}

ll get_back(ll elem, ll mod){
    return bin_pow(elem, mod - 2, mod);
}

ll nCr[MAXN];


ll k;
ll n;

void prec() {

    k -= 1;

    for (int i = 0; i < k; ++i) {
        nCr[i] = 0;
    }
    nCr[k] = 1;

    for (ll i = k + 1; i <= n; ++i) {
        nCr[i] = nCr[i - 1] * i;
        nCr[i] %= mod;

        ll back = get_back(i - k, mod);
        nCr[i] *= back;
        nCr[i] %= mod;
    }
}

void solve() {
    cin >> n >> k;
    vector<ll> vals;

    prec();


    for (int i = 0; i < n; ++ i){
        ll curr;
        cin >>curr;
        vals.push_back(curr);
    }

    ll up = 0;
    ll down = 0;
    sort(vals.begin(), vals.end());


    for (int i = 1; i <= n; ++ i){

        auto el = vals[i - 1];

        ll crr = el * nCr[n - i];
        crr %= mod;

        down += crr;
        down %= mod;

        crr = el * nCr[i - 1];
        crr %= mod;

        up += crr;
        up %= mod;

    }

    ll answr = (up - down + mod) % mod;


    cout << answr << "\n";
}


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

    cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(5);
    solve();
}

Measured memory_bytes: 2168
package main

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

func parse() int {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Split(bufio.ScanLines)

	stdin.Scan()
	n, _ := strconv.Atoi(stdin.Text())
	return n
}

func main() {
	n := parse()

	if n%2 == 0 {
		fmt.Println((n / 2) * (n / 2))
	} else {
		fmt.Println((n / 2) * (n/2 + 1))
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

int main(){
    int H,W;
    cin >> H >> W;
    string S[H+1];
    for(int i = 0; i < H; i++){
        cin >> S[i];
        S[i][W] = '#';
        S[i][W+1] = '#';
    }
    for(int i = 0; i < W; i++)
        S[H][i] = '#';
    int hight[H][W];
    int width[H][W];
    for(int i = 0; i < H; i++)
        for(int j = 0; j < W; j++){
            hight[i][j] = 0;
            width[i][j] = 0;
        }
    
    for(int yoko = 0; yoko < W; yoko++){
        int tmp = 0;
        for(int tate = 0; tate < H; ){
            int i = tate, tmp = 0;
            while(S[i][yoko] == '.' && i < H){
                i++;
                tmp++;
            }
            for(int j = i-1; j >= tate; j--)
                hight[j][yoko] = tmp;
            while(S[i][yoko] == '#' && i < H)
                i++;
            tate = i;
        }
    }
    
    for(int tate = 0; tate < H; tate++){
        int tmp = 0;
        for(int yoko = 0; yoko < W; ){
            int i = yoko, tmp = 0;
            while(S[tate][i] == '.' && i < W){
                i++;
                tmp++;
            }
            for(int j = i-1; j >= yoko; j--)
                width[tate][j] = tmp;
            while(S[tate][i] == '#' && i < W)
                i++;
            yoko = i;
        }
    }
    
    int tmp[H][W];
    int ans = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            tmp[i][j] = hight[i][j] + width[i][j] - 1;
            ans = max(tmp[i][j], ans);
        }
    }
    
    cout << ans << "\n";
    return 0;
} 


Measured memory_bytes: 51200
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define ff first
#define ss second
#define p pair<int,int>
#define pb push_back
#define endl '\n'
#define w(t) ll test;cin>>test;while(test--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define pi acos(-1)
const int mxn=1e9+5;
int main()
{
    fast;
    ll n;
    cin>>n;
    ll r=0;
    string s;
    cin>>s;
    for(auto i:s)
    {
        if(i=='R')r++;
    }
    ll ww=0,wr=0;
    for(ll i=0;i<s.size();i++)
    {
        if(i<r&&s[i]=='W')ww++;
        if(i>=r&&s[i]=='R')wr++;
    }
    ll mn=min(ww,wr);
    ll ans=ww-mn+wr-mn+mn;
    cout<<ans<<endl;
}



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

int main(void) {
    int S, h, m, s;
    cin >> S;
    s = S % 60;
    m = (S - s) / 60 % 60;
    h = S / 3600;
    
    cout << h << ":" << m << ":" << s << endl;
    
    return 0;
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
using namespace std;
int m,n;
double t[16][16];
double dp[16][(1<<16)];
double P[16][(1<<16)];

double rec(int x,int S){

  double res=0;
  for(int i=0;i<m;i++){
    if(S>>i&1)continue;
    double p=1.0,k=0;
    for(int j=x;j<n;j++){      
      k+=rec(j,S|(1<<i))*p*(1.0-t[i][j]);
      p*=t[i][j];
    }
    res=max(res,k+p);
  }
  return res;
}

int main(){
  cin>>m>>n;
  for(int i=0;i<m;i++){
    for(int j=0;j<n;j++){
      cin>>t[i][j];
    }
  }
  
  double p,k;  
  for(int S=(1<<m)-1;S>=0;S--){
    for(int x=n-1;x>=0;x--){
      
      p=1.0,k=0.0;
      for(int i=0;i<m;i++){
        if(S>>i&1)continue;
        p=1.0,k=0.0;
        for(int j=x;j<n;j++){      
          k+=dp[j][S|(1<<i)]*p*(1.0-t[i][j]);
          p*=t[i][j];
        }
        dp[x][S]=max(dp[x][S],k+p);
      }
      
    }
  }
  printf("%.12f\n",dp[0][0]);  
  return 0;
}

Measured memory_bytes: 9448
n = int(input())
input=[list(map(int, input().split())) for i in range(n)]
input = sorted(input, key=lambda x: x[1])
start = 0
count = 0
for i in range(len(input)):
    start += input[i][0]
    if input[i][1] >= start:
        count += 1
if count == len(input):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 55264
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
    string s; cin >> s;
    bool ans=true;
    rep(i,3){
        if(s[i] == s[i+1]){
            ans = false;
        }
    }
    if(ans){
        cout << "Good";
    }else{
        cout << "Bad";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <algorithm>
using namespace std;
 
 
 
int main()
{
    int k; cin >> k;
 
    int d[k];
    int m[k];
    for ( int i =0; i<k; i++) {cin>>d[i]; }
    for(int i=0; i<k; i++) {m[i]=-1; }
    //if(k>1){
    m[k-1]=0;
    m[k-2] = abs(d[k-2]-d[k-1]);
    for(int i=k-2; i>=0; i--)
    {
        m[i] = min(abs(d[i]-d[i+1])+m[i+1],abs(d[i]-d[i+2])+m[i+2]);
    }
 
 
    cout << m[0]<< endl;
 
 
 
    return 0;
}

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

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

  string S;
  cin >> S;

  if (S.length() <= K) {
    cout << S << endl;
  } else {
    for (int i = 0; i < K; i++) {
      cout << S[i];
    }
    cout << "..." << endl;
  }
}

Measured memory_bytes: 3624
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;

int n, m, a, b, in[1001] = {}, visited[1001], G[1001][1001];
vector<int> g[1001];
vector<int> v, ans;
queue<int> q;

int dfs(int x) {
  int res = 0;

  visited[x] = 1;
  v.push_back(x);
  for (int i = 0; i < g[x].size(); i++) {
    if (visited[g[x][i]] == 1) {
      for (int j = 0; j < v.size(); j++) {
        if (v[j] == g[x][i] || ans.size()) {
          ans.push_back(v[j]);
        }
      }
      int cnt = 0;
      for (int j = 0; j < ans.size(); j++) {
        for (int k = 0; k < ans.size(); k++) {
          cnt += G[ans[j]][ans[k]];
        }
      }
      if (cnt == ans.size()) {
        return 1;
      }
      ans.clear();
    }
    if (visited[g[x][i]] == 0) {
      res = dfs(g[x][i]);
    }
    if (res == 1) {
      return res;
    }
  }
  visited[x] = 2;
  v.pop_back();
  return 0;
}

int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    in[b]++;
    G[a][b] = 1;
  }
  for (int i = 1; i <= n; i++) {
    if (in[i] == 0) {
      q.push(i);
    }
  }
  while (!q.empty()) {
    int x = q.front();
    v.push_back(x);
    q.pop();
    for (int i = 0; i < g[x].size(); i++) {
      in[g[x][i]]--;
      if (in[g[x][i]] == 0) {
        q.push(g[x][i]);
      }
    }
  }
  if (v.size() == n) {
    printf("-1\n");
  } else {
    v.clear();
    for (int i = 1; i <= n; i++) {
      if (in[i] && visited[i] == 0 && dfs(i)) {
        printf("%ld\n", ans.size());
        for (int i = 0; i < ans.size(); i++) {
          printf("%d\n", ans[ans.size() - 1 - i]);
        }
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3712
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static BufferedReader br;
    static PrintWriter out;
    static StringTokenizer st;

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));

        long n = nextLong();
        long k = nextLong();
        long mod = Math.min(n % k, Math.abs(n - k));

        while (mod < n) {
            n = mod;
            mod = Math.min(n % k, Math.abs(n - k));
        }
        out.println(n);
        out.close();
    }


    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }

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

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

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

    static char nextCharacter() throws IOException {
        return next().charAt(0);
    }

    static String nextLine() throws IOException {
        return br.readLine().trim();
    }
}


Measured memory_bytes: 23124
#include<iostream>
using namespace std;
int main(){
	int x = 0;
	int y = 0;
	int z = 0;
	while (1){
		cin >> x;
		cin >> y;
		if (x == 0 && y == 0){ break; }
		if (x > y){
			z = x;
			x = y;
			y = z;
			}
		cout << x << " " << y << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,i=0;
	while(true){
	cin >> n;
	if(n == 0 )break;
	i++;
	cout << "Case" << " " << i << ":" << " " << n << endl;
	}
	return 0;
}
	


Measured memory_bytes: 3100
#include <bits/stdc++.h> 
#define MAX 50 
using namespace std; 
  
// Function to print Excel column name for a given column number 
void printString(long long n) 
{ 
    char str[MAX]; // To store result (Excel column name) 
    long long i = 0; // To store current index in str which is result 
  
    while (n > 0) { 
        // Find remainder 
        int rem = n % 26; 
  
        // If remainder is 0, then a 'Z' must be there in output 
        if (rem == 0) { 
            str[i++] = 'z'; 
            n = (n / 26) - 1; 
        } 
        else // If remainder is non-zero 
        { 
            str[i++] = (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    } 
    str[i] = '\0'; 
  
    // Reverse the string and print result 
    reverse(str, str + strlen(str)); 
    cout << str << endl; 
  
    return; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long n;
    cin>>n;
    printString(n);
}

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

int main(void)
{
  int n, x, i, j, k, count;
  while(1) {
    count = 0;
    cin >> n >> x;
    if (n == 0 && x == 0) break;
    for (i = 1; i <= n; i++){
      for (j = i + 1; j <= n; j++){
        for (k = j + 1 ; k <= n; k++){
          if (i + j + k == x) count++;
        }
      }
    }
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
fn main() {
    proconio::input! {
    b:[isize;9],
    }
    if (b[0]-b[1]==b[3]-b[4]&&b[3]-b[4]==b[6]-b[7]) && (b[1]-b[2]==b[4]-b[5]&&b[4]-b[5]==b[7]-b[8]){
        println!("Yes")
    }
    else {
        println!("No")
    }
}

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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
typedef struct aaaaa{
  int x,y,t;
}Grid;
using namespace std;
ll toint(string s){
  ll kake=1;
  ll ret=0;
  for(int i=s.size()-1;i>=0;i--){
    ret+=kake*(s[i]-'0');
    kake*=10;
  }
  return ret;
}
int main(){
  int n;cin>>n;
  string str;cin>>str;
  for(int i=0;i<n;i++){
    string s;cin>>s;
    if(s==str){
      cout<<"+"<<endl;
      continue;
    }
      bool flag=true;
      int win=-1;
      for(int i=0;i<min(str.size(),s.size());i++){
	if(!flag)continue;
	if(isdigit(str[i])&&isdigit(s[i])){
	  string str2="";
	  int po=i;
	  while(isdigit(str[po]))
	    str2+=str[po++];
	  string s2="";
	  int po2=i;
	  while(isdigit(s[po2]))
	    s2+=s[po2++];
	  if(toint(str2)>toint(s2)){
	    cout<<"-"<<endl;
	    //cout<<toint(str2)<<" "<<toint(s2)<<endl;
	    flag=false;
	  }else if(toint(str2)<toint(s2)){
	    cout<<"+"<<endl;
	    flag=false;
	  }
	}else if(isdigit(str[i])){
	  cout<<"+"<<endl;
	  flag=false;
	}else if(isdigit(s[i])){
	  cout<<"-"<<endl;
	  flag=false;
	}else{
	  if(str[i]>s[i]){
	    cout<<"-"<<endl;
	    flag=false;
	  }else if(str[i] < s[i]){
	    cout<<"+"<<endl;
	    flag=false;
	  }
	}
      }
      if(flag){
	if(str.size()>s.size())
	  cout<<"-"<<endl;
	else
	  cout<<"+"<<endl;
      }
    
  }
  return 0;
}



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

#define M1 1000000007
#define M2 1000000009
#define ll long long 
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
#define PI 3.1415926535897932384626
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define f0(i, n) for (int i = 0; i < (int)(n); ++i)
#define f1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fc0(i,l,r) for(int i = (int)(l); i<(int)(r); ++i)
#define fc1(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define fr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 
 
void init()
{
  #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
      freopen("error.txt", "w", stderr);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
}

signed main()
{
    init();

    int n;
    cin>>n;
    if(n>=400 && n<=599)
      cout<<8<<endl;
    else if(n>=600 && n<=799)
      cout<<7<<endl;
    else if(n>=800 && n<=999)
      cout<<6<<endl;
    else if(n>=1000 && n<=1199)
      cout<<5<<endl;
    else if(n>=1200 && n<=1399)
      cout<<4<<endl;
    else if(n>=1400 && n<=1599)
      cout<<3<<endl;
    else if(n>=1600 && n<=1799)
      cout<<2<<endl;
    else 
      cout<<1<<endl;

    cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}

Measured memory_bytes: 3792
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    s, t = input().split()
    a, b = map(int, input().split())
    u = input()
    if u == s:
        a -= 1
    else:
        b -= 1
    print(a,b)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
string s="CODEFESTIVAL2016";
string cxk;
long long a;
int main(){
    cin>>cxk;
    if(cxk[0] != 'C') a++;
    if(cxk[1] != 'O') a++;
    if(cxk[2] != 'D') a++;
    if(cxk[3] != 'E') a++;
    if(cxk[4] != 'F') a++;
    if(cxk[5] != 'E') a++;
    if(cxk[6] != 'S') a++;
    if(cxk[7] != 'T') a++;
    if(cxk[8] != 'I') a++;
    if(cxk[9] != 'V') a++;
    if(cxk[10] != 'A') a++;
    if(cxk[11] != 'L') a++;
    if(cxk[12] != '2') a++;
    if(cxk[13] != '0') a++;
    if(cxk[14] != '1') a++;
    if(cxk[15] != '6') a++;
    cout<<a<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int field[6][6] = {0},a,x = 1,y = 0,t = 2;
  for(int i=0; i<5; i++){
    for(int j=0; j<4; j++){
      scanf("%1d",&a);
      field[j+1][i]+=(a<<2);
      field[j+1][i+1]+=(a<<0);
    }
    if(i<4){
      for(int j=0; j<5; j++){
	scanf("%1d",&a);
	field[j][i+1]+=(a<<1);
	field[j+1][i+1]+=(a<<3);
      }
    }
  }
  for(;;){
    if(t == 1){
      if(field[x][y]&2){
	cout <<"U";
	if(field[x][y]&1){t = 8;}
	else{y--;}
      }
      else{x++;t = 2;}
    }
    else if(t == 2){
      if(field[x][y]&4){
	cout <<"R";
	if(field[x][y]&2){t = 1;}
	else{x++;}
      }
      else{y++;t = 4;}
    }
    else if(t == 4){
      if(field[x][y]&8){
	cout <<"D";
	if(field[x][y]&4){t = 2;}
	else{y++;}
      }
      else{x--;t = 8;}
    }
    else if(t == 8){
      if(field[x][y]&1){
	cout <<"L";
	if(field[x][y]&8){t = 4;}
	else{x--;}
      }
      else{y--;t = 1;}
    }
    if(!x && !y){break;}
  }
  cout <<endl;
  return 0;
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
#define L long long
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define pii pair<pi,int>
#define aa first
#define bb second
#define xx aa.aa
#define yy aa.bb
#define zz bb
#define mp make_pair
#define mpp(a,b,c) mp(mp(a,b),c)
using namespace std;
int n;
vi a[100010];
inline int dp(int i,int j)
{
	int p=0;
	for(auto k:a[i])
	  if(k!=j)
	    p^=dp(k,i)+1;
	return p;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j,k;
	scanf("%d",&n);
	for(i=1;i<n;i++)
	  {
	   scanf("%d%d",&j,&k);
	   a[j].pb(k);
	   a[k].pb(j);
	  }
	if(dp(1,0))
	  printf("Alice");
	else
	  printf("Bob");
	return 0;
}


Measured memory_bytes: 8448
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
	int a, b, c,d;
	scanf("%d",&a);

	b = (a / 10)%10;
	c = a / 100;
	a = a % 10;
	if (a == 9)a = a - 8;
	else
	if (a == 1)a = a + 8;
	
	if (b == 9)b = b - 8;
	else
	if (b == 1)b = b + 8;
	
	if (c == 9) c = c - 8;
	else
    if (c == 1) c = c + 8;

	d = 100 * c + 10 * b + a;

	printf("%d", d);
	
}

Measured memory_bytes: 128
KN = list(map(int,input().split()))
A = list(map(int,input().split()))
maxi = A[0] - A[KN[1]-1] + KN[0]
result = 0

for i in range(KN[1]-1):
    if maxi < A[i+1]-A[i]:
        maxi = A[i+1]-A[i]

print(KN[0]-maxi)

Measured memory_bytes: 25920
#include<bits/stdc++.h>
#define ll int
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define vi vector < ll  int >
#define CLR(a) memset((a),0,sizeof(a))
#define mp make_pair
#define hell 1000000007
using namespace std;

#define MAXN 1000005
int spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)
        spf[i] = i;
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
            for (int j=i*i; j<MAXN; j+=i)

                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}


vector<int> gf(int x)
{
    vector<int> ret;
    while (x != 1)
    {
        ret.push_back(spf[x]);
        x = x / spf[x];
    }
    return ret;
}
int BIT[100050]; //fenwick
void upd(int x) { ++x;  while(x<=MAXN)  {  BIT[x]++;  x+=(x&-x);  } }
int cal(int x) {  ++x;  int res=0;  while(x>0)  {  res+=BIT[x];  x-=(x&-x);  } return res; }
ll Com[1051][1051];
void pre()
{

    ll i,j,n=1051;
    rep(i,0,n) Com[i][0]=Com[i][i]=1;
    rep(i,2,n)
    {
        rep(j,1,i)
        {
            Com[i][j]=Com[i-1][j]+Com[i-1][j-1];
            Com[i][j]%=hell;
        }
    }

}
ll mod=hell;
ll pr( ll x , ll y)
{
    ll ans=1;
    if(y==0) return ans;
    while(y>1)
    {
        if(y&1) ans*=x;
        x*=x;
        y/=2;
        x%=mod;
        ans%=mod;
    }
    ans*=x;
    ans%=mod;
    return ans;
}
ll inv(ll n)
{
    return pr(n,mod-2);
}
pair< pair<int, int>, int> query[500500];
int BLOCK_SIZE;
inline bool sbs(const pair< pair<int, int>, int> &x,
        const pair< pair<int, int>, int> &y)
{
    int block_x = x.first.first / BLOCK_SIZE;
    int block_y = y.first.first / BLOCK_SIZE;
    if(block_x != block_y)
        return block_x < block_y;
    return x.first.second < y.first.second;
}
void solve()
{
ll i,j=0,r=200,p,q,k=0,d,y=0,n,h=10,flag=0,m=0,a=hell,b=hell,id,h1,h2,a1,b1,a2,w,x,u,f,l,c=0,e,ans=0;
 cin>>n>>k;
 rep(i,0,k) {cin>>d; y+=d;}
 cout<<max(-1,n-y);
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    while(t--)
    solve();
}


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

int main(){
  int H,W,x,y;
  int count;
  cin >> H >> W;
  vector<string> s(H);
  for(int i=0;i<H;i++){
    cin >> s.at(i);
  }
  
  for(int j=0;j<W;j++){
      for(int i=0;i<H;i++){
          if(s.at(i).at(j)=='.'){
              count=0;
              for(int x:{-1,0,1}){
                  for(int y:{-1,0,1}){
                      if((W-1 > j+x > -1) || (H-1 > i+y > -1)){
                          try{
                              if(s.at(i+y).at(j+x)=='#'){
                                  count++;
                              }
                          }catch(...){
                          }
                      }
                  }
              }
              s.at(i).at(j)='0' + count;
          }
      }
  }
  for(int i=0;i<H;i++){
      cout << s.at(i) << endl;
  }
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	vector<int> a(5);
	rep(i, 5) cin >> a[i];
	int k;
	cin >> k;
	int res = 0;
	reverse(a.begin(), a.end());
	for (int i = 0; i < 4; i++) {
		for (int j = i + 1; j < 5; j++) {
			if (a[i] - a[j] <= k) res++;
			else break;
		}
	}
	if (res == 10) cout << "Yay!" << endl;
	else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO ios::sync_with_stdio(NULL); cin.tie(NULL);

using namespace std;

int a,b,c,k,sum = 0;

int main()
{
    cin>>a>>b>>c>>k;
    
    while (a > 0 && k > 0)
    {
        sum += 1;
        --a;
        --k;
    }
    
    while (b > 0 && k > 0)
    {
        --b;
        --k;
    }
    
    while (c > 0 && k > 0)
    {
        --sum;
        --c;
        --k;
    }
    
    cout<<sum;
}

Measured memory_bytes: 3592
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def modinv(a,m):
	b=m
	u=1
	v=0
	
	while b > 0:
		t = a //b
		a = a - (t * b)
		a,b = b,a
		u = u - (t * v)
		u,v=v,u
	
	u = u % m
	if u < 0:
		u+=m
	return u

def cob(n,a):
	rr=1
	for i in range(n, n-a, -1):
		rr = (rr *i ) % mod
	
	r=1
	for i in range(1, a+1):
		r = (r *i ) % mod
	
	#ww=pow(r,-1,mod)
	ww=modinv(r, mod)
	ret = rr * ww
	return ret
	
	

def main():
	n, a , b = IN()
	
	mm=(pow(2,n,mod)-1)%mod
	ret=(mm-cob(n,a)-cob(n,b))%mod
	
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)



Measured memory_bytes: 38908
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long i64;
typedef pair<i64,i64> P;


int n, d, x[22][22];

int main(){
	cin >> n >> d;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < d; j++){
			cin >> x[i][j];
		}
	}
	
	int ans = 0;
	for(int i = 0; i < n-1; i++){
		for(int j = i+1; j < n; j++){
			int cnt = 0;
			for(int k = 0; k < d; k++){
				cnt += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
			}
			int b = 0;
			for(int k = 0; k * k <= cnt; k++){
				if(k*k == cnt) b = 1;
			}
			ans += b;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
def insertion_sort(target_list):
    sorted_list = list()
    for target in target_list[:]:
        for i, num in enumerate(sorted_list):
            if num > target:
                sorted_list[i:i] = [target]
                break
        else:
            sorted_list.append(target)
        target_list.pop(0)
        print(' '.join(str(s) for s in sorted_list + target_list))

N = int(input())
A = [int(s) for s in input().split()]
insertion_sort(A)

Measured memory_bytes: 7740
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;
#define int ll
using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<int, int> pii;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define asd(n) rep(i, 0, n)
#define jkl(n) rep(j, 0, n)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

namespace IO {

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> a);

    template<class A>
    ostream &operator<<(ostream &out, vector<A> a);

    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
        return out;
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> a) {
        for (A x: a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve() {
    int n, x, m;
    cin >> n >> x >> m;
    set<int> c;
    map<int, int> b;
    vi a;
    int su = 0;
    rep(i, 0, m + 1) {
        a.push_back((i == 0? x:sqr(a.back()) % m));
        if (c.count(a.back())) break;
        b[a.back()] = i;
        c.insert(a.back());
    }
    int ans = 0;
    rep(i, b[a.back()], a.size() - 1) su += a[i];
    int cyc = a.size() - 1 - b[a.back()];
    asd(min(n, (int)a.size() - 1)) ans += a[i];
    if (n > a.size() - 1) {
        n -= a.size() - 1;
        ans += su * (n / cyc);
        rep(i, b[a.back()], b[a.back()] + (n % cyc)) ans += a[i];
    }
    put(ans);
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(30);
//    freopen("input.txt", "r", stdin);
    int q = 1;
//    cin >> q;

    while (q--) solve();
}


Measured memory_bytes: 8696
import math


def main():
    a, b, c = map(int, input().split())
    angle = math.radians(c)
    s = (1/2) * math.sin(angle) * a * b
    L = a + b + (a**2 + b**2 - 2*a*b*math.cos(angle))**(1/2)
    h = math.sin(angle) * b
    print('{0:.5f}\n{1:.5f}\n{2:.5f}'.format(s, L, h))


if __name__ == '__main__':
    main()



Measured memory_bytes: 5724
def main():
    # r:ぐー,s:ちょき,p:ぱー
    # 相手のn回目の手についてn%Kの値によってグループ分け
    # 連続して同じ手を出せずに最高点を出す方法を知れば良い
    # 最後に全てを足し合わせる
    N,K = map(int, input().split())
    R,S,P = map(int, input().split())
    T = input()
    hands = [[] for i in range(K)]
    for i in range(N):
        if T[i]=='r': hands[i%K].append(0)
        elif T[i]=='s': hands[i%K].append(1)
        else: hands[i%K].append(2)
    # 貪欲に前から勝てば良い..わけではなさそう
    ans = 0
    points = [R,S,P]
    for i in range(K):
        # dp[j][k] := j回目にkを出した時の最大得点
        dp = [[0]*3 for _ in range(len(hands[i])+1)]
        for j in range(len(hands[i])):
            for k in range(3):
                # kが勝ち手かどうかで場合分け
                if hands[i][j]==(k+1)%3:
                    dp[j+1][k] = max(dp[j+1][k], dp[j][(k+1)%3]+points[k])
                    dp[j+1][k] = max(dp[j+1][k], dp[j][(k+2)%3]+points[k])
                else:
                    dp[j+1][k] = max(dp[j+1][k], dp[j][(k+1)%3])
                    dp[j+1][k] = max(dp[j+1][k], dp[j][(k+2)%3])
        ans += max(dp[-1])
    print(ans)

main()


Measured memory_bytes: 18584
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;

int main(void)
{
	int y1,m1,d1,y2,m2,d2,x;
	scanf("%d %d %d",&y1,&m1,&d1);
	scanf("%d %d %d",&y2,&m2,&d2);
	if(y1>y2 || (y1==y2 && m1>m2) || (y1==y2 && m1==m2 && d1>d2))	{
		swap(y1,y2);	swap(m1,m2);	swap(d1,d2);
	}
	x=y2-y1;
	if(m2>m1 || (m2==m1 && d2>d1))	x++;
	printf("%d\n",x);	
	return 0;
}


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

int main(){
  int n, max_value = 0, sum = 0;
  
  cin >> n;
  
  for(int i=0;i<n;i++){
    int p;
    cin >> p;
    max_value = max(p, max_value);
    sum += p;
  }
  
  cout << sum - max_value / 2 << endl;
  
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	if(n>=s.size()){
		cout<<s<<endl;
	}else{
		for(int i=0;i<n;i++){
			cout<<s[i];
		}
		cout<<"..."<<endl;
	}
	return 0;
}


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

int main(){
  char S;
  cin >> S;
  if(S == 'a' || S == 'i' || S == 'u' || S == 'e' || S == 'o'){
    cout << "vowel" <<endl;
  }
  else{
    cout << "consonant" <<endl;
  }
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<P>> Graph;


int main(){

  int n,a,b;
  cin  >> n >> a >> b;
  
  if(abs(a-b) % 2 == 1) cout << "Borys" << endl;
  else					cout << "Alice" << endl;
 
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void) {
	int i,n;
	int cost = 100;
	
	scanf("%d\n", &n);
	for(i=0;i<n;i++) {
		cost = (int)ceil(cost * 1.05);
	}
	
	printf("%d\n", cost*1000);
	
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  string s, t;
  cin >> s >> t;
  int d = s.size() - t.size();
  int ans = 1e6;
  for (int i = 0; i <= d; i++) {
    int cnt = 0;
    rep(j, (int)t.size()) {
      if (s.at(i+j) != t.at(j)) cnt++;
    }
    ans = min(ans, cnt);
  } 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
#include <string>
//typedef long long LL;
using namespace std;
 
int main(){
    string s;
    string t;
    cin >> s >> t;
    cout << t << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cstring>

using namespace std;

int main() {
    int N;
    double V[100];
    double ans = 0;
    cin >> N;
    for(int i = 0; i < N; i++)
    {
        cin >> V[i];
    }
    sort(V, V + N);
    double temp;

    for(int i = 0; i < N - 1; i++){
        temp = (double(V[i]) + double(V[i + 1])) / double(2.0);
        V[i + 1] = temp;
        V[i] = -1;
        sort(V, V + N);
    }
    
    cout << temp << endl;
}

Measured memory_bytes: 256
s = list(input())
q = int(input())
for i in range(q):
    command = input().split()
    a = int(command[1])
    b = int(command[2])
    if command[0] == 'print':
        print(''.join(s[a:b+1]))
    elif command[0] == 'reverse':
        while a < b:
            s[a], s[b] = s[b], s[a]
            a += 1
            b -= 1
    elif command[0] == 'replace':
        p = list(command[3])
        j = 0
        while a + j <= b:
            s[a + j] = p[j]
            j += 1
    else:
        pass



Measured memory_bytes: 5624
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;

using Graph = vector<vector<int>>;

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

  string S;
  cin >> S;
  deque<char> que;
  rep(i,S.size()){
    if(S[i] == '0' || S[i] == '1'){
      que.emplace_back(S[i]);
    }
    else{
      if(!que.empty()){
        que.pop_back();
      }
    }
  }
  while(!que.empty()){
    cout << que.front();
    que.pop_front();
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int N, A, B;
    cin >> N >> A >> B;
    int p1 = A * N;
    int p2 = B;
    if (p1 < p2)
        cout << p1 << endl;
    else
        cout << p2 << endl;

    return 0;
}


Measured memory_bytes: 256
import sys, math

n = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()
res = 0

r = []
g = []
b = []
for i, c in enumerate(s):
    if c == "R":
        r.append(i)
    if c == "G":
        g.append(i)
    if c == "B":
        b.append(i)


res = len(r) * len(b) * len(g)

def bin_find(tar):
    left = 0
    right = len(b)
    while left < right:
        mid = (left+right) // 2
        if b[mid] < tar:
            left = mid+1
        elif b[mid] > tar:
            right = mid
        else:
            return mid
    return -1

for i in r:
    for j in g:
        diff = i - j
        if diff < 0:
            diff = -diff
        if diff % 2 == 0:
            target = diff // 2 + min(i,j)
            if target < n and s[target] == 'B':
                res -= 1
        target = min(i,j) - diff
        if target >= 0 and s[target] == 'B':
            res -= 1
        target = max(i,j) + diff
        if target < n and s[target] == "B":
            res -= 1

print(res)

Measured memory_bytes: 69388
n = int(input())
r_min = int(input())
r_t = int(input())
g_max = r_t - r_min
r_min = min(r_t, r_min)

for _ in range(n - 2):
    r_t = int(input())
    g_max = max(g_max, r_t -r_min)
    r_min = min(r_t, r_min)
print(g_max)

Measured memory_bytes: 7644
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

lst = [a,b,c,d,e]
amari = list(map(lambda x: x % 10,lst ))
sho = list(map(lambda x: x // 10,lst))

for i in range(5):
    if amari[i] == 0:
        amari[i] = amari[i]+10
    else:
        sho[i] = sho[i]+1


def swap(x,y):
 global amari,lst,sho
 temp = amari[x]
 amari[x] = amari[y]
 amari[y] = temp
 temp2 = lst[x]
 lst[x] = lst[y]
 lst[y] = temp2
 temp3 = sho[x]
 sho[x] = sho[y]
 sho[y] = temp3

for i in range(1,5):
    j = i
    while j >= 1:
      if amari[j-1] > amari[j]:
        swap(j-1, j)
      else:
        break      # while文から強制的に抜け出る
      j = j - 1

a = sho[2] + sho[3] + sho[4] + sho[1]

time = a*10


time = time + lst[0]

print(time)


Measured memory_bytes: 3064
n = int(input())

dic = {}

for i in range(n):
    a = int(input())
    if dic.get(a) is None:
        dic[a] = 1
    else:
        dic[a] = (dic[a] + 1)%2
        
    
val = list(dic.values())
ans = int(sum(val))

print(ans)

Measured memory_bytes: 15068
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(c, i, n) for (int i = c; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N), ball(N, 0);
    queue<int> q;
    int count = 0;
    int ans = 0;
    rep(0, i, N)
    {
        cin >> a.at(i);
    }
    for (int i = N - 1; i >= 0; i--)
    {
        for (int j = 0; (i + 1) * (j + 1) <= N; j++)
        {
            count += ball.at((i + 1) * (j + 1) - 1);
        }
        if (count % 2 != a.at(i))
        {
            ans++;
            ball.at(i) = 1;
            q.push(i + 1);
        }
        count = 0;
    }
    cout << ans << endl;
    while (!q.empty())
    {
        cout << q.front() << ' ';
        q.pop();
    }
}

Measured memory_bytes: 3072
import heapq
n = int(input())
a = sorted(list(map(float, input().split())))
heapq.heapify(a)
for i in range(n-1):
    x = heapq.heappop(a)
    y = heapq.heappop(a)
    heapq.heappush(a, (x+y)/2)
print(a[0])

Measured memory_bytes: 3060
use std::io;

fn gets() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let line = gets();
    let n = line.trim().parse::<i32>().unwrap();
    if n % 10 == 9 || n >= 90 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
#include <fstream>
#include <bitset>
#include <time.h>
#include <assert.h>

#define LL long long
#define VI vector<int>
#define VB vector<bool>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

template <class T> int find_index(T x, const std::vector<T> &v) {
    auto it = std::find(v.begin(), v.end(), x);
    if (it != v.end()) { return (int)std::distance(v.begin(), it); }
    return -1;
}

template <class T> void print(T x) {
    std::cout << x << std::endl;
}

using namespace std;

// nまでの素数のリストを作成(nを含む) O(N log log N)
vector<int> make_prime_list(int n) {
    vector<bool> is_prime(n + 1, true);
    is_prime[0] = false;
    is_prime[1] = false;

    vector<int> prime_list;
    for (int i = 2; i < n + 1; ++i) {
        if (!is_prime[i]) { continue; }
        prime_list.emplace_back(i);

        for (int j = i + i; j < n + 1; j += i) {
            is_prime[j] = false;
        }
    }
    return prime_list;  // 素数のリスト
    //return is_prime;  // すべての数値について素数かどうか
}

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    vector<int> prime_list = make_prime_list(1000100);

    int n;
    while(cin >> n) {
        int ans = 0;
        for(int i = 0;;++i)  {
            if(prime_list[i] <= n){
                ans++;
            }
            else {
                break;
            }
        }

        cout << ans << endl;
    }

    return 0;
}


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

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

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

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


int main(){
    string s;
    cin>>s;
    int len = s.size();
    while(len){
        s.erase(len-2, 2);
        len -= 2;
        if(s.substr(0, len/2)==s.substr(len/2, len/2)) break;
    }
    cout << len << endl;
}


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

using namespace std;

#define INF 1e9

int n,m;

int par[100010]; //親
int Rank[100010]; //木の深さ

//n要素で初期化
void init(int n){
    for(int i=0;i<n;i++){
        par[i]=i;
        Rank[i]=0;
    }
}

//木の深さを求める
int find(int x){
    if(par[x]==x){
        return x;
    }
    else{
        return par[x]=find(par[x]);
    }
}

//xとyの属する集合を併合
void unit(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return ;

    if(Rank[x]<Rank[y]){
        par[x]=y;
    }
    else{
        par[y]=x;
        if(Rank[x]==Rank[y])Rank[x]++;
    }
}

//xとyが同じ集合に属するか否か
bool same(int x,int y){
    return find(x)==find(y);
}

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

    cin>>n>>m;

    init(n);

    vector<int> p(n);
    for(int i=0;i<n;i++)cin>>p[i];

    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--;b--;

        unit(a,b);
    }

    int ans=0;

    for(int i=0;i<n;i++){
        if(same(p[i]-1,i))ans++;
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 1408