akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
	   if(x%i==0)return false;
   }return true;
}
bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline ll read() {
	char c = getchar(); ll w = 1; ll x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
	x *= w;
}
void fl(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
int main(){
	fast;
	ll n,k;
	cin>>n>>k;
	ll a[n+1];
	rp(i,1,n){
		cin>>a[i];
	}
	ll sum=0;
	sort(a+1,a+1+n,cmp);
	for(int i=k+1;i<=n;i++){
		sum+=a[i];
	}cout<<sum<<endl;
	return 0;
}/*『你强归你强，Siyuan比你强』*/





Measured memory_bytes: 1792
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{ 
 
 
    static long mod=1000000007;
    static int dx[]={1,-1,0,0};
    static int dy[]={0,0,1,-1};
    // static int dx[]={1,-1,0,0,1,1,-1,-1};
    // static int dy[]={0,0,1,-1,1,-1,1,-1};
    // PriorityQueue<Integer> que = new PriorityQueue<Integer>(); 
    //HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
 
    public  static void main(String[] args)   throws Exception, IOException{
     
        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
     
        int n=sc.nextInt();
        // long n=sc.nextLong();
        // char c[][] = new char[h][w];
        // long a[] = new long [n];
        // for (int i=0; i<n; i++) {a[i]=sc.nextInct();}
        // char c[] = sc.nextString().toCharArray();
        n--;
        int c[]=new int[n];
        int s[]=new int[n];
        int f[]=new int[n];
        for (int i=0; i<n; i++) {
            c[i]=sc.nextInt();
            s[i]=sc.nextInt();
            f[i]=sc.nextInt();
        }

        for (int i=0; i<n; i++) {
            long w=(long)s[i]+c[i];
            for (int t=i+1; t<n; t++) {
                int rm=(int)((w-s[t])%f[t]);
                if(s[t]>w)w=(long)s[t]+c[t];
                else w=w+(rm==0?0:f[t]-rm)+c[t];
            }
            out.println(w);
        }

        out.println(0);
        out.flush();
    }

    static void db(Object... os){
     
        System.err.println(Arrays.deepToString(os));
     
    }
     
    static boolean validpos(int x,int y,int r, int c){
        
        return x<r && 0<=x && y<c && 0<=y;
        
    }
     
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}

class XY {
    int x,y,d;
    XY(int x, int y, int d) {
        this.x=x;
        this.y=y;
        this.d=d;
    } 
}
 
class P implements Comparable<P>{
    int x,y;
    P(int x, int y) {
        this.x=x;
        this.y=y;
    } 
      
    public int compareTo(P p){
        return -x + p.x;//des
    } 
}
 
class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 21588
#include <functional>
#include <iostream>
#include <limits>
#include <queue>

using namespace std;

int64_t a[300'000];
int64_t lScore[100'001];
int64_t rScore[100'001];

int main()
{
    int N;
    cin >> N;
    for (int i = 0; i < 3 * N; i++)
    {
        cin >> a[i];
    }

    priority_queue<int64_t, vector<int64_t>, greater<int64_t>> lQ;
    priority_queue<int64_t, vector<int64_t>, less<int64_t>> rQ;
    int64_t lSum = 0;
    int64_t rSum = 0;

    for (int i = 0; i < N; i++)
    {
        lQ.push(a[i]);
        rQ.push(a[i + 2 * N]);

        lSum += a[i];
        rSum += a[i + 2 * N];
    }

    for (int i = 0; i <= N; i++)
    {
        if (i != 0)
        {
            lSum += a[i - 1 + N];
            lQ.push(a[i - 1 + N]);
            lSum -= lQ.top();
            lQ.pop();

            rSum += a[2 * N - i];
            rQ.push(a[2 * N - i]);
            rSum -= rQ.top();
            rQ.pop();
        }
        lScore[i] = lSum;
        rScore[N - i] = rSum;
    }

    int64_t mScore = numeric_limits<int64_t>::min();
    for (int i = 0; i <= N; i++)
    {
        mScore = max(mScore, lScore[i] - rScore[i]);
    }

    cout << mScore << endl;

    return 0;
}

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

using namespace std;

//constexpr long long int MOD = 1000000007;
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-12;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

class UnionFind {
	vector<int>parent;
	vector<int>rank;
public:
	UnionFind(int num) {
		num++;
		parent.resize(num);
		rank.resize(num);
		for (int i = 0; i < num; i++) {
			parent[i] = i;
			rank[i] = 0;
		}
	}
	int Find(int node) {
		if (parent[node] == node)return node;
		else return parent[node] = Find(parent[node]);
	}
	void Unite(int u, int v) {
		u = Find(u);
		v = Find(v);
		if (u == v)return;
		if (rank[u] < rank[v])parent[u] = v;
		else {
			parent[v] = u;
			if (rank[u] == rank[v])rank[u]++;
		}
	}
	bool Check_Same(int u, int v) {
		return Find(u) == Find(v);
	}
};

void Calculate_Depth(vector<vector<int>>&edge, vector<int>&depth, int stnode) {
	depth[stnode] = 0;
	queue<int>Q;
	Q.push(stnode);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (auto i : edge[cn]) {
			if (depth[i] > depth[cn] + 1) {
				depth[i] = depth[cn] + 1;
				Q.push(i);
			}
		}
	}
	return;
}

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

	cin >> N >> M;
	vector<int>v(N);
	for (auto &i : v)cin >> i;
	vector<vector<int>>edge(N);
	vector<pair<int, int>>e;
	for (int i = 0; i < M; i++) {
		cin >> L >> R;
		L--, R--;
		edge[L].push_back(R);
		e.emplace_back(L, R);
	}
	string s(N, 'B');
	vector<int>dis(N, MOD);
	vector<vector<int>>t_edge(N);
	set<pair<int, pair<int, int>>>st;
	for (int i = 0; i < N; i++) {
		for (auto j : edge[i]) {
			st.insert({ max(v[i], v[j]),{ i, j } });
		}
	}
	UnionFind uf(N);
	for (auto i : st) {
		if (uf.Check_Same(i.second.first, i.second.second))continue;
		uf.Unite(i.second.first, i.second.second);
		t_edge[i.second.first].push_back(i.second.second);
		t_edge[i.second.second].push_back(i.second.first);
	}
	Calculate_Depth(t_edge, dis, 0);
	for (int i = 0; i < N; i++) {
		if (dis[i] & 1)s[i] = 'W';
		bool flag = true;
		for (auto j : t_edge[i]) {
			if (v[i] >= v[j])flag = false;
		}
		if (flag) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << s << endl;
	for (auto i : e) {
		cout << max(v[i.first], v[i.second]) << endl;
	}
	return 0;
}


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()

void Main() {
    int a, b;
    cin >> a >> b;
    if (a >= 13) {
        cout << b << endl;
        return;
    }
    else if (a <= 5) {
        cout << 0 << endl;
        return;
    }
    else {
        cout << b / 2 << endl;
        return;
    }
}

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


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

int main() {
  long long N;
  cin>>N;
  vector<long long> vec(0);
  while(N>26){
    if(N%26==0){
      vec.push_back((N-1)%26+1);
      N=(N-1)/26;
    }
    else{vec.push_back(N%26);
    N=N/26;
    }
  }
  vec.push_back(N);
  
  long long S=vec.size();
  for(int i=S-1;i>=0;i--){
    cout<<char(vec.at(i)+96);
  }
  cout<<endl;

    
}

Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
typedef long long ll;
using namespace std;

int partition(int a[],int p,int r){
  int tmp,x=a[r],i,j=p;
  for(i=p;i<r;i++){
    if(a[i]<=x){
      tmp=a[i];
      a[i]=a[j];
      a[j]=tmp;
      j++;
    }
  }
  a[r]=a[j];
  a[j]=x;
  return j;
}

int main(void){
  int i,n,a[100000];
  cin>>n;
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  int q=partition(a,0,n-1);

  for(i=0;i<q;i++){
    printf("%d ",a[i]);
  }
  printf("[%d]",a[q]);
  if(i==n-1)printf("\n");
  else printf(" ");
  i++;
  for(;i<n-1;i++){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[n-1]);

	return 0;
}


Measured memory_bytes: 3580
S = input()

Wnum = [0 for i in range(len(S))]
wmax = S.count('W')
if S[0] == 'W':
    Wnum[0] = 1

for i in range(1,len(S)):
    if S[i] == 'W':
        Wnum[i] = Wnum[i-1] + 1
    else:
        Wnum[i] = Wnum[i-1]

ans = 0
for i in range(len(S)):
    if S[i] == 'B':
        ans += wmax - Wnum[i]

print(ans)


Measured memory_bytes: 11368
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc131_d.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  vector<P> c(N);
  rep(i, N) {
    int a, b;
    cin >> a >> b;
    c[i] = make_pair(b, a);
  }

  auto comp = [&](P a, P b) -> bool {
    if (a.first == b.first)
      return a.second < b.second;
    else
      return a.first < b.first;
  };
  sort(c.begin(), c.end(), comp);

  bool ret = true;
  ll time = 0;
  rep(i, N) {
    int lim = c[i].first;
    time += c[i].second;
    if (lim < time) {
      ret = false;
      break;
    }
  }

  cout << (ret ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1792
n, x = map(int, input().split())
x -= 1
npl = [0] * (n+1)
lbl = [0] * (n+1)
npl[0] = 1
lbl[0] = 1
for i in range(1, n+1):
    npl[i] = 2*npl[i-1] + 1
    lbl[i] = 2*lbl[i-1] + 3

def rec(n, x):
    if x == 0:
        if n == 0:
            return 1
        else:
            return 0
    elif x < 1 + lbl[n-1]:
        return rec(n-1, x-1)
    elif x == 1+lbl[n-1]:
        return npl[n-1] + 1
    elif x == 2+2*lbl[n-1]:
        return 2*npl[n-1] + 1
    else:
        return npl[n-1] + 1 + rec(n-1, x-2-lbl[n-1])

print(rec(n, x))


Measured memory_bytes: 61300
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    string s;
    cin >> s;
    rep(i, s.size()) cout << "x";
    cout << endl;    
    return 0;
}


Measured memory_bytes: 3572
Module VBModule
 
    Sub Main()
        Dim n As Integer = CInt(Console.Readline())
        Dim str As String() = Console.Readline().Split(" ")
        Dim i, avg As Integer = 0
        
        for i = 0 to UBound(str)
          avg+= CInt(str(i))
        Next
        Dim a1 As Integer = Math.Floor(avg / n)
        Dim c1 As Integer = 0
        
        for i= 0 to ubound(str)
          c1 += (Cint(str(i)) - a1)*(Cint(str(i)) - a1)
        next
        
        Dim a2 As Integer = Math.Ceiling(avg/n)
        Dim c2 As Integer = 0
        
        for i= 0 to ubound(str)
          c2 += (Cint(str(i)) - a2)*(Cint(str(i)) - a2)
        next
        
        if c2>c1 then Console.writeline(c1.toString()) else console.writeline(c2.tostring())
        
        
    End Sub
  
End Module


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved

int main(){
    long long n;
    cin>>n;
    int stone[200010]={};
    int Lw[200010]={};
    int Lr[200010]={};

    int Rw[200010]={};
    int Rr[200010]={};
    rep2(i,n){
        char c;
        cin>>c;
        if(c=='W'){
            stone[i]=1;
        }
        else{
            stone[i]=0;
        }
    }

    rep(i,n+1){
        Lw[i]=Lw[i-1]+stone[i];
        Lr[i]=Lr[i-1]+(stone[i]^1);
    }
    for(int i=n-1;i>-1;i--){
        Rw[i]=Rw[i+1]+stone[i+1];
        Rr[i]=Rr[i+1]+(stone[i+1]^1);
    }
    long long ans=INF;
    rep(i,n+1){
        long long total;
        total=max(Lw[i],Rr[i]);
        //cout<<Lw[i]<<" "<<Rr[i]<<endl;
        ans=min(ans,total);
    }
    cout<<ans<<endl;
    return 0;

}
/*


*/


Measured memory_bytes: 5952
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1);

int H,W;
bool movable(vector<string> &maze,vector<vector<int>> &memo,int x,int y,int X,int Y)
{
  if(X<0||X>=W||Y<0||Y>=H) {return false;}
  if(maze.at(Y).at(X)=='#') {return false;}
  if(memo.at(Y).at(X)!=-1) {return false;}
  return true;
}



int main() 
{
  cin>>H>>W;
  int ans=0;
  vector<string> maze(H);
  rep(i,H)
  {
    cin>>maze.at(i);
  }
  rep(i,H*W)
  {
    for(int j=0;j<i;j++)
    {
      int sx=i%W,sy=i/W,gx=j%W,gy=j/W;
      if(maze.at(sy).at(sx)=='#'||maze.at(gy).at(gx)=='#') {continue;}
      queue<vector<int>> next;
      vector<vector<int>> memo(H,vector<int>(W,-1));
      memo.at(sy).at(sx)=0;
      next.push({sx,sy});
      while(!next.empty())
      {
        int x=next.front().at(0),y=next.front().at(1);
        //cout<<x<<" "<<y<<endl;
        next.pop();
        if(x==gx&&y==gy) {break;}
        
        if(movable(maze,memo,x,y,x+1,y))
        {
          memo.at(y).at(x+1)=memo.at(y).at(x)+1;
          next.push({x+1,y});
        }
        if(movable(maze,memo,x,y,x-1,y))
        {
          memo.at(y).at(x-1)=memo.at(y).at(x)+1;
          next.push({x-1,y});
        }
        if(movable(maze,memo,x,y,x,y+1))
        {
          memo.at(y+1).at(x)=memo.at(y).at(x)+1;
          next.push({x,y+1});
        }
        if(movable(maze,memo,x,y,x,y-1))
        {
          memo.at(y-1).at(x)=memo.at(y).at(x)+1;
          next.push({x,y-1});
        }
      }
      ans=max(ans,memo.at(gy).at(gx));
    }
  }
  cout<<ans<<endl;
      
    
  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <limits>
using namespace std;
int main(void) {
	for (;;) {
		int cnt = 0,buf;
		cin >> buf;
		if (!buf)return 0;
		for (; buf != 1;) {
			buf = buf % 2 ? buf * 3 + 1 : buf / 2;
			cnt++;
		}
		cout << cnt << endl;
	}
}

Measured memory_bytes: 1160
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var (
	path         [][]int
	distance     []int
	shortestFrom []int
	done         []bool
)

var max int

func main() {
	max = 1000000

	N := NextInt()
	M := NextInt()

	path = make([][]int, N+1)
	for i := 1; i <= M; i++ {
		f := NextInt()
		t := NextInt()
		path[f] = append(path[f], t)
		path[t] = append(path[t], f)
	}

	distance = make([]int, N+1)
	done = make([]bool, N+1)
	shortestFrom = make([]int, N+1)

	for i := 1; i <= N; i++ {
		distance[i] = max
	}

	q := new(IntHeap)
	heap.Init(q)

	for _, t := range path[1] {
		distance[t] = 1
		shortestFrom[t] = 1
		heap.Push(q, t)
	}

	for q.Len() > 0 {
		next := heap.Pop(q).(int)
		if done[next] {
			continue
		}

		for _, t := range path[next] {
			if distance[t] > distance[next]+1 {
				distance[t] = distance[next] + 1
				shortestFrom[t] = next
				heap.Push(q, t)
			}
		}

		done[next] = true
	}

	fmt.Println("Yes")
	for i := 2; i <= N; i++ {
		fmt.Println(shortestFrom[i])
	}
}

// An IntHeap is a min-heap of ints.
type IntHeap []int

func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return distance[h[i]] < distance[h[j]] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

var _sw = bufio.NewScanner(os.Stdin)

func init() {
	_sw.Split(bufio.ScanWords)
}

func NextInt() int {
	if _sw.Scan() == false {
		panic(_sw.Err())
	}
	i, e := strconv.Atoi(_sw.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func NextString() string {
	if _sw.Scan() == false {
		panic(_sw.Err())
	}
	return _sw.Text()
}

func Max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func Min(x, y int) int {
	if x > y {
		return y
	}
	return x
}

func SortInts(xs []int) {
	sort.Sort(sort.IntSlice(xs))
}

func ReverseSortInts(xs []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(xs)))
}


Measured memory_bytes: 19568
N = gets.strip.to_i
A = gets.strip.split.map(&:to_i)
 
count = 0
N.times do |i|
  break if i + 2 >= N
  if (A[i + 1] > A[i]) && (A[i + 1] < A[i + 2])
    count += 1
  elsif A[i + 1] > A[i + 2] && A[i + 1] < A[i]
    count += 1
  end
end

puts count


Measured memory_bytes: 1788
#include <iostream>

int main() {
	int temp, i;
	for (i = 0; i < 10000; i++) {
		std::cin >> temp;
		if (temp == 0) break;
		std::cout << "Case " << i + 1 << ": " << temp << std::endl;
	}
	return 0;
}


Measured memory_bytes: 2996
#include<iostream>
#include<vector>
using namespace std;
int main(){
	int n;
	cin >> n;
	vector<int> stones(n);
	for(int i = 0; i < n; i++){
		cin >> stones[i];
	}
	vector<int>dp(n);
	for(int i = 0; i < n; i++){
		if(i == 0){
			dp[i] = 0;
		}
		else if(i == 1){
			dp[i] = abs(stones[1] - stones[0]);
		}
		else{
			dp[i] = min(abs(stones[i] - stones[i-1]) + dp[i-1], abs(stones[i] - stones[i-2]) + dp[i-2]);
		}
	}
	cout << dp[n-1] << endl;
}

Measured memory_bytes: 3636
#include<stdio.h>

int main(void){
  long long i,j;
  int n,prime[50001];

  prime[0]=1;
  prime[1]=1;

  for(i=2;i<50001;i++)
    prime[i]=0;

  for(i=2;i*i<50001;i++){
    if(prime[i]==0){
      for(j=i*i;j<50001;j+=i)
	prime[j]=1;
    }
  }

  while(1){
    int count=0;
    scanf("%d",&n);
    if(n==0)break;    

    for(i=0;i<n/2+1;i++)
      if(prime[i]==0 && prime[n-i]==0)count++;
    
    printf("%d\n",count);
  }
  return 0;
}

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

using namespace std;

int N;
int h[200005], v[200005], s[200005];
long long dp[200005];
long long ans = 0;

int main(){
    cin >> N;
    for(int i = 1; i<=N; i++){
        cin >> h[i];
        s[i] = h[i];
    }
    for(int i = 1; i<=N; i++){
        cin >> v[i];
    }
    sort(s+1, s+N+1);
    for(int i = 1; i<=N; i++){
        int l = 1, r = N;
        while(l <= r){
            int mid = (l+r)/2;
            if(s[mid] == h[i]){
                h[i] = mid;
                break;
            }
            if(s[mid] > h[i]){
                r = mid - 1;
            }
            else{
                l = mid + 1;
            }
        }
    }
    for(int i = 1; i<=N; i++){
        for(int j = h[i]; j > 0; j-=j&-j){
            dp[h[i]] = max(dp[j], dp[h[i]]);
        }
        dp[h[i]] += v[i];
        ans = max(ans, dp[h[i]]);
        for(int j = h[i]; j<=N; j+=j&-j){
            dp[j] = max(dp[j], dp[h[i]]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4096
#include<stdio.h>
int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a<b){
    printf("a < b\n");
  }
  if(a>b){
    printf("a > b\n");
  }
  if(a==b){
    printf("a == b\n");
  }
 
 
  return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<long long> a, v;
    long long s = 0;
    for (int i = 0; i < n; i++) {
        int m;
        cin >> m;
        if (i == 0) {
            a.push_back(m);
        } else {
            a.push_back(a.back() + m);
        }
        s += m;
    }
    
    for (int i = 0; i < n - 1; i++) {
        v.push_back(abs(a[i] - (s - a[i])));
    }
    sort(v.begin(), v.end());
    cout << v.front() << endl;
}

Measured memory_bytes: 4848
#include<iostream>
#include<cmath>
#define MODE 1
#ifdef MODE
#define DEB(X) cout<<#X<<": "<<X<<" ";
#define ARDEB(i,X) cout<<#X<<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(X) {}
#define END {}
#endif
using namespace std;
int main(){
	string s;
	cin>>s;
	s[3]='8';
	cout<<s<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int tree, range, watch, watcher;
  
  scanf("%d %d", &tree, &range);
  
  watch = 2*range+1;
  watcher = (int)((double)tree / (double)watch + 0.99999);
  
  printf("%d", watcher);
  
  return 0;
}

Measured memory_bytes: 128
import math
p = 1000000007
if __name__ == '__main__':
    n,m = list(map(int,input().split()))
    if n==m:
        print(((math.factorial(n)%p)*(math.factorial(n)%p)*2)%p)
    elif abs(n-m)==1:
        print((math.factorial(m)%p)*(math.factorial(n)%p)%p)
    else:
        print(0)


Measured memory_bytes: 4092
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll; 
typedef pair<ll, ll> PL;

ll n, m;
ll a[1000100];

int main(){
	for (int i = 1; i <= 1000000; i *= 2){
		for (int j = 1; j*i <= 1000000; j *= 3){
			for (int k = 1; k*j*i <= 1000000; k *= 5){
				a[i*j*k] = 1;
			}
		}
	}
	while (cin >> m){
		if (m == 0)break;
		cin >> n;
		ll c = 0;
		FOR(i, m, n + 1){
			if (a[i]){
				c++;
			}
		}
		cout << c << endl;
	}
}

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

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    if (a[a.size()-1] == b[0] && b[b.size()-1] == c[0]){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

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

using namespace std;

int main() {

	int n;
	cin >> n;

	vector<int> w(101);
	int total=0;
	for (int i = 0; i < n; i++) {
		cin >> w[i];
		total += w[i];
	}

	int minn = 1000000;
	for (int i = 0; i < n; i++) {
		int summ = 0;
		for (int j = 0; j <= i; j++) {
			summ += w[j];
		}
		if (abs(summ - (total - summ)) < minn) {
			minn = abs(summ - (total - summ));
		}
	}
	cout << minn << endl;
}

Measured memory_bytes: 256
MOD=998244353
n,s=map(int,input().split())
a=list(map(int,input().split()))
al=sum(a)
dp=[[0]*3001 for i in range(n+1)]
dp[0][0]=1
for i in range(n):
    for j in range(3001):
        if j==0:
            dp[i+1][j]=pow(2,i+1,MOD)
            continue
        dp[i+1][j]=(dp[i+1][j]+(dp[i][j]*2%MOD))%MOD
        if j-a[i]>=0:
            dp[i+1][j]=(dp[i+1][j]+dp[i][j-a[i]])%MOD
print(dp[n][s])

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

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i += 2) {
        cout << s[i];
    }
    cout << endl;
    return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  int res = 1;
  rep(i, n) {
    if (res * 2 < res + k) {
      res *= 2;
    } else {
      res += k;
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(int i=0;i<(int)N;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;

    long double N; cin >> N;
    vector<long double> v(N);
    rep(i, N) cin >> v[i];

    sort(v.begin(), v.end());

    long double ans=v[0];

    for (int j = 1; j < N; ++j) {
        ans = (ans + v[j]) / 2;
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int s,w;
    cin>>s>>w;
    if(w>=s){
        cout<<"unsafe\n";
    }else{
        cout<<"safe\n";
    }
    return 0;
}

Measured memory_bytes: 3620
def main():
    N = int(input())
    S1 = input()
    S2 = input()
    MOD = 10 ** 9 + 7
    ans = 1
    cnt = 0
    while cnt < N:
        if cnt == 0:
            if S1[cnt] == S2[cnt]:
                ans *= 3
                cnt += 1
            else:
                ans *= 6
                cnt += 2
        else:
            if S1[cnt] == S2[cnt]:
                if S1[cnt-1] == S2[cnt-1]:
                    ans *= 2
                else:
                    ans *= 1
                cnt += 1
            else:
                if S1[cnt-1] == S2[cnt-1]:
                    ans *= 2
                else:
                    ans *= 3
                cnt += 2

        ans %= MOD

    print(ans)

if __name__ == "__main__":
    main()

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

int main() {
    int n, m;
    while(cin >> n >> m, n + m) {
        vector<int> a(n);
        for (int i = 0; i < n; i++) cin >> a[i];
        sort(a.begin(), a.end(), greater<int>());

        int ans = -1;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i == j) continue;
                if (a[i] + a[j] <= m) {
                    ans = max(a[i] + a[j], ans);
                }
            }
        }
        if (ans < 0) cout << "NONE" << endl;
        else cout << ans << endl;
    }
}


Measured memory_bytes: 3156
import string
lower = string.ascii_lowercase

n = int(input())

# if n == 1:
#     print('a')
#     exit()

ans = ['']

for i in range(n):
    new_list = []
    for word in ans:
        for new_char in lower:
            if new_char in word:
                new_list.append(word + new_char)
            else:
                new_list.append(word + new_char)
                break
    ans = new_list
#    print(new_list)

for word in ans:
    print(word)


Measured memory_bytes: 13516
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, i321) => {
        read_value!($next, i32) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// # Examples
//
// # integers
// input! { n: i32, m: i32, ... }
//
// # array
// input! { n: i32, v: [i32; n], }
//
// # matrix
// input! { n: i32, m: i32, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: i32,
//     w: i32,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: i32, b: i32, c: i32,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}
fn main() {
    input!{
        a: i32, b: i32, c: i32, d: i32
    }
    if (a-c).abs() <= d {
        println!("{}", "Yes");
    } else if (a-b).abs() <= d && (b-c).abs() <= d {
        println!("{}", "Yes");
    } else {
        println!("{}", "No");
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
#define overload4(_1,_2,_3,_4,name,...) name
#define rep1(n) for(ll i=0;i<(n);++i)
#define rep2(i,n) for(ll i=0;i<(n);++i)
#define rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep4(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vec vector<ll>
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

void solve(){
    ll n;cin>>n;
    vector<pair<ll,ll>> p;
    rep(i,n){
        ll x,l;cin>>x>>l;
        p.push_back(make_pair(x+l,x-l));
    }
    sort(all(p));
    ll pos=-LINF;
    ll cnt=0;
    rep(i,n){
        if(p[i].second>=pos){
            cnt++;
            pos=p[i].first;
        }
    }
    cout<<cnt<<endl;
}

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


Measured memory_bytes: 2420
#include<bits/stdc++.h>                                                         
using namespace std;
int main()
{
  int H,W;
  cin >> H >> W;
  vector<vector<char>> C(H, vector<char>(W));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> C.at(i).at(j);
    }
  }
  for(int i=0; i<H; i++){
    for(int j=0; j<2; j++){
      for(int k=0; k<W; k++){
        cout << C.at(i).at(k);
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
typedef long long ll;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b&&a!=c||b==c&&c!=a||c==a&&a!=b){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return(0);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
#include<functional>
using namespace std;
    int INF = 1e9 + 7;
    typedef long long ll;
    typedef pair<int, int> P;
    int main() {
	int n, t;
	cin >> n >> t;
	vector<int> a(n + 1);
	for (int i = 1; i <= n; i++) cin >> a[i];
	ll unk = 0;
	for (int i = 1; i < n; i++) {
	if (a[i + 1] - a[i] >= t) unk += t;
	else unk += a[i + 1] - a[i];
	}
	cout << unk + t << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm> 
using namespace std;
int main()
{
	long long n,a,b,i,j,sum=0,p1,p2,p=-1;
	cin>>a>>b;
	for(i=1;i<=10000;i++)
	{
		if((i*8)/100==a&&(i/10)==b)
		{
			cout<<i;
			return 0;
		}
	}
	cout<<"-1";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    String s = sc.nextLine();
    sc.close();
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < s.length(); i++) {
      int charCode = (s.codePointAt(i) - 65 + n) % 26;
      sb.append(Character.toChars(charCode + 65));
    }
    System.out.println(sb.toString());
  }
}


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int n;
    cin>>n;
    long long int ans=1;
    rep(i,n){
        ans=ans*(i+1)%(1000000000+7);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	s := make(map[string]int, n)
	for i := 0; i < n; i++ {
		var judge string
		fmt.Scan(&judge)

		s[judge]++
	}

	fmt.Printf("AC x %d\n",s["AC"])
	fmt.Printf("WA x %d\n",s["WA"])
	fmt.Printf("TLE x %d\n",s["TLE"])
	fmt.Printf("RE x %d\n",s["RE"])

}



Measured memory_bytes: 7064
using System;
using System.Linq;
using System.Collections.Generic;
 
public class Beginner
{
 
    public static void Main()
    {
      var res = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
      var N = res[0];
      var M = res[1];
      var A = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
      
      var all =  A.Sum() * (1.0/(4.0*M));
      int Cnt=0;
      for(int i=0;i<A.Length;i++)
      {
        if(A[i]>=all){Cnt++;}
      }
      if(M<=Cnt){Console.WriteLine("Yes");}
      else{Console.WriteLine("No");}
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
const int MAXN = 5e3+6;
ll d[MAXN], dm[MAXN], sbloco;
int main(){
    fastio;
    int k,q; cin>>k>>q;
    for(int i=0; i<k; i++)cin>>d[i];
    while(q--){
        ll ni,xi,mi; cin>>ni>>xi>>mi;
        xi = xi%mi;
        sbloco = 0;
        for(int i=0; i<k; i++){
            int aux = d[i]%mi;
            dm[i] = (aux==0) ? mi : aux;
            sbloco += dm[i]; 
        }
        ll num_blocos = (ni - 1)/k;//quantos blocos completos
        ll ans = xi + num_blocos*sbloco;
        for(int i=0; i<(ni-1)%k; i++){
            ans += dm[i];
        }
        cout << ni - 1 - ans/mi << endl;
    }
}

Measured memory_bytes: 384
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const ll INF=1e+18;
const int MOD=1e+9+7;

//REPマクロ
#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 REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//グローバル変数
// xのn乗%modを計算
ll mod_pow(ll x, ll n, ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*x%mod;
        x = x*x%mod;
        n >>= 1;
    }
    return res;
}

//ライブラリ挿入
int main(){
    int N;
    cin>>N;
    vector<ll> A(N),B(N);
    map<pair<ll,ll>,pair<ll,ll>> C;
    ll cnt_00=0;
    REP(i,N){
        cin>>A[i]>>B[i];
        if(A[i]==0&&B[i]==0){cnt_00++;}
        else if(A[i]==0){C[make_pair(A[i],INF)].first++;}
        else if(B[i]==0){C[make_pair(B[i],INF)].second++;}
        else{
            if(A[i]<0){A[i]*=-1;B[i]*=-1;}
            ll g=__gcd(abs(A[i]),abs(B[i]));
            if(B[i]>0){C[make_pair(A[i]/g,B[i]/g)].first++;}
            else{C[make_pair(-B[i]/g,A[i]/g)].second++;}
        }
    }

    ll ans=cnt_00;
    ll c1,c2;

    ll tmp=1;
    for(auto itr=C.begin();itr!=C.end();itr++){
        c1=itr->second.first;
        c2=itr->second.second;
        tmp*=((mod_pow(2,c1,MOD)+mod_pow(2,c2,MOD)-1)%MOD);
        tmp%=MOD;
    }
    if(tmp==0){ans+=MOD;}
    ans+=tmp-1;
    ans%=MOD;
    cout<<ans<<endl;


    
}

Measured memory_bytes: 21772
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
//const ll mod = 1e9 + 7;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;

const int N = 2e5 + 10;
int t;
int main()
{
	ll a;
	long double b;
	while (cin >> a >> b) {
		long double k= (long double)b*a;
		ll ans = (ll)k;
		cout << ans << endl;
	}
}


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

int main(){
    ll N; cin>>N;
    vector<ll> H(N);
    for (ll i = 0; i < N; i++){
        cin>>H[i];
    }
    ll ans=0,cnt=0;
    ll i=0;
    while(i<N-1){
        if(H[i]>=H[i+1]){
            cnt++;
        }else{
            ans=max(ans,cnt);
            cnt=0;
        }
        i++;
    }
    ans=max(ans,cnt);
    cout<<ans<<endl;
}
    

Measured memory_bytes: 3936
n, a = map(int, input().split())
X = tuple(map(int, input().split()))
dp = [[[0] * (2550) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(n):
    # i枚目までで
    for j in range(n):
        # j枚のカードを選んで
        for s in range(n*a+1):
            # 合計がsになるパターン
            if dp[i][j][s] == 0:
                continue
            # i枚目のカードが選ばれない場合
            dp[i+1][j][s] += dp[i][j][s]
            # i枚目のカードが選ばれる場合
            dp[i+1][j+1][s+X[i]] += dp[i][j][s]
ans = 0
for k in range(1, n+1):
    ans += dp[n][k][k*a]
print(ans)


Measured memory_bytes: 70024
#include <iostream>

int main(void){
    std::string S, T, ans="No";
    std::cin >> S >> T;
    int N = S.size();

    for (int i=0; i<N; ++i){
        bool flg = true;
        int loc = i;
        for (int j=0; j<N; ++j){
            if (loc + j >= N) loc -= N;
            if (S.at(loc + j) != T.at(j)){
                flg = false;
                break;
            }
        }
        if (flg){
            ans = "Yes";
            break;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,t1,t2,fa1[1000001],fa2[1000001];
map<int,int>g[1000001];
int find1(int x){
	if(x==fa1[x])return x;
	return fa1[x]=find1(fa1[x]);
}
int find2(int x){
	if(x==fa2[x])return x;
	return fa2[x]=find2(fa2[x]);
}
int main(){
	int i,t,k,x,y;
	scanf("%d%d%d",&n,&t1,&t2);
	for(i=1;i<=n;i++)fa1[i]=i,fa2[i]=i;
	for(i=1;i<=t1;i++){
		scanf("%d%d",&t,&k);
		x=find1(t);y=find1(k);
		if(x!=y)fa1[x]=y;
	}
	for(i=1;i<=t2;i++){
		scanf("%d%d",&t,&k);
		x=find2(t);y=find2(k);
		if(x!=y)fa2[x]=y;
	}
	for(i=1;i<=n;i++){
		x=find1(fa1[i]);y=find2(fa2[i]);
		//printf("%d %d %d\n",i,fa1[i],fa2[i]);
		g[x][y]++;
	}
	for(i=1;i<=n;i++){
		x=find1(fa1[i]);y=find2(fa2[i]);
	 printf("%d ",g[x][y]);
  }
}

Measured memory_bytes: 62464
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};
use std::ascii::AsciiExt;

// Functions

// Main
fn main(){
    input!{
        Sa: chars,
        Sb: chars,
        Sc: chars,
    }

    let mut mapS = HashMap::new();
    mapS.insert('a',Sa);
    mapS.insert('b',Sb);
    mapS.insert('c',Sc);
    let mut mapI = HashMap::new();
    mapI.insert('a',0);
    mapI.insert('b',0);
    mapI.insert('c',0);

    let mut c = 'a';
    while mapI[&c] < mapS[&c].len(){
        *mapI.entry(c).or_insert(0) += 1;
        c = mapS[&c][*mapI.entry(c).or_insert(0) -1];
    }

    println!("{}", c.to_ascii_uppercase());
}


Measured memory_bytes: 4352
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
const int mod = 1e9+7;

int main() {
    int N;
    cin >> N;
    int A[N];

    bool flg = true;
    vector<int> v(100000, 0);
    for (int i = 0; i < N; i++) {
        int t;
        cin >> t;
        v[t]++;
    }

    ll ans = 1;
    for (int i = 0; i < N; i++) {
        if (N % 2 == 0) {
            if (i % 2) {
                if (v[i] != 2) {
                    flg = false;
                    break;
                } else {
                    ans *= v[i];
                    ans %= mod;
                }
            } else {
                if (v[i] != 0) {
                    flg = false;
                    break;
                }
            }
        } else {
            if (i % 2 == 0) {
                if (i == 0) {
                    if (v[i] != 1) {
                        flg = false;
                        break;
                    }
                } else {
                    if (v[i] != 2) {
                        flg = false;
                        break;
                    } else {
                        ans *= v[i];
                        ans %= mod;
                    }
                }
            }
        }
    }

    if (flg == false) ans = 0;
    cout << ans << endl;

    return 0;
}


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

int main (){
    int N;
    int K;
    int Q;

    cin >> N;
    cin >> K;
    cin >> Q;

    vector<int> scores(N, 0);
    int i;
    int j;
    int A;
    for(i = 0; i < Q; i++){
        cin >> A;
        scores[A-1]++; 
    }

    for(i = 0; i < scores.size(); i++){
        if(Q - scores[i] < K){
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl ;
        }
    }
    return 0;
}


Measured memory_bytes: 1024
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    res = 1000
    for i in range(n-1):
        if a[i] < a[i+1]:
            res = res % a[i] + (res//a[i])*a[i+1]
    print(res)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 9176
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
signed main()
{
	int A, B;
	cin >> A >> B;
	int sum = 0;
	if (A > B)
	{
		sum += A;
		A -= 1;
	}
	else
	{
		sum += B;
		B -= 1;
	}
	sum += max(A, B);
	cout << sum;
}

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

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i ,a, b) for (int i = a ; i <= b ; i++)
#define sz(a) int(a.size())
#define cuti(a) cout << a << endl;
#define cutii(a,b) cout << a << " " << b << endl;
#define cutiii(a,b,c) cout << a << " " << b << " " << c << endl;
#define vec(a) vector<int > a;

template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }

typedef long long LL;
typedef pair<int ,int > pii;
typedef pair<string ,int > psi;
typedef pair<string ,string > pss;
typedef pair<LL, LL> pLL;

const long long oo = 1e9 + 7;
const double PI = acos(-1.0);

double DEG_to_RAD(double d) { return d * PI / 180.0; }

int n,z,w;
int a[2123];
int maxi,mini;

int main(){
 //   freopen("test.txt","r",stdin);
    cin >> n >> z >> w;
    for (int i =1 ; i<= n ; i++) {
        cin >> a[i];
    }
    if (n >= 2) {
        cout << max(abs(a[n] - w), abs(a[n-1] - a[n])) << endl;
    } else {
       cout << abs(a[1] - w) << endl;
    }
}


Measured memory_bytes: 256