akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define MOD 1000000007
#define md 998244353
#define INF LLONG_MAX
#define F first
#define S second
#define sz(x) (long long)x.size()
#define vi vector<int>
#define vll vector<long long>
#define vpl vector<pair<long long,long long> >
#define vpi vector<pair<int,int> >
#define pb push_back
#define debug(x) cerr<<#x<<"= "<<x<<endl
#define all(v) v.begin(),v.end()
#define TT ll test;cin>>test; while(test--)
#define rep(i,a,n) for(ll i=a;i<(long long)n;++i)
#define repr(i,n,a) for(ll i=n;i>(long long)a;--i)
#define endl '\n'
#define MAXN 200005
typedef long long ll;
typedef long double ld;
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll n;
    cin>>n;
    vll a(n);
    for (int i = 0; i < n; ++i)
    {
    	cin>>a[i];
    }
    vll suff(n);
    suff[n-1]=a[n-1];
    for(int i=n-2;i>=0;i--){
    	suff[i]=(suff[i+1]+a[i])%MOD;
    }
    ll res=0;
    for (int i = 0; i < n-1; ++i)
    {
    	res=(res+a[i]*suff[i+1]%MOD)%MOD;
    }
    cout<<res;

    return 0;
}

Measured memory_bytes: 6332
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

signed main(){
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

vector<list<int>> e;

int dfs(int n,int par){
  int ans=0,re;
  for(auto itr=e[n].begin();itr!=e[n].end();itr++){
    if((*itr)!=par){
      re=dfs(*itr,n);
      if(re==0) ans++;
      else if(re>1){
        ans=2;
        break;
      }
    }
  }
  return (ans>1?2:ans);
}

int main(){
  int n;
  cin >> n;
  if(n==2){
    cout << "Second" << endl;
    return 0;
  }
  e=vector<list<int>>(n);
  int a,b;
  vector<int> d(n,0);
  for(int i=0;i<n-1;i++){
    cin >> a >> b;
    e[--a].push_back(--b);
    e[b].push_back(a);
    d[a]++,d[b]++;
  }
  int num1=-1,num2;
  for(int i=0;i<n;i++){
    if(d[i]>1){
      num1=i;
      num2=num1;
    }
  }
  if(num2==-1) cout << "First" << endl;
  else cout << (dfs(num1,-1)>1||dfs(num2,-1)>1?"First":"Second") << endl;
  return 0;
}


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

struct Point{bool high; double x,y;};
bool comp(Point a,Point b) {return (a.x==b.x ? a.y<b.y : a.x<b.x);}

Point* Intersection(Point p1,Point p2,Point p3,Point p4,Point *ret=new Point()){
    double d = (p2.x-p1.x)*(p4.y-p3.y)-(p2.y-p1.y)*(p4.x-p3.x);
    double u = ((p3.x-p1.x)*(p4.y-p3.y)-(p3.y-p1.y)*(p4.x-p3.x))/d;
    double v = ((p3.x-p1.x)*(p2.y-p1.y)-(p3.y-p1.y)*(p2.x-p1.x))/d;
    if(d==0 || u<0 || u>1 || v<0 || v>1)return NULL;
    ret->x = p1.x+u*(p2.x-p1.x);
    ret->y = p1.y+u*(p2.y-p1.y);

    return ret;
}

int main(void){
    int N,n,o,l;
    cin>>N;
    while(N--){
        Point a,b;
        vector<Point> cross;
        cin>>a.x>>a.y>>b.x>>b.y>>n;
        rep(i,n){
            Point s,t;
            cin>>s.x>>s.y>>t.x>>t.y>>o>>l;

            Point *ret = Intersection(a,b,s,t);
            if(ret != NULL){
                ret->high = o==l;
                cross.push_back(*ret);
            }
        }

        sort(cross.begin(),cross.end(),comp);

        int cnt=0;
        for(int i=0;i+1<cross.size();i++){
            cnt+=(cross[i].high!=cross[i+1].high);
        }
        cout<<cnt<<endl;
    }

    return 0;
}

Measured memory_bytes: 4740
def is_unbalance(lst):
    res = False
    for x in lst:
        if lst.count(x) >= 2:
            res = True
            break
    return res

s = input()
i = 0
a, b = -1, -1
for j in 2, 1:
    while i + j < len(s):
        if is_unbalance(s[i:i + j + 1]):
            a, b = i + 1, i + j + 1
            break
        i += 1
    if (a, b) != (-1, -1):
        break
print(a, b)

Measured memory_bytes: 3188
/**
 * Created by hiramekun at 22:39 on 2019-08-27.
 */
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(obj) (obj).begin(), (obj).end()

int main() {
    ll x, y, z, k;
    cin >> x >> y >> z >> k;
    vl a(x), b(y), c(z);
    rep(i, x) cin >> a[i];
    rep(i, y) cin >> b[i];
    rep(i, z) cin >> c[i];

    sort(all(a), greater<>()), sort(all(b), greater<>()), sort(all(c), greater<>());

    auto solve = [&](ll p) -> bool {
        ll cnt = 0;
        rep(i, x) { // ここは最大でK回ループがまわる
            rep(j, y) { // ここから下は最大でK回ループがまわる
                rep(l, z) {
                    ll val = a[i] + b[j] + c[l];
                    if (val < p) break;
                    if (++cnt >= k) {
                        return true;
                    }
                }
            }
        }
        return false;
    };

    ll s = -1, e = a[0] + b[0] + c[0] + 1;
    while (e - s > 1) {
        ll mid = (s + e) / 2;
        if (solve(mid)) s = mid;
        else e = mid;
    }
    vl ans;
    rep(i, x) {
        rep(j, y) {
            rep(l, z) {
                ll val = a[i] + b[j] + c[l];
                if (val < s + 1) break;
                ans.emplace_back(val);
            }
        }
    }
    while (ans.size() < k) ans.emplace_back(s);
    sort(all(ans), greater<>());
    for (auto val: ans) cout << val << '\n';
    return 0;
}



Measured memory_bytes: 384
L = []
L.append(input())

if L[0] == 'SSS':
	print(0)
elif L[0] == 'RRR':
	print(3)
elif L[0] == 'SSR' or L[0] == 'SRS':
	print(1)
elif L[0] =='RSS':
	print(1)
elif L[0] == 'SRR' or L[0] == 'RRS':
	print(2)
elif L[0] == 'RSR':
	print(1)


Measured memory_bytes: 9052
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(ll i=0;i<x;i++)
#define rep1(i,x) for(ll i=1;i<=x;i++)
#define rrep(i,x) for(ll i=x-1;i>=0;i--)
#define rrep1(i,x) for(ll i=x;i>0;i--)

ll n;
ll cnt=0;
ll bar[101][4];

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

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

ll dp[101];
ll rec(ll x){
	if(dp[x]!=-1) return dp[x];
	ll l=rec(bar[x][2]);
	ll r=rec(bar[x][3]);
	dp[x]=((l*bar[x][0])/gcd(l*bar[x][0],r*bar[x][1]))*r+((r*bar[x][1])/gcd(r*bar[x][1],l*bar[x][0]))*l;
	//ll tmp = lcm(l*bar[x][0],r*bar[x][1]);
	//dp[x] = tmp / bar[x][0] + tmp / bar[x][1];
	return dp[x];
}

int main()
{while(1){
	ll ans=0;
	cnt=0;
	rep(i,101) dp[i]=-1;
	dp[0]=1;
	cin>>n;
	if(!n) return 0;
	rep1(i,n){
		rep(j,4) cin>>bar[i][j];
		ll div=gcd(bar[i][0],bar[i][1]);
		bar[i][0]/=div;
		bar[i][1]/=div;
	}
	rep1(i,n){
		ans=max(ans,rec(i));
	}
	printf("%lld\n",ans);
}}

Measured memory_bytes: 3044
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

// Returns n divisors ORDER BY ASC.
vector<i64> getDivisors(i64 n) // {{{
{
    vector<i64> ret;
    i64 i = 1;
    for (i = 1; i * i < n; ++i) {
        if (n % i == 0) {
            ret.emplace_back(i);
            ret.emplace_back(n / i);
        }
    }
    if (i * i == n) ret.emplace_back(i);
    sort(begin(ret), end(ret));
    return ret;
} // }}}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    var(i64, N, K);
    vector<i64> a(N);
    read(a);

    const i64 S = accumulate(all(a), 0LL);
    const auto divisors = getDivisors(S);

    vector<i64> m(N);
    for (const i64 g : Rev<decltype(divisors)>(divisors)) {
        rep(i, 0, N) m[i] = a[i] % g;
        sort(all(m));

        i64 rsum = 0;
        rep(i, 0, N) rsum += g - m[i];

        bool ok = false;
        i64 lsum = 0;
        rep(i, 0, N) {
            lsum += m[i];
            rsum -= g - m[i];
            ok |= lsum == rsum && lsum <= K && rsum <= K;
        }

        if (ok) {
            print(g);
            return 0;
        }
    }

    return 0;
}


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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define up(x, v) upper_bound(all(x), v)
#define low(x, v) lower_bound(all(x), v)
#define bin(x, v) binary_search(all(x), v)
#define FOR(k, a, b) for(int k = (a); k < (b); ++k)
#define ROF(k, a, b) for(int k = (a); k > (b); --k)
#define pq priority_queue

#define EPS 1.0e-9

#define X real()
#define Y imag()

typedef long long ll;
typedef unsigned long long ull;

using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using point = pair<double, double>;
using Vector = complex<double>;

int main() {

	int n;
	map<string, int> F;
	
	ios_base :: sync_with_stdio(false);
	cin.tie(nullptr);

	cin >> n;
	
	vector<string> votes(n);
	int max_votes = 0;

	FOR(k, 0, n) {

		cin >> votes[k];
		max_votes = max(max_votes, ++F[votes[k]]);
	}
	
	for(pair<string, int> v : F) {

		if(v.y == max_votes)
			cout << v.x << '\n';
	}

    return 0;
}

Measured memory_bytes: 25472
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };



int main() {
	ll x;
	cin >> x;
	for (int i = 0;; i++) {
		for (int j = 0;j<=i; j++) {
			if (pow(i, 5) + pow(j, 5)==x) {
				j *= -1;
				cout << i << " " << j << endl;
				return 0;
			}
			if (pow(i, 5) - pow(j, 5) == x) {
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 4064
// Aizu 2252: koukyoukoukokukikou
// 2017.9.22 bal4u@uu

#include <stdio.h>

char lh[] = "qwertasdfgzxcvb";
char rh[] = "yuiophjklnm";
char tr[128];

int main(void)
{
	int ans;
	char s[40], *p, *q;

	p = lh; while (*p) tr[*p++] = 1;
	p = rh; while (*p) tr[*p++] = 2;
	while (scanf("%s", s) && *s != '#') {
		ans = 0, q = s, p = q + 1;
		while (*p) { if (tr[*p] != tr[*q]) ans++; p++, q++; }
		printf("%d\n", ans);
	}
	return 0;
}

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

using namespace std;

int main()
{
    string Days [7] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string s;
    int Remaining_days = 0;
    cin>>s ;
    for (int i =0 ;i <7; i++){
        if (s == Days[i]){
            Remaining_days = 7- i ;

        }
    }
    cout << Remaining_days << endl;



    return 0;
}


Measured memory_bytes: 256
import collections, itertools
N = int(input())
mod = 10**9 + 7
# cd = collections.defaultdict
# dp = cd(lambda: cd(lambda: cd(lambda: cd(int))))
dp = [[[[0 for _ in range(4)] for _ in range(4)] for _ in range(4)]
      for _ in range(N + 1)]
dp[0][3][3][3] = 1
count = 0
for i in range(N):
    for c0, c1, c2, c3 in itertools.product(range(4), repeat=4):
        A1 = [c1, c2, c3]
        A2 = [c0, c2, c3]
        A3 = [c0, c1, c3]
        if A1 in [[0, 1, 2], [1, 0, 2], [0, 2, 1]] or [0, 1, 2] in [A2, A3]:
            continue
        dp[i + 1][c1][c2][c3] += dp[i][c0][c1][c2]
        dp[i + 1][c1][c2][c3] %= mod
        if i == N - 1:
            count += dp[i][c0][c1][c2]
            count %= mod
print(count)
# https://www.youtube.com/watch?v=w2AEXSloYk8


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

int main() {
    string s;
    cin >> s;
    
    int max = 0, cnt = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s.at(i) == 'A' || s.at(i) == 'C' || s.at(i) == 'G' || s.at(i) == 'T') {
            cnt++;
            if (cnt > max) max = cnt;
        } else {
            cnt = 0;
        }
    }

    cout << max << endl;

    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
const int N = 100005;

int n, lim, ans, dt[N];

vector<int> adj[N], arr;

bool can (int C, int P) {
	for(auto &T : adj[C]) {
		if(T == P) continue;
		if(!can(T, C)) return false;
	}
	arr.clear();
	for(auto &T : adj[C]) {
		if(T == P) continue;
		if(dt[T]+1 > lim) return false;
		arr.push_back(dt[T]+1);
	}
	sort(arr.begin(), arr.end());
	int N = arr.size();
	if(N % 2 == 0) {
		bool F = false;
		for(int i=0;i<N/2;i++) {
			if(arr[i] + arr[N-1-i] > lim) F = true;
		}
		if(!F) {dt[C] = 0; return true;}
		arr.pop_back(); N--;
	}
	int S = 0, E = N;
	while(S<E) {
		int M = (S+E)/2, L = 0, R = N-1;
		bool F = false;
		while(1) {
			if(L == M) L++;
			if(R == M) R--;
			if(L >= R) break;
			if(arr[L] + arr[R] > lim) {F = true; break;}
			L++; R--;
		}
		F ? S = M+1 : E = M;
	}
	if(S == N) return false;
	dt[C] = arr[S];
	return true;
}

bool can () {
	if(!can(1, 0)) return false;
	return (adj[1].size() % 2 || dt[1] == 0);
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++) {
		int A, B;
		scanf("%d%d",&A,&B);
		adj[A].push_back(B);
		adj[B].push_back(A);
	}
	ans = n-1;
	for(int i=1;i<=n;i++) {
		ans -= (int)adj[i].size() / 2;
	}
	printf("%d ",ans);
	int S = 0, E = n;
	while(S<E) {
		lim = (S+E)/2;
		can() ? E = lim : S = lim+1;
	}
	printf("%d\n",S);
}


Measured memory_bytes: 14080
#include <iostream>
#include <vector>

using namespace std;

int N;
int K;
int QMax;
int QMin;
vector<int> vec;

bool Feasible()
{
    int TrackNum = 1;
    int TotalWeight = 0;
    
    for(int i = 0; i < N; ++i)
    {
        if(vec[i] > QMax)
            return false;
            
        if(TotalWeight + vec[i] > QMax)
        {
            TotalWeight = 0;
            TrackNum += 1;
        }
        TotalWeight += vec[i];
    }
    
    if(TrackNum <= K)
        return true;
    else 
        return false;
}

int main()
{
    cin >> N >> K;
    vec.reserve(N);
    
    QMax = 0;
    
    for(int i = 0; i < N; ++i)
    {
        int tmp; cin >> tmp;
        vec.push_back(tmp);
        QMax += tmp;
    }
    
    int left = 0, right = QMax;
    int mid ;
    
    while(left <= right)
    {
        mid = (left + right) / 2;
        QMax = mid;
        
        if(Feasible())
        {
            QMin = mid;
            right = mid - 1;
        }
        else
        {
            left = mid + 1;
        }
          
    }
    
    cout << QMin << endl;
    
    return 0;
}


Measured memory_bytes: 3136
#include <algorithm>
#include <climits>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>

#define mset(a,x,n) memset(a,x,(n)*sizeof(*(a)))

using std::min;
using std::priority_queue;
using std::vector;

const int MAXV=305;
int n,L;

struct Edge{
	int to,w;
	Edge(int _to=0,int _w=0):to(_to),w(_w){}
};
vector<Edge> G[MAXV];

struct State{
	int id,ans,fuel;
	State(int _id=0,int _ans=0,int _fuel=0):id(_id),ans(_ans),fuel(_fuel){}
	bool operator <(const State &that)const{
		if(ans==that.ans) return fuel<that.fuel;
		else return ans>that.ans;
	}
}ans[MAXV][MAXV];

inline void Dijkstra(int s,State ans[]){
	static bool use[MAXV];
	mset(use+1,false,n);
	for(int i=1;i<=n;++i)
		ans[i]=State(i,INT_MAX,0);
	ans[s]=State(s,0,L);
	priority_queue<State> pq;
	pq.push(ans[s]);
	while(pq.size()){
		State u=pq.top();
		pq.pop();
		if(use[u.id]) continue;
		use[u.id]=true;
		for(auto &v:G[u.id]){
			if(u.fuel>=v.w){
				State sta(v.to,u.ans,u.fuel-v.w);
				if(ans[sta.id]<sta){
					ans[sta.id]=sta;
					pq.push(sta);
				}
			}
			if(L>=v.w){
				State sta(v.to,u.ans+1,L-v.w);
				if(ans[sta.id]<sta){
					ans[sta.id]=sta;
					pq.push(sta);
				}
			}
		}
	}
}

inline void solve(){
	for(int i=1;i<=n;++i)
		Dijkstra(i,ans[i]);
}

int main(){
	int m;
	scanf("%d%d%d",&n,&m,&L);
	for(int i=1,u,v,w;i<=m;++i){
		scanf("%d%d%d",&u,&v,&w);
		G[u].push_back(Edge(v,w));
		G[v].push_back(Edge(u,w));
	}
	solve();
	int q;
	scanf("%d",&q);
	for(int i=1,u,v;i<=q;++i){
		scanf("%d%d",&u,&v);
		printf("%d\n",ans[u][v].ans==INT_MAX ? -1:ans[u][v].ans);
	}
	return 0;
}

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

int main()
{
	string s;
	cin>>s;
	int countc=0,daxie=1;
	int i;
	if(s[0]!='A')
	{
		cout<<"WA";
		return 0;
	}
	for(i=0; i<s.length(); i++)
	{
		if(i>=2&&i<=s.length()-2)
		{
			if(s[i]=='C') countc++;
		}
		if(i>=1&&i<=s.length()-1)
		{
			if(s[i]>='A'&&s[i]<='Z'&&s[i]!='C')
				daxie=0;
		}
	}
	if(countc!=1)
	{
		cout<<"WA";
		return 0;
	}
	if(daxie==0)
	{
		cout<<"WA";
		return 0;
	}
	cout<<"AC";
	
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>
#include <math.h>

#define nl '\n'

using namespace std;

int n;
char c;

int main(){

    cin >> n;

    set<char> s;

    for(int i = 0; i < n; i++){
        cin >> c;
        s.insert(c);
    }

    if(s.size() == 4){
        cout << "Four";
    } else{
        cout << "Three";
    }





}

//g++ -std=c++14 comp.cpp -o b; ./b.exealso

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    vector<vector<T>>(h,vector<T>(w))
#define VVI(T,h,w,i) vector<vector<T>>(h,vector<T>(w,i))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
    ll n = in();
    vector<ll>a(n);
    ll micn = 0;
    REP(i, n) {
        ll foo = in();
        if (foo < 0)++micn;
        a[i] = foo;
    }
    sort(ALL(a), [](ll a, ll b) {return abs(a) < abs(b); });
    ll sum = 0;
    REP(i, n)sum += abs(a[i]);
    if (micn % 2 == 0) {
        cout << sum << endl;
    } else {
        cout << sum - abs(a[0]) * 2 << endl;
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int m,n;
int Min=0x3f3f3f3f;
int x;
int main(){
cin>>m>>n;
for(int i=1;i<=m;i++){
cin>>x;
n-=x;
Min=min(Min,x);
}
cout<<n/Min+m;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cassert>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <type_traits>
#include <fstream>
//#include <bits/stdc++.h>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// print(x, y, z);
// printVec(va.begin(), va.end());
void print(){ std::cout << std::endl; }
template <typename Head> void print(Head&& head) { std::cout << head << std::endl; }
template <typename Head, typename... Tail> void print(Head&& head, Tail&&... tail)
{
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...); // or print(tail...);
}
template<typename Iterator> void printVec(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << it - begin << "] " << *it << " ";
    if ((it - begin) % 20 == 19 || it == end - 1) { std::cout << std::endl; }
  }
}
template<typename Iterator> void printVecPair(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << it - begin << "] " << it->first << " " << it->second << " ";
    if ((it - begin) % 10 == 9 || it == end - 1) std::cout << std::endl;
  }
}

template<typename T> T bitnum(T x)
{
  T cnt = 1;
  T ret = 0;
  while (x > 0) {
    ret += (x % 2) * cnt;
    x /= 2;
    cnt *= 10;
  }
  return ret;
}

template<typename T> T lminimum(const std::vector< T >& v) {return *std::min_element(v.begin(), v.end());}
template<typename T> T lmaximum(const std::vector< T >& v) {return *std::max_element(v.begin(), v.end());}
template<typename T> void lunique(std::vector< T >& v) {v.erase(std::unique(v.begin(), v.end()), v.end());}
template<typename T> void lsort(std::vector< T >& v) {std::sort(v.begin(), v.end());}
template<typename T> void lgreatersort(std::vector< T >& v) {std::sort(v.begin(), v.end(), std::greater<>());}
template<typename T> bool lnext_permutation(std::vector< T >& v) {return std::next_permutation(v.begin(), v.end());}

int main(int argc, char* argv[])
{
  ll N, M;
  std::cin >> N >> M;

  std::vector< std::pair<ll, ll> > vp(N);
  std::map< ll, ll > MM;
  for (ll i = 0; i < N; i++) {
    ll a, b;
    std::cin >> a >> b;
    vp[i] = std::make_pair(a, i);
    MM[i] = b;
  }
  std::sort(vp.begin(), vp.end());

  ll ans = 0LL;
  ll num = M;
  for (ll i = 0; i < N; i++) {
    ans += vp[i].first * std::min(num, MM[vp[i].second]);
    num -= std::min(num, MM[vp[i].second]);
    if (num <= 0) {
      break;
    }
  }

  print(ans);
  return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + (ll)b) % mod
#define MUL(a, b) a = (a * (ll)b) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rer(i, a, b) for(int i = a - 1; i >= b; i--)
#define all(a) (a).begin(), (a).end()
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef pair<int, pi> ppi;
typedef vector<ll> vec;

const int MAX_N = 200010;
const double eps = 1e-6;
const ll mod = 1000000007;
const ll inf = 1LL << 59;

void Debug() {cout << '\n'; }

template<class FIRST, class... REST> 
void Debug(FIRST arg, REST... rest) { cout << arg << " "; Debug(rest...); }

template<class T>
ostream& operator<< (ostream& out, const vector<T>& v) {
	out << "[";
	if(!v.empty()) {
		rep(i, 0, (int)v.size() - 1) out << v[i] << ", ";
		out << v.back();
	}
	out << "]";
  return out;
}

template<class S, class T>
ostream& operator<< (ostream& out, const pair<S, T>& v) {
	out << "(" << v.first << ", " << v.second << ")";
	return out;
}

///g++ -g3 -std=c++0x -DLOCAL -Wall -ftrapv -D_GLIBCXX_DEBUG -Wl,-stack,268435456 -o
///g++ -O2 -std=c++0x -DLOCAL -Wall -Wl,-stack,268435456 -o

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

int N;
int A[MAX_N];

void solve() {
	cin >> N;
	for(int i = 0; i < N; i++) {
		int a; cin >> a;
		A[a - 1]++;
	}
	int odd = 0, even = 0;
	for(int i = 0; i < 100000; i++) {
		if(A[i]) {
			if(A[i] % 2) odd++;
			else even++;
		}
	}
	cout << odd + ((even % 2 == 0) ? even : even - 1) << "\n";
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(0);	
    cout << fixed;
	cout.precision(20);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 640
N, M = map(int, input().split())
G = [[] for _ in range(N)]
in_G = [0] * N

for i in range(M):
    x, y = map(int, input().split())
    G[x-1].append(y-1)
    in_G[y-1] += 1

dist = [0] * N
q = [x for x in range(N) if in_G[x] == 0]

while q:
    v = q.pop()

    for g in G[v]:
        dist[g] = max(dist[g], dist[v] + 1)
        in_G[g] -= 1
        if in_G[g] == 0:
            q.append(g)

print(max(dist))

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

// #define DEBUG

using namespace std;

const int N = 2e5+7;
const int MOD = 1e9+7;

template <int _MOD> struct Mint
{
    int v = 0;
    Mint() {}
    Mint(int _v) : v((_v%_MOD+_MOD)%_MOD) {}
    Mint(long long _v) : v(static_cast<int>((_v%_MOD+_MOD)%_MOD)) {}
    Mint operator = (const int _v) { this->v = _v; return *this; }
    Mint operator = (const long long _v) { this->v = static_cast<int>(_v%_MOD); return *this; }
    bool operator < (const Mint &b) const { return v < b.v; }
    bool operator > (const Mint &b) const { return v > b.v; }
    bool operator == (const Mint &b) const { return v == b.v; }
    bool operator != (const Mint &b) const { return v != b.v; }
    bool operator <= (const Mint &b) const { return v < b.v || v == b.v; }
    bool operator >= (const Mint &b) const { return v > b.v || v == b.v; }
    Mint operator + (const Mint &b) { return Mint(v+b.v); }
    Mint operator - (const Mint &b) { return Mint(v-b.v); }
    Mint operator * (const Mint &b) { return Mint(1ll*v*b.v); }
    Mint operator / (const Mint &b) { return Mint(b.inv()*v); }
    Mint operator += (const Mint &b) { return *this = *this+b; }
    Mint operator -= (const Mint &b) { return *this = *this-b; }
    Mint operator *= (const Mint &b) { return *this = *this*b; }
    Mint operator /= (const Mint &b) { return *this = *this/b; }
    Mint pow(int p) const {
        Mint res(1), x(*this);
        while (p) {
            if (p&1) res = res*x;
            x *= x;
            p >>= 1;
        }
        return res;
    }
    Mint inv() const { return pow(_MOD-2); }
    friend istream& operator >> (istream &is, Mint &mt) { return is >> mt.v; }
    friend ostream& operator << (ostream &os, const Mint &mt) { return os << mt.v; }
};
using mint = Mint<MOD>;

int n;
mint pow2[N];
vector<int> e[N], son[N];

int dfs(int u, int fa)
{
    int fi = -1, sum = 0;
    for (int i = 0, v; i < (int)e[u].size(); ++i) {
        v = e[u][i];
        if (v == fa) {
            fi = i;
            continue;
        }
        son[u][i] = dfs(v, u);
        sum += son[u][i];
    }
    if (fi != -1) son[u][fi] = n-1-sum;
    return sum+1;
}

int main()
{
    cin >> n;
    for (int i = 1, u, v; i < n; ++i) {
        cin >> u >> v;
        e[u].emplace_back(v);
        e[v].emplace_back(u);
    }
    pow2[0] = 1;
    for (int i = 1; i <= n; ++i) {
        son[i].resize(e[i].size(), 0);
        pow2[i] = pow2[i-1]*2;
    }
    dfs(1, 0);
    mint res = 0;
#ifdef DEBUG
    for (int i = 1; i <= n; ++i) {
        for (int j : son[i]) cout << j << " ";
        cout << endl;
    }
#endif
    for (int i = 1; i <= n; ++i) {
        mint mul = 1;
        /*
        for (int j = 0; j < (int)son[i].size(); ++j) {
            mul *= son[i][j];
            res -= son[i][j];
        }
        */
        for (int j : son[i]) {
            mul *= pow2[j];
            res -= pow2[j];
        }
        res += mul+(int)son[i].size()-1;
    }
    cout << res/pow2[n] << endl;
    return 0;
}

Measured memory_bytes: 36224
let () =
  let rec tsurukame x y z =
    if y < 0 || x * 4 + y * 2 > z then "No "
    else if x * 4 + y * 2 = z then "Yes "
    else tsurukame (x+1) (y-1) z in
  Scanf.scanf "%d %d\n" @@ fun x y ->
  Printf.printf "%s\n" (tsurukame 0 x y)

Measured memory_bytes: 3692
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#include<functional>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.20f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define cotu cout
#define Endl endl
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll N; cin >> N;
    ll tmp1 = 1;
    ll tmp2 = 1;
    ll tmp3 = 1;
    rep(i,0,N){
        tmp1 *= 10;
        tmp1 %= MOD;
        tmp2 *= 8;
        tmp2 %= MOD;
        tmp3 *= 9;
        tmp3 %= MOD;
    }

    ll tmp = ((tmp1 + tmp2 - 2*tmp3) % MOD + MOD) % MOD;

    cout << tmp << endl; 
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <stack>
#include <algorithm>
#include <string>

using namespace std;
stack<int> st;

int main(void){
  string s;
  while(cin>>s){
    if (!s.compare("*")||!s.compare("+")||!s.compare("-")){
      int p1=st.top();
      st.pop();
      int p2=st.top();
      st.pop();
      if (!s.compare("*"))
	st.push(p1*p2);
      else if (!s.compare("+"))
	st.push(p1+p2);
      else
	st.push(p2-p1);
    }else{
      st.push(stoi(s));
    }
  }
  cout<<st.top()<<endl;
  return 0;
}
      



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

using namespace std;

typedef  pair < int , pair<int , int> > PP;

template<typename T>
class UF
{
public:
	UF ()
	{
		count = 0;
	}

	void push ( T a )
	{
		M[a] = count;
		V.push_back ( count );
		rank.push_back ( 0 );
		count++;
	}

	void unite ( T a , T b )
	{
		long long int x = find ( M[a] );
		long long int y = find ( M[b] );
		if( x == y )return;
		if( rank[x] < rank[y] )
		{
			V[x] = y;
		} else
		{
			V[y] = x;
			if( rank[x] == rank[y] )rank[x]++;
		}
	}
	void merge ( T a , T b )
	{
		unite ( a , b );
	}
	bool same ( T a , T b )
	{
		return find ( M[a] ) == find ( M[b] );
	}
	long long int group ()
	{
		set<long long int>S;
		for( long long int i = 0; i < V.size (); i++ )
		{
			S.insert ( find ( V[i] ) );
		}
		return S.size ();
	}

private:
	vector<long long int> V , rank;
	map < T , long long int>M;
	long long int count;

	long long int find ( long long int x )
	{
		if( V[x] == x )return x;
		else return V[x] = find ( V[x] );
	}
};

int main ()
{
	int N , M;
	while( cin >> N , N )
	{
		cin >> M;
		priority_queue < PP , vector<PP> , greater<PP>>que;
		UF<int> uf;
		for( size_t i = 0; i < N; i++ )
		{
			uf.push ( i );
		}
		for( size_t i = 0; i < M; i++ )
		{
			char x;
			int a , b , c;
			cin >> a >> x >> b >> x >> c;
			que.push ( PP ( c , pair<int , int> ( a , b ) ) );
		}
		int count = 0;
		while( que.size () )
		{
			PP now = que.top (); que.pop ();
			if( uf.same ( now.second.first , now.second.second ) )continue;
			uf.merge ( now.second.first , now.second.second );
			count += now.first / 100 - 1;

		}
		cout << count << endl;
	}
}

Measured memory_bytes: 1352
#include <bits/stdc++.h>
using namespace std;
#define ld double
#define ll long long
#define pb emplace_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) x.begin(),x.end()
ll power(ll a, ll b) {ll res = 1; a = a % mod; while (b) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b /= 2;} return res;}
ll invmod(ll a) {return power(a, mod - 2);}
int main(void)
{
	FIO
	int t = 1;
	// cin >> t;
	while (t--)
	{
		string s;
		cin >> s;
		if (s[2] == s[3] && s[4] == s[5]) {
			cout << "Yes\n";
		}
		else cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
using namespace std;
int f(int n) {
	int r = 0;
	while (n != 0) {
		r += n % 10;
		n /= 10;
	}
	return r;
}
int main() {
	int n, a, b; cin >> n >> a >> b;
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		int p = f(i);
		if (a <= p&&p <= b)ans += i;
	}
	cout << ans << endl;
}

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

int main()
{
    long long int a,b,c,d,arr[4],ans;
    std::cin>>a>>b>>c>>d;
    arr[0] = a*c;
    arr[1] = a*d;
    arr[2] = b*c;
    arr[3] = b*d;
    ans = *std::max_element(arr,arr+4);
    std::cout<<ans<<std::endl;
}


Measured memory_bytes: 3172
using System;
using System.Linq;

namespace ABC078_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine((N[0] - N[2]) / (N[1] + N[2]));
        }
    }
}


Measured memory_bytes: 13268
ROLL_MASTER = (
    (0, 1, 2, 3, 4, 5), (1, 0, 3, 2, 5, 4), (2, 0, 1, 4, 5, 3),
    (3, 0, 4, 1, 5, 2), (4, 0, 2, 3, 5, 1), (5, 1, 3, 2, 4, 0))
TWIST_MASTER = (0, 2, 4, 1, 3, 5)


def roll(dice, top):
    return tuple(dice[i] for i in ROLL_MASTER[top])


def twist(dice):
    return tuple(dice[i] for i in TWIST_MASTER)


def twist_check(d1, d2):
    if d1[0] != d2[0] or d1[5] != d2[5]:
        return False
    for _ in range(4):
        if d1 == d2:
            return True
        d2 = twist(d2)
    return False


def equal_check(d1, d2):
    for i in range(6):
        if twist_check(d1, roll(d2, i)):
            return True
    return False


def differs_all():
    n, d1, dset = int(input()), tuple(map(int, input().split())), set()
    dset.add(d1)

    for _ in range(n - 1):
        d2 = tuple(map(int, input().split()))
        for d1 in dset:
            if equal_check(d1, d2):
                return False
        dset.add(d2)
    return True


print('Yes' if differs_all() else 'No')

Measured memory_bytes: 7916
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#define MOD_P 1000000007
#define ll long long
using namespace std;



int main()
{
	int n;
	cin >> n;
	vector<int> ar(n);
	vector<int> left(n);
	vector<int> right(n);

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

	left[0] = 0;
	right[0] = 0;


	for (int i = 1; i < n; i++) {
		left[i] = (left[i - 1] > ar[i - 1] ? left[i - 1] : ar[i - 1]);
		right[i] = (right[i - 1] > ar[n - i] ? right[i - 1] : ar[n - i]);
	}

	for (int i = 0; i < n; i++) {
		printf("%d\n", left[i] > right[n - i - 1] ? left[i] : right[n - i - 1]);
	}


	return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int N, W, H;
  cin >> N >> W >> H;
  cout << (N - W + 1) * (N - H + 1)<< endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<long long> a(n),b;
	
	for(int i=0;i<n;i++){
		cin >> a[i];
		if(i>=1){
			if(a[i]-a[i-1]!=0){
				b.push_back(a[i]-a[i-1]);
			}	
		}
	}
	
	if(n==1){
		cout << 1 << endl;
		return 0;
	}
	
	int cnt=0;
	for(int i=0;i<b.size()-1;i++){
		if(b[i]>0 && b[i+1]<0 || b[i]<0 && b[i+1]>0){
			cnt++;
			i++;
		}
	}
	
	cout << cnt+1 << endl;
	
	return 0;
}



Measured memory_bytes: 2168
n,m,k = map(int,input().split())
a = [0]+list(map(int,input().split()))
b = [0]+list(map(int,input().split()))
s = [0]*(n+1)
t = [0]*(m+1)
x = 0
for i in range(n+1):
    s[i] += x + a[i]
    x = s[i]
if(s[-1] <= k):
    p = n
else:
    for i in range(n+1):
        if(s[i] >= k):
            p = i
            break
x = 0
for i in range(m+1):
    t[i] += x + b[i]
    x = t[i]
if(t[-1] <= k):
    p = min(p,m)
else:
    for i in range(m+1):
        if(t[i] >= k):
            p = max(p,i)
            break
#print(s,t)
while(1):
    f = 0
    for j in range(p-min(p,m),min(p,n)+1):
        #print(j,p-j)
        if(s[j]+t[p-j] <= k):
            #print(j,x-j)
                f = 1
                break
    if(f == 0):
        break
    p += 1
print(p-1)

Measured memory_bytes: 119640
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

ll ans=1;

int main(){
	ll mod = 1e9+7;
	ll n;
	cin >> n;
	arep(1,i,n+1){
		ans*=i;
		ans%=mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3536
#include <iostream>
using namespace std;
int main(){
  int a;
  int h;
  int m;
  int s;
  cin>>a;
  h=a/3600;
  m=(a-h*3600)/60;  
  s=(a-h*3600)-m*60;
  cout<<h<<":"<<m<<":"<<s<<endl;

}


Measured memory_bytes: 3108
#include <stdio.h>
     
    int power(int,int);
     
    int power(int a, int b){
        int i, w=1;
        for(i=0; i<b; i++) w *= a;
        return w;
    }
     
    int main(void){
        int D, N;
        scanf("%d %d", &D, &N);
        if(N==100) N++;
        printf("%d\n", power(100, D) * N);
        return 0;
    }


Measured memory_bytes: 128
import java.sql.Array;
import java.util.*;
public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<String, Integer> map = new HashMap<>();
		for (int i = 0; i < N; i++) {
			String S = sc.next();
			if(!map.containsKey(S)){
				map.put(S, 1);
			}else{
				map.put(S,map.get(S)+1);
			}
		}
		int cnt = 0;
		for (String key : map.keySet()) {
			if (cnt<map.get(key)) {
				cnt = map.get(key);
			}
		}
		ArrayList<String> list = new ArrayList<>();
		for (String key : map.keySet()) {
			if (cnt==map.get(key)) {
				list.add(key);
			}
		}
		Collections.sort(list);
		for (String string : list) {
			System.out.println(string);
		}
		sc.close();
    }	
		
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ordered_set tree<ll int, null_type,less<ll int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005

int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
    	ll i,j,k,l,m,n;
    	ll a,b;
    	cin>>a>>b;
    	// ll l1,r1,l2,r2;
    	for(i=1;i<=100000;i++)
    	{
    		ll x=0.08*i;
    		ll y=0.1*i;
    		if(x==a&&y==b)
    		{
    			cout<<i;
    			return 0;
    		}
    	}
    	cout<<-1;
    }
    return 0;
}

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

int main(){
    int a , b; cin >> a >> b;
    
    cout << a / b; cout << ' ';
    
    cout << a % b; cout << ' ';
    
    printf("%.5f" , (double)a / b );
    
    return 0;
}


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

#define pb push_back

vector<int>g[100003];
vector<int>v(100003);
queue<int>q;

int main()
{
    double a,b,c,d;
    cin>>a>>b>>c>>d;
    int e = ceil(c/b);
    int f = ceil(a/d);
    //cout<<e<<" "<<f<<endl;
    if(e<=f)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}






Measured memory_bytes: 6012
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)

/* exchange */
#define chmin(a, b) (a) = min((ll)(a), (ll)(b))
#define chmax(a, b) (a) = max((ll)(a), (ll)(b))

/* output */
#define I(x) cin >> x;
#define D(x) cerr << (x) << " ";
#define BR cerr << "\n";
#define P(x) cout << (x) << endl;
#define FIX cout << fixed << setprecision(10);

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll modPow(ll x, ll y) {
  if (y == 0) return 1;
  if (y == 1) return x;
  if (y % 2 == 0) return modPow((x * x) % MOD, y / 2);
  else return (x * modPow((x * x) % MOD, y / 2)) % MOD;
}

ll N = 0;
ll H, W, K;
ll ret = 0;
ll black = 0;
vector<vector<char>> mat(6, vector<char>(6));
vl r(6, 0);
vl c(6, 0);

ll countBlack(ll row, ll col) {
  ll cnt = 0;
  REP(i, H) {
    if (((row >> i) & 1) == 1) {
      cnt += r[i];
    }
  }
  REP(j, W) {
    if (((col >> j) & 1) == 1) {
      cnt += c[j];
    }
  }
  REP(i, H) {
    REP(j, W) {
      if (((row >> i) & 1) == 1 && ((col >> j) & 1) == 1) {
        if (mat[i][j] == '#') cnt--;
      }
    }
  }
  return cnt;
}

int main(void){
  
  I(H);
  I(W);
  I(K);
  REP(i, H) {
    REP(j, W) {
      I(mat[i][j]);
      if (mat[i][j] == '#') {
        r[i]++;
        c[j]++;
        black++;
      }
    }
  }

  FOR(i, 0, modPow(2, H)) {
    FOR(j, 0, modPow(2, W)) {
      ll del = countBlack(i, j);
      // D(i);
      // D(j);
      // D(black - del);
      // BR;
      if (black - del == K) ret++;
    }
  }

  P(ret);

}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int n;cin>>n;
	vector<vector<pair<string,int>>> v(12);
	v[1].pb(mp("a",0));
	for(int i = 2; i <= 10; i++) {
		for(int j = 0; j < v[i - 1].size(); j++) {
			for(int k = 0; k <= (v[i - 1][j].sc + 1); k++) {
				v[i].pb(mp(v[i - 1][j].fs + (char)('a' + k),max(v[i - 1][j].sc,k)));
			}
		}
	}
	for(int i = 0; i < v[n].size(); i++) {
		cout << v[n][i].fs << endl;
	}
	return 0;
}

Measured memory_bytes: 10736
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)

int a[3005][3005];
ll dp[3005][3005][4];

int main() {
  int R, C, n;
  cin >> R >> C >> n;
  rep(i,n) {
    int r, c, v;
    cin >> r >> c >> v;
    a[r-1][c-1] = v;
  }

  rep(i,R)rep(j,C) {
    for (int k = 2; k >= 0; k--) {
      chmax(dp[i][j][k+1], dp[i][j][k]+a[i][j]);
    }
    rep(k,4) {
      chmax(dp[i+1][j][0], dp[i][j][k]);
      chmax(dp[i][j+1][k], dp[i][j][k]);
    }
  }

  ll ans = 0;
  rep(k,4) chmax(ans, dp[R-1][C-1][k]);
  cout << ans << endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vi>;

const long long int llinf = 1LL << 62;
const int inf = 99999999;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };

#define Endl endl
#define pr(x) cout << x << endl
#define FOR(i,a,b) for(int i = a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb(a) push_back(a);
#define mp(a,b) make_pair(a,b)
#define atcoder int(1e9) +7;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
#define all(x) x.begin,x.end();

char c[110][110];

int main() {

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

	ll ans = k;
	FOR(i, 1, n) {
		ans *= k - 1;
	}
	pr(ans);

	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := nextInt()
	b := nextInt()
	if a == b {
		fmt.Println(1)
		return
	}
	if a > b {
		fmt.Println(0)
		return
	}
	if n <= 1 {
		fmt.Println(0)
		return
	}
	fmt.Println((n-2)*(b-a) + 1)
}

// 引数処理
func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}

func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}


Measured memory_bytes: 640
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int main(){
	ll n,x,tmp;
	cin>>n;
	x=n;
	while(x!=0){
		tmp+=x%10;
		x/=10;
	}
	if(n%tmp==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256