akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n, q;
	cin >> n >> q;
	string s;
	cin >> s;
	vector<int> pref(n + 1);
	vector<int> good(n);
	for (int i = 1; i < n; ++i) {
		if (s[i] == 'C' && s[i - 1] == 'A') {
			good[i] = 1;
		}
	}
	for (int i = 0; i < n; ++i) {
		pref[i + 1] = pref[i] + good[i];
	}
	while (q--) {
		int l, r;
		cin >> l >> r;
		cout << pref[r] - pref[l] << '\n';
	}
	return 0;
}


Measured memory_bytes: 1872
(defun string-palindrome ()
  (let* ((s (read-line))
         (n (length s))
         (sr (reverse s))
         (ans "No"))
    (if (string= s sr)
        (if (string= (subseq s 0 (/ (1- n) 2)) (reverse (subseq s 0 (/ (1- n) 2))))
            (if (string= (subseq s (1- (/ (+ n 3) 2)) n) (reverse (subseq s (1- (/ (+ n 3) 2)) n)))
                (setf ans "Yes"))))
    ans))
(format t "~A~%" (string-palindrome))


Measured memory_bytes: 4072
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int A = input[0];
            int B = input[1];
            int road = A + B - 1;
            Console.WriteLine(A * B - road);
        }
    }
}

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

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
	int A,B,K;
	cin >> A >> B >> K;
	int k = euclidean_gcd(A,B);
	int ans = k;
	int i = 0;

	while(true){
		if (k % ans == 0) {
			i++;
		}
		if (i == K) {
			break;
		}
		ans--;
	}
	cout << ans;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e16;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b;
    cin >> n;
    vector<vector<int>> g(n);
    vector<int> c(n);
    rep(i,n-1){
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i,n) cin >> c[i];
    RSORT(c);
    int ans = 0,index = 0;
    vector<int> res(n,-1);
    rep(i,1,n) ans += c[i];
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int v = q.front();
        q.pop();
        res[v] = c[index++];
        for (int u:g[v]){
            if (res[u] != -1) continue;
            q.push(u);
        }
    }
    PRINT(ans);
    array_output(all(res));
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int n,k,c;
int f[N],g[N],nex[N],pre[N],h[N];
string s;
int main() {
	int l,i,cnt,cnt1,last,k;
	ios::sync_with_stdio(false);
	cin>>n>>k>>c>>s; c++; l=s.length();
	last=-1;
	for (i=0;i<l;i++) 
		if (s[i]=='x') f[i]=(i==0?0:f[i-1]);
		else {
			f[i]=1; if (i>=c) f[i]+=f[i-c];
			pre[i]=last; last=i;
		}
	last=-1;
	for (i=l-1;i>=0;i--)
		if (s[i]=='x') g[i]=g[i+1];
		else {
			g[i]=1; if (i+c<l) g[i]+=g[i+c];
			nex[i]=last; last=i;
		}
	for (i=0;i<l;i++)
		if (s[i]=='o') {
			h[i]=f[i];
			if (i+c<l) h[i]+=g[i+c];
//			cout<<i<<' '<<h[i]<<endl;
		}
	for (i=0;i<l;i++) 
		if (s[i]=='o') {
//			cout<<i<<' '<<pre[i]<<' '<<nex[i]<<endl;
			cnt=h[i];
			if (cnt!=k) continue;
//			if ((pre[i]==-1||i-pre[i]>=c)&&(nex[i]==-1||nex[i]-i>=c)) {
//				cout<<i+1<<endl;
//				continue;
//			}
			if (pre[i]==-1) cnt1=g[i+1];
			else cnt1=h[pre[i]];
			if (pre[i]!=-1&&i-pre[i]>=c) cnt1--;
			if (cnt1==k) continue;
			if (nex[i]==-1) cnt1=(i==0?0:f[i-1]);
			else cnt1=h[nex[i]];
			if (nex[i]!=-1&&nex[i]-i>=c) cnt1--;
			if (cnt1==k) continue;
			cout<<i+1<<endl;
		}
	return 0;
}

Measured memory_bytes: 5780
n = gets.chomp.split('').map(&:to_i)

if n[-1] == 2 || n[-1] == 4 || n[-1] == 5 || n[-1] == 7 || n[-1] == 9
  puts 'hon'
elsif n[-1] == 0 || n[-1] == 1 || n[-1] == 6 || n[-1] == 8
  puts 'pon'
elsif n[-1] == 3
  puts 'bon'
end



Measured memory_bytes: 14376
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H1, M1, H2, M2, K = map(int, read().split())

hr = (H2- H1) * 60 
if M2 >= M1:
    _min = M2 - M1
    hr = (H2- H1) * 60 
    ans = hr + _min
else:
    _min = (M2 + 60) - M1
    hr = (H2- H1 -1) * 60 
    ans = hr + _min

print(ans - K)

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

int main() {
    string s; cin >> s;
    int cnt = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if(s[i]=='o') cnt++;
    }
    cout << 700 + cnt * 100 << endl;
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
A = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for i in range(len(S)):
  c = (A.index(S[i])+N)%26
  S[i] = A[c]
print("".join(S))

Measured memory_bytes: 9156
/*input
9
0
1
1
0
1
2
2
1
2
*/
#include <bits/stdc++.h>
using namespace std;
long long a[200005],n;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	long long q,m,k,h,ans=0,sum=0,p,x,y;
	cin>>n;
	for(int i=1;i<=n;++i) {
		cin>>a[i];
		if(a[i]>=i) return cout<<-1,0;
	}
	for(int i=n;i>1;--i){
		if(!a[i]) continue;
		if(a[i]==1){
			++ans;
		} else {
			if(a[i-1]!=a[i]-1) {
				if(a[i-1]<a[i]-1) return cout<<-1,0;
				else ans += a[i];
			}
			else ++ans;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 1792
def main
  n, l = gets.split.map(&:to_i)

  sum = 0
  min = 10000
  (0...n).each do |i|
    if (l + i).abs < min.abs
      min = l + i
    end
    sum += l + i
  end

  puts sum - min
end

main if $0 == __FILE__


Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
using namespace std;
int n,S,X[202020],st[202020],top;
long long P[202020];
void solve(int l,int r)
{
	if(S<=X[l]) return (void)(st[++top]=r);
	if(S>=X[r]) return (void)(st[++top]=l);
	if(P[l]<P[r]) return st[++top]=l,P[r]+=P[l],solve(l+1,r);
	else return st[++top]=r,P[l]+=P[r],solve(l,r-1);
}
int aabs(int x){ return x<0?-x:x;}
int main()
{
	scanf("%d%d",&n,&S);
	for(int i=1;i<=n;i++)
	scanf("%d%lld",&X[i],&P[i]);
	solve(1,n);
	long long ans=0;
	while(top) ans+=aabs(S-X[st[top]]),S=X[st[top--]];
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;
int a[100010];
int main()
{
    int n,odd=0,fou=0,dou=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(int i=0;i<n;i++)
    {
        if(a[i]%2!=0) odd++;
        if(a[i]%4==0) fou++;
        if(a[i]%2==0&&a[i]%4!=0) dou++;
    }
    if(odd>=fou+2) printf("No");
    else if(odd==fou+1&&dou!=0) printf("No");
    else printf("Yes");
    return 0;
}


Measured memory_bytes: 640
#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=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, f[110][10], p[110][10], ans = -INF;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    rep(i, 0, n) rep(j, 0, 10) 
        cin >> f[i][j];
    rep(i, 0, n) erep(j, 0, 10) 
        cin >> p[i][j];
    
    rep(bit, 1, 1 << 10) {
        int sum = 0;
        rep(i, 0, n) {
            int cnt = 0;
            rep(j, 0, 10) 
                if ((bit >> j & 1) && f[i][j]) 
                    cnt++;
            sum += p[i][cnt];
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int n;
ll ksm(ll ta,int tp){
	ll s=1;
	for(;tp;ta=ta*ta%mod,tp>>=1) if(tp&1) s=ta*s%mod;
	return s;
}
int main(){
	scanf("%d",&n);
	printf("%lld\n",((ksm(10,n)-ksm(9,n)*2%mod+mod)+ksm(8,n))%mod);
	return 0;
}


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

int score[1000][2];
int main(){
	int i;
	int N,a,b,scorsole= 0;
	while(1){
		cin >> N;
		if(N == 0)
			break;
		for(i = 0;i < N;i++){
			cin >> a >> b;
			if(a > b)
				score[scorsole][0] += a+b;
			else if(a == b){
				score[scorsole][0] += a;
				score[scorsole][1] += b;
			}
			else
				score[scorsole][1] += a+b;
		}
		scorsole++;
	}
	for(i = 0;i < scorsole;i++){
		cout << score[i][0] << " " << score[i][1] << endl;
	}
	return 0;
}

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

typedef long long ll;

int main(){
  
  ll n;
  cin >> n;
  
  vector<ll> a, b;
  
  for ( ll i = 0; i < n; i++ ){
    ll x, y;
    cin >> x >> y;
        
    a.push_back(x);
    b.push_back(y);
  }
  
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  
  ll ans = 0;
  ll l, r;
    
  if ( n % 2 == 0 ){
    l = a[n/2 - 1] + a[n/2];
    r = b[n/2 - 1] + b[n/2];
    
    ans = (r - l) + 1;
  } else {
    ans = b[n/2] - a[n/2] + 1;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 6320
def main():
    import fractions
    n,x=map(int, input().split())
    xn=list(map(int, input().split()))
    xn.append(x)
    xn.sort()
    for i in range(n):
        buf=xn[i+1]-xn[i]
        if i==0:
            d=buf
        else:
            d=fractions.gcd(d,buf)
    print(d)

if __name__=='__main__':
    main()

Measured memory_bytes: 16240
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)


typedef long long int ll;
typedef double D;      // ??§?¨?????????????double???long double?????????
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;


const int INF = (1<<30) - 1;
const D EPS = 1e-9;

#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)


//g++ -std=c++0x -msse4.2 -O3
//#include <bits/stdc++.h>
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.precision(16);
    
    int N;
    while(cin>>N, N){
        bool ldown = false, rdown = false;
        string s;
        vector<string> command(N);
        for(int i=0; i<N; i++)
            cin >> command[i];
        
        int ans = 0;
        for(int i=1; i<N; i++){
            if((command[i]=="lu" && command[i-1]=="ru")||
               (command[i]=="ru" && command[i-1]=="lu")||
               (command[i]=="ld" && command[i-1]=="rd")||
               (command[i]=="rd" && command[i-1]=="ld"))
                ans++;
        }
        cout << ans << endl;
    }
    
    return 0;
}

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

#define fst first
#define snd second
#define mp make_pair
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define per(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

template <typename T1, typename T2>
inline bool umin(T1& x, const T2& y){return y<x ? x=y,true : false;}

template <typename T1, typename T2>
inline bool umax(T1& x, const T2& y){return x<y ? x=y,true : false;}

typedef long long ll;
typedef long double ld;

const int N    = (int)1e6+7;
const int mod  = (int)1e9+7;
const int INF  = (int)1e9+17;
const ll LLINF = (ll)1e18+17;


int n, m;


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    #define FILENAME ""
//    freopen(FILENAME".in", "r", stdin);
//    freopen(FILENAME".out", "w", stdout);
#endif

    cin >> n;
    vector<int> b(n);
    rep(i, 0, n) cin >> b[i];
    vector<int> ans;
    per(step, 1, n+1) {
        if (*max_element(all(b)) > step) {
            cout << -1 << endl;
            return 0;
        }
        bool any = false;
        per(i, 0, b.size()) {
            if (b[i] == i + 1) {
                any = true;
                b.erase(b.begin() + i);
                ans.push_back(i + 1);
                break;
            }
        }
        if (!any) {
            cout << -1 << endl;
            return 0;
        }
    }
    reverse(all(ans));
    for(int x : ans) cout << x << '\n';

    return 0;
}


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

using namespace std;

int main(){

    double a, b, c;
    cin >> a >> b >> c;

    double e;
    e = sqrt(a*a + b*b -2*a*b*cos(c / 180*M_PI));

    double S, L, h;
    S = 0.5 * (a * b * sin(c / 180*M_PI));

    h = 2*S/a;

    printf("%.7lf\n", S);
    printf("%.7lf\n", a+b+e);
    printf("%.7lf\n", h);
    
    return 0;
}

Measured memory_bytes: 3528
import java.util.Scanner;

public class Main {

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

    	int area = a * b;
    	int perimeter = 2 * a + 2 * b;
    	
    	System.out.println(area +" "+ perimeter);
	}

}


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

long long a, b, c, d, n;
int main()
{
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    scanf("%lld", &n);
    long long s1 = 1LL * n * 4 * a;
    long long s2 = 1LL * n * 2 * b;
    long long s3 = 1LL * n * c;
    long long s4 = 0;
    if(n % 2 == 0) s4 = 1LL * n / 2 * d;
    else s4 = min(min(a * 4, b * 2), c) + 1LL * ((n - 1) / 2) * d;
    long long Sol = min(min(s1, s2), min(s3, s4));
    printf("%lld", Sol);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char const *argv[]) {
  long a,j=0,b,c,d=0,i,n,k[30][30];
  scanf("%ld %ld %ld",&n,&a,&b);
  char rb[n];
  d=(n/(a+b));
  if (n%(a+b)!=0) {
    d++;
  }
  for (i = 0; i < d; i++) {
    j+=a;
  }
  if (n%(a+b)<a&&n%(a+b)!=0) {
    j-=a-n%(a+b);
  }
  printf("%ld\n",j);
  return 0;
}


Measured memory_bytes: 128
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

int main() {
	ll ret = 0;
	ll sum = 0;
	ll num = 0;
	ll n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		ll a, b;
		cin >> a >> b;
		sum += a * b;
		num += b;
	}
	cout << ((sum - 1) / 9 + (num - 1)) << endl;
	return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    double sum=0;
    int n;
    cin>>n;
    while(n--)
    {
        double x;
        cin>>x;
        string s;
        cin>>s;
        if(s=="JPY")
            sum+=x;
        else
        {
            sum+=(x*380000.0);
        }
    }
    cout<<setprecision(10)<<fixed<<sum<<endl;

    return 0;
}


Measured memory_bytes: 3852
s = input()
n = int(s)
l = len(s)
ans = 0
if(n < 10):
    print(n)
elif(n < 100):
    print(9)
elif(n < 1000):
    ans = 9
    ans += n-99
    print(ans)
elif(n < 10000):
    print(909)
elif(n < 100000):
    ans = 9+900
    ans += n-9999
    print(ans)
else:
    print(90909)


Measured memory_bytes: 3060
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {

	static int testN=3;
	static long mod = 1000000007;
	//static long mod =998244353; 
	static System.IO.StringReader sr;
	static void Main(string[] args) {
		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res = "";
		string res = "No"; ;

		string str = Console.ReadLine();
		if ( str.Contains('A') && str.Contains('B') ) {
			res = "Yes";
		}

		Console.WriteLine(res);

		return;

	}



}

Measured memory_bytes: 13268
import math
 
N = 1000001
 
spf = [*range(N)]
i = 2
while i * i < N:
  if spf[i] == i:
    for j in range(i * i, N, i):
      if spf[j] == j:
        spf[j] = i
  i += 1
  
r = 'pairwise'
 
input()
d = None
u = set()
for x in map(int, input().split()):
  d = math.gcd(d or x, x)
  s = set()
  while x > 1:
    p = spf[x]
    if p in u:
      r = 'setwise'
    s.add(p)
    x //= p
  u |= s
print((r, 'not')[d > 1], 'coprime')


Measured memory_bytes: 179280
n,m=gets.split.map(&:to_i)
k=[]
m.times do
  k<<gets.split.map(&:to_i)
end
p=gets.split.map(&:to_i)
switch=0
ans=0
can=0
s=[0,1].repeated_permutation(n).to_a
s.each do |s|
  can=0
  m.times do |i|
    switch =0
    1.upto(k[i][0]) do |j|
      switch+=s[k[i][j]-1]
    end
    if switch%2==p[i]
      can+=1
    end
  end
  if can==m
    ans+=1
  end
end
puts ans


Measured memory_bytes: 14356
n = int(input())
a = list(map(int, input().split()))

even = sum([1 for i in a if i % 2 == 0])
odd = sum([1 for i in a if i % 2 != 0])
multiple4 = sum([1 for i in a if i % 4 == 0])

flag = False
if even - multiple4 == 0:
    if multiple4 >= odd - 1:
        flag = True
else:
    if multiple4 >= odd:
        flag = True

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


Measured memory_bytes: 14252
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
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...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> a >> b;
  ans = (a + b - 1) / b;
  Cout(ans);
  return 0;
}

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

const int MOD = 1000000007;

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

    std::map<int, int> mp;
    for (int i = 1; i <= n; i++)
    {
        int x = i;
        for (int j = 2; j * j <= x; j++)
        {
            int count = 0;
            if (x % j != 0)
            {
                continue;
            }
            while (x % j == 0)
            {
                x /= j;
                count++;
            }
            mp[j] += count;
        }
        mp[x] += 1;
    }
    
    unsigned long long int ans = 1;
    for (int i = 2; i <= n; i++)
    {
        ans = ans * (mp[i] + 1) % MOD;
    }
    
    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 3620
use std::cmp;

use num_integer::gcd;
use proconio::input;

#[proconio::fastout]
fn main() {
    input! {
        N: i128,
        M: i128
    }
    if N == 1 {
        println!("{}", M);
        return;
    }
    let mut max = 1;
    let mut x = 2;
    while x * x < M {
        if M % x == 0 {
            max = cmp::max(gcd(x, cmp::max(M - x * (N - 1), 1)), max);
            max = cmp::max(gcd(M / x, cmp::max(M - (M / x) * (N - 1), 1)), max);
        }
        x += 1;
    }
    println!("{}", max);
}


Measured memory_bytes: 2168
*RGB, N = map(int, input().split())
RGB.sort()
ans = 0
for i in range(N // RGB[2] + 1):
    n = N - RGB[2]*i
    for j in range((N - RGB[2]*i) // RGB[1] + 1):
        if (N - RGB[2]*i - RGB[1]*j) >= 0 and (N - RGB[2]*i - RGB[1]*j) % RGB[0] == 0:
            ans += 1
print(ans)


Measured memory_bytes: 41564
#include<stdio.h>
int main(void){
	int h1,h2,k1,k2,a,b,c,d,sum_h,sum_k;
	scanf("%d %d",&h1,&h2);
	scanf("%d %d",&k1,&k2);
	scanf("%d %d %d %d",&a,&b,&c,&d);
	sum_h=h1*a + h2*b + h1/10*c + h2/20*d;
	sum_k=k1*a + k2*b + k1/10*c + k2/20*d;
	if(sum_h>sum_k){
		printf("hiroshi\n");
	}
	else if(sum_h<sum_k){
		printf("kenjiro\n");
	}
	else{
		printf("even\n");
	}
	return 0;
}

Measured memory_bytes: 1816
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, X, m[200];
    cin >> N >> X;
    int sum = 0, M=1001001001;
    for (int i = 0; i < N; i++)
    {

        cin >> m[i];
        sum += m[i];
        if (m[i]<M)
        {
         M=m[i];
        }
    }
        int ans =N+(X-sum)/M;
        cout<< ans<<endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1000000007;
int MAX_N=100100;




int main(){
    int N, A, B, C;
    cin>>N>>A>>B>>C;
    vector<int> L(N);
    for(int i=0; i<N; i++){
        cin>>L[i];
    }
    int MPmin=100000;
    int MAXBit=pow(4, N);
    for(int Bit=0; Bit<MAXBit; Bit++){
        int BiBit=Bit;
        int ALen=0;
        int BLen=0;
        int CLen=0;
      	int ACou=0;
      	int BCou=0;
      	int CCou=0;
        int MP=-30;
        for(int j=0; j<N; j++){
            int Check=BiBit%4;
            if(Check==0){
                ALen+=L[j];
                ACou++;
              	MP+=10;
            }
            if(Check==1){
                BLen+=L[j];
                MP+=10;
              	BCou++;
            }
            if(Check==2){
                CLen+=L[j];
                MP+=10;
              	CCou++;
            }
			BiBit/=4;
        }
      	if(ACou*BCou*CCou==0){
          	continue;
        }
      	
        int DifA=abs(A-ALen);
        int DifB=abs(B-BLen);
        int DifC=abs(C-CLen);
        MP+=DifA+DifB+DifC;
        MPmin=min(MPmin, MP);
    }
    cout<<MPmin<<endl;
}

Measured memory_bytes: 512
s = input()
L = [0]*(len(s)+1)
R = [0]*(len(s)+1)

for i in range(len(s)):
    if s[i] == '<':
        L[i+1] = L[i]+1

for i in range(len(s)-1, -1, -1):
    if s[i] == '>':
        R[i] = R[i+1]+1

print(sum(max(x, y) for x, y in zip(L, R)))


Measured memory_bytes: 27300
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

fn main() {
    input! {
        n:usize,
        mut a:[i64;n],
    }
    let n = n as i64;
    a.sort();
    let mut mp = HashMap::new();
    for &x in a.iter() {
        *mp.entry(x).or_insert(0) += 1;
    }
    if mp.len() == 1 {
        if let Some(x) = mp.get(&0) {
            yn(true);
            return;
        } else {
            yn(false);
            return;
        }
    } else if mp.len() == 2 {
        if n % 3 == 0 && mp.get(&0) == Some(&(n / 3)) {
            yn(true);
        } else {
            yn(false);
        }
    } else if mp.len() == 3 {
        let k = mp.keys().collect::<Vec<_>>();
        if n % 3 == 0 && mp.values().all(|&c| c == n / 3) && k[0] ^ k[1] == *k[2] {
            yn(true);
        } else {
            yn(false);
        }
    } else {
        yn(false);
    }
}
pub fn yn(ans: bool) {
    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 6720
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	ll x;
	
	cin >> x;

	ll t = x / 11;
	ll remainder = x % 11;

	if (remainder == 0)
	{
		cout << t*2 << endl;
	}
	else if (remainder <= 6)
	{
		cout << t*2 + 1 << endl;
	}
	else
	{
		cout << t*2 + 2 << endl;
	}

	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dst[100010];
bool iq[100010];
int main()
{
	ll k; cin >> k;
	while(k%2==0) k/=2;
	while(k%5==0) k/=5;
	for(int i=0; i<int(1e5); ++i) dst[i]=1000;
	dst[k] = 0;
	queue<int> q; q.push(k);
	while(q.size()){
		int x=q.front(); q.pop(); iq[x]=0;
		for(int i=0; i<10; ++i){
			int t=x+i*k;
			int nd=dst[x]+t%10; t/=10;
			if(dst[t]>nd){
				dst[t]=nd;
				if(!iq[t]) iq[t]=1, q.push(t);
			}
		}
	}
	printf("%lld\n", dst[0]);
	return 0;
}


Measured memory_bytes: 1536
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

const int MAX_SIZE = 550;
int H, W;
char a[MAX_SIZE][MAX_SIZE];

char blue[MAX_SIZE][MAX_SIZE], red[MAX_SIZE][MAX_SIZE];

int main(int argc, char **argv) {
    std::cin >> H >> W;

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            std::cin >> a[i][j];
        }
    }

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            blue[i][j] = a[i][j];
            red[i][j] = a[i][j];
        }
    }

    for (int i = 1; i <= H; i++) {
        red[i][1] = '#';
        blue[i][W] = '#';
    }

    for (int i = 2; i < H; i++) {
        for (int j = 2; j < W; j++) {
            if (i % 2 == 0) {
                red[i][j] = '#';
            } else {
                blue[i][j] = '#';
            }
        }
    }

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            std::cout << red[i][j];
        }
        std::cout << std::endl;
    }
    
    std::cout << std::endl;

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            std::cout << blue[i][j];
        }
        std::cout << std::endl;
    }

    return 0;
}


Measured memory_bytes: 1536
#include <stdio.h>
 
#define DEBUG	(0)

int main(void)
{
  unsigned long h,w = 0;
  unsigned long ans = 0;
  
  scanf("%lu %lu",&h,&w);
  ans = h * w;
  
  if(h == 1 || w == 1){
    ans = 1;
  }else{
    if(ans%2 == 0){
      ans = ans/2;
    }else{
      ans = ans/2+1;
    }
  }
  
  printf("%lu\n",ans);
  
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
void print(ll x){
	if(x<0)putchar('-'),x=-x;
	int y=x%10+'0';
	if(x>=10)print(x/10);
	putchar(y);
}
ll n,mod=1e9+7,a[25][25],dp[1<<22]={1};
int main(){
	n=read();
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			a[i][j]=read();
	for(int j=1;j<1<<n;j++){
		int i=__builtin_popcount(j);
		for(int k=0;k<n;k++)
			if(j>>k&1 and a[i-1][k])
				dp[j]=(dp[j]+dp[j^(1<<k)])%mod;
	}
	print(dp[(1<<n)-1]);
    return 0;
}

Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a){
    cout<<k<<endl;
  }else if(k<=a+b){
    cout<<a<<endl;
  }else{
    cout<<(a-(k-a-b))<<endl;
  }
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <utility>

using namespace std;

int main() {
    int N,M;
    cin >> N >> M;
    
    vector<pair<int,int> > students;
    for (int i = 0; i < N; i++) {
        int a,b;
        cin >> a >> b;
        students.push_back(make_pair(a,b));
    }
    
    vector<pair<int,int> > checkpoints;
    for (int i = 0; i < M; i++) {
        int c,d;
        cin >> c >> d;
        checkpoints.push_back(make_pair(c,d));
    }
    
    int distance, chosen;
    for (int i = 0; i < N; i++) {
        distance = 1e9;
        for (int j = 0; j < M; j++) {
            if (abs(students[i].first - checkpoints[j].first) + abs(students[i].second - checkpoints[j].second) < distance) {
                distance = abs(students[i].first - checkpoints[j].first) + abs(students[i].second - checkpoints[j].second);
                chosen = j;
            }
        }
        cout << chosen + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int zettai(int a){
  if(a>0)
    return(a);
  else
    return(-a);
}
int main(void){
  int i,n,t,a,h,kai=0,dif=0;
  scanf("%d%d%d",&n,&t,&a);
  t*=1000;a*=1000;
  for(i=0;i<n;i++){
    scanf("%d",&h);
    if(i==0||dif>zettai(a-(t-6*h))){
      dif=zettai(a-(t-6*h));
      kai=i;
    }
  }
  printf("%d\n",kai+1);
  return(0);
}


Measured memory_bytes: 128
//#pragma GCC target("avx2,avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <atcoder/all>
using namespace atcoder;
//using mint = modint998244353;
//using mint = modint1000000007;
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//using i128 = __int128_t;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
constexpr char ln = '\n';
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) {if (a < b) {a = b; return true;} return false;}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) {if (a > b) {a = b; return true;} return false;}
inline int topbit(int x) {return x == 0 ? -1 : 31-__builtin_clz(x);}
inline int topbit(long long x) {return x == 0 ? -1 : 63-__builtin_clzll(x);}
inline int botbit(int x) {return x == 0 ? 32 : __builtin_ctz(x);}
inline int botbit(long long x) {return x == 0 ? 64 : __builtin_ctzll(x);}
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
inline int kthbit(long long x, int k) {return (x>>k)&1;}
inline void print() {cout << "\n";}
template<class T>
inline void print(const vector<T> &v) {
    for (auto itr = v.begin(); itr != v.end(); ++itr) cout << *itr << " ";
    print();
}
template<class T, class... Args>
inline void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
#ifdef MINATO_LOCAL
#define dump(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
inline void debug() {cerr << endl;}
template<class T>
inline void debug(const vector<T> &v) {
    for (auto itr = v.begin(); itr != v.end(); ++itr) cerr << *itr << " ";
    debug();
}
template<class T, class... Args>
inline void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
#else
#define dump(x) void(0)
inline void debug() {}
template<class T> inline void debug(const vector<T> &v) {}
template<class T, class... Args> inline void debug(const T &x, const Args &... args) {}
#endif
struct Fast_ios {Fast_ios() {cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);};} fast_ios;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    int N,Q; cin >> N >> Q;
    dsu g(N);
    while (Q--) {
        int t,u,v; cin >> t >> u >> v;
        if (t) {
            cout << g.same(u,v) << ln;
        } else {
            g.merge(u,v);
        }
    }
}


Measured memory_bytes: 4064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
const int maxx=1e10+10;
const int maxm=1e6+10;
int n,m;
int vis[maxm]; 
int  bs( int x ){
	int cnt=0;
	rep(i,0,n){
		cnt+=(vis[i]-1+x)/x-1;
	}
	if(cnt>m)return 0;
	return 1;
	
}
int main() {
	scanf("%d%d",&n,&m);
	rep(i,0,n){
		scanf("%d",&vis[i]);
	} 
	int l=0,r=maxx;
	while(l+1<r){
		int mid=( l+r ) >>1;
		if( bs(mid) )r=mid;
		else l=mid;
	}
	cout<<r;
	
} 

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
  }
  vector<int> ball(n,0);
  for(int i=n-1; i>=0; i--){
    int iBall = 0; 
    for(int j=2*i+1; j<n; j+=(i+1)){
      iBall += ball[j];
    }
    ball[i] = (a[i]+iBall)%2;
  }
  int m;
  vector<int> b;
  rep(i,n){
    m += ball[i];
    if (ball[i] == 1) b.push_back(i+1);
  }
  if(m>0){
    cout << m << endl;
    rep(i,m-1){
      cout << b[i] << " "; 
    }
    cout << b[m-1] << endl;
  }
  else{cout << "0" << endl;}

  return 0;
}


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

using namespace std;

long long mypow(long long x, long long y)
{
	long long result = 1;
	while (y != 0) {
		if (y%2 != 0) {
			result *= x;
			y -= 1;
		}	
		x *= x;
		y /= 2;
	}
	return result;
}
int main(void)
{
	int h, w, k;
	cin >> h >> w >> k;
	bool d[h][w];
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			char c;
			cin >> c;
			if (c == '.')
				d[i][j] = true; // white
			else
				d[i][j] = false; // black
		}
	}
	
	int ans = 0;
	for (int i = 0; i < mypow(2, h); i++) {
		for (int j = 0; j < mypow(2, w); j++) {
			set<int> sx, sy;
			for (int k = 0; k < h; k++)
				sx.insert(k);
			for (int k = 0; k < w; k++)
				sy.insert(k);
			for (int k = 0; k < h; k++) {
				if ((i>>k)&1 == 1)
					sx.erase(k);
			}
			for (int k = 0; k < w; k++) {
				if ((j>>k)&1 == 1)
					sy.erase(k);
			}

			int count = 0;
			for (auto ix = sx.begin(); ix != sx.end(); ix++) {
				for (auto iy = sy.begin(); iy != sy.end(); iy++) {
					if (d[*ix][*iy] == false)
						count++;
				}
			}
			if (count == k)
				ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int main(){
	long long a1,a2,b1,b2;
	cin>>a1>>b1>>a2>>b2;
	int round=1;
	while(1){
		if(round%2==1){
			a2-=b1;
		}
		else{
			a1-=b2;
		}
		if(a1<=0){
			cout<<"No";
			break;
		}
		if(a2<=0){
			cout<<"Yes";
			break;
		}
		round++;
	}
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
    int i,j,a[100],temp;
    for(i=0;i<10;i++){
        cin>>a[i];
    }
    for(i=0;i<10;i++){
        for(j=0;j<10-(i+1);j++){
            if(a[j]>a[j+1]){
                temp=a[j];
                a[j]=a[j+1];
                a[j+1]=temp;
            }
        }
    }
    for(j=9;j>=7;j--){
        printf("%d\n",a[j]);
    }
    return 0;
}

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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2e5 + 5;
const int   mod = 998244353;

void add(int &a,int b)  {
    a += b;
    if (a >= mod)
        a -= mod;
}
void sub(int &a,int b)  {
    a -= b;
    if (a <  0)
        a += mod;
}

int f[N][3][3][2];

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

    string S;   cin >> S;
    int n = S.size();

    if (S == string(n,'a')) return  cout << 1,0;
    if (S == string(n,'b')) return  cout << 1,0;
    if (S == string(n,'c')) return  cout << 1,0;

    if (n == 2) return  cout << 2,0;
    if (n == 3) {
        queue<int>  qu;

        int val = (S[0] - 'a') * 9 + (S[1] - 'a') * 3 + (S[2] - 'a');
        int ans = 0;

        vector<bool> vis(27,0);

        qu.push(val);
        vis[val] = 1;

        while (qu.size())   {
            int x = qu.front(); qu.pop();
            int z = x % 3;  x /= 3;
            int y = x % 3;  x /= 3;

            cerr << x << y << z << "\n";

            ans++;

            if (x != y) {
                int t = 3 - x - y;

                if(!vis[t * 12 + z])    {
                    vis[t * 12 + z] = 1;
                    qu.push(t * 12 + z);  
                }
            }
            if (y != z) {
                int t = 3 - y - z;

                if(!vis[x * 9 + t * 4]) {
                    vis[x * 9 + t * 4] = 1;
                    qu.push(x * 9 + t * 4);
                }
            }
        }
        cout << ans << endl;
        return  0;
    }
    char lst = 'd';
    int  sum = 0;
    int  ans = 1;

    for(char c : S) {
        if (lst == c)
            ans = 0;
        
        lst  = c;
        sum += c - 'a';

        if (sum >= 3)
            sum -= 3;
    }
    f[0][0][0][0] = 1;
    f[0][1][1][0] = 1;
    f[0][2][2][0] = 1;

    for(int i = 1 ; i < n ; ++i)
    for(int s = 0 ; s < 3 ; ++s)
        for(int END = 0 ; END < 3 ; ++END)  {
            int n_S = s - END;
            if (n_S < 0)
                n_S += 3;

            for(int c = 0 ; c < 3 ; ++c)
                add(f[i][s][END][0],f[i - 1][n_S][c][0]),
                add(f[i][s][END][1],f[i - 1][n_S][c][1]);

            sub(f[i][s][END][0],f[i - 1][n_S][END][0]);
            add(f[i][s][END][1],f[i - 1][n_S][END][0]);
        }    
    add(ans,f[n - 1][sum][0][1]);
    add(ans,f[n - 1][sum][1][1]);
    add(ans,f[n - 1][sum][2][1]);

    cout << ans << endl;
}

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

int main()
{
    int in;
    int first = 0, second, third;

    for (int i = 0; i < 10; i++) {
        cin >> in;

        if (first <= in) {
            third = second;
            second = first;
            first = in;
        } else if (second <= in) {
            third = second;
            second = in;
        } else if (third <= in) {
            third = in;
        }
    }

    cout << first << endl
         << second << endl
         << third << endl;

    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
            #include<iostream>
            #include<cstdio>
            #include<vector>
            #include<queue>
            #include<map>
            #include<cstring>
            #include<string>
            #include <math.h>
            #include<algorithm>
        //    #include <boost/multiprecision/cpp_int.hpp>
            #include<functional>
          #define int long long
            #define inf  1000000007
            #define pa pair<int,int>
    #define ll long long
            #define pal pair<ll,ll>
            #define ppa pair<int,pa>
            #define  mp make_pair
            #define EPS (1e-10)
            #define equals(a,b) (fabs((a)-(b))<EPS)
     
            using namespace std;
     
            class Point{
            	public:
            	double x,y;
            	Point(double x=0,double y=0):x(x),y(y) {}
            	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
            	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
            	Point operator * (double a) {return Point(x*a,y*a);}
            	Point operator / (double a) {return Point(x/a,y/a);}
            	double absv() {return sqrt(norm());}
            	double norm() {return x*x+y*y;}
            	bool operator < (const Point &p) const{
            		return x != p.x ? x<p.x: y<p.y;
            	}
            	bool operator == (const Point &p) const{
            		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
            	}
            };
            typedef Point Vector;
     
            struct Segment{
            Point p1,p2;
            };
     
        double hen(Vector a){
        if(fabs(a.x)<EPS && a.y>0) return acos(0);
        else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0);
        else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0);
        else if(fabs(a.y)<EPS && a.x>0) return 0.0;
        else if(a.y>0) return acos(a.x/a.absv());
        else return 2*acos(0)+acos(-a.x/a.absv());
     
        }
     
            double dot(Vector a,Vector b){
            	return a.x*b.x+a.y*b.y;
            }
            double cross(Vector a,Vector b){
            	return a.x*b.y-a.y*b.x;
            }
        
            //----------------kokomade temple------------
int n,x,k;
string s[10];
    signed main(){
  int h,w;
    	cin>>h>>w;
    	int y=0;
    	for(int i=0;i<h;i++){
    		cin>>s[i];
    		for(int j=0;j<w;j++){
    			if(s[i][j]=='#'){
    				y++;
    				
    			}
    			
    			
    		
    	}
    	}
    		
    		if(y!=h+w-1){
    			cout<<"Impossible"<<endl;
    			return 0;
    		}		
    //	cout<<"s"<<endl;
    	for(int i=0;i<h;i++){
    		for(int j=0;j<w;j++){
    			if(i==h-1 && j== w-1) continue;
    			if(s[i][j]=='#'){
    				if(!(s[i+1][j]=='#'||s[i][j+1]=='#')){
    					cout<<"Impossible"<<endl;
    			return 0;
    				}
    				
    			}
    			
    		}
    		
    	}
    	cout<<"Possible"<<endl;
    			return 0;
    	
    //	printf("%.10f\n",ans);
    	return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
#define PB push_back
#define MP make_pair
#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<long long>;
using ld = long double;

#define unordered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif


int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);

  int n;
  string s;

  cin >> n >> s;
  int r = 0, g = 0, b = 0;

  vector<pii> pairs[18];

  for (int i = 0; i < n; ++i) {
    while (s[r] != 'R') { ++r; }
    while (s[g] != 'G') { ++g; }
    while (s[b] != 'B') { ++b; }

    vi nums{r,g,b};
    vi order{0,1,2};
    sort(ALL(order), [&](int lhs, int rhs) { return nums[lhs] < nums[rhs]; });

    pairs[order[0]].emplace_back(nums[order[0]],nums[order[1]]);
    pairs[order[2]+9].emplace_back(nums[order[1]],nums[order[2]]);
    ++r; ++g; ++b;
  }

  const int mod = 998244353;
  int ans = 1;

  for (int i = 0; i < 18; ++i) {
    vector<pii> setup;
    for (auto &p : pairs[i]) {
      int a, b; tie(a, b) = p;
      debug(i, a, b);
      setup.emplace_back(a, 1);
      setup.emplace_back(b, -1);
    }
    sort(ALL(setup));
    int x = 0;

    for (auto &p : setup) {
      int loc, coef;
      tie(loc, coef) = p;
      if (coef == -1) {
        debug(x);
        ans = (ll)ans * x % mod;
      }
      x += coef;
    }
  }

  for (int i = 1; i <= n; ++i) {
    ans = (ll)ans * i % mod;
  }

  cout << ans << "\n";
}



Measured memory_bytes: 5736