akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
    #define _USE_MATH_DEFINES
    using namespace std;
        
    #define ll long long int
    #define pb push_back
    #define rep(i , j , n) for(ll i = j ; i < n ; i++)
    #define per(i , j , n) for(ll i = j ; i >= n ; i--)
    #define all(x) x.begin(), x.end()
    typedef pair<int, int>	pii;
    typedef pair<ll, ll>	pl;
    typedef vector<int>		vi;
    typedef vector<ll>		vll;
    typedef vector<bool>	vb;
    ll mod = 1e9 + 7;



    int main(){  
        ll n,m,k;
        cin >> n >> m >> k;
        vll a(n + 1),b(m + 1);
        a[0] = b[0] = 0;
        rep(i,1,n + 1){
            ll x;
            cin >> x;
            a[i] = a[i - 1] + x;
        }
        rep(i,1,m + 1){
            ll x;
            cin >> x;
            b[i] = b[i - 1] + x;
        }
        ll ans = 0;
        rep(i,0,n + 1){
            ll l = k - a[i];
            if(l < 0) break;
            ll x = lower_bound(all(b),l) - b.begin();
            if(x > m || b[x] > l) x--;
            ans = max(ans, i + x);
        }
        cout << ans << endl;

    }

Measured memory_bytes: 6380
#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);
    scanVecInt(A, N);
    sort(A.begin(), A.end());
    // for (auto& a : A) cout << a << " "; cout << endl;
    deque<int> deq(A.begin(), A.end());
    // for (auto& e : deq) cout << e << " "; cout << endl;
    vector<pair<int, int>> result; result.reserve(N - 1);
    while (1 < deq.size()){
        int yi = deq.front(); // min
        deq.pop_front();
        int xi = deq.back(); // max
        deq.pop_back();
        const int min_e = deq.front();
        const int max_e = deq.back();
        if (!(max_e < 0)) swap(xi, yi);
        result.emplace_back(xi, yi);
        const int d = xi - yi;
        if (0 <= d){
            deq.emplace_back(d);
        }else{
            deq.emplace_front(d);
        }
    }
    cout << deq.front() << endl;
    for (auto& e : result){
        auto& xi = e.first;
        auto& yi = e.second;
        cout << xi << " " << yi << endl;
    }
}


Measured memory_bytes: 3456
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int w,h,x,y;
    cin >> w >> h >> x >> y;
    
    double area = (double)w*(double)h/2.0;
    int multiple = 0;
    if ( x*2==w && y*2==h ) {
       multiple=1;
    }    
    
    cout << area << " " << multiple;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            StringBuilder builder;
            String line = reader.readLine();
            builder = new StringBuilder(line);
            for (int i = 0; i < line.length(); i++) {
                char word = builder.charAt(i);
                if (Character.isLowerCase(word) == true) {
                    System.out.print(Character.toUpperCase(word));
                } else if (Character.isUpperCase(word) == true) {
                    System.out.print(Character.toLowerCase(word));
                } else {
                    System.out.print(word);
                }
            }
        } catch (IOException e) {
            
        }
        System.out.println("");
    }
}

Measured memory_bytes: 25080
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std; 
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
 
template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_mset;
 
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define F0R(i,a) for(int i = 0; i < a; i++)
#define F0Rd(i,a) for (int i = a - 1; i >=0 ; i--)
#define FORd(i,a,b) for (int i = b - 1; i >= a; i--)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) int((x).size())
#define newl '\n'
 
#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define print(x) cout << x << newl;
#define finish(x) return cout << x << "\n", 0;
#define bug(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " " << 
 
//const ll MOD = 998244353;
//const ll INF = 1e9 + 7;

const int MX = 2e5 + 5;
int N;

ll BIT[MX], ans;

//sum[1,k]
ll query(int k){
	ll sum = 0;
	for(;k > 0; k -= k & -k) sum = max(sum, BIT[k]);
	return sum;
}

//arr[k] += x
void update(int k, ll x){
	for(;k <= N; k += k&-k) BIT[k] = max(BIT[k], x);
}

int main(){ FAST
    //ifstream cin("/Users/konwoo/input.txt");
    //ofstream cout("/Users/konwoo/output.txt");

	cin >> N;
	vector<ll> heights(N), a(N);
	F0R(i,N){
		cin >> heights[i];
	}
	F0R(i,N){
		cin >> a[i];
	}


	F0R(i,N){
		ll cur_height = heights[i], cur_beauty = a[i];
		ll dp_ans = query(heights[i] - 1) + cur_beauty;
		update(heights[i],dp_ans);
		ans = max(ans, dp_ans);
	}
	finish(ans);






    return 0;
}


Measured memory_bytes: 4992
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	long Q = sc.nextInt();
    	long H = sc.nextInt();
    	long S = sc.nextInt();
    	long D = sc.nextInt();
    	long N = sc.nextInt();
    	if (S <= 4*Q && S <= 2*H) {
    		if (2*S < D) {
    			System.out.println(S*N);
    		} else {
    			System.out.println(N/2*D + N%2*S);
    		}
    	} else if (4*Q <= S && 2*Q <= H) {
    		if (8*Q < D) {
    			System.out.println(4*Q*N);
    		} else {
    			System.out.println(N/2*D + N%2*4*Q);
    		}
    	} else {
    		if (4*H < D) {
    			System.out.println(2*H*N);
    		} else {
    			System.out.println(N/2*D + N%2*2*H);
    		}
    	}
    }
}

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

using namespace std;

int main()
{
    vector<int> v;
    int a, b, k;
    
    cin >> a >> b >> k;

    for (int i = 1; i <= 100; i++) {
        if (a%i == 0 && b%i == 0) {
            v.push_back(i);
        }
    }

    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());

    cout << v[k-1] << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * https://www.hamayanhamayan.com/entry/2020/02/24/092051
 */
public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    private static long[] fact;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        System.out.println(solve(n, k));
    }

    private static long solve(int n, int k) {
        long count = 0;
        fact = factInit(n, MOD);

        for (int numZeroRoom=0; numZeroRoom<=Math.min(n, k); numZeroRoom++) {
            // System.err.println("\t" + (n-numZeroRoom) + "P" + (numZeroRoom) + " = " + permutation(n-numZeroRoom,  numZeroRoom, MOD));
            count += combination(n, numZeroRoom, MOD) * combination(n-1, n - (n-numZeroRoom), MOD) % MOD;
            count %= MOD;
            // System.err.println("zero(" + numZeroRoom + "): +" + tmp + " => " + count);
        }

        return count;
    }

    public static long combination(int n, int r, long p) {
        if (n == 0 && r == 0) return 1;
        if (n < r || n < 0)   return 0;

        return (fact[n] * power((fact[r]), p-2, p) % p) * power(fact[n-r], p-2, p) % p;
    }

    public static long[] factInit(int n, long p) {
        long[] fact = new long[n+1];
        fact[0] = 1;
        fact[1] = 1;
        for (int i=2; i<=n; i++) {
            fact[i] = i * fact[i-1] % p;
        }

        return fact;
    }


    public static long power(long base, long t, long p) {
        long ans = 1;

        while (t > 0) {
            if (t%2 == 1) {
                ans = ans * base % p;
            }

            t /= 2;
            base = base * base % p;
        }

        return ans;
    }
}

Measured memory_bytes: 24404
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define MAX 105
int a[MAX],dp[100005];
int gamedp(int n,int k)
{
	if(dp[k]!=-1)
	return dp[k];
	dp[k]=1;
	for(int i=1;i<=n;i++)
	{
	if(k>=a[i])
	{
	if(gamedp(n,k-a[i])==1)
	dp[k]=0;
}
}
return dp[k];

}
signed main()
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	memset(dp,-1,sizeof(dp));
	if(gamedp(n,k)==1)
	cout<<"Second"<<"\n";
	else
	cout<<"First"<<"\n";
}

Measured memory_bytes: 9060
let N = Int(readLine()!)!
if N < 3 {
    print(0)
} else {
    var L: [Int] = readLine()!.split(separator: " ").map { Int($0)! }
    L.sort()
    var cou: Int = 0
    for i in 0..<N-2 {
        for j in i+1..<N-1 {
            for k in j+1..<N {
                if L[i] == L[j] || L[j] == L[k] { continue }
                if L[i] + L[j] > L[k] { cou += 1 }
            }
        }
    }
    print(cou)
}

Measured memory_bytes: 8388
var
	n:Smallint;
begin
    read(n);
    if n=0 then begin
        write(0)
    end
    else if n<=1000 then begin
        write(1000-n)
    end
    else if n<=2000 then begin
        write(2000-n)
    end
    else if n<=3000 then begin
        write(3000-n)
    end
    else if n<=4000 then begin
        write(4000-n)
    end
    else if n<=5000 then begin
        write(5000-n)
    end
    else if n<=6000 then begin
        write(6000-n)
    end
    else if n<=7000 then begin
        write(7000-n)
    end
    else if n<=8000 then begin
        write(8000-n)
    end
    else if n<=9000 then begin
        write(9000-n)
    end
    else begin
        write(10000-n)
    end;
end.

Measured memory_bytes: 1384
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
#define endl '\n'
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}}

struct P { i64 x, y, z; };

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

    int N, M;
    P p[1005];

    cin >> N >> M;
    for (int i = 0; i < N; ++i) {
        i64 x, y, z;
        cin >> x >> y >> z;
        p[i] = { x, y, z };
    }

    i64 ans = 0;

    for(int a : {1, -1}) for(int b : {1, -1}) for(int c : {1, -1}) {
        sort(p, p+N, [&](const auto &l, const auto &r) {
            return (l.x * a) + (l.y * b) + (l.z * c) < (r.x * a) + (r.y * b) + (r.z * c);
        });

        i64 sumx = 0;
        i64 sumy = 0;
        i64 sumz = 0;
        for (int i = 0; i < M; ++i) {
            sumx += p[i].x;
            sumy += p[i].y;
            sumz += p[i].z;
        }
        chmax(ans, abs(sumx) + abs(sumy) + abs(sumz));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>

#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)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
#define INF 1000000007

#define ARRAY_MAX 2005

int main(){

    ll n,x;
    cin >> n >> x;
    vector<ll> a(ARRAY_MAX,0),now(ARRAY_MAX,0);
    REP(i,n){
        cin >> a[i];
        now[i] = a[i];
    }

    ll ans = LLONG_MAX;
    for(ll k = 0;k < n;k++){
        //魔法をk回かけるとする

        ll sum = k*x;

        for(ll i = 0;i < n;i++){
            now[i] = min(now[i],a[(i-k+n)%n]);
        }
        for(ll i = 0;i < n;i++){
            sum += now[i];
        }
        ans = min(sum,ans);
    }
    cout << ans << 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;

typedef long long ll;

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

	string s;
	cin >> s;
	int n = s.size();
	
	int cnt = 0;
	rep(i, n) if(s[i] == '2') cnt++;
	cout << cnt << endl;

}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**5)

# input
X = int(input())

# process
def is_prime(x):
    if x < 2:
        return False
    
    i = 2
    while i*i <= x:
        if x % i == 0:
            return False
        i += 1
    
    return True
    
x = X
while not is_prime(x):
    x += 1

# output
print(x)

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 17:19:32 2020

@author: NEC-PCuser
"""

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
                arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr

def multiplication(n):
    ans = len(str(n))
    for i in range(2, int(-(-n**0.5//1))+1):
        if (n % i == 0):
            ans = max([len(str(i)), len(str(n // i))])
    return ans
        

if __name__ == "__main__":
    N = int(input())
    """
    l = factorization(N)
    """
    print(multiplication(N))
    """
    minimu = 10 ** 10
    ans = 0
    for i in range(0, 2**len(l)):
        a = 1
        b = 1
        for j in range(0, len(l)):
            if ((i >> j) & 1):
                a *= l[j]
            else:
                b *= l[j]
        if (abs(a - b) < minimu):
            minimu = abs(a - b)
            ans = max([len(str(a)), len(str(b))])
    print(ans)
    """     
                

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  string s;
  cin >> s;
  int sl = s.length();
  unordered_map<char, int> mp;
  rep(i, sl) mp[s[i]]++;

  cout << ((abs(mp['a'] - mp['b']) <= 1 && abs(mp['c'] - mp['b']) <= 1 &&
            abs(mp['c'] - mp['a']) <= 1)
               ? "YES"
               : "NO")
       << endl;
  return 0;
}


Measured memory_bytes: 512
n,k = map(int,input().split())
s = input()+"x"

cnt = 1
li = []
for i in range(0,n):
    if s[i+1] != s[i]:
        li.append(cnt)
        cnt = 1
    else:
        cnt += 1

cursum = [0]*(len(li)+1)
for i in range(len(li)):
    cursum[i+1] = cursum[i]+ li[i]

if s[0]=="1":
  is_s_1 = True
else:
  is_s_1 = False

ans = 0
for i in range(1,len(cursum)):
    if is_s_1:
        low_limit = max(i-2*k-1,0)
    else:
        low_limit = max(i-2*k,0)
    ans = max(ans,cursum[i] - cursum[low_limit])
    is_s_1 = not is_s_1

if ans == 0:
    print(n)
else:
    print(ans)


Measured memory_bytes: 7884
#include<stdio.h>
#include<stdlib.h>
int linearsearch(int*,int,int);
int main(){
  int i=0,q,k,cnt=0;
  int n;
  int *t,*s;
  scanf("%d",&n);
  s=(int *)malloc(n * sizeof(int));
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
  }
  scanf("%d",&q);
  t=(int *)malloc(q * sizeof(int));
   for(i=0;i<q;i++){
    scanf("%d",&t[i]);
  }
  for(i=0;i<q;i++){
    k=linearsearch(s,t[i],n);
    if(k==1)cnt++;
  }
  printf("%d\n",cnt);
  free(t);
  free(s);
  return 0;
}
int linearsearch(int s[],int key,int n){
  int i=0;
  while(s[i]!=key){
    i++;
    if(i==n)return 0;
  }
  return 1;
}



Measured memory_bytes: 2144
N,K=gets.split.map(&:to_i)
steps=gets.split.map(&:to_i)
dp = []
dp << 0
dp << (steps[0] - steps[1]).abs
pos = 2
while pos < N
    k = 1
    min = 100000000000
    while k <= K
        break if (pos - k) < 0
        tmp = dp[pos-k] + (steps[pos] - steps[pos-k]).abs
        min = tmp if tmp < min
        k += 1
    end

    dp << min
    pos += 1
end
puts dp[N-1]


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

//昇順
int acs(const void *a, const void *b)
{
  return *(int *)a - *(int *)b;
}

int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i=0; i<N; i++)
    cin >> a[i];
  qsort(a, N, sizeof(int), acs);
  cout << a[N-1]-a[0] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template<typename tp> inline void read(tp &x) {
  x = 0; char c = getchar(); int f = 0;
  for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
  for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if (f) x = -x;
}
int main(void) {
  long long a, b, c;
  cin >> a >> b >> c;
  if (a + b + 1 >= c) {
    cout << c + b << "\n";
  } else {
    cout << min(a + b + 1, c) + b << "\n";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define one_peace ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int main()
{
    one_peace;
int a,b;
cin>>a>>b;
cout<<6-(a+b);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#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)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
ll n,k;
int main(){
    cin>>n>>k;
    vl t(n),d(n);
    vector<l_l> p(n);
    rep(i,n){
        cin>>t[i]>>d[i];
        p[i]={d[i],t[i]};
    }
    sort(p.rbegin(),p.rend());
    set<ll> s;
    stack<ll> st;
    ll ans=0;
    rep(i,k){
        if(s.count(p[i].se)){
            st.push(p[i].fi);
        }
        s.insert(p[i].se);
        ans+=p[i].fi;
    }
    ll sum=ans;
    ans+=(ll)s.size()*(ll)s.size();
    for(int i=k;i<n;i++){
        if(st.empty()) break;
        if(s.count(p[i].se))continue;
        s.insert(p[i].se);
        sum-=st.top();
        st.pop();
        sum+=p[i].fi;
        chmax(ans,sum+(ll)s.size()*(ll)s.size());
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6656
#include <iostream>
#include <algorithm>
#include <cmath>
#include <functional>
#include <string>
#include <vector>
#include <set>
using namespace std;

#define int long long
#define rep(n, i) for (int i = 0; i < n; i++)
#define rep2(m, n, i) for (int i = m; i < n; i++)
#define rep_r(n, i) for (int i = n - 1; i >= 0; i--)

const int INF = 1LL << 60;
const int MOD = 1e9 + 7;
const int MAX = 101;

int h, w;
char a[MAX][MAX];

bool dot_h(int n) {
    rep(w, j) {
        if (a[n][j] == '#') {
            return false;
        }
    }
    return true;
}

bool dot_w(int n) {
    rep(h, i) {
        if (a[i][n] == '#') {
            return false;
        }
    }
    return true;
}

signed main() {
    cin >> h >> w;
    rep(h, i) {
        rep(w, j) {
            cin >> a[i][j];
        }
    }
    bool remove[h][w];
    rep(h, i) {
        rep(w, j) {
            remove[i][j] = false;
        }
    }
    rep(h, i) {
        if (dot_h(i)) {
            rep(w, j) {
                remove[i][j] = true;
            }
        }
    }
    rep(w, j) {
        if (dot_w(j)) {
            rep(h, i) {
                remove[i][j] = true;
            }
        }
    }
    rep(h, i) {
        rep(w, j) {
            if (!remove[i][j]) {
                cout << a[i][j];
            }
        }
        if (!dot_h(i)) cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define VIEW(x) do {cerr << #x << ": "; for(auto i : x) cerr << i << " "; cerr << endl;} while(0)
#define ALL(x) (x).begin(),(x).end()
template<class T>bool umax(T &a, const T &b) {if(a<b){a=b;return 1;}return 0;}
template<class T>bool umin(T &a, const T &b) {if(b<a){a=b;return 1;}return 0;}

template<typename A,size_t N,typename T> void FILL(A (&array)[N],const T &val){fill((T*)array,(T*)(array+N),val);}
template<typename T> void FILL(vector<T> &v, const T &x) {fill(v.begin(), v.end(), x);}
template<typename T> void FILL(vector<vector<T>> &v, const T &x) {for(auto &i:v)fill(i.begin(), i.end(), x);}

int n,m; 
vector<int> adj[8];
bool visited[8];

int dfs(int from, int d) {
  if(d == n) return 1;
  int ret = 0;
  for(auto u : adj[from]) if(!visited[u]) {
    visited[u] = true;
    ret += dfs(u, d+1);
    visited[u] = false;
  }
  return ret;
}

int main() {
  cin >> n >> m;
  rep(i,m) {
    int a,b; cin >> a >> b; --a, --b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }

  visited[0] = true;
  cout << dfs(0, 1) << endl;
  
}


Measured memory_bytes: 3632
W,H,x,y,r = map(int,input().split())
#????????¢??????
if x-r<0:
	flag = 1
#????????¢??????
elif y-r<0:
	flag = 1
#????????¢??????
elif y+r>H:
	flag = 1
#????????¢??????
elif x+r>W:
	flag = 1

else:
	flag = 0

if flag:
	print("No")
else:
	print("Yes")

Measured memory_bytes: 7672
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define N 1000123
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define pb emplace_back
#define fs first
#define sc second
#define sz(x) ((int)((x).size()))
#define oo 1000000123
#define mod 1000000007LL
#define M 10000123
 
using namespace std;

int n, m, K;
int mat[10][10];


int f(int mi, int mj){
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            if(((1 << i) & mi) && ((1 << j) & mj) && mat[i][j])
                cnt++;
        }
    }
    return cnt == K;
}
 
int main(){
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> K;
    char c;
    int ln = 0, lm = 0;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> c;
            mat[i][j] = (c == '#');
        }
        ln |= (1 << i); 
    }

    /*
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cout << mat[i][j] << ' ';
        }
        cout << '\n';
    }
    */

    for(int i = 0; i < m; ++i) lm |= (1 << i);

    int ans = 0;
    for(int i = 0; i <= ln; ++i){
        for(int j = 0; j <= lm; ++j){
            if(f(i, j)) ans++; 
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3656
N = int(input())
kaimono_list = []
for i in range(N):
    kaimono_list.append(int(input()))
for i in range(N-1):
    for j in range(N):
        if i < j:
            if kaimono_list[i] > kaimono_list[j]:
                a = kaimono_list[i]
                kaimono_list[i] = kaimono_list[j]
                kaimono_list[j] = a
kaimono_sum = 0
for i in kaimono_list:
    kaimono_sum += i
print(kaimono_sum - kaimono_list[N-1]//2)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
long long abs_l(long long a){
    if(a<0) return -a;
    else return a;
}

int main(){
    int n;
    scanf("%d", &n);
    int a[n];
    int i=0;
    long long x=0;
    long long sum=0;
    long long ans;
    long long min=2*1e15;
    
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    for(i=0;i<n-1;i++){
        x+=a[i];
        ans=abs_l(sum-2*x);
        if(min>ans) min=ans;
    }
    
    printf("%lld\n",min);
    
    return 0;
}

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

/* short names and const
using ll = long long;
using vll = vector<long long>;
using df = vector<vector<long long>>;
df data(n, vector<long long>(m));
const int MOD = 1e9 + 7;
const long long INF = 1e18;
*/

/* Boost!
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
using boost::algorithm::split; // split(result, s, boost::is_any_of(","));
#include <boost/algorithm/string/join.hpp>
using boost::algorithm::join; // string s = join(arr, "");
#include <boost/algorithm/string/replace.hpp>
using boost::algorithm::replace_all; // replace_all(s, "AtCoder", "A");
#include <boost/range/algorithm.hpp> // boost::sort(arr)
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
*/

/* print(arr)
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}
*/

/* fast cin and precise cout
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  getline(cin, s);
  cout << fixed << setprecision(15);
*/

/* sum function
int sum(vector<int> &arr) {
  int res = accumulate(arr.begin(), arr.end(), 0);
  return res;
}
*/

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if (b - a <= 0) cout << "delicious";
  else if (b - a <= x) cout << "safe";
  else cout << "dangerous";
  cout << endl;
}


Measured memory_bytes: 256
from bisect import bisect_right
n = int(input())
d = {}
for a in map(int, input().split()):
  if a in d:
    d[a] += 1
  else:
    d[a] = 1
alist = list(sorted(d.keys(), reverse = True))
amax = alist[0]
t = 1
power_of_two = []
while t < 2 * amax:
  t *= 2
  power_of_two.append(t)
result = 0
for a in alist:
  if a not in d or d[a] == 0:
    continue
  t = power_of_two[bisect_right(power_of_two, a)] - a
  while True:
    if t not in d or d[t] == 0:
      break
    if a == t and d[a] == 1:
      break
    i = 1
    if a != t:
      i = min(d[a], d[t])
    result += i
    d[a] -= i
    d[t] -= i
    if a not in d or d[a] == 0:
      break
print(result)


Measured memory_bytes: 44560
#include <iostream>

using namespace std;

int main () {
	char num[4];
	
	cin >> num;
	
	if ( (num[0] == '7') || (num[1] == '7') || (num[2] == '7') ) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3636
#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 fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

struct Node{
    bool use;
    ll koshin;
    vector<l_l> v;
    vector<ll> fromv;
    ll maxi;
};
Node node[3000];
void hoge(ll x){
    node[x].use=true;
    if(node[x].fromv.size()==0)return ;
    rep(i,0,node[x].fromv.size()-1){
        if(!node[node[x].fromv[i]].use){
            hoge(node[x].fromv[i]);
        }
    }
}


int main(){
    ll n,m,p;cin>>n>>m>>p;
    ll a,b,c;
    rep(i,1,n){
        node[i].use=false;
        node[i].koshin=0;
        node[i].maxi=-inf;
    }
    rep(i,0,m-1){
        cin>>a>>b>>c;
        node[a].v.pb(make_pair(b,c-p));
        node[b].fromv.pb(a);
    }
    hoge(n);
    queue<l_l> q;
    node[1].maxi=0;
    q.push(make_pair(1,0));
    while(q.size()>0){
        ll x=q.front().first,y=q.front().second;q.pop();
        if(node[x].maxi!=y)continue;
        if(!node[x].use)continue;
        node[x].koshin++;
        if(node[x].koshin>m+10){
            cout<<-1<<endl;
            return 0;
        }
        if(node[x].v.size()==0){
            
        }else{
            rep(i,0,node[x].v.size()-1){
                if(node[x].maxi+node[x].v[i].second>node[node[x].v[i].first].maxi){
                    node[node[x].v[i].first].maxi=node[x].maxi+node[x].v[i].second;
                    q.push(make_pair(node[x].v[i].first,node[node[x].v[i].first].maxi));
                }
            }
        }
    }
    
    if(node[n].maxi>0){
        cout<<node[n].maxi<<endl;
    }else{
        cout<<0<<endl;
    }
    
    return 0;
}



Measured memory_bytes: 768
#include <iostream>

using namespace std;

int main()
{
    double a,b;
    int av;
    double sum;
    double av2;
    cin>>a>>b;
    av=(a+b)/2;
    av2=(a+b)/2;
    sum=av2-av;
    if(sum>=0.5)
    {
        cout <<av+1;
    }
    else{cout <<av;}
    return 0;
}


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

using namespace std;

typedef long long ll;

int main(){
	string s;
	cin >> s;
	ll ans = (int)s.size();
	ll stock = 0;
	for(int i = 0; i < (int)s.size(); i++){
		if(s[i] == 'S')stock++;
		else if(stock)stock--, ans-=2;
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    int x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;
    vector<int> p(a),q(b),r(c);
    rep(i,a){
        cin >> p[i];
    }
    rep(i,b){
        cin >> q[i];
    }
    rep(i,c){
        cin >> r[i];
    }
    sort(p.rbegin(),p.rend());
    sort(q.rbegin(), q.rend());
    rep(i, x)
    {
        r.push_back(p[i]);
    }
    rep(i,y){
        r.push_back(q[i]);
    }
    sort(r.rbegin(),r.rend());
    ll ans = 0;
    rep(i, x + y)
    {
        ans += r[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 2552
loop do

n = gets.split(" ")
h = n[0].to_i
w = n[1].to_i

if h == 0 && w == 0 then
    break
end

for i in 0..h-1

  for j in 0..w-1
 
    if (i + j) % 2 == 0 then 
      print "#"
    else
      print "." 
    end  

  end

print "\n"

end

print "\n"

end

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


int contribution(int n)
{
    int a = n*(n-1);
    int b = 2*1;
    return a/b;
}

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

    int sum = 0;
    if(N<2){ sum += 0; }
    else{ sum += contribution(N); }
    if(M<2){ sum += 0; }
    else { sum += contribution(M); }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int m, f, r;
while (1)
{
	scanf("%d %d %d", &m, &f, &r);
	if (m + f + r == -3)
	{
		return 0;
	}
	    ;
	if (m == -1 || f == -1)
	{
		printf("F\n");
	}
	else if (m + f >= 80)
	{
		printf("A\n");
	}
	else if (m + f >= 65)
	{
		printf("B\n");
	}
	else if (m + f >= 50 || r >= 50)
	{
		printf("C\n");
	}
	else if (m + f >= 30)
	{
		printf("D\n");
	}
	else
	{
		printf("F\n");
	}
}
	return 0;
}


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

#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 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

int n, m;

int main(){
	cin >> n >> m;
	cout << (2*m)-n<< endl;
	return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG
#include "../utils.cpp"
#endif
#include <bits/stdc++.h>
/*
Problem
 
Category
DP
 
URL:
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_A&lang=ja

考察:
dp[M][N] を考える
dp[i][j] := コインの最小の枚数
dp[i][j] = min (dp[i][j-v[i]], dp[i-1][j])

O(N*W)

Date: 2020/04/18
*/
 

using namespace std;
using ll = int64_t;
#define int int64_t
#define INF 10e9

 
/* ==== declarations ====== */
// functions
void solve();
void getInput();
 
// global variables
int N, M;
vector<vector<int>> dp;
vector<int> V;

/* ======================== */

void getInput() {
    cin>>N>>M;
    V = vector<int>(M, 0);
    for(int i=0; i<M; ++i) {
        cin>>V[i];
    }
}
 
 
void solve() {
    dp = vector<vector<int>>(M, vector<int>(N+1, INF));

    for(int i=0; i<M; ++i) {
        dp[i][0] = 0;
    }

    for(int j=0; j<N+1; ++j) {
        if (j-V[0] >= 0)
            dp[0][j] = dp[0][j-V[0]]+1;
    }

    for(int i=1; i<M; ++i) {
        for(int j=0; j<N+1; ++j) {
            if (j-V[i] < 0)
                dp[i][j] = dp[i-1][j];
            else
                dp[i][j] = min(dp[i-1][j], dp[i][j-V[i]] + 1);
        }
    }
    cout<<dp[M-1][N]<<endl;
    // print(dp);
}
 
 
 
signed main(){
    getInput();
    solve();
    return 0;
}




Measured memory_bytes: 11064
#!/usr/bin/env python3


def main():
    # n = int(input())
    # i = list(map(int,input().split()))
    # j = list(map(int,input().split()))

    x, y = map(int, input().split())

    cnt = 0

    while True:
        cnt += 1
        x *= 2
        #print(x)
        if x > y:
            break

    print(cnt)

main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    ll N,migi,hidari,d_size;
    cin >> N;
    vector<ll> d(N);

    for(ll i = 0;i < N;i++)
        cin >> d.at(i);

    sort(d.begin(),d.end());
    d_size=d.size();
    migi = d.at((d_size/2)-1);
    hidari=d.at((d_size/2));

    cout << hidari - migi << endl;



    

}

Measured memory_bytes: 4000
#n = int(input())
n,m = map(int,input().split())
#a_L = list(map(int,input().split()))
s_L,c_L = [],[]

for _ in range(m):
    s,c = map(int,input().split())
    s_L.append(s-1)
    c_L.append(c)

ans = 10000
for i in range(0,10000):
    tmp =list(str(i)) 
    flag = []
    for j in range(m):
        
        try:
            if tmp[s_L[j]] == str(c_L[j]):
                flag.append(True)
            else:
                flag.append(False)
        except:
            pass
    if all(flag) and len(tmp)==n:
        ans = min(i,ans)

if ans == 10000:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 43372
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: usize = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let A: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    let m = A.iter()
        .map(|&a| a / 400)
        .filter(|&a| a < 8)
        .collect::<std::collections::HashSet<_>>()
        .len();
    let k = A.iter()
        .filter(|&&a| a >= 3200)
        .count();
    let ans = format!(
        "{} {}",
        std::cmp::max(1, m),
        m + k
    );

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


Measured memory_bytes: 4476
#include<iostream>

int W,H,N;
int field[101][101];

int main(){
    std::cin>>W>>H>>N;
    int x,y,a;
    for(int i=0;i<W;++i){
        for(int j=0;j<H;++j){
            field[i][j]=1;
        }
    }
    for(int i=0;i<N;++i){
        std::cin>>x>>y>>a;
        if(a==1){
            for(int i=0;i<x;++i){
                for(int j=0;j<H;++j){
                    field[i][j]=2;
                }
            }
        }else if(a==2){
            for(int i=x;i<W;++i){
                for(int j=0;j<H;++j){
                    field[i][j]=2;
                }
            }
        }else if(a==3){
            for(int i=0;i<W;++i){
                for(int j=0;j<y;++j){
                    field[i][j]=2;
                }
            }
        }else if(a==4){
            for(int i=0;i<W;++i){
                for(int j=y;j<H;++j){
                    field[i][j]=2;
                }
            }
        }
    }
    int ans=0;
    for(int i=0;i<W;++i){
        for(int j=0;j<H;++j){
            if(field[i][j]==1)ans++;
         //   std::cout<<field[i][j]<<" ";
        }
       // std::cout<<std::endl;
    }
    std::cout<<ans<<std::endl;
    
}

Measured memory_bytes: 384
#include <vector>
#include <algorithm>
#include <cstdio>
#include <functional>
#include <tuple>
#include <cassert>
using namespace std;
using int64 = long long int;

struct UnionFind {
    vector<int> par, node, anc, color;
    UnionFind(int n) : node(n, 1), anc(n), color(n) {
        for(int i=0; i<n; i++) par.push_back(i);
    }
    int find(int k) { return par[k] == k ? k : find(par[k]); }
    bool same(int u, int v) { return find(u) == find(v); }
    bool unite(int u, int v) {
        if(same(u, v)) return false;
        u = find(u), v = find(v);
        if(node[u] > node[v]) {
            par[v] = u;
        }
        else if(node[u] < node[v]) {
            par[u] = v;
        }
        else {
            par[u] = v; node[v]++;
        }
        return true;
    }
};

int main() {
    int N, Q; scanf("%d%d", &N, &Q);
    vector< vector< tuple<int, int, int> > > G(N);
    for(int i=0; i<N-1; i++) {
        int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
        a--; b--; c--;
        G[a].emplace_back(b, c, d);
        G[b].emplace_back(a, c, d);
    }

    vector<int64> ans(Q), neg(Q);
    vector< vector< tuple<int, int, int, int> > > info(N), tmp(N);
    for(int i=0; i<Q; i++) {
        int x, y, u, v; scanf("%d%d%d%d", &x, &y, &u, &v);
        x--; u--; v--;
        info[u].emplace_back(x, y, i, v);
        info[v].emplace_back(x, y, i, u);
    }

    UnionFind uf(N);
    function<void(int, int)> find_lca = [&](int cur, int par) {
        uf.anc[cur] = cur;
        for(auto e : G[cur]) {
            int to = get<0>(e);
            if(to == par) continue;
            find_lca(to, cur);
            uf.unite(to, cur);
            uf.anc[uf.find(cur)] = cur;
        }
        uf.color[cur] = 1;
        for(auto e : info[cur]) {
            int col, d, idx, to; tie(col, d, idx, to) = e;
            if(to < 0) continue;
            if(uf.color[to] == 1) {
                int lca = uf.anc[uf.find(to)];
                tmp[lca].emplace_back(col, d, idx, -1);
            }
        }
    };

    vector<int64> sum(N), cnt(N);
    int64 cost = 0;
    function<void(int, int)> go = [&](int cur, int par) {
        for(auto e : info[cur]) {
            int col, d, idx, p; tie(col, d, idx, p) = e;
            int64 diff = cost + cnt[col] * d - sum[col];
            if(p < 0) {
                if(neg[idx]++ == 0) ans[idx] -= 2 * diff;
            }
            else { 
                ans[idx] += diff;
            }
        }

        for(auto e : G[cur]) {
            int to, col, dist; tie(to, col, dist) = e;
            if(to == par) continue;
            sum[col] += dist;
            cnt[col]++;
            cost += dist;
            go(to, cur);
            sum[col] -= dist;
            cnt[col]--;
            cost -= dist;
        }
    };

    find_lca(0, -1);
    for(int i=0; i<N; i++) for(auto e : tmp[i]) info[i].push_back(e);
    go(0, -1);
    for(auto a : ans) printf("%lld\n", abs(a));
    return 0;
}


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

int main()
{
    int n , close=0 , to=0 , to1=0;

    cin >> n;

    string s;

    cin >> s;

    for(int i = 0 ; i<s.size() ; i++)
    {
        if(s[i]==')')
            close++;
        else
            close--;
        to = max(to , close);
    }
    for(int i = 1 ; i<=to ; i++)
    {
        cout << "(";
    }
    cout << s;
    for(int i = close ; i<to ; i++)
    {
        cout << ")";
    }

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int a[] = new int[14];
		int b[] = new int[7];
		for (int i = 0; i < 14; i++) {
			a[i] = stdIn.nextInt();
		}
		for (int i = 0, j = 0; i < 7; i++) {
			b[i] = a[j] - a[j + 1];
			j = j + 2;
		}
		for (int i = 0; i < 7; i++) {
			System.out.println(b[i]);
		}
	}
}

Measured memory_bytes: 17172
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

char b;

void solve(){
    if(b == 'A')
        cout << 'T' << endl;
    else if(b == 'T')
        cout << 'A' << endl;
    else if(b == 'G')
        cout << 'C' << endl;
    else if(b == 'C')
        cout << 'G' << endl;
}

int main(){
    cin >> b;

    solve();
}


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

int main() {
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    if (x>y) {
        swap(x,y);
        swap(a,b);
    }
    c=min(c*2,a+b);
    b=min(c,b);
    cout<<c*x+b*(y-x)<<endl;
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int res=0;
    REP(i,n){
        vector<bool> tb(26,false),ta(26,false);
        for(int j=0;j<=i;j++)ta[s[j]-'a']=1;
        for(int j=i+1;j<n;j++)tb[s[j]-'a']=1;
        int sum=0;
        REP(j,26){
            if(ta[j]&&tb[j])sum++;
        }
        res=max(res,sum);
    }
    cout << res << endl;
}


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


Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

class Main{


	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		long[] A = new long[N];

		for(int i = 0;i < N;i++){
			A[i] = sc.nextLong();
		}
		Arrays.sort(A);

		long one = 0;
		long sec = 0;
		for(int i = N-1;i>=1;i--){
			
			
			if(one == 0){
				if(A[i] == A[i-1]){
					one = A[i];
					i--;
				}
			}else{
				if(A[i] == A[i-1]){
					sec = A[i];
				}
			}
			
			
			if(one != 0 && sec != 0){
				System.out.println(one*sec);
				return;
			}
		}
		
		System.out.println(0);


	}
	

}

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

int main(){
	ll N, X , M;
	cin >> N >> X >> M;
	vector<ll> cnt(M, -1);
	vector<ll> v;
	ll a = X%M;
	v.push_back(a);
	cnt[a] = 0;
	ll p = -1;
	for(int i=1; i<N; i++) {
		a = (a*a)%M;	
		if (cnt[a] != -1) {
			p = i - cnt[a];
			break;
		}
		cnt[a] = i;
		v.push_back(a);
	}

	ll ans = 0;
	if (p == -1) {
		for (ll i: v) ans += i;
	}
	else {
		for(int i = 0; i<cnt[a]; i++) ans += v[i];
		ll tot = 0;
		for(int i = cnt[a]; i<v.size(); i++) tot += v[i];
		ll n = N - cnt[a];
		ans += tot*(n/p);
		ll m = N - cnt[a] - p*(n/p);
		for(int i=cnt[a]; i<cnt[a]+m; i++) ans += v[i];
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 4632
#include <bits/stdc++.h>
#define rep( i, n ) for (ll i = 0; i < ( ll )(n); i++)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair< int , int > P;
typedef tuple<int, int, int> T;

int main(){
    string t,s;
    cin>>s>>t;
    int ans=t.size();
    for(int i=0;i<=(int)s.size()-(int)t.size();i++){
        int b=0;
        int k=0;
        for(int j=i;j<=i+(int)(t.size())-1;j++){

            if(s[j]!=t[k]) {b++;}
            k++;
        }
        ans=min(b,ans);
    }
    cout<<ans;
}

Measured memory_bytes: 3528
n = int(input())
jp_list = []
btc_list = []
for i in range(n):
    s = list(input().split())
    if s[1] == 'JPY':
        jp_list.append(float(s[0]))
    else:
        btc_list.append(float(s[0]))
print(sum(jp_list)+sum(btc_list)*380000)

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

int main() {
	int a[5];
	for(int i=0; i<5; i++){
		cin >> a[i];
	}
	for(int j=0; j<5; j++){
		int v = a[j];
		int k = j-1;
		while(a[k]<v && k>=0){
			a[k+1] = a[k];
			k--;
			a[k+1] = v;
		}
	}
	for(int l=0; l<4; l++){
		cout << a[l] << ' ';
	}
	cout << a[4] << endl;
	return 0;
}


Measured memory_bytes: 3092
#include<iostream>
using namespace std;
using ll=long long;
ll N;
bool dfs(ll x,ll y,ll f,ll d){
/*    if(d==3){
        if(x*N==4*y)return true;
        else return false;
    }
*/
    if(d==2){
        if((4*y-x*N)>0&&(y*N)%(4*y-x*N)==0){
            cout<<(y*N)/(4*y-x*N)<<' ';
            return true;
        }
        return false;
    }
    if(x*N>y*4)return false;
    for(ll i{f};i<=3500;++i){
        if(dfs(x*i+y,y*i,i,d+1)){
            cout<<i;
            cout<<(d?' ':'\n');
            return true;
        }
    }
    return false;
}
int main(){
    cin>>N;
    dfs(0,1,1,0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 int W,H,x,y,r;
 cin >> W >>H >> x >> y >> r;
 if( x+r <= W && y+r <= H && x >= r  && y >= r ){
  cout << "Yes" << endl;
  }else{
  cout << "No" << endl;
 };
 return 0;
}

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

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

    unordered_map<int, int> data;
    int key;
    for (int i = 0; i < N; i++) {
        cin >> key;
        if (data.count(key)) {
            data.at(key)++;
        } else {
            data[key] = 1;
        }
    }

    auto solve = [](int N, const unordered_map<int, int> &data) {
        if (N % 3 != 0) {
            return (data.size() == 1) && (data.count(0));
        } else {
            const int Ncyc = N / 3;

            bool ans = true;
            int cumxor = 0;
            for (auto [key, freq] : data) {
                if (freq % Ncyc == 0) {
                    for (int i = 0; i < freq / Ncyc; i++) { cumxor ^= key; }
                } else {
                    ans = false;
                }
            }
            ans &= cumxor == 0;

            return ans;
        }
    };

    string ans = solve(N, data) ? "Yes" : "No";

    cout << ans << endl;
    //
}


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

typedef long long ll;
int main(){
    string s;
    cin >> s;
    for(int i=0; i<3; i++) {
        if(s[i]==s[i+1]){
            cout << "Bad" << endl;;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256