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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MOD 1000000007
#define INF 100100100

typedef long long ll;
typedef pair<int, int> p;


int main(){
  ll n, l;
  cin >> n >> l;
  vector<ll> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }

  ll maxv = -1;
  ll maxv_index = -1;
  for (int i = 1; i < n; i++) {
    if(maxv < v[i] + v[i-1]){
      maxv_index = i;
      maxv = v[i] + v[i-1];
    }
  }

  if(maxv < l){
    cout << "Impossible" << endl;
  }else{
    cout << "Possible" << endl;
    for (int i = 0; i < n-1; i++) {
      if(i+1 == maxv_index) break;
      cout << i+1 << endl;
    }
    for (int i = n-2; i+1 > maxv_index; i--) {
      cout << i+1 << endl;
    }
    cout << maxv_index << endl;
  }
}


Measured memory_bytes: 1664
#include "bits/stdc++.h"
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define debug(var) std::cout << #var << " : " << var << std::endl;
using ll = long long;
using ull = unsigned long long;
using vint = std::vector<int>;
using vvint = std::vector<std::vector<int>>;
using namespace std;
ll mod = 1e9 + 7;


int main() {


	int N, W; cin >> N >> W;
	vint w(N);
	vector<ll> v(N);
	rep(i, N)cin >> w[i] >> v[i];
	vector<vector<ll>> dp(N + 1, vector<ll>(W + 1, 0));

	rep(i, N)for (int j = 0; j <= W; j++) {
		if (j >= w[i]) {//もし追加してもいいのなら追加
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
		}
		dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
	}

	cout << dp[N][W];


	return 0;
}

Measured memory_bytes: 80256
//#pragma warning disable

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Text;

public class Test
{
    public class Pair
    {
        public long Red;
        public long Blue;

        public Pair(long x, long y)
        {
            Red = x;
            Blue = y;
        }

        public void Swap()
        {
            var temp = Red;
            Red = Blue;
            Blue = temp;
        }
    }

    public static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var xy = new Pair[N];

        for (int i = 0; i < N; i++)
        {
            var line2 = Console.ReadLine().Split(' ').Select(z => long.Parse(z)).ToArray();
            xy[i] = new Pair(
                Math.Max(line2[0], line2[1]),
                Math.Min(line2[0], line2[1]));
        }

        xy = xy.OrderBy(z => z.Blue).ToArray();
        
        var Rmax = xy.Select(x => x.Red).Max();
        var Rmin = xy.Select(x => x.Red).Min();
        var Bmax = xy[N - 1].Blue;
        var Bmin = xy[0].Blue;

        var MAX = Rmax;
        var MIN = Bmin;

        var Pmin = (Rmax - Rmin) * (Bmax - Bmin);

        var SwappedBlueMin = long.MaxValue;
        var SwappedBlueMax = long.MinValue;

        for (int i = 0; i <= N - 2; i++)
        {
            xy[i].Swap();
            SwappedBlueMin = Math.Min(SwappedBlueMin, xy[i].Blue);
            SwappedBlueMax = Math.Max(SwappedBlueMax, xy[i].Blue);

            Rmin = MIN;
            Bmin = Math.Min(SwappedBlueMin, xy[i + 1].Blue);
            Bmax = Math.Max(SwappedBlueMax, xy[N - 1].Blue);

            var P = (Rmax - Rmin) * (Bmax - Bmin);

            Pmin = Math.Min(Pmin, P);
        }

        Console.WriteLine(Pmin);
    }
}

Measured memory_bytes: 36344
#include<iostream>
using namespace std;
int main(){
    int n,i,max,min;
    long long sum=0;
    int a[10000];
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>a[i];
        sum=sum+a[i];
        if(i==1){
            max=a[i];
            min=a[i];
        }
        else{
            if(max<a[i]){
                max=a[i];
            }
            if(min>a[i]){
                min=a[i];
            }
        }
    }
    cout<<min<<" "<<max<<" "<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3140
#include <iostream>

auto sum(int n) -> int {
  return (n/10000)%10 + (n/1000)%10 + (n/100)%10 + (n/10)%10 + n%10;
}

int main() {
  int n,a,b,s=0;
  std::cin >> n >> a >> b;
  for(int k=1; k <= n; k++) {
    int x = sum(k);
    if(a<=x && x <=b) {
      s += k;
    }
  }
  std::cout << s << std::endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()
flg = 0
res = 1
for i in range(n-1):
  if flg == 0 and s[i] == s[i+1]:
    flg = 1
  elif flg == 1 and s[i] == s[i+1]:
    pass
  else:
    flg = 0
    res += 1
print(res)

Measured memory_bytes: 3316
//                                ** ALLAH **
//                        who is Hussain? -> whoishussain.org

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1000000007;
inline int in(){ int x; scanf("%d",&x); return x; }
const int N = 200100;
int n, k;
string s;
int32_t main(){
        cin >> n >> k;
        cin >> s;

        int t = k, c = 1;
        k = 0;
        for(; t && k < n;){
                if( s[k] == 'A'+(k%2) && c ) s[k] = 'A' + (1-k%2), c = 0;
                else k++, c = 1;
                t--;
        }
        if( k == n ) { if( n%2 == 1 ) cout << char('A' + t%2); else cout << 'B';for(int i = 1;i < n; i++) cout << char('A'+(n-i-1)%2); cout << endl;return 0; } 
        for(int i = k; i < n; i++) cout << (k%2==1?(s[i]=='A'?'B':'A'):s[i]);
        for(int i = 0;i < k; i++) cout << char('A'+(k-i-1)%2); 
        cout << endl;
}

Measured memory_bytes: 772
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int f(int x) {
  int n = 1;
  while (true) {
    if(10*(n-1) < x && x <= 10*n) {
      break;
    }
    n++;
  }
  return 10*n;
}

int g(int x) {
  return f(x) - x;
}

int main() {
  vector<int> a(5);
  rep(i, 5) cin >> a[i];
  
  vector<int> b(5);
  rep(i, 5) {
    b[i] = f(a[i]);
  }

  vector<int> p(5);
  rep(i, 5) p[i] = i;

  int ans = 1000000000;

  do {
    int tmp = 0;
    rep(i, 4) {
      int j = p[i];
      tmp += b[j];
    //   if(i == 3) cout << p[i] << endl;
    //   else cout << p[i] << " ";
    // 
    }
    tmp += a[p[4]];
    ans = min(tmp, ans);
  } while(next_permutation(p.begin(), p.end()));

  cout << ans << endl;

  return 0;
}

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

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

    int x = 800 * N;
    int y = 200 * (N / 15);

    cout << x - y << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
#include<numeric>
#include<set>
#include<iterator>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)
int INF=1e9;
const long long mod=1e9+7;
typedef long long ll;
int main(){
    int n;
    set<int>a,b;
    cin>>n;
    while(n--){
        int x;
        cin>>x;
        a.insert(x);
    }
    cin>>n;
    while(n--){
        int x;
        cin>>x;
        b.insert(x);
    }
    vector<int>c;
    set_difference(a.begin(),a.end(),b.begin(),b.end(),back_inserter(c));
    for(int i=0;i<c.size();i++)cout<<c[i]<<endl;
    return 0;
}


Measured memory_bytes: 22620
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  long long a, b, c;
  std::cin >> a >> b >> c;

  long long l = 4 * a * b;
  long long r = (c - a - b) * (c - a - b);

  if (c - a - b < 0) {
    std::cout << "No" << std::endl;
  } else if (l < r)
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
int num[10] = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};

map<int, bool> canuse;

string bigger(string &s, string &t)
{
    if (s.size() > t.size())
    {
        return s;
    }
    if (s.size() < t.size())
    {
        return t;
    }
    return max(s, t);
}

int main()
{
    int n, m;
    cin >> n >> m;
    rep(i, m)
    {
        int x;
        cin >> x;
        canuse[x] = true;
    }
    vector<string> dp(n + 1, "");
    rep(i, n)
    {
        if (i != 0 && dp[i] == "")
            continue;
        rep(j, 10)
        {
            if (canuse[j] == false)
            {
                continue;
            }
            if (i + num[j] <= n)
            {
                string newstr = dp[i] + (char)('0' + j);
                //sort(ALL(newstr), greater<char>());
                //cerr << i << "->" << i + num[j] << " : " << dp[i] << " -> " << newstr << endl;
                dp[i + num[j]] = bigger(dp[i + num[j]], newstr);
            }
        }
    }
    //rep(i, n) cerr << dp[i] << endl;
    sort(ALL(dp[n]), greater<char>());
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 43648
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <utility>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> grid(w);
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        if (s.find("#") != string::npos) {
            for (int j = 0; j < w; j++) {
                grid[j].push_back(s[j]);
            }
        }
    }
    vector<vector<char>> ans(grid[0].size());
    for (int x = 0; x < w; x++) {
        if (find(grid[x].begin(), grid[x].end(), '#') != grid[x].end()) {
            for (int y = 0; y < grid[x].size(); y++) {
                ans[y].push_back(grid[x][y]);
            }
        }
    }

    for (int y = 0; y < ans.size(); y++) {
        for (auto&& e : ans[y]) {
            cout << e;
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
h,n=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(n)]

DP=[float("inf")]*(h+max(AB)[0]+1)
DP[0]=0
for i in range(h+1):
    for a,b in AB:
        DP[i+a]=min(DP[i+a],DP[i]+b)

print(min(DP[h:]))

Measured memory_bytes: 43356
import sys

def main():
    lines = sys.stdin.readlines()
    n = int(lines[0])

    repo = {}
    for i in range(1, n + 1):
        command, acgt = lines[i].split()
        if command[0] == 'i':
            if acgt not in repo:
                repo[acgt] = 0
        elif command[0] == 'f':
            if acgt in repo:
                print('yes')
            else:
                print('no')
    return


main()


Measured memory_bytes: 108376
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	
	public static final int C = 0;
	public static final int V = 1;
	public static final int D = 2;
	public static final int L = 3;
	public static void main(String[] args) {
		doIt();

	}
	
	public static void doIt(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			int m = sc.nextInt();
			int[][] bydol = new int[n][4];
			for(int i = 0; i < n; i++){
				sc.nextLine();
				sc.nextLine();
				bydol[i][C] = sc.nextInt();
				bydol[i][V] = sc.nextInt();
				bydol[i][D] = sc.nextInt();
				bydol[i][L] = sc.nextInt();
			}
			int max = 0;
			//各能力値に付いて
			for(int i = 1; i <= 3; i++){
				int dp[][] = new int[n + 1][m + 1];
				//各BYDOLについて
				for(int j = 1; j < n + 1; j++){
					//各費用に付いて
					for(int k = 1; k < m + 1; k++){
						//各個数について
						dp[j][k] = dp[j - 1][k];
						for(int l = 1; l*bydol[j - 1][C] <= k; l++){
							dp[j][k] = Math.max(dp[j][k], dp[j - 1][k - l*bydol[j - 1][C]] + l*bydol[j - 1][i]);
						}
					}
				}
				if(max < dp[n][m]){
					max = dp[n][m];
				}
			}
			System.out.println(max);
		}
	}

}

Measured memory_bytes: 17000
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;

int n;
string s;
int dw[310000];
int de[310000];

int main()
{
	cin >> n;
	cin >> s;
	dw[0] = 0;
	de[0] = 0;
	for (int i = 1; i <= n; i++) {
		if (s[i - 1] == 'W') {
			dw[i] = dw[i - 1] + 1;
			de[i] = de[i - 1];
		}
		else {
			de[i] = de[i - 1] + 1;
			dw[i] = dw[i - 1];
		}
	}
	int mn=INF;
	for (int i = 1; i <= n; i++) {
		int nishi = dw[i - 1];
		int higashi = de[n] - de[i];
		mn = min(mn, nishi + higashi);
	}
	cout << mn << endl;




	return 0;
}


Measured memory_bytes: 3076
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    sort(a.begin(), a.end());
    a[0] = a[2] - a[0];
    a[1] = a[2] - a[1];

    int r = 0;
    if (a[0] % 2 == a[1] % 2) {
        r = (a[0] + a[1]) / 2;
    } else {
        r = (a[0] + a[1] - 1) / 2 + 2;
    }

    cout << r << endl;

    return 0;
}

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

typedef long long ll;

const ll INF = 1e18L + 5;

int main() {
	int a, W;
	scanf("%d%d", &a, &W);
	vector<int> w(a), v(a);

	for (int i = 0; i < a; i++) {
		scanf("%d%d", &w[i], &v[i]);
	}

	int max_value = 0;
	for (int x : v)
		max_value += x;

	vector<ll> dp(max_value + 1, INF);
	dp[0] = 0;
	for (int i = 0; i < a; i++) {
		for (int j = max_value - v[i]; j >= 0 ; j--) {
			dp[j + v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
		}
	}

	ll ans = 0;
	for (int i = 0; i <= max_value; i++)
		if (dp[i] <= W)
			ans = max(ans, (ll) i);

	printf("%lld\n", ans);
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    public struct Pair { public int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } }
    public static void Solve()
    {
        int N = NextInt();
        int[] dp = new int[N + 1];
        dp[0] = 0;
        for (int i = 1; i <= N; i++)
        {
            dp[i] = dp[i - 1] + 1;
            int p6 = 6;
            while (i - p6 >= 0)
            {
                dp[i] = Math.Min(dp[i], dp[i - p6] + 1);
                p6 *= 6;
            }
            int p9 = 9;
            while (i - p9 >= 0)
            {
                dp[i] = Math.Min(dp[i], dp[i - p9] + 1);
                p9 *= 9;
            }
        }
        Console.WriteLine(dp[N]);

    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}

public class Input
{
    public const long MOD = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 13344
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)

//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

void solve()
{
    IN(n, a, b);
    ll m = n % (a + b);
    if (m <= a)
        cout << m + n / (a+b) * a << endl;
    else
        cout << a + n / (a+b) * a << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 1e5;

int n, r = 0;
string s;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> s;
    for0(i, n - 2)
    {
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
        {
            ++r;
        }
    }
    cout << r;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,a[100000],ans;
map<ll,ll>m;
int32_t main(){
CODE_START;
cin>>n;
for(ll i=0;i<n;i++)
{
    cin>>a[i];
    if(m[a[i]]==0){
        m[a[i]]++;
        ans++;
    }else {
    m[a[i]]=0;
    ans--;
    }
}
cout<<ans;
}


Measured memory_bytes: 7296
int main(void){
    long long int h,n,i,j,sum;
 
    scanf("%lld",&h);
    scanf("%lld",&n);

   long long int s[n];

    for(i=0; i<n; i++){
        scanf("%lld",&s[i]);
    }

    sum = 0;

    for(j=0; j<n; j++){
        sum = sum + s[j];
    }

    if(h<=sum){
        printf("Yes");
    }

    else{
        printf("No");
    }

    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

string S[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

int main() {
    string s;
    cin >> s;
    REP(i, 7) {
        if (S[i] == s) {
            cout << 7 - i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
N,W = map(int,input().split())
w,v = [],[]
for i in range(N):
    a,b = map(int,input().split())
    w.append(a)
    v.append(b)
m = sum(v)
dp=[[float("inf")]*(m+1) for i in range(N+1)]
dp[0][0] = 0

for i in range(N):
    for j in range(m+1):
        if j-v[i] >=0:
            dp[i+1][j] = min(dp[i][j-v[i]] + w[i],dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]
ans = 0
for j in range(m+1):
        if dp[N][j] <= W:
            ans = max(ans,j)
print(ans)

Measured memory_bytes: 308296
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int x = sc.nextInt();
    int y = sc.nextInt();
    
    System.out.println(Math.min(x,y) + " " + Math.max(x + y - N, 0));
  }
}

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

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

    int s(1000000),b(0);
    for(int i=0;i<n;i++){
        int x;  cin >> x;

        s = min(s,x);
        b = max(b,x);
    }

    if((b-s)%2==0)
        cout << (b-s)/2 << endl;
    else
        cout << (b-s)/2+1 << endl;

    return 0;
}


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

int main() {
  int n, count;
  cin >> n;
  count = 1;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p.at(i);
  }
  int min = p.at(0);
  for (int i = 1; i < n; i++) {
    if (min > p.at(i)) {
      min = p.at(i);
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3916
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <numeric>
#include <list>
#include <queue>
#include <cmath>

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

using namespace std;


int main()
{
    long double a, b, x;
    long double res;
    cin >> a >> b >> x;
    if (a * a * b / 2.0 <= x) {
        long double y = ((2.0 * x) / (a * a)) - 2.0 * b;
        res = abs(atan(y / a));
    } else {
        long double y = (2.0 * x) / (a * b);
        res = abs(atan(b / y));
    }
    printf("%.10llf\n",  res * 180.0 / M_PI);
}


Measured memory_bytes: 764
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main(void)
{
    int N, X;
    cin >> N >> X;

    vector<int> L(N);
    for (int i = 0; i < N; i++)
        cin >> L[i];

    vector<int> imos(N + 1, 0);
    for (int i = 0; i < N; i++)
        imos[i + 1] += imos[i] + L[i];

    int ans = upper_bound(imos.begin(), imos.end(), X) - imos.begin();
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define loop(i,L,R) for(int i=(L);i<=(R);i++)
#define rept(i,L,R) for(int i=(L);i<(R);i++)
#define isc(n) scanf("%d",&n)
#define llsc(n) scanf("%lld",&n)
#define dsc(n) scanf("%lf",&n)
#define enl cout<<endl
#define pb(x) push_back(x)
#define xx first
#define yy second
typedef long long ll;
typedef pair<int,int>PI;
typedef pair<pair<int,int>,int>PII;

int main()
{
	int n;
	cin>>n;
	int ans=24+(24-n);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

# define INF 0x3f3f3f3f

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

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

  int N;
  cin >> N;

  ll m = 0, a = 0, r = 0, c = 0, h = 0;

  REP(i, N) {
    string name;
    cin >> name;
    if (name[0] == 'M') m++;
    if (name[0] == 'A') a++;
    if (name[0] == 'R') r++;
    if (name[0] == 'C') c++;
    if (name[0] == 'H') h++;
  }
  ll ans = 0;
  ans += m * a * r;
  ans += m * a * c;
  ans += m * a * h;
  ans += m * r * c;
  ans += m * r * h;
  ans += m * c * h;
  ans += a * r * c;
  ans += a * r * h;
  ans += a * c * h;
  ans += r * c * h;

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


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

#define min3(a,b,c)   min(a,min(b,c))
#define max3(a,b,c)   max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)    __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)       __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)       __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b)     __gcd(a,b)
#define lcm(a,b)     (a*(b/gcd(a,b)))

#define pb   push_back
#define PI   M_PI
#define endl "\n"
#define sc   scanf
#define pf   printf

#define ll  long long
#define ull unsigned long long

#define W(t)            while(t--)
#define rep1(i,n)       for(int i = 0; i < n; i++)
#define rep2(a,b)       for(int i = a; i <= b; i++)
#define repit(it,type)  for(it = type.begin(); it != type.end(); it++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
using namespace __gnu_cxx;

int main()
{
     IOS
     ll a,b;
     cin>>a>>b;
     cout<<a*b<<endl;

     return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef std::pair<int, int> pii;
typedef unsigned long ul;

int main() {
    map<string, int> m = {make_pair("MON", 1), make_pair("TUE", 2),
                          make_pair("WED", 3),make_pair("THU", 4),make_pair("FRI", 5),
                          make_pair("SAT", 6), make_pair("SUN", 0)};
    string s;
    cin >> s;

    int ans = 7 - m[s];
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#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>;
  
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int r; cin >> r;
  cout << r * 2 * 3.141592653589793 << endl;
}


Measured memory_bytes: 3804
#include <algorithm>
#include <map>
#include <iostream>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iterator>
#include <array>
typedef long long int ll;
using namespace std;
#define maxN 200007
#define mod 1000000007

string s;

void solve() {
	if(s[0]=='7'||s[1]=='7'||s[2]=='7'){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>s;
	solve();
}

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

int main(){
    int n;
    cin>>n;
    
    map<int,int> a;
    int c;
    rep(i,n){
        cin>>c;
        a[c]++;//現れた回数をカウント
    }
    
    int amax = a.rbegin()->first;
    
    vi sieve(amax+1,0);
    int ans = 0;
    
    for(auto p: a){
        int x = p.first;
        int count = p.second;
        for(int i=x; i<=amax; i += x){
            sieve[i] += count;
        }
        
        if(sieve[x] == 1)//約数は自分自身のみ
            ans++;
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 16464
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<deque>
#include<functional>
#include<ctime>
#include<cassert>
#include<cstring>
#include<unordered_map>
using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<=b;++i)
#define fj(a,b) for(int j=a;j<=b;++j)
#define fo(a,b) for(int o=a;o<=b;++o)
#define fdi(a,b) for(int i=a;i>=b;--i)
#define fdj(a,b) for(int j=a;j>=b;--j)
#define fdo(a,b) for(int o=a;o>=b;--o)
#define pb push_back
#define mp make_pair
#ifdef LOCAL
#define err(format, ...) fprintf(stderr, format, __VA_ARGS__);
#else
#define err(format, ...) while(false) {}
#endif
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef double ld;
typedef vector<int> vi;

template<class T> bool uin(T &a, T b){ return (a > b ? a = b, true : false); }
template<class T> bool uax(T &a, T b){ return (a < b ? a = b, true : false); }

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

int n, m;

void solve() {
	if (n == 1 && m == 1) {
		printf("1\n");
		return;
	}
	ll ans = 0;
	if (n == 1) {
		ans = max(0LL, (ll) m - 2);			
	}	else if (m == 1) {
		ans = max(0LL, (ll) n - 2);
	} else {
		if (n == 2 || m == 2) {
			ans = 0;
		}	else {
			ans = (ll) (n - 2) * (m - 2);
		}
	}
	printf("%lld\n", ans);
}

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

	scanf("%d %d", &n, &m);	
	solve();		

	
#ifdef LOCAL
	fprintf(stderr, "ELAPSED TIME: %.3lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 256
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
list1 = [a, b, c, d, e]
result = 0
last = 10
for i in range(0, 5):
    tmp = math.floor(list1[i] / 10) * 10
    if last > list1[i] - tmp and list1[i]-tmp != 0:
        last = list1[i]-tmp
    result += math.ceil(list1[i]/10)*10

print("{}".format(result-(10-last)))


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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, k, n) for (int i = k; i < n; ++i)
#define fore(i,a) for (auto &i : a)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int mod = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = LLONG_MAX / 2;
const static double eps = 1e-10;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<llong> 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<llong> AB;
    rep(i, x) {
        rep(j, y) {
            AB.push_back(A[i] + B[j]);
        }
    }

    sort(allr(AB));

    vector<llong> ABC;
    rep(i, min(k, (int)AB.size())) {
        rep(j, z) {
            ABC.push_back(AB[i] + C[j]);
        }
    }

    sort(allr(ABC));
    
    rep(i, k) cout << ABC[i] << endl;

    return 0;
}

Measured memory_bytes: 43112
#include <stdio.h>
#include <stdlib.h>

int main()
{
	char word[5];
	int num[5];
	int count1 = 0;


	scanf("%s", word);

	for (int i = 0; i < 4; i++)
		num[i] = word[i];

	if (((num[0] == num[1]) && (num[2] == num[3])) || ((num[0] == num[3]) && (num[1] == num[2])) || ((num[0] == num[2]) && (num[1] == num[3])))
	{
		if ((num[0] != num[1]) || (num[0] != num[2]))
			printf("Yes\n");
		else
			printf("No\n");
	}
	else
		printf("No\n");
	

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define loop(n, i) for(int i=0;i<n;i++)
#define loop1(n, i) for(int i=1;i<=n;i++)
#define rloop(n, i) for(int i=n;i;i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;

int n;
ll k;
V<int> A;
V<int> idx[200010];

int head_idx(int i) {
    while (1) {
        if (i >= n) return -1;

        auto itr = upper_bound(idx[A[i]].begin(), idx[A[i]].end(), i);
        if (itr == idx[A[i]].end()) {
            return i;
        }
        i = (*itr) + 1;
    };
}

// int head(int st_c) {
//     int i = idx[st_c][0];
// 
//     while (1) {
//         if (i >= n) return -1;
// 
//         auto itr = upper_bound(idx[A[i]].begin(), idx[A[i]].end(), i);
//         if (itr == idx[A[i]].end()) {
//             if (i + 1 >= n) return -1;
//             return A[i + 1];
//         }
//         i = (*itr) + 1;
//     };
// }

V<int> ans;

void solve(int i) {
    while (1) {
        if (i >= n) return;

        auto itr = upper_bound(idx[A[i]].begin(), idx[A[i]].end(), i);
        if (itr == idx[A[i]].end()) {
            ans.push_back(A[i]);
            i++;
        } else {
            i = (*itr) + 1;
        }
    }
}

int main() {
    cin >> n >> k;
    k--;
    A.resize(n);
    loop (n, i) cin >> A[i];
    loop (n, i) {
        idx[A[i]].push_back(i);
    }

    // int vis[200010] = {};

    V<int> I;
    int nxt = 0;
    while (1) {
        int crr = head_idx(nxt);
        I.push_back(crr);
        if (crr == -1) break;

        nxt = idx[A[crr]][0] + 1;
    }

    // for (int v : I) {
    //     cout << v << " ";
    // }
    // cout << endl;

    k = k % I.size();

    int st = I[k];
    if (st == -1) {
        cout << endl;
        return 0;
    }

    // cout << st << endl;
    solve(st);

    if (ans.size() == 0) {
        cout << endl;
        return 0;
    }

    cout << ans[0];
    for (int i = 1; i < ans.size(); i++) {
        cout << " " << ans[i];
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 14968
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int N;
vector<vector<int>> G;
vector<int> c;
vector<int> ans;
int cnt = 0;

void dfs(int u, int p){
	ans[u] = c[cnt];
	cnt++;
	for(int v : G[u]){
		if(v == p) continue;
		dfs(v,u);
	}
}

int main(){
	cin >> N;
	G.resize(N);
	ans.resize(N);
	rep(i,N-1){
		int a,b; cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	c.resize(N);
	rep(i,N) cin >> c[i];
	sort(c.begin(),c.end(),greater<int>());
	dfs(0,-1);
	ll sum = 0;
	repr(i,1,N) sum += c[i];
	cout << sum << endl;
	rep(i,N){
		if(i) cout << " ";
		cout << ans[i];
	}
	cout << endl;

}



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

int main()
{
    string S, T;
    cin >> S >> T;
    int ans = 0;
    for (size_t i = 0; i < S.size(); i++)
    {
        if (S[i] != T[i])
        {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3852
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#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)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(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()
{
	char a, b; cin >> a >> b;
	cout << (a == b ? 'H' : 'D') << endl;
}

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

using namespace std;

array<char,4> plane[6];
int fn;

void rp(int x,int n){
  while(n--){
    int t=plane[x][1];
    int tn[]={1,0,2,3};
    for(int i=0;i<3;i++){
      plane[x][tn[i]]=plane[x][tn[i+1]];
    }
    plane[x][3]=t;
  }
}

void cf(char c){
  while(c!="FURBDL"[fn]){
    auto t=plane[0];
    int x[][4]={{0,4,2,5},{0,1,2,3}};
    int *cx=x[fn%2];
    for(int i=0;i<3;i++){
      plane[cx[i]]=plane[cx[i+1]];
    }
    plane[cx[3]]=t;
    if(fn%2==0){
      for(int i=2;i<=4;i+=2){
	for(int j=0;j<2;j++){
	  swap(plane[i][j],plane[i][j^3]);
	}
      }
    }
    rp(3+fn%2,1);
    rp(1+fn%2*4,3);
    fn=(fn+1)%6;
  }
}

int main(){
  for(int i=0;i<6;i++){
    fill(begin(plane[i]),end(plane[i]),"ybwgro"[i]);
  }
  for(char c;cin>>c;){
    cf(c);
    rp(0,1);
    int rt=plane[1][0];
    int rb=plane[1][2];
    for(int i=0;i<3;i++){
      int pn[]={1,4,3,5};
      int tn[]={0,2,3,1};
      int bn[]={2,3,1,0};
      plane[pn[i]][tn[i]]=plane[pn[i+1]][tn[i+1]];
      plane[pn[i]][bn[i]]=plane[pn[i+1]][bn[i+1]];
    }
    plane[5][1]=rt;
    plane[5][0]=rb;
  }
  cf('F');
  char g[6][8];
  fill(g[0],g[6],'.');
  for(int i=0;i<6;i++){
    int x[]={2,4,6,0,2,2};
    int y[]={2,2,2,2,0,4};
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++){
	g[y[i]+j][x[i]+k]=plane[i][j*2+k];
      }
    }
  }
  for(auto e:g){
    for(int i=0;i<8;i++){
      cout<<e[i];
    }
    cout<<endl;
  }
}

Measured memory_bytes: 1144
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void solve() throws Exception {
		String s = scanString();
		int w = 0;
		long ans = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'W') {
				ans += i - w;
				++w;
			}
		}
		out.print(ans);
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 25172
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<set>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define INF 1000000100
#define rep(i,n) for (int i=0;i<n;i++)

int main(){
    int A,B;
    cin >> A >> B;
    if(A<10 && B<10) cout << A*B << endl;
    else cout << -1 << endl;
    return 0;
}



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

int main(){
	long long n, a[10000] = {0};
	long long  min, max, sum = 0;
	
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	min = max = a[0];
	for(int i = 0; i < n; i++){
		if(min > a[i]){
			min = a[i];
		}
		if(max < a[i]){
			max = a[i];
		}
		sum += a[i];
	}
	
	cout << min << ' ' << max << ' ' << sum << endl;
	
	return 0;
}

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

int main(){
  int N; 
  int count = 0;
  cin >> N;
  char c;
  for (int i = 0; i < N ;i++){
    cin >> c;
    if ( c == 'Y'){
        count++;
      }//if
  }//for 
  
  if (count !=0){
    cout << "Four" <<endl;
  }
  else { 
    cout << "Three" <<endl;
  }
}

Measured memory_bytes: 256
// tested by Hightail: https://github.com/dj3500/hightail
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <cassert>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cout<<"["<<__LINE__<<"] "<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (__typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

int v[1 << 26];

int main () {
   string s;
   cin >> s;
   int n = SZ(s);
   FOR(mask,1<<26) v[mask] = INF;
   v[0] = 0;
   int cur = 0;
   REPD(a,n,1) {
      int resa = INF;
      cur ^= 1 << (s[a-1] - 'a');
      REMIN(resa, 1 + v[cur]);
      FOR(k,26) REMIN(resa, 1 + v[cur ^ (1 << k)]);
      REMIN(v[cur], resa);
      if (a == 1) {
         pisz(resa);
      }
   }
}

Measured memory_bytes: 262788
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    a, b, k = map(int, input().split())
    if a >= k:
        print(a - k, b)
    elif a < k <= a + b:
        print(0, a + b - k)
    else:
        print(0, 0)


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


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define sz int(1e5+1)
int main()
{
    int N, W; cin >> N >> W;
    int vi,wi;

    
    vector <long long> dp (sz+1, INT_MAX);
    dp[0]=0;
    int sum=0;
    for(int i = 0; i < N; i++){
        cin >> wi >> vi;
        sum+=vi;
        for(int j = sz; j >= vi; j--){
            dp[j] = min(dp[j], dp[j-vi]+wi);
        }
    }
    int ans=0;
    for(int i = 1; i <= sum; i++){
        if(dp[i]<=W)
            ans=max(i, ans);
    }
    cout<<ans<<endl;



    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
 
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		if (A - B > 0) {
			System.out.println("safe");
		} else {
			System.out.println("unsafe");
		}
	}
}

Measured memory_bytes: 35672
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>

using namespace std;

int n;

int dfs(int sum, int num, int use) {
    if (sum == n) return 1;
    if (use >= 4) return 0;
    
    int ret = 0;
    for (int i = num; i*i <= n; i++) {
        if (sum + i*i > n) break;
        ret += dfs(sum + i*i, i, use+1);
    }
    return ret;
}

int main(void){
    while (cin >> n && n) {
        cout << dfs(0,1,0) << endl;
    }
    
    return 0;
}

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

#define ll long long

using namespace std;

void solve() {
    int n, k;
    cin >> n >> k;

    vector<ll> v(n);
    for (int i = 0; i < n; ++i)
        cin >> v[i];

    int p0 = 0, p1;
    p1 = p0 + k;

    for (; p1 < n; ++p0, ++p1) {
        if (v[p1] > v[p0])
            cout << "Yes\n";
        else
            cout << "No\n";
    }

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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

    int t = 1;
    // cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 4780
#include <stdio.h>
#define MAX 100000
int main(void)
{
	long n, k, a, b, i;
    long cnt[MAX + 1] = {0};
    scanf("%ld %ld", &n, &k);
    for (i = 0; i < n; i++) {
        scanf("%ld %ld", &a, &b);
        cnt[a] += b;
    }
    for (i = 1; i <= MAX; i++) {
        if (k <= cnt[i]) {
            printf("%ld\n", i);
            break;
        }
        k -= cnt[i];
    }
    return 0;
}

Measured memory_bytes: 896
S=input()
N=int(input())
a=len(S)
b=0
for i in range(a-1):
 if S[i]==S[i+1]:
  b+=0.5
 else:
  b=int(b+0.5)
b=int(b+0.5)
S2=S*3
a2=a*3
b2=0
for i in range(a2-1):
 if S2[i]==S2[i+1]:
  b2+=0.5
 else:
  b2=int(b2+0.5)
b2=int(b2+0.5)
c=int((b2-b*3)/2*(N-1)+0.5)+b*N
print(c)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        int c = stdIn.nextInt();
        int d = stdIn.nextInt();
        //int num[] = new int[3];
        //String s = stdIn.next();
        //char c[] = s.toCharArray();
        //boolean flag = true;
        
        if(d >= Math.abs(a - c)){
            System.out.println("Yes");
        }else{
            if(d >= Math.abs(a - b) && d >= Math.abs(b - c)){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }
        
        
        //System.out.println();
        //System.out.print();
    }
}


Measured memory_bytes: 21844