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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }



int main() {
    ll h, n; cin >> h >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    rep(i, n) {
        h -= a[i];
        if(h < 0) break;
    }

    if(h > 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	ll N; cin >> N;
	ll a[5];
	for (int i = 0; i < 5; i++) cin >> a[i];

	// ボトルネックの位置を求める
	int pos_min;
	ll min_cap = LLINF;
	for (int i = 0; i < 5; i++) {
		if (min_cap > a[i]) {
			pos_min = i;
			min_cap = a[i];
		}
	}

	ll ans = 4 + N / min_cap;
	if (N%min_cap != 0) ans++;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
#include<vector>
using namespace std;

int main(){
	string S,T;
	cin>>S>>T;
	map<char,vector<char> >Sarr,Tarr;
	vector<char>Schararr,Tchararr;
	for(int i=0;i<S.length();++i){
		Sarr[T[i]].push_back(S[i]);
		Tarr[S[i]].push_back(T[i]);
		int Ttmp=1,Stmp=1;
		for(int j=0;j<Schararr.size();++j){
			if(Schararr[j]==S[i]){
				Stmp=0;
				break;
			}
		}
		if(Stmp==1)Schararr.push_back(S[i]);
		for(int j=0;j<Tchararr.size();++j){
			if(Tchararr[j]==T[i]){
				Ttmp=0;
				break;
			}
		}
		if(Ttmp==1)Tchararr.push_back(T[i]);
	}
	string ans="Yes";
	char tmp;
	for(int i=0;i<Tchararr.size();++i){
		for(int j=0;j<Sarr[Tchararr[i]].size();++j){
			if(j==0)tmp=Sarr[Tchararr[i]][j];
			else if(tmp!=Sarr[Tchararr[i]][j]){
				ans ="No";
				break;
			}
		}
	}
	for(int i=0;i<Schararr.size();++i){
		for(int j=0;j<Tarr[Schararr[i]].size();++j){
			if(j==0)tmp=Tarr[Schararr[i]][j];
			else if(tmp!=Tarr[Schararr[i]][j]){
				ans="No";
				break;
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1288
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define ll long long
#define rn(i,n) for(int i=1;i<=n;i++)

int main(){
  int n,sum=0;
  cin>>n;

  vector<int> a(n),b(n),c(n);

  r(i,n){
    cin>>a.at(i);
  }
  r(i,n){
    cin>>b.at(i);
  }
  ll max=0;
  r(i,n){
    sum=0;
    for(int k=0;k<=i;k++){
      sum+=a.at(k);
    }
    for(int j=i;j<n;j++){
      sum+=b.at(j);
    }
    if(max<sum)max=sum;
  }

  cout<<max<<endl;
return 0;}


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

using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<n; i++)


int main() {
	string S;
	cin >> S;

	bool hantei = true;
	int len = S.length();
	rep(i,len){
		if (i % 2 == 0) {
			if (S[i] == 'L') {
				hantei = false;
			}
		}
		else {
			if (S[i] == 'R') {
				hantei = false;
			}
		}
	}
	if (hantei) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}



}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define PI (2*acos(0.0))
#define eps 1e-9
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pp pair< ll, pair<ll,ll> >

ll dp[2005];
ll s;

ll f(int sum){
    if(sum == s) return 1;
    ll &ret = dp[sum];
    if(ret != -1) return ret;
    ret = 0;
    for(int i = 3; i <= s-sum; i++){
        ret += f(sum+i);
        ret %= MOD;
    }
    return ret;
}

int main()
{
    cin>>s;
    mem(dp,-1);
    cout << f(0) << endl;
    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
#define MXK 100010
#define MXN 101
bool win[MXK];
int a[MXN];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int N; cin>>N;
	int K; cin>>K;
	for(int i=1; i<=N; i++) cin>>a[i];

	win[0] = false;
	for(int i=1; i<=K; i++)
	{
		win[i] = false;
		for(int j=1; j<=N; j++)
			if(i-a[j]>=0 and win[i-a[j]]==false) 
			{
				win[i] = true; break;
			}
	}

	if(win[K]) cout << "First\n";
	else cout << "Second\n";
	return 0;
}

Measured memory_bytes: 384
str = gets.chomp
n = gets.chomp.to_i

ary = [*('a'..'z')]

str.size.times do |i|
	c = str[i]
	ind = ary.index(c)

	if c!= "a" and n >= (26 - ind)
		str[i] = "a"
		n = n - (26 - ind)
    end

	c = str[i]
	ind = ary.index(c)
   	
   	if i  == str.size-1
   		nn = n%26
		str[i] = ary[ind+nn]
		n = 0
    end

    break if n==0
end
puts(str)

Measured memory_bytes: 2044
import java.util.Scanner;

public class Main {
	
	public static boolean valExists(int[] nums, int val) {
		
		int start = 0;
	    int end = nums.length - 1;
	    int middle = start + (end - start)/2;

	    while(start < end && nums[middle] != val) {
	        if (val < nums[middle]) {
	            end = middle - 1;
	        } else {
	            start = middle + 1;
	        }
	        middle = start + (end - start)/2;
	    }
	    
	    if (nums[middle] == val) {
	    	return true;
	    } else {
	    	return false;
	    }
		
	}
	
	public static int searchBinary(int[] nums, int[] queries) {
		
		int answer = 0;
		
		for (int i = 0; i < queries.length; i++) {
			int query = queries[i];
			if(valExists(nums, query)) {
				answer++;
			}
		}
		
		return answer;
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int arrLen = scan.nextInt();
		scan.nextLine();
		int[] a = new int[arrLen];
		
		for (int i = 0; i < arrLen; i++) {
			a[i] = scan.nextInt();
		}
		scan.nextLine();
		
		int querLen = scan.nextInt();
		scan.nextLine();
		int[] b = new int[querLen];
		
		for (int i = 0; i < querLen; i++) {
			b[i] = scan.nextInt();
		}
		
		scan.close();
		
		int answer = searchBinary(a, b);
		
		System.out.println(answer);
	}
	
}


Measured memory_bytes: 68820
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
long long x[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%lld",x+i);
	}
	int at=a;
	for(int i=0;i<a;i++){
		if(x[i]>=0){
			at=i;break;
		}
	}
	int ret=mod;
	for(int i=0;i<=b;i++){
		if(at+i>a)continue;
		if(at-(b-i)<0)continue;
		int L=0;
		int R=0;
		if(i)R=x[at+i-1];
		if(b-i)L=-x[at-(b-i)];
		int tmp=min(L,R)+L+R;
		ret=min(ret,tmp);
	}
	printf("%d\n",ret);
}

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

int main()
{
  int N;
  cin >> N;
  vector<int> X(N);
  for (int i = 0; i < N; i++)
  {
    cin >> X.at(i);
  }
  sort(X.begin(), X.end());
  int ans = numeric_limits<int>::max();
  for (int i = X.at(0); i <= X.at(X.size() - 1); i++)
  {
    int sum = 0;
    for (int x : X)
    {
      sum += (i - x) * (i - x);
    }
    ans = min(sum, ans);
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main
{
    public static void process()throws IOException
    {
        String s=nln(),t=nln();
        int n=s.length();

        pn((s.compareTo(t.substring(0,n))==0)?"Yes":"No");
    }
 
 
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new FastReader();
 
        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }
    
    
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static int ni()throws IOException{return Integer.parseInt(sc.next());}
    static long nl()throws IOException{return Long.parseLong(sc.next());}
    static double nd()throws IOException{return Double.parseDouble(sc.next());}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    
    static long mod=(long)1e9+7l;
 
    static<T> void r_sort(T arr[],int n){
        Random r = new Random(); 
        for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            T temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } 
        Arrays.sort(arr); 
    }
    
/////////////////////////////////////////////////////////////////////////////////////////////////////////
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 36300
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>
//#include "atcoder/all"
using namespace std;
//using namespace atcoder;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=3e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const long double PI = acos(-1),eps=1.0e-14;
ll v1[mxN],v2[mxN],n;
ll calc(){
    ll m1=-1e18;
    ll m3=-1e18;
    ll m2=1e18;
    ll m4=1e18;

    for(int i=0;i<n;i++){
        m1=max(m1,v1[i]+v2[i]);
        m2=min(m2,v1[i]+v2[i]);
        m3=max(m3,v1[i]-v2[i]);
        m4=min(m4,v1[i]-v2[i]);

    }

    ll val1=m1-m2;
    ll val2=m3-m4;
    return max(val1,val2);
}

void solve() {
    cin>>n;
    vll all;
    loop(n,i,0){
        cin>>v1[i]>>v2[i];
    }
    cout<<calc()<<Endl;

}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 6736
#include <stdio.h>
#include <string.h>

int main() {
	char str[100000];
	int len_str;
	int i;

	scanf("%s", str);

	len_str = strlen(str);

	for (i=0; i<len_str; i=i+2) {
		printf("%c", str[i]);
	}
	printf("\n");
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std; 
int main(){
	int a,b,c,x,y,z;
	cin>>a>>b>>c;
	x=a+b;
	y=a+c;
	z=b+c;
	cout<<min(min(x,y),z)<<endl;
	return 0;
}

Measured memory_bytes: 256
// {{{
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

int N;
ll a[100000], b[100000], c[100000];
ll bi[100000];
ll nb[100000], nc[100000];

void init()
{
}

void solve()
{
    sort(a, a+N);
    sort(b, b+N);
    sort(c, c+N);
    ll ans = 0;
    REPR(i, N-1){
        ll cidx = lower_bound(begin(c), begin(c)+N-1, b[i]+1) - c;
        int cn = N - cidx;
        if(cidx == N-1 && c[cidx] <= b[i]) cn = 0;
        nc[i] = cn;
        if(i < N-1) nc[i] += nc[i+1];
    }
    REP(i, N){
        ll bidx = lower_bound(begin(b), begin(b)+N-1, a[i]+1) - b;
        if(bidx == N-1 && b[bidx] <= a[i]) bidx = N;
        bi[i] = bidx;
    }

    //REP(i, N){
    //    ll bidx = lower_bound(begin(b), begin(b)+N-1, a[i]+1) - b;
    //    ll cidx = lower_bound(begin(c), begin(c)+N-1, b[i]+1) - c;
    //    bi[i] = bidx;
    //    int bn = N - bidx;
    //    int cn = N - cidx;
    //    if(bidx == N-1 && b[bidx] <= a[i]) bn = 0;
    //    if(cidx == N-1 && c[cidx] <= b[i]) cn = 0;
    //    nb[i] = bn;
    //    nc[i] = cn;
    //}
    //REP(i, N) cout << nb[i] << " ";
    //cout << endl;
    //REP(i, N) cout << nc[i] << " ";
    //cout << endl;
    REP(i, N){
        ll bidx = bi[i];
        //ans += nb[i] * nc[bidx];
        if(bidx < N) ans += nc[bidx];
        //cout << "[" << nb[i] << ", " << nc[bidx] << "]" << " ";
    }
    //cout << endl;
    cout << ans << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    REP(i, N) cin >> a[i];
    REP(i, N) cin >> b[i];
    REP(i, N) cin >> c[i];
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 4224
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut x: Vec<i32> = sc.vec(n);
    x.sort();
    let mut results = vec![];
    for y in 0..101 {
        let mut tmp = 0;
        for &v in x.iter() {
            tmp += (v - y) * (v - y);
        }
        results.push(tmp);
    }
    results.sort();
    println!("{}", results[0]);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572
#include "vector"
#include "set"
#include "map"
#include "unordered_set"
#include "unordered_map"
#include "string"
#include "iostream"
#include "algorithm"
#include "queue"

using namespace std;

#define ll long long
#define INF 2e9
#define INF2 4611686018427387904
//#define MOD 1000000007
#define MOD 998244353
#define MAX_SIZE 1000000000

typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) { bool first = true; for (const auto& j: v) { if (!first) { os << " "; } first = false; os <<j; } os << "\n"; return os; }
template<typename T>
istream& operator>>(istream& is, vector<T>& v) { for (auto& elem : v) { is >> elem; } return is; }

vector<ll> f;
void set_f(int n) { f.resize(n+1); f[0] = 1; for (int i=1; i<= n; i++) { f[i] = (f[i-1] * i) % MOD;} }
ll nod(ll a, ll b) { if (b == 0) { return a; } else { return nod(b, a % b); } }
ll pw(ll x, ll n, ll m=MOD) { if (n == 0) { return 1;} if (n%2 == 0) { return pw((x*x) % m, n/2, m); } return (pw(x, n-1, m) * x) % m; }
ll dv(ll a, ll b) { return (a * pw(b, MOD - 2)) % MOD; }
ll c_n_k(int n, int k) { if (k > n) { return 0; } if (k < 0) { return 0; } return dv(dv(f[n], f[k]), f[n-k]); }

void solve() {
    string s;
    cin >> s;

    cout << (s == "ABC" ? "ARC" : "ABC");
}

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

    if (0) {
        int tests;
        cin >> tests;
        for (int t = 1; t <= tests; t++) {
            //cout << "Case #" << t << ": ";
            solve();
            //cout << "\n";
        }
    } else {
        solve();
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3656
n, m = map(int, input().split())
h = list(map(int, input().split()))
g = [[] for _ in range(n+1)]
for i in range(m):
  a, b = map(int,input().split())
  g[a].append(b)
  g[b].append(a)
ans = [1] * n
for i in range(n):
  for j in g[i+1]:
    if h[i] <= h[j-1]:
      ans[i-1] = 0
      break
print(sum(ans))

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

int main() {
  string c;
  cin >> c;
  char b = c.at(0);
  if ( b == 'a' || b == 'i' || b == 'u' || b == 'e' || b == 'o'){
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 3600
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  int mod = 1e9 + 7;
	int i, j, num, buf;
	long long ans = 1;
	vector<int> pri = { 2 }, d = { 0 };
	cin >> num;
	for (i = 3; i <= num; i+=2) {;
		j = 0;
		while (j < pri.size() && i % pri[j] != 0)
			j++;
		if (j == pri.size()) {
			pri.push_back(i);
			d.push_back(0);
		}
	}
	for (i = 0; i < pri.size(); i++) {
		buf = 1;
		while (num / buf >= 1) {
			buf *= pri[i];
			d[i] += num / buf;
		}
	}
	for (i = 0; i < d.size(); i++) {
		ans *= d[i] + 1;
		ans %= mod;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt();
		Map<Integer,Integer> map = new TreeMap<>();
		for(int i = 1; i <= n; i++) {
			map.put(sc.nextInt(), i);
		}
		for(Integer value : map.values()) {
			System.out.print(value + " ");
		}
	}
	
	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

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

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

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

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

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


Measured memory_bytes: 63828
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include <string>
#include<algorithm>
#include<map>
#include <vector>
#include <cassert>
#include<cmath>
using namespace std;

int main() {
	int i, j;
	int H, A;
	int ans = 0;
	cin >> H >> A;
	ans = H / A;
	if (H%A == 0) {
		cout << ans << endl;
	}
	else {
		cout << ans + 1 << endl;
	}



}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

#define u32 long long 
#define u64 long long 
#define ll long long

#define MOD 998244353

template<u32 M = 998244353>
struct modint{
    u32 val;
    modint(): val(0){}
    template<typename T>
    modint(T t){t %= (T)M; if(t < 0) t += (T)M; val = t;}

    modint pow(ll k) const {
        modint res(1), x(val);
        while(k){
            if(k&1) res *= x;
            x *= x;
            k >>= 1;
        }
        return res;
    }
    template<typename T>
    modint& operator=(T t){t %= (T)M; if(t < 0) t += (T)M; val = t; return *this;}
    modint inv() const {return pow(M-2);}
    modint& operator+=(modint a){val += a.val; if(val >= M) val -= M; return *this;}
    modint& operator-=(modint a){if(val < a.val) val += M-a.val; else val -= a.val; return *this;}
    modint& operator*=(modint a){val = (u64)val*a.val%M; return *this;}
    modint& operator/=(modint a){return (*this) *= a.inv();}
    modint operator+(modint a) const {return modint(val) +=a;}
    modint operator-(modint a) const {return modint(val) -=a;}
    modint operator*(modint a) const {return modint(val) *=a;}
    modint operator/(modint a) const {return modint(val) /=a;}
    modint operator-(){return modint(M-val);}
    bool operator==(const modint a) const {return val == a.val;}
    bool operator!=(const modint a) const {return val != a.val;}
    bool operator<(const modint a) const {return val < a.val;}
};
using mint = modint<MOD>;

using namespace std;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main()
{
	COMinit();
	mint n,m,k;
	int A,B,C;
	cin >> A >> B >> C;
	n=A;
	m=B;
	k=C;

	mint ans=0;
	for(int i=0;i<=C;i+=1)
	{
		mint tmp=(m*(m-1).pow(A-i-1));
		int c=COM(A-1,i);
		tmp*=c;
		ans+=tmp;
	}

	cout << ans.val << endl;

}

Measured memory_bytes: 15152
#include<cstdio>
    #include<algorithm>
    #include<vector>
    using namespace std;
    typedef long long ll;
    struct edge
    {
    	ll x,y;
    };
    ll n,i,dp[100005],mxx,mx[100005],x,y,z,ms[100005],root=0,mi[100005],mii,ans=0;
    const ll inf=1e18;
    vector<edge> s[100005];
    void getroot(ll p,ll f)
    {
    	ll i;
    	dp[p]=1;mx[p]=0;
    	for(i=0;i<s[p].size();i++)
    	{
    		if(s[p][i].x==f)continue;
    		getroot(s[p][i].x,p);
    		dp[p]+=dp[s[p][i].x];
    		if(dp[s[p][i].x]>mx[p])mx[p]=dp[s[p][i].x],ms[p]=s[p][i].x;
    	} 
    	if(n-dp[p]>mx[p])mx[p]=n-dp[p],ms[p]=f;
    	if(mx[p]<mxx)mxx=mx[p],root=p;
    }
    void dfs(ll p,ll f,ll len)
    {
    	ll i;
    	dp[p]=len;
    	if(p!=root&&dp[p]<mii)mii=dp[p];
    	for(i=0;i<s[p].size();i++)
    	{
    		if(s[p][i].x==f)continue;
    		dfs(s[p][i].x,p,len+s[p][i].y);
    	}
    }
    int main()
    {
    	scanf("%lld",&n);
    	for(i=1;i<n;i++)
    	{
    		scanf("%lld%lld%lld",&x,&y,&z);
    		s[x].push_back((edge){y,z});
    		s[y].push_back((edge){x,z});
    	}
    	mxx=mii=inf;
    	getroot(1,0);
    	dfs(root,0,0);
    	for(i=1;i<=n;i++)ans+=2LL*dp[i];
    	if(mxx>n-1-mxx)ans-=dp[ms[root]];
    	else ans-=mii;
    	printf("%lld\n",ans);
    	return 0;
    } 

Measured memory_bytes: 16256
import math
def main():
    N, K = map(int, input().split())

    prob = 0
    for point in range(1, N+1):
        if point <= K - 1:
            p = (1/N) * (1/2.0)**math.ceil(math.log2(K/point)) 
            prob += p
        else:
            p = 1/N
            prob += p

    print(prob)
if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <cstdio>
#include <deque>
#include <utility>
#include <algorithm>
using namespace std;
int main() {
	long long int n,total_h,max_h,total_d=0,ans=0;
	scanf("%lld %lld",&n,&total_h);
	max_h=total_h;
	deque<pair<long long int,long long int> > Q;
	for(int i=0;i<n-1;i++) {
		long long int d,h;
		scanf("%lld %lld",&d,&h);
		while(!Q.empty()&&Q.back().first<=h)
			Q.pop_back();
		Q.push_back(make_pair(h,total_d));
		total_d+=d;
		while(total_h<=total_d) {
			long long int tmp_h=total_h;
			while(!Q.empty()&&tmp_h+Q.front().first-Q.front().second>max_h) {
				total_h=max(total_h,Q.front().second+max_h);
				Q.pop_front();
			}
			if(!Q.empty()) {
				total_h=max(total_h,tmp_h+Q.front().first);
				long long int tmp=max(0LL,min((total_d-total_h)/Q.front().first,(Q.front().second+max_h-total_h)/Q.front().first));
				ans+=tmp;
				total_h+=tmp*Q.front().first;
			}
			ans++;
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 1052
N, D = map(int,input().split())
x = [[0]*D]*N
for i in range(N):
  x[i] = list(map(int,input().split()))

count = 0
for i in range(N-1):
  for j in range(i+1,N):
    dist = 0
    for m in range(D):
      dist += (x[i][m] - x[j][m]) **2
    if (dist ** 0.5) % 1 == 0:
      count += 1
print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vr vector
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(),v.end()

ll pow(ll x,ll n,ll p,ll res)
{
    if(n==0)
        return res%p;
    if(n&1)
    {
        res=((res%p)*(x%p))%p;
        n--;
    }
    x=((x%p)*(x%p))%p;
    n>>=1;
    return pow(x,n,p,res);
}





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

//ll t;
//cin>>t;
//while(t--)
{

  ll n,a,b;
  cin>>a>>b>>n;
  if(b>n)
  {
      cout<<floor(a*n/b);
  }
  else
  {
      ll x=b-1;
      ll ans=floor(a*x/b)-(a*(floor(x/b)));
      cout<<ans;
  }


    cout<<endl;

}
    return 0;
}





Measured memory_bytes: 3792
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> temp(N);
	for (auto i = 0; i < N; ++i)
	{
		auto P = 0;
		cin >> P;
		temp[P - 1] = i;
	}

	auto result = 0;
	for (auto i = 0; i < N;)
	{
		auto j = i + 1;
		for (; j < N && temp[j] > temp[j - 1]; ++j);
		result = max(result, j - i);
		i = j;
	}

	cout << N - result << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
using namespace std;
#define mod int(1e9+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,a,b) for(int i=a;i<=b;i++)
#define repn(i,a,b) for(int i=b-1;i>=a;i--)
#define F first
#define S second
#define pb push_back
#define mk make_pair
typedef long long int ll;

int main()
{ ios_base::sync_with_stdio(false); cin.tie(0);
  ll a,b,c; cin>>a>>b>>c;
  map<ll,ll> m;
  m[a]++; m[b]++; m[c]++;
  cout<<m.size()<<endl;
  return 0;
}

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  long long int n,k;
  cin>>n>>k;
  long long int sum=0;
  for(long long int i=k;i<=n+1;i++){
    sum +=i*(n-i+1)+1;
  }
  cout<<sum%(1000000007);

}


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

using namespace std;

#define int long long
int pref[250005], suff[250005], ans, prefix[250005], h , w, a, b;

const int mod = 1e9 + 7;

int BinPow(int x,int n){
    if(n == 0)
        return 1;
    if(n == 1)
        return x;
    else{
        int sum = BinPow(x, n / 2) % mod;
        sum*=sum; sum%=mod;
        if(n % 2 != 0)
            sum *= x, sum%=mod;
        return sum;
    }
}

int C(int x,int n){
    if(x < 0 || x > n || n < 0) return 0;
    int sum = pref[n] * suff[x]; sum %= mod;
    sum*=suff[n - x]; sum %= mod;
    return sum;
}

signed main(){
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> h >> w >> a >> b;
    pref[0] = 1;
    for(int i = 1; i <= 250000; i++){
        pref[i] = pref[i - 1]*i;
        pref[i] %= mod;
    }
    suff[0] = 1;
    for(int i = 1; i <= 250000; i++)
        suff[i] = BinPow(pref[i], mod - 2);
    for(int i = 1; i <= 100000; i++){
        if(i >= h - a + 1){
            prefix[i] += C(b - 1, i + b - 2);
            pref[i] %= mod;
            prefix[i] += prefix[i - 1];
        }
    }
    ans = C(h - 1,h + w - 2);
    for(int i = 1; i <= h; i++){
        if(i >= h - a + 1){
            int dist = w - b;
            int dist1 = h - i + 1;
            ans -= C(b - 1, i + b - 2)*C(dist1 - 1,dist + dist1 -2 );
            ans %= mod;
            if(ans < 0) ans += mod;
        }
    }
    cout << ans;
}

Measured memory_bytes: 4992
/*
    ex7-1
    takaoga
 */

#include<stdio.h>

typedef struct point{
    int x_elem;
    int y_elem;
}point;

point shift_point(point p){
    point p_rest;
    p_rest = p;
    p.x_elem = -(p_rest.y_elem);
    p.y_elem = p_rest.x_elem; //反時計周りに90度回転をしている。なお、この場合では行列による回転の表現を採用した。
    return p;
}

int main(void){
    point p1,p2,p3,p4,p_temp; 
    scanf("%d %d %d %d",&(p1.x_elem) , &(p1.y_elem) ,&(p2.x_elem) ,&(p2.y_elem));
    p_temp = p2;
    p_temp.x_elem = p_temp.x_elem - p1.x_elem;
    p_temp.y_elem = p_temp.y_elem - p1.y_elem;
    p_temp = shift_point(p_temp);
    p4.x_elem = p_temp.x_elem + p1.x_elem;
    p4.y_elem = p_temp.y_elem + p1.y_elem; //p2を、p1を基準に反時計90度回転させることで、p4を求めている。
    p_temp = p1;
    p_temp.x_elem = p_temp.x_elem - p4.x_elem;
    p_temp.y_elem = p_temp.y_elem - p4.y_elem;
    p_temp = shift_point(p_temp);
    p3.x_elem = p_temp.x_elem + p4.x_elem;
    p3.y_elem = p_temp.y_elem + p4.y_elem; //p1を、p4を基準に反時計90度回転させることで、p3を求めている。
    printf("%d %d %d %d\n", p3.x_elem ,p3.y_elem ,p4.x_elem ,p4.y_elem);
    return 0;
}

Measured memory_bytes: 1728
n,m,x = map(int,input().split())
ls = []
for i in range(n):
  ls.append(list(map(int,input().split())))
minimum = 10**12
for i in range(2**n+1):
  f = "{{:0{}b}}".format(n)
  now = f.format(i)
  understand = [0] * m
  cost = 0
  for j in range(len(now)):
    if now[j] == "1":
      cost += ls[j][0]
      for k in range(m):
        understand[k] += ls[j][k+1]
  if cost < minimum:
    if min(understand) >= x:
      minimum = cost
if minimum == 10**12:
  print(-1)
else:
  print(minimum)

Measured memory_bytes: 9140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var ans = (GetStr().ToCharArray().Distinct().Count() == 3).YesNo();
            Console.WriteLine(ans);
        }


        static public string GetStr() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

Measured memory_bytes: 11348
Scanf.scanf "%d %d" (fun n s ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in

    let m = 998244353 in
    let ( +@) a b = (a + b) mod m in

    let rec loop i dp =
        if i = n then dp.(s) else (
            let ndp = Array.map (fun a -> a +@ a) dp in
            let c = a.(i) in
            for j = 0 to s - c do
                ndp.(j + c) <- ndp.(j + c) +@ dp.(j)
            done;
            loop (i + 1) ndp
        )
    in
    let dp = Array.make (s + 1) 0 in
    let () = dp.(0) <- 1 in
    loop 0 dp |> Printf.printf "%d\n"
)

Measured memory_bytes: 18436
import itertools

n = int(input());
x = list(map(int, input().split()));
y = list(map(int, input().split()));

new = sorted(x);
kaijo = list(itertools.permutations(new, n));

x_num = kaijo.index(tuple(x))
y_num = kaijo.index(tuple(y))

print(abs(x_num - y_num));

Measured memory_bytes: 8052
import sys
import _collections

def sa(Type= int):
  return [Type(x) for x in input().split()]

def solve():
  ff = _collections.defaultdict(int)

  mn = ord('a')
  mx = ord('z')

  s = sys.stdin.read()
  for ch in s:
    ch = ch.lower()
    chc = ord(ch)

    if mn <= chc <= mx:
      ff[ch]+= 1

  for chc in range(mn, mx+1):
    ch = chr(chc)
    print('{} : {}'.format(ch, ff[ch]))

if __name__ == '__main__':
  # sys.stdin = open('input.txt', 'r')

  solve()


Measured memory_bytes: 5592
#include <bits/stdc++.h>
typedef long long int LL;
using namespace std;

const int N = 1e6+7;
const int MOD = 1e9+7;
const int INF = (~(1<<31));

int fre(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}

inline int read(){
	int x=0,f=-1;char ch=getchar();
	for(;ch<'0'||'9'<ch;ch=getchar())if(ch=='-') f=-1;
	for(;'0'<=ch&&ch<='9';ch=getchar())x=(x<<3)+(x<<1)+ch-'0';
	return x*f;
}

#define lal puts("****");
#define pb  push_back
#define mp  make_pair

/*****************************************************************/

int n,m;
int a[111];
int main(){
	scanf("%d",&n);
	int sum = 0;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),sum += a[i];

	if(sum%10) return 0*printf("%d\n",sum );
	sort(a+1,a+n+1);

	for(int i=1;i<=n;i++){
		if(a[i]%10) {
			sum-=a[i];
			break;
		}
	}
	if(sum%10) return 0*printf("%d\n",sum );
	return 0*puts("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> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
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; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


vector<ll> all_divisor(ll n){
	vector<ll> res;
	for(ll i = 1; i*i<= n; i++){
		if(n%i==0){res.pb(i);res.pb(n/i);}
	}
	sort(res.rbegin(), res.rend());
	return res;
}

int main(){
	int n, m;
	cin >> n >> m;
	auto t = all_divisor(m);
	rep(i,t.size()) {
		if(t[i]*n<=m){
			cout << t[i] << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    
    let mut iter = buf.split_whitespace();
    
    let mut a: i32 = iter.next().unwrap().parse().unwrap();
    let mut b: i32 = iter.next().unwrap().parse().unwrap();
    
    if b % a == 0 {
        println!("{}", a+b);
    } else {
        println!("{}", b-a);
    }
}

Measured memory_bytes: 4352
def solve(n, m, h, a, b):
    for j in range(m):
        a[j] -= 1
        b[j] -= 1
    E = {i:[] for i in range(n)}
    for x, y in zip(a, b):
        E[x].append(y)
        E[y].append(x)
    ans = 0
    for i in range(n):
        ok = True
        for j in E[i]:
            if h[i] <= h[j]:
                ok = False
        ans += ok
    return ans
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for j in range(m):
    a[j], b[j] = map(int, input().split())
print(solve(n,m, h, a, b))

Measured memory_bytes: 39548
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, nums[109];
    cin>>N;
    rep(i,N) cin>>nums[i];
    
    int ans=0;
    rep(k,100){
        bool flag=1;
        rep(i,N){
            if(nums[i]>0){
                ans+=flag;
                flag=0;
                nums[i]--;
            }else{
                flag=1;
            }
        }
    }
    
    cout1(ans)
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);

int main(){
  
  double a,b,x;
  cin>>a>>b>>x;
  double ans;
  if(a*a*b/2>=x){
    ans=atan(a*b*b/(x*2));
  }
  else{
    ans=atan((a*a*b-x)/((a*a*a)/2));
  }
  ans/=PI;
  ans*=180;
  cout<<setprecision(15)<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int gcd(int a,int b){
  if(b==0){
    return a;
  }
  return gcd(b,a%b);
}
int main(){
  int n,k,a[100010],i;
  cin >> n >> k;
  int z=0;
  for(i=0;i<n;i++){
    cin >> a[i];
    if(a[i]>=k){
      z=1;
    }
  }
  if(z==0){
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  if(n==1){
    if(a[0]==k){
      cout << "POSSIBLE" << endl;
    }
    else{
      cout << "IMPOSSIBLE" << endl;
    }
    return 0;
  }
  int x=gcd(a[0],a[1]);
  for(i=2;i<n;i++){
    x=gcd(x,a[i]);
  }
  if(k%x==0){
    cout << "POSSIBLE" << endl;
  }
  else{
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}

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

int main(){
  int n,m,count=0;
  cin>>n>>m;
  vector<vector<int>> num(n,vector<int>(m));
  vector<bool> flag(m,true);
  for(int i=0;i<n;i++){
    vector<bool> flagflag(m,true);
    int a;
    cin>>a;
    for(int j=0;j<a;j++){
      cin>>num[i][j];
      int x=num[i][j]-1;
      flagflag[x]=false;
    }for(int j=0;j<m;j++){
      if(flagflag[j]){
        flag[j]=false;
      }
    }
  }
  for(int i=0;i<m;i++){
    if(flag[i]) count++;
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long int lli;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define ff first
#define ss second
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5 + 5;


int main() {
	IOS
	int T = 1;
	// cin >> T;
	while(T--) 
	{
		lli n;
		cin>>n;
		lli ans = 0;
		for (lli i = 1; i * i <= n - 1; ++i) {
			if (i * i == n - 1) ++ans;
			else if ((n - 1) % i == 0) ans += 2;
		}
		for (lli i = 2; i * i <= n; ++i) {
			if (n % i != 0) continue;
			lli now = n;
			while (now % i == 0) now /= i;
			if (now % i == 1) ++ans;
		}
		cout<<ans;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> arr(n);
    for (int i = 0; i < n; i++) cin >> arr.at(i);
    sort (arr.begin(),arr.end(),greater<int>());
     int prev = arr.at(0);
     int ans = 1;
     for (int i = 1; i < n; i++){
         if(prev != arr.at(i))ans++;
         prev = arr.at(i);   
     }
     cout << ans <<endl;
}

Measured memory_bytes: 3584
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string.h>
using namespace std;
#define maxn 1e6;
int main()
{
	char letter1[30];
	char temp[2];
	int i;
	for(i = 1; i <= 19; i++)
	{
		scanf("%c", &temp[1]);
		if(temp[1] == ',')
			letter1[i] = ' ';
			else
				letter1[i] = temp[1];
	}
	for(i = 1; i <= 19; i++)
		printf("%c", letter1[i]);
		printf("\n");
	
	

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int n; cin>>n;
	int a[n];
	rep(i,n) cin>>a[i];
	bool flg1,flg2=0;
	int cnt=1;
	rep(i,n-1){
		if(!flg2){
			if(a[i]<a[i+1]){
				flg1=1; flg2=1;
			}
			if(a[i]>a[i+1]){
				flg1=0; flg2=1;
			}
		}
		if(flg2){
			if(flg1){
				if(a[i]>a[i+1]){
					cnt++; flg2=0;
				}
			}else{
				if(a[i]<a[i+1]){
					cnt++; flg2=0;
				}
			}
		}
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 768
#include <iostream>
using namespace std;
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#define SQR(X) ( (X) * (X) )

int main()
{
   static long i,j,k,l;
   long double x1,x2,y1,y2;
   long double ans;
   cin >> x1 >> y1 >> x2 >> y2;
   ans = sqrtl(SQR(x1-x2)+SQR(y1-y2));
   printf("%llf\n",ans);

   return 0;
}

Measured memory_bytes: 1236