akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;

int l[105];
void solve() {
  int n;
  int sum = 0;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> l[i];
    sum += l[i];
  }
  int error = 1e9;
  int ret = -1;
  for(int i = 0; i < n; i++) {
    if(abs(sum - n * l[i]) < error) {
      error = abs(sum - n * l[i]);
      ret = i;
    }
  }
  cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
int main()
{
    int N;
    double D;
    cin >> N;
    cin >> D;
    vector<double> X(N);
    vector<double> Y(N);
    int cnt = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> X[i];
        cin >> Y[i];
        if(sqrt(X[i]*X[i] + Y[i]*Y[i]) <= D){ 
            cnt++;
        }
    }
    cout << cnt;
    return 0;
}

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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  string s; cin >> s;
  int n = si(s);
  
  string a = s.substr(0, n/2);
  string b = s.substr((n+1)/2);

  reverse(all(b));
  int ans = 0;
  rep(i, si(a)) if (a[i] != b[i]) ++ans;

  cout << ans << endl;
}

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



int main() {

  int N;
  cin >> N;

  vector<int> W(N);
  int all = 0;
  for(int i=0; i<N; i++){
    cin >> W.at(i);
    all += W.at(i);
  }

  int min = 1000;
  for(int i=0; i<N; i++){
    int sum = 0;
    for(int j=0; j<i; j++){
      sum += W.at(j);
    }
    
    //cout << sum << endl;
    int other = all - sum;
    if (abs(other-sum)<min) min = abs(other-sum);
  }

  cout << min << endl; 
}


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

const int MAX_N = 20002;
int N;

int P[MAX_N];

ll A[MAX_N];
ll B[MAX_N];

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

    cin >> N;

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

    for (int i = 0; i < N; ++i) {
        A[i] = 30000 * (i) + 1;
        B[i] = 30000 * (N - (i+1)) + 1;
    }

    for (int i = 0; i < N; ++i) {
        B[P[i]] += i;
    }


    for (int i = 0; i < N; ++i) {
        cout << A[i];
        if (i != N-1) {
            cout << " ";
        }
    }
    cout << endl;

    for (int i = 0; i < N; ++i) {
        cout << B[i];
        if (i != N-1) {
            cout << " ";
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 1024
N,M = map(int,input().split())
P = []
Y = []
arr = [[]for j in range(10**5+1)]
for i in range(M):
  listA = list(map(int,input().split()))
  P.append(listA[0])
  Y.append(listA[1])
  arr[listA[0]].append(listA[1])
for i in range(N+1):
  arr[i].sort()
for i in range(M):
  #二部探索
  left = 0
  right = len(arr[P[i]])-1
  while left <= right:
    mid = (left+right)//2
    if arr[P[i]][mid] == Y[i]:
      k = mid
      break
    elif arr[P[i]][mid] > Y[i]:
      right = mid-1
    else:
      left = mid+1
  print(str(P[i]).rjust(6,'0')+str(k+1).rjust(6,'0'))

Measured memory_bytes: 30396
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 
		int w = sc.nextInt();
		int n = sc.nextInt();
		int c;
		int[] values = new int[w];
		for (int i = 0; i < values.length; i++) { 
			values[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
		String str = sc.next();
		String[] ab = str.split(",");
		int a = Integer.parseInt(ab[0]) - 1; 
		int b = Integer.parseInt(ab[1]) - 1;
		c=values[a];
		values[a]=values[b];
		values[b]=c;
		}
		for(int i=0;i<w;i++){
			System.out.println(values[i]);
		}
		} }

Measured memory_bytes: 25860
n = int(input())
cardList = map(int,input().split())
cl = list(cardList)
cl.sort(reverse=True)
alice = 0
bob = 0
turn = True
for c in cl:  
  if turn:
    alice+= c
    turn = False
  else:
    bob +=c
    turn =True
    
print(alice-bob)  

Measured memory_bytes: 38256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int [] grade = new int [10000];
    int n = 0;
    for(int i=0;;i++){
      int m = sc.nextInt();
      int f = sc.nextInt();
      int r = sc.nextInt();
      if(m == -1 && f == -1 && r == -1) break;
      if(m == -1 || f == -1){
        grade[i] = 1;
      }else if(m + f >= 80){
        grade[i] = 5;
      }else if(m + f >= 65){
        grade[i] = 4;
      }else if(m + f >= 50){
        grade[i] = 3;
      }else if(m + f >= 30){
        if(r >= 50){
          grade[i] = 3;
        }else{
          grade[i] = 2;
        }
      }else{
        grade[i] = 1;
      }
      n++;
    }
    for(int i=0;i<n;i++){
      switch(grade[i]){
        case 5:
          System.out.println("A");
          break;
        case 4:
          System.out.println("B");
          break;
        case 3:
          System.out.println("C");
          break;
        case 2:
          System.out.println("D");
          break;
        case 1:
          System.out.println("F");
          break;
      }
    }
  }
}


Measured memory_bytes: 26416
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cassert>
using namespace std;

#define sz(x) (int)(x.size())
#define fr(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
///////////////////////

int const N = 1e5 + 41;
ll const INF = 1e9 * 1LL * 1e9 + 41;

int n, a[N], b[N], c[N], x, y, z;

struct T{
	map<pii, int> pos;
	vector<ll> fcnt, fsum;
	int n;
	T(){};
	T(vector<pii> a){
		sort(a.begin(), a.end());
		reverse(a.begin(), a.end());
		n = sz(a);
		fr(i, 0, n) pos[a[i]] = i;
		fcnt.assign(n, 0);
		fsum.assign(n, 0);
	}

	void add(vector<ll> &f, int x, int v){
		while(x < n){
			f[x] += v;
			x |= (x + 1);
		}
	}

	void add(pii v){
		assert(pos.find(v) != pos.end());
		add(fcnt, pos[v], 1);
		add(fsum, pos[v], v.first);
	}

	void rem(pii v){
		assert(pos.find(v) != pos.end());
		add(fcnt, pos[v], -1);
		add(fsum, pos[v], -v.first);
	}

	ll getSum(vector<ll> &f, ll x){
		ll ret = 0;
		while(x >= 0){
			ret += f[x];
			x = (x&(x+1))-1;
		}
		return ret;
	}

	ll getKMax(int k){
		int l = -2;
		int r = n;
		while(r-l>1){
			int m = (l+r)/2;
			if(getSum(fcnt, m) >= k) r = m;
			else l = m;
		}
		assert(getSum(fcnt, r) == k);
		return getSum(fsum, r);
	}
};

T yz, xz;

void solve(){
	cin >> x >> y >> z;
	n = x + y + z;
	fr(i, 0, n) cin >> a[i] >> b[i] >> c[i];
	vector<pii> f, s, t;
	
	fr(i, 0, n) f.pb(mp(-a[i] + b[i], i));
	fr(i, 0, n) s.pb(mp(-b[i] + c[i], i));
	fr(i, 0, n) t.pb(mp(-a[i] + c[i], i));

	yz = T(s);
	xz = T(t);
	
	sort(f.begin(), f.end());
	reverse(f.begin(), f.end());
	ll sum = 0;
	fr(i, 0, n) sum += a[i];
	fr(i, 0, y){
		int id = f[i].second;
		sum += f[i].first;
		yz.add(mp(-b[id] + c[id], id));
	}
	fr(i, y, n){
		int id = f[i].second;
		xz.add(mp(-a[id] + c[id], id));
	}

	ll ans = -INF;

	fr(i, y, y+z+1){
		ll pans = sum;
		int k = i - y;
		pans += yz.getKMax(k);
		int m = z - k;
		pans += xz.getKMax(m);
		ans = max(ans, pans);
		int id = f[i].second;
		xz.rem(mp(-a[id] + c[id], id));
		yz.add(mp(-b[id] + c[id], id));
		sum += f[i].first;
	}

	cout << ans << endl;
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	solve();

	return 0;
}

Measured memory_bytes: 20196
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, K;
  cin >> N >> K;
  
  int ans = 1;
  for(int i = 0; i < N;i++){
    if(ans < K){ans *= 2;}
    else{ans += K;}
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   int a, p;
   cin >> a >> p;
   int ans = (a * 3 + p) / 2;
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include<deque>
#include<stdlib.h>
#include <algorithm>
#include<set>
#include<map>
#include <limits>
#include<iomanip>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_2 100000
#define d9_7 1000000007
int main(void){
  ll n;
  cin>>n;
  vector<ll> h(n);
  rep(i,n){
    cin>>h[i];
}
ll nmax=0;
ll now=0;
  rep(i,n-1){
    if(h[i]>=h[i+1]){
      now++;
    }else{
      nmax=max(nmax,now);
      now=0;
    }
    //cout<<now<<" ";
  }
      nmax=max(nmax,now);

  cout<<nmax<<endl;
  return 0;
}

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

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

  cout << (X / 500) * 1000 + ((X % 500) / 5) * 5 << endl;
  return 0;
}

Measured memory_bytes: 3604
package main

import (
	"fmt"
	"sort"
)

func main() {
	n, m := 0, 0
	fmt.Scan(&n, &m)
	x := make([]int, n)
	y := make([]int, n)
	z := make([]int, n)
	for i := range x {
		fmt.Scan(&x[i], &y[i], &z[i])
	}

	nums := make([][]int, 8)
	for i := range nums {
		nums[i] = make([]int, n)
	}

	for l := 0; l < n; l++ {
		count := 0
		for i := 0; i < 2; i++ {
			x[l] *= (-1)
			for j := 0; j < 2; j++ {
				y[l] *= (-1)
				for k := 0; k < 2; k++ {
					z[l] *= (-1)

					ans := x[l] + y[l] + z[l]
					nums[count][l] = ans
					count++
				}
			}
		}
	}

	max := 0
	for i := 0; i < 8; i++ {
		sort.Ints(nums[i])
		ans := 0
		for j := n - 1; j > n-1-m; j-- {
			ans += nums[i][j]
		}
		if ans > max {
			max = ans
		}
	}
	fmt.Println(max)
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  i64 x;
  cin >> x;
  i64 n = 100;
  int ans = 0;
  while (true) {
    n += n / 100;
    ans += 1;
    if (n >= x) {
      cout << ans << endl;
      return;
    }
  }
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    double a,b,c,d;
    in(a,b,c,d);
    out((double)sqrt((a-c)*(a-c)+(b-d)*(b-d)));
}


Measured memory_bytes: 3264
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int x1, y1, w1, h1;
  int x2, y2, w2, h2;

  cin >> x1 >> y1 >> w1 >> h1;
  cin >> x2 >> y2 >> w2 >> h2;

  int l = max(x1, x2);
  int r = min(x1 + w1, x2 + w2);
  int u = max(y1, y2);
  int d = min(y1 + h1, y2 + h2);

  int dx = max(0, r - l);
  int dy = max(0, d - u);

  debug(dx * dy);

  cout << w1 * h1 + w2 * h2 - dx * dy * 2 << endl;

  return 0;
}



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

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

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

    int a[N];
    for(int i = 0; i < N; i++) {
        a[i] = min(x[i], K-x[i]) * 2;
    }

    int ans = 0;

    for(int i = 0; i < N; i++) {
        ans += a[i];
    }

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

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

using namespace std;

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

    int D, N;
    cin >> D >> N;

    int res = 1;
    for (int i = 0; i < D; ++i) {
        res *= 100;
    }

    cout << res * N + (N == 100 ? (int) pow(100, D) : 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
#define INF 1e9+7
#define PI 3.141592653
#define inf 100007
using namespace std;


int main(){
    int n,m;
    cin>>n>>m;
    priority_queue <ll> g;
    ll ans=0,a=0;
    pan(i,n) cin>>a , g.push(a);
    while(m>0){
        ll x=g.top();
        g.pop();
        x/=2;
        g.push(x);
        m--;
    }
    pan(i,n) ans+=g.top() , g.pop();
    cout<<ans;
}   

Measured memory_bytes: 1400
#include <iostream>
#include <vector>
 
int main(){
    u_int a;	// width
    u_int b;	// height
    while(std::cin >> a >> b){
        if(a == 0 && b == 0){
            break;
        }
		
		// initialization
        std::vector<std::vector<u_int>> path(a+1);
        for(u_int i = 0; i < a+1; ++i){
            path[i].resize(b+1, 1);
        }
        
        // construction
        u_int n;
        std::cin >> n;
        for(u_int i = 0; i < n; ++i){
            u_int x, y;
            std::cin >> x >> y;
            path[x][y] = 0;
        }
        
        // out path
        for(u_int i = 0; i < a+1; ++i) path[i][0] = 0;
        for(u_int i = 0; i < b+1; ++i) path[0][i] = 0;
        
        
        for(u_int x = 1; x <= a; ++x){
            for(u_int y = 1; y <= b; ++y){
                if( path[x][y] != 0 && (!(x == 1 && y == 1)) ){
                    path[x][y] = path[x-1][y] + path[x][y-1];
                }
            }
        }
         
        std::cout << path[a][b] << std::endl;
         
    }
    return 0;
}

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

int mod = 2019;
int vis[2050];
int main()
{
    vis[0]++;
    string s;
    cin >> s;
    int base = 1;
    int sum = 0;
    int ans = 0;
    for(int i=s.size()-1; i>=0; i--){
        sum = (sum + (s[i] - '0') *base) % mod;
        ans += vis[sum];
        vis[sum]++;
        base = base * 10 % mod;
    }

    cout << ans << endl;

    return 0;

}

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

int main(){
  int N, x;
  cin >> N >> x;
  vector<int> a(N);
  for (int i = 0; i < N; i++){
    cin >> a[i];
  }
  
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 0; i < N; i++){
    if (x - a.at(i) >= 0) {
      x -= a.at(i);
      ans++;
    } else {
      x -= a.at(i);
      break;
    }
  }
  if (x > 0) ans--;
  cout << ans << endl;
}

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

//abc095_a
int main(){
	string s;
	cin>>s;
	
	
	int count=0;
	for(int i=0;i<3;i++){
		if(s[i]=='o') count++;
	}
		
		
	cout<<700+100*count<<endl;
	
	return 0;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val _ = io.StdIn.readInt()
    val an: Seq[Int] = io.StdIn.readLine().split(" ").map(_.toInt)
    println(an.tail.foldLeft(an.head)((acc, ai) => lcm(acc, ai)))
  }
  def lcm(m: Int, n: Int): Int = (m * n) / gcd(m, n)
  def gcd(x: Int, y: Int): Int = {
    var (m, n) = if (x < y) (y, x) else (x, y)
    while(n > 0) {
      val tmp = m
      m = n
      n = tmp % n
    }
    m
  }
}

Measured memory_bytes: 43900
#include<stdio.h>
#include<string.h>
int main(void)
{
	char S[200001],T[200001];
	int i,len,cnt;
	cnt=0;
	scanf("%s %s",S,T);
	len=strlen(S);
	for(i=0;i<len;i++){
		if(S[i]!=T[i]){
			cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 2100
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define SYOU(x) setprecision(x)
#define abs(x,y) max(x,y)-min(x,y)
#define mp make_pair
#define fi first
#define se second
using namespace std;
int i[111111];
vector<int> ii;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=0,f=0,g=0,h,j;
  string s;
  cin >>a>>b;
  cout <<a*a-b<<'\n';
  return (0);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
vector<int>g[110];
int sz[110];
int now[110];
int main(){
	int a;scanf("%d",&a);
	while(a--){
		vector<int>v;
		while(1){
			int b;scanf("%d",&b);
			if(!b)break;
			v.push_back(b);
		}
		for(int i=0;i<110;i++)g[i].clear();
		for(int i=0;i<110;i++)sz[i]=0;
		int d=-1;
		int at=-1;
		int n=0;
		for(int i=0;i<v.size();i++){
			if(v[i]>0){
				//n++;
				while(~at&&g[at].size()==sz[at]){
					d--;
					at=now[d];
				}
				d++;at=n;
				n++;
				now[d]=at;
				sz[at]=v[i];
				if(d){
					g[now[d-1]].push_back(at);
					g[at].push_back(now[d-1]);
				}
			}else{
				while(g[at].size()==sz[at]){
					d--;
					at=now[d];
				}
				g[at].push_back(now[d+v[i]]);
				g[now[d+v[i]]].push_back(at);
			}
		//	for(int j=0;j<=d;j++)printf("%d ",now[j]);printf("\n");
		}
		for(int i=0;i<n;i++)std::sort(g[i].begin(),g[i].end());
		for(int i=0;i<n;i++){
			printf("%d",i+1);
			for(int j=0;j<g[i].size();j++)printf(" %d",g[i][j]+1);
			printf("\n");
		}
	}
}

Measured memory_bytes: 1084
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);
bool vis[8];
int N, M;
vector<int> g[8];
int ans = 0;

void dfs(int x, int cnt) {
  if (cnt == N) {
    ans++;
    return;
  }

  for (auto y : g[x]) {
    if (vis[y]) continue;

    vis[y] = true;
    dfs(y, cnt+1);
    vis[y] = false;
  }
}


int main() {
  cin >> N >> M;
  rep(i, M) {
    int a, b; cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vis[0] = true;
  for (auto x : g[0]) {
    vis[x] = true;
    dfs(x, 2);
    vis[x] = false;
  }

  cout << ans << endl;

  return 0;
}

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

int N, inDegree[MAXN + 3], K, answer[MAXN + 3];
vector<pair<int, int> > adj[MAXN + 3]; //(v, idx)

void DFS(int u, int prvNode, int prvColor) {
    int ptrColor = 1;
    for (auto e: adj[u]) {
        int v = e.first, id = e.second;

        if (v == prvNode) continue;

        if (ptrColor == prvColor)
            ptrColor += 1;

        answer[id] = ptrColor;
        DFS(v, u, answer[id]);

        ptrColor += 1;
    }
}

int main() {
    cin >> N;

    memset(inDegree, 0, sizeof(inDegree));
    for (int i = 1; i < N; i++) {
        int u, v;
        cin >> u >> v;

        adj[u].push_back({v, i});
        adj[v].push_back({u, i});

        inDegree[u] += 1;
        inDegree[v] += 1;
    }

    K = 0;
    for (int i = 1; i <= N; i++)
        K = max(K, inDegree[i]);

    DFS(1, -1, -1);

    cout << K << endl;
    for (int i = 1; i < N; i++)
        cout << answer[i] << endl;
}


Measured memory_bytes: 9728
#include<iostream>

using namespace std;

int main()
{
  char a;
  cin >> a;
  if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a,b,d,r;
	double f;
	scanf("%d %d",&a,&b);
	
	d=a/b;
	r=a%b;
	f=(double)a/b;
	printf("%d %d %.5f\n",d,r,f);
	return 0;
}


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

#define      sf           scanf
#define      pf           printf
#define      pb           push_back
#define      sz           200005
#define      read         freopen("in.txt", "r", stdin);
#define      write        freopen("out.txt", "w", stdout);
#define      optimize     ios::sync_with_stdio(0); cin.tie(0);

using namespace std;

int main()
{
	// read
	// write
	
	string s;
	int flag = 0;

	cin >> s;

	for(int i = 0; i < s.size(); i++)
	{
		if(s[i]=='7') flag = 1;
	}

	if(flag) cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}

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

int main() {
  int N,K;
  cin >> N >> K;
  int sum=0;

  for (int i=0; i<N; i++) {
    int x;
    cin >> x;
    sum += 2*min(x,K-x);
  }

  cout << sum << endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		String s = scan.next();
		long k = scan.nextLong();
		int len = s.length();
		int index = 0;
		int i;
		for(i = 0; i < len; i++) {
			if(!s.substring(i, i + 1).equals("1")) {
				index = i;
				break;
			}
		}
		String ans;
		if(index + 1 > k) {
			ans = "1";
		}else {
			ans = s.substring(index, index + 1);
		}
		out.print(ans);
		out.flush();
	}
	public static int gcd(int a, int b) {
		if(b == 0)
			return a;
		return gcd(b, a % b);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


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

using namespace std;

typedef long long int ll;
typedef long double ld;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
	
	int n;
	int arr[60];
	
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> arr[i];
	}
	
	int cnt = 0;
	
	for(int i = 1; i <= n; i++){
		if(i != arr[i]) cnt++;
	}
	
	
	if(cnt <= 2) cout << "YES" << endl;
	else cout << "NO" << endl;
	
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>

using namespace std;

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

// const ll INF = 1LL << 60;

int main()
{
  double L;
  cin >> L;
  cout << setprecision(10) << (L / 3) * (L / 3) * (L / 3) << endl;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    i32 n,a,b, x1, x2; cin >> n >> a >> b;
    /**
     * 歩く距離よりbが小さいような区間ではテレポート
     *
     * a--b--cの時、
     * a -teleport-> c -walk-> b == a -walk-> b -teleport-> c
     * より、X1から順番に歩いて行ってよい
     */

    i32 cnt = 0;
    cin >> x1;
    rep(i, n-1) {
        cin >> x2;
        cnt += min(b, abs(x1-x2) * a);
        x1 = x2;
    }

    cout << cnt << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


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

int top;

int pop(int* s){
    top--;
    return s[top+1];
}

void push(int* s,int num){
    top++;
    s[top]=num;
}

int main(){
    int stacks[1000];
    int a,b;
    top=-1;
    string s;
    while(cin >> s){
        if(s=="+"){
            a=pop(stacks);
            b=pop(stacks);
            push(stacks,a+b);
        }
        else if(s=="-"){
            a=pop(stacks);
            b=pop(stacks);
            push(stacks,b-a);
        }
        else if(s=="*"){
            a=pop(stacks);
            b=pop(stacks);
            push(stacks,a*b);
        }
        else{
            push(stacks,atoi(s.c_str()));//string???????????°???char???????????????????????????????????????
        }
    }
    cout << stacks[top] <<endl;
}

Measured memory_bytes: 1196
#include<stdio.h>
#include<string.h>
int main(){
	char x[10];
	scanf("%s",&x);
	int ada  = 0;
	for(int i=0;i<strlen(x);i++)
		if(x[i]=='7')
			ada=1;
	if(ada==1)
		printf("Yes");
	else
		printf("No");
	printf("\n");
}

Measured memory_bytes: 1708
#include <stdio.h>

int main()
{
    int a, b, c, k, max, sum=0;
    scanf("%d %d %d %d",&a,&b,&c,&k);
    if(a>=b && a>= c)
        max = a;

    else if(b>=a && b>=c)
        max =b;

    else
        max = c;

    sum = a+b+c - max;
    for(int i=0; i<k; i++)
    {
        max = max * 2;
    }
     printf("%d\n",sum+max);

     return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    int n, z, w;
    cin >> n >> z >> w;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int ans = INT_MIN;
    if (n == 1) {
        ans = max(ans, abs(a[n - 1] - w));
    }
    else {
        ans = max(ans, abs(a[n - 1] - w));
        ans = max(ans, abs(a[n - 2] - a[n - 1]));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
     
int dep[1000];
int deg[1000];
int dad[1000];
int lef[1000];
int rig[1000];
int hei[1000];
int sib[1000];
int in[1000];
 
int depth(int now,int prev){
  if(deg[now] == 0){
    dep[now] = dep[prev]+1;
    return 0;
  }
    dep[now] = dep[prev]+1;
    //cout << "now = " << now << ", prev = " << prev << endl;
    //cout << dep[now] << endl;
    if(lef[now] != -1){//cout << "In1" << endl;
    depth(lef[now],now);
    }
    if(rig[now] != -1){//cout << "In2" << endl;
      depth(rig[now],now);
    }
 
   
}
 
int heich(int now,int above){
  if(dad[now] == -1)return 0;
 
  if(hei[now]+1 > hei[above]){ 
    hei[above]=hei[now]+1;
    heich(above,dad[above]);
  }
 
}
 
int main(){
  int n,id,L,R;
  
 
  scanf("%d\n",&n);
 
  for(int i=0;i<1000;i++){
    dad[i]=-1;
    lef[i]=-1;
    rig[i]=-1;
    dep[i]=0;
    hei[i]=0;
    sib[i]=-1;
    deg[i]=0;
  }
 
  for(int i=0;i<n;i++){
    scanf("%d %d %d\n",&id,&L,&R);
    dad[L]=dad[R]=id;
    lef[id] = L;
    rig[id] = R;
    if(!(L==-1 || R==-1)){
 
      sib[L]=R;
      sib[R]=L;
    }
    if(L+R == -2){
      deg[id]=0;
    }
    else if(L == -1 || R == -1){
      deg[id]=1;
    }
    else deg[id] = 2;
 
 
    if(L == -1){
      dep[R]=dep[id]+1;
    }
    else if(R == -1){
      dep[L]=dep[id]+1;
    }else{
      dep[L]=dep[id]+1;
      dep[R]=dep[id]+1;
    }
    if(deg[L] != 0){
      if(lef[L] == -1){
 
    depth(rig[L],L);
      }
      else if(rig[L] == -1){
    depth(lef[L],L);
      }
      else{
    depth(rig[L],L);
    depth(lef[L],L);
      }
    }
    if(deg[R] != 0){
      if(lef[R] == -1){
    depth(rig[R],R);
      }
      else if(rig[R] == -1){
    depth(lef[R],R);
      }
      else{
    depth(rig[R],R);
    depth(lef[R],R);
      }
    }
 
    /*
    if(L+R != -2){ // hukasa   
      if(deg[L] != 0){
    if(lef[L] == -1){
      depth(rig[L],L);
    }
    else if(rig[L] == -1){
    depth(lef[L],L);
    }
    else{
      depth(rig[L],L);
      depth(lef[L],L);
    }
 
      }
      if(deg[R] != 0){
    depth(rig[R],R);
      }
    }
    else if(L == -1){
      dep[R]=dep[id]+1;
      if(deg[R] != 0){
    depth(rig[L],L);
      }
    }
    else{
      dep[L]=dep[id]+1;
      if(deg[L] != 0){
    depth(lef[L],L);
      }
    }
    */
 
  }
 
  for(int i=0;i<n;i++){ //
    if(lef[i] == -1 && rig[i] == -1){
      heich(i,dad[i]);
    }
  } //
 
  for(int i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,dad[i],sib[i],deg[i],dep[i],hei[i]);
    if(dad[i] == -1){
      printf("root\n");
    }
    else if(hei[i] == 0){
      printf("leaf\n");
    }
    else printf("internal node\n");
 
  }
 
 
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

#include<atcoder/all>
using namespace atcoder;

int b;

int op(int a,int b){return max(a,b);}
int e(){return -1;}
bool f(int x){ return x < b;}

int main(){
    int n,q;
    cin >> n >> q;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    segtree<int,op,e> seg(a);
    while(q--){
        int t,a;
        cin >> t >> a >> b;
        if(t==1){
            --a;
            seg.set(a,b);
        }else if(t==2){
            --a;
            cout << seg.prod(a,b) << endl;
        }else if(t==3){
            --a;
            cout << seg.max_right<f>(a)+1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 6108
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    for(int i=1;i<=9;i++){
        if(N/i<=9 && N%i == 0){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18

ll mod = 1e9+7;

bool compare_by_b(P a, P b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

// 検索タグ pair, pairのsecondでソート
// https://perogram.hateblo.jp/entry/2018/12/17/045943
int main() {
	// 入力
	ll N;cin>>N;
	vector<P> A;
    REP(i,N){
		ll tmp; cin>>tmp;
		A.pb(make_pair(i, tmp));
	}
	// 解法
	// REP(i,N){
	// 	printf("%lld %lld\n", A[i].first,A[i].second);
	// }
	sort(A.begin(), A.end(), compare_by_b);
	// REP(i,N){
	// 	printf("%lld %lld\n", A[i].first,A[i].second);
	// }

	ll num_same = 1;
	ll total = 0;
	REP(i,N){
		if (i==0){ // i==0の時
			num_same = 1;
		}
		else if (A[i].second==A[i-1].second & i<N-1){// 0<i<N-1で数値一致
			num_same++;
		}
		else if (A[i].second!=A[i-1].second & i<N-1){// 0<i<N-1で数値一致
			total += num_same*(num_same-1)/2;
			REP(j, num_same){
				A[i-num_same+j].second = num_same-1;
			}
			num_same = 1;
		}
		else if (A[i].second==A[i-1].second & i==N-1){// i=N-1で数値一致
			// printf("condition 4\n");
			num_same++;
			total += num_same*(num_same-1)/2;
			REP(j, num_same){
				A[i-num_same+j+1].second = num_same-1;
			}
		}
		else if (A[i].second!=A[i-1].second & i==N-1){// i=N-1で数値一致
			// printf("condition 5\n");
			total += num_same*(num_same-1)/2;
			REP(j, num_same){
				A[i-num_same+j].second = num_same-1;
			}
			A[i].second = 0;
		}
		
		// printf("i: %lld num same: %lld %lld\n", i, num_same, total);
	}
	// printf("total: %lld\n", total);

	// REP(i,N){
	// 	printf("i: %lld, heru kazu %lld\n", A[i].first,A[i].second);
	// }
	
	sort(A.begin(), A.end());
	// REP(i,N){
	// 	printf("%lld %lld\n", A[i].first,A[i].second);
	// }
	REP(i,N){
		printf("%lld\n", total - A[i].second);
	}
	// REP(i,N) printf("%lld, %lld\n", i, A[i]);
	// REP(i,N) printf("%lld, ", A[i]);
	// printf("\n");
	// // DP
	// memset(dp, -1, sizeof(dp));
	// REP(i,N) rec(i);
	
	// map<ll, ll> mp; // 連想配列 map<key:数値, value:出現回数の偶奇> 
	// for (ll i = 0; i < N; ++i){
	// 	auto itr = mp.find(A[i]);        // s[i] が設定されているか？
	// 	if(itr != mp.end() ) {
	// 	     mp[A[i]] = (mp[A[i]] + 1) % 2; // ある場合
	// 	}
	// 	else {
	// 	     mp[A[i]] = 1 ;
	// 	}
	// }
	// ll ans = 0;
 
	// //for(auto itr = mp.begin(); itr != mp.end(); ++itr){
	// //    cout << itr->first << " " << itr->second << endl;
	// //}
 
	// for(auto itr = mp.begin(); itr != mp.end(); ++itr) sum += itr->second;
 
	// //出力
	// cout << ans << endl;
	// printf("%lld\n", ans);
	// if (ans) printf("Yes\n");
	// else printf("No\n");
}


Measured memory_bytes: 6636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
int main()
{
  int n,m,l; cin>>n>>m>>l;
  long long m1[n][m], m2[m][l];
  rep(i,n)rep(j,m) cin>>m1[i][j];
  rep(i,m)rep(j,l) cin>>m2[i][j];
  rep(i,n)
  {
    rep(j,l)
    {
      long long ans = 0;
      rep(k,m)
      {
        ans += m1[i][k]*m2[k][j];
      }
      cout << ans;
      if(j!=l-1) cout << " ";
    }
    cout << "\n";
  }
}


Measured memory_bytes: 3236
import sys
from pprint import pprint

def warshall_floyd(d, n):
    # pprint(d)
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

def solve(h, w, s):
    
    n_node = 0
    nodes = [] 
    # pprint(nodes)
    for y in range(h):
        nodes.append([])
        for x in range(w):
            nodes[y].append(n_node)
            n_node += 1
    edges = [[float("inf") for i in range(n_node)] for j in range(n_node)]
    # pprint(nodes)
    for y in range(h):
        for x in range(w):
            if s[y][x] != ".":
                continue
            for dx, dy in ((1,0), (-1,0), (0,1), (0,-1)):
                if 0 <= y+dy < h and 0 <= x+dx < w and s[y+dy][x+dx] == ".":
                    edges[nodes[y][x]][nodes[y+dy][x+dx]] = 1
    for i in range(n_node):
        edges[i][i] = 0
    
    dist = warshall_floyd(edges, n_node)
    # pprint(dist)
    ans = -1
    for y in range(n_node):
        for x in range(n_node):
            if dist[y][x] < float("inf"):
                ans = max(ans, dist[y][x])
    print(ans)


if __name__ == '__main__':
    h, w = map(int, sys.stdin.readline().strip().split(" "))
    s = []
    for i in range(h):
        s.append(list(sys.stdin.readline().strip()))
    # debug
    # pprint(s)
    solve(h, w, s)

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
typedef unsigned long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 300 + 5;

ll gcd(const ll a, const ll b) {
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> A;
    for (int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        A.push_back(temp);
    }
    sort(A.begin(), A.end());
    int max = A.back();
    int gg = A[0];
    for (int i = 1; i < n; i++) {
        gg = gcd(gg, A[i]);
    }
    if (k <= max && k % gg == 0)
        cout << "POSSIBLE" << endl;
    else
        cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 892
#include <iostream>
using namespace std;
int main(){
  int N, X;
  cin >> N >> X;
  int len = 0;
  int count = 1;
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
  	len += a;
    if(len>X){
    	break;
    }
    count++;
  }
  cout << count << "\n";
  return 0;
}

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

using namespace std;

#define INF 0x7FFFFFFF

unsigned long long all[51];
unsigned long long patty[51];

unsigned long long search(int N, unsigned long long X) {
  if (N == 0) {
    return X == 1 ? 1 : 0;
  }
  
  if (1 < X && X < 2 + all[N - 1]) {
    return search(N - 1, X - 1);
  }
  
  if (X == 2 + all[N - 1]) {
    return patty[N - 1] + 1;
  }
  
  if (2 + all[N - 1] < X && X < all[N]) {
    return patty[N - 1] + 1 + search(N - 1, X - 2 - all[N - 1]);
  }
  
  if (X == all[N]) {
    return patty[N];
  }
}

int main() {
  int N;
  unsigned long long X;
  
  cin >> N >> X;
  
  all[0]	= 1;
  patty[0]	= 1;
  
  for (int i = 1; i <= N; i++) {
    all[i]		= 2 * all[i - 1] + 3;
    patty[i]	= 2 * patty[i - 1] + 1;
  }
  
  cout << search(N, X) << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9) + 7;
	public static void main(String[] args) {
		FastReader sc = new FastReader();
        int n = sc.nextInt();
      	int res = 0;
      	PriorityQueue<Integer> pq = new PriorityQueue<>();
      	
      	for (int i = 0; i < n; i++) {
      		int num = sc.nextInt();
      		res += num;
      		if (num % 10 != 0) {
      			pq.offer(num);
      		}
      	}
      	
      	if (res % 10 == 0) {
      		if (pq.size() != 0) {
      			res -= pq.poll();
      		} else {
      			res = 0;
      		}
      	}
      	System.out.println(res);
	}
	
    static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 22612
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

int main(){
  ll a,b,k;
  cin>>a>>b>>k;
  for(int i=0;i<k;i++){
      if(i&1){
	  if(b&1)b--;
	  a+=b/2;
	  b/=2;
      }
      else{
	  if(a&1)a--;
	  b+=a/2;
	  a/=2;
      }
  }
  cout<<a<<" "<<b<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		while(true) {
			int kazu=sc.nextInt();
			long price=sc.nextLong();
			if(kazu==0 && price==0) {
				System.exit(0);
			}
			mono=new long[kazu];
			for(int i=0; i<kazu; i++) {
				mono[i]=sc.nextInt();
			}
			long tmp=0;
			long kiroku=0;
			for(int i=0; i<kazu; i++) {
				tmp=mono[i];
				for(int j=i+1; j<kazu; j++) {
					if(tmp+mono[j]<=price && tmp+mono[j]>kiroku) {
						kiroku=tmp+mono[j];
					}
				}
			}
			if(kiroku==0) {System.out.println("NONE");}
			else{System.out.println(kiroku);}
		}
	}
}


Measured memory_bytes: 50772
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int a,b,k,i;
  cin >> a >> b >> k;
  for(i=a;i<a+k&&i<=b;i++)
    cout << i << endl;
  if(i<=b-k) i=b-k+1;
  for(;i<=b;i++)
    cout << i << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    
    int main(){
        long x , a , b ;
        cin >> x >> a >> b ;
        if( a - b < 0 ){
            if(a + x - b < 0){
                cout << "dangerous" << endl;
            }else{
                cout << "safe" << endl;
            }
        }else{
            cout << "delicious" << endl;
        }
        
        return 0;
    }

Measured memory_bytes: 256
n = int(input())
a = []
for i in range(n):
  si = str(input())
  a.append(si)
a.sort()
mx = 1
w = []
j = 1
for i in range(1,n):
  if a[i] == a[i-1]:
    j += 1
  else:
    if j > mx:
      w = [a[i-1]]
      mx = j
    elif j == mx:
      w.append(a[i-1])
    j = 1
if j > mx:
  w = [a[n-1]]
elif j == mx:
  w.append(a[n-1])
for wi in w:
  print(wi)

Measured memory_bytes: 83160
#include <iostream>
#include <string>
#include <iomanip>
#include <math.h>

using namespace std;

int main()
{
  long long A, B;
  cin >> A >> B;

  if ((A + B) % 2 != 0) cout << "IMPOSSIBLE" << endl;
  else cout << (A + B) / 2 << endl;
}

Measured memory_bytes: 256