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

using namespace std;

#define long long long
#define INF ((long) 2e18)
#define MOD ((long) (1e9 + 7))
#define umap unordered_map

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

    long t = 1;
    //cin >> t;

    while (t--) {
        string s;
        cin >> s;

        vector<string> week = {
            "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"
        };
        for (long i = 0; i < 7; i++) {
            if (week[i] == s) {
                long count = 1;
                for (long j = (i+1) % 7; week[j] != "SUN"; j = (j + 1) % 7) {
                    count++;
                }
                printf("%lld\n", count);
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3700
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        init();

        int n = nextInt();

        int lookingFor = 1;
        for (int i = 0; i < n; i++) {
            if (nextInt() == lookingFor) lookingFor++;
        }

        System.out.println((lookingFor == 1 ? -1 : n - lookingFor + 1));
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
}

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

int n,a,ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int len=1,ii=i;
		for(int j=1;j<=6;j++)
		{
			if(ii/10<=0) break; 
			len++;
			ii/=10;
		}
		if(len%2==1) ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
from sys import stdin
from operator import itemgetter

input = stdin.readline

N = int(input())

ab = [[int(j) for j in input().split()] for i in range(N)]

cd = [[int(j) for j in input().split()] for i in range(N)]


def main():
    # y 降順
    ab.sort(key=itemgetter(1), reverse=True)

    # x 昇順
    cd.sort(key=itemgetter(0))

    # ペアになった赤
    done = [False] * N

    ans = 0

    for blue in cd:
        i = 0

        for red in ab:
            if not done[i] and red[0] < blue[0] and red[1] < blue[1]:
                done[i] = True
                ans += 1
                break

            i += 1

    print(ans)
    return


main()


Measured memory_bytes: 3064
#include<stdio.h>
#define INFTY (1 << 21)
#define MAX 100
#define White 0
#define Gray 1
#define Black 2
void dijkstra();
int n, M[MAX][MAX];

int main(){
  int u,v,k,c;
  int i,j;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      M[i][j] = INFTY;
    }
  }

  for(i = 0; i < n; i++){
    scanf("%d %d",&u,&k);
    for(j = 0; j < k; j++){
      scanf("%d %d",&v,&c);
      M[u][v] = c;
    }
  }

  dijkstra();

  return 0;
}

void dijkstra(){
  int i,j;
  int color[MAX],d[MAX],p[MAX];
  int min,u,v;
  for(i = 0; i < n; i++){
    color[i] = White;
    d[i] = INFTY;
    p[i] = -1;
  }

  d[0] = 0;

  while(1){
    min = INFTY;
    for(i = 0; i < n; i++){
      if(color[i] != Black && d[i] < min){
	min = d[i];
	u = i;
      }
    }

    if(min == INFTY) break;
    color[u] = Black;

    for(v = 0; v < n; v++){
      if(color[v] != Black && M[u][v] != INFTY){
	if(d[u] + M[u][v] < d[v]){
	  d[v] = d[u] + M[u][v];
	  p[v] = u;
	  color[v] = Gray;
	}
      }
    }
  }
  for(i = 0; i < n; i++){
    printf("%d %d\n",i,d[i]);
  }
}

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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    string S;
    cin >> S;
    // そのマスを含めて以左に出現した白、黒の数
    vector<pair<int, int>> V; V.reserve(N + 1);
    V.emplace_back(0, 0);
    REP(i, N){
        auto before = V.back();
        if (S[i] == '.'){ // White
            V.emplace_back(before.first + 1, before.second);
        }else{ // Black
            V.emplace_back(before.first, before.second + 1);
        }
    }
    // for (auto& e : V){
    //     cout << e.first << " " << e.second << endl;
    // }
    int result = INT_MAX;
    REP(i, N + 1){
        const int right_white = V.back().first - V[i].first;
        const int left_black = V[i].second;
        result = min(result, right_white + left_black);
    }
    cout << result << endl;
}


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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

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

	vector<int> n(3);
	cin >> n[0] >> n[1] >> n[2];

	sort(n.begin(), n.end());
	int res = n[2] - n[1];
	int tmp = n[2] - (n[0] + res);
	if (tmp & 1)
		res += ceil(tmp / 2.0) + 1;
	else
		res += (tmp / 2);

	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
k = input()
dismatch = 0
num = len(k)//2 
if len(k) % 2 == 1:
  num += 1
  
n = 0
m = len(k)-1
for i in range(num):
  if k[n] != k[m]:
    dismatch += 1
  n += 1
  m -= 1
print(dismatch)

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

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

void test_case() {
    int n, m;
    cin >> n >> m;
    set<int> done;
    map<int, int> cnt;
    for (int i = 1; i <= m; ++i) {
        int p;
        string s;
        cin >> p >> s;
        if (s == "AC") {
            done.insert(p);
        } else {
            if (!done.count(p)) {
                ++cnt[p];
            }
        }
    }
    cout << done.size() << " ";
    int other = 0;
    for (auto &p : cnt) {
        if (done.count(p.first)) {
            other += p.second;
        }
    }
    cout << other << "\n";
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    test_case();
    return 0;
}


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

using namespace std;

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define pb emplace_back
#define ll long long
#define ld long double

const int INF = 2e9 + 1;
const ll INFLL = 1e18 + 1;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = (n / (a + b)) * a;
    ll kek = n % (a + b);
    cout << ans + min(kek, a);
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int A,B;
    cin >> A >> B;
    cout << 6-A-B << endl;



}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b,c;
	
	scanf("%d %d %d",&a,&b,&c);
	
	if((a < b && b < c) || (a == b && (b < c || a < c))){
		printf("%d %d %d\n",a,b,c);
	}
	else if((a < c && c < b) || (a == c && (c < b || a < b))){
		printf("%d %d %d\n",a,c,b);
	}
	else if((b < a && a < c) || (b == a && (a < c || b < c))){
		printf("%d %d %d\n",b,a,c);
	}
	else if((b < c && c < a) || (b == c && (b < a || c < a))){
		printf("%d %d %d\n",b,c,a);
	}
	else if((c < a && a < b) || (c == a && (c < b || a < b))){
		printf("%d %d %d\n",c,a,b);
	}
	else if((c < b && b < a) || (c == b && (c < a || b < a))){
		printf("%d %d %d\n",c,b,a);
	}
	else if( a == b && b == c){
		printf("%d %d %d\n",a,b,c);
	}
	return(0);
}

Measured memory_bytes: 2752
#include <iostream>
using namespace std;
int dx[] = {0, 1};
int dy[] = {1, 0};
int n, m, flag = 0, flg = 0;
string s[100];
bool visited[100][100];
void dfs(int i, int j)
{
    if (i >= n || j >= m || s[i][j] == '.')
        return;
    visited[i][j] = true;
    if (i == (n - 1) && j == (m - 1))
        flag = 1;
    for (int k = 0; k < 2; k++)
    {
        if (flag)
            return;
        dfs(dx[k] + i, dy[k] + j);
    }
    if (!flag)
        visited[i][j] = false;
}
int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        cin >> s[i];
    }
    dfs(0, 0);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            if (s[i][j] == '#' && !visited[i][j])
            {
                flg = 1;
                break;
            }
        }
    }
    if (flg)
        cout << "Impossible" << endl;
    else
        cout << "Possible" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var nm = IO.RSLong;
            var n = nm[0];
            var m = nm[1];

            if (Abs(n - m) > 1)
            {
                WriteLine(0);
                return;
            }

            long perm_n = Permutation(n);
            long perm_m = Permutation(m);

            long ans;
            if (n == m)
            {
                ans = Mod.Multi(perm_m, perm_n);
                ans = Mod.Multi(ans, 2);
                WriteLine(ans);
            }
            else
            {
                WriteLine(Mod.Multi(perm_m, perm_n));
            }
        }

        public static long Permutation(long n)
        {
            long ret = 1;
            for (long i = 1; i <= n; i++)
            {
                ret = Mod.Multi(ret, i);
            }
            return ret;
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 19184
n = int(input())
v = list(map(int, input().split()))

vo = [0]*(10**5+1)
ve = [0]*(10**5+1)

for i in range(n):
    if i % 2 == 0:
        vo[v[i]] += 1
    else:
        ve[v[i]] += 1

if vo.index(max(vo)) == ve.index(max(ve)):
    ans1 = sum(vo) - max(vo) + sum(ve) - sorted(ve)[-2]
    ans2 = sum(vo) - sorted(vo)[-2] + sum(ve) - max(ve)
    print(min(ans1, ans2))
else:
    print(sum(vo) - max(vo) + sum(ve) - max(ve))


Measured memory_bytes: 14404
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {

	int n, k,l;
	cin >> n >> k>>l;
	
		cout << max(max(n,k),l)-min(min(n,k),l) << endl;
	


}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	static PrintWriter out;
	static StringBuilder sb;
	static int mod = 1000000007;
	static long inf = (long) 1e16;
	static int n, c, t, r;
	static ArrayList<Integer>[] ad;
	static long[][][] memo;
	static boolean f;
	static boolean[] vis[];
	static long[][] mat;
	static int[] ans, a;
	static TreeMap<pair, Long> tm;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		r = sc.nextInt();
		c = sc.nextInt();
		memo = new long[r][c][4];
		for (long[][] h : memo)
			for (long[] hh : h)
				Arrays.fill(hh, -1);
		tm = new TreeMap<>();
		int k = sc.nextInt();
		mat = new long[r][c];
		for (int i = 0; i < k; i++)
			mat[sc.nextInt() - 1][sc.nextInt() - 1] = sc.nextLong();
		System.out.println(dp(0, 0, 3));
		out.flush();
	}

	static long dp(int i, int j, int left) {
		if (i == r || j == c)
			return 0;
		if (memo[i][j][left] != -1)
			return memo[i][j][left];
		long ans = Math.max(dp(i + 1, j, 3), dp(i, j + 1, left));
		if (left > 0 && mat[i][j] > 0) {
			ans = Math.max(ans, Math.max(dp(i + 1, j, 3) + mat[i][j], dp(i, j + 1, left - 1) + mat[i][j]));
		}
		return memo[i][j][left] = ans;
	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		pair(int x, int y) {
			this.x = x;
			this.y = y;
		}

		public String toString() {
			return x + " " + y;
		}

		@Override
		public int compareTo(pair o) {
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public int[] nextArrInt(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextArrLong(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}


Measured memory_bytes: 732164
// 

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
  int r;
  cin >> r;
  if(r < 1200) cout << "ABC" << endl;
  else if(r < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){
    ll n;cin>>n;
    ll a[n],b[n];rep(i,0,n-1)cin>>a[i]>>b[i];
    ll sum=0;
    for(ll i=n-1;i>=0;i--){
        if((sum+a[i])%b[i]!=0){
            sum+=(b[i]-(sum+a[i])%b[i]);
        }
    }
    cout<<sum<<endl;
    
    
    return 0;
}






Measured memory_bytes: 1792
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
int main(){
int a,b,c;cin>>a>>b>>c;
if(a!=b&&b!=c&&c!=a||a==b&&b==c)cout<<"No"<<endl;
else cout<<"Yes"<<endl;
}

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

using namespace std;

int main(){
    int N, M;   cin >> N >> M;
    long long ans = 0;
    std::vector<int> v(M), u(M-1);
    for(int i=0; i<M; i++)  cin >> v[i];
  	std::sort(v.begin(),v.end());
    for(int i=0; i<M-1; i++)    u[i] = v[i+1] - v[i];
    std::sort(u.begin(),u.end());
  	for(int i=0; i<M-N; i++)    ans += u[i];
    cout << ans;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll a, b;
    cin >> a >> b;
    if(b==1) {
        cout << 0 << endl;
        return 0;
    }
    cout << (b-1+a-2)/(a-1) << endl;
}


Measured memory_bytes: 256
def main():
    c11, c12, c13 = map(int, input().split())
    c21, c22, c23 = map(int, input().split())
    c31, c32, c33 = map(int, input().split())
    
    for a1 in range(-200, 200):
        b1 = c11 - a1
        b2 = c12 - a1
        b3 = c13 - a1
        a2 = c21 - b1
        a3 = c31 - b1
        if c22 == a2 + b2 and c23 == a2 + b3 and c32 == a3 + b2 and c33 == a3 + b3:
            print('Yes')
            exit()
    print('No')
    
    




if __name__ == "__main__":
    main()

Measured memory_bytes: 61796
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define MAXN maxn
#define MOD 1000000007

using namespace std;

long long fastpow(long long a, long long b) {
	long long res = 1LL;
	while (b) {
		if (b & 1) {
			res = res * a % MOD;
		}
		a = a * a % MOD;
		b >>= 1;
	}
	return res;
}

long long add(long long a, long long b) {
	return (a + b) % MOD;
}

long long sub(long long a, long long b) {
	long long res = (a - b) % MOD;
	if (res < 0) res += MOD;
	return res;
}

long long N;

signed main()
{
	IO;
	cin >> N;
	cout << add(sub(fastpow(10, N), 2LL * fastpow(9, N)), fastpow(8, N)) << endl;
	return 0;
}



Measured memory_bytes: 3604
S=input()
T=input()
count=0
min=1000000
for i in range(len(S)):
    count = 0
    if i + len(T) <= len(S):
        for j in range(len(T)):
            if T[j] != S[i + j]:
                count += 1
    else:
        break

    if count<min:
        min=count

print(min)

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

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for (auto & a : A)
    cin >> a;
  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  cout << ((A.size() == N) ? "YES" : "NO");
  return 0;
}


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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
//setprecision(10);
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

llong pownew(llong m, llong n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return pow(m*m, n/2); }
    return pow(m, n-1) * m;
}

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

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

const int inf=100000000;

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

llong extgcd(llong a,llong b,llong& x,llong& y){
    llong d=a;
    if(b!=0){
        d=extgcd(b,a%b,y,x);
        y-=(a/b)*x;
    }
    else{
        x=1;y=0;
    }
    return d;
}

llong  mod_inverse(llong  a,llong m){
    long long int x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
   int n; cin>>n;
   llong x; cin>>x;
   vector<llong> a(n,0);
   REP(i,n) cin>>a[i];
   llong ans=0;
   if(a[0]>x)  {ans+=a[0]-x; a[0]=x;}

   for(int i=0; i<n-1; i++)
   {
       if(a[i]+a[i+1]>x)
       {
           ans+=a[i]+a[i+1]-x;
           a[i+1]-=a[i]+a[i+1]-x;
       }
   }
   cout<<ans<<endl;

    return  0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define kika "kika"
#define tam 55
#define ll long long
#define ii pair <int, int>
#define dl pair <ll, ll>
#define vi vector <int>
#define vl vector <ll>
#define vii vector <ii>
#define graph vector <vi>

using namespace std;

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

	int n;
	cin >> n;
	string s;
	cin >> s;
	int cont = 0;
	for (int i = 0; i < n - 2; ++i)
	{
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')  {
			cont++;
			i += 2;
		}
	}
	cout << cont << endl;
	return 0;
}

Measured memory_bytes: 256
N, X = map(int, input().split())
P = [int(_) for _ in input().split()]

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while b:
        a, b = b, a%b
    return a

D = abs(P[0]-X)
for i in range(N):
    D = gcd(D, abs(P[i]-X))

print(D)

Measured memory_bytes: 14252
n=int(input())
zmi=wmi=int(1e+10)
zma=wma=int(-1e+10)
for i in range(n):
    xi,yi=map(int,input().split())
    zma=max(xi+yi,zma)
    wma=max(xi-yi,wma)
    zmi=min(xi+yi,zmi)
    wmi=min(xi-yi,wmi)
print(max(zma-zmi,wma-wmi))
    

Measured memory_bytes: 8976
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

typedef pair<int, int> P;
ll modnum = 1e9+7;



int main() {
    int h,w; cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];

    queue<P> que;
    que.emplace(0,0);
    vector<vector<int>> distance(h, vector<int>(w, 100000));
    distance[0][0] = 0;
    while(!que.empty()) {
        P n = que.front();
        que.pop();
        if(n.first-1 >= 0 && s[n.first-1][n.second] == '.') {
            if(distance[n.first-1][n.second] > distance[n.first][n.second] + 1) {
                distance[n.first-1][n.second] = distance[n.first][n.second] + 1;
                que.emplace(n.first-1, n.second);
            }
        }
        if(n.first+1 < h && s[n.first+1][n.second] == '.') {
            if(distance[n.first+1][n.second] > distance[n.first][n.second] + 1) {
                distance[n.first+1][n.second] = distance[n.first][n.second] + 1;
                que.emplace(n.first+1, n.second);
            }
        }
        if(n.second-1 >= 0 && s[n.first][n.second-1] == '.') {
            if(distance[n.first][n.second-1] > distance[n.first][n.second] + 1) {
                distance[n.first][n.second-1] = distance[n.first][n.second] + 1;
                que.emplace(n.first, n.second-1);
            }
        }
        if(n.second+1 < w && s[n.first][n.second+1] == '.') {
            if(distance[n.first][n.second+1] > distance[n.first][n.second] + 1) {
                distance[n.first][n.second+1] = distance[n.first][n.second] + 1;
                que.emplace(n.first, n.second+1);
            }
        }
    }

    if(distance[h-1][w-1] == 100000) {
        cout << -1 << endl;
    } else {
        int white = 0;
        rep(i, h) rep(j, w) {
            if(s[i][j] == '.') white++;
        }
        cout << white - distance[h-1][w-1] -1 << endl;
    }

    return 0;
}


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

int main()
{
	int N;
	string S,T;
	cin >> N >> S >> T;
	
	rep(i,N)
	{
		cout << S[i] << T[i];
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD (long long)(1e9+7)
using namespace std;
long long r,w,dp[1005][1005];
char g[1005][1005];
int main()
{
	cin >> r >> w; getchar();
	for(int i=1; i<=r; i++) fgets(g[i]+1,w+2,stdin);
	dp[1][1]=(g[1][1]!='#');
	for(int i=1; i<=r; i++)
		for(int j=1; j<=w; j++)
		{
			if(g[i][j] != '#' && (i!=1 || j!=1))
			{
				if(i==1) dp[i][j]=dp[i][j-1];
				else if(j==1) dp[i][j]=dp[i-1][j];
				else dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
			}
			//cout << dp[i][j] << ' ';
		}
	cout << dp[r][w];
	return 0;
}

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

using namespace std;

const int N = (int) 4e6 + 46;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  bitset<N> occ;
  occ[0] = 1;
  long long sm = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    sm += x;
    occ |= (occ << x);
  }
  for (int i = 0; i < N; i++) {
    if (occ[i] && 2 * i >= sm) {
      cout << i << '\n';
      return 0;
    }
  }
  return 0;
}


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

int main(){
  int n;
  cin >> n;
  
  int a[n];
  
  for(auto &i:a)cin >> i;
  
  sort(a,a+n);
  
  int m = (n/2)-1;
  int ans = a[m+1]-a[m];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <set>
#include <queue>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define reps(i, s, n) for (int i = s; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++) 
#define repsl(i, s, n) for (ll i = s; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl
#define readVarll(nam) ll nam; cin >> nam

ll x[20],y[20];
ll n;

#define DEV_VAL 1000000007
ll mulbig(ll a, ll b)
{
  return (a * b) % DEV_VAL; 
}

ll addbig(ll a, ll b)
{
  return (a + b) % DEV_VAL;
}

ll powbig(ll a, ll b)
{
  ll ans = 1;
  repl(i, b)
  {
    ans = mulbig(ans, a);
  }
  return ans;
}

ll subbig(ll a, ll b)
{
  ll ans = a - b;
  while(ans < 0)
  {
    ans = addbig(ans, DEV_VAL);
  }
  return ans;
}

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

  ll x = powbig(10, n);
  ll y = mulbig(2, powbig(9, n));
  ll z = powbig(8, n);
  ll ans = subbig(addbig(x, z), y);
  
  cout << fixed << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
typedef long long ll;

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

    string s;
    cin >> s;
    sort(s.begin(),s.end());

    if(s[0]==s[1] && s[2]==s[3] && s[1]!=s[2])
        cout << "Yes";
    else
        cout << "No";
}

Measured memory_bytes: 256
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
paths = []
for i in range(1, M+1):
    paths.append(list(map(int, input().split())))

import networkx as nx
G = nx.Graph()
G.add_nodes_from(list(range(1, N+1)))
for i in range(1, N+1):
    G.nodes[i]['H'] = H[i-1]
G.add_edges_from(paths)

ans = 0
for adj in G.adjacency():
    dic_adj = adj[1]
    ans += 1
    for n_adj in dic_adj.keys():
        if G.nodes[adj[0]]['H'] <= G.nodes[n_adj]['H'] :
            ans -=1
            break
print(ans)

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

using ll = int64_t;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	os << "{";
	rep(i, (int)v.size()) {
		if (i)
			os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
	for (auto val : array)
		std::cout << val << ", ";
	std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

	int n, m, l; std::cin >> n >> m >> l;
	vector<vi> dist(n, vi(n, inf));
	rep(i, n) dist[i][i] = 0;
	rep(i, m) {
		int a, b, c; std::cin >> a >> b >> c;
		--a, --b;
		dist[a][b] = dist[b][a] = c;
	}

	rep(k, n) rep(i, n) rep(j, n) chmin(dist[i][j], dist[i][k] + dist[k][j]);

	vector<vi> dist2(n, vi(n, inf));
	rep(i, n) rep(j, n) {
		if (dist[i][j] <= l) dist2[i][j] = 1;
	}
	rep(k, n) rep(i, n) rep(j, n) chmin(dist2[i][j], dist2[i][k] + dist2[k][j]);

	int q; std::cin >> q;
	rep(i, q) {
		int s, t; std::cin >> s >> t;
		--s, --t;
		if (dist2[s][t] == inf)
			std::cout << -1 << "\n";
		else
			std::cout << dist2[s][t] - 1 << "\n";
	}
}


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


int main(){
  string pass;
  cin >> pass;
  bool hantei = false;

  for (int i = 0; i < 3; i++){
    if (pass.at(i) == pass.at(i + 1)){
      hantei = true;
    }else{
      continue;
    }
  }

  if (hantei){
    cout << "Bad" << endl;
  }else{
    cout << "Good" << endl;
  }
}


Measured memory_bytes: 256
s = input()

l = []
count_a=0
count_b=0
for i in s:
  if i not in l:
    l.append(i)
    count_a+=1
  else: 
    count_b+=1
if count_a == 2 and count_b == 2:
  print('Yes')
else:
  print('No')

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

int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  cout << ( s.at(0) == s.at(1) and s.at(2) == s.at(3) and s.at(1) != s.at(2) ? "Yes" : "No" ) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
//l={1,2,3,4}
//greater<int>()
//sort(l.bigin(),l.end())
//sort(l,l+n)

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

	int th = n / 1000;
	int hu = n / 100 - 10 * th;
	int ten = n / 10 - 100 * th - 10 * hu;
	int a = n - th * 1000 - hu * 100 - ten * 10;

	if (hu == ten) {
		if (ten == a || hu == th)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int k, x;
	scanf("%d %d", &k, &x);
	int i;
	for (i = x - k + 1; i < x + k - 1; i++)
		printf("%d ", i);
	printf("%d\n", x + k - 1);
	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import sys


def main():
    S = sys.stdin.readline().rstrip()
    T = sys.stdin.readline().rstrip()

    min_cnt = len(T)

    for i in range(len(S)-len(T)+1):
        cnt = 0

        for j in range(len(T)):
            if S[i+j] != T[j]:
                cnt += 1
        
        min_cnt = min(min_cnt, cnt)
    
    
    print(min_cnt)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9136
main = getContents >>= putOut.formatOut.calc.formatIn
  where putOut = putStrLn.reverse.dropWhile (\c-> c=='\n' || c==' ').reverse

formatIn :: String -> Int
formatIn = read :: String -> Int

formatOut :: [Int] -> String
formatOut = (' ':).unwords.map show

calc :: Int -> [Int]
calc n = filter f [1..n] 
  where f x = x `mod` 3==0 || elem '3' (show x)

Measured memory_bytes: 4920
/*
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left224
#define right right224
#define next next224
#define rank rank224
#define prev prev224
#define y1 y1224
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
#define mp make_pair
const string FILENAME = "input";
const int MAXN = 3000228;
const int Mod = 998244353;


int mul(int a, int b) {
    return (1LL * a * b) % Mod;
}


int sum(int a, int b) {
    return (a + b) % Mod;
}


int powm(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1) {
            res = mul(res, a);
        }
        b >>= 1;
        a = mul(a, a);
    }
    return res;
}

int n, m;
int fact[MAXN];
int rfact[MAXN];

int getc(int i, int j) {
    return mul(fact[i], mul(rfact[j], rfact[i - j]));
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //read(FILENAME);
    cin >> n >> m;
    fact[0] = 1;
    for (int i = 1; i <= 3000000; i++) {
        fact[i] = mul(fact[i - 1], i);
    }
    rfact[3000000] = powm(fact[3000000], Mod - 2);
    for (int i = 2999999; i >= 0; i--) {
        rfact[i] = mul(rfact[i + 1], i + 1);
    }
   // n + 3 * m, n - 1
    int ans = getc(n + 3 * m - 1, n - 1);
    //cout << ans << endl;
    for (int value = 2 * m + 1; value <= 3 * m; value++) {
        int f = getc(n + 3 * m - value - 2, n - 2);
        f = mul(f, n);
        ans = sum(ans, Mod - f);
    }
    for (int cntodd = m + 1; cntodd <= n; cntodd++) {
        int f = getc(n, cntodd);
        int rest = 3 * m - cntodd;
        if (rest % 2 != 0) {
            continue;
        }
        if (cntodd > 3 * m) {
            continue;
        }
        int have = rest / 2;
        f = mul(f, getc(have + n - 1, n - 1));
        ans = sum(ans, Mod - f);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 23680
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <regex>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int,int> > vp;
int main(int argc,char const* argv[])
{
  int n;
  cin >> n;
  vp per(n);
  for(int i=0;i<n;i++)
    {
      cin >> per[i].first >> per[i].second;
    }
  sort(per.begin(),per.end(),greater<pair<int,int> > ());
  cout << per[0].first+per[0].second << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
#define mx(x,y) x=max(x,y)
typedef double D;
typedef complex<D> P;
D dp[10011][20][20];
D d[20][20];
bool can[20][20][20];
int main(){
	int n;
	D r,theta;
	cin>>n>>r>>theta;
	if(n==1){
		puts("0");
		return 0;
	}
	theta*=acos(-1.0)/180;
	P p[20];
	rep(i,n){
		int x,y;
		cin>>x>>y;
		p[i]=P(x,y);
	}
	rep(i,n) rep(j,n) d[i][j]=abs(p[i]-p[j]);
	rep(i,n) rep(j,n){
		if(i==j) continue;
		rep(k,n){
			if(k==j) continue;
			if(abs( arg((p[k]-p[j])/(p[j]-p[i])) )<theta) can[i][j][k]=true;
		}
	}
	bool ok=false;
	rep1(i,n-1){
		mx(dp[1][0][i],r-abs(p[0]-p[i]));
		if(dp[1][0][i]>0) ok=true;
	}
	if(!ok){
		puts("0");
		return 0;
	}
	for(int i=1;i<=10010;i++){
		bool update=false;
		rep(a,n) rep(b,n){
			if(a==b) continue;
			if(dp[i][a][b]==0) continue;
			rep(c,n){
				if(b==c) continue;
				if(can[a][b][c]&&dp[i][a][b]-d[b][c]>0){
					mx(dp[i+1][b][c],dp[i][a][b]-d[b][c]);
					update=true;
				}
			}
		}
		if(!update){
			cout<<i<<endl;
			break;
		}
	}
}

Measured memory_bytes: 17704
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

int main() {
    int p, q, r;
    cin >> p >> q >> r;

    int ans = 1000;

    ans = min(ans, p + q);
    ans = min(ans, q + r);
    ans = min(ans, r + p);

    cout << ans << endl;
}

Measured memory_bytes: 3600
S=list(input())
K=int(input())
#print(S)
i=0;p=0;q=0
while i!=len(S):
  if S[i]!="1":
    p=1
    q=i
    if K<i+1:
      print("1")
    else:
      print(S[i])
    break
  i=i+1
if p==0:
  print("1")

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}


void solve_WA(long long N, long long M){
    vector<int> even(N);
    vector<int> odd(M);
    for (long long i = 0; i < N; i++) {
        even[i]=i*2;
    }
    for (long long i = 0; i < M; i++) {
        odd[i]=i*2+1;
    }
    ll cnt=0;
    for (ll i = 0; i < N; i++){
        for (ll j = 0; j < M; j++){
            if((even[i]+odd[j])%2==0) cnt++;
        }
    }
    cout << cnt << endl;
}

void solve(long long N, long long M){
    vector<int> v;
    for (long long i = 0; i < N; i++) {
        v.push_back(2);
    }
    for (long long i = 0; i < M; i++) {
        v.push_back(3);
    }
    ll cnt=0;
    for (ll i = 0; i < v.size(); i++){
        for (ll j = i + 1; j < v.size(); j++){
            if((v[i]+v[j])%2==0) cnt++;
        }
    }
    cout << cnt << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


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

using namespace std;

typedef unsigned long long ull;

int main()
{
  std::string s;

  cin >> s;

  for (int i=1; i<4; i++) {
      if (s[i-1] == s[i]) {
          cout << "Bad" << endl;
          return 0;
      }
  }
  cout << "Good" << endl;

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define intt unsigned long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int>dp(3);
    while(n--)
    {
        vector<int>c(3);
        vector<int>dp1(3,0);
        for(int i = 0;i<3;i++)
            cin>>c[i];
        for(int i = 0;i<3;i++)
            for(int j = 0;j<3;j++)
                if(i!=j)
                dp1[j] = max(dp1[j],dp[i]+c[j]);

        dp = dp1;
    }
    cout<<max({dp[0],dp[1],dp[2]});
}


Measured memory_bytes: 256
#include <iostream>/*{{{*/
#include <bits/stdc++.h>
#define rep(i, x) for(int i = 0; i < (int)(x); i++)
#define reps(i,x) for(int i = 1; i <= (int)(x); i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define foreach(x,a) for(auto& (x) : (a) )
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define debug(x)                 cerr << __LINE__ << ": " << #x << " -> " << x << '\n'
#define debug2(x, y)             cerr << __LINE__ << #x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define debug3(x, y, z)          cerr << __LINE__ << #x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug4(a, b, c, d)       cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define debug5(a, b, c, d, e)    cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define debug6(a, b, c, d, e, f) cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define INF 999999999
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<pii,vii,greater<pii> > spq;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};/*}}}*/

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

  int d,n;
  cin >> d >>n;

  int c = 1;
  while (true){
    if (c % (int)pow(100, d) == 0 and c%int(pow(100, d+1))!=0){
      n -= 1;
    }

    if (n==0){
      cout << c << endl;
      break;
    }
    c++;
  }


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0){
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int h, w, H, W;
  for(;;){
    scanf("%d %d", &H, &W);
    if(H == 0 && W == 0)
      break;
    for(h = 0; h < H; h++){
      for(w = 0; w < W; w++){
	if(h % 2 == 0){
	  if(w % 2 == 0){
	    printf("#");
	  }else{
	    printf(".");
	  }
	}else{
	  if(w % 2 == 1){
	    printf("#");
	  }else{
	    printf(".");
	  }
	}
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define fore(x, a) for(auto &x : a)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
#define F first
#define S second
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>void show(const vector<T> &a) { for (int i = 0; i < (int)a.size(); ++i) cout << a[i] << (i != (int)a.size()-1 ? " " : "\n"); }
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};

int n;
string s, ans;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n >> s;
    int cnt = 0;
    ans = s;
    rep(i, 0, n) {
      if (s[i] == '(') cnt++;
      else cnt--;

      if (cnt < 0) {
        ans = "(" + ans;
        cnt++;
      }
    }
    rep(i, 0, cnt) ans += ")";
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256