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

#define rep(i,k,n) for(int i = k; i < n; i++)  
#define repp(i,a,n,k) for(typeof(a) i=a;i!=n;i+=k)

#define int long long
#define all(a) a.begin(),a.end()       

#define pb push_back
typedef long long ll; 
typedef pair<int, int> ii;
typedef pair<int,ii > iii;

typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<char> vchar;

#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)

#define ff first
#define ss second

#define lb lower_bound
#define ub upper_bound
#define me max_element

#define INF 1000000000
//#define mod 998244353
#define mod 1000000007
#define endl "\n"


  


int modPow(int a, int b);
int modInv(int a);     




void solve(){
    int n;
    cin >> n ;
     int a[n];
     rep(i,0,n)cin >> a[i];
     int cnt = 0;
     rep(i,0,n){
         rep(j,0,n){
             rep(k,0,n){
                 if(i!=j && j!=k && i!=k){
                     if(a[i]==a[j]||a[j]==a[k]||a[i]==a[k])continue;
                     int d[] = {a[i],a[j],a[k]};
                     sort(d,d+3);
                     if(d[2]<d[0]+d[1])cnt++;
                 }
             }
         }
     }cout << cnt/6;

}


// Recheck if it is 2^9 or 10^9 
//check for long long overflow
//while adding and subs check if mod becomes -ve
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;




signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed;
    //cout <<setprecision(6);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
  //  int test=1; cin >> test; while(test--)
    solve();
}

int modPow(int a, int b){
    if(b==0)return 1;
    if(b%2==0){
        int x = a*a;
        x%=mod;
        return modPow(x,b/2);
    }
    return (a*modPow(a,b-1))%mod;
}


int modInv(int a){
    return modPow(a,mod-2);
}





Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
#define F first
#define S second 
#define mp make_pair
#define pb push_back
#define pf push_front
#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define debug cerr << "OK\n";
#define ub upper_bound
#define lb lower_bound
#define treap_pair pair<treap*, treap*>
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef set <int> si;
typedef set <ll> sll;
typedef multiset <int> msi;
typedef multiset <ll> msll;
typedef map <int, int> mi;
typedef map <ll, int> mll;
 
const int N = 2e5 + 2;
const int M = 1e5 + 2;
const int mod = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e16;

void data() {
	#ifdef PC
		freopen("main.in", "r", stdin);
		freopen("main.out", "w", stdout);
	#endif
}

int dp[110][M], pr[110][M], n, k, a[N];

int add(int a, int b) {
	return (a + b + ((a + b < 0) ? mod : 0)) % mod;
}

int main() {
	data();
	scanf("%d %d", &n, &k);
	for (int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	dp[0][0] = 1;
	for (int i = 0; i <= k; ++i)
		pr[0][i] = 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j <= k; ++j)
			dp[i][j] = add(dp[i][j], pr[i - 1][j] - (j > a[i] ? pr[i - 1][j - a[i] - 1] : 0LL));	
		for (int j = 0; j <= k; ++j) {
			if (j)
				pr[i][j] = add(pr[i][j - 1], dp[i][j]);
			else
				pr[i][j] = dp[i][0];
		}
	}
	printf("%d", dp[n][k]);
}

/*
	Timus: 288481RF
	CodeForces: fractal
*/


Measured memory_bytes: 81408
N, K = map(int, input().split())

if K == 10:
    Str = str(N)
    print(len(Str))
else:
    cnt = []
    while True:
        if N < K:
            cnt.append(N)
            break
        cnt.append(N%K)
        N = int(N/K)
    print(len(cnt))

Measured memory_bytes: 3060
#include <stdio.h>
  int main(){
	  int n,m,j;
   int a,q;
   int i,k;
   
   int c,d[100];
   for(i=0;i<100;i++){
	   d[i] = 0;
   }
   scanf("%d",&n);
   scanf("%d %d",&a,&q);
   scanf("%d",&c);
   for(i=0;i<n;i++){
	   scanf("%d",&d[i]);
   }
   for(j=0;j<n;j++){
	   for(k=0;k<n-1;k++){
		   if(d[k]<d[k+1]){
              m = d[k+1];
			  d[k+1] =d[k];
			  d[k] = m;
		   }
	   }
   }
   
   for(i=0;i<n;i++){
	   if(c/(a+i*q)< d[i]/q){
		 c += d[i];
	   }else{
		   int x = c/(a+i*q);
		   printf("%d\n",x);
		   break;
	   }
   }
   return 0;
  }

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

const ll mod = 998244353;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

vector<int> adj[200200];

mint dfs(int cur, int prev = -1){
    mint res(1);
    for(int to : adj[cur]){
        if (to == prev) continue;
        res *= dfs(to, cur);
    }
    res += 1;
    return res;
}

int main() {
    int n;
    cin >> n;
    vector<pair<ll, ll>> robots(n);
    rep(i, n) cin >> robots[i].first >> robots[i].second;
    sort(robots.begin(), robots.end());

    set<pair<ll, ll>> rbs;
    for (int i = n - 1; i >= 0; i--){
        ll x = robots[i].first;
        ll d = robots[i].second;
        while(rbs.size() && rbs.begin()->first < x + d){
            adj[i].push_back(rbs.begin()->second);
            rbs.erase(rbs.begin());
        }
        rbs.emplace(x, i);
    }

    mint ans(1);
    for(auto p : rbs){
        ans *= dfs(p.second);
    }
    cout << ans.x << endl;
}

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

using namespace std;

#define endl '\n'
#define ll long long

const ll mod = 1e9 + 7;
const ll maxn = 1e6 + 5;
const double pi = 3.1415926535897932384626433832795028841971693993751058209749445923078;
//iostream::sync_with_stdio(false);

int main()
{
    string s;
    cin >> s;
    if(s.size() % 2)
    {
        string s1,s2,s3;
        s1 = s.substr(0,s.size() / 2);
        s2 = s.substr(s.size() / 2 + 1,s.size() - 1);
        s3 = s2;
        reverse(s2.begin(), s2.end());
        if(s1 == s2)
        {
            string s4;
            s4 = s1;
            reverse(s1.begin(), s1.end());
            if(s4 == s1 && s3 == s2)
            {
                cout << "Yes" << endl;
            }
            else
            {
                cout << "No" << endl;
            }

        }
        else
        {
            cout << "No" << endl;
        }
    }
    else
    {
        string s1,s2,s3;
        s1 = s.substr(0,s.size() / 2);
        s2 = s.substr(s.size() / 2,s.size() - 1);
        s3 = s2;
        reverse(s2.begin(), s2.end());
        if(s1 == s2)
        {
            string s4;
            s4 = s1;
            reverse(s1.begin(), s1.end());
            if(s4 == s1 && s3 == s2)
            {
                cout << "Yes" << endl;
            }
            else
            {
                cout << "No" << endl;
            }
        }
    }
    return 0;
}



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

int main() {
    int n;
    cin >> n;
    vector<int> p(n, 0);
    rep(i, n) cin >> p[i];

    int count = 0;
    rep(i, n) {
        if(p[i] != i+1) {
            count++;
        }
    }
    if(count <= 2) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<utility>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int, int> P;

int main (){

    int H, W; cin >> H >> W;
    vector<string> maze(H);
    int cnt = 0;
    rep(i, H){
        cin >> maze[i];
        rep(j, W){
            if (maze[i][j] == '.') cnt++;
        }
    }
    vector<vector<int> > dist(H, vector<int>(W, -1));
    dist[0][0] = 1;

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

    queue<P> que; que.push(P(0, 0));

    while (!que.empty()){

        P p = que.front();
        que.pop();

        rep(i, 4){

            int ny = p.first + dx[i];
            int nx = p.second + dy[i];

            if (ny < 0 || H <=  ny|| nx < 0 || W <= nx) continue;
            if (maze[ny][nx] == '#') continue;
            if (dist[ny][nx] != -1) continue;

            que.push(P(ny, nx));
            dist[ny][nx] = dist[p.first][p.second] + 1;
        }
    }

    if (dist[H-1][W-1] == -1) cout << -1 << endl;
    else cout << cnt - dist[H-1][W-1] << endl;
    // rep(i,H){
    //     rep(j, W) cout << dist[i][j] << " ";
    //     cout << endl;
    // }
    return 0;

}

Measured memory_bytes: 256
N, M = map(int, input().split())

flag = [False] * N
count = [0] * N
ans = [0, 0]

for i in range(M):
    line = input().split()
    p = int(line[0]) - 1
    S = line[1]
    
    if flag[p]:
        pass
    else:
        if S == 'AC':
            ans[0] += 1
            ans[1] += count[p]
            flag[p] = True
        else:
            count[p] += 1
print('{} {}'.format(ans[0], ans[1]))

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

using namespace std;

int n;
int h,w;
int a[1000][1000];

void solve(){
    int i,j;
    string str;
    cin >> h >> w;
    queue<pair<int,int> > qp;
    memset(a,-1,sizeof(a));
    for(i = 0;i < h;i++){
        cin >> str;
        for(j = 0;j < w;j++){
            if(str[j] == '#'){
                a[i][j] = 0;
                qp.push(make_pair(i,j));
            }
        }
    }
    long long ans = 0;
    while(!qp.empty()){
        i = qp.front().first;
        j = qp.front().second;
        if(i-1 >= 0 && a[i-1][j] == -1){
            a[i-1][j] = a[i][j]+1;
            qp.push(make_pair(i-1,j));
        }
        if(i+1 < h && a[i+1][j] == -1){
            a[i+1][j] = a[i][j]+1;
            qp.push(make_pair(i+1,j));
        }
        if(j-1 >= 0 && a[i][j-1] == -1){
            a[i][j-1] = a[i][j]+1;
            qp.push(make_pair(i,j-1));
        }
        if(j+1 < w && a[i][j+1] == -1){
            a[i][j+1] = a[i][j]+1;
            qp.push(make_pair(i,j+1));
        }
        if(a[i][j] > ans) ans = a[i][j];
        qp.pop();
    }
    cout << ans << endl;
}

int main(){
    solve();
}


Measured memory_bytes: 12304
#include <iostream>
using namespace std;
 int main(void){
     int a,b,c,d,e;
     cin >> a >> b >> c >> d >> e;
     
     int time=0,temp=a;
     
     if(a<0){
     for(int temp=a;temp<0;temp++){
         time +=c;
     }
     temp =0;
     time += d;
     }
     
         for(;temp<b; temp++){
             time +=e;
         }
       
     cout << time << endl;
 }


Measured memory_bytes: 3096
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] inputArray = sc.next().toCharArray();
        int count = 0;

        for(char c: inputArray){
            if(c == 'o'){
                count++;
            }
        }

        System.out.println(700 + 100 * count);
    }

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }
}


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

/*文字列の変換*/
void change (char* s, int k){
	int i = k - 1; 
	switch(s[i]){
		case 'A':
			s[i] = 'a';
			break;
		case 'B':
			s[i] = 'b';
			break;
		case 'C':
			s[i] = 'c';
			break;
	}
}

int main(){
	/*入力*/
	int n, k;
	cin >> n >> k; 
	char* s = new char[n];
	cin >> s;

	change(s, k);
	cout << s;

	delete[] s;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  long long int ans,n; cin>>n; ans=0;
  vector<long long int> v(n+1);
  map<long long int,int> mp;
  for(int i=1;i<=n;i++){
    cin>>v[i]; mp[i+v[i]]++;
  }
  for(int i=1;i<=n;i++){
    ans+=mp[i-v[i]];                            
  }
  cout<<ans;
  return 0;
}


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


int main(void){
    double n,t,a;
    cin >> n >> t >> a;
    vector<double>h;
    rep(i,n){
        double x;
        cin >> x;
        x = t-0.006*x;
        h.push_back(x);
    }
    int ansnum=0;
    double mn = 100000;
    rep(i,n){
        if(abs(h[i]-a) < mn){
            mn = abs(h[i]-a);
            ansnum = i+1;
        }
    }
    
    cout << ansnum <<endl;
    
    return 0;
}















































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


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
  	cin>>s;
  	if(s=="ABC")
      cout<<"ARC"<<endl;	
  	else
      cout<<"ABC"<<endl;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl

const int MN = 200010;

int N;
ll L;
ll X[MN];
ll sm[MN];

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

	rep(i, N) {
		cin >> X[i];
	}

	ll ans = max(X[N-1], L-X[0]);

	rep(tt, 2) {
		sm[0] = 0;
		rep(i, N) {
			sm[i+1] = sm[i] + X[i];
		}

		for (int i = 0; i < N-1; ++i) { //last A
			//same
			int zan = min(N - 1 - i, i);
			ll tmp = X[i] + (L * zan - (sm[i + zan + 1] - sm[i+1])) * 2 + (sm[i] - sm[i-zan]) * 2;
			ans = max(ans, tmp);

			if (i + zan + 2 <= N) {
				ll tmp2 = X[i] + (L * (zan+1) - (sm[i + zan + 2] - sm[i+1])) * 2 + (sm[i] - sm[i-zan]) * 2;
				ans = max(ans, tmp2);
			}
		}

		rep(i, N) {
			X[i] = L - X[i];
		}

		reverse(X, X + N);
	}

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

Measured memory_bytes: 3328
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
typedef long long ll;

int main()
{
   int N;
   cin >> N;
   vector<bool> zoro(N);

   for (int i = 0; i < N; i++)
   {
      int a, b;
      cin >> a >> b;
      zoro[i] = (a == b);
   }
   for (int i = 0; i + 2 < N; i++)
   {
      bool ok = true;
      for (int k = 0; k < 3; k++)
      {
         ok &= zoro[i + k];
      }
      if (ok)
      {
         cout << "Yes" << endl;
         return 0;
      }
   }
   cout << "No" << endl;

   return 0;
}


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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

int main(void) {
  int d;
  cin >> d;
  arrll(c,26);
  vecll2(s, d, 26);
  rep(i,d){
    rep(j,26){
      cin >> s[i][j];
    }
  }

  arrll(t,d);
  rep(i,d){
    t[i]--;
  }

  srand(time(NULL));

  vecll human(26);
  vecll last(26);

  ll manzoku=0;
  rep(i,d){
    int id = 0;
    ll mx = s[i][0];
    rep(j,26){
      if(mx < s[i][j]){
        id = j;
        chmax(mx, s[i][j]);
      }
    }
    id = t[i];
    //prt(mx);

    manzoku += s[i][id];
    rep(j,26){
      if(j!=id) last[j]++;
      else last[j]=0;
    }
    rep(j,26){
      manzoku -= last[j]*c[j];
    }
    prt(manzoku);
  }
}


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

int main()
{
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  int sum = 0, total = 0;
  for(int c = 0; X-c >= 0 || Y-c >= 0; c++)
  {
    if(c == 0) sum = A*X + B*Y;
    else
    {
      total = A*max(0,X-c) + B*max(0,Y-c) + C*c*2;
      sum = min(sum, total);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main(){

    long n, a, b, ans = 0;
    cin >> n >> a >> b;

    if (a == 0) {
        ans == 0;
    } else if (b == 0){
        ans = n;
    } else {
        ans += n / (a+b);
        ans = ans * a;

        if ((n % (a+b)) > a) {
            ans += a;
        } else {
            ans += n % (a+b);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n, m; cin >> n >> m;
    vector<VI> g(n);
    FOR(i, 0, m) {
        int s, t; cin >> s >> t;
        --s, --t;
        g[s].push_back(t);
    }
    int s, t; cin >> s >> t;
    --s, --t;

    auto dis = defvec<int>(INF, n, 3);
    dis[s][0] = 0;
    queue<pair<int,int>> bfs;
    bfs.emplace(s, 0);
    while (!bfs.empty()) {
        int now, cnt;
        tie(now, cnt) = bfs.front();
        bfs.pop();
        each(to, g[now]) {
            if (!chmin(dis[to][(cnt + 1) % 3], dis[now][cnt] + 1))continue;
            bfs.emplace(to, (cnt + 1) % 3);
        }
    }

    cout << (dis[t][0] == INF ? -1 : dis[t][0] / 3) << "\n";
}

Measured memory_bytes: 11264
#include<stdio.h>
#include<math.h>

int main(){

	double l,S,r;
	
	scanf("%lf\n",&r);
	
	S = M_PI*r*r;
	l = M_PI*2*r;
	

	printf("%lf %lf\n",S,l);
	return 0;
}

Measured memory_bytes: 652
#include <iostream>

using namespace std;

int main() {
	int n;
	int cnt = 0;
	int a[200];
	bool isOK = true;
	cin >> n;
	for (int i = 0; i < n ;i++ ) {
		cin >> a[i];
	}
	while (isOK==true) {
		for (int i = 0; i < n; i++) {
			if (a[i] % 2 == 0) {
				a[i] = a[i] / 2;
			}
			else {
				isOK=false;
				break;
			};
		}
		cnt = cnt + 1;
	}

	cout << cnt - 1;

	return 0;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	int a, b, i;
	string s, t, u;
	cin >> s >> t;
	cin >> a >> b;
	cin >> u;
	if(u == s)
	cout << a - 1 << ' ' << b;
	else 
	cout << a << ' ' << b - 1;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
s = input()[::-1]

position = 0
steps = []
while position < n:
    position_ = position
    for l in range(m, 0, -1):
        if position+l > len(s)-1:
            continue
        if s[position+l] == '0':
            position += l
            steps.append(l)
            break
    if position == position_:
        steps = [-1]
        break
print(*steps[::-1])

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

#define endl "\n"
#define ll long long int
#define f(i,n) for(ll i=0;i<n;i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define MOD 1000000007

void yes(){
    cout << "YES" << endl;
}

void no(){
    cout << "NO" << endl;
}

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

    string s,t;
    cin >> s >> t;

    ll len1 = s.length();
    ll len2 = t.length();

    if(len2==len1+1)
    {
        ll cnt=0;

        f(i,len1)
        {
            if(s[i]==t[i])
                cnt++;
        }

        if(cnt==len1)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    else
            cout << "No" << endl;


        /*
           ll arr[n];

           f(i,n)
           cin >> arr[i];
        */

    return 0;
}



Measured memory_bytes: 3652
<?php  
$stdin = trim(fgets(STDIN));
$array = str_split($stdin);
foreach($array as $value){
    if (substr_count($stdin, $value) % 2 !== 0) {
        echo "No";
        return;
    }
    if(end($array) === $value){
        echo "Yes";
        return;
    }
}

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


int main() {
  char a;
  cin >> a;

  if (islower(a)) cout << 'a' << endl;
  else cout << 'A' << endl;
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  int ans = 0;
  int l = 0, r = s.length();
  while (l < r) {
    if (s[l] != s[r - 1]) {
      if (s[l] == 'x') {
        ans++;
        l += 1;
      } else if (s[r - 1] == 'x') {
        ans++;
        r -= 1;
      } else {
        ans = -1;
        break;
      }
    } else {
      l += 1;
      r -= 1;
    }
  }
  cout << ans << '\n';
}

Measured memory_bytes: 3712
import sys
input = sys.stdin.readline

def main():
  n, m = map(int, input().split())
  U = 2**n
  dp = [ [float("inf")]*(2**n) for _ in range(m) ]
  dp[0][0] = 0
  for i in range(1, m):
    a, b = map(int, input().split())
    k = map(int, input().split())
    c = 0
    for l in k:
      c |= 1<<(l-1)
    for j in range(U):
      dp[i][j] = min(dp[i-1][j&(~c)]+a, dp[i-1][j])

  if dp[m-1][2**n-1] == float("inf"):
    print(-1)
  else:
    print(dp[m-1][2**n-1])
    
if __name__ == "__main__":
  main()

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

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

using namespace std;

int main(){
	int n; scanf("%d",&n);
	vector<int> p(n);
	rep(i,n) scanf("%d",&p[i]), p[i]--;

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

	vector<int> cnt(n);
	cnt[n-1]=1;
	for(int i=n-2;i>=0;i--){
		if(pos[i]<pos[i+1]) cnt[i]=cnt[i+1]+1;
		else                cnt[i]=1;
	}
	printf("%d\n",n-*max_element(cnt.begin(),cnt.end()));

	return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<math.h>
#include<set>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>
#include<string>
#include<bitset>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
typedef long long ll;
using namespace std;
long long inf = 1LL << 63 - 1;
static long parseans(long j, long l)
{
    string k = "";
    long ps = 0;
    for (long long i = (long long) j; i <= l; ++i)
    {
        ps *= 10;
        ps += k[i] - '0';
    }
    return ps;
}

int cur = 1;

static long gcd(long a, long b)
{
    if (b == 0)
    {
        return a;
    }
    else
    {
        return gcd(b, a % b);
    }
}

static bool pri(long long k)
{
    if (k == 1LL) return false;
    for (long long i = 2; i * i <= k; i++)
    {
        
        if (k % i == 0) return false;
    }
    return true;
}

double binpow (double a, ll n) {
    if (n == 0)
        return 1;
    if (n % 2 == 1)
        return binpow (a, n-1) * a;
    else {
        int b = binpow (a, n/2);
        return b * b;
    }
}
vector<int> calcz (string s)
{
    int n = s.length();
    vector<int> z (n);
    int l = 0, r = 0;
    for (int i = 1 ; i<n; i++)
    {
        if (i <= r)
        {
            z[i] = min (r - i+ 1, z[i - l]);
        }
        while (i + z[i] < n && s[ z[i] ] == s[i + z[i] ]) z[i]++;
        if (i + z[i] - 1 > r)
        {
            l = i;
            r = i + z[i] - 1;
        }
    }
    return z;
}


vector<int> calcpref(string s)
{
    vector<int> p(s.size() + 1);
    int n = s.length();
    p[0] = 0;
    for (int i = 2; i <= n; i++)
    {
        p[i] = p[i - 1];
        while (p[i] > 0 && s[p[i]] !=s[i-1]) p[i] = p[p[i]];
        if (s[p[i]] == s[i-1]) p[i]++;
    }
    return p;
}


int main()
{
    ios_base:: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll q , n , h , d , s;
    cin >> q >> h >> s >> d >> n;
    ll a =  4 * q;
    ll b = 2 * h;
    ll c = s;
    ll ans = inf;
    if(n == 1)
    {
        ans = min(ans , a);
        ans = min(ans , b);
        ans = min(ans , c);
    }
    else
    if(n % 2 == 0)
    {
        ans = n / 2 * d;
        ans = min(ans , n * a);
        ans = min(ans , n * b);
        ans = min(ans , n * c);
    }
    else
    {
        ans = min(ans , n * a);
        ans = min(ans , n * b);
        ans = min(ans , n * c);
        ans = min(ans , (n - 1) / 2 * d + a);
        ans = min(ans , (n - 1) / 2 * d + b);
        ans = min(ans , (n - 1) / 2 * d + c);

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

Measured memory_bytes: 256
from collections import deque
n=int(input())

alpha=['a','b','c','d','e','f','g','h','i','j','k']

q=deque(['a'])

for i in range(n-1):
    qi_ans=[]
    while(len(q)>0):
        qi=q.popleft()
        qiword_maxind=0
        for j in range(len(qi)):
            qi_ans.append(qi+qi[j])
            qij_ind=alpha.index(qi[j])
            if(qiword_maxind<qij_ind):
                qiword_maxind=qij_ind
        else:
            qi_ans.append(qi+alpha[qiword_maxind+1])
    qi_ans=sorted(list(set(qi_ans)))
#    print(qi_ans)
    q.extend(qi_ans)

lenq=len(q)
for i in range(lenq):
    print(q.popleft())


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

int main() {
	ll a[3], b[3];
	ll mini = 100000;
	for (ll i = 0; i < 3; i++) {
		b[i] = 0;
		cin >> a[i];
	}

	b[0] = a[0] + a[1];
	b[1] = a[1] + a[2];
	b[2] = a[2] + a[0];
	for (ll i = 0; i < 3; i++) {
		if (mini > b[i]) mini = b[i];
	}
	cout << mini << endl;
	return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.ascii;
import core.bitop;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

const dy = [-1, 0, 1, 0],
      dx = [0, 1, 0, -1];

string[] P;
void input() {
    P = readln.chomp.split(" ").array;
}
void solve() {
    int Ans = 0;
    string[] X = new string[9];
    bool check(int y, int x) {
        for (int i = 0, k = 3; i < 2; i++, k = (k + 1) % 4) {
            int ny = y + dy[k],
                nx = x + dx[k];
            if (ny < 0 || ny >= 3) continue;
            if (nx < 0 || nx >= 3) continue;
            //writeln([y, x], " ", [ny, nx]);
            char a = X[y * 3 + x][k],
                 b = X[ny * 3 + nx][(k + 2) % 4];
            if (a == b || std.ascii.toUpper(a) != std.ascii.toUpper(b)) return false;
        }
        return true;
    }

    string rotate(in string s) {
        return s[3] ~ s[0 .. 3];
    }

    void dfs(int v, int used) {
        //writefln("%d: %09b", v, used);
        if (v == 9) {
            Ans++;
            return;
        }

        int y = v / 3,
            x = v % 3;

        foreach (i; 0 .. 9) {
            if (used & (1 << i)) continue;
            X[v] = P[i];
            //writeln(X[v], " ", rotate(X[v]));
            for (int k = 0; k < 4; k++, X[v] = rotate(X[v])) {
                if (check(y, x)) {
                    dfs(v + 1, used | (1 << i));
                }
            }
        }

    }
    dfs(0, 0);
    writeln(Ans);
}

void main() {
    int N;
    scanf("%d\n", &N);
    foreach (i; 0 .. N) {
        input; solve;
    }
}

Measured memory_bytes: 2060
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>


#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)

using namespace std;

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

  int a = n/2;
  double ret = 1-(a/n);
  cout << ret;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

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

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

    int R, C;
    const int mod = 100000;
    while (cin >> R >> C, R) {
        vector<vector<vector<int>>> dp(R, vector<vector<int>>(C, vector<int>(4, 0)));
        rep(i, R) dp[i][0][0] = 1;
        rep2(j, 1, C) dp[0][j][1] = 1;
        rep2(i, 1, R) {
            rep2(j, 1, C) {
                dp[i][j][0] = dp[i-1][j][0] + dp[i-1][j][3];
                dp[i][j][1] = dp[i][j-1][1] + dp[i][j-1][2];
                dp[i][j][2] = dp[i][j-1][0];
                dp[i][j][3] = dp[i-1][j][1];
                rep(k, 4) dp[i][j][k] %= mod;
            }
        }
        int ans = 0;
        rep(k, 4) (ans += dp[R-1][C-1][k]) %= mod;
        cout << ans << endl;
    }

}

Measured memory_bytes: 3824
N = int(input())
A = list(map(int, input().split()))

d = {}
for a in A:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1

s = 0
for k in d:
    s += d[k] * (d[k] - 1) // 2

for i in range(N):
    t = d[A[i]]
    print(s - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2)

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

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0219

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) break;
		int arr[10] = {0};
		for (int i = 0; i < n; i++) {
			int a;
			cin >> a;
			arr[a]++;
		}
		for (int i = 0; i < 10; i++) {
			if (arr[i] == 0) cout << "-";
			for (int j = 0; j < arr[i]; j++) cout << "*";
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1152
import heapq

N, M = map(int, input().split())
A = list(map(lambda x: (-1)*int(x), input().split()))
heapq.heapify(A)

for _ in range(M):
  t_min = heapq.heappop(A)
  heapq.heappush(A, (-1)*(-t_min//2))
  
print(-sum(A))

Measured memory_bytes: 14180
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include <numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD=1000000007;
//scanf("%d", &a); '\n';


int main() {
	int a, b;
	cin >> a >> b;
	cout << 6 - a - b;
	}

	

Measured memory_bytes: 256
# print('input >>')
N = int(input())
a = list(map(int,(input().split())))

breaks = 0
count = 1
for i in range(N):
    if a[i] == count:
        count += 1
    else:
        breaks += 1

# print('-----output-----')
if breaks == N:
    print(-1)
else:
    print(breaks)

Measured memory_bytes: 24872
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(x,y) for(lli i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define bg() begin()
#define en() end()
#define ft first
#define sc second
#define vect_lli_it vector<lli>::iterator
#define set_lli_it set<lli>::iterator
#define inf 1e18
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n;
    cin>>n;
    lli arr[n];
    rep(0,n)
    cin>>arr[i];
    map <lli,lli> mp;
    rep(0,n){
    	mp[arr[i]]++;
	}
	map <lli,lli>::iterator it;
	lli total=0;
	for(it=mp.bg();it!=mp.en();it++){
		total=total+((it->second)*(it->second-1))/2;
	}
	lli ans[n+1];
	rep(0,n+1)
	ans[i]=0;
	for(it=mp.bg();it!=mp.en();it++){
		ans[it->first]=total-((it->second)*(it->second-1))/2+((it->second-1)*(it->second-2))/2;
	}
	rep(0,n){
		cout<<ans[arr[i]]<<"\n";
	}
	return 0;
}


Measured memory_bytes: 12672
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
#define VI vector<int>
#define VL vector<LL>
#define VII vector< vector<int> >
#define VLL vector< vector<LL> >
#define VS  vector<string>
#define VSS vector< vector<string> >
#define PII pair<int,int>
#define PIS pair<int,string>
#define PSI pair<string,int>
#define PLL pair<LL,LL>
const LL MOD = 1000000007;
const LL INF = 1e16;
LL facctorialMethod(int k);
int main(){
    LL n;
    cin >> n;
    for(int i = 9; i >= 1; i--) {
        if(n % i == 0 && n / i <= 9) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

LL facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i){
        sum *= i;
    }
    return sum;
}


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

using namespace std;
double euclid(double x1, double x2, double y1, double y2)
{
    return sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
}
int main()
{
    int n;
    cin>>n;
    int x[n],y[n];
    for(int i=0; i<n; i++)
    {
        cin>>x[i]>>y[i];
    }
    vector<int> v(n);
    for(int i=0; i<n; i++)
    {
        v[i]=i;
    }
    int cnt=0;
    double tmp=0;
    do{

        set<double> s;
        for(int i=0; i<n; i++)
        {
            s.insert(v[i]);
        }
        if(s.size()<n)continue;
        cnt++;
        for(int i=0; i<n-1; i++)
        {
            tmp+=euclid((double)x[v[i]],(double)x[v[i+1]],(double)y[v[i]],(double)y[v[i+1]]);
        }
    }while(next_permutation(v.begin(),v.end()));
    double res=tmp/cnt;
    cout<<fixed<<setprecision(10)<<res<<endl;
    return 0;
}


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

int main(){
  string S;
  cin >> S;
  
  bool flg = true;
  
  if(S.size() %2 != 0){
    flg = false;
  } else {
    for(int i = 0; i < S.size()/2; i+=2){
      cerr << S[i] << S[i+1] << endl;
      if(S[i]=='h' && S[i+1] == 'i'){
        //
      } else { 
        flg = false;
        break;
      }
    }
  }
  if(flg){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    ll a[200005] = {}, p[200005] = {1}, q = 0, z = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) p[i] = p[i - 1] * 2 % mod;
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    q = p[n - 1];
    for (int i = n - 1; i >= 0; i--) {
        z = (z + q * a[i]) % mod;
        q = (q + p[n - 2]) % mod;
    }
    cout << z * p[n] % mod;
    /*
     1
     3 2
     8 6 4
     20 16 12 8
     48 40 32 24 16
     */
}


Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 987654321;
const ll MOD = 1000000007;
//const long double PI = (acos(-1));
//const long double EPS = 0.0000000001;
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};

int n;
vl a;


int main(void) {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL); 
	cout.tie(NULL);
	//freopen("in.txt", "r", stdin);
	cin >> n;
	a.resize(n);

	int cnt = 0;
	ll total = 0;
	ll b = 1000000001;

	rep(i,0,n) {
		cin >> a[i];

		if(a[i] < 0) 
			cnt++;
		a[i] = abs(a[i]);
		b = min(b, a[i]);
		total += a[i];
	}
	//cout << total << endl;
	if(cnt % 2) {
		total -= 2 * b;
	}
	//cout << b << endl;
	cout << total << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

char a;
cin >> a;

if(a >= 'a') {
    cout << 'a' << endl;
} else {
    cout << 'A' << endl;
}

return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int N, sum=0, num[50];
  cin >> N;
  for(int i=0;i<N;i++)
  {
    cin >> num[i];
  }
  for(int j=0;j<N;j++)
  {
    for(int k=j+1;k<N;k++)
    {
      sum+=num[j]*num[k];
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	string s[3];
	for(int i=0;i<3;i++){
		cin>>s[i];
	}
	int turn[3]={0,0,0};
	int check=0;
	for(;;){
		if(turn[check]==s[check].length()){
			switch(check){
			case 0:
				cout<<'A'<<endl;
				break;
			case 1:
				cout<<'B'<<endl;
				break;
			case 2:
				cout<<'C'<<endl;
				break;
			}
			break;
		}
		switch(s[check][turn[check]]){
		case 'a':
			turn[check]++;
			check=0;
			break;
		case 'b':
			turn[check]++;
			check=1;
			break;
		case 'c':
			turn[check]++;
			check=2;
			break;
		}
	}
	return 0;
}

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

int w[35];
int a,b,c,d,e,f;

int main()
{
	int i,j,k,l;
	cin >> a >> b >> c >> d >> e >> f;
	
	long double n = 100.0*e/(100+e);
	long double min = 100.0,now;
	int water,sugar;
	for(i=0;i*a*100<=f;i++)
	{
		for(j=0;(i*a+j*b)*100<=f;j++)
		{
			for(k=0;((i*a+j*b)*100+k*c)<=f;k++)
			{
				for(l=0;((i*a+j*b)*100+k*c+l*d)<=f;l++)
				{
					if(i!=0||j!=0||k!=0||l!=0)
					{
						if((i*a+j*b)*e==k*c+l*d)
						{
							cout << (i*a+j*b)*100+k*c+l*d << " " << k*c+l*d;
							goto exit;
						}
						now = (100.0*(k*c+l*d))/((i*a+j*b)*100.0+k*c+l*d)*1.0;
						if(fabs(n-now)<min&&now<n)
						{
							min = fabs(n-now);
							water = (i*a+j*b)*100;
							sugar = k*c+l*d;
						}
					}
				}
			}
		}
	}
	
	cout << water+sugar << " " << sugar;
	exit:
	cout << endl;
	return 0;
}

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

using namespace std;

int main() {
	int N; cin >> N;
	char* a = new char[N];
	cin >> a;
	int* n = new int[N];//黒の個数
	for (int i = 0; i < N; i++) {
		if (i == 0) {
			if (a[i] == '.') {
				n[i] = 0;
			}
			else {
				n[i] = 1;
			}
			continue;
		}
		if (a[i] == '.') {
			n[i] = n[i-1];
		}
		else {
			n[i] = n[i-1]+1;
		}
	}

	int m = min(n[N - 1],N-n[N-1]);
	for (int i = 0; i < N; i++) {//i番目までを白にする
		int s = n[i] - (n[N - 1] - n[i]) + N - 1 - i;
		m = min(s, m);
	}
	cout << m;
}

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

class Main{
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int[] colors = new int[3];
    for(int i=0; i<3; i++){
      colors[i] = Integer.parseInt(scanner.next());
    }
    scanner.close();

    Arrays.sort(colors);

    int ans = 1;
    for(int i=1; i<3; i++){
      if(colors[i] != colors[i-1]){
        ans ++;
      }
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 21844
//
// Created by 伊東麻沙美 on 2019/10/22.
//

#include<iostream>
#include<algorithm>
using namespace std;


int main(){

    int a,b;
    cin>>a>>b;

    int num1,num2,num3,max;
    num1 = a+b;
    num2 = a-b;
    num3 = a*b;

    max = num1;
    if(max<num2){
        max = num2;
    }
    if(max<num3){
        max = num3;
    }

    cout<<max;
    return 0;
}

Measured memory_bytes: 256
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
def ang(n) Array.new(n){gsmi} end
def debug(k,v) puts "#{k}: #{v}" end
def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

$stdin = File.open('input.txt') if File.exist?('input.txt')
mod = 10**9 + 7
n = gi

(puts 0;exit) if n==1

puts (10**n - 9**n - 9**n + 8**n)%mod


Measured memory_bytes: 23492
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
//MACROS
#define _crt_secure_no_warnings
#define FREEELO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define INF 0x3F3F3F3F
#define MAX 1001
#define MOD 1000000007
#define ALPHABET 128
#define loop(i, n) for (int i = 1; i <= (n); i++)
#define loop0(i, n) for (int i = 0; i < (n); i++)
#define sz(x) (int)x.size()
#define all(v) v.begin(), v.end()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll, ll> llll;
typedef pair<int, int> ii;
typedef unordered_map<int, int> umii;
typedef unordered_map<ll, ll> umll;
typedef unordered_set<int> usi;
typedef unordered_multiset<int> usmi;

int main() {
    ll n; cin >> n;
    ll ans = 0;
    for (int i = 1; i < n; i++){
        ll k = (n - 1) / i;
        ans += k;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3188
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,s[100000],a,tmp,cnt,MOD=1000000007,ans=1LL;
vector<P>v;
ll f(ll n){
    if(n==1)return 1;
    return n*f(n-1)%MOD;
}
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        v.push_back({a,1});
    }
    for(int i=0;i<n;i++){
        cin>>a;
        v.push_back({a,-1});
    }
    sort(v.begin(),v.end());
    for(auto x:v){
        if(x.second==1){
            if(tmp<0){
                ans*=-tmp;
                ans%=MOD;
            }
            tmp++;
        }
        else{
            if(tmp>0){
                ans*=tmp;
                ans%=MOD;
            }
            tmp--;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6384
input = raw_input
range = xrange
k, n = map(int,input().split())
if k%2 == 0:
    print k//2,
    for i in range(n-1): print k,
    exit()
seq = [k//2+1]*n
for i in range(n//2):
    seq[-1]-= 1
    if seq[-1] == 0: seq.pop()
    else: seq.extend([k]*(n-len(seq)))
for x in seq: print x,

Measured memory_bytes: 37404
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>
#include <map>
#include <time.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

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

signed main() {
  string s;
  cin >> s;
  bool h = false, m = false;
  if(!(((int)s[0] - 48 == 0) && ((int)s[1] - 48 == 0)) && (int)s[0] - 48 < 1 || ((int)s[0] - 48 == 1 && (int)s[1] - 48 <= 2)) {
    h = true;
  }
  if(!(((int)s[2] - 48 == 0) && ((int)s[3] - 48 == 0)) && (int)s[2] - 48 < 1 || ((int)s[2] - 48 == 1 && (int)s[3] - 48 <= 2)) {
    m = true;
  }
  if(h && m) {
    cout << "AMBIGUOUS" << endl;
  }else if(h) {
    cout << "MMYY" << endl;
  }else if(m) {
    cout << "YYMM" << endl;
  }else {
    cout << "NA" << endl;
  }
}


Measured memory_bytes: 256