akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

bool solve(vector<vector<bool>> mark) {
  bool ret = false;

  rep(row, 0, 3) {
    bool flag = true;
    rep(col, 0, 3) {
      if (!mark[row][col]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      return true;
    }
  }

  rep(col, 0, 3) {
    bool flag = true;
    rep(row, 0, 3) {
      if (!mark[row][col]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      return true;
    }
  }

  if (mark[0][0] && mark[1][1] && mark[2][2]) {
    return true;
  }

  if (mark[0][2] && mark[1][1] && mark[2][0]) {
    return true;
  }

  return ret;
};

int main() {
  int A[3][3];

  vector<vector<bool>> mark(3, vector<bool> (3, false));

  rep(i, 0, 9) {
    int row = i / 3;
    int col = i % 3;
    cin >> A[row][col];
  }

  int N;
  cin >> N;

  int b;
  rep(i, 0, N) {
    cin >> b;
    rep(i, 0, 9) {
      int row = i / 3;
      int col = i % 3;
      if (A[row][col] == b) {
        mark[row][col] = true;
      }
    }
  }

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

  return 0;
};


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	int N;
	int a[1001]={};
	int maxi=0,mini=INF;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>a[i];
		maxi=max(a[i],maxi);
		mini=min(a[i],mini);
	}
	cout<<maxi-mini<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string c="APPROVED";
  
  cin >>n;
  vector<int> a(n);
  
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  
  for(int j=0;j<n;j++){
    if(a.at(j)%2==0 && a.at(j)%3!=0 && a.at(j)%5!=0){
      c = "DENIED";
    }
  }
  
  cout << c << endl;
}

Measured memory_bytes: 256
main :: IO()
main = do
    [sx, sy, tx, ty] <- map read . words <$> getLine
    putStrLn $ makeAns (tx - sx) (ty - sy)

makeAns :: Int -> Int -> String
makeAns dx dy = path1 dx dy ++ path2 dx dy ++ path3 dx dy ++ path4 dx dy




path1 dx dy = replicate dy 'U' ++ replicate dx 'R'
path2 dx dy = replicate dy 'D' ++ replicate dx 'L'
path3 dx dy = 'L':(replicate (dy+1) 'U' ++ replicate (dx+1) 'R' ++ ['D'])
path4 dx dy = 'R':(replicate (dy+1) 'D' ++ replicate (dx+1) 'L' ++ ['U'])







Measured memory_bytes: 1020
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define PI acos(-1)

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> H(N);
    Rep(i, N) cin >> H[i];
    vector<vector<int>> graph(N);
    Rep(i, M) {
        int a, b;
        cin >> a >> b;
        graph[a - 1].push_back(b - 1);
        graph[b - 1].push_back(a - 1);
    }
    int ans = 0;
    Rep(i, N) {
        int height = H[i];
        bool flag = true;
        Rep(j, graph[i].size()) {
            if (H[graph[i][j]] >= height) {
                flag = false;
                break;
            }
        }
        if (flag) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8764
c,i=30,k[30],x;main(n,a)
{
	for(;~scanf("%d",&a);)
	{
		k[__builtin_popcount(a^a-1)]=--n&&(x^=a);
	}
	for(;i;i--)x&1<<i-1&&k[i]&&(c++,x^=(1<<i)-1);
	printf("%d",x?-1:c);
}

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

int main()
{
    int ans = 0;
    int n;
    cin >> n;
    int l, r;
    for (int i = 0; i < n; i++)
    {
        cin >> l >> r;
        ans += r - l + 1;
    }
    cout << ans << endl;
}

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

#define ll long long
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

int main() {
    while (true) {
        int H, W;
        cin >> H >> W;
        if (H == 0 && W == 0) break;
        rep(i, H) {
            rep(j, W) { cout << "#"; }
            cout << endl;
        }
        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3084
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int A =sc.nextInt();
      int B =sc.nextInt();
      int C =sc.nextInt();
      
      if(A==B&&B!=C){
      System.out.println("Yes");
      }
      else if(A==C&&A!=B)
      {System.out.println("Yes");
      }else if(B==C&&A!=C){
        System.out.println("Yes");
      }
  else{
    System.out.println("No");
  }
}
}

Measured memory_bytes: 21972
#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++){
int a[999][8],n,t,s;main(){scanf("%d ",&n);a[0][2]=1;r(i,n)s=getchar()%4-1;r(j,8)r(k,8)if(j&k&&j>>s&1)a[i+1][j]+=a[i][k]%10007;}t+=a[n][j];}}printf("%d\n",t%10007);}

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

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

    int ans = 0;
    int zen = -1;
    for(int i = 0; i < n; i++){
        ans += b[a[i] - 1];
        if(zen == a[i] - 1){
            ans += c[zen - 1];
        }
        zen = a[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
//============================
// ABC133b Food Distance
//
// 2019/08/15
//============================

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main(int argc, char* argv[])
{
  int n, d;
  cin >> n >> d;

  vector<vector<int>> x(n, vector<int>(d));

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

  int cnt=0;
  for(int i=0; i<n-1; i++)
  {
    for(int j=i+1; j<n; j++)
    {
      int y=0;
      for(int k=0; k<d; k++)
      {
        y += pow((x[i][k] - x[j][k]), 2);
      }
      float temp;
      temp = sqrt(y);
      if(ceil(temp) == floor(temp)) cnt++;
    }
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main() {
    let d: usize = read();
    let g: i64 = read();

    let mut p:Vec<i64> = vec![1;d];
    let mut c:Vec<i64> = vec![1;d];
    let mut sum: Vec<i64> = vec![0;d];

    for i in 0..d {
        p[i] = read();
        c[i] = read();
        sum[i] = p[i] * 100 * ((i+1) as i64) + c[i];

    }

    let mut ans: i64 = 1 << 32;
    for i in 0..(1<<d) {
        let mut now = 0;
        let mut mai = 0;
        for j in 0..d {
            if i & (1<<j) != 0{
                now += sum[j];
                mai += p[j];
            }
        }
        if now >= g {
            ans = std::cmp::min(ans,mai);
        } else {
            for j in 0..d {
                if (i & (1<<j) == 0) && (now + sum[j] >= g) {
                    let po = std::cmp::min(p[j],
                        (g-now) / (100*(j+1) as i64) + 
                        if (g-now) % (100*(j+1) as i64) != 0 {1} else {0});
                    ans = std::cmp::min(ans, mai + po);
                }
            }
        }
    }

    println!("{}", ans);

}


fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
                        .bytes()
                        .map(|c| c.expect("failed to read char") as char)
                        .skip_while(|c| c.is_whitespace())
                        .take_while(|c| !c.is_whitespace())
                        .collect();
    token.parse().ok().expect("failed to parse token")
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
const int INFI=2147483647;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }


int main() {
  int w,h,x,y,r; cin >>w >>h >>x >>y >>r;
  cout <<((0<=x-r && x+r<=w && 0<=y-r && y+r<=h) ? "Yes" : "No") <<endl;
}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
int main(){
	int h,w,n,sr,sc;
	string s,t;
	cin>>h>>w>>n>>sr>>sc>>s>>t,sr--,sc--;
	int lx=0,ux=h,ly=0,uy=w;
	for(int i=n-1;i>=0;i--){
		switch(t[i]){
		case'L':
			if(ly<uy&&uy<w)
				uy++;
			break;
		case'R':
			if(0<ly&&ly<uy)
				ly--;
			break;
		case'U':
			if(lx<ux&&ux<h)
				ux++;
			break;
		case'D':
			if(0<lx&&lx<ux)
				lx--;
			break;
		}
		switch(s[i]){
		case'L':
			if(ly<uy)
				ly++;
			break;
		case'R':
			if(ly<uy)
				uy--;
			break;
		case'U':
			if(lx<ux)
				lx++;
			break;
		case'D':
			if(lx<ux)
				ux--;
			break;
		}
	}
	cout<<(lx<=sr&&sr<ux&&ly<=sc&&sc<uy?"YES":"NO")<<endl;
}


Measured memory_bytes: 776
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        int[][] b1 = new int[n][m];
        for(int i=0; i<n; i++) {
            for(int j=0; j<m; j++) {
                b1[i][j] = sc.nextInt();
            }
        }
        int[] b2 = new int[m];
        for(int i=0; i<m; i++) {
            b2[i] = sc.nextInt();
        }
        sc.close();

        for(int i=0; i<n; i++) {
            int ans = 0;
            for(int j=0; j<m; j++) {
                ans += b1[i][j] * b2[j];
            }
            System.out.println(ans);
        }
    }
}



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

int main() {
    int n, k, ans = 0;
    cin >> n >> k;
    vector<int> l(n);
    rep(i, n) { cin >> l.at(i); }
    sort(l.rbegin(), l.rend());
    rep(i, k) { ans += l.at(i); }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
/*
数値の制約が小さいから, 集会を開く座標pを全探索すれば良い
*/
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    
    vector<int> x(n);
    for (int i = 0; i < n; i++) cin >> x[i];
    
    // 与えられた座標の最小値と最大値を求めるために
    // 座標系を昇順に整理する
    sort(x.begin(),x.end());
    
    int ans = 1e8 + 7; // どう考えても, こんな労力は必要ない値で初期化する
    int minIndex = x[0]; // sort済みのため, 左端が与えられた座標の最小値である
    int maxIndex = x[n-1]; // sort済みのため, 右端が与えられた座標の最大値である
    
    // 集会を開く座標pを全探索する
    for (int p = minIndex; p <= maxIndex; p++){
        
        int cost = 0;
        
        for (int i = 0; i < n; i++){
            cost += (x[i]-p)* (x[i]-p); // 問題文で定義された労力を計算して,記録しよう
        }
        
        ans = min(ans, cost); // 消費体力の最小値を取る
    }
    
    cout << ans << endl; //　答えを出力しよう
}

Measured memory_bytes: 256
public class Main {

  private static void solve() {
    char[] s = ns();
    char[] t = ns();

    int ret = Integer.MAX_VALUE;

    for (int i = 0; i <= s.length - t.length; i++) {
      int now = 0;
      for (int j = 0; j < t.length; j++) {
        if (s[i + j] != t[j]) {
          now++;
        }
      }
      ret = Math.min(now, ret);
    }
    System.out.println(ret);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

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

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 36700
#include <iostream>
#include <string>

using namespace std;

int main(){

    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;

    A = A - 1;
    B = B - 1;
    C = C - 1;
    D = D - 1;

    string S;
    cin >> S;

    S[A] = 'A';
    S[B] = 'B';

    bool f = true;



    if (C < D){
        for (int i = B; i <= D; i++){
            if (S[i + 1] == '.'){
                S[i] = '.';
                S[i + 1] = 'B';
            }else if(S[i + 2] == '.'){
                S[i] = '.';
                S[i + 2] = 'B';
                i++;
            }else{
                f = false;
                break;
            }

            if (S[D] == 'B'){
                break;
            }
        }

        if (f == true){
            for (int i = A; i <= C; i++){
                if (S[i + 1] == '.'){
                    S[i] = '.';
                    S[i + 1] = 'A';
                }else if(S[i + 2] == '.'){
                    S[i] = '.';
                    S[i + 2] = 'A';
                    i ++;
                }else{
                    f = false;
                    break;
                }

                if (S[C] == 'A'){
                    break;
                } 
            }        
        }

    }else{
        int stop = 0;
        for (int i = B; i <= D; i++){
            if(S[i - 1] == '.' && S[i + 1] == '.'){
                stop = i;
                break;
            }

            if (S[i + 1] == '.'){
                S[i] = '.';
                S[i + 1] = 'B';
            }else if(S[i + 2] == '.'){
                S[i] = '.';
                S[i + 2] = 'B';
                i++;
            }else{
                f = false;
                break;
            }
        }

        if (stop == 0){
            f = false;
        }
        
        if (f == true){
            for (int i = A; i <= C; i++){
                if (S[i + 1] == '.'){
                    S[i] = '.';
                    S[i + 1] = 'A';
                }else if(S[i + 2] == '.'){
                    S[i] = '.';
                    S[i + 2] = 'A';
                    i ++;
                }else{
                    f = false;
                    break;
                }

                if (S[C] == 'A'){
                    break;
                } 
            }    
        }

        if (f == true){
            for (int i = stop; i <= D; i++){
                if (S[i + 1] == '.'){
                    S[i] = '.';
                    S[i + 1] = 'B';
                }else if(S[i + 2] == '.'){
                    S[i] = '.';
                    S[i + 2] = 'B';
                    i++;
                }else{
                    f = false;
                    break;
                }

                if (S[D] == 'B'){
                    break;
                }
            }        
        }
    }
    
    if (f == true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vs = V<string>;
using vd = V<double>; using vvi = V< V<int> >; using vvl = V< V<> >;
template<typename T>using heap = priority_queue< T , V<T> , greater<T> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif

using P = pair<ll,ll>; using vp = V<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
//////

ll dp[1024][30000];

void solve(){
  ini(N);
  vl w(N) , s(N) , v(N);
  rep(i , N) in(w[i] , s[i] , v[i]);

  vi ord(N); iota(all(ord) , 0);
  sort(all(ord) ,[&](int x,int y){
    return w[x] + s[x] < w[y] + s[y];
  });

  rep(i , N) rep(j , 20201){
    amax( dp[i + 1][j] , dp[i][j]);
    if(s[ord[i]] >= j){
      amax( dp[i + 1][j + w[ord[i]]] , dp[i][j] + v[ord[i]]);
    }
  }

  ll ans = 0;
  rep(j , 20010) amax(ans , dp[N][j]);
  out(ans);

  
}

Measured memory_bytes: 234368
using System;
class Program
{
	static void Main()
	{
	string s = Console.ReadLine();
	int a = 700;
      for(int i = 0;i<3;i++)
      {
        if(s[i] == 'o')
        {a += 100;
        }
      }
	Console.WriteLine(a);//WriteLineをWriteとすると、改行なしで出力。
	}
}

Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<pair<int,int> > V;
void Cut(int,int);
int main(){
  int n,w,d,p,s;
  vector<int> ans;
  while(1){
    cin >> n >> w >> d;
    if(n==0&&w==0&&d==0) break;
    V.push_back(make_pair(0,0));
    V.push_back(make_pair(d,w));
    for(int i=0;i<n;i++){
      cin >> p >> s;
      Cut(p,s);
    }
    for(int i=1;i<V.size();i++) ans.push_back(V[i].first*V[i].second);
    sort(ans.begin(),ans.end());
    for(int i=0;i<ans.size();i++){
      if(i!=ans.size()-1) cout << ans[i] << ' ';
      else cout << ans[i];
    }
    cout << endl;
    V.clear();
    ans.clear();
  }
  return 0;
}
void Cut(int p,int s){
  int d=V[p].first,w=V[p].second,push1,push2;
  V.erase(V.begin()+p);
  if(s>2*d+2*w) s%=2*d+2*w;
  if(s>w+d) s-=w+d;
  if(0<s&&s<w){
    if(w-s<s) push1=w-s,push2=s;
    else push1=s,push2=w-s;
    V.push_back(make_pair(d,push1));
    V.push_back(make_pair(d,push2));
  }
  else if(w<s&&s<w+d){
    if(w+d-s<s-w) push1=w+d-s,push2=s-w;
    else push1=s-w,push2=w+d-s;
    V.push_back(make_pair(push1,w));
    V.push_back(make_pair(push2,w));
  }
}

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

#define rep(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumlate(all(a),0)
#define pb push_back
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

#define inf 1<<29

int check[100000];
vector<pii> g[100000];
int n;
int indeg[100000];
int posi[100000];
int indeg2[100000];

bool bfs(int i){
  queue<int> q;
  q.push(i);
  check[i]=1;
  while(!q.empty()){
    int a = q.front();
    q.pop();
    int s = g[a].size();
    rep(j,s){
      indeg[g[a][j].first]--;
      if(posi[g[a][j].first]!=0 and posi[a]+g[a][j].second!=posi[g[a][j].first])
	return false;
      posi[g[a][j].first]=posi[a]+g[a][j].second;
      if(indeg[g[a][j].first]==0 and check[g[a][j].first]==0){
	check[g[a][j].first]=1;
	q.push(g[a][j].first);
      }
    }
  }
  return true;
}
 
main(){
  int m; cin >> n >> m;
  int l,r,d;
  
  rep(i,m){
    cin >> l >> r >> d;
    g[--l].pb(make_pair(--r,d));
    indeg[r]++;
    indeg2[r]++;
  }
 
  rep(i,n){
    if(indeg[i]==0 and check[i]==0)
      if(bfs(i)==false){
	cout << "No\n";
	return 0;
      }
  }

  int maxv = 0;
 
  rep(i,n){
    if(indeg2[i]!=0 and posi[i]==0){
      cout << "No\n";
      return 0;
    }
    maxv = max(maxv,posi[i]);
  }
 
  if(maxv > pow(10,9)){
    cout << "No\n";
    return 0;
  }
  
  cout << "Yes\n";
  //rep(i,n) cout << posi[i];
}


Measured memory_bytes: 8064
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n, k;
	cin >> n >> k;

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

	sort(h.rbegin(), h.rend());

	long long min_attack = 0;
	for (int i = k; i < n; ++i) {
		min_attack += h[i];
	}

	cout << min_attack << "\n";

	return 0;

}

Measured memory_bytes: 1024
#include <stdio.h>
 int main(){
 int x, y;
  while(1){
  scanf("%d %d",&x,&y);
  if(x==0 && y==0) break;
  if(x>y){
  printf("%d %d\n",y,x);
  } else{
  printf("%d %d\n",x,y);
 }
 }
}

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

using namespace std;

int main()	{
  long long n, t;
  cin >> n >> t;
  vector<long long int> a;
  for (int i = 0; i < n; i++)	{
    a.push_back(0);
  }
  for (int i = 0; i < n; i++)	{
    cin >> a[i];
  }
  long long total = t;
  for (int i = 0; i < n - 1; i++)	{
    total += min(t, a[i + 1]- a[i]);
  }
  cout << total << endl;
  return 0;
}

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

int main(){
    string a;
    int l;
    while(cin >> a >> l, l){
        while(a.length() != l) a = "0"+a;
        
        int arr[l];
        for(int i = 0; i < l; i++)  arr[i] = a[i]-'0';

        map<int,int> m;
        m[stoi(a)] = 0;

        int ansj, ansai, ansdiff, step = 1;
        while(1){
            sort(arr, arr+l);
            int less = 0, more = 0;
            for(int i = 0; i < l; i++){
                less = less*10 + arr[i];
                more = more*10 + arr[l-1-i];
            }
            int next = more-less;
            if(m.count(next)){
                ansj = m[next], ansai = next, ansdiff = step-ansj;
                break;
            }
            m[next] = step;
            int pos = 0;
            while(next > 0) arr[pos] = next%10, pos++, next /= 10;
            while(pos < l)  arr[pos] = 0, pos++;
            step++;
        }

        cout << ansj << " " << ansai << " " << ansdiff << endl;
    }
    return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, m;
    cin >> n >> m;
    ll x = 100*(n-m) + 1900*m;
    ll p = 1;
    rep(i, m) {
        p *= 2;
    }
    out(x*p);
    re0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 			1000000007
#define tc(t) 			int t;cin >> t;while(t--)
#define for0(i , n)		for(int i=0;i<n;i++)
#define loop(i , a, b)	for(int i=a;i<=b;i++)
#define endl 			'\n'
#define inf 			1e18
#define fi 				first
#define se 				second

int XX[8] = { +1, +1, +1, 0, 0, -1, -1, -1};
int YY[8] = { +1, 0, -1, +1, -1, +1, 0, -1};
int dx[4] = { -1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int a[100005];
int n;
vector<int> dp(100005, -1);

int frogA(int ind) {
	if (ind == (n - 1)) return 0;
	if (dp[ind] != -1) return dp[ind];
	int c1 = abs(a[ind] - a[ind + 1]) + frogA(ind + 1);
	int c2 = inf;
	if (ind + 2 < n)
		c2 = abs(a[ind] - a[ind + 2]) + frogA(ind + 2);
	return dp[ind] = min(c1, c2);
}

signed main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r" , stdin);
	freopen("output.txt" , "w" , stdout);
#endif

	cin >> n;

	for0(i, n) cin >> a[i];

	cout << frogA(0);

	return 0;
}

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

using namespace std;

string in;
vector<int> P,A;

int main(){
  getline(cin,in);
  P.push_back(-5);
  A.push_back(-5);
  while(1){
    int n = in.find("apple",A.back()+5);
    if(n != -1) A.push_back(n);
    else break;
  }

  while(1){
    int n = in.find("peach",P.back()+5);
    if(n != -1) P.push_back(n);
    else break;
  }

  for(int i = 1; i < P.size(); i++)
    in.replace(P[i],5,"apple");
  for(int i = 1; i < A.size(); i++)
    in.replace(A[i],5,"peach");

  cout << in << endl;
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ll long long
#define PI 3.14159265358979
#define sc ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9+7;
ll const INF = 1e18;

int main()
{
	sc;
	int k;
	cin>>k;
	string s;
	cin>>s;
	int l = s.length();
	if(l <= k){
		cout<<s<<'\n';
	}
	else{
		for(int i=0;i<k;i++){
			cout<<s[i];
		}
		cout<<"...\n";
	}
}

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

int main() {
  int A,B,C,D,E,F;
  string S;
  
  cin>>A>>B>>C>>D;
  if(A%D!=0) E=A/D+1;
  else E=A/D;
  
  if(C%B!=0) F=C/B+1;
  else F=C/B;
  
  if(E<F) S="No";
  else S="Yes";
    
  cout<<S;
}

Measured memory_bytes: 3592
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>
#include<boost/multiprecision/cpp_int.hpp>



using namespace std;
using namespace boost::multiprecision;

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", v)
#define PRIY PRI("Yes")
#define PRIN PRI("No")
template<typename A, typename B>
void mins(A& a, const B& b) { a = min(a, (A)b); };
template<typename A, typename B>
void maxs(A& a, const B& b) { a = max(a, (A)b); };

ull key(ull x, ull y) { return ((x << 32) | y); }

int main() {
	ll H, W, N;
	cin >> H >> W >> N;
	unordered_set<ull> P;
	unordered_set<ull> found;
	vector<ll> cnt;
	REP(i, 0, N) {
		uint x, y;
		cin >> x >> y;
		--x; --y;
		P.insert(key(x, y));
	}
	cnt.resize(10, 0);
	auto f = [&](int x_, int y_, int px, int py) {
		int x = x_ - px;
		int y = y_ - py;
		if (x < 0 || y < 0 || x + 2 >= H || y + 2 >= W) return;
		if (found.count(key(x, y)) > 0) return;
		int c = 0;
		REP(i, 0, 3)REP(j, 0, 3) {
			if (P.count(key(x + i, y + j)) > 0) ++c;
		}
		cnt[c]++;
		found.insert(key(x, y));
	};
	for (ull p : P) {
		uint x = p >> 32;
		uint y = (p << 32) >> 32;
		REP(i, 0, 3)REP(j, 0, 3) f(x, y, i, j);
	}
	cnt[0] = (H - 2) * (W - 2);
	REP(i, 1, 10)cnt[0] -= cnt[i];
	REP(i, 0, 10)PRI(cnt[i]);
	return 0;
}


Measured memory_bytes: 43528
#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define pb push_back
using namespace std;
const int N=3e5+5;
int n,x[N];
priority_queue<int>q;
ll sum,ans,dp[2][N];
int main()
{
	cin>>n;
	for(int i=0;i<n*3;i++)cin>>x[i];
	for(int i=0;i<n;i++)
	{
		sum+=x[i];
		q.push(-x[i]);
	}
	dp[0][n-1]=sum;
	for(int i=n;i<3*n;i++)
	{
		dp[0][i]=dp[0][i-1];
		if(-q.top()<x[i])
		{
			dp[0][i]=dp[0][i-1]+q.top()+x[i];
			q.pop();
			q.push(-x[i]);
		}
	}
	while(!q.empty())q.pop();
	sum=0;
	for(int i=3*n-1;i>=n*2;i--)
	{
		q.push(x[i]);
		sum+=x[i];
	}
	dp[1][n*2]=sum;
	for(int i=n*2-1;i>=0;i--)
	{
		dp[1][i]=dp[1][i+1];
		if(q.top()>x[i])
		{
			dp[1][i]=dp[1][i+1]-q.top()+x[i];
			q.pop();
			q.push(x[i]);
		}
	}
	ans=-1e18;
	for(int i=n;i<=2*n;i++)
	{
//		cout<<dp[0][i]<<' '<<dp[1][i]<<endl;
		ans=max(ans,dp[0][i-1]-dp[1][i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5240
#include<stdio.h>
int main(){
          int a,b;
          scanf("%d %d", &a, &b);
          if(a<b){
                 printf("a < b\n");
          }else{ 
                 if(a>b){
                        printf("a > b\n");
                 }else{
                        printf("a == b\n");
                 }
          }
          return 0;
}

Measured memory_bytes: 2596
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		long []a = new long[N];
		for(int i = 0; i < N; i++) {
			a[i] = scan.nextLong();
		}
		scan.close();

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

		if(p == 0) {
			System.out.println(0);
		}else {
			System.out.println(p - N);
		}

	}
	public static int num2(long n) {
		for(int i = 1; i < 10000; i++) {
			long t = (long)Math.pow(2, i);
			if(n % t != 0) {
				return i;
			}
		}
		return 0;
	}
}

Measured memory_bytes: 34412
def together(n , a):

    listans = [0]*(10**5+2)

    for i in range(n):
        listans[a[i] - 1] += 1
        listans[a[i]] += 1
        listans[a[i] + 1] += 1

    return max(listans)


def main():
    n = int(input())
    a = list(map(int,input().split()))
    print(together(n , a))

if __name__ == '__main__':
    main()

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define INF 2000000000000000000LL
#define EPS 1e-9
#define debug(a) cerr<<#a<<"="<<(a)<<"\n"
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> cd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll mod = 1e9+7;
const double PI = acos(-1);

int n,i,j,k,t;
int h[200004];
int a[200004];
int le[200004];
ll dp[200004];
ll tree[800005];

void update(int l, int r, int pos, int idx, ll val){
    if(r < idx || l > idx)
        return;
    if(l == r){
        tree[pos] = max(tree[pos], val);
        return;
    }
    int mid = (l+r)>>1;
    update(l, mid, 2*pos+1, idx, val);
    update(mid+1, r, 2*pos+2, idx, val);
    tree[pos] = max(tree[2*pos+1], tree[2*pos+2]);
}

ll query(int l, int r, int pos, int ql){
    if(r < ql)
        return 0;
    if(l >= ql)
        return tree[pos];
    int mid = (l+r)/2;
    return max(query(l, mid, 2*pos+1, ql), query(mid+1, r, 2*pos+2, ql));
}

int main(){
    memset(tree, 0, sizeof tree);
    memset(dp, -1, sizeof dp);
    scanf("%d", &n);
    for(i=1;i<=n;++i)
        scanf("%d", h+i);
    for(i=1;i<=n;++i)
        scanf("%d", a+i);
    h[n+1] = n+1;
    le[n] = n+1;
    for(i=n;i>=1;--i){
        dp[i] = a[i] + query(1, n, 0, h[i]);
        update(1, n, 0, h[i], dp[i]);
    }
    printf("%lld\n", query(1, n, 0, 1));
    return 0;
}

Measured memory_bytes: 9984
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
#define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << endl;
#define LINE cout << "line : " << __LINE__ << endl;
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl;
#define STOP assert(false);
#else
#define dump(x) ;
#define LINE 	;
#define dumpV(v);
#define STOP 	;
#endif

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fi<<", "<<a.se<<')';
    return out;
  }
}


ll dist[10010][610];	//time from start to room_i and after j_min left prev room

struct Edge{ int to, cost; };
vector<Edge> es[10010];
template<typename T> T chmax(T& a, const T& b){return a = max(a, b);}
template<typename T> T chmin(T& a, const T& b){return a = min(a, b);}

int main(){
	int n, m, x;
	cin >> n >> m >> x;
	vi t(n);
	rep(i, n) cin >> t[i];

	rep(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		es[a].pb({b, c});
		es[b].pb({a, c});
	}

	const int Base = 203;
	rep(i, 10010) rep(j, 610) dist[i][j] = 1e18;
	auto dijkstra = [&] {
		typedef pair<pair<long, int>, pii> P;	//cost from time prv_state:0->hot, 1->normal, 2->cool
		priority_queue<P,vector<P>,greater<P> > q;
		q.push({{0LL, 0}, {x, t[0]}});
		dist[0][0] = 0LL;
		while(!q.empty()) {
			P p = q.top();	q.pop();
			ll cost = p.fi.fi;
			int from = p.fi.se, time = p.se.fi, ps = p.se.se;
			//dump(cost);dump(from);dump(time);dump(ps);
			if(cost > dist[from][time+ps*Base]) continue;
			for(auto& e : es[from]) {
				int to = e.to;
				ll ncst = cost + e.cost;
				if(ps != 1 && ps != t[to] && t[to] != 1 && time - e.cost > 0) continue;
				int ntime, nstate;
				if(t[to] == 1) {
					ntime = (ps == 1 ? 0 : max(0, time - e.cost));
					nstate = (ntime == 0 ? 1: ps);
				}
				else {
					ntime = x;
					nstate = ntime == 0 ? 1 : t[to];
				}
				if(ncst < dist[to][ntime+nstate*Base]) {
					dist[to][ntime+nstate*Base] = ncst;
					q.push({{ncst, to}, {ntime, nstate}});
				}
			}
		}
	};
	dijkstra();
	ll ans = 1e18;
	rep(j, 610) chmin(ans, dist[n-1][j]);
	cout << ans << endl;
	// #ifdef DEBUG_MODE
	// //DEBUG_2D
	// for(int i = n-1; i < n; i++) {
	// 	for(int j = 0; j < 610; j++) if(dist[i][j] == 1e18) cout <<"  "; else printf("%3d",dist[i][j]);
	// 	printf("\n");
	// }
	// #endif
	return 0;
}

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



int main(){
    int N;
    cin>>N;
    vector<int> L(N);

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

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

    int count=0;

    for(int i=0;i<N;i++){
        int a = L.at(i);
        for(int j=1;i+j<N;j++){
            int b = L.at(i+j);
            for(int k=1;i+j+k<N;k++){
                int c = L.at(i+j+k);
                if(abs(b-c)>=a) {
                    break;
                }else{
                    count++;
                }
            }


            }
        }


    cout<<count<<endl;

    return 0;
    }




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

int main(){
  int n,a[200000],atmp[200000];
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> a[i];
    atmp[i] = a[i];
  }

  sort(a,a+n);

  for(int i = 0;i < n;i++){
    if(atmp[i] < a[n/2]){
      cout << a[n/2] << endl;
    }else{
      cout << a[n/2-1] << endl;
    }
  }

  return(0);
}



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

int main() {
	int h1,h2,m1,m2,k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int h=h2-h1,m=m2-m1;
	if(h2 < h1)
	{
		h += 24;
	}
	int tm = h * 60 + m,ans = tm - k;
	if(ans < 0)
	{
		ans = 0;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
#include <cassert>
#include <unordered_map>
#include <chrono>
#include <random>
#include <ctime>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = 3.14159265358979323846;
const ll MOD = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	srand(time(0));
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	ll ans = 0;
	for (ll i = 1; i <= n; i++) {
		ans += i * (n - i + 1);
	}
	for (int i = 0; i < n - 1; i++) {
		ll a, b;
		cin >> a >> b;
		if (a > b)swap(a, b);
		ans -= a * (n - b + 1);
	}
	cout << ans;	
}

Measured memory_bytes: 3640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
typedef long long ll;

int main()
{
   int N;
   cin >> N;
   vector<int> A(N);
   ll ans = 0;
   for (int i = 0; i < N; i++)
   {
      cin >> A[i];
      if (i > 0)
      {
         if (A[i] < A[i - 1])
         {
            ans += A[i - 1] - A[i];
            A[i] = A[i - 1];
         }
      }
   }
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 4044
def solve(n):
    cnt_dict = dict()
    for k in range(11, 100):
        if k % 10 != 0:
            cnt_dict[str(k)] = 0
    for i in range(1, n + 1):
        if i % 10 != 0:
            cnt_dict[str(i)[0] + str(i)[-1]] += 1
    res = 0  # 0 is ignored
    for k in range(11, 100):
        if k % 10 != 0:
            res += cnt_dict[str(k)] * cnt_dict[str(k)[1] + str(k)[0]]
    # print(res)
    return res


def main():
    n = int(input())
    res = solve(n)
    print(res)


def test():
    assert solve(25) == 17
    assert solve(1) == 1
    assert solve(100) == 108
    assert solve(2020) == 40812
    assert solve(200000) == 400000008


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>//solved by *ALIKHAN*
#define ll long long
#define ld long double
#define pb push_back
#define sz(x) (int)x.size()
#define F first
#define S second
#define ppb pop_back
#define mp make_pair
#define all(n) n.begin(), n.end()
#define timefaster ios_base::sync_with_stdio(0);cin.tie(0)

using namespace std;

const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18;

int main(){
  	timefaster;
  	int n;
  cin >> n;
  cout << n * n * n;





}// Aksay sila

Measured memory_bytes: 256
/*
Volume0-0009
*/
#include <iostream>
#include <stdlib.h>
#include <string.h>

#define N 1000000
#define TRUE (int)(0==0)
#define FALSE !TRUE

using namespace std;

int main(int argc, char *argv[]){
  int f[N];

  //  memset(f, TRUE, N);
  f[0]=FALSE;
  f[1]=FALSE;
  for (int i=2; i<N; i++)
    f[i] = TRUE;

  for (int i=2; i<N; i++){
    if (f[i] == TRUE ) {
      for (int j=i+i; j<N; j+=i){
	f[j] = FALSE;
      }
    }
  }
  int n;
  while (cin >> n) {
    int m = 0;
    for (int i=1; i<=n; i++){
      if (f[i]){
	m++;
      }
    }
    cout << m << endl;
  }
 
  exit(0);
}

Measured memory_bytes: 5064
#include<bits/stdc++.h>
using namespace std;
int a[10][10],m,n,flag;
char kk[10];
void dfs(int x,int y){
    if(x==m-1&&y==n-1){
        for(int i=0;i<m;++i)for(int j=0;j<n;++j){
            if(a[i][j])return;
        }
        flag=1;
        return;
    }
    if(flag==1)return;
    if(a[x+1][y]){
        a[x+1][y]=0;
        dfs(x+1,y);
        a[x+1][y]=1;
    }
    if(a[x][y+1]){
        a[x][y+1]=0;
        dfs(x,y+1);
        a[x][y+1]=1;
    }
    if(!a[x][y+1]&&!a[x+1][y])return;
}
int main(){
    scanf("%d%d",&m,&n);
    for(int i=0;i<=m;++i){
        gets(kk);//输入
        for(int j=0;j<n;++j)
        if(kk[j]=='#')a[i-1][j]=1;
    }
    if(a[0][0]){
        a[0][0]=0;
        dfs(0,0);
    }
    if(flag)cout<<"Possible"<<endl;
    else cout<<"Impossible"<<endl;
    return 0;
} 

Measured memory_bytes: 256
#include <iostream>

template<class T> T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}

int main() {
  long long a, b; std::cin >> a >> b;
  long long g = gcd(a, b);
  long long ans = a * b / g;
  std::cout << ans << std::endl;
  
  return 0;
}

Measured memory_bytes: 3624
N = int(input())

ba = 0
_a = 0
b_ = 0
ans = 0
for _ in range(N):
    s = input()
    ans += s.count('AB')
    if s[-1] == 'A' and s[0] == 'B':
        ba += 1
    elif s[-1] == 'A':
        _a += 1
    elif s[0] == 'B':
        b_ += 1

if _a == b_ == 0 and ba > 0:
    ans += ba - 1
else:
    ans += min(ba+_a, ba+b_)

print(ans)


Measured memory_bytes: 3064
/*
 * test.cpp
 *
 *
 *      Author: Fireworks
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cmath>
#include<bitset>
#include<set>
#include<iomanip>
#include<fstream>
#include<bitset>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<list>
#include<sstream>

using namespace std;

typedef pair<int,int> ii;
typedef pair<int,long long> il;
typedef pair<long long,long long> ll;
typedef pair<ll,int> lli;
typedef pair<long long,int> li;
typedef pair<double,double> dd;
typedef pair<ii,int> iii;
typedef pair<double,int> di;
typedef pair<ii,ii> iiii;
long long mod = 1000000007LL;
long long base = 37;
long long large = 1000000000000000000LL;



int main(){
	int n;
	cin>>n;
	long long a,b;
	cin>>a>>b;
	vector<long long> h(n,0);
	for(int i=0;i<n;i++) cin>>h[i];
	long long low = 0;
	long long high = 1000000000LL;
	long long mid;
	long long ans;
	while(low<=high){
		mid = (low+high)/2;
		vector<long long> hh = h;
		long long cnt = 0;
		for(int i=0;i<n;i++){
			hh[i]-=mid*b;
			hh[i]=max(hh[i],0LL);
			if(hh[i]>0){
				cnt+=(hh[i]-1)/(a-b)+1;
			}
		}
		if(cnt<=mid){
			ans=mid;
			high=mid-1;
		}else{
			low=mid+1;
		}
	}
	cout<<ans<<endl;

	/*int totalcase;
	int testcase=0;
	cin>>totalcase;
	ofstream out;
	out.open("result.txt");

	while(totalcase--){
		testcase++;
		out<<"Case #"<<testcase<<": ";
		cout<<testcase<<": "<<endl;

		//GOGOGO


		//END
	}
	out.close();*/

	return 0;
}


Measured memory_bytes: 1920
#include<iostream>
#include<string>
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;



vector<string> ans;
string code;

void dfs(string s,int used,int i){
	if(i==code.size()){
		ans.push_back(s);
		return;
	}
	char c=code[i];
	if(c=='z'){
		if(used&1<<'z'-'a')dfs(s+'z',used|1<<'z'-'a',i+1);
	}else{
		if(used&1<<c-'a')dfs(s+c,used|1<<c-'a',i+1);
		if((used&1<<c+1-'a')==0)dfs(s+(char)(c+1),used|1<<c+1-'a',i+1);
	}
}



int main(){
	while(cin>>code&&code!="#"){
		ans.clear();
		dfs("",1,0);
		cout<<ans.size()<<endl;
		if(ans.size()<=10){
			rep(i,ans.size())cout<<ans[i]<<endl;
		}else{
			rep(i,5)cout<<ans[i]<<endl;
			rep(i,5)cout<<ans[ans.size()-5+i]<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2380
N=input()
A="abcdefghij"

S=["a"]
for n in range(2,N+1):
    temp=[]
    for s in S:
        max_s=max(s)
        ind_max_s=A.index(max_s)
        for i in range(ind_max_s+2):
            temp.append(s+A[i])
    S=temp

S.sort()
for x in S:
    print x


Measured memory_bytes: 44316