akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            long k = in.nextLong();
            if (k % 2 == 0) {
                out.println(a - b);
            } else {
                out.println(b - a);
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 20692
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int n = int.Parse(In[0]);
            int a = int.Parse(In[1]);
            int b = int.Parse(In[2]);
            int c = n * a;
            if (c <= b) Console.WriteLine(c);
            else Console.WriteLine(b);
        }
    }
}


Measured memory_bytes: 27504
using System;

namespace ConsoleApp3
{
	class Program
	{
		static void Main(string[] args)
		{
			long n = long.Parse(Console.ReadLine());
			long sqrtn = (long)Math.Sqrt(n);
			long ans = long.MaxValue;

			for (long i = 1; i <= sqrtn; i++)
			{
				if (n % i != 0)
				{
					continue;
				}
				long j = n / i;
				ans = Math.Min(ans, i + j - 2);
			}
			Console.WriteLine(ans);
		}
	}
}


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

string a,b,u;
int x,y;
int main()
{
    cin >> a >> b;
    cin >> x >> y;
    cin >> u;
    if(u==a) {
        x-=1;
    }
    else {
        y-=1;
    }
    cout << x << ' ' << y;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long happiness = 0;
        happiness += (n / 500) * 1000;
        n = n % 500;
        happiness += (n / 5) * 5;
        System.out.println(happiness);
    }
}

Measured memory_bytes: 35860
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long i=1;i<=n;i++)
int top(int a){
  int b=0;
  while(a){ b=0; b+=a%10,a=a/10;} 
  return b;
}
int main(){
  int n,ans,memo; cin>>n;
  vector<int> p(101);
  ans=0;
  rep(i,101) p[i]=300000;
  
  rep(i,n){
    memo=top(i)*10+i%10;
    
    if(p[memo]!=300000){
      ans=ans+p[memo];
    }
    else{
      p[memo]=0;
      rep(k,n){
        if(memo%10==top(k) && memo/10==k%10) p[memo]++;
      }
      ans=ans+p[memo];
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

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

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

const int Maxn = 60;
const int INF = (int) 1e7;

ll a[Maxn];

int n, x, y;

ll C[Maxn][Maxn];

void comb() {
    for (int i = 0; i < Maxn; ++i) {
        for (int j = 0; j < Maxn; ++j) {
            if (j == 0 || i == j) C[i][j] = 1;
            else C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
        }
    }
}

int main() {
    /*
    ios::sync_with_stdio(false);
    cin.tie(0);
     */
    cin >> n >> x >> y;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n, greater<ll>());
    double ans = 0;
    for (int i = 0; i < x; ++i) {
        ans += a[i];
    }
    ans /= x;
    cout << fixed << setprecision(10) << ans << endl;

    ll cnt = 0;
    ll t = a[x - 1];
    comb();
    if (a[0] == t) {
        reverse(a, a + n);
        int num = upper_bound(a, a + n, t) - lower_bound(a, a + n, t);
        for (int i = x; i <= min(num, y); ++i) cnt += C[num][i];
    } else {
        reverse(a, a + n);
        int num = upper_bound(a, a + n, t) - lower_bound(a, a + n, t);
        int num2 = upper_bound(a + n - x, a + n, t) - lower_bound(a + n - x, a + n, t);
        cnt = C[num][num2];
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <list>
#include <iomanip>
#include <cctype>

using namespace std;

int main() {
	int a, p;
	cin >> a >> p;
	cout << (3 * a + p) / 2 << endl;



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,q;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
    
//------ Believe yourself as a genius!!!!!! ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    rep(i,n)cin>>a[i];
    while(1){
        int owari=1;
        ll st=-1,en,sageru=LINF;
        rep(i,n){
            if(a[i]!=0){
                if(st==-1)st=i;
                owari=0;
            }
        }
        if(owari)break;
        rrep(i,st,n){
            if(a[i]==0)break;
            en=i;
        }
        rrep(i,st,en+1)sageru=min(sageru,a[i]);
        rrep(i,st,en+1)a[i]-=sageru;
        //rep(i,n)cout<<a[i]<<" ";
        //cout<<"\n";
        ans+=sageru;
    }
    Cout(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;

ll nC2(ll n){
    if(n == 1 || n == 0) return 0;
    ll ans = 1;
    ans*=n;
    ans*=(n-1);
    ans/=2;
    return ans;
}

int main(){
    ll N; cin >> N;
    
    vector<ll> A(N); for(int i = 0; i < N; i++) cin >> A[i];
    map<int, int> M;
    for(int i = 0; i < N; i++) M[A[i]]++;
    vector<ll> V(200001), V_(200001);
    //vector<ll> V(M.size()), V_(M.size());

    ll SUM = 0;
    for(int i = 1; i <= M.size(); i++) {V[i] = nC2(M[i]); SUM += V[i];}
    for(int i = 1; i <= M.size(); i++) V_[i] = nC2(M[i]-1);

    for(int i = 0; i < N; i++){
        cout << SUM - V[A[i]]+ V_[A[i]] << endl;
    }
    
}

Measured memory_bytes: 17536
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
const int INF = 1<<30;
int gcd(int s, int t){
  if(s>t)swap(s, t);
  if(s==0){
  	return t;
  }
  return gcd(t%s, s);
}
int main(){
  ll a, b;cin>>a>>b;
  int c, d;cin>>c>>d;
  ll e = (ll)c*(ll)d/(ll)gcd(c, d);
  ll ans = b-(b/(ll)c)-(b/(ll)d)+(b/e);
  if(a!=1){
    a--;
  	ans -= a-(a/(ll)c)-(a/(ll)d)+(a/e);
  }
  cout<<ans<<endl;
}

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

int main(){
	string n;
	cin >> n;
	string s = "ABC" + n;
	cout << s << endl;

}

Measured memory_bytes: 256
import collections as col
import math as ma

MOD = 10**9 + 7
def inv(a): return pow(a, MOD-2, MOD)
def comb(n,r,MOD):
    ans = 1
    for i in range(r): # r-i==0でbreak
        ans *= n-i
        ans *= inv(r-i)
        ans %= MOD
    return ans

def prime(n):
    ans = []
    for i in range(2, int(n**0.5)+1):
        while not n%i: n //= i; ans.append(i)
    if n != 1: ans.append(n)
    return ans

n,m = map(int,input().split())
cnt = col.Counter(prime(m))

ans = 1
for key,val in cnt.items():
    #ans *= comb(val + n-1, n-1)
    ans *= comb(val + n-1, n-1, MOD)
    ans %= MOD
print(ans)



Measured memory_bytes: 42780
using System;
using System.Text;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int[] a = sc.IntArray();

        long all = 0;
        for (int i = 0; i < n; i++)
        {
            if (i == 0) all += Math.Abs(a[0]);
            else all += Math.Abs(a[i] - a[i - 1]);
        }

        all += Math.Abs(a[n - 1]);

        var sb = new StringBuilder();
        for (int i = 0; i < n; i++)
        {
            int prev = i == 0 ? 0 : a[i - 1];
            int next = i == n - 1 ? 0 : a[i + 1];
            long t = all - Math.Abs(prev - a[i]) - Math.Abs(a[i] - next);
            t += Math.Abs(prev - next);
            sb.AppendLine(t.ToString());
        }
        Console.Write(sb.ToString());
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

int main()
{
    long long N;
    cin >> N;
    vector<long long> a(N);
    for (long i = 0; i < N;i++){
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    for (long i = 0; i < N-1; i++)
    {
        if(a.at(i)==a.at(i+1)){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 1792
#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 result[3001][3001];

int main()
{
	string s, t;
	cin >> s >> t;
	if(s[0] == t[0]) result[0][0] = 1;
	else result[0][0] = 0;
	for(int i = 1; i < s.length(); i++){
		if(s[i] == t[0]) result[i][0] = 1;
		else result[i][0] = result[i - 1][0];
	}
	for(int i = 1; i < t.length(); i++){
		if(s[0] == t[i]) result[0][i] = 1;
		else result[0][i] = result[0][i - 1];
	}
	for(int i = 1; i < s.length(); i++){
		for(int j = 1; j < t.length(); j++){
			result[i][j] = max(result[i - 1][j], result[i][j - 1]);
			if(s[i] == t[j]) result[i][j] = max(result[i][j], result[i - 1][j - 1] + 1);
		}
	}
	vector<char> v;
	int i = s.length() - 1;
	int j = t.length() - 1;
	while(i >= 0 && j >= 0){
		// cout << i << " " << j << endl;
		if(i > 0 && result[i][j] == result[i - 1][j]){
			i--;
		} else if(j > 0 && result[i][j] == result[i][j - 1]){
			j--;
		} else {
			if(s[i] == t[j]) v.push_back(s[i]);
			i--;
			j--;
		}
	}
	string ans = "";
	for(int i = v.size() - 1; i >= 0; i--){
		ans = ans + v[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 35456
a,b,c,d = list(map(int,input().split()))

x1 = a * c
x2 = a * d
x3 = b * c
x4 = b * d

l = []
l.append(x1)
l.append(x2)
l.append(x3)
l.append(x4)

ans = max(l)

print(ans)

Measured memory_bytes: 9180
#include<stdio.h>
#include<math.h>
#define SIZE 1000

int main(void)
{
    int i, n, s[SIZE];
    double m, v;
    
    while (1) {
        scanf("%d", &n);
        if ( n == 0)
            break;
        for ( i=0; i<n; ++i)
            scanf("%d", &s[i]);
        
        /* 平均 */
        m = 0;
        for ( i=0; i<n; ++i)
            m += s[i];
        m /= n;
        /* 分散 */
        v = 0;
        for ( i=0; i<n; ++i)
            v += pow(s[i]-m, 2.0);
        v /= n;
        
        printf("%lf\n", sqrt(v));
    }
    
    return 0;
}


Measured memory_bytes: 2036
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



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


	int n, m;
	cin >> n >> m;
	int ans = 0;
	rep(i,m) {
		int a;
		cin >> a;
		ans += m < a;
	}
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 3196
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc147_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            var AL = new List<Dictionary<int, int>>();

            for (var i = 0; i < N; i++)
            {
                int AN = int.Parse(Console.ReadLine());

                AL.Add(new Dictionary<int, int>());
                
                for (var j = 0; j < AN; j++)
                {
                    var xy = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
                    AL[i].Add(xy[0] - 1, xy[1]);
                }
            }

            int r = 0;
            string item = "";
            for (int i = 1; i <= N; i++)
                item += i.ToString("x");
            
            // N人から1～N人選ぶ全組み合わせ
            for (var i = 1; i <= N; i++)
            {
                foreach (var cl in Combination.Enumerate(item, i, false))
                {
                    int[] pl = new int[N];

                    foreach (var c in cl)
                    {
                        pl[int.Parse(c.ToString(), NumberStyles.AllowHexSpecifier) - 1] = 1;
                    }

                    bool b = true;

                    //検証
                    for (int j = 1; j <= N; j++)
                    {
                        var a = AL[j - 1];
                        foreach (var k in a.Keys)
                        {
                            var ak = a[k];
                            if (pl[j - 1] == 1 && pl[k] != ak)
                            {
                                b = false;
                                break;
                            }
                        }
                        if (!b) break;
                    }
                    if (b && cl.Count() > r) r = cl.Count();
                }

            }

            Console.WriteLine(r);
          
        }

        /// <summary>
        /// 組み合わせ生成クラス
        /// </summary>
        public static class Combination
        {
            public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition)
            {
                if (k == 1)
                {
                    foreach (var item in items)
                        yield return new T[] { item };
                    yield break;
                }
                foreach (var item in items)
                {
                    var leftside = new T[] { item };

                    // item よりも前のものを除く （順列と組み合わせの違い)
                    // 重複を許さないので、unusedから item そのものも取り除く
                    var unused = withRepetition
                                ? items
                                : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList();

                    foreach (var rightside in Enumerate(unused, k - 1, withRepetition))
                    {
                        yield return leftside.Concat(rightside).ToArray();
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 15792
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <deque>
#include <cstring>
//#include<bits/stdc++.h>
#define int long long
#define all(x) begin(x), end(x)
#define SZ(x) ((int)(x).size())
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define F first
#define S second

#define de(x) if(x && x == MODE)
#define MODE 1

using namespace std;

typedef pair<int, int> pii;

const int INF = 1e18;
const int maxn = 1e5 + 7;

struct Dsu {
	int p[maxn];
	void init(int n) {
		for (int i = 1; i <= n; i++) p[i] = i;
	}
	int f(int x) {
		return p[x] == x ? x : p[x] = f(p[x]);
	}
	bool merge(int u,int v) {
		u = f(u);
		v = f(v);
		return u == v ? 0 : p[u] = v;
	}
} dsu;

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0); 
	int n, m, ans;
	cin >> n >> m;
	dsu.init(n);
	ans = n - 1;
	for (int i = 1; i <= m; i++) {
		int u, v;
		cin >> u >> v; 
		ans -= (dsu.merge(u, v) > 0);
	}
	cout << ans << "\n";
}


Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
 
  struct fruit {
  int name;  // 名前
  int price; // 価格
};

int main() {
    int i,j,k=0;
    int n,m;
    int b,c;
    int flag=0;
    std::cin >> n>> m;
    vector<int> a(n);
    vector<fruit> fruits(m);
    for (i=0;i<n;i++){
        std::cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    
    for (i=0;i<m;i++){
        std::cin >> fruits.at(i).name>>fruits.at(i).price;
    }
    sort(fruits.begin(), fruits.end(), 
    [](const fruit& x, const fruit& y) { return x.price > y.price;});
    
    for(i=0;i<m;i++){
        if (flag==-1)break;
        b=fruits.at(i).name;
        c=fruits.at(i).price;
        for(j=0;j<b;j++){
            if(k==n){flag=-1;break;}
            else if(a[k]<c){a[k]=c;k++;}
            else {flag=-1;break;}
        }
    }
    
    
    long long int ans=0;
     for (i=0;i<n;i++){
        ans+=a.at(i);
    }
    std::cout << ans << std::endl;

}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
*/


int main(){
cout<<fixed<<setprecision(10);
//cin.tie(0); ios::sync_with_stdio(false);

  
ll H,W;
  cin>>H>>W;
  if(H==1||W==1){
    cout<<1<<endl;
    return 0;
  }

ll  ans;
  if(H%2==0&&W%2==0){ans=H/2*W;}
   if(H%2==1&&W%2==0){ans=(H/2+1)*W-W/2;}
   if(H%2==0&&W%2==1){ans=H/2*W;}
   if(H%2==1&&W%2==1){ans=(H/2+1)*W-W/2;}
  cout<<ans<<endl;
}




Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int i,j;
	scanf("%d %d",&i,&j);
	if(i <= 8){
		if(j <= 8){
			printf("Yay!");
		}else{
			printf(":(");
		}
	}else{
		printf(":(");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef vector< P > vecp;

struct S{
  P p,q;
  S(P p,P q) : p(p),q(q) {}  
};

struct C{
  P p;  double r;
  C(P p,double r):p(p),r(r){}
};

double eps=1e-8,  PI=acos(-1),  PI2=PI*2.0;

bool eq(double a,double b){return (b-a<eps&&a-b<eps);}
bool eq(P a,P b){return (abs(a-b)<eps);}
double Sqrt(double x){  return ( x<0 ? 0.0 : sqrt(x) ); }
double dot(P a,P b){return real(b*conj(a));}
double cross(P a,P b){return imag(b*conj(a));}

double dist(P a,P b,P c){
  if(dot(b-a,c-a)<0)return abs(c-a);
  if(dot(a-b,c-b)<0)return abs(c-b);
  return abs(cross(b-a,c-a))/abs(b-a);
}

P project(P a,P b,P c){  b-=a; c-=a; return a+b*real(c/b); }

double getTime(P a,P b){
  assert( eq(cross(a,b),0) );
  return ( dot(a,b) < 0 ? -1.0 : 1.0 ) * abs(b);
}

double getArg(P a,P b){  return arg(b*conj(a)); }

vecp getCrossPoint(C a,S b, bool debug=false){
  vecp res;
  P base=b.q-b.p,  target=project(b.p,b.q,a.p);
  double length=abs(base), h=abs(a.p-target);
  base/=length;  
  if(a.r+eps<h)return res;
  double w=Sqrt(a.r*a.r-h*h);
  double L=getTime(b.q-b.p,target-b.p)-w,  R=L+w*2.0;
  if( -eps<L && L< length+eps )res.push_back(b.p+base*L);
  if( -eps<R && R< length+eps )res.push_back(b.p+base*R);
  return res;
}


double getArea(C c,P a,P b){
  P va=c.p-a,  vb=c.p-b;
  double A=abs(va), B=abs(vb);
  double f=cross(va,vb), d=dist(a,b,c.p), res=0;
  if( eq(0, f ) )return 0;
  if(A<c.r+eps&&B<c.r+eps)return f*0.5;
  if(d>c.r-eps)return c.r*c.r*PI*getArg(va,vb)/PI2;
  
  vecp u=getCrossPoint(c, S(a,b) );
  assert( !u.empty() );
  u.insert(u.begin(), a),  u.push_back(b);

  for(int i=0;i+1<(int)u.size();i++) res+=getArea(c,u[i],u[i+1]);
  return res;
}

double getArea(vecp t,C c){
  int n=t.size();
  if(n<3)return 0;
  double res=0;
  for(int i=0;i<n;i++){
    P a=t[i], b=t[(i+1)%n];
    res+=getArea(c,a,b);
  }
  return res;
}


void change(vecp t){
  int n=t.size();
  double sum=0;
  for(int i=0;i<n;i++){
    P a=t[i];
    P b=t[(i+1)%n];
    sum+= cross(a,b)*0.5;
  }
  if(sum<0){
    reverse(t.begin(),t.end());
  }
}

int main(){
  int n,cx,cy,cr;
  cin>>n>>cx>>cy>>cr;
  C cir( P(cx,cy) ,cr);
  double ans=0;
  for(int i=0;i<n;i++){
    int k,score;
    cin>>k>>score;
    vecp G;
    for(int j=0;j<k;j++){
      int x,y;
      cin>>x>>y;
      G.push_back(P(x,y));
    }
    change(G);
    ans+= getArea(G,cir)*score;
  }
  ans/= cir.r*cir.r*PI;
  printf("%.10f\n",ans);
  return 0;
}


Measured memory_bytes: 3412
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;

long long f(long long l, long long r) {
  if (l * r < 0)
    return min(abs(l) * 2 + r, -l + r * 2);
  return max(abs(l), abs(r));
}

int main() {
  int n, k;
  cin >> n >> k;
  vector<long long> x(n);
  for (int i = 0; i < n; i++)
    cin >> x[i];
  set<long long> s;
  for (int i = 0; i < k; i++)
    s.insert(x[i]);
  long long ans = 100000000000;
  for (int i = k; i < n; i++) {
    auto it = s.end();
    it--;
    int l = *s.begin();
    int r = *it;
    ans = min(ans, f(l, r));
    s.erase(s.begin());
    s.insert(x[i]);
  }
  auto it = s.end();
  it--;
  ans = min(ans, f(*s.begin(), *it));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5760
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		ArrayList<String> lines = new ArrayList<String>();
		
		String string = "";
		int cn =0;
		while (true) {
			string = sc.nextLine();
			lines.add(string);
			cn++;
			if(string.equals("0")){
				break;
			}
		}
		
		int[] in = new int[cn];
		
		for (int i=0; i < cn;i++) {
			in[i] = Integer.parseInt(lines.get(i));
		}
		
		int j = 0;
		
		for (int number = 1;; number++) {
			if (in[j] == 0) {
				break;
			} else {
				System.out.print("Case ");
				System.out.print(number);
				System.out.print(": ");
				System.out.println(in[j]);
				j++;
			}
		}
	}

}

Measured memory_bytes: 62144
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
char s[100005];
int main()
{
	cin>>s;
	int len=strlen(s);
	if(len%2==1)
	{
		if(s[0]!=s[len-1])printf("First");
		else printf("Second");
	}
	else
	{
		if(s[0]==s[len-1])printf("First");
		else printf("Second");
	}
	
	return 0;
 } 

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

int main() {
    char s[6];
    cin >> s;

    cout << (strstr(s, "AC") ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 768
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

ll a,b,k,m[6][6];

int main() {
    fast;
    cin>>a>>b>>k;
    for(int q=0; q<a; q++){
        str t; cin>>t;
        for(int w=0; w<b; w++){
            m[q][w] = t[w]=='#';
        }
    }
    int all = 1<<(a+b), o =0 ;
    for(int mask=0; mask<all; mask++){
        vec<int> row(a), col(b);
        for(int q=0; q<a+b; q++){
            if(!(mask&(1<<q))) continue;
            if(q<a) row[q] = 1;
            else col[q-a] = 1;
        }
        int  e =0;
        for(int q=0; q<a; q++){
            for(int w=0; w<b; w++){
                e += row[q]&&col[w]&&m[q][w];
            }
        }
        o += e==k;
    }
    cout<<o;
}

Measured memory_bytes: 3620
#include <cstdio>
using namespace std;
int k,cnt;
long long ans;
void ctr(int len,long long i){
	if(len==0){
		++cnt;
		if(cnt==k)ans=i;
		return;
	}
	if(i%10!=0)ctr(len-1,i*10+i%10-1);
	if(ans)return;
	if(i%10!=100)ctr(len-1,i*10+i%10);
	if(ans)return;
	if(i%10!=9)ctr(len-1,i*10+i%10+1);
	if(ans)return;
}
void cr(int len){
	for(int i=1;i<=9;++i){
		ctr(len-1,i);
		if(ans)return;
	}
}
int main(){
	scanf("%d",&k);
	for(int i=1;1;++i){
		cr(i);
		if(ans)break;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 128
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define forr(i,n) for(int i=int(n-1);i>=0;i--)
#define fora(i,a,b) for(int i=int(a);i<=int(b);i++)
#define forb(i,a,b) for(int i=int(a);i>=int(b);i--)
#define mod 1000000007
using namespace std;
using ll=long long int;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vii;
typedef pair<ll ,ll> pii;
ll n;
int ans=0;
void solve()
{
	int n;
	cin>>n;
	ll mx=-1e15,mn=1e18,mx1=-1e15,mn1=1e18;
	forn(i,n)
	{
		ll a,b;
		cin>>a>>b;
		mx=max(a+b,mx);
		mn=min(a+b,mn);
		mx1=max(a-b,mx1);
		mn1=min(a-b,mn1);
	}

	cout<<max(abs(mx-mn),abs(mx1-mn1))<<endl;

}

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
	solve();
    return 0;
}


Measured memory_bytes: 3572
import collections
N=int(input())
a=[]
for i in range(N):
  A=int(input())
  a.append(A)
c=collections.Counter(a)
for i in c.keys():
  if c[i]%2==0:
    N-=c[i]
  else:
    N-=c[i]-1
print(N)



Measured memory_bytes: 16612
using System;
using System.Linq;
using System.Numerics;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string[] str=Console.ReadLine().Split(' ');
    long N=long.Parse(str[0]);
    long D=long.Parse(str[1]);
      int ans=0;
      for(int i=1;i<=N;i++){
       string[] str2=Console.ReadLine().Split(' ');
        long X=long.Parse(str2[0]);
        long Y=long.Parse(str2[1]);
      long tmpsq=(long)Math.Pow(X,2)+(long)Math.Pow(Y,2);
      long tmp=(long)Math.Ceiling(Math.Sqrt(tmpsq));
       
        if(tmp<=D){
          ans++;
        }
      }
      Console.WriteLine(ans);
    }
    
  }

}


Measured memory_bytes: 46112
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mx2 102
#define mx3 1003
#define mx4 10004
#define mx5 100005
#define mx6 1000006
#define mod 1000000007
#define PI 3.14159265
#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0 ; i<n ; i++)
#define Fo(i,k,n) for(int i=k ; i<n ; i++)
 
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pair<int,int>,int> piii;

const int inf=0x3f3f3f3f;
int n , ans , sum , a , b ,arr[22][22] ;
string str;
 
int main() {
	ios::sync_with_stdio(false);
	//int t;cin>>t;while(t--)
	{
		cin>>n;
		int dp[1<<n]={0};
		fo(i,n)
		{
			fo(j,n)
			{
				cin>>arr[i][j];
			}
		}
		dp[0]=1;
		fo(i,(1<<n)-1)
		{
			int a=__builtin_popcount(i);
			fo(b,n)
			{
				if(arr[a][b]&&!(i&(1<<b)))
				{
					dp[(i^(1<<b))]=(dp[i]+dp[(i^(1<<b))])%mod;
				}
			}
		}
		cout<<dp[(1<<n)-1];
	}
	return 0;
}


Measured memory_bytes: 8576
#include "bits/stdc++.h"
using namespace std;

constexpr long long MOD = 998244353;

int main() {
	long long N, M;
	cin >> N >> M;
	vector<pair<long long, long long> > VA(N - 2, { 0, 0 });
	vector<vector<long long> > VB(N, vector<long long>(3, -1));
	map<pair<long long, long long>, pair<long long, long long> > mp;
	for (int i = 0; i < M; i++) {
		long long A, B, C;
		cin >> A >> B >> C;
		A--, B--;
		if (abs(A - B) >= 3) mp[{min(A, B), max(A, B)}].first++, mp[{min(A, B), max(A, B)}].second += C;
		else if (abs(A - B) == 2) VA[min(A, B)].first++, VA[min(A, B)].second += C;
		else {
			if (A + 1 == B) {
				VB[B][0] = C;
			}
			if (A == B) {
				VB[A][1] = C;
			}
			if (A == B + 1) {
				VB[A][2] = C;
			}
		}
	}
	vector<vector<long long> > DP(N, vector<long long>(8, 0));
	if (VB[0][1] == -1) DP[0][0] = 1, DP[0][2] = 1;
	if (VB[0][1] == 0) DP[0][0] = 1;
	if (VB[0][1] == 1) DP[0][2] = 1;
	for (int i = 0; i < 2; i++) {
		if (VB[1][0] == 1 - i) continue;
		for (int j = 0; j < 2; j++) {
			if (VB[1][1] == 1 - j) continue;
			for (int k = 0; k < 2; k++) {
				if (VB[1][2] == 1 - k) continue;
				DP[1][i + j * 2 + k * 4] += DP[0][((i + j + k) % 2) * 2];
			}
		}
	}
	for (int i = 2; i < N; i++) {
		for (int j = 0; j < 8; j++) {
			int X[3] = {};
			X[0] = j % 2;
			X[1] = (j / 2) % 2;
			X[2] = (j / 4) % 2;
			int Z;
			if (VA[i - 2].first == 0) Z = 2;
			if (VA[i - 2].first == 1) Z = 1;
			if (VA[i - 2].first == 2) {
				if (VA[i - 2].second % 2 == X[1]) Z = 1;
				else continue;
			}
			for (int k = 0; k < 8; k++) {
				int Y[3] = {};
				Y[0] = k % 2;
				Y[1] = (k / 2) % 2;
				Y[2] = (k / 4) % 2;
				if (VB[i][0] == 1 - Y[0] || VB[i][1] == 1 - Y[1] || VB[i][2] == 1 - Y[2]) continue;
				if ((X[1] + Y[0] + Y[1] + Y[2]) % 2 == 1) continue;
				DP[i][k] += DP[i - 1][j] * Z;
				DP[i][k] %= MOD;
			}
		}
	}
	long long ANS = 0;
	for (int i = 0; i < 8; i++) {
		ANS += DP[N - 1][i];
		ANS %= MOD;
	}
	long long COUNT = (N - 2) * (N - 3) / 2;
	for (auto it = mp.begin(); it != mp.end(); it++) {
		if (it->second.first == 1) COUNT--;
		else if (it->second.first == 2) {
			if (it->second.second % 2 == 0) COUNT--;
			else {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	long long NOW = 2;
	while (COUNT > 0) {
		if (COUNT % 2 == 1) ANS *= NOW, ANS %= MOD;
		NOW = (NOW * NOW) % MOD;
		COUNT >>= 1;
	}
	cout << ANS << endl;
}

Measured memory_bytes: 21376
a = raw_input()
b = raw_input()

a = "".join( sorted( list(a) ) )
b = "".join( sorted( list(b) ) )

yes = True
printed = False

if len(a) < len(b):
    i = 0
    while i < len(a):
        if a[i] != b[i]:
            yes = False
            break
        i += 1
    if yes:
        print "Yes"
        printed = True

if not printed and len(b) > 0:
    i = 0
    b = "".join( sorted( list(b), reverse = True ) )

    while i < len(a) and i < len(b):
        if a[i] < b[i]:
            print "Yes"
            printed = True
            break
        elif a[i] > b[i]:
            print "No"
            printed = True
            break
        i += 1
if not printed:
    print "No"


Measured memory_bytes: 2696
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long[] bounding = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long N = inputLongArray[0];
            long X = inputLongArray[1];
            long boundingSum = 0;
            int cnt = 1;
            for(int j = 0; j < N; j++)
            {
                boundingSum += bounding[j];
                if(boundingSum <= X)
                {
                    cnt++;
                }
            }
            Console.WriteLine(cnt);

        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


Measured memory_bytes: 13268
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int N;
    cin >> N;
    int res = N;
    REP(i, N + 1) {
        int c = 0;
        int t = i;
        while (t > 0) {
            c += t % 6;
            t /= 6;
        }
        t = N - i;
        while (t > 0) {
            c += t % 9;
            t /= 9;
        }
        amin(res, c);
    }
    cout << res << endl;
    return 0;
}


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

    string s;
    cin >> s;

    int begin = 0;
    int end = 0;
    
    string result;

    if(s.size() == 1) {
        if(s == "A" || s == "C" || s == "G" || s == "T") {
            result = s;
        }
        else {
            result = "";
        }
    }
    else {
        bool finding = false;
        for(int i=0; i<s.size(); i++) {
            string focus_s = s.substr(i,1);
            if(focus_s == "A" || focus_s == "C" || focus_s == "G" || focus_s == "T") {
                end = i;
                if(!finding) {
                    begin = i;
                    finding = true;
                } 
            }
            else {
                if(result.size() <= end-begin+1) {
                    result = s.substr(begin, end-begin+1);
                }
                finding = false;
            }
            
            if(i == s.size()-1) {
                if(begin>=end && finding && result.size() <= 1) {
                    result = s.substr(begin, 1);
                }
                else {
                    if(result.size() <= end-begin+1) {
                        result = s.substr(begin, end-begin+1);
                    }
                }
            }
        }
    }
    if(result.size() == 1 && !(result == "A" || result == "C" || result == "G" || result == "T")) {
        result = "";
    }
    
    
    cout << result.size() << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>
#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222






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


  cin >> s;
  if (s == "Sunny") cout << "Cloudy" << endl;
  else if (s == "Cloudy") cout << "Rainy" << endl;
  else cout << "Sunny" << endl;





  return 0;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
S = list(input() for i in range(N)) 
my_count = Counter(S)
print('AC x {}'.format(my_count['AC']))
print('WA x {}'.format(my_count['WA']))
print('TLE x {}'.format(my_count['TLE']))
print('RE x {}'.format(my_count['RE']))

Measured memory_bytes: 16472
import sys
sys.setrecursionlimit(10**7)
import math
mod = 10**9 + 7
def I(): return int(input())
def II(): return map(int, input().split())
def L(): return list(map(int, input().split()))
def TWO(M):
  L=[0]*M
  R=[0]*M
  for i in range(M):
    L[i],R[i] = II()
  return L, R

N,D = II()
ans = 1
right = 2*D+1
while 1:
  if right >= N:
    break
  right += 2*D+1
  ans += 1
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#include <boost/foreach.hpp>
using namespace std;
#define pi 2*asin(1.0)
#define MAX 10000000
#define MOD 1000000007
#define _GLIBCXX_DEBUG


/////////////////////////


//Answer


int main() {
long N,flag=0;
cin>>N;
for(long i=1;i<10;i++){
    if(N%i==0&&N/i<10){
        flag=1;
        break;
    }
}
if(flag){
    cout<<"Yes"<<endl;
}else{
    cout<<"No"<<endl;
}


}



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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<int,int>;

const int MOD = 1e9 + 7;

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

    int n, t, a;
    cin >> n >> t >> a;
    vector<double> h(n);
    int ans = 1;
    rep(i, n){
        int x;
        cin >> x;
        h[i] = t - x * 0.006 - a;
        if(h[i] < 0) h[i] = -h[i];
        if(h[ans-1] > h[i]) ans = i + 1;
    }

    cout << ans << endl;

    return 0;
}


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

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

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    int N,M;
    cin >> N >> M;
    ll X[N],Y[N],Z[N];

    rep(i,N) {
        ll x,y,z;
        cin >> x >> y >> z;
        X[i] = x;
        Y[i] = y;
        Z[i] = z;
    }
    ll ans = 0;
    for (int bit=0; bit<(1<<3); bit++) {
        vector<ll> tmp(0);
        rep(i,N) {
            ll x, y, z;
            if (bit & (1<<2)) x = X[i];
            else x = -X[i];
            if (bit & (1<<1)) y = Y[i];
            else y = -Y[i];
            if (bit & (1<<0)) z = Z[i];
            else z = -Z[i];

            ll t = x + y + z;
            tmp.push_back(t);
        }
        sort(tmp.begin(),tmp.end());
        reverse(tmp.begin(),tmp.end());
        ll ans_tmp = 0;
        rep(i,M) {
            ans_tmp += tmp[i];
        }
        ans = max(ans, ans_tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

void see(string msg,const vector<int> &are) {
    cout << msg << endl;
    for(const auto &a:are) cout << a << endl;
}

int main() {
    int N;
    cin >> N;
    // 0からiまで行った時のコスト
    vector<int> s(N+2,0);
    // iからgoalまで行った時のコスト
    vector<int> g(N+2,0);
    vector<int> p(N+2,0);
    p[N+1]=0;
    REP(i,N) cin >> p[i+1];
    // see("p",p);
    // 累積和
    FOR(i,1,N+2) {
        s[i]=abs(p[i]-p[i-1])+s[i-1];
    }
    // 累積和を使ってiからgoalを出す
    REP(i,N+2) g[i]=s[N+1]-s[i];
    // see("s",s);
    // see("g",g);
    FOR(i,1,N+1) {
        if (i==1) {
            cout << abs(p[i+1])+g[i+1] << endl;
            continue;
        }
        if (i==N) {
            cout << s[N-1]+abs(p[N-1]);
            continue;
        }
        cout << s[i-1]+abs(p[i+1]-p[i-1])+g[i+1] << endl;
    }
    return 0;
}


Measured memory_bytes: 2432
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_HCNT_MAX		100005									// 最大配列数

// 内部変数
static FILE *szpFpI;											// 入力
static int siHCnt;												// 人数
static int siOCnt;												// 指示回数
static char sc1Str[D_HCNT_MAX];									// 文字列
static int siLen;												// 文字列長
static int si1Sum[D_HCNT_MAX];									// 集計
static int siSCnt;												// 集計数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// 出力
int
fOut(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 改行カット
// 戻り値：文字数
int
fCutCrLf(
	char *pcpStr				// <I> 文字列
)
{
	int i;

	for (i = 0; pcpStr[i] != '\0'; i++) {
		if (pcpStr[i] == '\n') {
			pcpStr[i] = '\0';
			break;
		}
	}

	return i;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 人数・指示回数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d", &siHCnt, &siOCnt);

	// 文字列 - 取得
	fgets(sc1Str, sizeof(sc1Str), szpFpI);

	// 文字列長
	siLen = fCutCrLf(sc1Str);

	// 集計 - セット - １文字目
	if (sc1Str[0] == '1') {					// 逆立ち
		si1Sum[0] = 1;
		siSCnt = 1;
	}
	else {									// 直立
		si1Sum[1] = 1;
		siSCnt = 2;
	}

	// 集計 - セット - ２文字目以降
	for (i = 1; i < siLen; i++) {
		if (sc1Str[i - 1] == sc1Str[i]) {
			si1Sum[siSCnt - 1]++;
		}
		else {
			si1Sum[siSCnt] = 1;
			siSCnt++;
		}
	}

	// 直立数
	int liUCnt = siSCnt / 2;

	// 指示回数 - チェック
	if (siOCnt > liUCnt) {
		siOCnt = liUCnt;
	}

	// 合計
	int liMax = 0;
	for (i = 0; i < siOCnt * 2 + 1; i++) {
		liMax += si1Sum[i];
	}

	// 他のパターン数
	int liPCnt = liUCnt - siOCnt;

	// 他のパターン
	int liSum = liMax;
	for (i = 0; i < liPCnt; i++) {
		liSum -= si1Sum[i * 2];
		liSum -= si1Sum[i * 2 + 1];
		liSum += si1Sum[(siOCnt + i) * 2 + 1];
		liSum += si1Sum[(siOCnt + i) * 2 + 2];

		// 合計 - 更新
		if (liMax < liSum) {
			liMax = liSum;
		}
	}

	return liMax;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// データ - 初期化
	memset(si1Sum, 0, sizeof(si1Sum));							// 集計

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOut(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 640