akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod=1e9+7;
int main()
{
    ll i,j,h,w;
    cin>>h>>w;
    char grid[h][w];
    ll dp[h][w];
    for(i=0;i<h;i++)
    {
        for(j=0;j<w;j++)
            cin>>grid[i][j];
    }
    dp[0][0]=1;
    for(i=1;i<w;i++)
    {
        if(grid[0][i]=='.')
            dp[0][i]=dp[0][i-1];
        else dp[0][i]=0;
    }
    for(i=1;i<h;i++)
    {
        if(grid[i][0]=='.')
            dp[i][0]=dp[i-1][0];
        else dp[i][0]=0;
    }
    for(i=1;i<h;i++)
    {
        for(j=1;j<w;j++)
        {
            if(grid[i][j]=='.')
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
            else dp[i][j]=0;
        }
    }
    cout<<dp[h-1][w-1]<<endl;
    return 0;
}


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

int fun(char a, char b) {
    return a == 'A' && b == 'C';
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> list(n, {0, 0});
    rep(i, n) {
        cin >> list[i].first >> list[i].second;
    }

    sort(list.begin(), list.end(), [](auto a, auto b) { return a.first < b.first; });

    int cnt = 0;
    ll ans = 0LL;
    for (auto p : list) {
        if (cnt + p.second < m) {
            cnt += p.second;
            ans += (ll)p.first * (ll)p.second;
        } else {
            ans += (ll)p.first * (ll)(m - cnt);
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a >=-1000 && a <= 1000) {
				if(b >=-1000 && b <= 1000) {
					
					if(a>b) {
						System.out.println("a > b");									
					}else if(a<b) {
						System.out.println("a < b");									
						
					} else {
						System.out.println("a == b");															
					}
				}
			}
		}
	}
}

Measured memory_bytes: 26128
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n, a;
    cin >> n;
    map<ll, ll> mp;
    ll s = 0LL;
    for(int i=0;i<n;++i) {
        cin >> a;
        ++mp[a];
        s += a;
    }

    int q;
    ll b, c;
    cin >> q;
    for(int i=0;i<q;++i) {
        cin >> b >> c;
        s -= mp[b] * b;
        s += mp[b] * c;
        mp[c] += mp[b];
        mp[b] = 0;
        cout << s << endl;
    }
}


Measured memory_bytes: 9512
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int n, h; cin >> n >> h;
  VI a(n), b(n); for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  int ma = *max_element(a.begin(), a.end());
  sort(b.rbegin(), b.rend());
  int res = 0;
  for (int i = 0; i < n; i++) {
    if (h <= 0 or b[i] < ma) break;
    h -= b[i];
    res++;
  }
  if (h > 0) res += (h + ma - 1) / ma;
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int a;
	string s;
	cin >>a>>s;
	cout<<((a<3200)?"red":s)<<endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main(void){
   int n,m;
   cin>>n>>m;
   
   vector<int> x(m,0);
   vector<int> a(m-1,100010);
   int b=0,cnt=1;

   
   for(int i=0;i<m;i++){
       cin>>x[i];
   }
   
 /*  for(int i=0;i<m;i++){
       for(int j=m-1;j>i;j--){
         if(x[j]<x[j-1]) swap(x[j],x[j-1]);
       }
   }
   */
   sort(x.begin(),x.end());
   
   /* for(int i=0;i<m;i++){
       cout<<x[i]<<endl;
    }*/
   
   for(int i=0;i<m;i++){
       if(i!=0){
        a[i-1]=x[i]-x[i-1];
        b+=a[i-1];
       }
   }
   
   //cout<<b<<endl;
   
/*   for(int i=0;i<m;i++){
       for(int j=m-1;j>i;j--){
         if(a[j]<a[j-1]) swap(a[j],a[j-1]);
       }
   }
      */
    sort(a.begin(),a.end());
      
/*   for(int i=0;i<m;i++){
       cout<<a[i]<<endl;
   }
*/
   if(m<n) cout<<0<<endl;
   else {
       for(int i=m-2;cnt<n;i--){
          b-=a[i];
          cnt++;
        //  cout<<b<<endl;
          }
   
         cout<<b<<endl;
   }
   return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int count=0;
  for(int i=0; i<1000; i++){
    vector<int> c(3);
    c[0] = i/100;
    c[1] = (i-(i/100)*100)/10;
    c[2] = i%10;
    int f=0;
    for(int j=0; j<N; j++){
      int s = S[j] - '0';
      if(s == c[f]){
        f++;
      }
      if(f == 3){
        count++;
        break;
      }
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split(" ")))

s = sum(a)

# |x - y| = |x - (s - x)| = |2x - s|

x = [a[0]]*(N-1)

for i in range(1,N-1):
    x[i] = x[i-1]+a[i]

print(min(map(lambda y:abs(2*y-s),x)))

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 0x3fffffff;

ll solve(ll N, ll a){
	ll l=-1, r = 1e16;
	while(r-l>1){
		ll m = (l+r) / 2ll;
		if( a - m*(N-1) < N ){
			r = m;
		}else{
			l = m;
		}
	}
	cout << a << ":" << r << endl;
	return r;
}

int main(){
	//ios_base::sync_with_stdio(0);
	ll N, ans=0;
	ll a[305];

	cin >> N;
	rep(i,N) cin >> a[i];

	//priority_queue<ll, vector<ll>, greater<ll>> que;
	priority_queue<ll> que;
	rep(i,N) que.push( a[i] );
	ll line = N;
	while( que.top() >= line ){
		auto k = que.top();
		que.pop();
		ll m = (k - line + N) / N;
		//cout << "k=" << k << " m=" << m << endl;
		line -= m;
		que.push( k - m*(N+1) );
	}

	ans = N - line;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>

void output(std::vector<int>& v)
{
	size_t size = v.size();
	for (size_t i = 0; i < size; i++)
	{
		std::ostringstream item;
		item << v[i];

		std::cout << "Case " << i+1 << ": " << item.str() << std::endl;
	}
}

int main()
{
	std::vector<int> numbers;
	int input;
	std::cin >> input;

	while (input != 0)
	{
		numbers.push_back(input);
		std::cin >> input;
	}

	output(numbers);
	return 0;
}


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

int main(){
	int N;
	cin>>N;
	
	bool exist=0;
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(N==4*i+7*j)
				exist=1;
		}
	}
	
	if(exist)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;//左から k + 1 文字目以降の数字列を整数とみなした時の値an + 10an−1 + ... + 10n−k−1ak+1 を Tk
using vc = vector<char>;//Ti−1 == Tj (mod2019)の時に満たす
using vb = vector<bool>;
const int INFTY =2147483647;
int main(){
    string s;
    int ans=0,m[200005],a[2020]={};
    cin>>s;
    int n=s.length(),k=1;
    m[n]=0;
    a[0]++;
    for(int i=n-1;i>=0;i--){
        m[i]=(m[i+1]+(s[i]-'0')*k)%2019;
        k=(k*10)%2019;
        a[m[i]]++;
    }
    REP(i,2020){
        if(a[i]>=2) ans+=(a[i]*(a[i]-1))/2 ;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4528
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int max_ = 0;
    string input, x, y;
    cin >> input;
    cin >> input;
    for(int i = 1; i < input.size(); i++){
        x = input.substr(0, i);
        y = input.substr(i, input.size() - i);
        set<char> xs, ys;
        for(string::iterator itr = x.begin(); itr < x.end(); itr++){
            xs.insert(*itr);
        }
        int sum = 0;
        for(set<char>::iterator itr = xs.begin(); itr != xs.end(); itr++){
            if(find(y.begin(), y.end(), *itr) != y.end()) sum++;
        }
        if(max_ < sum)
            max_ = sum;
    }
    cout << max_ << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
const int INF = 1e9;



signed main()
{
    int N;
    cin >> N;
    cout << "ABC" << N << endl;
}


Measured memory_bytes: 256
;;; [練習] Enderedさんの提出を参考にしています
(let ((h (read)) (w (read)))
  (dotimes (i h)
    (let ((s (read-line)))
      (progn
        (princ s)
        (princ #\newline)
        (princ s)
        (princ #\newline)))))



Measured memory_bytes: 6368
use std::collections::*;
use std::io::*;
use std::*;
// template {{{
macro_rules! get {
    ($($t:tt),*; $n:expr) => {
        {
            let stdin = std::io::stdin();
            let ret = std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
                let line = line.unwrap();
                let mut it = line.split_whitespace();
                _get!(it; $($t),*)
            }).collect::<Vec<_>>();
            ret
        }
    };
    ($($t:tt),*) => {
        {
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut it = line.split_whitespace();
            _get!(it; $($t),*)
        }
    };
}
macro_rules! _get {
    ($it:ident; [char]) => {
        _get!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; [u8]) => {
        _get!($it; String).bytes().collect::<Vec<_>>()
    };
    ($it:ident; usize1) => {
        $it.next().unwrap().parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap().parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:tt),+) => {
        ($(_get!($it; $t)),*)
    };
}
// }}}

fn main() {
    let x = get!(i32);
    println!("{}", if x >= 30 { "Yes" } else { "No" });
}


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

using namespace std;

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

    for(int i = 0; i <= n; i++)
    {
        int cnt = 0;
        int tmp = i;
        while(tmp > 0)
        {
            cnt += tmp % 6;
            tmp /= 6;
        }

        tmp = n - i;
        while(tmp > 0)
        {
            cnt += tmp % 9;
            tmp /= 9;
        }

        if(res > cnt)
        {
            res = cnt;
        }
    }

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

Measured memory_bytes: 256
#define ONLINE_JUDGE
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

void solve();

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

void solve(){
    ll a,b;cin>>a>>b;
    cout<<(a*b%2?"Odd":"Even")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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; }


ll beki(ll a, ll n)
{
    if(n == 0){
        return 1;
    }
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1){
        ans = ans * a;
    }
    return ans;
}

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

    ll N,K; cin >> N >> K;

    if(K % 2 != 0){cout << beki(N/K, 3) << endl; return 0;}
    else {cout << beki(N/K, 3) + beki((N + K / 2) / K, 3) << endl; return 0;}
}

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

long long INF = 1e18;

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

    long long a, b, q;
    cin >> a >> b >> q;
    vector<long long> s(a);
    vector<long long> t(b);
    for(int i = 0; i < a; i++){
        cin >> s[i];
    }
    for(int i = 0; i < b; i++){
        cin >> t[i];
    }
    s.push_back(INF);
    s.push_back(-INF);
    t.push_back(INF);
    t.push_back(-INF);
    
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());

    for(int i = 0; i < q; i++){
        long long x;
        cin >> x;
        long long ans = INF;

        for(int j = 0; j < 2; j++){
            long long first;
            if(j % 2 == 0) first = lower_bound(s.begin(), s.end(), x) - s.begin(); //自分自身を含む
            else first = upper_bound(s.begin(), s.end(), x) - s.begin() - 1; //自分自身を含まない

            for(int k = 0; k < 2; k++){
                long long second;
                if(k % 2 == 0) second = lower_bound(t.begin(), t.end(), s[first]) - t.begin();
                else second = upper_bound(t.begin(), t.end(), s[first]) - t.begin() - 1;

                ans = min(ans, abs(x - s[first]) + abs(s[first] - t[second]));
            }
        }

        for(int j = 0; j < 2; j++){
            long long first;
            if(j % 2 == 0) first = lower_bound(t.begin(), t.end(), x) - t.begin(); //自分自身を含む
            else first = upper_bound(t.begin(), t.end(), x) - t.begin() - 1; //自分自身を含まない

            for(int k = 0; k < 2; k++){
                long long second;
                if(k % 2 == 0) second = lower_bound(s.begin(), s.end(), t[first]) - s.begin();
                else second = upper_bound(s.begin(), s.end(), t[first]) - s.begin() - 1;

                ans = min(ans, abs(x - t[first]) + abs(t[first] - s[second]));
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 2912
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cctype>


using namespace std;
#define modd 1000000007



typedef pair<long long, long long> pl;


typedef string::const_iterator State;
class ParseError {};




#define ll long long




class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL){
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};


class SegmentTree {
private:
	int n;
	vector <ll> node;

public:
	// 元の配列　v をセグメントツリーで表現する。
	SegmentTree(vector<ll> v) {
		//最下段のノード数は元配列のサイズ以上になる最小の2冪->これをnとおく。
		//セグ木全体で必要なノード数は2n-1個である。
		int sz = v.size();
		n = 1; 
		while (n < sz)n *= 2;

	}

};




long long N, M, K, a, b, c, d, e, H, W, L;
ll A[300005] = {};
ll B[300005] = {};
ll C[300005] = {};
bool f, ff;
string S[2][2][2];
set <long long>sll;
pl bufpl;
vector <long long>vl[100005];
vector <long long>vll;
vector <pl>vpl;
vector <string> vs;
set<ll> llset;
multiset<ll> llmset;


struct ST
{
	int kaisuu;
	int dan;
	int score;
	char situ[52][2][2];
	

	bool operator<(const ST& another) const
	{
		return dan < another.dan;//比較
	};

};



/*vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/


long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}


ll minn, maxx;
double ansa;
bool fl[2] = {};

queue<ST> qST[101];
ST bufST;
char ss[2][2];
char otiru[3][2][2][2];


int heikou[3];
bool nai[3][2];
int kai = 0;
int da = 0;
int mogureru = 0;
int ana = 0;
int aruhou[3];


int main() {

	cin >> a>>b;

	c = -10000000000;

	c = max(c, a * b);
	c = max(c, a + b);
	c = max(c, a - b);

	cout << c << endl;

	return 0;

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
    int n;
    cin >> n;
    ll ans = 0;
    int memo = 0;
    for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) for(int l=1; l<=n; l++){
        memo = __gcd(i, j);
        ans += __gcd(memo, l);
    } 
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using LL = long long;
using ULL = unsigned long long;


void solve() {
	int n; cin >> n;
	int pp[40000]; rep(i, n) { int p; cin >> p; pp[p-1] = i; }
	for (int i = 0; i < n; i++) {
		if (i != 0) cout << " ";
		cout << n * i + pp[i] + 1;
	}cout << endl;
	for (int i = 0; i < n; i++) {
		if (i != 0) cout << " ";
		cout << n * (n - i);
	}cout << endl;
}

int main() {

	solve();

	return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std ;
 
int main(){
   ios_base :: sync_with_stdio( 0 ) ;
   cin.tie( 0 ) ;
   cout.tie( 0 ) ;
 
   int n ;
   cin >> n ;
   vector<int>a(n) ;
   for(int i = 0 ; i < n ; i++ ){
     cin >> a[i] ;
   }
 
   int mx = 0 ;
   vector<int>bk ;
   bk.push_back(a[0]) ;
   for( int i = 1 ; i < n ; i++ ){
      if( bk.back() < a[i] ){
         int cn = 0 ;
         while( bk.size() ){
            cn++;
            bk.pop_back();
         }
        mx = max(cn, mx);
      }
      bk.push_back(a[i]) ;
   }
 
   mx = max( (int)bk.size() , mx ) ;
   cout << mx - 1 ;
 
 
}

Measured memory_bytes: 1276
#include <stdio.h>
#include <string.h>

#define lli long long int

using namespace std;

lli n, m, s[2010], t[2010], memo[2010][2010], bigmod = 1000000007;

lli dp(lli a, lli b) {
	lli ret;
	if ((a == n) || (b == m))
		return 1;
	if (memo[a][b] != -1)
		return memo[a][b];
	ret = (dp(a + 1, b) + dp(a, b + 1) - dp(a + 1, b + 1) + bigmod) % bigmod;
	if (s[a] == t[b])
		ret = (ret + dp(a + 1, b + 1)) % bigmod;
	memo[a][b] = ret;
	return ret;
}

int main() {
	lli ans;
	scanf("%lld %lld", &n, &m);
	for (lli i = 0; i < n; i++)
		scanf("%lld", &s[i]);
	for (lli i = 0; i < m; i++)
		scanf("%lld", &t[i]);
	memset(memo, -1, sizeof memo);
	ans = dp(0, 0);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 32000
#include<bits/stdc++.h>
using namespace std;
//define
typedef pair<int,int>pi;
#define int long long
#define elif else if
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define vint vector<int>
#define vvint vector<vector<int>>
#define vtr vector<string>
#define vvtr vector<vector<string>>
#define vhar vector<char>
#define vvhar vector<vector<char>>
#define mod 100000007
#define elif else if
#define str string
int sum(int a){
  int b=0;
  while(a){
      b+=a%10;
      a/=10;
  }
  return b;
}
signed main(){
  int N,M,O,P=0,c=0,c2=0,toSearch=1;
  double D,D2;
  char C;
  str S,T,U;
  cin>>N;
  vint a(N);
  rep(0,N)cin>>a[i];
  rep(0,N){
    if(toSearch==a[i]){
      toSearch++;
    }
    else c++;
  }
  c==N?cout<<-1<<endl:cout<<c<<endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


ll gcd(ll a, ll b) {
	//0を単位元とみなしている
	if (a == 0)return b;
	if (b == 0)return a;
	if (a%b == 0)return b;
	return gcd(b, a%b);
}

template<class T>
class SegTree {
	int n;
	vector<T>data;
	T def;
	function<T(T, T)>operation;
	function<T(T, T)>update;

	T _query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l)return def;
		if (a <= l && r <= b)return data[k];
		else {
			T c1 = _query(a,b,2*k+1,l,(l+r)/2);
			T c2 = _query(a,b,2*k+2,(l+r)/2,r);
			return operation(c1, c2);
		}
	}

public:
	SegTree(size_t _n, T _def, function<T(T, T)>_operation,
		function<T(T, T)>_update) 
		:def(_def), operation(_operation), update(_update) {
		n = 1;
		while (n < _n) {
			n *= 2;
		}
		data = vector<T>(2 * n - 1, def);
	}

	void change(int i,T x){
		i += n - 1;
		data[i] = update(data[i],x);
		while (i > 0) {
			i = (i - 1) / 2;
			data[i] = operation(data[2*i+1],data[2*i+2]);
		}
	}

	//[a,b)
	T query(int a, int b) {
		return _query(a, b, 0, 0, n);
	}

	T operator[](int i) {
		return data[i + n - 1];
	}
};


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

	int N;
	cin >> N;
	SegTree<ll>st(N, 0, [](ll a, ll b) {return gcd(a, b); }, [](ll a, ll b) {return b; });
	for (int i = 0; i < N; i++) {
		ll A;
		cin >> A;
		st.change(i,A);
	}

	ll ans = -inf;
	for (int i = 0; i < N; i++)ans = max(ans,gcd(st.query(0,i),st.query(i+1,N)));
	puts(ans);
	return 0;
}


Measured memory_bytes: 2304
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	string res=a+b;
     int chk=stoi(res);
     int d=sqrt(chk);
     cout<<(d*d==chk? "Yes": "No");
     
     
     
}

Measured memory_bytes: 256
import math
import sys

is_prime = [i for i in range(1000000)]

is_prime[0] = is_prime[1] = False

for i in range(2,1000000):
    is_prime[i] = True

for i in range(2,1000000):
    if i*i >= 1000000:
        break
    if is_prime[i]:
        for j in range(i*i,1000000,i):
            is_prime[j] = False

n_prime = [i for i in range(1000000)]
cnt = 0
for i in range(1000000):
    if is_prime[i]:
        cnt += 1
    n_prime[i] = cnt

a=[]
for i in sys.stdin:
    a.append(int(i))
for i in range(0,len(a)):
    print(n_prime[a[i]])


Measured memory_bytes: 53044
#include <bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mp<i,i> map<int,int>
#define f(i,n) for(i=0;i<n;i++)
#define fr(i,n) for(i=1;i<=n;i++)
#define fi first
#define se seecond
#define in insert

using namespace std;

int main() {
    char s;
    cin>>s;
    
    if(s>92)cout<<'a';
    else cout<<'A';
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ABC148E - Double Factorial
  // 後ろに10が何個付くか = 10で何回割れるか
  // = 素因数分解したとき2と5がセットで何回出てくるかと同義
  // 素因数で2と5を比較すると明らかに5の方が少ない = 5だけ調べればok
  // 100までの数値で考えると以下のようになる
  // 2, 4, 6, 8, 10, 12, 14,...98, 100
  // 2*5, 4*5, 6*5, 8*5, 10*5, 12*5,...20*5(10個)
  // ここまでで10個の5が出てくる。残り5を素因数として持つのは
  // 10, 20
  // 2*5, 4*5(2個)
  // Nを5で割った答えから1/2を加算
  // Nが0になるまで5の除算を繰り返し、ansには1/2を加算していく
  ll N; cin >> N;
  if(N%2){
    cout << 0 << endl;
    return 0;
  }
  ll ans = 0;
  while(N){
    N = N/5;
    ans += N/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define NIL -1

struct node{
  int parent;
  int left;
  int right;
};

struct node t[100005];
int n,d[100005];

  void print(int u)
{
  int i,c;

  printf("node %d: parent = %d, depth = %d, ",u,t[u].parent,d[u])\
;
  if(t[u].parent ==NIL) printf("root, ");
  else if(t[u].left == NIL) printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i=0,c=t[u].left;c!=NIL;i++,c=t[c].right){
    if(i>0) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

void setdep(int u,int p)
{
  d[u]=p;
  if(t[u].right!=NIL) setdep(t[u].right,p);
  if(t[u].left!=NIL) setdep(t[u].left,p+1);
}

int main(){
  int id,k,i,j,c,l,r;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    t[i].parent=t[i].left=t[i].right=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d",&id);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&c);
      if(j==0) t[id].left=c;
      else t[l].right=c;
      l=c;
      t[c].parent=id;
    }
  }
for(i=0;i<n;i++){
  if(t[i].parent==NIL) r=i;
}
setdep(r,0);
for(i=0;i<n;i++){
  print(i);
}
  return 0;
}



Measured memory_bytes: 6384
num=int(input())
lis=[]
staro=0
shanako=0
for x in range(num):
	lis.append(input().split(' '))

for i in lis:
	taro=i[0]
	hanako=i[1]

	if taro > hanako:
		staro+=3

	elif taro < hanako:
		shanako+=3

	else:

		staro+=1
		shanako+=1

print(f"{staro} {shanako}")


Measured memory_bytes: 5724
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))

k,x = map(int, input().split())

for i in range(k*2-1):
    print(x-k+1+i, end=" ")




Measured memory_bytes: 9120
#include <stdio.h>
#include <stdlib.h>

int distance(int h1,int h2){
  if(h1 >= h2){
    return h1 - h2;
  }else{
    return h2 - h1;
  }
}

int min(int i,int j){
  if(i > j) return j;
  else return i;
}

int main(){
  int n;
  int h[100000];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&h[i]);
  }
  int dp[100000];
  dp[0] = 0;
  dp[1] = distance(h[1],h[0]);
  int cost1,cost2;
  for(int i=2;i<n;i++){
    cost1 = distance(h[i-1],h[i]);
    cost2 = distance(h[i-2],h[i]);
    dp[i] = min(dp[i-2]+cost2,dp[i-1]+cost1);
  }
  printf("%d\n",dp[n-1]);
  return 0;
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Main
{
    public static class Program
    {
        static void Main(string[] arg)
        {
            var answer = 0;
            var line = GetIntList(Console.ReadLine());
            int a = line[0];
            int b = line[1];
            int k = line[2];

            int i = 0;
            int j = a > b ? b : a;
            while(i < k)
            {
                if (a%j == 0 && b % j == 0)
                {
                    i++;
                    answer = j;
                }
                j--;

            }
            Console.WriteLine(answer);
            Console.ReadLine();

        }
        #region libraries
        private static int[] GetIntList(string line)
        {
            return line.Split(' ').Select(x => int.Parse(x)).ToArray();

        }
        private static double[] GetDoubleList(string line)
        {
            return line.Split(' ').Select(x => double.Parse(x)).ToArray();

        }
        private static int SearchNearest(this IEnumerable<int> list, int target)
        {
            var min = list.Min(c => Math.Abs(c - target));
            return list.First(c => Math.Abs(c - target) == min);
        }
        public static int Gcd(int a,int b)
        {
            if(a < b)
            {
                Gcd(b, a);
            }
            while (b != 0)
            {
                var rm = a % b;
                a = b;
                b = rm;
            }
            return a;
        }
        #endregion
    }
}


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

#ifdef LOCAL
	#define D(a) cerr << #a << " = " << a << endl
#else
	#define D(a)
	#define cerr false && cerr
#endif
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define dforn(i,n) dforsn(i,0,n)
#define forn(i,n) forsn(i,0,n)
#define all(a) a.begin(),a.end()
#define si(a) int((a).size())
#define pb emplace_back
#define mp make_pair
#define snd second
#define fst first
#define endl '\n'
using pii = pair<int,int>;
using vi = vector<int>;
using ll = long long;
using vii = vector<pii>;

const int N = 300+1, M = 1e9+7, C = 3;
int n, m, memo[N][N][N]; 
vii conditions[N];

int add(int a, int b) {
    return a + b >= M ? a + b - M : a + b;
}

bool valid(int pos, int last0, int last1, int last2) {
    for (auto lx : conditions[pos]) {
        int l, x; tie(l, x) = lx;
        int cant = (last0 >= l) + (last1 >= l) + (last2 >= l);
        if (cant != x) return false;
    }

    return true;
}

int dp(int last0 = 0, int last1 = 0, int last2 = 0) {
    int pos = max({last0, last1, last2})+1;
    if (pos == n+1) return 1;

    int &res = memo[last0][last1][last2];
    if (res != -1) return res;
    res = 0;

    if (valid(pos, pos, last1, last2))
        res = add(res, dp(pos, last1, last2));
    if (valid(pos, last0, pos, last2))
        res = add(res, dp(last0, pos, last2));
    if (valid(pos, last0, last1, pos))
        res = add(res, dp(last0, last1, pos));

    return res;
}

int main() {
	fastio;

    cin >> n >> m;    
    while (m--) {
        int l, r, x; cin >> l >> r >> x;
        conditions[r].pb(l, x);
    }

    fill(memo[0][0], memo[N][0], -1);
    cout << dp() << endl;
	
	return 0;
}


Measured memory_bytes: 106880
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define N 201000
#define ll long long
using namespace std;
char s[N];
int nxt[N],n,m,t,a[N][26];
void kmp()
{
	int j=0;
	fo(i,2,m)
	{
		while(j&&s[j+1]!=s[i]) j=nxt[j];
		if(s[j+1]==s[i]) j++;
		nxt[i]=j;
	}
}
ll calc(int x,ll l)
{
	if(l<=m) return a[l][x];
	ll l1=t,l2=m,b1=a[t][x],b2=a[m][x];
	while(l2<=l)
	{
		ll jy=b1;
		b1=b2;b2=b2+jy;
		jy=l1;l1=l2;l2=l1+jy;
	}
	if(l==l1) return b1;
	else return b1+calc(x,l-l1);
}
int main()
{
	scanf("%s\n",s+1);
	n=strlen(s+1);
	m=n/2;
	kmp();
	t=m-nxt[m];
	fo(i,1,n)
	{
		fo(j,0,25) a[i][j]=a[i-1][j];
		a[i][s[i]-97]++;
	}
	ll l,r;scanf("%lld %lld",&l,&r);
	fo(i,0,25) printf("%lld ",calc(i,r)-calc(i,l-1));
}

Measured memory_bytes: 21120
import java.util.*;

public class Main {
	  public static void main(String args[]){
      	Scanner scan = new Scanner(System.in);
            
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        String cnt;
        
        if( a % 3 == 0 )cnt = "Possible";
        else if( b % 3 == 0 )cnt = "Possible";
        else if( (a+b) % 3 == 0 )cnt = "Possible";
        
        else cnt = "Impossible";
            
        System.out.println(cnt);
	  }
}

Measured memory_bytes: 21204
//01/12/miya
#include<iostream>
#include<algorithm>
using namespace std;

int main(){
bool p[1000000];
p[0]=false;
p[1]=false;
for(int i=2;i<1000000;i++){
	p[i]=true;
}
for(int i=2; (i*i)<1000000;i++){
	if(p[i]==true){
		for(int y =i+i;y<1000000;y += i){
			if(p[y]==true){
				p[y]=false;
			}
		}
	}
}


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

	if(n==0)break;
	
	int cnt=0;
	for(int i=0;i<=(n/2);i++){
		if(p[i]==true && p[n-i]==true){
			cnt++;
		}
	}
	cout << cnt << endl;
}	
return 0;
}

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

using namespace std;

int main() {

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

	vector<string> a(h);

	for (int i = 0; i < h; i++)cin >> a[i];
	

	vector<bool> yoko(h, false);
	vector<bool> tate(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				yoko[i] = true;
				tate[j] = true;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		if (yoko[i]) {
			for (int j = 0; j < w; j++) {
				if (tate[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}

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

using namespace std;

int n,m,i,a,b,ans,q;
vector <int> wektor[100003];
int dp[100003];
bool visited[100003];

int licz(int x)
{
    if(dp[x]!=0){
        return dp[x];
    }
    for(auto i : wektor[x]){
        dp[x]=max(dp[x], licz(i)+1);
    }
    return dp[x];
}

int main()
{
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> m;
    for(i=0;i<m;i++)
    {
        cin >> a >> b;
        wektor[b].push_back(a);
    }
    for(i=1;i<=n;i++)
    {
        if(!visited[i]){
            licz(i);
        }
        ans = max(ans, dp[i]);
    }
    cout << ans;
    return 0;
}


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

#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
    FastIO
    int x;
    cin >> x;
    x = x - x%5;
    int p = (x/500);
    x %= 500;
    int q = x/5;
    cout << 1000*p + 5*q << "\n";
    return 0;
}

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

long long int dp[11][1001];
void q97() {
	dp[0][0] = 1;
	for (int i = 0; i < 101; i++) {
		for (int j = 9; j >= 0; j--) {
			for (int k = 0; i + k < 1001; k++) {
				dp[j + 1][k + i] += dp[j][k];
			}
		}
	}

	int n, s;
	for (; cin >> n >> s;) {
		if (!n && !s) break;
		cout << dp[n][s] << endl;
	}
}

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

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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

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

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int h, w;
    while (true){
        cin >> h >> w;
        if(h == 0 && w == 0)break;
        for (int i = 0; i < h; i++){
            for (int e = 0; e < w; e++){
                if(i == 0 || i == h - 1 || e == 0 || e == w - 1){
                    cout << "#";
                    continue;
                }
                cout << ".";
            }
            cout << endl;
        }
        cout << endl;
    }
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    int n, t, a,h,bestn;
    double tmp = 0.0,besttmp=10000000;
    cin >> n >> t >> a;
    rep(i, n) {
        cin >> h;
        tmp = t - h * 0.006;
        if (abs(a - tmp) < besttmp) {
            besttmp = abs(a - tmp);
            bestn = i + 1;
        }
    }
    cout << bestn << endl;

    return 0;
}

Measured memory_bytes: 256
class in{struct It{int it;const bool rev;explicit constexpr It(int it_, bool rev=false):it(it_),rev(rev){}int operator*(){return it;}bool operator!=(It& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const It i,n;public:explicit constexpr in(int n):i(0),n(n<0?0:n){}explicit constexpr in(int i,int n):i(i,n<i),n(n){}const It& begin(){return i;}const It& end(){return n;}};

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

struct UnionFind {
    vector<int> data; int group;
    UnionFind(int N) : data(N, -1), group(N) {}
    void init(int N) {
        data.assign(N, -1);
        group = N;
    }
    void unite(int x, int y) {
        x = root(x); y = root(y);
        if(x != y){
            data[x] += data[y];
            data[y] = x;
            --group;
        }
    }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]);}
    bool same(int a, int b) { return root(a) == root(b);}
};
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k, l;
    cin >> n >> k >> l;
    UnionFind a(n), b(n);
    for(int _ : in(k)) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        a.unite(u, v);
    }

    for(int _ : in(l)) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        b.unite(u, v);
    }

    map<pair<int, int>, int> cnt;
    for(int i : in(n)) cnt[make_pair(a.root(i), b.root(i))]++;
    for(int i : in(n)) cout << cnt[make_pair(a.root(i), b.root(i))] << (n == i + 1 ? '\n' : ' ');
    return 0;
}

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

void dfs(int x, int y, vector<vector<int>> &data, vector<int> &add) {
  for(int i = 0; i < data.at(x).size(); i++) {
    if(data.at(x).at(i) == y) {
      continue;
    }
    else {
      add.at(data.at(x).at(i)) += add.at(x);
      dfs(data.at(x).at(i), x, data, add);
    }
  }
}

int main() {
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> data(N);
  for(int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    data.at(a - 1).push_back(b - 1);
    data.at(b - 1).push_back(a - 1);
  }
  vector<int> add(N);
  for(int i = 0; i < Q; i++) {
    int p, x;
    cin >> p >> x;
    add.at(p - 1) += x;
  }
  dfs(0, -1, data, add);
  for(int i = 0; i < N; i++) {
    cout << add.at(i) << " ";
  }
  cout << endl;
}

Measured memory_bytes: 29696
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <memory.h>
#include <cmath>
#include <array>

using namespace std;

void re(int& x);

template<class T, class... Ts> void re(T& t, Ts&... ts);

void pr(int x);

void pr(const char *x);

void ps();
template<class T, class... Ts> void ps(const T& t, const Ts&... ts);

#ifdef FFDBG

#else
#define dbg(x...) dsfdsfsdfasd
#endif

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

int n,m;
int dp[120][120];
char bd[120][120];

void solve()
{
    re(n,m);
    rep(i,0,n) scanf("%s", bd[i]);

    rep(i,0,n) rep(j,0,m) if (i != 0 || j != 0) {
        dp[i+1][j+1] = 1000000000;
        if (i > 0) dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j+1] + (bd[i][j]!=bd[i-1][j]));
        if (j > 0) dp[i+1][j+1] = min(dp[i+1][j+1], dp[i+1][j] + (bd[i][j]!=bd[i][j-1]));
    }

    int v = dp[n][m];
    if (bd[0][0] == '#') v++;
    ps( (v+1) / 2);
}

int main() {

    solve();
}

void re(int& x) { scanf("%d", &x); }

template<class T, class... Ts> void re(T& t, Ts&... ts) { 
    re(t); re(ts...); 
}

void pr(int x) { printf("%d", x); }

void pr(const char *x) { printf("%s", x); }

void ps() { pr("\n"); }
template<class T, class... Ts> void ps(const T& t, const Ts&... ts) { 
    pr(t); if (sizeof...(ts)) pr(" "); ps(ts...); 
}



Measured memory_bytes: 256
A, B, K = map(int, input().split())
candidate1 = [i for i in range(A, A+K) if i <= B]
candidate2 = [i+1 for i in range(B-K, B) if i+1 >= A]

ans = list(sorted(list(set(candidate1+candidate2))))
ans = [str(ans[i]) for i in range(len(ans))]

print('\n'.join(ans))

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

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

    cout << a / b << endl;
    cout << a % b << endl;
    
    cout << fixed << setprecision(5);
    cout << (double)a / (double)b << endl;

    return 0;
}


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

int main() {
	int n, m, x, y;
	cin >> n >> m >> x >> y;
	int xx[n], yy[m];
	for (int i = 0;i < n;i++)cin >> xx[i];
	for (int i = 0;i < m;i++)cin >> yy[i];
	sort(xx, xx + n);
	sort(yy, yy + m);
	for (int i = x + 1;i <= y;i++) {
		if (i > xx[n - 1] && i <= yy[0]) {
			cout << "No War" << endl;
			return 0;
		}
	}
	cout << "War" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	char str[30];
	cin>>str;
	int len=strlen(str),j=0;
	if(str[0]!='A'){
		printf("WA");
		return 0;
	}
	if(str[1]>='A'&&str[1]<='Z'){
		printf("WA");
		return 0;
	}
	if(str[len-1]>='A'&&str[len-1]<='Z'){
		printf("WA");
		return 0;
	}
	for(int i=2;i<len-1;i++){
		if(str[i]=='C'){
			if(j){
				printf("WA");
				return 0;
			}
			j++;
		}
		else if(str[i]>='A'&&str[i]<='Z'){
			printf("WA");
			return 0;
		}
	}
	if(j==0){
		printf("WA");
		return 0;
	}
	printf("AC");
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()

{
    int n,k,x,y,a;
    scanf("%d%d%d%d",&n,&k,&x,&y);

    if(n<k)
    {
        a=n*x;
        printf("%d",a);
    }

    else
    {
        a=k*x+(n-k)*y;
        printf("%d",a);

    }
    return 0;
}

Measured memory_bytes: 1732
import numpy as np
n, k=map(int, input().split())

pp = []
for i in range(2*k):
    pp.append(list(input().split()))

p = pp[1::2]
s = 0
l = []

for i in range(k):
    q = p[i]
    l.extend(q)


ll = set(l)

print(n - len(ll))


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


int main() {

    int arr[5];
    int x;
    int index;
    for(int i=0;i<5;i++)
    {
        cin>>x;
        arr[i]=x;
        if(x==0)
        {
            index=i;
        }
    }
    cout<<index+1;
    return 0;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<28)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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 dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
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;}

int n, i; 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >>  n >> i;
    if (n - i + 1 == 0) cout << 1;
    else cout << n - i + 1;
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256