akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;



class Edge {
public:
  ll t, w;
  Edge() {}
  Edge(ll t, ll w): t(t), w(w) {}
};

ll N, M;
vector<Edge> g[MAX];
ll d[MAX];

void dijkstra(ll s) {
  ll i, u;
  ll clr[MAX];
  for(i=0; i<N; i++) {
    d[i]=INF;
    clr[i]=0;
  }
  priority_queue<P> q;
  q.push(P(0, s));
  d[s]=0;
  
  while(q.size()) {
    P f=q.top(); q.pop();
    u=f.second;
    
    clr[u]=1;
    if(d[u]<-f.first) continue;
    
    for(i=0; i<g[u].size(); i++) {
      Edge &e=g[u][i];
      if(clr[e.t]) continue;
      if(d[e.t]<=d[u]+e.w) continue;
      
      d[e.t]=d[u]+e.w;
      q.push(P(-d[e.t], e.t));
    }
  }
}


int main(void) {
  cin >> N >> M;
  ll i;
  
  vector<pair<ll, P>> es;
  
  for(i=0; i<M; i++) {
    ll l, r, c;
    cin >> l >> r >> c;
    l--; r--;
    g[l].push_back(Edge(r, c));
  }
  
  for(i=0; i<N-1; i++) {
    g[i+1].push_back(Edge(i, 0));
  }
  
  dijkstra(0);
  if(d[N-1]==INF) pt(-1);
  else pt(d[N-1]);
  
}








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

int main(){
    int X, N, p;
    int flg_found_p = 0, flg_found_m = 0;
    int tmp_p, tmp_m;
    int ans_p = 1000, ans_m = 1000;
    map<int, int> f_list;

    std::cin >> X >> N;

    for(int i = 0; i < N; i++){
        std::cin >> p;
        f_list[p] = 1;
    }

    for(int i = 0; i <= 100; i++){
        //X+i
        tmp_p = X + i;
        tmp_m = X - i;
        if(!f_list.count(tmp_p)){
            flg_found_p = 1;
            ans_p = tmp_p;    
        }
        if(!f_list.count(tmp_m)){
            flg_found_m = 1;
            ans_m = tmp_m;
        }
        if(flg_found_m == 1 || flg_found_p == 1){
            break;
        }
    }

    if(ans_p < ans_m){
        std::cout << ans_p;
    }else{
        std::cout << ans_m;
    }

}

Measured memory_bytes: 3640
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
	count[i]+=count[i-1]
	if S[i-1:i+1]=="AC":
		count[i]+=1
for i in range(Q):
	l,r=map(int,input().split())
	print(count[r-1]-count[l-1])

Measured memory_bytes: 9236
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
    is >> p.first >>p.second ;
    return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
    rep(i, v.size()) {
        is >> v[i];
    }
    return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
    int n,m;
    cin >>n>>m;
	VP data(n), ter(m);
	cin >> data>>ter;
	int ans = 0;
	ll at   = INFLL;
	rep(i,n){
		at = INFLL;
		rep(j,m){
            if(chmin(at,abs(data[i].F-ter[j].F)+abs(data[i].S-ter[j].S))){
				ans = j;
			}
        }
		cout << ans + 1 << endl;
	        }
   
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(x,1010101) {
		y=x*108/100;
		if(y==N) {
			cout<<x<<endl;
			return;
		}
	}
	
	cout<<":("<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
// ===== 2018/06/02 20:12:54 =====

// ../../../lib/template/includes.hpp

#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <vector>

// ../../../lib/template/const_value.hpp

template <typename T> constexpr T inf();
template <> constexpr int inf<int>() { return 1e9; }
template <> constexpr long long inf<long long>() { return 1e18; }
template <> constexpr long double inf<long double>() { return 1e30; }

template <typename T>
constexpr typename std::enable_if<std::is_arithmetic<T>::value, T>::type
zero() {
  return T(0);
}

const long double pi = acos(-1.0);

// ../../../lib/template/initialize.cpp

struct yes_no : std::numpunct<char> {
  string_type do_truename() const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

struct Initialize {
  Initialize() {
    std::locale loc(std::locale(), new yes_no);
    std::cout << std::boolalpha << std::setprecision(11) << std::fixed;
    std::cout.imbue(loc);
  }
};

const Initialize init;

// ../../../lib/template/macros.hpp

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()

// ../../../lib/template/misc.hpp

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

// ../../../lib/template/range.hpp

class range {
  class index_type {
    int x;

  public:
    index_type(int x_) : x(x_) {}
    int operator*() const { return x; }
    bool operator!=(index_type &r) { return x < r.x; }
    void operator++() { ++x; }
  };
  index_type i, n;

public:
  range(int n_) : i(0), n(n_) {}
  range(int i_, int n_) : i(i_), n(n_) {}
  index_type &begin() { return i; }
  index_type &end() { return n; }
};

// ../../../lib/template/typedef.hpp

using ll = long long;
using ld = long double;
using Point = std::complex<ld>;

// ../../../lib/template/template.cpp

using namespace std;

// A.cpp

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

void solve(ll A, ll B) {
  cout << max({A + B, A - B, A * B}) << endl;
}

int main() {
	ll B;
	ll A;
	scanf("%lld", &A);
	scanf("%lld", &B);
	solve(A, B);
	return 0;
}
// ===== 2018/06/02 20:12:54 =====



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

const int Nmax = 8;
vector<vector<int>> graph(Nmax, vector<int>(Nmax));

int dfs(int v, int N, vector<bool> visited){
  bool all_visited = true;
  for(int i=0; i<N; i++){
    if(visited.at(i) == false){
      all_visited = false;
    }
  }
  
  if(all_visited){
    return 1;
  }
  
  int ans = 0;
  for(int i=0; i<N; i++){
    if(graph.at(v).at(i) == false) continue;
    if(visited.at(i)) continue;
    
    visited.at(i) = true;
    ans += dfs(i, N, visited);
    visited.at(i) = false;
  }
  
  return ans;
}

int main() {
  int N, M;
  cin >> N >> M;
  
  for(int i=0; i<M; i++){
    int a, b;
    cin >> a >> b;
    graph.at(a-1).at(b-1) = true;
    graph.at(b-1).at(a-1) = true;
  }
  
  vector<bool> visited(Nmax);
  for(int i=0; i<N; i++){
    visited.at(i) = false;
  }
  
  visited.at(0) = true;
  cout << dfs(0, N, visited) << endl;
  return 0;
}

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

#ifdef LOCAL 
string to_string(char a) { return string(1,a); }
string to_string(bool a) { return a ? "1" : "0"; }
string to_string(const char* a) { return (string)a; }
string to_string(string a) { return a; }
string to_string(vector<bool> v) {
	string s = "["; for(unsigned i=0;i<v.size();i++){ s += ((i>0)?" ":"");
    s += char('0'+v[i]); } 	s += "]"; return s; }
template<class A, class B> string to_string(pair<A,B> p);
template<class T> string to_string(T v) {
	bool b = 1; string s = "["; for (const auto& x: v) {
		if (!b) {s += ", ";} b = 0; s += to_string(x); } s += "]"; return s; }
template<class A, class B> string to_string(pair<A,B> p) {
	return "("+to_string(p.first)+", "+to_string(p.second)+")"; }
void dbgf() { cerr << endl; }
template<class H, class... T> void dbgf(H h, T... t) {
	cerr << to_string(h); if (sizeof...(t)) cerr << ", ";
	dbgf(t...); }
#define dbg(...) cerr << #__VA_ARGS__ << " = ", dbgf(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
#define boolout(x) cout<<(x?"YES":"NO")<<endl;
typedef long long ll;


double p[301][301][301];
double ev[301][301][301];
void solve()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }


    vector<bool> dp(k+1); 
    dp[0] = false;
    for (int i = 1; i < k+1; ++i) {
        for (int j = 0; j < n; ++j) {
            if (i-a[j]>=0 && dp[i-a[j]]==false) {
                dp[i] = true; 
            }
        }
    }

    //dbg(dp);

    if (dp[k]) {
        cout << "First" << endl;
    } else {
        cout << "Second" << endl;
    }

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t; // read t. cin knows that t is an int, so it reads it as such.
    for (int i = 1; i <= t; ++i) {
        solve();
    }
    return 0;
}



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

int main() {
    int N;
    cin >> N;
    vector<int> f(N + 1, 0);
    for (int x = 1; x * x <= N; ++x) {
        for (int y = 1; x * x + y * y <= N; ++y) {
            for (int z = 1; x * x + y * y + z * z + x * y + y * z + z * x <= N; ++z) {
                ++f[x * x + y * y + z * z + x * y + y * z + z * x];
            }
        }
    }
    for (int i = 1; i <= N; ++i) {
        cout << f[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3428
def m():
    n, m = map(int, input().split())
    d = dict()
    yeard = dict()
    a = []
    b = []
    for i in range(m):
        p, y = map(int, input().split())
        a.append((p, y))
        b.append((p, y))

    a.sort(key=lambda x: x[1])
    for i in range(m):
        if d.get(a[i][0], 0) == 0:
            d[a[i][0]] = 1
            yeard[a[i][1]] = 1
        else:
            d[a[i][0]] += 1
            yeard[a[i][1]] = d[a[i][0]]

    for key, value in b:
        print(str(key).zfill(6)+str(yeard[value]).zfill(6))

m()

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

int main(){
   string S;
  cin >> S;
  sort(S.begin(),S.end());
  string T;
  cin >> T;
  sort(T.begin(),T.end());
  reverse(T.begin(), T.end());
  
  if(S < T){
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;
  
}

Measured memory_bytes: 256
def find(A):
    X=[(A[i],i) for i in range(len(A))]
    X=sorted(X)
    ans=[0]*len(X)
    p1=(len(A)-1)//2
    p2=len(A)//2
    #print(p1,p2)
    for i in range(len(X)):
        a,b=X[i]
        if i<p2:
            ans[b]=X[p2][0]
        else:
            ans[b]=X[p1][0]
    return ans
input()
A=[str(x) for x in find(list(map(int,input().strip().split(" "))))]
print("\n".join(A))

Measured memory_bytes: 122280
//#pragma GCC optimize(2)
#include<set>
#include<map>
#include<stack>
#include<cmath>
#include<ctime>
#include<queue>
#include<cstdio>
#include<vector>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
int read(){
    int f=1,x=0;char c=getchar();
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
    while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return f==1?x:-x;
}
#define MAXN 1000
#define INF 0x3f3f3f3f
int main(){
	int k=read(),x=read();
	for(int i=max(-1000000,x-k+1);i<=min(1000000,x+k-1);i++)
		printf("%d ",i);
	puts("");
    return 0;
}

Measured memory_bytes: 256
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


n, l = LI()
s = SR(n)
s.sort()
print(''.join(s))


Measured memory_bytes: 3064
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <cassert>
//#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;
 

void solve()
{
    int n, K;
    scanf("%d%d", &n, &K);
    vector<int> cnt(n);
    int i, j;
    for (i = 0; i < K; i++) {
        int num;
        scanf("%d", &num);
        for (j = 0; j < num; j++) {
            int tmp;
            scanf("%d", &tmp); tmp--;
            cnt[tmp]++;        
        }
    }

    int ans = 0;
    for (i = 0; i < n; i++) {
        if (cnt[i] == 0) ans++;
    }
    printf("%d\n", ans);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}



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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(a-b) <= 3 && abs(c-b) <= d || abs(c-a) <= d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	mp := map[int]int{}
	for i := 0; i < n; i++ {
		var v int
		fmt.Scan(&v)
		mp[v]++
	}
	fi := 0
	se := 0
	for k, v := range mp {
		if fi < k {
			if v >= 2 {
				se = fi
				fi = k
				v -= 2
			}
		}
		if se < k {
			if v >= 2 {
				se = k
			}
		}
	}
	fmt.Println(fi * se)
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
  
void chmin(int& x, int y)
{
  x = min(x, y);
}
void chmax(int& x, int y)
{
  x = max(x, y);
}
  
int main()
{
  int Q, H, W;
  string S[50];
  int proc = 1;
  int used[50][50] = {{}};
  
  cin >> Q;
  while(Q--) {
    cin >> H >> W;
  
    string chars = "";
    for(int i = 0; i < H; i++) {
      cin >> S[i];
      chars += S[i];
    }
    sort(chars.begin(), chars.end());
    chars += ".";
    chars.erase(unique(chars.begin(), chars.end()), chars.end());

    int xx1[128], xx2[128] = {}, yy1[128], yy2[128] = {};
    fill_n(xx1, 128, W);
    fill_n(yy1, 128, H);
    for(int i = 0; i < H; i++) {
      for(int j = 0; j < W; j++) {
        int pos = chars.find(S[i][j]);
        chmin(xx1[S[i][j]], j);
        chmax(xx2[S[i][j]], j);
        chmin(yy1[S[i][j]], i);
        chmax(yy2[S[i][j]], i);
      }
    }
    
    bool Judge = chars.size() == 1;
    do {
      if(chars[chars.size() - 1] != '.') continue;
      Judge = true;
      for(int i = 0; i < chars.size(); i++) {
        for(int j = xx1[chars[i]]; j <= xx2[chars[i]]; j++) {
          for(int k = yy1[chars[i]]; k <= yy2[chars[i]]; k++) {
            if(used[j][k] == proc) continue;
            used[j][k] = proc;
            if(S[k][j] != chars[i]) {
              Judge = false;
              goto myon;
            }
          }
        }
      }
    myon: ;
      ++proc;
    } while(!Judge && next_permutation(chars.begin(), chars.end()));
    if(Judge) cout << "SAFE" << endl;
    else cout << "SUSPICIOUS" << endl;
  }
}

Measured memory_bytes: 1256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
#define MAXN 100005
typedef long long LL;
#define int LL
const int mo=1e9+7;
typedef pair<int,int> pii;
#define gc() getchar()
template<typename _T>
void read(_T &x){
	_T f=1;x=0;char s=gc();
	while(s>'9'||s<'0'){if(s=='-')f=-1;s=gc();}
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+(s^48);s=gc();}
	x*=f;
}
template<typename _T>
_T Fabs(_T x){return x<0?-x:x;}
int n,m,h[MAXN];
bool vis[MAXN];
signed main(){
	read(n);read(m);
	for(int i=1;i<=n;i++)read(h[i]);
	for(int i=1;i<=m;i++){
		int u,v;read(u);read(v);
		if(h[u]>=h[v])vis[v]=1;
		if(h[v]>=h[u])vis[u]=1;
	}
	int sum=0;
	for(int i=1;i<=n;i++)sum+=!vis[i];
	printf("%lld\n",sum);
	return 0;
}

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

#ifdef _DEBUG
    #include "/home/v-o_o-v/deb.h"
    #define deb(x...)cerr << "[" << #x << "] = [";_print(x);
#else
    #define deb(x...)
#endif

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
   
    string s;
    cin >> s;
    cout << s[0] << s.size() - 2 << s.back() << '\n';
    return 0;
}
// Write Here


Measured memory_bytes: 3632
#include <stdio.h>
int main (void){
    int a,b;
    scanf("%d",&a);
    scanf("%d",&b);
    int min;
    min=b-a+1;
    int c;
    for(int i=0;i<(2*a-1);i++){
        c=min+i;
        printf("%d ",c);
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
#define INF  (1<<21)
//int prim(int M[100][100], int n){
int M[100][100];
int prim(int n){
	int u, mincost;
	int color[n], d[n], p[n];
	for(int i=0; i<n; i++){
		color[i]=0;
		d[i]=INF;
		p[i]=-1;
	}
	d[0]=0;
	while(1){
		mincost=INF;
		u=-1;
		for(int i=0; i<n; i++){
			if(mincost>d[i] && color[i]!=2){
				u=i;
				mincost=d[i];
			}
		}
		if(u==-1)
			break;
		color[u]=2;
		for(int v=0; v<n; v++){
			if(color[v]!=2 && M[u][v]!=INF){
				if(d[v]>M[u][v]){
					d[v]=M[u][v];
					p[v]=u;
					color[v]=1;
				}
			}
		}
	}
	int sum=0;
	for(int i=0; i<n; i++)
		if(p[i]!=-1)
			sum+=M[i][p[i]];
	return sum;
}

int main(){
	int n;
	cin>>n;
	//int M[100][100];
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			int e;
			cin>>e;
			if(e!=-1)
				M[i][j]=e;
			else
				M[i][j]=INF;
		}
	}
	cout<<prim(n)<<endl;
	return 0;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    string s;
    cin >> s;

    int add = 0;
    for(int is=0;is<s.size();is++) {
        if(s.at(is)=='o') add++;
    }

    cout << 700 + add * 100 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;

#define int long long
#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define endl "\n"
#define ends " "
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << ": " << x << endlx
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
#define debugV(v) cerr << #v << ": [ "; for(int __ = 0; __ < v.size(); __++) cerr << v[__] << ((__ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugVP(v) cerr << #v << ": [ "; for(int ___ = 0; ___ < v.size(); ___++) cerr << '{' << v[___].first << ", " << v[___].second << '}' << ((___ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugA(a, n) cerr << #a << ": [ "; for(int ____ = 0; ____ < n; ____++) cerr << a[____] << ((____ != n - 1) ? ", " : ends); cerr << ']' << endl
#define print(args...) fprintf (st                                  derr, args)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef map<pii, int> mpii;
typedef set<int> sti;
const int INF = 1e9, MOD = INF + 7 /* INF - 1755647 */;
int gcd(int a, int b) { return (b ? gcd(b, a % b) : a); }
int power(int a, int b) { return (!b ? 1 : power(a, b / 2) * power(a, b / 2) * (b % 2 ? a : 1)); }
int mod(int a) { return (a % MOD + MOD) % MOD; }

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

const int N = 3e1 + 1;

int32_t main() {

    sync;

    int a, b, c; cin >> a >> b >> c;

    if (a * a + b * b == c * c) cout << (a * b) / 2 << endl;
    if (a * a + c * c == b * b) cout << (a * c) / 2 << endl;
    if (c * c + b * b == a * a) cout << (b * c) / 2  << endl;

    return 0;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on

const int N = 100010;
ll ct[N];

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

    ll s = 0;
    rep(i, n) {
        int a;
        cin >> a;
        ++ct[a];
        s += a;
    }

    int q;
    cin >> q;
    while (q--) {
        int b, c;
        cin >> b >> c;

        s += ct[b] * (c - b);
        ct[c] += ct[b];
        ct[b] = 0;

        cout << s << "\n";
    }
    return 0;
}


Measured memory_bytes: 4408
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

char s;

int main(){
    cin>>s;
    if(s=='a'||s=='i'||s=='u'||s=='e'||s=='o'){
        out("vowel");
    }
    else out("consonant");
}


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

class Exam {
	private int a;
	private int b;
	private int c;
	private int d;
	private int e;
	private int sum;

	Exam(int a, int b, int c, int d, int e){
		this.a = a;
		this.b = b;
		this.c = c;
		this.d = d;
		this.e = e;
		this.sum = this.a + this.b + this.c + this.d + this.e;
	}

	public int getA() {
		return a;
	}
	public void setA(int a) {
		this.a = a;
	}
	public int getB() {
		return b;
	}
	public void setB(int b) {
		this.b = b;
	}
	public int getC() {
		return c;
	}
	public void setC(int c) {
		this.c = c;
	}
	public int getD() {
		return d;
	}
	public void setD(int d) {
		this.d = d;
	}
	public int getE() {
		return e;
	}
	public void setE(int e) {
		this.e = e;
	}

	public int getSum() {
		return sum;
	}

	public void setSum(int sum) {
		this.sum = sum;
	}


}

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Exam> x = new ArrayList<Exam>();
		int n = 0;

			while (sc.hasNext()) {
				n = sc.nextInt();
					if (n == 0) {
						break;
					}

					for (int i = 0; i < n; i++) {
						x.add(new Exam(sc.nextInt(), sc.nextInt(),
									   sc.nextInt(), sc.nextInt(), sc.nextInt()));
					}
				sum_rank(x);
				x.clear();
			}

		sc.close();
	}

	private static void sum_rank(ArrayList<Exam> x) {
		int max = x.get(0).getSum();
		int min = x.get(0).getSum();

			for (int i = 1; i < x.size(); i++) {
				max = Math.max(max, x.get(i).getSum());
				min = Math.min(min, x.get(i).getSum());
			}

		System.out.printf("%d %d\n", max, min);
	}

}


Measured memory_bytes: 43456
#include <iostream>

using namespace std;

int main(){
    int a;
    //aを定義
    int b;
    //を定義
    for(int i = 0; i < 7; i++){ //7日分ループさせる
        cin >> a >> b;
        //a,bの順で標準入力
        cout << a - b << endl;
        //最大気温と最低気温を引いて出力
    }
}


Measured memory_bytes: 3100
#include <stdio.h>

int main(void){
	int a[4], b[4];
	while(scanf("%d %d %d %d", a, a + 1, a + 2, a + 3) != EOF && scanf("%d %d %d %d", b, b + 1, b + 2, b + 3) != EOF){
		int i, j, hit = 0, blow = 0;
		for(i = 0; i < 4; i++){
			for(j = 0; j < 4; j++){
				if(i == j && a[i] == b[j])	hit++;
				else if(i != j && a[i] == b[j]) blow++;
			}
		}
	
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

Measured memory_bytes: 596
#include <cstdio>
#include <algorithm>
using namespace std;

const int MAXN = 5000;
const int MOD = int(1E9) + 7;

inline int add(int x, int y) {x += y; return x >= MOD ? x - MOD : x;}
inline int sub(int x, int y) {x -= y; return x < 0 ? x + MOD : x;}
inline int mul(int x, int y) {return 1LL * x * y % MOD;}

int pow_mod(int b, int p) {
	int ret = 1;
	for(int i=p;i;i>>=1,b=mul(b,b))
		if( i & 1 ) ret = mul(ret, b);
	return ret;
}

int f[MAXN + 5], g[2][MAXN + 5], N, A, B;
int main() {
	scanf("%d%d%d", &N, &A, &B);
	if( A < B ) swap(A, B);
	
	f[0] = 1;
	for(int i=1;i<A;i++) {
		f[i] = add(f[i - 1], i >= B);
		for(int j=B;i>j;j++)
			f[i] = add(f[i], f[i - j - 1]);
	}
	
	g[0][0] = g[1][0] = 1;
	for(int i=1;i<=N;i++) {
		for(int j=1;j<=i&&j<B;j++)
			g[0][i] = add(g[0][i], g[1][i - j]);
		
		if( i != 1 ) g[1][i] = add(g[1][i], g[0][i - 1]);
		for(int j=2;j<i&&j<A;j++)
			g[1][i] = add(g[1][i], mul(f[j - 2], g[0][i - j]));
		if( i < A ) g[1][i] = add(g[1][i], f[i - 1]);
	}
	
	int ans = sub(pow_mod(2, N), g[0][N]);
	for(int i=1;i<A;i++)
		ans = sub(ans, mul(f[i - 1], g[0][N - i]));
	printf("%d\n", ans);
}

Measured memory_bytes: 1728
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
long long mod = 1e9 + 7;

int main(void) {
  int n; cin >> n;
  vector<pair<pair<string, int> , int>> p(n);
  for(int i=0; i<n; i++) {
    cin >> p[i].first.first >> p[i].first.second;
    p[i].first.second *= -1;
    p[i].second = i+1;
  }
  sort(p.begin(), p.end());
  cerr << endl;
  for(int i=0; i<n; i++) {
    cout << p[i].second << endl;
  }

  return 0;
}



// EOF


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int A, B, H, M;

		A = Integer.parseInt(in.next());
		B = Integer.parseInt(in.next());
		H = Integer.parseInt(in.next());
		M = Integer.parseInt(in.next());
		double pi = Math.PI;

		double alpha = 2 * pi * H / 12 + 2 * pi * M / 720;
		double beta = 2 * pi * M / 60;

		double ans = Math.sqrt(Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * Math.cos(alpha - beta));
		System.out.println(ans);
	}
}


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

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

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0;
    String s = sc.next();
    if(n%2 == 1){
      System.out.println("No");
    } else {
    for(int i=0;i<n/2;i++){
      if(s.charAt(i) == s.charAt(n/2+i)){
        count++;
      }
    }
    if(count == n/2){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    }
 }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    pair<pair<string,int>,int> p[110];
    for(int i = 0; i < N; i++){
        int t;
        string tmp;
        cin >> tmp >> t;
        p[i] = make_pair(make_pair(tmp, -t),i);
    }
    sort(p, p+N);

    for(int i = 0; i < N; i++){
        cout << p[i].second+1 << endl;
    }

}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>

int main(){
        char ch;
        while(scanf("%c",&ch)!= EOF){
                if(islower(ch) != 0){
                        printf("%c", toupper(ch));
                }else if(isupper(ch) != 0){
                        printf("%c", ch);
                }else{
                        printf("%c",ch);
                }
        }
return 0;
}

Measured memory_bytes: 524
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    long long int n,m,a,b,c,s;
    scanf("%lld",&s);
    scanf("%lld",&a);
    s--;
    while(s--)
    {
        scanf("%lld",&b);
        {
            if(a<b)
            swap(a,b);
            m=a;n=b;
            while(b!=0)
            {
                c=a%b;
                a=b;
                b=c;
            }
            a=m/a*n;
        }
    }
    printf("%lld",a);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <queue>
#include <unistd.h>
#include <set>
#include <stack>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100

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

int MDT[N2][N2], ans;

class puzzle{
public:
  int f[N2], space, MD;
  void print(){
    for(int i = 0; i < N2; i++){
      cout << f[i] << " ";
      if((i + 1) % N == 0) cout << endl;
    }
  }
};

puzzle c;
int limit;

bool istarget(puzzle p){
  for(int i = 0; i < N2; i++){
    if(p.f[i] != i + 1) return false;
  }
  return true;
}

int getcost(puzzle p){
  int cost = 0;
  for(int i = 0; i < N2; i++){
    if(p.f[i] == N2) continue;
    cost += MDT[i][p.f[i] - 1];
  }
  return cost;
}

bool dfs(int d, int p){
  if(c.MD == 0){
    ans = d;
    return true;
  }
  /*if(istarget(c) == true){
    cout << c.MD << endl;
    cout << getcost(c) << endl;
    ans = d;
    return true;
  }*/
  if(d + c.MD > limit) return false;
  int x = c.space / N, y = c.space % N;
  for(int i = 0; i < 4; i++){
    puzzle n = c;
    int nx = x + dx[i], ny = y + dy[i];
    if(nx < 0 || nx >= N || ny < 0 || ny >= N) continue;
    if(max(i, p) - min(i, p) == 2) continue;
    //cout << p << " " << nx * N + ny << endl;
    //if(nx * N + ny == p) continue;
    c.MD -= MDT[nx * N + ny][c.f[nx * N + ny] - 1];
    c.MD += MDT[x * N + y][c.f[nx * N + ny] - 1];
    c.space = nx * N + ny;
    //cout << d << " " << c.MD << endl;
    //cout << "(" << x << "," << y << ") -> (" << nx << "," << ny << ")\n";
    swap(c.f[x * N + y], c.f[nx * N + ny]);
    //c.print();
    if(dfs(d + 1, /*x * N + y,*/ i)) return true;
    c = n;
  }
  return false;
}

void solve(){
  for(int i = 0; i < N2; i++){
    for(int j = 0; j < N2; j++){
      int li = i / N, ci = i % N, lj = j / N, cj = j % N;
      MDT[i][j] = abs(li - lj) + abs(ci - cj);
    }
  }
  puzzle in;
  for(int i = 0; i < N2; i++){
    cin >> in.f[i];
    if(in.f[i] == 0){
      in.f[i] = N2;
      in.space = i;
    }
  }
  in.MD = getcost(in);
  for(limit = in.MD; limit <= LIMIT; limit++){
    c = in;
    if(dfs(0, -100)){
      cout << ans << endl;
      return;
    }
  }
  return;
}
int main(){
  solve();
  return 0;
}



Measured memory_bytes: 3092
n = int(input())
s = input()
a = s.split(' ')
for i in range(n):
    a[i] = int(a[i])
max = 0
tot = 0
for i in range(n):
    if a[i] > max:
        max = a[i]
    tot +=a[i]
if max < tot - max: print('Yes')
else: print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
const lli mod=1e9+7;
void fast() {std::ios::sync_with_stdio(false);cin.tie(NULL);}
lli power(lli a,lli b){lli ans=1;while(b!=0){ if(b%2==1){ans*=a;ans%=mod;}b/=2;a*=a;a%=mod;} return ans;}
lli invmod(lli a,lli b) {return power(a,b-2);}
#define vi vector<int>
#define pii pair<int,int>
#define vlli vector<lli>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define sli(n) scanf("%lld",&n)
#define printi(n) printf("%d\n",n)
#define printli(n) printf("%lld\n",n)
#define all(vi) (vi.begin(),vi.end())
#define forn(i,n) for(int i=0;i<n;i++)
void print(int a[],int n){for(int i=0;i<n;i++) cout<<a[i]<<" ";}

int main()
{
    int n,k;
    si(n);si(k);

    int ans=INT_MAX;
    for(int i=0;i<=n;i++){
        ans=min(ans,(int)power(2,i) + (n-i)*k );
    }

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
long long int N;
long long int ans = 0;
int main(){
	cin >> N;
	if(N%2==1)ans=0;
	else{
		long long int d=10;
		while(N>=d){
			ans+=(N/d);
			d*=5;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
constexpr long double eps = 1e-9;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	ll n, a, b;
	scanf("%lld%lld%lld", &n, &a, &b);
	printf("%lld\n", max((b * (n - 1) + a) - (a * (n - 1) + b) + 1, 0LL));

	Please AC;
}


Measured memory_bytes: 256
#include <cstdio>

#include <algorithm>

using namespace std;

typedef long long i64;

int main() {
    i64 n, L, R;
    scanf("%lld%lld%lld", &n, &L, &R);
    if (L > R) swap(L, R);
    i64 ans = min(max(L, R) - 1, n - min(L, R));
    if ((R - L) % 2 == 0) {
        ans = min(ans, abs(R - L) / 2);
    } else {
        ans = min(ans, L + (R - L - 1) / 2);
        ans = min(ans, n - R + 1 + (R - L - 1) / 2);
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		double v, y;
		double n;
		
		while (input.hasNext()){
			v = input.nextDouble();
			y = (v * v) / 19.6;
			n = (y + 5) / 5;
			System.out.println((int)Math.ceil(n));
		}
	}
}

Measured memory_bytes: 27780
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
from collections import deque
INF = float("inf")

DX = [1, -1, 0, 0]
DY = [0, 0, 1, -1]


def solve(H: int, W: int, K: int, A: "List[str]"):

    y, x = -1, -1
    for i in range(1, H-1):
        for j in range(1, W-1):
            if A[i][j] == "S":
                y, x = i, j
                break
        if y != -1:
            break

    outer = INF
    outplace = (-1, -1)
    reachable = [[INF]*W for _ in range(H)]
    q = deque([(y, x, 0)])
    while len(q) > 0:
        y, x, d = q.popleft()

        # 到達可能な箇所で外に最も近い場所を探す
        dist = min([y, H-1-y, x, W-1-x])
        if dist < outer:
            outer = dist
            outplace = (y, x)

        if d == K:
            continue
        for dy, dx in zip(DY, DX):
            if not (0 <= y+dy < H):
                continue
            elif not (0 <= x+dx < W):
                continue
            elif A[y+dy][x+dx] == "#":
                continue
            else:
                if d+1 < reachable[y+dy][x+dx]:
                    reachable[y+dy][x+dx] = d+1
                    q.append((y+dy, x+dx, d+1))

    ans = 1 - (-outer // K)
    print(ans)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [next(tokens) for _ in range(H)]  # type: "List[str]"
    solve(H, W, K, A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 84572
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(int i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    int N;
    cin >> N;
    vector<int> h(N);
    REP(i, N) cin >> h[i];
    vector<int> dp(N, 1<<30);
    dp[0] = 0;
    for(int i=0; i<N; i++){
        if(i+1 < N) dp[i+1] = min(dp[i+1], dp[i] + abs(h[i]-h[i+1]));
        if(i+2 < N) dp[i+2] = min(dp[i+2], dp[i] + abs(h[i]-h[i+2]));
    }
    cout << dp[N-1] << endl;
    return 0;
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>>  var(n, vector<int>(m, 0))
#define vecb2(var, n, m)   vector<vector<bool>> var(n, vector<bool>(m, false))
#define vecll2(var, n, m)  vector<vector<ll>>   var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

int main(void) {
  int n, k;
  cin >> n >> k;
  arrll(a,n);
  rep(i,n-k){
    if(a[i+k] > a[i]){
      prt("Yes");
    } else {
      prt("No");
    }
  }


}


Measured memory_bytes: 4844
#include <bits/stdc++.h>
#define long long long int
using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);


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

    long res = 0;
    for (int x = k; x <= n + 1; x++) {
        long minsum = (long)x * (x - 1) / 2; //0 + 1 + .. + x - 1
        long maxsum = (long)n * x - minsum;  //n + (n - 1) + ... + (n - (x - 1));
        res += (maxsum - minsum + 1);
        res %= 1000000007;
    }
    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 3612
from functools import reduce
import copy

def gcd( x, y ):
    while y != 0:
        x, y = y, x%y
    return x

n = int(input())
a = list(map(int, input().split()))

result = 0
l = [0]*n
r = [0]*n
for i in range(n-1):
    l[i+1] = gcd(l[i],a[i])

for i in reversed(range(1, n)):
    r[i-1] = gcd(r[i], a[i])

ans = 0
for i in range(n):
    lr = gcd(l[i], r[i])
    ans = max(ans, lr)

print(ans)


Measured memory_bytes: 15212
#include <iostream>

using namespace std;

int main(void)
{
  int n, x;
  int flag;
  int i, j, k;
  while(1){
    flag = 0;
    cin >> n >> x;
    if(n+x == 0) break;
    for(i = 1; i <= n; i++){
      for(j = i+1; j <= n; j++){
	for(k = j+1; k <= n; k++){
	  if(i+j+k == x){
	    flag += 1;
	  }
	}
      }
    }
    cout << flag << '\n';
  }
}


	    
  

Measured memory_bytes: 1160
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int h,w,n;cin>>h>>w>>n;
    int u=max(h,w);
    int ans=n/u;
    if(n%u!=0)ans++;
    cout<<ans<<endl;
}


Measured memory_bytes: 892
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        int a = Read.Int();

        for (int i = 0; ; i++)
        {
            if (a < Math.Pow(2, i)) { Console.WriteLine(Math.Pow(2, Math.Max(i-1,0))); break; }
        }
        Console.ReadLine();
    }

    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b)
    {
        return a * b / gcd(a, b);
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (long i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

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

int main()
{
  int r, g;
  cin >> r >> g;
  
  // (r + x) / 2 = g
  // r + x = 2g
  // x = 2g - r
  cout << 2 * g - r << endl;
  
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n; cin >> n;
    ll res = n * (n + 1) * (n + 2) / 6;
    REP(i, n - 1){
        ll u, v; cin >> u >> v;
        if(u > v) swap(u, v);
        res -= u * (n + 1 - v);
    }
    cout << res << '\n';
}

Measured memory_bytes: 3580
#include<stdio.h>

int main(void)
{
  int a,b,c,i;
  
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  
  i=b;
  b=a;
  a=c;
  c=i;
  
  printf("%d %d %d",a,b,c);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(void) {
  
  int a, b, c, d, n, cnt;

  while(1) {
    cnt = 0;
    cin >> n;

    if (cin.eof()) break;

    for(a = 0; a < 10; a++) {
      for(b = 0; b < 10; b++){
	for(c = 0; c < 10; c++){
	  for(d = 0; d < 10; d++){
	    if (a + b + c + d == n) {
	      cnt++;
	    }
	  }
	}
      }
    }

    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 1160