akhauriyash/Code-Regression huggingface dataset:
// "include" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <utility>
// }}}
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long 
#define pii pair<int,int> 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1000000007;

int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

vector<int> cnt(100050);

signed main(){
    cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a;
	int p = 1;
	cin >> n;
	rep(i,n){
		cin >> a;
		++cnt[a];
	}
	if(n % 2){
		++p;
		if(cnt[0] != 1){
			cout << 0 << '\n';
			return 0;
		}
	}
	for(int i = p;i <= n-1;i += 2){
		if(cnt[i] != 2){
			cout << 0 << '\n';
			return 0;
		}
	}
	int ans = 1;
	rep(i,n/2){
		ans = ans << 1;
		ans %= mod;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 1024
process.stdin.resume();
process.stdin.setEncoding('utf8');
 
process.stdin.on('data', function(input){
    var ii;
    var lines = input.trim().split("\n");
    for(var i=0;i<lines.length;++i){
        var n, end;
        var dataset;
        var map;
        n = parseInt(lines[i++]);
        if( n===0 ) break;
        end = n+1;
        map = new Array(end);
        dataset = lines[i].trim().split(" ");
        for(ii=1;ii<end;++ii){
            map[ii] = parseInt(dataset[ii]) - parseInt(dataset[ii-1]);
        }
        
        if( map[1] === map[2] && map[2] === map[3] && map[3] === map[4] ){
            for(ii=5;ii<end;++ii){
                if( map[ii] != map[1] ) break;
            }
            console.log(dataset[ii]);
        }
        else if( map[2] === map[3] && map[3] === map[4] ){
            console.log(dataset[0]);
        }
        else if( map[1] === map[2] && map[2] === map[3] ){
            console.log(dataset[4]);
        }
        else if( parseInt(dataset[2]) - parseInt(dataset[0]) === map[3] && map[3] === map[4] ){
            console.log(dataset[1]);
        }
        else if( map[1] === map[2] && map[2] === parseInt(dataset[4]) - parseInt(dataset[2]) ){
            console.log(dataset[3]);
        }
        else if( map[1] === parseInt(dataset[3]) - parseInt(dataset[1]) && map[1] === map[4] ){
            console.log(dataset[2]);
        }
    }       
});

Measured memory_bytes: 18088
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
int gcd(int a, int b) { return a ? gcd(b % a, a) : b; }
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, A[101010];
int lft[101010], rht[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];

	lft[0] = A[0];
	rep(i, 1, N) lft[i] = gcd(lft[i - 1], A[i]);

	rht[N - 1] = A[N - 1];
	rrep(i, N - 2, 0) rht[i] = gcd(rht[i + 1], A[i]);

	int ans = 0;
	rep(i, 0, N) {
		int g = 0;
		if (0 < i) g = gcd(g, lft[i - 1]);
		g = gcd(g, rht[i + 1]);
		chmax(ans, g);
	}
	cout << ans << endl;
}


Measured memory_bytes: 1408
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (n, m, x, y) = listOfInt()
    val xx = listOfInt()
    val yy = listOfInt()

    val xMax = xx.max()!!
    val yMin = yy.min()!!

    for (z in xMax+1..yMin) {
        if (x < z && z <= y) {
            println("No War")
            return
        }
    }

    println("War")
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 37956
using System;
using System.Linq;

namespace _0532
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] C = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int Ain = A[0] * 3600 + A[1] * 60 + A[2];
            int Bin = B[0] * 3600 + B[1] * 60 + B[2];
            int Cin = C[0] * 3600 + C[1] * 60 + C[2];
            int Aout = A[3] * 3600 + A[4] * 60 + A[5];
            int Bout = B[3] * 3600 + B[4] * 60 + B[5];
            int Cout = C[3] * 3600 + C[4] * 60 + C[5];
            int Akinmu = Aout - Ain;
            int Bkinmu = Bout - Bin;
            int Ckinmu = Cout - Cin;
            int now = 0;
            now = Akinmu / 3600;
            Console.Write(now+" ");
            now = Akinmu % 3600 / 60;
            Console.Write(now + " ");
            now = Akinmu % 60;
            Console.WriteLine(now);
            now = Bkinmu / 3600;
            Console.Write(now + " ");
            now = Bkinmu % 3600 / 60;
            Console.Write(now + " ");
            now = Bkinmu % 60;
            Console.WriteLine(now);
            now = Ckinmu / 3600;
            Console.Write(now + " ");
            now = Ckinmu % 3600 / 60;
            Console.Write(now + " ");
            now = Ckinmu % 60;
            Console.WriteLine(now);
        }
    }
}

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

int main(){
  int x;
  cin >> x;
  
  while (1){
    bool ok=true;
    for (int i=2;i<x;++i){
      if (x%i==0) {
        ok=false;
        break;
      }
    }
    if (ok) break;
      ++x;
  }
      cout << x << endl;
      return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    int n; std::cin >> n;
    std::vector<std::vector<int>> a(2, std::vector<int>(n + 2));
    for (int i = 0; i < 2; i++) {
        for (int j = 1; j <= n; j++) std::cin >> a[i][j];
    }
    for (int i = 0; i < 2; i++) {
        for (int j = 2; j <= n; j++) a[i][j] += a[i][j - 1];
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans = std::max(ans, a[0][i] + a[1][n] - a[1][i - 1]);
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#define PII pair<ll, ll>
#define F first
#define S second

using namespace std;

typedef long long ll;

ll n, n2, m;
ll ans;
PII b[100005];
priority_queue<ll, vector<ll>, greater<ll> > pq;

int main()
{
    scanf("%lld%lld", &n, &m);
    n2 = n;
    for(ll i = 0; i < n; i++)
    {
        ll t;
        scanf("%lld", &t);
        pq.push(t);
    }
    for(ll i = 0; i < m; i++)
    {
        scanf("%lld%lld", &b[i].S, &b[i].F);
    }
    sort(b, b + m, greater<PII>());
    for(ll i = 0; i < m; i++)
    {
        if(b[i].S > n2)
        {
            for(ll j = 0; j < n2; j++)
            {
                pq.push(b[i].F);
                pq.pop();
            }
            n2 = 0;
        }
        else
        {
            for(ll j = 0; j < b[i].S; j++)
            {
                pq.push(b[i].F);
                pq.pop();
            }
            n2 -= b[i].S;
        }
    }
    for(ll i = 0; i < n; i++)
    {
        ans += pq.top();
        pq.pop();
    }
    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 2936
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int n = vs[0];
			int m = vs[1];
			int X = vs[2];
			int Y = vs[3];
			int x = Console.ReadLine().Split().Select(int.Parse).Max();
			int y = Console.ReadLine().Split().Select(int.Parse).Min();
			int xMax = Math.Max(X, x);
			int yMin = Math.Min(Y, y);
			if (xMax < yMin) {
				Console.WriteLine("No War");
			} else {
				Console.WriteLine("War");
			}


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll t;
	t = 1;
	while(t--)
	{
    ll a,b,c;
    cin>>a>>b>>c;
    if((a==b && a!=c) ||(a==c && a!=b) ||(b==c && a!=b)) cout<<"Yes\n";
    else cout<<"No\n";
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a,const void *b){
  return *(long int *)a-*(long int *)b;
}
int main(){
  int n;
  scanf("%d",&n);
  long int k,a[n],i,j,out=0;
  for(i=0;i<n;i++) scanf("%ld",&a[i]);
  qsort(a,n,sizeof(long int),cmp);
  i=0;
  while(a[i]==0){
    out++;
    i++;
  }
  while(a[n-2]!=0){
  for(i=out+1;i<n;i++){
    if(a[i]>0)a[i]-=(a[i]/a[out])*a[out];
  }
    qsort(a,n,sizeof(long int),cmp);
    out=0;
    for(i=0;i<n;i++) if(a[i]==0)out++;
  }
  printf("%d",a[n-1]);
}

Measured memory_bytes: 1788
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,z;
    char ca,cb,cc;
    cin>>n>>k;
    while(n>0){
        n/=k;
        sum++;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
typedef vector<int> Vi;
typedef pair<int,int> Pii;
typedef pair<int,Pii> Pip; 
const int INF = (1<<30);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){

  int w, h, n;
  cin >> w >> h >> n;

  int cnt = 0;
  int a, b, c, d;
  cin >> a >> b;
  n--;
  while( n -- ) {
    cin >> c >> d;
    cnt += (abs(a - c) + abs(b - d));

    if( a > c && b > d ) {
      int tmp1 = a - c;
      int tmp2 = b - d;
      cnt -= min(tmp1, tmp2);
    }
    else if( a < c && b < d ) {
      int tmp1 = c - a;
      int tmp2 = d - b;
      cnt -= min(tmp1, tmp2);
    }
    a = c; b = d;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <bitset>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using lint = long long;
using namespace std;

const int MOD = 1000000007;

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

    bool flag = true;

    for (int i = 0; i < S.size(); i++) {
        if (i % 2 == 0 && S[i] == 'L') flag = false;
        if (i % 2 == 1 && S[i] == 'R') flag = false;
    }
 
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
int x,n;
int s,a,b;
int main()
{
	scanf("%d%d%d",&x,&n,&a);
	n--;
	s=a;
	int ans=-1;
	while(n--)
	{
		scanf("%d",&b);
		ans=std::max(ans,b-a);
		a=b;
	}
	ans=std::max(x-b+s,ans);
	printf("%d\n",x-ans);
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define dbg(S) { int f=1; for(auto x:S) cerr<<(f?"[":", ")<<x, f=0; cerr<<"]\n"; }

using namespace std;

int main(){
	double a,b,x; cin>>a>>b>>x;
	if(x>=a*a*b/2){
		double theta=atan(2*(a*a*b-x)/(a*a*a));
		cout<<setprecision(15)<<theta*180/M_PI<<endl;
	}
	else{
		double theta=atan((a*b*b)/(2*x));
		cout<<setprecision(15)<<theta*180/M_PI<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include<unordered_map>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

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


int main() {
	int n;
	cin >> n;
	unordered_map<int, int>note;
	deque<int>side;
	ll S = 0;
	rep(i, n) {
		int m;
		cin >> m;
		if (note[m] == 0) {
			note[m] = i+1;
		}
		else {
			note[m] = 0;
			side.push_back(m);
		}
	}
	if (side.size() <= 1) {
		cout << 0 << endl;
	}
	else {
		sort(all(side));
		reverse(all(side));
		S =(ll) side[0] * side[1];
		cout << S << endl;
	}
}


Measured memory_bytes: 4388
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    for(int i=0;i<s.size()-1;i++){
        if(s.at(i) == 'A' && s.at(i+1) == 'C'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# A

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

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

l, r, d = map(int, input().split())
ans = 0
for n in range(l, r+1):
    if n % d == 0:
        ans += 1
print(ans)


Measured memory_bytes: 64768
H, W, K = [int(_) for _ in input().split()]

S = [input() for _ in range(H)]

k = 0
A = [[0 for _ in range(W)] for _ in range(H)]

for i, L in enumerate(S):
    f = 1
    for j, a in enumerate(L):
        if a == "#":
            k += 1
            f = 0
        A[i][j] = k + f

for i in range(1, H):
    if S[i].count("#") == 0:
        for j in range(W):
            A[i][j] = A[i-1][j]

for i in range(H-1)[::-1]:
    if S[i].count("#") == 0:
        for j in range(W):
            A[i][j] = A[i+1][j]

for l in A:
    print(" ".join([str(a) for a in l]))


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  string s;cin>>s;
  char tmp=s[0];
  res=0;
  for(i=0;i<s.size();i++){
    if(tmp!=s[i]){res++;tmp=s[i];}
  }
  cout<<res<<endl;
  
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
  int n;
  ll o = 0, s = 0;
  scanf("%d", &n);
  vector<int> a(n);
  for(int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    s += a[i];
    if(!a[i]) {
      o += s / 2;
      s = 0;
    }
  }
  o += s / 2;
  printf("%lld\n", o);
}

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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

#define F first
#define S second

int h, w, a;
string in[10];

inline bool ok(const vi &x, const vi& y){
	rep(i, 6) rep(j, i) if(x[i] == x[j] && y[i] == y[j]) return 0;
	return 1;
}

int main(){
	
	cin >> h >> w >> a;
	
	vi gy(a), gx(a);
	vi py(6), px(6);
	
	rep(i, h){
		cin >> in[i];
		
		rep(j, w){
			char c = in[i][j];
			
			if(isalpha(c)){
				
				if(c == 'S') py[0] = i, px[0] = j;
				else py[c - 'a' + 1] = i, px[c - 'a' + 1] = j;
			}
			if(isdigit(c)) gy[c - '1'] = i, gx[c - '1'] = j;
		}
	}
	
	set<pair<int, pair<vi, vi> > > s; //esa, pos;
	queue<pair<pi, pair<vi, vi> > > q; //cost, esa, pos
	
	s.insert(mp(0, mp(py, px)));
	q.push(mp(mp(0, 0), mp(py, px)));
	
	while(!q.empty()){
		
		int cost = q.front().F.F;
		int esa = q.front().F.S;
		vi ys = q.front().S.F;
		vi xs = q.front().S.S;
		
		q.pop();
		cost++;
		
		rep(d, 4){
			const int dy[] = {-1, 0, 1, 0}, dx[] = {0, -1, 0, 1};
			int hy = ys[0] + dy[d], hx = xs[0] + dx[d];
			
			if(hy < 0 || hy >= h || hx < 0 || hx >= w) continue;
			if(in[hy][hx] == '#') continue;
			
			vi ny, nx;
			ny.pb(hy); nx.pb(hx);
			rep(i, 5) ny.pb(ys[i]), nx.pb(xs[i]);
			
			if(!ok(ny, nx)) continue;
			
			int nesa = esa;
			if(in[hy][hx] == '1' + esa){
				if(++nesa == a){
					cout << cost << endl;
					return 0;
				}
			}
			
			if(s.count(mp(nesa, mp(ny, nx)))) continue;
			s.insert(mp(nesa, mp(ny, nx)));
			q.push(mp(mp(cost, nesa), mp(ny, nx)));
		}
	}
	cout << -1 << endl;
	
	return 0;
}


Measured memory_bytes: 6440
input_string = list(input().split())

stack = []
for i in range(len(input_string)):
    a = input_string[i]
    if a in ["+", "-", "*"]:
        num1 = stack.pop()
        num2 = stack.pop()
        if a == "+":
            stack.append(num2 + num1)
        elif a == "-":
            stack.append(num2 - num1)
        else:
            stack.append(num2 * num1)
    else:
        stack.append(int(a))
print(stack[0])


Measured memory_bytes: 5596
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(br.readLine());

        int N = Integer.parseInt(st.nextToken());

        int AC = 0;
        int WA = 0;
        int TLE = 0;
        int RE = 0;

        for(int i = 0; i < N; i++) {
            st = new StringTokenizer(br.readLine());
            String target = st.nextToken();

            switch (target) {
                case "AC" :
                    AC += 1;
                    break;
                case "WA" :
                    WA += 1;
                    break;
                case "TLE" :
                    TLE += 1;
                    break;
                case "RE" :
                    RE += 1;
                    break;
            }  
        }

        pw.println("AC x " + AC);
        pw.println("WA x " + WA);
        pw.println("TLE x " + TLE);
        pw.println("RE x " + RE);

        br.close();
        pw.close();
    }
}

Measured memory_bytes: 47852
import itertools

N, M, X = map(int, input().split())

C = []
A = []
for i in range(N):
    CA = list(map(int, input().split()))
    C.append(CA[0])
    A.append(CA[1:])

L = [0, 1]
num = N
bits_list = list(itertools.product(L, repeat=num))

min_cost = float('inf')
for bits in bits_list:

    cost = 0
    understands = [0 for j in range(M)]
    for i in range(N):
        if bits[i] == 1:
            cost += C[i]
            for j in range(M):
                understands[j] += A[i][j]
    
    clear = True
    for u in understands:
        if u < X:
            clear = False
            break
    
    if clear and cost < min_cost:
        min_cost = cost

if min_cost == float('inf'):
    print(-1)
else:
    print(min_cost)

Measured memory_bytes: 9512
#include <iostream>
#include <cmath>

using namespace std;

using ll = long long;

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

    ll m = sqrt(N);

    ll a = 0;
    for (ll i = m; i > 0; i--) {
        if (N % i == 0) {
            a = i;
            break;
        }
    }
    cout << a - 1 + N / a - 1 << endl;
}

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

int main(){
  int A,B,C,X;
  cin >> A >> B >> C >> X;
  int count = 0;
  for(int i=0;i<=A;i++){
    for(int j=0;j<=B;j++){
      for(int k=0;k<=C;k++){
        if(X == (500*i+100*j+50*k))++count;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
l = str(input())
ll = len(l)
mod = 10**9+7

ans = 0
t1 = 0
for i in range(ll):
    if l[i] == "0":
        continue
    ans = (ans+pow(2,t1,mod)*pow(3,ll-i-1,mod)%mod)%mod
    t1 += 1

ans = (ans+pow(2,t1,mod))%mod

print(ans)


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

int main() {
 int X,Y;
  cin >> X >> Y;
  bool ans = false;
  for(int i = 0; i < Y; i++){
    for(int j = 0; j < Y ;j++){
      if(i + j == X && 4*i + 2*j == Y){
      ans = true;}
}
  }
  if(ans){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3600
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 100
#define INFTY (1<<21)
#define rep(i, n) for ( int i = 0; i < n; i++)
int N, M, L, D[MAX][MAX], E[MAX][MAX];

int dijkstra(){
    int cost[MAX][MAX+1];
    bool visited[MAX][MAX+1];
    rep(i, N) rep(j, L+1){
	cost[i][j] = INFTY;
	visited[i][j] = false;
    }
    cost[0][L] = 0;
    
    while(1){
	pair<int, int> u;
	int minv = INFTY;
	rep(i, N) rep(j, L+1){
	    if ( !visited[i][j] && minv > cost[i][j] ){
		u = make_pair(i, j);
		minv = cost[i][j];
	    }
	}
	if ( minv == INFTY ) break;
	//	cout << u.first << " " << u.second << " " << minv << endl;
	visited[u.first][u.second] = true;

	for ( int v = 0; v < N; v++ ){
	    if ( D[u.first][v] == INFTY ) continue;
	    // not take
	    if ( !visited[v][u.second] ){
		cost[v][u.second] = min(cost[v][u.second], cost[u.first][u.second] + E[u.first][v]);
	    }
	    // take
	    if ( u.second < D[u.first][v] ) continue;
	    int l = u.second - D[u.first][v];
	    if ( visited[v][l] ) continue;
	    cost[v][l] = min(cost[v][l], cost[u.first][u.second]);
	}
    }
    int minv = INFTY;
    rep(i, L+1){
	minv = min(minv, cost[N-1][i]);
    }
    return minv;
}

main(){
    int s, t, d, e;
    while( cin >> N >> M >> L && N ){
	rep(i, N) rep(j, N){ D[i][j] = INFTY; E[i][j] = 0; }
	rep(i, M){
	    cin >> s >> t >> d >> e; s--; t--;
	    D[s][t] = D[t][s] = d;
	    E[s][t] = E[t][s] = e;
	}
	cout << dijkstra() << endl;
    }
}

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

int main(){
    long long n;
    cin >> n;
    vector<long long> a(n);
    vector<long long> b(n);
    long long sum_a = 0, sum_b = 0;

    for(long long i = 0; i < n; i++){
        cin >> a[i];
        sum_a += a[i];
    }
    for(long long i = 0; i < n; i++){
        cin >> b[i];
        sum_b += b[i];
    }

    if(sum_b < sum_a){
        printf("No\n");
        return 0;
    }
    
    long long operation = sum_b - sum_a;

    long long count1 = 0;
    long long count2 = 0;
    for(long long i = 0; i < n; i++){
        if(a[i] < b[i]){
            count1 += (b[i] - a[i])/2;
        }
        else if(a[i] > b[i]){
            count2 += a[i] - b[i];
        }
    }

    if(count1 >= count2){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 3772
def main():
  k = int(input())
  #s = input()
  #s = input().split()
  a,b = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  lis = []
  
  for i in range(a,b+1):
    if i % k == 0:
      print("OK")
      exit()
  print("NG")

if __name__ == '__main__':
  main()

Measured memory_bytes: 9168
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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; }

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s,t;
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
int sy, sx;
char maze[1010][1010];
P nums[10];
ll bfs(ll goal) {
	queue<P> que;
	rep(i,h){
		rep(j, w) {
			dis[i][j] = -1;
		}
	}
	que.push(P(sy, sx));
	dis[sy][sx] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == nums[goal].first && p.second == nums[goal].second) break;
		for (int i = 0; i < 4; i++) {
			int ny = p.first + dy[i];
			int nx = p.second + dx[i];
			if (0 <= ny && ny < h && 0 <= nx && nx < w && maze[ny][nx] != 'X' && dis[ny][nx] == -1) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	sy = nums[goal].first;
	sx = nums[goal].second;
	return dis[nums[goal].first][nums[goal].second];
}

int main() {
	cin >> s;
	ll res = INF;
	for (char ch = 'a'; ch <= 'z'; ch++) {
		ll cnt = 0;
		string str = s;
		while (true) {
			bool ok = true;
			rep(i,str.size()) {
				if (str[i] != ch) ok = false;
			}
			if (ok) break;
			rep(i,str.size() - 1) {
				if (str[i + 1] == ch) str[i] = ch;
			}
			str = str.substr(0, str.size() - 1);
			cnt++;
		}
		chmin(res, cnt);
	}
	cout << res << endl;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
//ll MOD = 1000000007;
ll MOD = 998244353;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
  gearup;
  ll k,a,b; cin >> k >> a >> b;
  if(b-a <= 2 || k < a-1)out(k+1);
  else{
      ll res = a;
      k-=a-1;
      if(k&1)k--,res++;
      res += (b-a)*k/2;
      out(res);
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <math.h>
#define ll long long
#define PI 3.14159265
using namespace std;


void printA(int *A,int size)
{
    for(int i=0;i<size;i++)
        cout<<A[i]<<" ";
}
void scanA(int *A,int size)
{
    for(int i=0;i<size;i++)
        cin>>A[i];
}


int absolute(int a,int b);

int main()
{
        double r;
        cin>>r;
        cout<<2.0*PI*r;



}






Measured memory_bytes: 3664
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)

int main() {

	int n;
	cin >> n;

	map<int, int> a;
	rep(i, 0, n) {
		int x;
		cin >> x;
		a[x] = i + 1;
	}

	rep(i, 0, n) {
		cout << a[i + 1] << " ";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 5504
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 2010
using namespace std;
char a[maxn],b[maxn],c[maxn];
bool ab[maxn+maxn+maxn+maxn+maxn],ac[5*maxn],bc[5*maxn];
int match(char a,char b){
	if(a==b||a=='?'||b=='?')return 1;
	return 0;
}
int main(){
	int i,j,A,B,C,L,R,ans=5*maxn;
	scanf("%s%s%s",a,b,c);
	A=strlen(a),B=strlen(b),C=strlen(c);
	for(i=0;i<A;i++)
		for(j=0;j<B;j++)
			if(!match(a[i],b[j]))ab[i-j+2*maxn]=1;
	for(i=0;i<A;i++)
		for(j=0;j<C;j++)
			if(!match(a[i],c[j]))ac[i-j+2*maxn]=1;
	for(i=0;i<B;i++)
		for(j=0;j<C;j++)
			if(!match(b[i],c[j]))bc[i-j+2*maxn]=1;
	for(i=-(B+C);i<=B+C;i++)
		for(j=-(B+C);j<=B+C;j++)
			if(!ab[i+2*maxn]&&!ac[j+2*maxn]&&!bc[j-i+2*maxn]){
				L=min(0,min(i,j)),R=max(A,max(B+i,C+j));//min(i,j)>0表示在内部匹配，故取0
				ans=min(ans,R-L);
			}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
import Control.Applicative
import Data.List (sort)

solve a b t
  | a == b = t + a
  | otherwise =
    let [x,y] = sort [a,b]
        z = max (y`div`x-1) 1
    in solve x (y-z*x) (t+2*z*x)

main = do
  [n,x] <- map read.words <$> getLine :: IO [Integer]
  print $ solve x (n-x) n


Measured memory_bytes: 508
N, M = map(int, input().split())
A = list(map(int, input().split()))

sum = sum(A)
limit = sum / (4 * M)
A.sort(reverse = True)

ans = True
for i in range(M):
    if A[i] < limit:
        ans = False
        break
if ans:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9032
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define ll long long
using namespace std;
const int inf=1e9;
const int mod=1e9+7;
const int maxn=1e5+10;
char s[110];
int n;
int main(){
    //ios::sync_with_stdio(false);
    //freopen("in","r",stdin);
    cin>>s;
    n=strlen(s);
    int i=0,j=n-1;
    int ans=0;
    while(i<j){
        if(s[i]!=s[j]) ans++;
        ++i;--j;
    }
    printf("%d\n",ans);
    return 0;
}

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

using str = string;
using ss = stringstream;

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

    str s;
    cin>>s;

    int ans=0;
    int cnt=0;

    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')cnt++;
        else
        {
            ans=max(ans,cnt);
            cnt=0;
        }
        
    }
    
    ans=max(ans,cnt);

    cout<<ans<<"\n";

    return 0;
}


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

int main()
{
	int n = 0;
	double sa = 0, sb = 0;
	double a[100], b[100];

	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[n];
		b[n] = 1 / a[n];
		sa = sa + b[n];
	}

	sb = 1 / sa;

	cout << sb << endl;

	return 0;
}

Measured memory_bytes: 256
n,*abc=map(int,input().split())
ip=[0]*n
for i in range(n):
	tmp=input()
	if tmp=="AB":
		ip[i]=[0,1]
	elif tmp=="BC":
		ip[i]=[1,2]
	else:
		ip[i]=[0,2]
ans="Yes"
res=[0]*n
s=sum(abc)
if s==0:
	ans="No"
elif s==1:
	for i in range(n):
		i1=ip[i][0]
		i2=ip[i][1]
		ABC=[abc[i1],abc[i2]]
		if ABC==[0,0]:
			ans="No"
		elif ABC==[0,1]:
			abc[i1]+=1
			abc[i2]-=1
			res[i]=i1
		else:
			abc[i1]-=1
			abc[i2]+=1
			res[i]=i2
else:
	i1=ip[0][0]
	i2=ip[0][1]
	if [abc[i1],abc[i2]]==[0,0]:
		ans="No"
	else:
		for i in range(n):
			i1=ip[i][0]
			i2=ip[i][1]
			if abc[i1]*abc[i2]==0:
				if abc[i1]==0:
					abc[i1]+=1
					abc[i2]-=1
					res[i]=i1
				else:
					abc[i1]-=1
					abc[i2]+=1
					res[i]=i2
			elif i+1<n and ip[i+1]!=ip[i]:
				c=list(set(ip[i])&set(ip[i+1]))[0]
				if i1==c:
					abc[i1]+=1
					abc[i2]-=1
					res[i]=i1
				else:
					abc[i1]-=1
					abc[i2]+=1
					res[i]=i2
			else:
				abc[i1]+=1
				abc[i2]-=1
				res[i]=i1
print(ans)
dic={0:"A",1:"B",2:"C"}
if ans=="Yes":
	for i in range(n):
		print(dic[res[i]])
		'''
		if res[i]==0:
			print("A")
		elif res[i]==1:
			print("B")
		else:
			print("C")
		'''

Measured memory_bytes: 18656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main(){
  int n,m;cin>>n>>m;
  int ctr[100001]={};
  rep(i,m){
    int a,b;cin>>a>>b;
    ctr[a]++;ctr[b]++;
  }
  rep(i,100001){
    if(ctr[i]%2){
      cout<<"NO"<<endl;exit(0);
    }
  }
  cout<<"YES"<<endl;
}

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

#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

typedef long long int ll;

int read_int()
{
    int a;
    scanf("%d", &a);
    return a;
}

int read_lint()
{
    ll a;
    scanf("%lld", &a);
    return a;
}

int read_float()
{
    float a;
    scanf("%f", &a);
    return a;
}

int read_double()
{
    double a;
    scanf("%lf", &a);
    return a;
}

int main()
{
    ll n = read_lint();
    ll ans = 0;
    for (ll i = 1; i <= n; i++)
    {
        ans += (i + n / i * i) * (n / i) / 2;
        // printf("%d\n", (i + n / i * i) * (n / i) / 2);
    }
    printf("%lld\n", ans);

    return 0;
}

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

long long comb2(long long x)
{
    if (x < 1)
        return 0;
    return x * (x - 1) / 2;
}

int main()
{
    int n;
    cin >> n;
    vector<long long> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) a[i]--;

    vector<long long> cnt(n);
    rep(i, n) cnt[a[i]]++;
    long long tot = 0;
    rep(i, n)
        tot += comb2(cnt[i]);

    rep(k, n)
    {
        cout << tot - comb2(cnt[a[k]]) + comb2(cnt[a[k]] - 1) << endl;
    }
    return 0;
}

Measured memory_bytes: 5760
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rf = lambda: map(float, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
h = ri()-1
w = ri()-1
print((n-h) * (n-w))

Measured memory_bytes: 27036
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;


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

	vector<int> okane(N);
	for (int i = 0; i < N; i++) {
		cin >> okane[i];
	}

	sort(okane.begin(), okane.end());
	for (int i = 0; i < M; i++) {
		int hangaku = okane.back() / 2;
		okane.pop_back();

		auto idx = lower_bound(okane.begin(), okane.end(), hangaku);
		okane.insert(idx, hangaku);
	}

	long long int sum = 0;
	for (int i = 0; i < N; i++) {
		sum += okane[i];
	}
	cout << sum;

	return 0;
}



Measured memory_bytes: 640
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
k=int(input())
cnt=0
while(a>=b):
    b=b*2
    cnt=cnt+1
while(b>=c):
    c=c*2
    cnt=cnt+1
if(cnt>k):
    print("No")
else:
    print("Yes")

Measured memory_bytes: 9140
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define MOD 998244353
using namespace std;
int32_t main()
{
    int n,k=2;
    cin>>n;
    vector<int> v;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        v.push_back(x);
    }
    vector<int> dp(n,0);
    for(int i=1;i<n;i++)
    {
        dp[i]=1e9;
        for(int j=i-1;j>=0 && i-j<=k;j--)
            dp[i]=min(dp[i],dp[j]+abs(v[i]-v[j]));
    }
    cout<<dp[n-1]<<endl;
}
    


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

using ll=long long; 

void solve(){
	int a,b,c;
	cin>>a>>b>>c;
	c--;
	int ans=b+1;
	ans+=min(a+b,c);
	cout<<ans<<endl;
}

signed main(){
	//while(1)
	solve();
}

Measured memory_bytes: 256
from collections import defaultdict
N = int(input())
s = [input() for _ in range(N)]
dic = defaultdict(int)

for i in range(N):
    os = "".join(sorted(s[i]))
    dic[os] += 1
#print(os)
cnt = 0
for s, c in dic.items():
    #print(s, c)
    cnt += c * (c-1) // 2
    #print(c* (c - 1) // 2)
print(cnt)

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

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	int n;
	cin >> n;
	syc(n,2,10);
	int a[n];
	int max=0,sum=0;
	
	for(int i=0;i<n;i++){
		cin >> a[i];
		sum+=a[i];
		if(i==0){
			max=a[i];
		}else if(i>0){
			if(a[i]>max){
				max=a[i];
			}
		}
	}
	max=max/2;
	sum-=max;
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
  ll n,y;
  cin >>n>>y;
  for(ll i=0;i<=n;i++){
    for(ll j=0;j<=(n-i);j++){
      if(n-i-j<0) continue;
      if(i*10000+j*5000+(n-i-j)*1000==y) {
        cout <<i<<" "<<j<<" "<<n-i-j<<endl;
        return 0;
      }
    }
  }
  cout <<-1<<" "<<-1<<" "<<-1<<endl;
}


Measured memory_bytes: 256
n = input()
x = map(int, input().split())
y = map(int, input().split())

x_y = [abs(xi - yi) for xi, yi in zip(x, y)]
for p in range(1, 4):
    print(sum(i ** p for i in x_y) ** (1 / p))
print(max(x_y))

Measured memory_bytes: 6784
import java.io.*;
import java.io.ObjectInputStream.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	//final static long MOD = 998244353;

	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		slove(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void slove(String[] args) throws Exception{

		int N = nextInt();
		int[][] p = new int[N][];
		for(int i=0;i<N;i++) {
			p[i]=nextInts();
		}


		int ans = 0;
		HashMap<String,Integer> map = new HashMap<String, Integer>();
		for(int i=0;i<N;i++) {
			for(int k=0;k<N;k++) {
				if(i==k) {
					continue;
				}
				String key = String.valueOf(p[k][0]-p[i][0])+","+String.valueOf(p[k][1]-p[i][1]);
				map.put(key,map.getOrDefault(key, 0)+1);
			}
		}
		for(int val:map.values()) {
			ans=Math.max(ans,val);
		}
		pw.println(N-ans);

	}


	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}



Measured memory_bytes: 27500
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N, x;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> x;
  if (x == 1 || x == 2 * N - 1) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;

  vector<int> v;
  for (int i = 2; i < 2 * N - 1; i++) {
    if (i != x) v.emplace_back(i);
  }
  for (int i = 0; i < N - 2; i++) {
    cout << v[i] << endl;
  }
  cout << 1 << endl;
  cout << x << endl;
  cout << 2 * N - 1 << endl;
  for (int i = 0; i < N - 2; i++) {
    cout << v[i + N - 2] << endl;
  }

  return 0;
}

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

#define ll  long long
#define forn(i,n)   for(ll i=0;i<(ll)n;i++)

long long numberofmoves(vector<ll>& a)
{
    ll max=0;
    ll curmax=0;
    forn(i,a.size()-1)
    {
        if(a[i]>=a[i+1])
            curmax++;
        else
            curmax=0;
        if(curmax>max)
            max=curmax;
    }
    return max;
}


int main()
{
    ll n;
    cin>>n;
    vector<ll> h;
    ll z;
    forn(i,n)
    {
        cin>>z;
        h.push_back(z);
    }
    cout<<numberofmoves(h)<<endl;
    return 0;
}

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

int main(){
  int s,w;
  cin >>s >>w;
  if(s<=w) cout << "unsafe" << endl;
  else cout << "safe" << endl;
  return 0;
}

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

bool inte(double n)
{
    return n - (int)n ? false : true;
}

int main()
{
    int n,d,ans = 0;
    scanf("%d %d",&n,&d);
    int arr[n][d];
    for(int i = 0;i < n;i++)
        for(int j = 0;j < d;j++)
            scanf("%d",&arr[i][j]);
    for(int i = 0;i < n - 1;i++)
        for(int j = i + 1;j < n;j++)
        {
            double he = 0;
            for(int k = 0;k < d;k++)
                he += (arr[i][k]-arr[j][k])*(arr[i][k]-arr[j][k]);
            if(inte(sqrt(he))) ans++;
        }
    printf("%d\n",ans);
    return 0;
}

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

#define INF 1234567890
#define ll long long

int N, M, X;
int C[20], A[20][20];

int main()
{
	scanf("%d %d %d", &N, &M, &X);
	for(int i=0; i<N; i++)
	{
		scanf("%d", &C[i]);
		for(int j=0; j<M; j++)
		{
			scanf("%d", &A[i][j]);
		}
	}
	int res = INF;
	for(int b=0; b<(1<<N); b++)
	{
		int cost = 0;
		int S[20] = {0, };
		for(int i=0; i<N; i++)
		{
			if (b&(1<<i))
			{
				cost += C[i];
				for(int j=0; j<M; j++)
					S[j] += A[i][j];
			}
		}
		int chk = 1;
		for(int j=0; j<M; j++)
		{
			if (S[j] < X)
				chk = 0;
		}
		if (chk == 0) continue;
		res = min(res, cost);
	}
	if (res == INF) res = -1;
	printf("%d", res);
	return 0;
}

Measured memory_bytes: 3816
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define ff first
#define pb push_back
#define ss second
#define maxn 100005
using namespace std;


int main(){

    int d1, m1, d2, m2;
    cin >> m1 >> d1 >> m2 >> d2;
    if(m1 != m2 ){
        cout <<  1 << endl;
    }
    else{
        cout << 0 << endl;
    }


    return 0;
}


Measured memory_bytes: 256
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] S = Console.ReadLine().Split(' ');
            long A = long.Parse(S[0]);
            long V = long.Parse(S[1]);

            S = Console.ReadLine().Split(' ');
            long B = long.Parse(S[0]);
            long W = long.Parse(S[1]);

            S = Console.ReadLine().Split(' ');
            long T = long.Parse(S[0]);


            long dist = Math.Abs(A - B);
            long catch_speed = V - W;

            if (T * catch_speed >= dist) Console.WriteLine("YES");
            else Console.WriteLine("NO");
            return;


            //for (int i = 0; i < T; i++)
            //{
            //    if (A < B)
            //    {
            //        B += W;
            //        if (A + V >= B)
            //        {
            //            Console.WriteLine("YES");
            //            return;
            //        }
            //        else
            //        {
            //            A += V;
            //        }                    
            //    }
            //    else if (A > B)
            //    {
            //        B -= W;
            //        if (A - V <= B)
            //        {
            //            Console.WriteLine("YES");
            //            return;
            //        }
            //        else
            //        {
            //            A -= V;
            //        }
            //    }
            //}

            //Console.WriteLine("NO");
            //return;

        }
    }
}


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

int main(){
    int n;
    ll mx=-1;
    ll sum=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        ll s;
        scanf("%d",&s);
        if(i==0) mx=s;
        else{
            if(s>mx){
                mx=s;
            }else {
                sum+=mx-s;
            }
        }
    }
    printf("%lld",sum);
    return 0;
}


Measured memory_bytes: 3812
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
int n, m, a, b, tmp;
long long ans;
P pr[100005];

int main(){
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; i++){
        scanf("%d%d", &a, &b);
        pr[i] = P(a, b);
    }
    sort(pr, pr+n);
    for(int i = 0; i < m; i++){
        if(tmp + pr[i].second < m){
            ans += (long long)pr[i].first * pr[i].second;
            tmp += pr[i].second;
        }
        else{
            ans += (long long)pr[i].first * (m - tmp);
            break;
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 1024