akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void){
  char s[100000];
  int i,count=0;
  scanf("%s",&s);
  for(i=0;s[i]!='\0';i++){
    if(s[i]==s[i+1]){
      if(s[i]=='1'){
        s[i+1]='0';
        count=count+1;
      }
      else if(s[i]=='0'){
        s[i+1]='1';
        count=count+1;
      }  
    }
  }   
  printf("%d",count);  
  return 0;
}

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

using namespace std;

void Main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

class Program {
  static void Main() {
    var e = Console.ReadLine().Split().Select(int.Parse).GroupBy(x => x);
    var a = new List<int>();
    foreach (var item in e) a.Add(item.Count());
    a = a.OrderBy(x => x).ToList();
    if ((a.Count == 3 && a[0] == 4 && a[1] == 4 && a[2] == 4 )||
        (a.Count == 2 && a[0] == 4 && a[1] == 8) ||
         a.Count == 1) {
      Console.WriteLine("yes");
    } else {
      Console.WriteLine("no");
    }
  }
}


Measured memory_bytes: 18600
def main():
  N, Q = map(int, input().split())
  graph = [[] for i in range(200010)]
  ans = [0 for i in range(200010)]
  import sys
  #sys.setrecursionlimit(100000)
  sys.setrecursionlimit(10**7)
  #
  readline = sys.stdin.readline


  for _ in range(N - 1):
      #a, b = map(int, input().split())
      a, b = map(int, readline().split())
      a -= 1
      b -= 1

      graph[a].append(b)
      graph[b].append(a)

  for _ in range(Q):
      #p, x = map(int, input().split())
      p, x = map(int, readline().split())
      p -= 1

      ans[p] += x

  def dfs(node, frm=-1):
      for to in graph[node]:
          if to == frm:
              continue
          ans[to] += ans[node]
          dfs(to, node)
  dfs(0)

  print(*ans[:N])

if __name__ == '__main__':
  main()

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


Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define INF 9999999999

int main(){
  int n;
  ll x;
  cin >> n >> x;
  ll a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  ll ans=0;
  for(int i=0;i<n-1;i++){
    ll s = a[i] + a[i+1];
    if (s > x){
      ll d = s - x;
      if (a[i+1] >= d){
        a[i+1] -= d;
      }else{
        a[i+1] = 0;
      }
      ans += d;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int x, y;
    int num = 1;
    while (1)
    {
        cin >> x >> y;

        if (x == 0 && y == 0)
            break;
        printf("%d %d\n", min(x, y), max(x, y));
    }
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char c[100][100];
    int a[100][100]={0},n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
        {
            cin>>c[i][j];
            if(c[i][j]=='#')
            {
                a[i][j]=-10;
                if(i-1>=0&&j-1>=0) a[i-1][j-1]++;
                if(i-1>=0) a[i-1][j]++;
                if(j-1>=0) a[i][j-1]++;
                if(i+1<n&&j-1>=0) a[i+1][j-1]++;
                if(i-1>=0&&j+1<m) a[i-1][j+1]++;
                if(i+1<n&&j+1<m) a[i+1][j+1]++;
                if(i+1<n) a[i+1][j]++;
                if(j+1<m) a[i][j+1]++;
            }
        }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
        	if(c[i][j]!='#') cout<<a[i][j];
            else cout<<"#";
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,i;
	int nin,ryo;
	char s[3];
	for(i=0;i<9;i++){
		scanf("%s %d %d",&s,&a,&b);
		nin=a+b;
		ryo=a*200+b*300;
		printf("%s %d %d\n",s,nin,ryo);
	}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstring>

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

using namespace std;

class Dice {
private:
    vector<int> num, i_num;

public:
    enum FACE {TOP, FRONT, RIGHT, LEFT, BACK, BOTTOM}; 
    enum MOVE {TOP_TO_FRONT, TOP_TO_RIGHT, TOP_TO_LEFT, TOP_TO_BACK, FRONT_TO_LEFT, FRONT_TO_RIGHT};

    const int tb[6][4] = {
        {FRONT, TOP, BACK, BOTTOM},
        {RIGHT, TOP, LEFT, BOTTOM},
        {LEFT, TOP, RIGHT, BOTTOM},
        {BACK, TOP, FRONT, BOTTOM},
        {LEFT, FRONT, RIGHT, BACK},
        {RIGHT, FRONT, LEFT, BACK}
    };

    Dice() 
    { 
        num.assign(6, -1);
        i_num.resize(6);
        i_num = {1, 3, 5, 2, 4, 6};
    }

    Dice(int t, int f) 
    {
        num.resize(6), i_num.resize(6);
        i_num = {1, 3, 5, 2, 4, 6};
        roll(t, f);
    }

    void set_identity(vector<int> i) { num = i_num = i; }

    int top() {return num[TOP];}
    int bottom() {return num[BOTTOM];}
    int right() {return num[RIGHT];}
    int left() {return num[LEFT];}
    int front() {return num[FRONT];}
    int back() {return num[BACK];}
    int get(FACE f) { return num[f]; }

    void rotate(int move)
    {
        int tmp = num[tb[move][0]];
        rep(i, 3) num[tb[move][i]] = num[tb[move][i+1]];
        num[tb[move][3]] = tmp;
    }
    
    bool roll(int t, int f)
    {
        num = i_num;
        for (int j=0; j<6; j++) {
            for (int i=0; i<4; i++) {
                if (num[0] == t && num[1] == f) return true;
                rotate(FRONT_TO_RIGHT);
            }
            if (j%2) rotate(TOP_TO_FRONT);
            else rotate(TOP_TO_RIGHT);
            if (num[0] == t && num[1] == f) return true; // ???????
        }
        return false;
    }

    void print()
    {
        cerr << "[" << num[0] << ", " << num[FRONT] << ", " 
            << num[RIGHT] << "]" << endl;
    };

    bool operator == (const Dice &other) { return num == other.num; }
};

int main()
{
    Dice d1, d2;

    vector<int> num(6);
    rep(i, 6) cin >> num[i];
    d1.set_identity(num);
    rep(i, 6) cin >> num[i];
    d2.set_identity(num);

    bool ans = false;
    for (int i=0; i<6; i++) {
        for (int j=0; j<4; j++) {
            d1.rotate(d1.FRONT_TO_RIGHT);
            ans |= (d1 == d2);
        }
        if (i%2) d1.rotate(d1.TOP_TO_RIGHT);
        else d1.rotate(d1.TOP_TO_FRONT);
        ans |= (d1 == d2);
    }
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3156
trial = int(input())
graph = []
for t in range(trial):
    graph.append([int(n) for n in input().split(" ")])
root = []
ans = []
stack = [[0,0]]
cnt = 0
while len(stack) > 0:
    index,out = stack[0][0],stack[0][1]
    for get in range(graph[index][1]):
        if graph[index][get*2 + 2] not in root:
            stack.append([graph[index][get*2 +2],graph[index][get*2 +3] + out ])
    if stack[0][0] not in root:
        root.append(stack[0][0])
        ans.append([stack[0][0],stack[0][1]])
    stack.pop(0)
    stack = sorted(stack,key=lambda x:x[1])
ans = sorted(ans,key=lambda x:x[0])
for a in range(trial):
    print(str(ans[a][0]) + " " + str(ans[a][1]))

Measured memory_bytes: 8356
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <regex>

#define FOR(i,x,y) for(int i=(x);i<(y);i++)
#define RFOR(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define REP(i,x) for(int i=0;i<(x);i++)
#define RREP(i,x) for(int i=(x)-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...) 42
#define dump(x) 42
#define debug(x) 42
#endif

typedef long long ll;

using namespace std;

const int MAX_N = 100000;
int N,x;
int a[MAX_N];

int solve() {
    int ans = 0;
    REP(i,N-1){
        while(a[i] + a[i+1] > x){
            int diff;
            if(a[i+1] > 0){
                diff = min(a[i] + a[i+1] - x, a[i+1]);
                a[i+1] -= diff;
            }
            else{
                diff = min(a[i] + a[i+1] - x, a[i]);
                a[i] -= diff;
            }
            ans += diff;
        }
    }
    return ans;
}

signed main() {
    // to shorten execution time for iostream
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> x;
    REP(i,N) cin >> a[i];
    cout << solve() << "\n";
}


Measured memory_bytes: 1024
use std::io::stdin;
fn get_string() -> String {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

macro_rules! input {
    ($single:ty) => ( get_string().parse::<$single>().ok().unwrap() );
    ($($plural:ty),+) => ({
        let line = get_string();
        let mut iter = line.split_whitespace();
        ($(iter.next().unwrap().parse::<$plural>().ok().unwrap()),+)
    });
    ($single:ty; $times:expr) => ( (0..$times).map(|_| input!($single)).collect::<Vec<$single>>() );
    ($($plural:ty),+; $times:expr) => ( (0..$times).map(|_| input!($($plural),+)).collect::<Vec<($($plural),+)>>() );
}

#[allow(dead_code)]
fn get_value<T: std::str::FromStr>() -> T {
    get_string().parse().ok().unwrap()
}
#[allow(dead_code)]
fn get_values_for<T: std::str::FromStr>(times: u64) -> Vec<T> {
    (0..times).map(|_| get_value()).collect()
}
#[allow(dead_code)]
fn get_vector<T: std::str::FromStr>() -> Vec<T> {
    get_string()
        .split_whitespace()
        .map(|v| v.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn get_vectors_for<T: std::str::FromStr>(times: u64) -> Vec<Vec<T>> {
    (0..times).map(|_| get_vector()).collect()
}

fn main() {
    let (a, b) = input!(u32, u32);
    if a <= 8 && b <= 8 {
        println!("Yay!");
    } else {
        println!(":(");
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

using ll = long long;
using ull = unsigned long long;
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

constexpr int INF = 1e9+7;
constexpr ll INFL = 9*1e18;

constexpr int dx[4] = { 1, 0, -1, 0 };
constexpr int dy[4] = { 0, 1, 0, -1 };

// constexpr int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
// constexpr int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

int inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T>inline void print(T&& x){cout<<setprecision(32)<<x<<endl;}


// TODO: write
int main() {
  int n;cin>>n;
  vector<int> a(n);rep(i,n)cin>>a[i];

  int sum = SUM(a);
  int tmp = 0;
  int ans = INF;
  rep(i,n){
    chmin(ans,abs(sum - tmp*2));
    tmp += a[i];
    chmin(ans,abs(sum - tmp*2));
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 3628
import sys
sys.setrecursionlimit(1<<20)
h,w=[int(x) for x in input().split()]
ch,cw=[int(x) for x in input().split()]
dh,dw=[int(x) for x in input().split()]
ch-=1
cw-=1
dh-=1
dw-=1

s=[]
for _ in range(h):
    s.append(list(input()))

nxt=[[ch,cw,0]]
#再起
def rcl(y,x,now):
    
    if y==dh and x==dw:
        print(now)
        exit()
    
    if s[y][x]=='#':
        return
    
    s[y][x]='#'
    # 四方を見る
    for i in range(4):
        yy,xx=-1,0
        if i==1:yy,xx=0,1
        if i==2:yy,xx=1,0
        if i==3:yy,xx=0,-1
        
        if y+yy<0 or h<=y+yy or x+xx<0 or w<=x+xx:
            continue
        if s[y+yy][x+xx]=='#':
            continue
        
        rcl(y+yy,x+xx,now)
    #5*5
    for i in range(-2,3):
        for j in range(-2,3):
            if i==0 and j==0:
                continue
            if y+i<0 or h<=y+i or x+j<0 or w<=x+j:
                continue
            if s[y+i][x+j]=='.':
                nxt.append([y+i,x+j,now+1])
                s[y+i][x+j]=now+1


idx=0
while idx<len(nxt):
    i=nxt[idx]
    idx+=1
    if i[0]==dh and i[1]==dw:
        print(i[2])
        exit()
    rcl(i[0],i[1],i[2])
print(-1)


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

int a, b, c, d, e, f, mxa, mxb;
bool vw[3005], vs[3005];
vector<int> w, s;
int main()
{
	int i, j;
	cin >> a >> b >> c >> d >> e >> f;
	mxa = a * 100;
	for (i = 0; i <= f; i += a * 100)
		for (j = 0; i + j <= f; j += b * 100)
			if (!vw[i + j]) vw[i + j] = 1, w.push_back(i + j);
	for (i = 0; i <= f; i += c)
		for (j = 0; i + j <= f; j += d)
			if (!vs[i + j]) vs[i + j] = 1, s.push_back(i + j);
	for (i = 0; i < w.size(); i++) {
		for (j = 0; j < s.size(); j++) {
			if (w[i] + s[j] <= f && w[i] / 100 * e >= s[j] && w[i] > 0) {
				if (mxb * (w[i] + s[j]) < s[j] * mxa) {
					mxa = w[i] + s[j];
					mxb = s[j];
				}
			}
		}
	}
    cout << mxa << ' ' << mxb << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main() {

	int n, k;
	int a[100000];
	int ans = 2;
	bool flag = false;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ans += (n - k) / (k - 1);
	if ((n - k) % (k - 1) == 0)
		ans--;
	cout << ans << endl;

	return 0;
}

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

int c[1000005];
int main(){
    int n;
    cin >> n;
    int a[n+1];
    for(int i=0;i<n;i++)cin >> a[i];
    sort(a,a+n);
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=a[i];j<=a[n-1];j+=a[i])c[j]++;
    }
    for(int i=0;i<n;i++)if(c[a[i]]==1)ans++;
    cout << ans << endl;
}

Measured memory_bytes: 8216
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	cout << 0 << endl;
	string s0;
	cin >> s0;
	if(s0 == "Vacant") return 0;
	int l = 0, r = n - 1;
	while(r - l > 1){
		int mid = (l + r) / 2;
		cout << mid << endl;
		string s;
		cin >> s;
		if(s == "Vacant") return 0;
		if(s == s0){
			if(mid % 2 == 0) l = mid;
			else r = mid;
		} else {
			if(mid % 2 == 0) r = mid;
			else l = mid;
		}
	}
	cout << l << endl;
	string s;
	cin >> s;
	if(s == "Vacant") return 0;
	cout << l + 1 << endl;
	cin >> s;
	return 0;
}

Measured memory_bytes: 852
using System;
using System.Linq;
class A{
static void Main(){
  string str=Console.ReadLine();
  int min=34753;
  for(int i=0;i<str.Length-3+1;i++){
  int u=int.Parse(str.Substring(i,3));
    min=Math.Min(min,Math.Abs(u-753));
  }
  Console.WriteLine(min);
}
}


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

int main(){
  int a,b;
  string result="";
  cin >> a>>b;
  if(a<b){
    for(int i=0;i<b;i++){
      result += to_string(a);
    }
  }else{
    for(int i=0;i<a;i++){
      result += to_string(b);
    }
  }
  cout << result;
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N, K = map(int, input().split())

iniarray = np.arange(1,N+1)
mask1 = iniarray < K
mask2 = 1 - mask1
prob_array = 1/2**np.ceil(np.log2(float(K)/iniarray))
ans = (prob_array * mask1 + mask2).sum() / float(N)

print(ans)

Measured memory_bytes: 20512
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

ll calc_gcd(ll x, ll y) {
    if (y == 0) {
        return x;
    }
    return calc_gcd(y, x % y);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll K;
    cin >> K;
    ll ans = 0;
    rep(a, 0, K) rep(b, 0, K) rep(c, 0, K) {
        ans += calc_gcd(a + 1, calc_gcd(b + 1, c + 1));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    vector<int> sta(3);
    for(int i=0;i<3;i++){
        cin >> sta.at(i);
    }
    sort (sta.begin(),sta.end());
    
    cout << sta.at(0) << " " << sta.at(1) << " " << sta.at(2) << endl;
}


Measured memory_bytes: 3140
# -*- coding: utf-8 -*-
import sys


def main():
    N,K = list(map(int, sys.stdin.readline().split()))
    A_list = list(map(int, sys.stdin.readline().split()))
    

    for i in range(K, len(A_list)):
        if A_list[i] > A_list[i-K]:
            print("Yes")
        else:
            print("No")



if __name__ == "__main__":
    main()


Measured memory_bytes: 31476
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int main(void){
	int N=0,M=0;
	cin>>N>>M;
	int A[M]={0},B,SUM=0;
	for(int i=0;i<M;i++){
		cin>>A[i]>>B;
	}
	sort(A,A+M);
	for(int i=M-1;i>0;i--){
		if(A[i]<N){
			SUM+=N-A[i];
		}
	}
	cout<<SUM<<endl;
	return 0;
}


Measured memory_bytes: 3132
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

int h, m, a, b;
const double PI = 3.141592653589793238462643383;


int main() {
    cin >> a >> b >> h >> m;
    double hourAngle = (double)(30*h)+(0.5*m);
    double minuteAngle = (double)(6*m);
    double angle = ((hourAngle > minuteAngle) ? hourAngle-minuteAngle : minuteAngle-hourAngle);
    angle = min(angle, 360-angle);
    double ans = sqrt((double)(a*a)+(double)(b*b) - (double)(2*a*b*cos(angle*PI/180)));
    cout << fixed << setprecision(10) << ans;
}


Measured memory_bytes: 4132
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <iostream>
using namespace std;
char a[110][110];
int main(){
    int n,m;
    while(~scanf("%d%d",&n,&m)){
        for(int i=0;i<n;i++){
            scanf("%s",a[i]);
        }
        for(int i=0;i<n;i++){
            printf("%s\n",a[i]);
            printf("%s\n",a[i]);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string S, T;
    cin >> S;
    cin >> T;

    // if (S.size() + 1 != T.size())
    // {
    //     cout << "No" << endl;
    //     return 0;
    // }

    bool hasS = true;

    for (int i = 0; i < S.length(); i++)
    {
        if (S.at(i) != T.at(i))
        {
            hasS = false;
            break;
        }
    }

    if (hasS)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#! /usr/bin/env python3

import math

def solve(h, w):

    y = math.floor(h / 2)

    x = 1
    res = 10**12

    while x <= w / 2:
        x2 = math.floor((w - x) / 2) + x
        areas = [x * h, (x2 - x) * h, (w - x2) * h]
        areas.sort()

        diff = areas[2] - areas[0]
        if diff < res:
            res = diff

        areas = [x * h, (w - x) * y, (w - x) * (h - y)]
        areas.sort()

        diff = areas[2] - areas[0]

        if diff < res:
            res = diff
        
        x += 1

    return(res)


h, w = map(int, input().split())

print(min(solve(h, w), solve(w, h)))


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

int main(){
    int n, a, b;
    cin >> n >> a >> b;

    int ans = 0;

    for (int i = 1; i <= n; i++){
        int t = i, sum = 0;
        while(t > 0){
            sum += t % 10;
            t /= 10;
        }
        if (a <= sum && sum <= b) ans += i; 
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;
typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>ar[i];
	sort(ar, ar+n);
	int tp = 0;
	for(int i=0;i<n-2;i++)
	{
		int l=i+1;
		int r=i+2;
		while(r < n)
		{
			if(ar[i] + ar[l] <= ar[r])
			{	
				l++;
				if(r <= l)
				r++;
			}		
			else
			{
				tp += (r-l);
				r++;
			}	
		}	
	}	
	cout<<tp<<"\n";
	return;
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

/*#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif*/

	while(T--)
	solve(T);

/*#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif*/

	return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    N = len(S)

    if (
        S == S[::-1]
        and S[: (N - 1) // 2] == S[: (N - 1) // 2][::-1]
        and S[(N + 1) // 2 :] == S[(N + 1) // 2 :][::-1]
    ):
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()


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

using namespace std;

int main(void) {
  int n; cin >> n;
  int ans[n];
  for (int i = 1; i <= n; i++) {
    int j; cin >> j;
    ans[j-1] = i;
  }
  
  for (int i = 0; i < n; i++) {
    cout << ans[i] << (i != n-1 ? " ": "");
  } cout <<endl;
  
  return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int c = scan.nextInt();
    if(a == b && a != c){
      System.out.println("Yes");
    }else if(a == c && a != b){
      System.out.println("Yes");
    }else if(b == c && b != a){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <queue>

#define DEBUG() std::cerr << __FUNCTION__ << " " << __LINE__ << std::endl

using i64 = long long;

namespace flw {
	const int N = 2500 + 7, M = 400000 + 7;
	struct flow {
		int n, st, ed;
		i64 dis[N];
		int vis[N];
		struct edge {
			int to, nex, cap; i64 wei;
		} e[M];
		int fir[N], cur[N], eid = 1;

		void addedge(int u, int v, int c, i64 w) {
			e[++eid] = (edge){ v, fir[u], c, w }, fir[u] = eid;
		}
		void addflow(int u, int v, int c, i64 w) {
			addedge(u, v, c, w), addedge(v, u, 0, -w);
		}
		int bfs() {
			std::fill(vis + 1, vis + n + 1, 0);
			std::fill(dis + 1, dis + n + 1, 1ll << 60);
			std::copy(fir + 1, fir + n + 1, cur + 1);
			static std::queue<int> q;
			dis[ed] = 0, vis[ed] = 1, q.push(ed);
			for (int s; q.size(); ) {
				s = q.front(), q.pop();
				for (int i = fir[s]; i; i = e[i].nex)
					if (e[i ^ 1].cap && dis[e[i].to] > dis[s] - e[i].wei) {
						dis[e[i].to] = dis[s] - e[i].wei;
						if (!vis[e[i].to]) vis[e[i].to] = 1, q.push(e[i].to);
					}
				vis[s] = 0;
			}
			return dis[st] < 1ll << 60;
		}
		i64 dfs(int s, int f) {
			if (s == ed) return f;
			vis[s] = 1;
			int u = 0, t;
			for (int& i = cur[s]; i; i = e[i].nex) {
				if (!e[i].cap || vis[e[i].to] || dis[s] != dis[e[i].to] + e[i].wei) continue;
				t = dfs(e[i].to, std::min(e[i].cap, f - u));
				e[i].cap -= t, e[i ^ 1].cap += t, u += t;
				if (f == u) break;
			}
			return vis[s] = 0, u;
		}
		i64 dinic() {
			i64 mincost = 0;
			int f;
			while (bfs()) while (f = dfs(st, 1 << 28)) mincost += dis[st] * f;
			return mincost;
		}
	};
}

const int N = 2000 + 7;

int n;
flw::flow f;

int main() {
//	freopen("code.in", "r", stdin);
//	freopen("code.out", "w", stdout);

	scanf("%d", &n);
	f.st = 2 * n + 5, f.ed = f.n = f.st + 1;
	for (int i = 1, x, y, z; i <= n; ++i) {
		scanf("%d%d%d", &x, &y, &z),
		f.addflow(f.st, i, z, 0),
		f.addflow(i, 2 * n + 1, z, x + y),
		f.addflow(i, 2 * n + 2, z, x - y),
		f.addflow(i, 2 * n + 3, z, -x + y),
		f.addflow(i, 2 * n + 4, z, -x - y);
	}
	for (int i = n + 1, x, y, z; i <= 2 * n; ++i)
		scanf("%d%d%d", &x, &y, &z),
		f.addflow(i, f.ed, z, 0),
		f.addflow(2 * n + 1, i, z, -x - y),
		f.addflow(2 * n + 2, i, z, -x + y),
		f.addflow(2 * n + 3, i, z, x - y),
		f.addflow(2 * n + 4, i, z, x + y);
	printf("%lld\n", -f.dinic());

	return 0;
}


Measured memory_bytes: 768
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<string>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll LINF=0x3f3f3f3f3f3f3f3f;
const int INF=0x7f7f7f7f;
vector<int>vec[100010];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    while(m--)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        vec[a].push_back(b);
        vec[b].push_back(a);
    }
    for(int i=1;i<=n;i++)
    {
        if(vec[i].size()%2!=0)
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    return 0;
}


Measured memory_bytes: 5504
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10000000000000
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define rep(i,n)for(ll i=0;i<(n);i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    ll n,q;cin>>n>>q;
    queue<ll>a[1010];
    while(q--){
        int c;cin>>c;
        if(c==0){
            ll t,x;cin>>t>>x;
            a[t].push(x);
        }
        else if(c==1){
            ll t;cin>>t;
            if(a[t].size())
            cout<<a[t].front()<<endl;;
        }
        else{
            ll t;cin>>t;
            if(a[t].size())
            a[t].pop();
        }
    }
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------













































Measured memory_bytes: 5220
//??¨??¢?´¢:??±???????????¢?´¢??????????????¢?´¢ 

//??????????????¢?????¬?????????
 
//?????°??¢??°???????????????(?????????)????????\???(?????????)
#include <stdio.h>
#include <queue>
#include <string.h>
using namespace std;	
int W,H;
char c[101][101];
bool visited[100][100];
 
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
 	
void compute();//????????????????????£?¨? 
	
int main(){
	
	while(scanf("%d %d",&W,&H),W |H){
	    int i;
		
		for(i=0;i<H;i++){
			scanf(" %s",&c[i][0]);
		}
		compute();
	}
	return 0;
}

void compute(){
	
	memset(visited,false,sizeof visited);  //{????????????????????????1bit??????????????????1bit????????§?????????} 
	
	queue<int> que;
	int i,j;
	for(j=0;j<W;j++){ 
	 for(i=0;i<H;i++){
	  if(c[i][j]=='@'){
	  	que.push(j+i*W);
	  	visited[i][j]=true;
	  	 break;
	  }
	 }
	}
  int answer=1;
  while(!que.empty()){
	int cur=que.front();
	        que.pop();
	        int x=cur%W;
	        int y=cur/W;
    

  for(i=0;i<4;i++){
	int nx=x+dx[i],ny=y+dy[i];
	
  
  
  if(!(0<=nx&&nx<W&&0<=ny&&ny<H))continue;
  if(c[ny][nx]=='#'||visited[ny][nx])continue;

  que.push(nx+ny*W);
  visited[ny][nx]=true;
++answer;
    }
   }
 //cout << answer << endl;
 printf("%d\n",answer);
 }

Measured memory_bytes: 1064
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int,int,int,int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 998244353;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[]={2,2,-2,-2,1,1,-1,-1},ddy[]={1,-1,1,-1,2,-2,2,-2};

struct info{
    int u, v;
    info(int a, int b){
        u = a, v = b;
    }
};
int n,m;
iii e[100000];
int par[100001],num[100001];
ll w[100001];
stack<info> st;
Vi vv[100001];
int find(int u){
	if(u==par[u]) return u;
	return find(par[u]);
}
void merge(int u, int v){
	u=find(u),v=find(v);
	if(u==v)
	{
		st.push(info(-1,-1));
		return;
	}
	if (num[u] < num[v])
		swap(u, v);
	st.push(info(u,v));
	par[v] = u;
	num[u] += num[v];
	w[u]+=w[v];
	vv[u].pb(v);
}
void rollback(){
	info I=st.top();
	st.pop();
	if(I.u<0)return;
	par[I.u] = I.u;
	par[I.v] = I.v;
	num[I.u] -= num[I.v];
	w[I.u] -= w[I.v];
	vv[I.u].pop_back();
}
bool chk[100001];
void dfs(int x)
{
	chk[x]=1;
	for(int y:vv[x])dfs(y);
}
int main(){
	scanf("%d%d",&n,&m);
	fup(i,1,n,1)par[i]=i,num[i]=1;
	fup(i,1,n,1)scanf("%lld",w+i);
	fup(i,0,m-1,1)
	{
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		e[i]=iii(z,x,y);
	}
	sort(e,e+m);
	fup(i,0,m-1,1)
	{
		int x,y;
		tie(ignore,x,y)=e[i];
		merge(x,y);
	}
	int ans=0;
	fdn(i,m-1,0,1)
	{
		int z,x,y;
		tie(z,x,y)=e[i];
		if(!chk[x])
		{
			x=find(x);
			if(w[x]>=z)dfs(x);
			else ans++;
		}
		rollback();
	}
	printf("%d",ans);
}

Measured memory_bytes: 7552
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 1000006;
const ll MOD = 1000000007;

int h, w, n, a;
int ans[102][102];

void chg (int id, int cl) {
    int r = id / w;
    int c = (r&1) ? w - id%w -1: id % w;
    ans[r][c] = cl;
}
/*********************GoodLuck***********************/
int main () {
    IOS();

    cin >> h >> w >> n;

    int idx = 0;
    REP1 (i, n) {
        cin >> a;
        REP (j, a) {
            chg(idx++, i);
        }
    }

    REP (i, h) {
        REP (j, w) {
            cout << ans[i][j] << " \n"[j==w-1];
        }
    }


    return 0;
}


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

using namespace std;

const int N = 2e5+23;

double a[N];

int main(){
    int n, k; scanf("%d%d", &n, &k);
    for (int i = 0; i < n; ++i) {
        int t; scanf("%d", &t);
        a[i] = (t+1)/2.;
        if (!i) continue;
        a[i] += a[i-1];
    }
    double ans = a[k-1];
    for (int i = k; i < n; ++i) {
        ans = max(ans, a[i]-a[i-k]);
    }
    printf("%.9999lf", ans);
    return 0;
}


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

using namespace std;


typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int ui;
typedef vector<int> vi;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef vector<ull> vull;

#define pb push_back;
#define FOR(i,a,b) for(int i = a; i <=b; ++i)
#define FORDOWN(i,a,b) for(int i = a; i >= b; --i)
#define F first;
#define S second;
#define rnd() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


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

    // freopen("sparse.in", "r", stdin);
    // freopen("sparse.out", "w", stdout);

    int n,x,t;
    cin >> n >> x >> t;

    int ans = 0;

    while(n > x) {
        ans += t;
        n -= x;
    }

    cout << ans + t;


     return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  int a[M], b[M];
  for(int i = 0; i < M; i++) {
    cin >> a[i] >> b[i];
  }
  int city[N];
  for(int i = 0; i < N; i++) {
    city[i] = 0;
  }
  
  for(int i = 0; i < M; i++) {
    ++city[a[i] - 1];
    ++city[b[i] - 1];
  }
  
  for(int i = 0; i < N; i++) {
    cout << city[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int P=139;
const int mod=149;
const int maxn=1e6+5;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int minn=0xc0c0c0c0;
int n,ans,res,sit,a[maxn],b[maxn];
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
    	cin>>a[i];
    for(int i=n;i>=1;i--)
		cin>>b[i];
	for(int i=1;i<=n;i++)
	{
		if(a[i]==b[i])
		{
			bool flag=0;
			for(int j=1;j<=n;j++)
			{
				if(a[i]!=b[j]&&a[j]!=b[i])
				{
					swap(b[i],b[j]);
					flag=1;
					break;
				}
			}
			if(!flag)
			{
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	for(int i=1;i<=n;i++)
		cout<<b[i]<<" ";
	cout<<endl;
    return 0;
}

Measured memory_bytes: 5176
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_6B
{
    class Program
    {
        static void Main(string[] args)
        {
            string cardtype = "";
            Dictionary<string, int> TrampCard = new Dictionary<string, int>();
            
            for (int i = 1; i < 5; i++)
            {
                if (i == 1) cardtype = "S";
                else if (i == 2) cardtype = "H";
                else if (i == 3) cardtype = "C";
                else if (i == 4) cardtype = "D";
                for (int j = 1; j < 14; j++)
                {
                    TrampCard[cardtype + " " + j.ToString()] = 0;
                }
            }

            /*
            foreach (string key in TrampCard.Keys)
            {
                Console.WriteLine("DEBUG: {0}", key);
            }
            */

            int count = int.Parse(Console.ReadLine());
            for (int i = 0; i < count; i++)
            {
                TrampCard[Console.ReadLine()] = 1; 
            }

            foreach (string key in TrampCard.Keys)
            {
                if (TrampCard[key] == 0) Console.WriteLine("{0}", key);
            }
        }
    }
}

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

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

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

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

    double m = a[n - 1];
    double min = 1e9;
    int ans;
    for (int i = 0; i < n - 1; i++) {
        double gap = abs(m / 2 - a[i]);
        if (gap < min) {
            min = gap;
            ans = a[i];
        }
    }
    cout << int(m) << " " << ans << endl;
}

Measured memory_bytes: 1024
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

void solve() {
	int n, d, a; cin >> n >> d >> a;
    vector<ll> x(n), h(n);
    vector<P> m(n);
    rep(i, n) {
        cin >> x[i] >> h[i];
        m[i] = make_pair(x[i], (h[i] + a - 1) / a);
    }
    priority_queue<P, vector<P>, greater<P>> pque;
    sort(all(m));
    ll cnt = 0;
    ll now = 0;
    rep(i, n) {
        int X = m[i].fr, C = m[i].sc;
        while(now > 0 && X > pque.top().fr) {
            int Z = pque.top().sc;
            now -= Z;
            pque.pop();
        }
        C -= now;
        if(C <= 0) continue;
        ll co = C;
        cnt += co;
        pque.push(make_pair(X + 2LL * d, co));
        now += co;
    }
    cout << cnt << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

const int maxn = 100001;
map<long long ,int> mp;
int main()
{
    int i,j,k,n,ans= 0;
    cin>>n;

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

    for(auto it = mp.begin() ; it!=mp.end();it++)
    {
        if(it->second & 1)
        {
            ans++;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 5e5+7;
int main()
{
	int n, a, b, c1 = 0, c2 = 0, c3 = 0;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1; i <= n; i++)
	{
		int p;
		scanf("%d", &p);
		c1 += p<=a;
		c2 += p>a&&p<=b;
		c3 += p>b;
	}
	printf("%d\n", min(c1, min(c2, c3)));
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;
int main(){
    int n;
    int x[110];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> x[i];

    int ans = 1001001001;
    for(int i = 0; i < 100; i++){
        int cost = 0;
        for(int j = 0; j < n; j++){
            cost += (i-x[j])*(i-x[j]);
        }
        ans = min(ans, cost);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
const ll inf=1e18;

int main() {
  ll n;
  cin >> n;
  vec a(n);
  ll sum=0;
  for(ll i=0;i<n;i++) {
    cin >> a[i];
    sum+=a[i];
  }
  ll ans=inf;
  ll sunuke=0;
  for(ll i=0;i<n-1;i++) {
    sum-=a[i];
    sunuke+=a[i];
    ans=min(ans,abs(sum-sunuke));
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<stdio.h>
#include<cmath>
using namespace std;
int main(){
    int n;
    int k=1;
    while(cin>>n,n){
        vector<pair<int,int> >v;
        int x,y;
        while(n--){
            cin>>x>>y;
            v.push_back(make_pair(x,y));
        }
        double s=0;
        for(int i=0;i<v.size();i++){
            pair<int,int>ne=v[(i+1)%v.size()];
            s+=0.5*(ne.second*v[i].first-v[i].second*ne.first);
        }
        printf("%d %.1f\n",k++,abs(s));
    }
}

Measured memory_bytes: 1220
// input! macro is published in the following URLs.
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// https://github.com/tanakh/competitive-rs.git
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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")
    };
}

fn main() {
    input! {
        x: usize
    }
    fn is_prime(x: usize, primes: &mut Vec<usize>) -> bool {
        for prime in primes.iter() {
            if x % *prime == 0 {
                return false;
            }
        }
        primes.push(x);
        true
    }
    let mut primes = vec![];
    for i in 2..x {
        is_prime(i, &mut primes);
    }
    for i in x.. {
        if is_prime(i, &mut primes) {
            println!("{}", i);
            return;
        }
    }
}


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

using namespace std;

#define USE_IOSTREAM \
{\
	ios::sync_with_stdio(false);\
	cin.tie(0);\
	cout.tie(0);\
}

#define pii pair<int, int>
#define mp make_pair

typedef long long ll;

string str;

/*
 dream, dreamer, erase and eraser.
*/
bool dfs(int i)
{
	if (i == str.size())
	{
		return true;
	}
	else if (i > str.size())
	{
		return false;
	}
	
	bool res = false;
	if (str.substr(i, 5) == "dream")
	{
		res = dfs(i + 5);
		if (!res && str.substr(i, 7) == "dreamer")
		{
			res = dfs(i + 7);
		}
	}
	else if (str.substr(i, 5) == "erase")
	{
		res = dfs(i + 5);
		if (!res && str.substr(i, 6) == "eraser")
		{
			res = dfs(i + 6);
		}
	}
	
	return res;
}

int main()
{
	USE_IOSTREAM;
	
	cin >> str;
	
	if (dfs(0))
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1872