akhauriyash/Code-Regression huggingface dataset:
/*Lucky_Glass*/
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=200;

int n,Vans;
vector<int> lnk[N+3];
char str[N+3];
int Etag[N+3];

void BFS(int st){
	for(int i=1;i<=n;i++) Etag[i]=0;
	queue<int> que;
	que.push(st);Etag[st]=1;
	while(!que.empty()){
		int u=que.front();que.pop();
		for(auto v : lnk[u]){
			if(Etag[v]){
				if(Etag[v]!=Etag[u]+1 && Etag[v]!=Etag[u]-1){
					printf("-1\n");
					exit(0);
				}
				else continue;
			}
			Etag[v]=Etag[u]+1;
			que.push(v);
			Vans=max(Vans,Etag[v]);
		}
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%s",str+1);
		for(int j=1;j<=n;j++)
			if(str[j]=='1')
				lnk[i].push_back(j);
	}
	for(int i=1;i<=n;i++)
		BFS(i);
	printf("%d\n",Vans);
	return 0;
}

Measured memory_bytes: 384
N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
for i in range(len(a)):
  x -= a[i]
  if x==0 and i == len(a)-1:
    print(i+1)
  elif x < 0 or (x != 0 and i == len(a) - 1) :
    print(i)
    break

Measured memory_bytes: 3060
n= int(input())
lists = list(map(int,input().split()))
whole_sum =  0
T_sum_list = []
sum = 0
for i in lists:
        whole_sum += i
for i in lists:
        sum +=i
        val_sum = abs(whole_sum - sum*2)
        T_sum_list.append(val_sum)



print(min(T_sum_list))

Measured memory_bytes: 3060
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 1e5 + 211;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;

int f (int a, int n) {
	int res = 1;
	while (n--) 
		res *= a;
	return res;
}


int get (int x) {
	bool sign = 0;
	if (x < 0) {
		x = -x;
		sign = 1;
	}

	int l = 0, r = 3000, res = 0;
	while (l <= r) {
		int mid = (l + r) / 2;
		if (f(mid, 5) <= x) {
			res = mid;
			l = mid + 1;
		} else 
			r = mid - 1;
	}
	
	if (sign) {
		res = -res;
		x =  -x;
	}

	if (f(res, 5) == x)
		return res;
	return -1;
}
int x;


main () {
	cin >> x;
	for (int i = -2000; i <= 2000; ++i) {
	    int j = get(x + f(i, 5));
		if (j != -1) {
			cout << j << ' ' << i << endl;
			return 0;
		} 
	}
}





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

int main(){
    int N;
    cin >> N;
    int A[200000], S[200000];
    for(int i=0; i<N; i++){
        cin >> A[i];
        S[i] = A[i];
    }
    sort(S, S+N, greater<>());
    for(int i=0; i<N; i++) cout << (S[0] == A[i] ? S[1] : S[0]) << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

template <class T1, class T2>
inline void chmax(T1 &a, const T2 &b)
{
    if (a < b)
    {
        a = b;
    }
}
template <class T1, class T2>
inline void chmin(T1 &a, const T2 &b)
{
    if (a > b)
    {
        a = b;
    }
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<vector<ll>> F(N);
    rep(i, M)
    {
        ll a, b;
        cin >> a >> b;
        --a;
        --b;
        F[a].emplace_back(b);
        F[b].emplace_back(a);
    }

    ll ans = 0;

    vector<bool> ff(N);
    rep(j, N)
    {
        ff[j] = false;
    }

    rep(i, N)
    {
        if (ff[i] == true)
        {
            continue;
        }
        ll tmp = 0;
        stack<ll> s;

        ff[i] = true;
        s.push(i);
        ++tmp;

        while (!s.empty())
        {
            ll num = s.top();
            s.pop();
            for (auto x : F[num])
            {
                if (ff[x] == false)
                {
                    ff[x] = true;
                    s.push(x);
                    ++tmp;
                }
            }
        }

        chmax(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 16388
#include <stdio.h>
#include <algorithm>
#define SIZE 100005

  const int mod = (int)1e9 + 7;
  int dp[SIZE];

  inline int add(int a, int b, int mod) {a += b; return a >= mod ? a - mod : a;}
  inline int sub(int a, int b, int mod) {a -= b; return a < 0 ? a + mod : a;}

  int main(void) {
        int n,k;
        scanf("%d %d",&n,&k);
        dp[0] = 1;
        for(int child=1; child<=n; child++) {
                int upto;
                scanf("%d",&upto);

                int prefix[k+5];
                for(int i=0; i<k+5; i++) prefix[i] = 0;

                for(int used=k; used>=0; used--) {
                        int tem = dp[used];
                        int l = used+1, r = std::min(k, used+upto);
                        if(l<=r) {
                           prefix[l] = add(prefix[l],tem,mod); //(prefix[l]%mod + tem%mod)%mod;
                           if(r+1 <= k) prefix[r+1] = sub(prefix[r+1],tem,mod); //(prefix[r+1]%mod - tem%mod)%mod;
                        }
                }
                int sum=0;
                for(int i=1; i<=k; i++) {
                        sum = add(sum,prefix[i],mod); //(sum%mod + prefix[i]%mod)%mod;
                        dp[i] = add(dp[i],sum,mod); //(dp[i]%mod + sum%mod)%mod;
                }
        }
        printf("%d", dp[k]);
        return 0;
  }













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

int main(){
  int64_t N;
  cin>>N;
  int64_t k=1;
  for(int64_t i=0;i<N;i++){
    int64_t j;
    cin>>j;
    k=k/__gcd(k,j)*j;
  }
  cout<<k<<endl;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int, input().split()))
    s = [0 for i in range(10**5+1)]
    sa = sum(a)
    for i in a:
        s[i] += 1
    q = int(input())
    for _ in range(q):
        b, c = map(int, input().split())
        s[c] += s[b]
        sa += (c-b)*s[b]
        s[b] = 0
        print(sa)

main()



Measured memory_bytes: 20828
use std::cmp;

fn main() {
    let sc = std::io::stdin();
    let mut sc = Scanner { reader: sc.lock() };
    let n: usize = sc.read();
    let fixed_cost: usize = sc.read();
    let x: Vec<usize> = sc.read_vec(n);
    let mut sum = vec![0; n + 1];
    for i in 0..n {
        sum[i + 1] = sum[i] + x[i];
    }

    let mut ans = 1e18 as usize;
    for count in 1..(n + 1) {
        let mut sub = 0;
        let mut multiply = 3;
        let mut head = n;
        while head > 0 {
            let tmp = if multiply == 3 { 5 } else { multiply };
            if head >= count {
                sub += (sum[head] - sum[head - count]) * tmp;
                head -= count;
            } else {
                sub += (sum[head] - sum[0]) * tmp;
                head = 0;
            }
            multiply += 2;
        }
        sub += count * fixed_cost + n * fixed_cost;
        ans = cmp::min(ans, sub);
    }

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

pub struct Scanner<R> {
    reader: 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
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_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: 8444
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <iomanip>

using namespace std;

#define ll long long
#define vi vector<int>
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pi 3.14159265359


ll gcd(ll a, ll b)
{
	ll c;
	while (a != 0) {
		c = a; a = b % a;  b = c;
	}
	return b;
}

int main() {
	ll A,B,C;
	cin >> A >> B;

	if (A*B % 2 == 0) {
		cout << "No";
	}
	else cout << "Yes";
	return 0;



}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}

vector<ll> pw2(51,1);vector<ll> pw10(19,1);
int main(){
    {rep1(i,50) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N; cin>>N;
    vector<ll> x(N,0);
    vector<ll> y(N,0);
    rep(i,N) cin>>x[i]>>y[i];
    long double sum=0.0;
    rep(i,N-1)FOR(j,i+1,N){
        sum+=sqrt((long double)((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])));
    }
    printf("%.14Lf\n",2.0*sum/N);
}




Measured memory_bytes: 3736
#include <stdio.h>

int main(){
    int i,n;
    double sum =100000;
    scanf("%d",&n);
    for (i=1; i<=n; i++) {
        sum *=1.05;
        if ((int)sum % 1000 !=0) {
            sum=((int)sum/1000+1)*1000;
        }
    }
    
    printf("%d\n",(int)sum);
    
    return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    int N, K, R, S, P;
    string T;
    cin >> N >> K >> R >> S >> P >> T;

    vector<int> t(N);
    rep(i, N) {
        if (T[i] == 'r') t[i] = 2;
        if (T[i] == 's') t[i] = 0;
        if (T[i] == 'p') t[i] = 1;
    }

    map<char, int> mp; // じゃんけんに勝った時に得るスコアのマップ
    mp['r'] = P;
    mp['s'] = R;
    mp['p'] = S;

    vector<vector<int>> dp(N + K, vector<int>(3));
    rep(l, K) {
        for (int i = l; i < N; i += K) {
            int ni = i + K;
            rep(j, 3) { // じゃんけんの3パターンを試す
                // このじゃんけんでjを出す場合,直前の手はj以外
                chmax(dp[ni][j], dp[i][(j + 1) % 3]);
                chmax(dp[ni][j], dp[i][(j + 2) % 3]);

                if (t[i] == j) { // じゃんけんに勝った場合
                    chmax(dp[ni][j], dp[i][(j + 1) % 3] + mp[T[i]]);
                    chmax(dp[ni][j], dp[i][(j + 2) % 3] + mp[T[i]]);
                }
            }
        }
    }

    int ans = 0;
    rep(l, K) ans += max(dp[N + K - 1 - l][0], max(dp[N + K - 1 - l][1], dp[N + K - 1 - l][2]));
    cout << ans << endl;
}

Measured memory_bytes: 11008
#include<iostream>
#include<cmath>
using namespace std;
typedef long long int LL;

int main(){
	LL a,b,c;
	LL x,y;
	LL i,j,k;
	LL s=0;
	cin>>a>>b>>c;
	cin>>x>>y;
	if(a+b>2*c){
		k=min(x,y);
		s+=k*2*c;
		x-=k,y-=k;
	}else{
		s+=a*x+b*y;
		x=0,y=0;
	}
	if(x>0){
		if(a>2*c)s+=x*2*c,x=0;
		else s+=x*a,x=0;
	}
	
	if(y>0){
		if(b>2*c)s+=y*2*c,y=0;
		else s+=y*b,y=0;
	}
	cout<<s<<endl;
	return 0;
}
		


Measured memory_bytes: 256
def examD():
    N = I()
    A = LI(); A.sort()
    d = defaultdict(int)
    cur = int(0)
    for i in A:
        d[i] +=1
    for i in d:
        cur += d[i]
    cur -= len(d)
    ans = N - cur - cur%2
    print(ans)

import sys
import copy
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()


Measured memory_bytes: 18592
#include <iostream>
using namespace std;
int main(void){
    long long N,i,S,T,ans;
    cin>>N;
    long long W[N];
    S=0;
    for(i=0;i<N;i++){
        cin>>W[i];
        S+=W[i];
    }
    ans=100000000;
    T=0;
    for(i=0;i<N;i++){
        T+=W[i];
        ans=min(ans,abs(S-T*2));
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t N,A,B,count,s,t;
  cin >> N >> A >> B;
  s = N/(A+B);
  t = N-(A+B)*s;
  if(t<A) {
    count=s*A+t;
  }else {
    count=s*A+A;
  }
   cout << count << endl;
}

Measured memory_bytes: 256
N = int(input())
D = []
for i in range(N):
  d1, d2 = map(int, input().split())
  D.append([d1, d2])
count = 0
for i in range(N):
  if D[i][0] == D[i][1]:
    count += 1
  else:
    count = 0
  if count == 3:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
using namespace std;

template<typename Integral = int> Integral fibonacci(const int &n) {
  static std::vector<Integral> dp(2, 1);
  int prev = dp.size();
  if (prev < n + 1) {
    dp.resize(n + 1);
    loop(i, prev, dp.size()) dp[i] = dp[i - 1] + dp[i - 2];
  }
  return dp[n];
}

main {
  int n;
  cin >> n;
  cout << fibonacci(n) << endl;
}

Measured memory_bytes: 3152
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

prev_a = 0
satisfaction = sum(B)
for a in A:
    if prev_a + 1 == a and prev_a > 0:
        satisfaction += C[prev_a-1]
    prev_a = a

print(satisfaction)

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

using namespace std;

int n;
double a;

void Process()
{
    for (int i=1; i<=n; i++)
    {
        int x;      cin >> x;
        a += (double) 1/x;
    }

    a = 1 / a;

    cout << setprecision(14) << fixed << a;
}

void Input()
{
    ios_base::sync_with_stdio(0);   cin.tie(0);

    cin >> n;
}

int main()
{
    Input();
    Process();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  lint q, h, s, d, n, m = 0;
  cin >> q >> h >> s >> d >> n;
  q *= 4; h *= 2;
  if(2*q > d && 2*h > d && 2*s > d){
    m += d * (n/2);
    m += (n%2) * min(q, min(h, s));
  }
  else m += n * min(q, min(h, s));
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int N, M;
    cin >> N >> M;
    unordered_map<int,bool> mp1;
    unordered_map<int,bool> mp2;
    
    rep(i,M){
        int a,b;
        cin >> a >> b;
        --a,--b;
        if(a==0) mp1[b]=true;
        if(b==(N-1)) mp2[a]=true;
    }
    
    bool ans = false;
    
    rep(i,N){
        if(mp1[N-1] || mp1[i] && mp2[i]){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }

    cout << "IMPOSSIBLE" << endl;    
}


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

int h, w;
const int H_MAX = 80;
const int W_MAX = 80;
const int SEG = 26000;
const int ZERO = 13000;
int A[H_MAX+2][W_MAX+2];
int B[H_MAX+2][W_MAX+2];
int S[H_MAX+2][W_MAX+2];
bool dp[H_MAX+2][W_MAX+2][SEG];

int main(){
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++)cin >> A[i][j];
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> B[i][j];
            S[i][j] = abs(A[i][j] - B[i][j]);
        }
    }

    memset(dp, false, sizeof(dp));
    dp[0][0][ZERO+S[0][0]] = true;
    dp[0][0][ZERO-S[0][0]] = true;
    for(int k = 1; k <= h+w-2; k++){
        int hmin = max(0, k-w+1);
        int hmax = min(h-1, k);
        for(int i = hmin; i <= hmax; i++){
            int nowh = i;
            int noww = k-i;
            int num = S[nowh][noww];
            for(int j = 0; j < SEG; j++){
                if (nowh > 0){
                    if (dp[nowh-1][noww][j]){
                        if (j - num >= 0)dp[nowh][noww][j-num] = true;
                        if (j + num < SEG)dp[nowh][noww][j+num] = true;
                    }
                }
                if (noww > 0){
                    if (dp[nowh][noww-1][j]){
                        if (j - num >= 0)dp[nowh][noww][j-num] = true;
                        if (j + num < SEG)dp[nowh][noww][j+num] = true;
                    }
                }
            }
        }
    }

    int ans;
    for(int i = 0; i < ZERO; i++){
        if (dp[h-1][w-1][i+ZERO] || dp[h-1][w-1][ZERO-i]){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 171008
/* ex 7_1
   riverstone */

#include <stdio.h>

//頂点を表す構造体
typedef struct point{
    int x_elem;
    int y_elem;
}point;

//関数shift_pointの定義
point shift_point(point point1,point point2){
    //point型の変数を定義
    point shift_p, direct_vector, rot_vector;

    //始点point1終点point2のベクトル
    direct_vector.x_elem=point2.x_elem-point1.x_elem;
    direct_vector.y_elem=point2.y_elem-point1.y_elem;

    //vectorを90度回転
    rot_vector.x_elem=-direct_vector.y_elem;
    rot_vector.y_elem= direct_vector.x_elem;

    //point2の隣の点の座標(point1ではない方の)
    shift_p.x_elem=point2.x_elem+rot_vector.x_elem;
    shift_p.y_elem=point2.y_elem+rot_vector.y_elem;
 
    return shift_p;
}

int main(void){
    point point1, point2, point3, point4;
    //入力を受け取る
    scanf("%d %d %d %d", &point1.x_elem, &point1.y_elem, &point2.x_elem, &point2.y_elem);

    //残り2点の座標を求める
    point3=shift_point(point1,point2);
    point4=shift_point(point2,point3);

    //出力
    printf("%d %d %d %d\n", point3.x_elem, point3.y_elem, point4.x_elem, point4.y_elem);
    return 0;
}

Measured memory_bytes: 1728
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>

using namespace std;

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

typedef pair<int, int> p_i;

int main()
{
    string s;
    cin >> s;
    int res = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '+')
            res++;
        if (s[i] == '-')
            res--;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int n=sc.nextInt(),a=sc.nextInt(),b=sc.nextInt();
			int ans=0;
			for(int i=0;i<n;i++){
				int t=sc.nextInt();
				if(a>t || t>=b) ans++;
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 9808
// Etavioxy
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#define il inline
#define ll long long
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in" ,"r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch;int f=1;
	while(!isdigit(ch=getchar()))f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar()))x=(x*10)+(ch^'0');
	return f*x;
}

il double logab(int a,int b){
	return log(b)/log(a);
}

int main(){
	int n=ci(), r=ci();
	printf("%d\n",(int)logab(r,n)+1);
	return 0;
}


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

int main() {
  long long n, a, b;
  cin >> n >> a >> b;
  
  long long c, ans;
  c = n / (a + b);
  ans = c * a + min(a, n % (a + b));
  
  cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, S, T):

    MOD = 10**9 + 7
    dp0 = [1] * (M+1)
    for s in S:
        dp1 = dp0[:]
        k = 0
        for j, t in enumerate(T):
            if s == t:
                k += dp0[j]
            dp1[j+1] = (dp0[j+1] + k) % MOD
        dp0 = dp1

    return dp0[-1]


def main():
    N, M = read_int_n()
    S = read_int_n()
    T = read_int_n()
    print(slv(N, M, S, T))


if __name__ == '__main__':
    main()


Measured memory_bytes: 62824
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n,t,a;
  cin>>n>>t>>a;
  vector<ll> h(n);
  rep(i,n) cin>>h[i];
  int idx=0;
  int diff = 1e9;
  rep(i,n) {
//    cout << "i="<<i<<",tempa="<<1000*t-6*h[i]<<endl;
    int tmp = abs(1000*t-6*h[i]-1000*a);
    if(tmp<diff) {
      idx = i;
      diff = tmp;
    }
  }
  cout << idx+1 << endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
S=list(input())
left=S[:N]
right=S[N:][::-1]
ans=0
for i in range(2**N):
    red=[]
    blue=[]
    for j in range(N):
        if (i>>j)&1==1:
            red.append(S[j])
        else:
            blue.append(S[j])
    L=len(red)
    if L==0 or L==N:
        if right==left:
            ans+=1
        continue
    dp=[[0]*L for _ in range(N)]
    zero=0
    if right[0]==red[0]:
        dp[0][0]=1
    if right[0]==blue[0]:
        zero=1
    for j in range(1,N):
        if right[j]==red[0]:
            dp[j][0]=zero
        if j-1+L<N and right[j]==blue[j-1]:
            dp[j][0]+=dp[j-1][0]
        if j+L<N and right[j]==blue[j]:
            zero*=1
        else:
            zero=0
        for k in range(1,min( j+1,len(red))):
            if right[j]==red[k]:
                dp[j][k]+=dp[j-1][k-1]
            if j-k<=N-L and right[j]==blue[j-k-1]:
                dp[j][k]+=dp[j-1][k]
    ans+=dp[N-1][-1]
print(ans)

Measured memory_bytes: 77020
//#####   #####   #####   #####   #####   #       #####   #   #//
//#   #   #   #   #       #       #   #   #       #   #   ## ##//
//#####   #####   #####   #       #####   #       #####   # # #//
//##      #   #       #   #       #   #   #       #   #   #   #//
//# #     #   #       #   #       #   #   #       #   #   #   #//
//#  #    #   #       #   #       #   #   #       #   #   #   #//
//#   #   #   #   #####   #####   #   #   #####   #   #   #   #//


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ppb pop_back
#define cs(n) cout<<n<<" "
#define cn(n) cout<<n<<"\n"
#define rep(i,j,k) for(int i=j;i<k;i++)
#define rrep(i,j,k) for(int i=j;i>=k;i--)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define deb(x) cout << #x << " " << x << endl;
ll bin(ll a, ll b, ll mod)
{
	if (b == 0)
		return 1;
	if (b % 2 == 0)
		return bin((a * a) % mod , b / 2 , mod) % mod;
	return ((a % mod) * (bin((a * a) % mod , b / 2 , mod) % mod)) % mod;
}
void solve()
{
	int n, x, t;
	cin >> n >> x >> t;
	if (n % x == 0) {
		cout << n / x*t;
	}
	else {
		cout << (n / x + 1)*t;
	}
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r" , stdin);
	freopen("output.txt" , "w" , stdout);
#endif
	fastio;
	int t;
	t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}
#ifndef ONLINE_JUDGE
	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cmath>

double CalcTime(double speed)
{
	return(speed / 9.8);
}

double CalcHeight(double time)
{
	return(4.9*std::pow(time, 2));
}

int CalcStep(double height)
{
	return static_cast<int>((height + 5.0) / 5.0)+1;
}

int Answer(double speed)
{
	double time = CalcTime(speed);
	double height = CalcHeight(time);
	return(CalcStep(height));
}

int main()
{
	double v = 0.0;

	while (std::cin >> v)
	{
		std::cout << Answer(v) << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3196
#include<stdio.h>
#define MAX 1000000
#define SENTI 2000000000

typedef struct Card{
  char pic;
  int num;
}Card;

Card L[MAX / 2 + 2];
Card R[MAX/ 2 + 2];

void Merge(Card *, int, int, int, int);
void MergeSort(Card *, int, int, int);
int Prtition(Card *, int, int, int);
void QuickSort(Card *, int, int, int);

int main(){
  int n, i, value;
  int stable = 1;
  char P[10];
  Card A[MAX], B[MAX];

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    scanf("%s %d",P,&value);
    A[i].pic = B[i].pic = P[0];
    A[i].num = B[i].num = value;
  }

  MergeSort(A,n,0,n);
  QuickSort(B,n,0,n-1);

  for(i = 0 ; i < n ; i++){
    if(A[i].pic != B[i].pic) stable = 0;
  }

  if(stable == 1) printf("Stable\n");
  else printf("Not stable\n");

  for(i = 0 ; i < n ; i++){
    printf("%c %d\n",B[i].pic,B[i].num);
  }
  return 0;
}

void Merge(Card A[], int n, int left, int mid, int right){
  int n1, n2, i, j, k;

  n1 = mid - left;
  n2 = right - mid;
  for(i = 0 ; i < n1 ; i++) L[i] = A[left + i];
  for(i = 0 ; i < n2 ; i++) R[i] = A[mid + i];
  L[n1].num = R[n2].num = SENTI;

  i = 0;
  j = 0;
  for(k = left ; k < right ; k++){
    if(L[i].num <= R[j].num) A[k] = L[i++];
    else A[k] = R[j++];
  }
}

void MergeSort(Card A[], int n, int left, int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right) / 2;
    MergeSort(A, n, left, mid);
    MergeSort(A, n, mid, right);
    Merge(A, n, left, mid, right);
  }
}

int Partition(Card A[], int n, int p, int right){
  int i, j;
	Card x, tmp;

  x = A[right];
  i = p - 1;
  for(j = p ; j < right ; j++){
    if(A[j].num <= x.num){
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i + 1];
  A[i + 1] = A[right];
  A[right] = tmp;
  return i+1;
}

void QuickSort(Card A[], int n, int p, int r){
  int x;

  if(p < r){
    x = Partition(A, n, p, r);
    QuickSort(A, n, p, x - 1);
    QuickSort(A, n, x + 1, r);
  }
}



Measured memory_bytes: 4044
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>

#define MAX 1000000

using namespace std;

vector <int> y;
vector <int> z;

int main(void){
	for(int i=0; ; i++){
		y.push_back(i*i);
		if(y[i] > MAX) break;
	}
	for(int i=0; ; i++){
		z.push_back(i*i*i);
		if(z[i] > MAX) break;
	}

	while(1){
		int e; cin >> e;
		if(!e) break;

		int ans = MAX;
		for(int i=0; i<y.size(); i++){
			for(int j=0; j<z.size(); j++){
				if(y[i]+z[j] <= e){
					int x = e-(y[i]+z[j]);
					ans = min(ans, x + i + j);
				} else break;
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3124
#include <iostream>
using namespace std;
int main(){
    int k,s;
    cin>>k>>s;
    int ans=0;
    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            int ij=s-i-j;
            if(ij<=k&&ij>=0)ans++;

        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int S;

	scanf("%d", &S);

	if (0 <= S && S < 86400)
	{
		int h = S / 3600; 
		int m = (S - h * 3600) / 60;
		int s = (S - h * 3600) - (m * 60);
		printf("%d:%d:%d\n", h, m, s);
	}
	else
	{
		printf("error");
	}

	return 0;
}

Measured memory_bytes: 2680
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

import math

n, d = na()
xy = nan(n)

ans = 0

for i in range(n):
    x, y = xy[i]
    if math.sqrt(pow(x, 2) + pow(y, 2)) <= d:
        ans += 1

print(ans)

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

int main(){
	int n,a[100],s;
	while(cin >> n,n){
		s = 0;
		for(int i = 0;i < n;++i){
			cin >> a[i];
		}
		sort(a,a+n);
		for(int i = 1;i < n-1;++i){
			s += a[i];
		}
		cout << s/(n-2) << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;


int main(){

  double d,t,s;
  cin >> d >> t >> s;


  if((d/s)>t){
    cout << "No" << endl;
  }

else{
  cout << "Yes" << endl;
}

  }


Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = LLONG_MAX / 2;
int main() {
    int N; cin >> N;
    vector<ll> A(N), B(N);

    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }

    ll sum = 0, mi = INF;

    for (int i = 0; i < N; i++) {
        sum += A[i];
        if (A[i] > B[i]) {
            mi = min(mi, B[i]);
        }
    }

    if (mi == INF) cout << 0 << endl;
    else cout << sum - mi << endl;

    return 0;
}


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

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

    for (int i = 1; i < 10; i++)
    {
        for (int k = 1; k < 10; k++)
        {
            if ((i * k) == n)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

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

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int[] blood = { 0, 0, 0, 0 };

        String line;
        while ((line = br.readLine()) != null) {
            String type = line.split(",")[1];
            switch (type) {
            case "A":
                blood[0]++;
                break;
            case "B":
                blood[1]++;
                break;
            case "AB":
                blood[2]++;
                break;
            case "O":
                blood[3]++;
                break;
            }
        }

        for(int i : blood){
            System.out.println(i);
        }
    }
}


Measured memory_bytes: 24256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[][] a = new int[3][3];
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length; j++) {
                a[i][j] = sc.nextInt();
            }
        }
        int n = sc.nextInt();
        int[] b = new int[n];
        for (int i = 0; i < b.length; i++) {
            b[i] = sc.nextInt();
        }
        boolean[][] isSelected = new boolean[3][3];
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length; j++) {
                for (int j2 = 0; j2 < b.length; j2++) {
                    if (a[i][j] == b[j2]) {
                        isSelected[i][j] = true;
                        break;
                    }
                }
            }
        }
        if ((isSelected[0][0] == true && isSelected[0][1] == true && isSelected[0][2] == true)
            || (isSelected[1][0] == true && isSelected[1][1] == true && isSelected[1][2] == true)
            || (isSelected[2][0] == true && isSelected[2][1] == true && isSelected[2][2] == true)
            || (isSelected[0][0] == true && isSelected[1][0] == true && isSelected[2][0] == true)
            || (isSelected[0][1] == true && isSelected[1][1] == true && isSelected[2][1] == true)
            || (isSelected[0][2] == true && isSelected[1][2] == true && isSelected[2][2] == true)
            || (isSelected[0][0] == true && isSelected[1][1] == true && isSelected[2][2] == true)
            || (isSelected[0][2] == true && isSelected[1][1] == true && isSelected[2][0] == true)
        ) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
}

Measured memory_bytes: 23764
n,k=map(int,input().split())

def cmb2(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**5
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

for i in range(1,k+1):
    ans=cmb2(n-k+1,i,mod)*cmb2(k-1,i-1,mod)%mod
    print(ans)


Measured memory_bytes: 15492
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
const int N=1e5+5,MAX=3e7,MOD=1e9+7;
 
using namespace std;


int main()
{
   

    	int n;

    	cin>>n;

    	double ans = 0;

    	for(int i=0;i<n;i++){
    		double x;
    		cin>>x;
    		ans+=1/x;
    	}

    	ans = 1/ans;

    	printf("%.9lf\n",ans );
	
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

void solve(){
}
int main(){
    string s;
    cin >> s;
    vector<char> dna(4);
    dna.at(0) = 'A';
    dna.at(1) = 'T';
    dna.at(2) = 'G';
    dna.at(3) = 'C';
    int n = s.size();
    int subsum = 0;
    int tmpmax = 0;
    for(int i = 0; i < n; i++){
        char c;
        c = s.at(i);
        if(c == dna.at(0) || c == dna.at(1) || c == dna.at(2) || c == dna.at(3)){
            subsum++;
        }
        else{
            tmpmax = max(tmpmax, subsum);
            subsum = 0;
        }
    }
    tmpmax = max(tmpmax, subsum);
    cout << tmpmax << endl;
    solve();
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(void) {
    int i, x, max;
    int N;
    char c;
    string S;
    cin >> N >> S;
    x = 0;
    max = x;
    for(i = 0; i < N; i++) {
        c = S[i];
        if(c == 'I') {
            x++;
            if(max < x) {
                max = x;
            }
        } else {
            x--;
        }
    }
    cout << max << endl;
    return 0;
}




Measured memory_bytes: 256
n=int(input())
w=input()
l=[w]
t=w[::-1][0]
for _ in range(n-1):
    w=input()
    if w[0]!=t or w in l:
        print('No')
        break
    t=w[::-1][0]
    l.append(w)
else:
    print('Yes')

Measured memory_bytes: 38256
n,m=map(int,input().split())
if n==1 and m==1:
  print(1)
elif n==1 and m!=1:
  print(m-2)
elif m==1 and n!=1: 
  print(n-2)
elif n==2:
  print(0)
elif n>3:
  print((m-2)*(n-2))


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

int N, X;
vector<int> L;

void solve() {
  int d = 0;
  int res = 1;
  for (int i = 0; i < N; i++) {
    d += L[i];
    if (d <= X) {
      res++;
    } else {
      break;
    }
  }
  cout << res << '\n';
}

int main() {
  cin >> N >> X;
  L.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  solve();
  return 0;
}


Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<utility>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
// FIFO First in first out.
#include<deque>
// Either end of the line.
#include<cctype>
#include<list>
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define debug(x) cout << x << endl
#define rep(a,b,c) for(int i=a; i<b ;i++)
#define sora(v) sort(v.begin(), v.end())
#define sord(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define print(p) cout << p <<endl
#define yes puts("YES")
#define no puts("NO")
#define line cout <<endl;
//#define sizev(s) long long SIZE;  SIZE = s.size();
using namespace std;
int T;
double pi = acos(-1.0);
typedef long long ll;
vector<long long>v;
long long factorial(long long x) {
	long long total = 1;
	for (int i = 2; i <= x; i++)
		total *= i;
	return total;
}
//sieve algorithm. nlog(log(n)).
bool isprime(long long x) {
	vector<bool>prime(x + 1, 1);
	prime[0] = prime[1] = 0;
	for (long long i = 2; i * i <= x; i++)
		if (prime[i])
			for (long long j = i * i; j <= x; j += i)
				prime[j] = 0;
	return prime[x];

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

	return (a * b) / gcd(a, b);
	//int lar = max(a, b);
	//int small = min(a, b);
	//for (int i = lar; ; i += lar) {
	//	if (i % small == 0)
		//	return i;
	//}
}
ll temp = 1;
ll fastpow(ll base, ll exponent) {

	if (exponent == 0) return 1;
	if (exponent == 1) return (temp * base);
	if (exponent % 2 == 0)
		return fastpow(base * base, exponent / 2);
	else {
		temp *= base;
		fastpow(base * base, exponent / 2);
	}
}
void fill(long long f) {
	v.clear();
	long long x;
	for (long long i = 0; i < f; i++) {
		cin >> x;
		v.push_back(x);
	}
}
void printv() {
	int size = v.size() - 1;
	for (int i = 0; i <= size; i++) {
		cout << v[i] << " ";
	}
	cout << endl;
}
inline void solve() {
	//*******************************************************************************
	char s; cin >> s;
	if (s >= 'a' && s <= 'z') {
		print('a');
	}
	else print('A');
	////////////////////////////////////////////////////////////////////////////////
}int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//cin >> T; while (T--)
	{
		solve();
	}
	return 0;
}

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

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

    // cout << S[0] << endl;
 
    // AABB
    if((S[0] == S[1]) && ((S[2] == S[3])) ){
        if((S[1] != S[2])){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        // ABBA
        if ((S[1] == S[2]) && (S[0] == S[3])){
            cout << "Yes" << endl;
        }else{
            //ABAB
            if((S[0] == S[2]) && (S[1] == S[3])){
                cout << "Yes" << endl;
            }else{
                cout << "No" << endl;
            }
        }
    }    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 105
char map[105][111];
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<100;i++)
		for(int j=0;j<100;j++)
			map[i][j]=i<50?'.':'#';
	int x=0,y=0;
	for(int i=0;i<b-1;i++)
	{
		map[x][y]='#';
		y+=2;
		if(y>=100)x+=2,y=0;
	}
	x=99;y=0;
	for(int i=0;i<a-1;i++)
	{
		map[x][y]='.';
		y+=2;
		if(y>=100)x-=2,y=0;
	}
	printf("100 100\n");
	for(int i=0;i<100;i++)
		printf("%s\n",map[i]);
}

Measured memory_bytes: 256
ABCD = input()
A = int(ABCD[0])
B = int(ABCD[1])
C = int(ABCD[2])
D = int(ABCD[3])
op = ['+','-']

for op1 in op:
    for op2 in op:
        for op3 in op:
            ans = 0
            ans = A+B if op1 == '+' else A-B
            ans = ans+C if op2 == '+' else ans-C
            ans = ans+D if op3 == '+' else ans-D
            if ans == 7:
                print(str(A)+op1+str(B)+op2+str(C)+op3+str(D)+'=7')
                exit()

Measured memory_bytes: 3064
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    print(((n-1)*n)//2)


if __name__ == '__main__':
    main()


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

using ll=long long;

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int div1(ll x){
  return x%1000000007;
}

main(){
    string s,day[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    cin >> s;
    int i,i2;
    for (i=0;true;i++){
        if (s==day[i]) break;
    }
    for (i2=i+1;true;i2++){
        if (day[i2%7]=="SUN") break;
    }
    cout << i2-i << endl;
}

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

using namespace std;

int main(void){


int a,b,c,d;

cin >> a >> b >> c >> d;

if(a+b- c-d > 0){cout << "Left" << endl;}
else if (a+b- c-d == 0){cout <<"Balanced" << endl;}
else{cout << "Right" << endl;}


return 0;



}


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

int check(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double r){
    double abx = x2 - x1;
    double aby = y2 - y1;
    double abz = z2 - z1;
    double acx = x3 - x1;
    double acy = y3 - y1;
    double acz = z3 - z1;
    double AB = sqrt(abx * abx + aby * aby + abz * abz);
    double AC = sqrt(acx * acx + acy * acy + acz * acz);
    double dot = (abx * acx + aby * acy + abz * acz);
    double rad = acos(dot / AB / AC);
    if(dot < 0)return 0;
    if(AC * cos(rad) > AB)return 0;

    double L = AC * sin(rad);
    if(L - r <= 1e-9)return 1;
    return 0;
}

int main(){

    int N, Q;
    cin >> N >> Q;
    double X[50], Y[50], Z[50], R[50];
    ll L[50];
    for(int i = 0; i < N; i++){
        cin >> X[i] >> Y[i] >> Z[i] >> R[i] >> L[i];
    }
    for(int i = 0; i < Q; i++){
        ll ans = 0;
        double x1, y1, z1;
        cin >> x1 >> y1 >> z1;
        double x2, y2, z2;
        cin >> x2 >> y2 >> z2;
        for(int j = 0; j < N; j++){
            int f = check(x1, y1, z1, x2, y2, z2, X[j], Y[j], Z[j], R[j]);
            if(f){
                ans += L[j];
            }
        }
        cout << ans << endl;
    }

    return 0;
}


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

using namespace std;

int main(){
string S,T; cin >> S >> T;
  
  vector<int> start(26,-1);
  vector<int> goal(26,-1);
  
  for(int i = 0; i < S.size(); i++){
    int a = S[i] - 'a'; int b = T[i] - 'a';
    
     if(start[a] != -1 || goal[b] != -1){
       if( start[a] != b || goal[b] != a){
         cout << "No" << endl; return 0;}}
    start[a] = b; goal[b] = a;
  }
  
  cout << "Yes" << endl;
  
  return 0;}

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

int main() {
    int N;
    cin >> N;
    vector<int> data(N+1, 0);
    vector<int> inp(N, 0);
    int n;
    for(int i=0;i<N;i++){
        cin >> n;
        data[n]++;
        inp[i] = n;
    }
    for(int i=0;i<N+1;i++){
        if (data[i] > 0){
            data[i]--;
        }
    }
    ll total = 0;
    for(int i=0;i<N;i++){
        total += data[inp[i]];
    }
    total = total / 2;
    for(int i=0;i<N;i++){
        cout << total - data[inp[i]] << endl;
    }
    return 0;
}

Measured memory_bytes: 4096
S = input()

if(S == 'SUN'):
    print(7)
elif(S == 'MON'):
    print(6)
elif (S == 'TUE'):
    print(5)
elif (S == 'WED'):
    print(4)
elif (S == 'THU'):
    print(3)
elif (S == 'FRI'):
    print(2)
else:
    print(1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define int long long
using namespace std;
signed main() {
    int a, b, k;
    cin >> a >> b >> k;
    rep(i, k / 2) {
        if(a % 2 != 0) a -= 1;
        a /= 2;
        b += a;
        if(b % 2 != 0) b -= 1;
        b /= 2;
        a += b;
    }
    if(k % 2 != 0) {
        if(a % 2 != 0) a -= 1;
        a /= 2;
        b += a;
    }
    cout << a << " " << b<<endl;
    return 0;
}

Measured memory_bytes: 256