akhauriyash/Code-Regression huggingface dataset:
/*

Our shadows stretch out on the pavement
As I walk in the twilight with you
If we could be together like this forever
Holding hands
It's almost enough to make me cry

The wind grows colder
I can smell winter
Soon the season will come to this town
When I can get close to you

This moment
When the two of us cuddle up
To gaze at the first snow flower of the year
Is overflowing with happiness

It's not dependence or weakness
I just love you
I thought so with all my heart

I feel like when I'm with you
I can overcome anything
I pray that these days
Will continue forever

The wind rattled the window
The night shakes you awake
I will change any sorrow
Into a smile

The snow flowers fell
Outside the window
Unceasing
And colored our town
I realized that love means
Wanting to do something
For someone else

If I should lose you
I'll become a star and shine on you
I'll be with you even on nights
When your smile is wet with tears

This moment
When the two of us cuddle up
To gaze at the first snow flower of the year
Is overflowing with happiness

It's not dependence or weakness
I just want to be like this
With you forever
I can honestly think that now

The pure white snow flowers
Bury this town
Softly drawing memories in our hearts
Together forever with you...

*/

#include <bits/stdc++.h>

using namespace std;

int main() {
  long long n, m;
  scanf("%lld %lld", &n, &m);
  if (n > m) swap(n, m);
  long long ans = 0;
  if (n == 1) {
    if (m == 1) {
      ans = 1;
    } else if (m == 2) {
      ans = 0;
    } else {
      ans = m - 2;
    }
  } else if (n == 2) {
    ans = 0;
  } else {
    ans = (n - 2) * (m - 2);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    int n; cin >> n;
    int minas = 1;
    rep(i,n){
        int num; cin >> num;
        if(num%2==0){
            minas*=2;
        }
    }
    cout << pow(3,n) - minas << endl;

    return 0;
}

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

int main () {
#ifdef TooLazy
    freopen("in.txt", "r", stdin);
#endif // TooLazy

    int n, m;
    cin >> n >> m;
    n--;
    m--;
    cout << n * m << "\n";

    return 0 ;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc052/tasks/arc067_a
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
const int MOD = 1e9 + 7;

// constexprな素数列挙(エラトステネスの篩)
template <int N> struct calc_prime {
    bool b[N + 1];

    constexpr calc_prime() : b() {
        for (int_fast64_t i = 0; i <= N; ++i)
            b[i] = true;
        b[0] = b[1] = false;
        for (int_fast64_t i = 2; i <= N; ++i) {
            for (int_fast64_t j = i * i; j <= N; j += i)
                b[j] = false;
        }
    }
};
calc_prime<200000> prime;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    ll ans = 1;
    FOR(i, 2, n + 1) {
        // 素数の場合
        if (prime.b[i]) {
            // n!の中で素因数iは何乗か？
            ll tot = 0;
            for (int j = i; j <= n; j *= i) { // 2,4,8...
                tot += n / j;                 // 12/2 + 12/4 + 12/8
            }
            //約数の個数*(tot+1)%modで更新
            ans = (ans * (tot + 1)) % MOD;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3708
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>

using namespace std;

int main()
{
  int T;
  cin >> T;
  for(int tc=1;tc<=T;++tc){
    int n,k;
    long long int ans = 0;
    cin >> n >> k;
    vector<int> house(n);
    vector<int> diff(n-1);
    for(int i = 0; i < n; ++i){
      cin >> house[i];
    }
    for(int i = 0; i < n-1; ++i){
      diff[i] = house[i+1] - house[i];
    }
    sort(diff.begin(),diff.end(),greater<int>());
    for(int i = k-1; i < diff.size(); ++i){
      ans += diff[i];
    }
    cout << ans << endl;
  }
  return 0;
}

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

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, std::string S){
    if(S[A] != '-'){
        cout << NO << endl;
        exit(0);
    }
    for(int i = 0; i < A + B; ++i){
        if(i == A) continue;
        if(!isdigit(S[i])){
            cout << NO << endl;
            return;
        }
    }
    cout << YES << endl;
    return;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    std::string S;
    std::cin >> S;
    solve(A, B, S);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,v.size())
#define all(v) (v).begin(),(v).end()
#define bit(n) (1ll<<(n))
#define clamp(n,mi,ma) max(min(n,ma),mi)
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b) cout<<((n)?a:b)<<endl
#define YES(n) cho(n,"YES","NO")
#define Yes(n) cho(n,"Yes","No")
#define Poss(n) cho(n,"Possible","Impossible")
template<class T>bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}
template<class T>istream&operator>(istream&i,T&t){return i>>t;}
#ifndef LOCAL
struct ostdmy{
template<class T>ostdmy&operator<<(const T&t){return*this;}
template<class T>ostdmy&operator<(const T&t){return*this;}};ostdmy cer_;
#define cerr cer_
#endif
int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    cin>n;
    vi a(n);
    cin>a;
    int mi=INF;
    int cnt=0;
    REP(i,n){
        if(a[i]<0){
            cnt++;
            a[i]=-a[i];
        }
        chmin(mi,a[i]);
    }
    ll su=accumulate(all(a), 0ll);
    cerr<"cnt:"<cnt;
    cerr<"mi:"<mi;
    if(cnt%2)
        su-=mi*2;
    cout<su<endl;
    return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=100111;
const int inf=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


/*
vvl comb(int n, int r) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}
*/

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

	

int main(){
	ll n;
	cin>>n;
	cout<<(n-1)*n/2;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(min(b,d)<=max(a,c))
     cout<<0<<endl;
  else
    cout<<min(b,d)-max(a,c)<<endl;
}


Measured memory_bytes: 256
from sys import stdin, setrecursionlimit


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


def main():
    input = stdin.buffer.readline
    a, b = map(int, input().split())
    print(a * b // gcd(a, b))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 38552
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0; i<N; i++)

using namespace std;

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

  long long ans =0;

  n = n -1 ;
  ans = n * ( n + 1) / 2;

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            
            String strSplit[] = br.readLine().split(" ");
            
            int result = 0;
            for(int i=0; i<strSplit.length; i++){
                if(strSplit[i].equals("0")){
                    result = i + 1;
                    break;
                }
            }
            
            System.out.println(result);
            
        }catch(Exception e){
            System.out.println(e);
        }
    }
}

Measured memory_bytes: 32344
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("198 1.10");
            //217
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("1 0.01");
            //0
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("1000000000000000 9.99");
            //9990000000000000
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        decimal[] wkArr = InputList[0].Split(' ').Select(X => decimal.Parse(X)).ToArray();

        decimal A = wkArr[0];
        decimal B = wkArr[1];

        Console.WriteLine(Math.Truncate(A * B));
    }
}


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

int main() {
    int n, k, s;
    cin >> n >> k >> s;
    if (n - k >= s - 1) {
        for (int i = 0; i < n; i++) {
            if (i <= k + s - 2)
                cout << 1 << " ";
            else
                cout << 1000000000 << " ";
        }
        cout << endl;
    } else {
        for (int i = 0; i < n; i++) {
            if (i < k)
                cout << s << " ";
            else
                cout << 1 << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1280
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn diff(a: u32, b: u32) -> u32 {
    if a > b {
        a - b
    } else {
        b - a
    }
}

fn main() {
    let n: usize = read();
    let x: Vec<u32> = read_vec();

    let mut ans = 1000000000;

    for i in 0..101 {
        let p = i as u32;
        let mut tmp = 0;
        for j in 0..n {
            let d = diff(p, x[j]);
            tmp += d * d;
        }
        if tmp < ans {
            ans = tmp;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
using namespace std;
vector<int> edge[2000];
int dist[2000][2000];
int cnt[2000];
int main() {
	int n, k;	cin >> n >> k;
	for (int i = 0; i < n; i++)	for (int j = 0; j < n; j++)	dist[i][j] = 1 << 25;
	for (int i = 0; i < n; i++)	dist[i][i] = 0;
	queue<pair<int, int>> q;
	for (int i = 1; i < n; i++) {
		int a, b;	cin >> a >> b;	a--;	b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
		dist[a][b] = dist[b][a] = 1;
		q.push(make_pair(a, b));
	}
	while (!q.empty()) {
		auto it = q.front();	q.pop();
		for (int i = 0; i < edge[it.first].size(); i++) {
			if (dist[it.second][edge[it.first][i]] >= 1 << 25) {
				dist[it.second][edge[it.first][i]] = dist[it.first][it.second]+1;
				q.push(make_pair(it.second, edge[it.first][i]));
			}
		}
		for (int i = 0; i < edge[it.second].size(); i++) {
			if (dist[it.first][edge[it.second][i]] >= 1 << 25) {
				dist[it.first][edge[it.second][i]] = dist[it.first][it.second]+1;
				q.push(make_pair(it.first, edge[it.second][i]));
			}
		}
	}
	for (int i = 0; i < n; i++)	cnt[i] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (dist[i][j] > k)	cnt[i]++;
		}
	}
	for (int ret = 0;; ret++) {
		int erase = -1, num = 0;
		for (int i = 0; i < n; i++) {
			if (num < cnt[i])	num = cnt[i], erase = i;
		}
		if (erase == -1) {
			cout << ret << endl;
			return 0;
		}
		for (int i = 0; i < n; i++) {
			if (dist[i][erase] > k)	cnt[i]--;
		}
		cnt[erase] = -1;
	}
}

Measured memory_bytes: 48644
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>

using namespace std;  //このネームスペースを使う

int main(){
  int A,B,T;
  int sum;
  cin >> A >> B >> T ;
  


  int i,j;
  sum = 0;
  j=0;
  for(i=A;i<(T+0.5);i=A*(j+1)){
    sum += B;
    j++;
  }
  
  cout << sum << endl;

  return 0;
}



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

int main(){
  int a,b,c;
  int temp;
  cin >> a >> b >> c;
  
  if(a>b){
    temp = a;
    a = b;
    b = temp;
  }
  
  if(a<c && c<b){
    cout << "Yes" << endl;
  }else{
	cout << "No" << endl;
  }
}

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

int ctoi(char c) { return (c - '0'); }

string solve() {
    vector<char> op(3);
    for (int bit = 0; bit < (1 << 3); bit++) {
        int n = ctoi(ABCD[0]);
        for (int i = 0; i < 3; i++) {
            op[i] = '-';
            if (bit & (1 << i)) {
                op[i] = '+';
            }
            if (op[i] == '-') {
                n -= ctoi(ABCD[i + 1]);
            } else {
                n += ctoi(ABCD[i + 1]);
            }
        }
        for (int i = 0; i < 3; i++) {
            if (n == 7) {
                string ret = "";
                for (int j = 0; j < 3; j++) {
                    ret += ABCD[j];
                    ret += op[j];
                }
                ret += ABCD[3];
                ret += "=7";
                return ret;
            }
        }
    }
    return "";
}

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

    cin >> ABCD;
    cout << solve() << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int cnt = 0;
        for (int cur = 1; cur < B;) {
            cur = (cur - 1) + A;
            cnt++;
        }

        System.out.println(cnt);
        return;
    }

}

Measured memory_bytes: 21844
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	float c=0.0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		c+=1/float(a[i]);
	}
	cout<<1/c<<endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
*A,=map(int, input().split())

MOD = 10**9+7

M = 10**3
primes = []
is_prime = [True] * (M+1)
for n in range(2,M+1):
    if not is_prime[n]: continue
    primes.append(n)
    for m in range(2*n,M+1,n): is_prime[m] + False

from collections import defaultdict
cmnd = defaultdict(int)

for a in A:
    for n in primes:
        i = 0
        while a % n == 0:
            i += 1
            a //= n
        cmnd[n] = max(cmnd[n], i)
    if a > 1: cmnd[a] = max(cmnd[a], 1)

lcm = 1
for k,v in cmnd.items():
    for i in range(v):
        lcm = (lcm * k) % MOD

ans = 0
for a in A:
    ans += (lcm * pow(a, MOD-2, MOD)) % MOD
    ans %= MOD

print(ans)

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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
bool compare_by(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second > b.second;
    }
}

vector<pair<int,ll>> vec[100000];
ll cost[100000];
void dfs(int now,ll COST){
    cost[now]=COST;
    int next;
    REP(i,vec[now].size()){
        next=vec[now][i].first;
        if(cost[next]<0){
            dfs(next,COST+vec[now][i].second);
        }
    }
}
int counter(int x){
    if(!x)return 0;
    return counter(x>>1)+(x&1);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N=in();
    string s=in<string>();
    int ans=0;
    REP(i,N-2){
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')ans++;
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 3584
#include <map>
#include <cmath>
#include <vector>
#include <iostream>

using namespace std;
using ll = long long;

ll isPrime(ll n) {
    if (n < 2) return 0;
    for (ll val = 2; val <= sqrt(n); ++val) {
        if (n % val == 0) return val;
    }
    return n;
}


int main() {
    ll n;
    cin >> n;
    map<ll, ll> mp;
    while (n > 1) {
        ll val = isPrime(n);
        mp[val]++;
        n /= val;
    }
    int cnt = 0;
    for (auto it = mp.begin(); it != mp.end(); it++) {
        cnt += (-1 + (ll)sqrt(1 + 8 * it->second)) / 2;
    }
    cout << cnt << '\n';
}

Measured memory_bytes: 3740
#include<iostream>
#include<map>
using namespace std;
typedef unsigned long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
ll kount(ll cou) {
    ll index = 0;
    for (ll i = 1; ;i++) {
        if (cou < i) {
            break;
        } else {
            cou -= i;
            index++;
        }
    }
    return index;
}
map<ll, ll> prime_factor(ll n) {
map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
if(n != 1) ret[n] = 1;
return ret;
}
int main() {
    ll n, c;
    map<ll, ll> count;
    cin >> n;
    count = prime_factor(n);
    ll cc = 0;
    for (map<ll, ll>::iterator i = count.begin(); i != count.end(); ++i){
        cc += kount(i->second);
    }
    cout << cc << endl;
}


Measured memory_bytes: 3636
using System;
using System.Linq;
using System.Collections.Generic;

public class Test
{
	public static void Main()
	{
		int a = int.Parse(Console.ReadLine());
		int b = int.Parse(Console.ReadLine());
		int c = int.Parse(Console.ReadLine());
		int x = int.Parse(Console.ReadLine());
		int cnt = 0;
		for(int ia = 0 ; ia <= a ; ia++){
			for(int ib = 0 ; ib <= b ; ib++){
				for(int ic = 0 ; ic <= c ; ic++){
					if( ((ia*500)+(ib*100)+(ic*50)) == x){
						cnt++;
					}
				}
			}
		}
		Console.WriteLine(cnt++);
	}                                                                                                                                                                       
}

Measured memory_bytes: 11092
#include<stdio.h>
int main(){
  int n, a[100], i,max=0,min=1000;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&a[i]);
    if(a[i]>max){
      max=a[i];
    }
    if(a[i]<min){
      min=a[i];
    }
  }
  printf("%d\n",max-min);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  ll a,b,c;
  cin>>a>>b>>c;
  cout << min(b/a,c) << endl;
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# 入力
n = int(input())
An_list = list(map(int, input().split()))

# 拒否フラグ
deny_flag = False


# 入国条件処理
for Ai in An_list:
    if Ai % 2 == 0:
        if (Ai % 3 == 0) or (Ai % 5 == 0):
            # 入国条件に合うので継続
            pass
        else:
            # 入国条件に合わないので拒否して終了
            print("DENIED")
            deny_flag = True
            break


# 数値をすべて審査してdeny_flagがFalseなら承認
if not deny_flag:
    print("APPROVED")


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

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

Measured memory_bytes: 5364
package main

import (
	"fmt"

	"os"
	"io"
	"bufio"
	"bytes"

	"strings"
	"strconv"
)

//  長い入力を読む
func ReadLongLines(times int) ([]string, error) {
	result := make([]string, times)
	reader := bufio.NewReader(os.Stdin)
	buffer := bytes.NewBuffer(make([]byte, 0))
	readBytes := int64(2)
	for i := 0; i < times; i++ {
		for {
			readBuf, isPrefix, err := reader.ReadLine()
			// fmt.Printf("Reader.Read: %d\n", len(readBuf))
			readBytes += int64(len(readBuf) + 1)
			if err != nil {
				if err == io.EOF {
					fmt.Println("EOF")
					break
				} else {
					return result, err
				}
			}
			_, err = buffer.Write(readBuf)
			if err != nil {
				return result, err
			}
			// end of line
			if !isPrefix {
				result[i] = buffer.String()
				buffer.Reset()
				// reader = bufio.NewReader(os.Stdin)
				break
			}
		}
	}
	// 先読みしてしまうようなので、戻しておく
	os.Stdin.Seek(-int64(reader.Buffered()), os.SEEK_CUR)
	return result, nil
}


// go だと固定長配列とか辛いので無理だった
type Queue struct {
	frontArr [] int
	backArr [] int
	back int
}
func NewQueue() Queue {
	return Queue{make([]int, 0, 100000), make([]int, 0, 100000), 0}
}
func (this *Queue)PushFront(i int) {
	this.frontArr = append(this.frontArr, i)
}
func (this *Queue) PushBack(i int) {
	this.backArr = append(this.backArr, i)
}
func (this *Queue)RandomAccess(i int) int {
	// fmt.Println(i)
	// this.Dump()
	if i <= len(this.frontArr) - 1 {
		return this.frontArr[len(this.frontArr) - 1 -i]
	} else {
		return this.backArr[i - len(this.frontArr)]
	}
}
func (this *Queue) PopFront() {
	if 0 < len(this.frontArr) {
		this.frontArr = this.frontArr[:len(this.frontArr) - 1]
	} else {
		this.backArr = this.backArr[1:]
	}
}
func (this *Queue) PopBack() {
	if 0 < len(this.backArr) {
		this.backArr = this.backArr[:len(this.backArr)-1]
	} else {
		this.frontArr = this.frontArr[1:]
	}
}
func (this *Queue) Dump() {
	fmt.Println(this.frontArr)
	fmt.Println(this.backArr)
}



func main() {
	// v := NewQueue()
	// for i := 0; i < 200000; i++ {
	// 	v.PushBack(i)
	// }
	// v.Dump()
	// var _ = strings.Split
	// var _ = strconv.Atoi
	var q int
	fmt.Scanf("%d", &q)
	v := NewQueue()
	lines, _ := ReadLongLines(q)
	for _, line := range lines {
		args := strings.Split(line, " ")
		cmd := args[0]
		switch cmd {
		case "0": // push
			x, _ := strconv.Atoi(args[2])
			if args[1] == "0" {
				v.PushFront(x)
			} else {
				v.PushBack(x)
			}
		case "1": // at
			x, _ := strconv.Atoi(args[1])
			fmt.Println(v.RandomAccess(x))
		case "2": // pop
		if args[1] == "0" {
			v.PopFront()
		} else {
			v.PopBack()
		}
		}
	}
}


Measured memory_bytes: 35712
s=str(input())
s=list(s)

flg = 0

for i in range(len(s)):
    #偶数
    if i % 2 == 0:
        if s[i] == "L":
            flg = 1
    #奇数
    else:
        if s[i] == "R":
            flg = 1
            
if flg == 0:
    print("Yes")
else:
    print("No")

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

int main() {
    int n,m,k;cin>>n>>m>>k;
    ll a[n+1]{},b[m+1]{};
    for (int i=0;i<n;i++) {
        cin>>a[i+1];
        a[i+1]+=a[i];
    }
    for (int i=0;i<m;i++) {
        cin>>b[i+1];
        b[i+1]+=b[i];
    }
    int ans=0;
    for (int i=0;i<=n&&a[i]<=k;i++) {
        int c=upper_bound(b,b+m+1,k-a[i])-1-b;
        ans=max(ans,i+c);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6764
let lcs x y =
  let m = String.length x in
  let n = String.length y in
  let dp = Array.make_matrix (m + 1) (n + 1) 0 in
  for i = 1 to m do
    for j = 1 to n do
      dp.(i).(j) <-
        if x.[i-1] = y.[j-1] then dp.(i-1).(j-1) + 1
        else
          let a = dp.(i-1).(j) in
          let b = dp.(i).(j-1) in
          if a > b then a else b;
    done
  done;
  dp.(m).(n)

let () =
  let q = read_int () in
  for _ = 0 to q - 1 do
    let x = read_line () in
    let y = read_line () in
    lcs x y |> Printf.printf "%d\n"
  done

Measured memory_bytes: 18548
n = int(input())
s = input()
common = 0
for i in range(n):
    x = s[:i]
    y = s[i:]
    x_set = {i for i in x}
    y_set = {i for i in y}
    c = x_set.intersection(y_set)
    if len(c) > common:
        common = len(c)
print(common)

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

int main() {
  int N;
  std::cin >> N;

  int k = static_cast<int>(log10(N));
  int n = N;
  int r = 1;
  for (; k > 0; k--) {
    r = r * 10 + 1;
    n /= 10;
  }
  r *= n;

  if (r < N) {
    r += r / n;
  }
  std::cout << r << std::endl;
  return 0;
}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main(){ 
  int x, y, z, k; cin >> x >> y >> z >> k;
  vector<ll> A(x), B(y), C(z);
  rep(i, x) cin >> A[i];
  rep(i, y) cin >> B[i];
  rep(i, z) cin >> C[i];
  
  vector<ll> V;
  rep(i, x){
    rep(j, y){
      V.push_back(A[i] + B[j]);
    }
  }
  sort(all(V), greater<ll>());
  if(V.size()> k) V.resize(k);
  vector<ll> res;
  rep(i, V.size()){
    rep(j, z){
      res.push_back(V[i] + C[j]);
    }
  }
  sort(all(res), greater<ll>());
  rep(i, k){
    cout << res[i] << ln;
  }
}


Measured memory_bytes: 43368
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
	int n;
	cin>>n;
	while (n--){
	bool yes=true;
		stack<int> s1;
		stack<int> s2;
		s1.push(0);
		s2.push(0);
		REP(i, 10){
			int a;
			cin >> a;
			if (s1.top() >= s2.top()){
				if (s1.top() < a){
					s1.push(a);
					continue;
					}
			}
			if (s2.top() < a){
					s2.push(a);
					continue;
			}
			if (s1.top() < a){
				s1.push(a);
				continue;
			}
			yes=false;
		}
		if (yes)
			cout << "YES"<<endl;
			else
				cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 3016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 1e9 + 7;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 2e5 + 10;
int main()
{
	int n, m;
	cin >> n >> m;
	int ans = n * (n - 1) / 2 + m * (m - 1) / 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var vi = Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray();
            Array.Sort(vi);
            Console.WriteLine(vi.Aggregate((x, y) => (x + y) / 2.0));
        }
    }
}


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

int main()
{
	string N;
	cin >> N;
	int count = 0;

	for (int i = 0; i < 3; i++)
	{
		if (N[i] == '1')count++;
	}

	cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;

inline bool isprime(ll n)
{
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

int main()
{
    while (true) {
        ll n;
        cin >> n;
        if (n == 0) {
            break;
        }
        ll inf = n;
        for (;; inf--) {
            if (isprime(inf)) {
                break;
            }
        }
        ll sup = n;
        for (;; sup++) {
            if (isprime(sup)) {
                break;
            }
        }
        cout << sup - inf << endl;
    }

    return 0;
}

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

int dfs(const vector<vector<int>> &G, int v, vector<int> &C){
  int c = C[v], ret = 1;
  for(auto v_ : G[v]){
    if(C[v_] < 0){
      C[v_] = 1-c;
      ret &= dfs(G,v_,C);
    }else if(C[v_] == c){
      ret = 0;
    }
  }
  return ret;
}

int main(){
  long long N, M;
  cin >> N >> M;
  vector<vector<int>> G(N);
  for(int i = 0; i < M; ++i){
    int u, v;
    cin >> u >> v;
    --u, --v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  vector<int> C(N,-1);
  long long x = 0, y = 0, z = 0;
  for(int i = 0; i < N; ++i){
    if(C[i] >= 0) continue;
    C[i] = 0;
    if(G[i].empty()) ++y;
    else ++z, x += dfs(G,i,C);
  }
  long long ans = N*N - (N-y)*(N-y) + z*z + x*x;
  cout << ans << endl;
}


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


void solve(long long N){
    ll maxv;
    for(maxv = 1; maxv * (maxv + 1) / 2 < N; ++maxv){
    }
    ll tmp = maxv * (maxv + 1) / 2;
    for(ll i = 1; i <= maxv; ++i){
        if(i != tmp - N){
            cout << i << endl;
        }
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define fi first
#define se second
#define inf 1000000007

ll N;
ll A[200010];
ll Sum[200010];
ll Le[200010];
ll Ri[200010];

int main(){
    cin >> N;
    rep(i,N) cin >> A[i];
    Sum[0] = 0;
    repi(i,1,N+1){
        Sum[i] = Sum[i-1]+A[i-1];
    }
    Le[0] = 0;
    Ri[0] = 2;
    ll ans = -1;
    repi(i,1,N-2){
        ll active = Le[i-1];
        ll sum = Sum[i+1];
        while(Sum[active+1] < sum/2){
            active++;
        }
        if (active > Le[i-1]){
            if (abs(Sum[active+1]-sum/2) <= abs(Sum[active]-sum/2)){
                Le[i] = active;
            }
            else
                Le[i] = active-1;
        }
        else{
            Le[i] = active;
        }
        active = Ri[i-1];
        sum = Sum[N]-Sum[i+1];
        while(Sum[active+1]-Sum[i+1] < sum/2){
            active++;
        }
        if (active > Ri[i-1]){
            if (abs(Sum[active+1]-Sum[i+1]-sum/2) <= abs(Sum[active]-Sum[i+1]-sum/2)){
                Ri[i] = active;
            }
            else
                Ri[i] = active-1;
        }
        else{
            Ri[i] = active;
        }
        ll P,Q,R,S;
        P = Sum[Le[i]+1];
        Q = Sum[i+1]-Sum[Le[i]+1];
        R = Sum[Ri[i]+1]-Sum[i+1];
        S = Sum[N]-Sum[Ri[i]+1];
        ll M = max(max(P,Q),max(R,S));
        ll m = min(min(P,Q),min(R,S));
        if (abs(M-m) <= ans || ans < 0){
            ans = abs(M-m);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6528
from collections import Counter
N, M = map(int,input().split())
par = []
rank = [0] * N
for i in range(N): par.append(i)
def find(x):
    if par[x] == x: return x
    else:
         par[x] = find(par[x])
         return par[x]
def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y: return 0
    if rank[x] < rank[y]: par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]: rank[x] += 1

for i in range(M):
    A, B = map(int,input().split())
    A -= 1
    B -= 1
    unite(A,B)
for i in range(N):find(i)    
print(Counter(par).most_common()[0][1])


Measured memory_bytes: 123880
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	string s;
	cin >> s;
	string ans;
	ans.push_back(s[0]);
	int add = s.size() - 2;
	ans += to_string(add);
	ans.push_back(s[s.size()-1]);
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main()
{
    int P, Q, R;

    cin >> P >> Q >> R;

    int min = P + Q + R;

    // A B C, C B A
    if(P+Q<min){
        min = P + Q;
    }

    // A C B, B C A
    if(R+Q<min){
        min = R + Q;
    }

    // B A C, C A B
    if(P+R<min){
        min = P + R;
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

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

	long N; cin >> N;
	if (N % 2 == 0) {
		cout << N << endl;
	}else {
		cout << 2 * N << endl;
	}
	return 0;
}


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

int main()
{
    string S;
    cin >> S;
    if (S.find("AC") != -1)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <algorithm>
#include <climits>
#include <deque>
#include <map>
#include <deque>
#include <iomanip>
#include <cmath>
#include <functional>
#include <set>
#include <list>
#include <bitset>
#include <stack>
#include <stdio.h>
#define endl '\n'
using namespace std;
#define MOD 1000000007
#define ll long long
#define pb push_back
typedef pair<ll,ll> pll;
int main()
{
    /*
for reading from input.txt and writing on output.txt
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
*/
    cin.sync_with_stdio(false);
    ll a,b;cin>>a>>b;
    ll ans=(a*b)/(__gcd(a,b));
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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 T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


string str;
char bo[4][4];

char solve(string str) {
    for (int i = 0; i < 3; ++i) for (int j = 0; j < 3; ++j) bo[i][j] = str[i*3+j];
    for (int i = 0; i < 3; ++i) {
        if (bo[i][0] == bo[i][1] && bo[i][1] == bo[i][2]) {
            if (bo[i][0] == 'o') return 'o';
            else if (bo[i][0] == 'x') return 'x';
        }
        if (bo[0][i] == bo[1][i] && bo[i][i] == bo[2][i]) {
            if (bo[0][i] == 'o') return 'o';
            else if (bo[0][i] == 'x') return 'x';
        }
    }
    if (bo[0][0] == bo[1][1] && bo[1][1] == bo[2][2]) {
        if (bo[0][0] == 'o') return 'o';
        else if (bo[0][0] == 'x') return 'x';
    }
    if (bo[0][2] == bo[1][1] && bo[1][1] == bo[2][0]) {
        if (bo[1][1] == 'o') return 'o';
        else if (bo[1][1] == 'x') return 'x';
    }
    return 'd';
}

int main() {
    while (cin >> str) {
        cout << solve(str) << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1176
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] nums = br.readLine().split(" ");
        int num;
        int max, min;
        long sum;
        max = min = Integer.parseInt(nums[0]);
        sum = (long) max;
        for (int i = 1; i < n; i++) {
            num = Integer.parseInt(nums[i]);
            if (max < num) max = num;
            else if (min > num) min = num;
            sum += num;
        }
        System.out.println(min + " " + max + " " + sum);
    }
}

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

int main(){
  int n,w,sum;
  scanf ("%d %d",&n,&w);
  vector<int> v(n);
  vector<int> ww(n);
  for(int t=0;t<n;t++){
    scanf ("%d %d",&v[t],&ww[t]);
  }
  vector<vector<int> > a(n,vector<int> (w+1,0));
  if(ww[0]<=w){
    a[0][ww[0]]=v[0];
  }
  for(int t=1;t<n;t++){
    for(int z=0;z<w+1;z++){
      a[t][z]=a[t-1][z];
    }
    for(int s=ww[t];s<=w;s++){
      if(a[t-1][s]<a[t-1][s-ww[t]]+v[t]){
        a[t][s]=a[t-1][s-ww[t]]+v[t];
      }
    }
  }
  sum=0;
  for(int t=0;t<w+1;t++){
    if(sum<a[n-1][t]){
      sum=a[n-1][t];
    }
  }
  printf("%d\n",sum);
}



Measured memory_bytes: 6828
int main(void){
  char s[1];
  scanf("%s",s);
  
  switch(s[0]){
    case 'A':
      printf("T\n");
      break;
    case 'T':
      printf("A\n");
      break;
    case 'C':
      printf("G\n");
      break;
    case 'G':
      printf("C\n");
      break;
  }
  
  
  return 0;
}

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

#define ll long long

#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define scd(x) scanf("%lf",&x)
#define scc(x) scanf("%[^\n]s",x); // For charecter string input , It will  read all charecter untill Enter new line .

#define pfi(x) printf("%d",x)
#define pfl(x) printf("%lld",x)
#define pfd(x) printf("%lf",x)
#define pfc(x) printf("Case %d: ",x)
#define ps printf(" ")
#define pn printf("\n")
#define pb(x) push_back(x)
#define ppb(x) pop_back(x)
#define pf(x) push_front(x)
#define ppf(x) pop_front(x)
#define in(x,y) insert({x,y})

//int dx[] = {0,1,0,-1,1,1,-1,-1};
//int dy[] = {1,0,-1,0,1,-1,-1,1};

//i64 gcd(i64 a,i64 b){if(!b)return a;return gcd(b,a%b);}


//i64 bigmod(i64 num,i64 n){if(n==0)return 1;i64 x=bigmod(num,n/2);x=x*x%mod;if(n%2==1)x=x*num%mod;return x;}

//i64 modinverse(i64 num){return bigmod(num,mod-2)%mod;}

//i64 po(i64 a,i64 b){i64 ans=1;while(b--)ans *= a;return ans;}

//i64 ncr(i64 n,i64 r){if(n==r)return 1;if(r==1)return n;if(dp[n][r]!=-1)return dp[n][r];return dp[n][r]=ncr(n-1,r)+ncr(n-1,r-1);}




#define pb push_back

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

#define file_read(filename)  freopen("input.txt","r",stdin);
#define file_write(filename)  freopen("output.txt","w",stdout);

#define sv(a) sort(a.begin(),a.end())
#define sortD(a)  sort(a,a+n,greater<int>())
#define sortA(a)  sort(a,a+n)

int main()
{

   ll a,b,c,r,w;
   cin>>w>>a>>b;

   if(a<b)
   {
       a=a+w;
       r=b-a;
       if(r>=0){ printf("%lld\n",r);}
       else printf("0\n");
   }
   else
   {
       b=b+w;
       r=a-b;
       if(r>=0){ printf("%lld\n",r);}
       else printf("0\n");
   }

return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <string.h>

using namespace std;

int main(){

	int num,n,table[1001],count,index,tmp;
	char claim[10];
	bool First;

	while(true){
		scanf("%d %d",&num,&n);
		if(num == 0 && n == 0)break;

		for(int i = 1; i <= num; i++){
			table[i] = 1;	//1?????????
		}

		count = num; //???????????£??????????????°
		index = 1;	//????¨????<???????????£?????????>?????????????????????

		for(int i = 1; i <= n; i++){
			scanf("%s",claim);
			if(count == 1)continue;	//???n???????????????????????¨?¬???????????????????????????????????????????????????????

			if(i%3 == 0 && i%5 != 0){ //Fizz
				if(strcmp(claim,"Fizz") == 0){
					//Do nothing
				}else{ //?????£?§£????????§?????????
					table[index] = 0;
					count--;
				}
			}else if(i%3 != 0 && i%5 == 0){ //Buzz
				if(strcmp(claim,"Buzz") == 0){
					//Do nothing
				}else{ //?????£?§£????????§?????????
					table[index] = 0;
					count--;				}

			}else if(i%3 == 0 && i%5 == 0){ //FizzBuzz
				if(strcmp(claim,"FizzBuzz") == 0){
					//Do nothing
				}else{ //?????£?§£????????§?????????
					table[index] = 0;
					count--;
				}
			}else{ //???????????°??????????¨????????????????
				if(claim[0] < '0' || claim[0] > '9'){ //????????????????¨??????°?????§????????´???
					table[index] = 0;
					count--; //?????£?§£????????§?????????
				}else{
					tmp = 0;
					for(int p = 0;claim[p] != '\0';p++){
						tmp = 10*tmp + (claim[p] - '0');
					}

					if(tmp == i){	//??£?§£
						//Do nothing
					}else{ //?????£?§£
						table[index] = 0;
						count--; //?????£?§£????????§?????????
					}
				}
			}
			//??£?§£???????????¨?????£?§£???????????¨?¬????????????¢????????¨?????????????????????
			for(int k = 1; k <= num-1; k++){
				if(index + k == num){
					if(table[num] == 1){
						index = num;
						break;
					}
				}else{
					if(table[(index+k)%num] == 1){
						index = (index+k)%num;
						break;
					}
				}
			}
		}

		First = true;
		for(int i = 1; i <= num; i++){
			if(table[i] == 1){
				if(First){
					printf("%d",i);
					First = false;
				}else{
					printf(" %d",i);
				}
			}
		}
		printf("\n");

	}


    return 0;
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}


/*{
  }*/

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int,int>;

//constexpr int mod = 1e9+7;
//constexpr int inf = 1<<30;

signed main(){
  int t1, t2, a1, a2, b1, b2;
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;

  // a1 > b1 and a2 > b2 -> 0
  // a1 < b1 and a2 < b2 -> 0
  if((a1 > b1 and a2 > b2) or (a1 < b1 and a2 < b2)){
    cout << 0 << endl;
    return 0;
  }

  int a = t1*a1;
  int b = t1*b1;
  int A = t1*a1 + t2*a2;
  int B = t1*b1 + t2*b2;
  if((a > b and A > B) or (a < b and A < B)){
    cout << 0 << endl;
    return 0;
  }

  if(A == B){
    cout << "infinity" << endl;
    return 0;
  }

  int dif1 = t1*(a1-b1);
  int dif2 = t2*(b2-a2) + t1*(b1-a1);
  int tmp = dif1/dif2;
  int ans = (dif1%dif2 != 0) + tmp*2;
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256