akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
void reader(int& x) { int k, m = 0; x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; x = x * 10 + k - '0'; }if (m) x = -x; }
void writer(int x, char c) { int s = 0, m = 0; char f[10]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writerLn(int x) { writer(x, '\n'); }
#define rep(i,n)for(int i=0;i<n;i++)
vector<int>E[100000];
int u[200000], v[200000], r[200000], ans[200000], d[100000], cnt = 1;
char b[200000], ok[100000]{ 1 };
deque<int>que;

void bfs(int u, bool t) {
	que.emplace_back(u);
	while (!que.empty()) {
		int p = que.front(); que.pop_front();
		for (int v : E[p]) {
			if (t) {
				if (d[v] > d[p] && !ok[v]) {
					ok[v] = 1; cnt++; que.emplace_back(v);
				}
			}
			else if (!~d[v]) {
				d[v] = d[p] + 1; que.emplace_back(v);
			}
		}
	}
}
int main() {
	int n, m, q; reader(n); reader(m); reader(q);
	rep(i, m) {
		reader(u[i]); reader(v[i]);
		u[i]--; v[i]--;
		E[u[i]].emplace_back(v[i]); E[v[i]].emplace_back(u[i]);
	}
	memset(d, -1, sizeof(d));
	d[0] = 0; bfs(0, 0);
	rep(i, n)E[i].clear();
	rep(i, q) {
		reader(r[i]); r[i]--;
		b[r[i]] = 1;
	}
	rep(i, m) {
		if (!b[i]) {
			if (d[v[i]] > d[u[i]]) {
				E[u[i]].emplace_back(v[i]);
			}
			if (d[v[i]] < d[u[i]]) {
				E[v[i]].emplace_back(u[i]);
			}
		}
	}
	bfs(0, 1);
	for (int i = q - 1; i >= 0; i--) {
		ans[i] = n - cnt;
		if (d[v[r[i]]] > d[u[r[i]]] && !ok[v[r[i]]]) {
			E[u[r[i]]].emplace_back(v[r[i]]);
			if (ok[u[r[i]]]) {
				cnt++; ok[v[r[i]]] = 1;
				bfs(v[r[i]], 1);
			}
		}
		if (d[v[r[i]]] < d[u[r[i]]] && !ok[u[r[i]]]) {
			E[v[r[i]]].emplace_back(u[r[i]]);
			if (ok[v[r[i]]]) {
				cnt++; ok[u[r[i]]] = 1;
				bfs(u[r[i]], 1);
			}
		}
	}
	rep(i, q)writerLn(ans[i]);
}

Measured memory_bytes: 13580
#include<stdio.h>
#include <stdlib.h>
#include <string.h>

//   enum hex { A , B , C, D, E, F };

int main()
{
//    enum hex henkan;

    char X;
    char Y;
 
 // 整数の入力
    scanf("%c %c", &X, &Y);
if(X<Y){
    printf("<\n");
    } else if (X==Y){
    printf("=\n");
    } else {
    printf(">\n");
   }            
     
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<int,int>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)

P tree[30];
int n,root;
void FindRoot(){
	int cnt[n] = {};
	FOR(i,0,n){
		cnt[tree[i].first]++;
		cnt[tree[i].second]++;
	}
	FOR(i,0,n){
		if(cnt[i]==0)root=i;
	}
}
void Preorder(int i=root){
	cout << ' ' << i;
	if(~tree[i].first)Preorder(tree[i].first);
	if(~tree[i].second)Preorder(tree[i].second);
}
void Inorder(int i=root){
	if(~tree[i].first)Inorder(tree[i].first);
	cout << ' ' << i;
	if(~tree[i].second)Inorder(tree[i].second);
}
void Postorder(int i=root){
	if(~tree[i].first)Postorder(tree[i].first);
	if(~tree[i].second)Postorder(tree[i].second);
	cout << ' ' << i;
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> n;
	FOR(i,0,n){
		int x;
		cin >> x;
		cin >> tree[x].first >> tree[x].second;
	}
	FindRoot();
	cout << "Preorder\n";
	Preorder();
	cout << "\nInorder\n";
	Inorder();
	cout << "\nPostorder\n";
	Postorder();
	cout << '\n';

}


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

def blue(n, a, b):
  res = 0
  s = n // (a+b)
  res += a*s
  n -= s*(a+b)
  if n <= a:
    res += n
  else:
    res += a
  return res

print(blue(N, A, B))

Measured memory_bytes: 3060
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

var grid [][]string

func main() {
	sc.Split(bufio.ScanWords)

	H := nextInt()
	W := nextInt()

	grid = make([][]string, H+2)

	for i := 0; i < H+2; i++ {
		grid[i] = make([]string, W+2)
		for j := 0; j < W+2; j++ {
			grid[i][j] = "@"
		}
	}

	for i := 1; i < H+1; i++ {
		line := nextLine()
		for j, l := range strings.Split(line, "") {
			grid[i][j+1] = l
		}
	}

	// fmt.Println(grid)

	// for i := 0; i < H+2; i++ {
	// 	for j := 0; j < W+2; j++ {
	// 		fmt.Print(grid[i][j])
	// 	}
	// 	fmt.Println()
	// }

	can := true

	for i := 1; i < H+1; i++ {
		for j := 1; j < W+1; j++ {
			if grid[i][j] == "." {
				continue
			}

			if !(grid[i+1][j] == "#" || grid[i-1][j] == "#" || grid[i][j-1] == "#" || grid[i][j+1] == "#") {
				can = false
			}

		}
	}

	if can {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 768
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int gi(){
	int x=0,w=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')w=0,ch=getchar();
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
#define ll long long
const int N=2e5+5;
int n,q,lst;ll add;
struct data{
	ll x,y,z;
	data(){x=y=z=1ll<<60;}
	data(ll _x,ll _y,ll _z){x=_x,y=_y,z=_z;}
	data operator + (const data &b)const{return data(min(x,b.x),min(y,b.y),min(z,b.z));}
}t[N<<2];
void modify(int x,int l,int r,int p,ll v){
	if(l==r){t[x]=t[x]+data(v,v-p,v+p);return;}int mid=l+r>>1;
	p<=mid?modify(x<<1,l,mid,p,v):modify(x<<1|1,mid+1,r,p,v);
	t[x]=t[x<<1]+t[x<<1|1];
}
data query(int x,int l,int r,int ql,int qr){
	if(l>=ql&&r<=qr)return t[x];int mid=l+r>>1;data res=data();
	if(ql<=mid)res=res+query(x<<1,l,mid,ql,qr);
	if(qr>mid)res=res+query(x<<1|1,mid+1,r,ql,qr);
	return res;
}
void dfs(int x,int l,int r){
	if(l==r){
		if(t[x].x==1ll<<60)printf("inf ");
		else printf("%lld ",t[x].x+add);
		return;
	}int mid=l+r>>1;
	dfs(x<<1,l,mid);dfs(x<<1|1,mid+1,r);
}
int main(){
	n=gi();q=gi();lst=gi();modify(1,1,n,gi(),0);
	while(q--){
		int now=gi();
		ll v=min(query(1,1,n,1,now).y+now,query(1,1,n,now,n).z-now)+add;
		add+=abs(now-lst);modify(1,1,n,lst,v-add);lst=now;
	}
	printf("%lld\n",t[1].x+add);return 0;
}


Measured memory_bytes: 18944
N=int(input())
A=[]
MAX=0
for _ in range(N):
    A.append(int(input()))
    if MAX<A[-1]:
        MAX=A[-1]
count=0
for i in range(N):
    if A[i]==MAX:
        count+=1
for j in range(N):
    if A[j]==MAX and count==1:
        A[j]=0
        print(max(A))
    else:
        print(MAX)

Measured memory_bytes: 12532
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;cin>>n;
  double sum=0;
  for(int i=0;i<n;i++){
    double k;
    string s;
    cin >> k >> s;
    if(s == "JPY") sum += k;
    else sum += k*380000;
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int time;
    bool have[4][14]={0};
    cin>>time;
    int ctoi[256];
    ctoi['S'] = 0;
    ctoi['H']=1;
    ctoi['C']=2;
    ctoi['D']=3;
    char itoc[4];
    itoc[0]='S';
    itoc[1]='H';
    itoc[2]='C';
    itoc[3]='D';
    for(int i=0;i<time;++i){
        char mark;
        int num;
        cin>>mark>>num;
        have[ctoi[mark]][num]=true;
    }
    
    for(int i=0;i<4;++i){
        for(int j=1;j<=13;++j){
            if(have[i][j]==false){
                cout<<itoc[i]<<" "<<j<<endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <sstream>
#include <bitset>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

typedef long long ll;

using namespace std;

int main() {
    
    ll n;
    cin >> n;
    vector<ll> a(n);
    FOR(i, 0, n){
        cin >> a[i];
    }
    
    ll cnt=0;
    ll l=0,r=0;
    ll tmp=0;
    while (r<n) {
        if((tmp+a[r]) == (tmp^a[r])){
            tmp += a[r];
            r++;
            cnt += r-l;
        }else{
            tmp = tmp - a[l];
            l++;
        }
    }
    
    cout << cnt << endl;
    return 0;
}


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

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
template<int SIZE>
class UF{
    vector<int> size,data;
    public:
    UF():size(SIZE,1),data(SIZE){iota(data.begin(),data.end(),0);}
    int operator[](int x){return (x==data[x])?x:data[x] = operator[](data[x]);}
    int operator()(int x,int y){
        x = operator[](x);y = operator[](y);
        if(x == y)return x;
        if(x > y)swap(x,y);
        size[x] = size[y] = size[x] + size[y];
        return data[y] = x;
    }
    int count(int x){return size[operator[](x)];}
};
UF<100050> uf;
vector<int> E[100050];
vector<int> B[100050];
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n,m,k;
    cin>>n>>m>>k;
    
    for(int i=0;i<m;++i){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        E[a].push_back(b);
        E[b].push_back(a);
        uf(a,b);
    }
    for(int i=0;i<k;++i){
        int c,d;
        cin>>c>>d;
        c--;d--;
        B[c].push_back(d);
        B[d].push_back(c);
    }
    vector<int> ret(n);
    for(int i=0;i<n;++i){
        int count = uf.count(i) - 1 - E[i].size();
        for(auto cur : B[i]){
            if(uf[cur] == uf[i])count--;
        }
        ret[i] = count;
    }
    for(int i=0;i<n;++i){
        if(i) cout << ' ';
        cout << ret[i];
    }
    return 0;
}

Measured memory_bytes: 13048
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();

    if (N < M) {
      for (int i = 0; i < M; i++) {
        System.out.print(N);
      }
    } else if (M < N) {
      for (int j = 0; j < N; j++) {
        System.out.print(M);
      }
    } else {
      for (int k = 0; k < N; k++) {
        System.out.print(N);
      }
    }
  }
}

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

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

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

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

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

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

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

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

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N; cin >> N;
    vec<lint> P_list(N);
    range(i, 0, N) cin >> P_list.at(i);
    vec<lint> cLIS(N + 1, 0);
    for (const auto& P : P_list) cLIS.at(P) = cLIS.at(P - 1) + 1;
    lint max_len = 0;
    for (const auto& len : cLIS) max_len = max(max_len, len);
    cout << N - max_len << "\n";
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s1;
  int ans=0;
  cin >> s1;
  if(s1[0]=='1')ans++;
  if(s1[1]=='1')ans++;
  if(s1[2]=='1')ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256
use std::io;
fn get_parms() -> Vec<u32> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).expect("Stdin error");
    return buf
        .split_whitespace()
        .map(|x| x.parse().expect("Parse failed"))
        .collect();
}

fn main() {
    let parms = get_parms();
    let (width, length) = (parms[0], parms[1]);
    println!("{} {}", width * length, 2 * (width + length));
}



Measured memory_bytes: 5028
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

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

   if(s[0]=='S'){
       cout<<"Cloudy"<<endl;
   }else if(s[0]=='C'){
       cout<<"Rainy"<<endl;
   }else{
       cout<<"Sunny"<<endl;
   }   
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<iomanip>
using namespace std;

int main(){
	long long n,m;
	cin >> n >> m;
	vector<int> a(m);
	long long sum=0;
	for(long long i=0;i<m;i++){
		cin >> a[i];
		sum+=a[i];
	}
	long long ans=n-sum;
	if(ans<0)ans=-1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3648
from copy import copy
from string import ascii_lowercase


s = list(input())
ans = len(s)
for c in ascii_lowercase:
    t = copy(s)
    for i in range(len(s), 0, -1):
        if t == [c] * i:
            ans = min(ans, len(s) - i)
            break
        u = copy(t[:-1])
        for j in range(i - 1):
            if t[j] == c or t[j + 1] == c:
                u[j] = c
            else:
                u[j] = t[j]
        t = u
print(ans)

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

int dp[15];
int p[105][12];
vector<int>data[10];
int n;
int MIN=1<<31;

int dfs(int now,string open,int sum){

  if(now==9){
    int c[105];
    int cnt=0;
    memset(c,0,sizeof(c));
    
    for(int i=0;i<10;i++){
      if(open[i]=='1'){
        for(int j=0;j<data[i].size();j++){
          c[data[i][j]]++;
        }    
      }
      else
        cnt++;
    }
    
    if(cnt==10)
      return MIN;
    for(int i=0;i<n;i++){
      sum+=p[i][c[i]];
    }
    return sum;
  }

  return max(dfs(now+1,open+'1',sum),dfs(now+1,open+'0',sum));
}
main(){
  int temp;
  
  cin >> n;
  for(int i=0;i<n;i++){
    for(int j=0;j<10;j++){
      cin >> temp;
      if(temp==1)
        data[j].push_back(i);
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<=10;j++){
      cin >> p[i][j];
      dp[j]=MIN;
    }
  }

  int ans=max(dfs(0,"0",0),dfs(0,"1",0));
  
  cout << ans << endl;

  return (0);
  
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
        int i,j,N,S,c=0;
        int A[100];
        scanf("%d",&N);

        for (i=0; i<N; i++) {
                scanf("%d",&A[i]);
        }
        for(j=0; j<N; j++) {
                for(i=N-1; i>0; i--) {
                        if(A[i]<A[i-1]) {
                                S=A[i-1];
                                A[i-1]=A[i];
                                A[i]=S;
                                c++;
                        }
                }
        }
        for(i=0; i<N-1; i++) {
                printf("%d ",A[i]);
        }
        printf("%d\n",A[i]);
        printf("%d\n",c);
        return 0;
}



Measured memory_bytes: 2728
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string.h>
#include <vector>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <queue>
using namespace std;
typedef unsigned long long ui64;
typedef long long i64;
void TimeLimitExceeded() {
	int n, t;
	cin >> n >> t;
	int res = 10000;
	for (size_t i = 0; i < n; i++)
	{
		int c, v;

		cin >> c >> v;
		if (v <= t) {
			res = min(res, c);
		}
	} 
	cout << (res == 10000 ? "TLE" : to_string(res)) << "\n";

}
 int main() {
	 TimeLimitExceeded();
	 return 0;
}

Measured memory_bytes: 256
package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)
)

func main() {
	defer writer.Flush()
	var c string
	fmt.Fscanf(reader, "%s\n", &c)
	if c == "a" || c == "i" || c == "u" || c == "e" || c == "o" {
		fmt.Fprintf(writer, "%s\n", "vowel")
		return
	}
	fmt.Fprintf(writer, "%s\n", "consonant")
}


Measured memory_bytes: 640
import java.util.*;

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

        int n = sc.nextInt();
        Map<String, Integer> s = new HashMap<>();
        for(int i=0; i<n; i++) {
            String tmp = sc.next();
            if(s.containsKey(tmp)) {
                s.put(tmp, s.get(tmp)+1);
            } else {
                s.put(tmp, 1);
            }
        }

        if(s.get("AC")!=null) {
            System.out.println("AC" + " x " + s.get("AC"));
        } else {
            System.out.println("AC" + " x " + "0");
        }
        if(s.get("WA")!=null) {
            System.out.println("WA" + " x " + s.get("WA"));
        } else {
            System.out.println("WA" + " x " + "0");
        }
        if(s.get("TLE")!=null) {
            System.out.println("TLE" + " x " + s.get("TLE"));
        } else {
            System.out.println("TLE" + " x " + "0");
        }
        if(s.get("RE")!=null) {
            System.out.println("RE" + " x " + s.get("RE"));
        } else {
            System.out.println("RE" + " x " + "0");
        }

    }
}


Measured memory_bytes: 58792
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int n;
  cin >> n;
  vi a(n);
  REP(i, n) { cin >> a[i]; }
  int ma = 0;
  int mai = -1;
  REP(i, n) {
    if (ma < a[i]) {
      ma = a[i];
      mai = i;
    }
  }
  int r = mai == 0 ? a[1] : a[0];
  REP(i, n) {
    if (i == mai)
      continue;
    if (abs(ma / 2 - r) > abs(ma / 2 - a[i])) {
      r = a[i];
    }
  }
  cout << ma << " " << r << endl;
}


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

using namespace std;

#define PI 3.14159265358979323846264338327950L

int main(void) {

	long long n, tmp;
	map<long long, long long> A;
	long long ans = 0;
	map<long long, long long> max_bottomup, max_topdown, min_bottomup, min_topdown, max_node;

	cin >> n;
	for (int i = 0; i <= n; i++) {
		cin >> tmp;
		A[i] = tmp;
	}

	for (int i = n; i >= 0; i--) {
		max_bottomup[i] = max_bottomup[i + 1] + A[i];
		min_bottomup[i] = (min_bottomup[i+1] + 1) / 2 + A[i];
	}

	if (min_bottomup[0] > 1 || max_bottomup[0] < 1) {
		cout << -1 << endl;
		return 0;
	}


	max_topdown[0] = 1;
	for (int i = 1; i <= n; i++) {
		max_topdown[i] = min((max_topdown[i - 1]-A[i-1]) * 2, max_bottomup[i]);
	}

	for (int i = 0; i <= n; i++) {
		ans = ans + max_topdown[i];
	}



	cout << ans << endl;



	return 0;
}



Measured memory_bytes: 28648
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
const double pi = 3.1415926535;
int main(){
	
	int a,b,h,m; cin>>a>>b>>h>>m;
	h *= 5;
	double h0 = h + 5.0*m/60;
	cout << fixed << setprecision(10);
	double c = abs(h0-m);
	if(c>30) c = 60 - c;  
	cout << sqrt(a*a+b*b-2*a*b*cos(c*6/180*pi)) << endl;
	
}



Measured memory_bytes: 4060
#include <bits/stdc++.h>
#include <bitset>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S, T;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main(){
    cin>>S;
    S.push_back('A');
    N = S.size();
    rep(i,N - 1){
        if(S[i] == S[i+1]){
            cout<<i+1<<' '<<i+2<<endl;
            return 0;
        }
        if(S[i] == S[i+2]){
            cout<<i+1<<' '<<i+3<<endl;
            return 0;
        }
    }
    cout<<"-1 -1"<<endl;
}

Measured memory_bytes: 512
function Main(input) {
	const temps = input.split(' ');
	const product　= parseInt(temps[0],10) * parseInt(temps[1], 10);
	if(product % 2 === 0) {
		console.log('Even');
	}else {
		console.log('Odd');
	}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#![allow(unused)]
use std::io::{self, Read};

fn get_stdin() -> String {
    let mut buf = String::new();
    let mut stdin = io::stdin();
    stdin.read_to_string(&mut buf);
    return buf
}

fn main() {
    let input = get_stdin();
    let s: i32 = input.trim().parse().unwrap();
    let h = &s / 3600;
    let s = s % 3600;
    let m = &s / 60;
    let s = s % 60;
    println!("{}:{}:{}", h,m,s);
}



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

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

    int a,b,c,k;

    cin>>a>>b>>c>>k;

    int ans = 0;

    ans+=min(a,k);

    k-=ans;
    if(k>0){
        k-=min(b,k);
    }
    if(k>0){
        ans-=min(c,k);
    }

    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;
import java.util.Arrays;

public class Main
{

	public static void main(String[] args)
	{	Scanner s = new Scanner(System.in);
                
                int n=s.nextInt();
                int[] a = new int[n];
                int[] b = new int[100];
                int i=0,sum=0,t=1,r=0;
                float sum1=0;
                for(i=0;i<n;i++){
                   a[i] = s.nextInt();
                }
                for(i=0;i<n-1;i++){
                     
                   if(a[i]==a[i+1]){
                      t++;
                   }else{
                      t = t/2;
                      sum = sum + t;
                    //   System.out.println(t);
                      t=1;
                   }
                   if(i==n-2 && a[i]==a[i+1]){
                      r=1;
                   }

                }
                if(r==1){
                    t = t/2;
                      sum = sum + t;
                }
                System.out.println(sum);
                
                
	}
}

Measured memory_bytes: 21588
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <array>
#include <deque>
#include <bitset>
typedef long long ll;
using namespace std;
#define trace(x) cerr << #x << " is " << x << endl;

int f(int a, int b, int c, int k) {
    if (a >= k) return k;
    if (a < k && a + b >= k) {
        return a;
    }
    if (a + b < k && a + b + c >= k) {
        return a - (k - (a + b));
    }
    return a - c;
}

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

    int a, b, c, k;
    cin >> a >> b>>c >> k;
    cout << f(a, b, c, k) <<endl;

    return 0;
}


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

using namespace std;

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

    string s;
    cin >> s;

    int count = 0;
    int s_i = 0;
    while(true) {
        s_i = s.find("ABC", s_i);
        if (s_i == string::npos) {
            break;
        }
        else {
            count++;
            s_i += 2;
        }
    }

    cout << count << endl;    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    long long sum = 0;
    for(int i = 0; i < S.size(); i++){
        sum += S[i] - '0';
    }
    if(sum % 9 == 0){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3756
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a=0, b = 0,c,d, n, k;
string s, t;


int main()
{
	cin >> n ;
	vector<int64_t> a(n + 1), b(n);
	rep(i, n + 1)
		cin >> a.at(i);
	rep(i, n)
		cin >> b.at(i);
	int64_t sum = 0;
	rep(i,n)
	{
		if (b.at(i) > a.at(i) + a.at(i + 1))
		{
			sum += a.at(i) + a.at(i + 1);
			a.at(i + 1) = 0;
		}
		else
		{
			sum += b.at(i);
			if(a.at(i)<b.at(i))
				a.at(i + 1) = a.at(i) + a.at(i + 1) - b.at(i);
		}

	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef long long ll;
typedef unsigned long long ull;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); i++ )
#define UREP( i, m, n ) for ( unsigned int i = (unsigned int)( m ); i < (unsigned int)( n ); i++ )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define RALL( c ) (c).rbegin(), (c).rend()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

int main()
{
	while ( true )
	{
		int n;
		cin >> n;

		if ( n == 0 )
		{
			break;
		}

		map<int, ull> tmp;
		vector<int> nums;

		REP( i, 0, n )
		{
			int no, price, num;
			cin >> no >> price >> num;

			if ( tmp[ no ] == 0 )
			{
				nums.PB( no );
			}

			tmp[no] += price * num;
		}

		bool flag = false;

		REP( i, 0, nums.size() )
		{
			if ( 1000000 <= tmp[ nums[i] ] )
			{
				cout << nums[i] << endl;
				flag = true;
			}
		}

		if ( !flag )
		{
			cout << "NA" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
#include <utility>
#include <cstdlib>

#define MOD 1000000007

using namespace std;
typedef  long long ll;

int main(){
    int a,b,c;
    double d;
    cin>>a>>b;
    if(a>b){swap(a,b);}
    c=(a+b)/2;
    d=(a+b)/2.0;
    if(c==d){
         cout<<c<<endl;
    }
    else{
        cout<<"IMPOSSIBLE"<<endl;
    }
   
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

struct edge{int to, id;};

const int MAX_N = 2e5;
vector<bool> used(MAX_N+1, false);
vector<edge> es[MAX_N+1];
//num[i]:=頂点iを通る辺を使う回数の偶奇
vector<int> num(MAX_N+1, 0), cnt(MAX_N+1, 0);
vector<int> ans;

//自分より下の部分木でnumが奇数のものの数
int dfs(int now){
    used[now] = true;
    cnt[now] = num[now];
    for(auto &e: es[now]){
        if(used[e.to]) continue;
        int k = dfs(e.to);
        cnt[now] ^= k;
        if(k&1) ans.pb(e.id);
    }
    return cnt[now];
}

int main(){
    int N, M;
    cin >> N >> M;
    int A[N+1], B[N+1];
    pii p[N+1];
    A[0] = -inf, B[0] = 0;
    rep2(i, 1, N) cin >> A[i] >> B[i];
    rep(i, N+1){
        p[i] = pii(A[i], i);
    }
    sort(p, p+N+1);
    vector<int> pos;
    rep(i, N+1){
        pos.pb(p[i].first);
    }
    int L[M], R[M];
    rep(i, M){
        cin >> L[i] >> R[i];
        L[i] = lower_bound(all(pos), L[i])-pos.begin()-1;
        R[i] = upper_bound(all(pos), R[i])-pos.begin()-1;
        es[L[i]].emplace_back((edge){R[i], i+1});
        es[R[i]].emplace_back((edge){L[i], i+1});
    }
    int sum = 0;
    rep3(i, N, 0){
        num[i] = B[p[i].second]^sum;
        sum ^= num[i];
    }
    rep(i, N){
        if(used[i]) continue;
        //木の根をiとしている
        int j = dfs(i);
        if(i != 0 && (j&1)){
            cout << -1 << endl;
            return 0;
        }
    }
    sort(all(ans));
    cout << ans.size() << endl;
    for(auto &e: ans) cout << e << ' ';
    cout << endl;
}

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

int main() {
    ll A, B;
    cin >> A >> B;
    ll res;
    if(A%2) {
        if(B%2) {
            res = A^(((B-A)/2)%2);
        } else {
            res = A^B^(((B-A-1)/2)%2);
        }
    } else {
        if(B%2) {
            res = ((B-A+1)/2)%2;
        } else {
            res = B^(((B-A)/2)%2);
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>
#include<stack>
#include<queue>
#include<iostream>
#define M -1
using namespace std;
int dp[101][10001];
int value[101],weight[101];
int main(void)
{
	int n,w,i,j;
	cin>>n>>w;
	for(i=0;i<n;i++) cin>>value[i]>>weight[i];
	for(i=0;i<n;i++) {
		for(j=0;j<=w;j++) dp[i][j]=M;
	}
	dp[0][0]=0;
	for(i=0;i<n;i++) {
		for(j=0;j<=w;j++) {
			if(dp[i][j]!=M) {
				dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
				if(j+weight[i]<=w) {
					dp[i+1][j+weight[i]]=max(dp[i][j]+value[i],dp[i+1][j+weight[i]]);
				}
			}
		}
	}
	int mx=-1;
	for(i=0;i<=w;i++) if(mx<dp[n][i]) mx=dp[n][i];
	cout << mx << endl;
	exit(0);
}

Measured memory_bytes: 5108
# coding: utf-8
# Your code here!
A,B,C,D=map(int,input().split())
A-=1

def gcd(a,b):
    ans=1
    for i in range(1,int(min(a,b)**0.5)+1):
        
        if a%i==0 and b%i==0:
            ans=max(ans,i)
        temp=min(a,b)//i
        if a%temp==0 and b%temp==0:
            ans=max(ans,temp)
    return ans

num1=A-A//C-A//D+(A//(C*D//gcd(C, D)))
num2=B-B//C-B//D+(B//(C*D//gcd(C, D)))

print(num2-num1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const int mod = 1e9+7;
const int N = 1e5+5;
int a[N];

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    string s;

    cin >> s;

    int a = s[0]-'0', b = s[1]-'0', c = s[2]-'0', d = s[3]-'0';

    if (a+b+c+d == 7) cout << a << "+" << b << "+" << c << "+" << d << "=7";
    else if (a+b+c-d == 7) cout << a << "+" << b << "+" << c << "-" << d << "=7";
    else if (a+b-c+d == 7) cout << a << "+" << b << "-" << c << "+" << d << "=7";
    else if (a+b-c-d == 7) cout << a << "+" << b << "-" << c << "-" << d << "=7";
    else if (a-b+c+d == 7) cout << a << "-" << b << "+" << c << "+" << d << "=7";
    else if (a-b-c+d == 7) cout << a << "-" << b << "-" << c << "+" << d << "=7";
    else if (a-b-c-d == 7) cout << a << "-" << b << "-" << c << "-" << d << "=7";
    else if (a-b+c-d == 7) cout << a << "-" << b << "+" << c << "-" << d << "=7";

    return 0;
}


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

const int N = 200010;

struct Edge {
    int nex, v;
}edge[N << 1]; int tp;

int n, e[N], sg[N], f[N], Ans;

inline void add(int x, int y) {
    edge[++tp].v = y;
    edge[tp].nex = e[x];
    e[x] = tp;
    return;
}

void DFS(int x, int fa) {
    int a = 1, b = 0;
    for(int i = e[x]; i; i = edge[i].nex) {
        int y = edge[i].v;
        if(y == fa) continue;
        DFS(y, x);
        if(a < f[y] + 1) {
            b = a;
            a = f[y] + 1;
        }
        else {
            b = std::max(b, f[y] + 1);
        }
    }
    Ans = std::max(Ans, std::max(a + b - 1, a));
    f[x] = a;
    return;
}

int main() {

    int n;
    scanf("%d", &n);
    for(int i = 1, x, y; i < n; i++) {
        scanf("%d%d", &x, &y);
        add(x, y);
        add(y, x);
    }

    DFS(1, 0);

    /// cal Ans
    sg[1] = 1;
    sg[2] = 0;
    for(int i = 3; i <= Ans; i++) {
        if(std::min(sg[i - 1], sg[i - 2]) == 0) {
            sg[i] = 1;
        }
        else {
            sg[i] = 0;
        }
    }

    if(sg[Ans]) {
        printf("First\n");
    }
    else {
        printf("Second\n");
    }

    return 0;
}


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

int main() {
  int N;
  int a,b,c,d;
  string s;
  cin >> N;
  a = N / 1000;
  b = N / 100 % 10;
  c = N / 10 % 10;
  d = N % 10;
  if (a == b && b == c) {
    s = "Yes";
  }else if (b == c && c == d) {
    s = "Yes";
  }else {
    s = "No";
  }
  cout << s << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int n;

	cin >> n;

	long long int* a;//配列で使用するポインタ

	a = new long long int[n];

	int i;
	long long int input;
	for (i = 0; i < n; i++) {
		cin >> input;
		a[i] = input;
	}

	long long int max;
	long long int min;
	long long int sum;

	max = -1000001;
	min = 1000001;
	sum = 0;

	for (i = 0; i < n; i++) {
		if (a[i] >= max) {
			max = a[i];
		}
		if (a[i] <= min) {
			min = a[i];
		}
		sum = sum + a[i];
	}
	cout << min << " " << max << " " << sum << endl;
	delete[] a;
	return 0;
}


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

int main(){
  stack<int> S1;
  stack<pair<int, int> > S2;
  int S = 0, i = 0, j, a, b;
  char D[20000];

  cin >> D;
  while ( D[i] != '\0' ){
    if ( D[i] == '\\' ) S1.push(i);
    else if ( D[i] == '/' ){
      if ( !S1.empty() ) {
        j = S1.top();
        a = i - j;
        S += a;
        if ( S2.empty() || S2.top().first < j ){
          S2.push(make_pair(j, a));
        } else {
          b = 0;
          while ( !S2.empty() && S2.top().first > j ){
            b += S2.top().second;
            S2.pop();
          }
          b += a;
          S2.push(make_pair(j, b));
        }
        S1.pop();
      }
    }
    i++;
  }
  cout << S << endl;
  cout << S2.size();
  vector<int> p;
  while ( !S2.empty() ){
    p.push_back(S2.top().second);
    S2.pop();
  }
  for ( int cnt = p.size() - 1; cnt >= 0; cnt-- ){
    cout << " " << p[cnt];
  }
  cout << endl;

  return 0;
}

  


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

using namespace std;
typedef long long ll;

const ll inf = 10e16;
const int MAXN = 3*10e5+5;
int A[MAXN];
ll m[MAXN], M[MAXN];
int main()
{
    int N;
    cin>>N;
    for(int i = 0; i < 3*N; i++)
        cin>>A[i];
    
    multiset<int> s1, s2;
    ll sum = 0;
    for(int i = 0; i < 3*N; i++)    {
        int add = A[i], rem = 0;
        s1.insert(A[i]);
        if(s1.size() > N)   {
            rem = *s1.begin();
            s1.erase(s1.begin());
        }
        sum += add - rem;
        if(s1.size() == N)
            M[i] = sum;
        else
            M[i] = -inf;
        //cout<<M[i]<<' ';
    }
    //cout<<endl;
    sum = 0;
    for(int i = 3*N-1; i >= 0; i--) {
        int add = A[i], rem = 0;
        s2.insert(A[i]);
        if(s2.size() > N)   {
            rem = *s2.rbegin();
            s2.erase(--s2.end());
        }
        sum += add - rem;
        if(s2.size() == N)
            m[i] = sum;
        else
            m[i] = inf;
        //cout<<m[i]<<' ';
    }
    //cout<<endl;
    ll ans = -inf;
    for(int i = 0; i < 3*N-1; i++) {   
        ans = max(M[i]-m[i+1], ans);
    }
    cout<<ans<<'\n';   
}

Measured memory_bytes: 21888
from collections import deque

N, K = map(int, input().split())
T = [[] for i in range(N)]
E = []
for i in range(N-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    T[a].append(b)
    T[b].append(a)
    E.append((a, b))


def bfs(n):
    visited = [False] * N
    dist = [0] * N
    queue = deque([n])
    while queue:
        node = queue.pop()
        if visited[node]:
            continue
        visited[node] = True
        for n in T[node]:
            if not visited[n]:
                dist[n] = dist[node] + 1
                queue.appendleft(n)
    return dist


dist = []
for i in range(N):
    dist.append(bfs(i))

ans = float('inf')
if K % 2 == 0:
    # 全ての頂点について全探索
    for i in range(N):
        ans = min(ans, len(list(filter(lambda x: K / 2 < x, dist[i]))))
else:
    # 全ての辺について全探索
    for a, b in E:
        adist = [min(d1, d2) for d1, d2 in zip(dist[a], dist[b])]
        ans = min(ans, len(list(filter(lambda x: (K-1) / 2 < x, adist))))

print(ans)


Measured memory_bytes: 94808
# -*- coding: utf-8 -*-
from sys import stdin

a = [chr(ord('a') + i) for i in range(26)]
# print(a)

dic = {}
for ai in a:
  dic[ai] = 0
#python

b = list(stdin.readline().rstrip())
while len(b) != 0:
  for bi in b:
    if bi.lower() in dic.keys():
      dic[bi.lower()] += 1
  b = list(stdin.readline().rstrip())
  # print(b)
  # print(len(b))

for ai in a:
  print("{0} : {1}".format(ai,dic[ai]))


Measured memory_bytes: 5576
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;	
int a[100004];
int main()
{
	int n,t=0,h=0,s=0;
	int k=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{        
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	for(int i=0;i<n;i++)
	{
	
		if(a[i]==a[i+1])
		{          
		i++;
	
		}
		else 
		h++;
	}
	printf("%d\n",h);
	return 0;
}

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

int n,a[200];
int cal(int v)
{
	int res=0;
	for(int i=0;i<n;++i)
		res+=(v-a[i])*(v-a[i]);
	return res;
}
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;++i)
		scanf("%d",&a[i]);
	int res=(~0u)>>2;
	for(int i=-100;i<=100;++i)
	{
		res=min(res,cal(i));
	}
	printf("%d\n",res);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    int min=10000;
    for(int i=0;i<s.length()-2;i++){
      min=Math.min(Math.abs(753-Integer.parseInt(s.substring(i,i+3))),min);
    }
    System.out.println(min);
  }
}

Measured memory_bytes: 22868
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <math.h>

using namespace std;
int main()
{
    unsigned long long A;
    long double B;
    cin >> A >> B;

    unsigned long long ans = (unsigned long long)(A * B);
    cout << ans << endl;
    return 0;
}


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

string s;
bool ans;
map<char, int> m;

int main(){
cin >> s;
for(int i =0; i<s.size();i ++){
   m[s[i]]++;
}
//ans = ((m['N']!=0)==(m['S']!=0))&&((m['E']!=0)==(m['W']!=0));

if((m['N']>0&&m['S']>0)&&(m['E']>0&&m['W']>0))cout << "Yes";
else if((m['N']>0&&m['S']>0) && (m['E']==0 && m['W']==0))cout << "Yes";
else if((m['N']==0&&m['S']==0) && (m['E']>0 && m['W']>0))cout << "Yes";
else cout << "No";

return 0;}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <map>
using namespace std;
using ll = long long;
using graph = std::vector<std::vector<long long>>;
int main(){
    int N;
    cin >> N;
    ll x[N];
    ll y[N];
    for (int i = 0; i < N; ++i) {
        cin >> x[i] >> y[i];
    }
    map<pair<ll,ll>,ll> m;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            m[make_pair(x[i]-x[j],y[i]-y[j])]++;
        }
    }
    auto begin = m.begin(), end = m.end();
    ll M = 0;
    for (auto iter = begin; iter != end; iter++) {
        // first: key, second: value
       // cout << "key = " << (iter->first).first << "\n";
        //cout << "value = " << iter->second << "\n";
        if(iter->first.first == 0 && iter->first.second == 0){
            continue;
        }
        if(M < iter -> second){
            //cout << "update" << iter -> first.first << "," << iter -> first.second << endl;
        }
        M = max(M,iter->second);
    }
    cout << N - M  << endl;
}

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

const int max_n=3e5+10;
int row[max_n],col[max_n];
vector<int>rr,cc;
set<pair<int,int>>sp;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    int max_r = 0, max_col = 0;
    for (int i = 1; i <= k; ++i) {
        int a, b;
        cin >> a >> b;
        sp.insert(make_pair(a, b));
        row[a]++;
        col[b]++;
        if (max_r < row[a]) {
            max_r = row[a];
            rr.clear();
            rr.push_back(a);
        } else if (max_r == row[a]) {
            rr.push_back(a);
        }
        if (max_col < col[b]) {
            max_col = col[b];
            cc.clear();
            cc.push_back(b);
        } else if (max_col == col[b]) {
            cc.push_back(b);
        }
    }
    for (auto i:rr) {
        for (auto j:cc) {
            if (sp.count(make_pair(i, j)))
                continue;
            else {
                cout << max_col + max_r;
                return 0;
            }
        }
    }
    cout<<max_col + max_r-1;
    return 0;
}

Measured memory_bytes: 21812
# coding: utf-8
# Your code here!
S = input()
N = len(S)

S = S[::-1]
#print(S)
L = ['maerd', 'remaerd', 'esare', 'resare']

while len(S) > 0:
    if S[:5] in L:
        S = S[5:]
    elif S[:6] in L:
        S = S[6:]
    elif S[:7] in L:
        S = S[7:]
    else:
        print('NO')
        break
if len(S) == 0:
    print('YES')

Measured memory_bytes: 135036
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j,k,l;
  int n,s[22050];
  s[0]=2;
  j=1;
  for(i=3;i<250000;i+=2){
    l=(int)sqrt(i)+1;
    for(k=3;k<l;k+=2){
      if(i%k==0)
	break;
    }
    if(k>=l){
      s[j]=i;
      j++;
    }
  }
  while(cin>>n&&n){
    for(i=0;s[i]<=n;i++);
    for(j=i;s[j]<=2*n;j++);
    cout<<j-i<<endl;
  }
  return 0;
}

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

using namespace std;

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

#define TT template<typename T>
TT T    sq(T x){ return x*x; }
TT int  ubnd(vector<T>& v,T x){ return upper_bound(v.begin(), v.end(), x) - v.begin(); }
TT int  lbnd(vector<T>& v,T x){ return lower_bound(v.begin(), v.end(), x) - v.begin(); }
TT void sort(T& v){ sort(v.begin(), v.end()); }
TT void revs(T& v){ reverse(v.begin(), v.end()); }
TT void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end()), v.end()); }
TT void show(T& v,char d=' ',char e='\n'){for(int i=0;i<v.size();++i)cout<<v[i]<<((i==v.size()-1)?e:d);}
TT void inpt(vector<T>& v,int n){ v.reserve(n);for(int i=0;i<n;++i){T x; cin>>x; v.push_back(x);} }
TT T In(){ T x; cin >> x; return x; }

static inline void fast_io(){ ios::sync_with_stdio(0); cin.tie(0); }
static inline int in(){ int x; scanf("%d", &x); return x; }
static inline string instr(){ string x; cin >> x; return x; }
static const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
static const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};

vector<string> split(const string& s, char d)
{
  stringstream ss(s);
  vector<string> vs;
  string token;
  while (getline(ss, token, d)) vs.push_back(token);
  return vs;
}

int main()
{
  fast_io();
  vector<string> table;
  table.push_back(".,!? ");
  table.push_back("abc");
  table.push_back("def");
  table.push_back("ghi");
  table.push_back("jkl");
  table.push_back("mno");
  table.push_back("pqrs");
  table.push_back("tuv");
  table.push_back("wxyz");

  int n;
  cin >> n;
  for (int i = 0; i < n; i++){
    string s;
    cin >> s;
    vector<string> vs = split(s, '0');
    for (int j = 0; j < vs.size(); j++){
      if (!vs[j].size()) continue;
      int tid = vs[j][0] - '1';
      cout << table[tid][(vs[j].size() - 1) % table[tid].size()];
    }
    cout << "\n";
  }
  return (0);
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> L(M);
  vector<int> R(M);
  for (int i = 0; i < M; i++){
    cin >> L.at(i) >> R.at(i);
  }
  sort(L.begin(), L.end());
  reverse(L.begin(), L.end());
  sort(R.begin(), R.end());
  if (L.at(0) > R.at(0)) cout << 0 << endl;
  else cout << R.at(0) - L.at(0) + 1 << endl;
}

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

int main() {

    const ll mod = 1000000007;
    ll n, m; cin >> n >> m;
    ll ans = 1;
    
    
    if (n == 1 && m == 1) {
        ans = 2;
    }
    else if (n == m) {
        ans *= 2;
        ll cnt = n;
        while (cnt--) {
            ans *= n;
            ans %= mod;
            ans *= m;
            ans %= mod;
            n--;
            m--;
        }
    }
    else if (n == m + 1 || n + 1 == m) {
        ll cnt, x;
        if (n == m + 1) {
            ans *= n;
            cnt = m;
            x = m;
        }
        else {
            ans *= m;
            cnt = n;
            x = n;
        }

        while (cnt--) {
            ans *= x;
            ans %= mod;
            ans *= x;
            ans %= mod;
            x--;
        }
    }
    else {
        ans = 0;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*input
4
12 24 6
52 16 4
99 2 2
*/

#include <bits/stdc++.h>
using namespace std;

#define fill(a,val) memset(a, (val), sizeof a)
#define pb push_back
#define lli long long int
#define endl "\n"
#define unique(x) x.erase(unique(x.begin(),x.end()), x.end())
#define      rep(i, n)         for(int i = 0; i < (n); ++i)
#define      FOR(i, a, n)     for(int i = a; i < (n); ++i)
#define      repD(i, a, n)     for(int i = a; i >= (n); --i)

int main(void)
{
  int n; cin>>n;
  int arr[n];
  int i=0;
  int k=n;
  int current = 0;
  int c[n], s[n], f[n];
  for(int i=0; i<n; ++i) cin>>c[i]>>s[i]>>f[i];
  for(int j=0; j<n; ++j){
    current = 0;
    for(int i=j; i<n-1; ++i){
        if(s[i]>current) current =s[i];
        while(current%f[i]!=0) current++;
        current += c[i];
    }
    cout<<current<<"\n";
  }
  return 0;
}


Measured memory_bytes: 256