akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
  char s[5];
  scanf("%s",s);
    
  if(strcmp(s,"SUN")==0){
    printf("7");
  }
  else if(strcmp(s,"MON")==0){
    printf("6");
  } 
  else if(strcmp(s,"TUE")==0){
    printf("5");
  } 
  else if(strcmp(s,"WED")==0){
    printf("4");
  } 
  else if(strcmp(s,"THU")==0){
    printf("3");
  } 
  else if(strcmp(s,"FRI")==0){
    printf("2");
  } 
  else {
    printf("1");
  }
     return 0;
     }

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



int main(){
    int n,i,h[100005],dp[100005];
    cin >> n;
    int t=n;
    i=0;
    while(t--){
        cin >> h[i++];
    }
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(i=2;i<n;i++)
        dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
    cout << dp[n-1] << endl;
	return 0;
}



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

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<P> as(n);
  rep(i, n) {
    int a;
    cin >> a;
    as[i] = P(a, i + 1);
  }
  sort(as.begin(), as.end());
  rep(i, n) {
    if (i != n - 1) {
      cout << as[i].second << " ";
    } else {
      cout << as[i].second << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3952
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
typedef std::pair<long long, long long> pll;

using namespace std;

const long long MOD = 1000000007;


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

	int n, v, p;
	ll m;
	cin >> n >> m >> v >> p;

	ll* a;
	a = new ll[n];
	rep(i, n) cin >> a[i];

	sort(a, a + n, [](ll &x, ll &y) {return x > y; });

	ll* sum;
	sum = new ll[n-p];
	sum[0] = m;
	REP(i, p, n - 1) sum[i - p + 1] = (a[p - 1] + m) - a[i] + sum[i - p];

	int l = p-1, r = n, mid;
	while (l + 1 != r) {
		mid = (l + r) / 2;

		if (a[p - 1] > a[mid] + m) {
			r = mid;
			continue;
		}

		ll q = max(0, v - n + mid - p + 1);
		if (q*m <= sum[mid - p] - (a[p - 1] - a[mid])*(mid - p + 1)) {
			l = mid;
		}
		else {
			r = mid;
		}
	}

	cout << l + 1 << "\n";

	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cassert>
#include<climits>
#include<map>
#include<set>
#include<iomanip>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define EPS 1e-6
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define MAX 20
#define pow2(a) ((a)*(a))

using namespace std;

struct Point{
  double x,y;
  Point(double x=IINF,double y=IINF):x(x),y(y){}
};

struct Segment{
  Point p[2];
  Segment(Point p1=Point(),Point p2=Point()){ p[0] = p1,p[1] = p2; }
};

int n,CNT = 1;
Segment seg[MAX];
double dp[MAX][2][(1<<15)],sum;
double cost[MAX][2][MAX][2];

inline double getDist(Point a,Point b){ return sqrt(pow2(a.x-b.x)+pow2(a.y-b.y)); }

int main(){

  while(cin >> n,n){
    sum = 0;
    rep(i,n){
      cin >> seg[i].p[0].x >> seg[i].p[0].y >> seg[i].p[1].x >> seg[i].p[1].y;
      sum += getDist(seg[i].p[0],seg[i].p[1]);
    }

    rep(i,n)rep(j,2)rep(k,n)rep(l,2) cost[i][j][k][l] = getDist(seg[i].p[j],seg[k].p[l]);

    rep(i,n)rep(j,2)rep(k,(1<<n))dp[i][j][k] = IINF;

    rep(i,n)rep(j,2)dp[i][j][(1<<i)] = 0;

    for(int state=0;state<(1<<n);state++){
      for(int cur=0;cur<n;cur++){
	if( !( (state>>cur) & 1 ) )continue;
	for(int ep=0;ep<2;ep++){
	  if(dp[cur][ep][state] == IINF)continue;
	  for(int next=0;next<n;next++){
	    if( (state>>next) & 1 )continue;
	    if(cur == next)continue;
	    for(int nep=0;nep<2;nep++){
	      int nstate = state | (1<<next);
	      dp[next][nep][nstate] = min(dp[next][nep][nstate],
					  dp[cur][ep][state]+cost[cur][(ep+1)&1][next][nep]);
	    }
	  }
	}
      }
    }

    double ans = IINF;
    rep(i,n)rep(j,2)ans = min(ans,dp[i][j][(1<<n)-1]);
    cout << "Case " << CNT++ << ": " << setiosflags(ios::fixed) << setprecision(5) << ans + sum << endl;

  }
  return 0;
}

Measured memory_bytes: 8508
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
typedef long long ll;

using ipair = pair<int, int>;

ll INF = 1e16+7;

bool operator>(const ipair a,const ipair b){return a.first > b.first;}

ipair f(int num){
  int a = num%10;
  int b = 0;
  while(num){
    b = num;
    num /= 10;
  }
  return make_pair(a, b);
}

int main(){
  // Input
  int N;
  cin >> N;
  map<ipair, int> mp;

  for(int i=1; i<=N; i++){
    ipair p = f(i);
    mp[p]++;
  }

  ll ans = 0;
  for(int i=1; i<=N; i++){
    ipair p = f(i);
    ans += mp[make_pair(p.second, p.first)];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int H,W,h,w,black,white;
  scanf("%d %d",&H,&W);
  scanf("%d %d",&h,&w);
  black=h*W+w*(H-h);
  white=H*W-black;
  printf("%d",white);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

const int MAX_N = 200000;

int par[MAX_N];
int rnk[MAX_N];

void init(int n) {
  for (int i = 0; i < n; i++) {
    par[i] = i;
    rnk[i] = 0;
  }
}

int find(int x) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = find(par[x]);
  }
}

void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return;

  if (rnk[x] < rnk[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if (rnk[x] == rnk[y]) rnk[x]++;
  }
}

bool same(int x, int y) { return find(x) == find(y); }

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

  int n, m, k;
  cin >> n >> m >> k;

  vector<int> a(m), b(m), c(k), d(k), fr(n);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    fr[a[i]]++;
    fr[b[i]]++;
  }

  vector<vector<int>> edge(n);
  for (int i = 0; i < k; i++) {
    cin >> c[i] >> d[i];
    c[i]--;
    d[i]--;
    edge[c[i]].push_back(d[i]);
    edge[d[i]].push_back(c[i]);
  }

  init(n);
  for (int i = 0; i < m; i++) {
    unite(a[i], b[i]);
  }

  vector<int> size(n);
  for (int i = 0; i < n; i++) {
    size[find(i)]++;
  }

  for (int i = 0; i < n; i++) {
    int ans = size[find(i)] - 1 - fr[i];

    for (auto j : edge[i]) {
      if(same(i, j)) ans--;
    }

    cout << ans << endl;
  }

  return 0;
}

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

using namespace std;

void A_Poor(void) {

	int num[3];
	int counter = 0;

	cin >> num[0] >> num[1] >> num[2];

	for (int loop1 = 0; loop1 < 3; loop1++) {
		for (int loop2 = loop1 + 1; loop2 < 3; loop2++) {
			
			if (num[loop1] == num[loop2]) counter++;
		}
	}

	if (counter == 1) cout << "Yes" << flush;
	else cout << "No" << flush;

	return;
}

int main(void) {

	A_Poor();
	return 0;
}


Measured memory_bytes: 256
// Last Change: 07/12/2019 14:06:41.
//////////////////////////////////////////////////////////////////////////
// 2点間の最短経路アルゴリズム
// O(EV)
// 負の辺OK
//辺の数E、頂点数V
//
//////////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

const ll INF = numeric_limits<ll>::max();

struct Edge {
  ll to;
  ll cost;
  Edge(ll t, ll c) : to(t), cost(c) {
  }
};

vector<vector<Edge>> edge;
vector<ll> dist;

//戻り値が真なら負の閉路を含む
// nは頂点数、startは開始地点
bool BellmanFord(ll n, ll start) {
  dist[start] = 0;
  for (ll i = 0; i < n; ++i) {
    for (ll v = 0; v < n; ++v) {
      for (ll k = 0; k < edge[v].size(); ++k) {
        Edge e = edge[v][k];
        if (dist[v] != INF and dist[e.to] > dist[v] + e.cost) {
          dist[e.to] = dist[v] + e.cost;
          // n回目の更新の有無で負の閉路を検出
          if (i == n - 1) {
            return true;
          }
        }
      }
    }
  }
  return false;
}

int main() {
  int n, m, r;
  cin >> n >> m >> r;
  edge.resize(n);
  dist.assign(n, INF);
  for (ll i = 0; i < m; ++i) {
    ll from, to, cost;
    cin >> from >> to >> cost;
    edge[from].push_back(Edge(to, cost));
  }

  bool flag = BellmanFord(n, r);

  if (flag) {
    cout << "NEGATIVE CYCLE" << endl;
    return 0;
  }
  for (ll i = 0; i < n; ++i) {
    if (dist[i] == INF) {
      cout << "INF" << endl;
    } else {
      cout << dist[i] << endl;
    }
  }
}



Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;
 
int main() {
    ll n, m, x, y;
    cin >> n >> m >> x >> y;
    ll mx = x;
    ll my = y;
    for (ll i = 0; i < n; ++i) {
        ll u;
        cin >> u;
        mx = max(mx, u);
    }
    for (ll i = 0; i < m; ++i) {
        ll u;
        cin >> u;
        my = min(my, u);
    }

    if (mx < my) {
        cout << "No War" << endl;
    } else {
        cout << "War"  << endl;
    }
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,true):false;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,true):false;}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}

int nextInt() { int x; scanf("%d", &x); return x;}

const int V = 200;
double dp[40000 + 10][V + 10];
int t[110];
int v[110];
int vh[40000 + 10];

int main2() {
  memset(dp,0,sizeof(dp));
  memset(vh,0,sizeof(vh));

  int N = nextInt();
  REP(i, N) t[i] = nextInt() * 2;
  REP(i, N) v[i] = nextInt() * 2;
  int T = 0;
  REP(i, N) T += t[i];
  {
    int p = 0;
    REP(i, N) {
      REP(_, t[i]) vh[p++] = v[i];
    }
  }
  REP(i, T + 1) REP(j, V + 1) dp[i][j] = -99999999;
  dp[0][0] = 0;
  for (int tt = 0; tt < T; tt++) {
    int VH = min(vh[tt], vh[tt+1]);
    for (int vv = 0; vv <= 200; vv++) {
      if (vv+1 <= VH) chmax(dp[tt + 1][vv+1], dp[tt][vv] + vv+0.5);
      if (vv   <= VH) chmax(dp[tt + 1][vv  ], dp[tt][vv] + vv    );
      if (vv-1 >= 0 && vv-1 <= VH) chmax(dp[tt + 1][vv-1], dp[tt][vv] + vv-0.5);
    }
  }
  double ans = dp[T][0] / 4.0;
  printf("%.10f\n", ans);
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}



Measured memory_bytes: 66048
# include <iostream>
# include <algorithm>

using namespace std;

int main() {
  int N, A[100000], B[100000], C[100000];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) cin >> B[i];
  for (int i = 0; i < N; i++) cin >> C[i];
  sort(A, A + N);
  sort(C, C + N);
  
  long long ans = 0;
  for (int b_i = 0; b_i < N; b_i++) {
    int a_i = lower_bound(A, A + N, B[b_i]) - A;
    int c_i = upper_bound(C, C + N, B[b_i]) - C;
    ans += 1LL * a_i * (N - c_i);
  }
  cout << ans << endl;
  
  return 0;
}

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

using namespace std;

typedef long long ll;

const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define FILE(s) freopen(s"in", "r", stdin), freopen(s"out", "w", stdout)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }

template<typename T>
inline void chkmin(T&a, T b) { a = a < b ? a : b; }

const int MAXN = 2010;
const int mod = 1e9 + 7;

inline int ksm(int x, int k = mod - 2) {
	int s = 1;
	while(k) {
		if(k & 1) s = 1LL * s * x % mod;
		x = 1LL * x * x % mod, k >>= 1;
	} return s;
}

int fac[MAXN * MAXN];
int ifac[MAXN * MAXN];
int f[MAXN][MAXN];

inline void init(int n) {
	fac[0] = 1;
	for(int i = 1; i <= n; i++) fac[i] = 1LL * fac[i - 1] * i % mod;
	ifac[n] = ksm(fac[n]);
	for(int i = n; i >= 1; i--) ifac[i - 1] = 1LL * ifac[i] * i % mod;
}

inline int C(int n, int m) {
	return 1LL * fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}

int main() {
#ifdef LOCAL
	FILE("");
#endif

	int n = ri, k = ri, N = n * k;
	init(N);

	if(k == 1) return puts("1"), 0;

	for(int i = 0; i <= n; i++) f[i][0] = 1;
	for(int i = 1; i <= n; i++)
		for(int j = 0; j <= i; j++)
			if(j) f[i][j] = (f[i - 1][j] + 1LL * f[i][j - 1] * C(N - i - (j - 1) * (k - 1) - 1, k - 2)) % mod;
			else f[i][j] = f[i - 1][j];

	printf("%lld\n", 1LL * f[n][n] * fac[n] % mod);
	return 0;
}

Measured memory_bytes: 46592
import java.io.IOException;
import java.util.Scanner;

/**
 * <pre>
 * NumberOfIsland
 *
 * ??¶?????°???????????????
 * </pre>
 *
 * @author ?????????????????§???
 *
 */
public class Main{

	/*
	 * ????????°???????????¨?????????????????????
	 */
	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		//???????????????????´????????????????????????§
		while (sc.hasNext()) {
			//??°??¢???????´???´???
			boolean map[][] = new boolean[12][12];

			for (int cnt = 0; cnt < map.length; cnt++) {
				//????????????
				int tmp_addr=0;
				// ???????????????????????£?????¨???????´?
				char[] tmp_row =sc.next().toCharArray();
				for (char info:tmp_row ) {
					// ????????°??????(???)???true(1)??? ?????? ????????????(???)???false(0)???
					//??°??????????£?
					map[cnt][tmp_addr] = (info == '1')/*(info =='1'? true:false)*/;
					tmp_addr++;
				}
			}
			// ??¶?????°
			int ans = 0;
			for (int cnt1 = 0; cnt1 < map.length; cnt1++) {
				for (int cnt2 = 0; cnt2 < map[0].length; cnt2++) {
					// ?????°??????
					if (map[cnt1][cnt2]/* == true */) {
						// ??¬??????
						recursive_landSurvey(cnt1, cnt2, map);
						// ??¬??????????????£????????¶?????°?????????
						ans++;
					}
				}
			}

			// ???????????????
			System.out.println(ans);
		} // ?????????????????????

		// ????????????????????????
		sc.close();
	}// ?????????????????????????????????

	/**
	 * <pre>
	 * ?????°??????????????????
	 * </pre>
	 *
	 * ?????°??¬???
	 *
	 * @param mh
	 *            ??????
	 * @param mw
	 *            ??????
	 * @param map
	 */
	private static void recursive_landSurvey(int mh, int mw, boolean[][] map) {
		// ?????????
		map[mh][mw] = false;
		// ?§????????????????????????????????????????
		final int MOVELIST_H[] = { 1, 0, -1, 0 };
		final int MOVELIST_W[] = { 0, 1, 0, -1 };
		for (int cnt = 0; cnt < MOVELIST_H.length; cnt++) {
			// ?????????????????????????§????
			int addr_h = mh + MOVELIST_H[cnt];
			// ?????????????????????????§????
			int addr_w = mw + MOVELIST_W[cnt];

			// ??°???????????????????????°??????
			if (0 <= addr_h && 0 <= addr_w && addr_h < map.length && addr_w < map[0].length
					&& map[addr_h][addr_w]/* ==true */)
				// ?????°?????¬???????¶????
				recursive_landSurvey(addr_h, addr_w, map);
		}
	}// recursive_landSurvey????????????????????????

}// ??????????????????????????????

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int a[26];
  rep(i,26){
    a[i] = 0;
  }
  rep(i,s.length()){
   a[(int)s[i]-97]++;
  }
  rep(i, 26){
   	if (a[i] % 2 != 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
 
int main() {
    int n, ins, cmp;
    double ttl, min, tmp;
    double *a_heap;
    ttl = 0.0;
    min = 1000.0;

    cin >> n;

    a_heap = new double[n];

    for(int i = 0; i < n; i++){
        cin >> a_heap[i];
    }

    for(ins = 1; ins < n; ins++){
        tmp = a_heap[ins];
        for(cmp = ins - 1; cmp >= 0; cmp--){
            if(a_heap[cmp] > tmp){
                a_heap[cmp + 1] = a_heap[cmp];
            }
            else
            {
                break;
            }
        }
        a_heap[cmp + 1] = tmp;
    }
    for(int j=0;j<n-1;j++){
        a_heap[j+1] = (a_heap[j] + a_heap[j+1])/2;
        ttl = a_heap[j+1];
        
    }    
    cout << ttl << endl;
    delete[] a_heap;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int M=1e9+7;
int a[110],n;
struct node{
	int x,y;
};
int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=x*x%M)
		if (y&1)(ans*=x)%=M;
	return ans;	
}
node calc(int l,int r,int lim){
	int minn=1e18,cnt=0;
	node ans;
	for (int i=l;i<=r;i++)
		if (a[i]<minn)minn=a[i],cnt=1;
		else if (a[i]==minn)cnt++;
	if (cnt==r-l+1){
		ans.x=(ksm(2,r-l+1)-2+M)%M;
		ans.y=ksm(2,minn-lim-1);
		return ans;
	}
	int s0=1,s1=1,last=0;
	for (int i=l;i<=r+1;i++){
		if (!last&&a[i]>minn)last=i;
		else if (last&&(i==r+1||a[i]==minn)){
			node Ans=calc(last,i-1,minn);
			(s0*=(Ans.x+4*Ans.y%M)%M)%=M;
			(s1*=Ans.y*2%M)%=M;
			last=0;
		}
	}
	s0=(s0+M-s1)%M;
	ans.x=(s0*ksm(2,cnt)%M+s1*(ksm(2,cnt)-2+M)%M)%M;
	ans.y=s1*ksm(2,minn-lim-1)%M;
	return ans;
}
signed main(){
	scanf("%lld",&n);
	for (int i=1;i<=n;i++)scanf("%lld",&a[i]);
	if (n==1){
		printf("%lld",ksm(2,a[1]));
		return 0;
	}
	int ans=1;
	for (int i=1;i<=n;i++)
		if (a[i]>a[i-1]&&a[i]>a[i+1]){
			(ans*=ksm(2,a[i]-max(a[i+1],a[i-1])))%=M;
			a[i]=max(a[i+1],a[i-1]);
		}
	node Ans=calc(1,n,0);
	printf("%lld\n",ans*(Ans.x+2*Ans.y%M)%M);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
char ch;

while(1){
scanf("%c", &ch);
if ( isalpha(ch) ){
if ( islower(ch) ) printf("%c", toupper(ch));
else printf("%c", tolower(ch));
}else printf("%c", ch);

if ( ch == '\n' ) break;
}
return 0;
}

Measured memory_bytes: 3120
H,W = list(map(int,input().split()))

S=[]

for i in range(H):
    S.append(input())

e_list = [[] for i in range(H*W)]

def z(i,j):
    return i*W + j

for i in range(H):
    for j in range(W):
        if i!=H-1:
            if S[i][j]=="." and S[i+1][j]==".":
                e_list[z(i,j)].append(z(i+1,j))
                e_list[z(i+1,j)].append(z(i,j))
        if j!=W-1:
            if S[i][j]=="." and S[i][j+1]==".":
                e_list[z(i,j)].append(z(i,j+1))
                e_list[z(i,j+1)].append(z(i,j))

vi = 0 #時と場合によってここを変える
from collections import deque
N=H*W
def BFS(vi):
    Q = deque([vi])
    checked_list = [False for i in range(N)]
    checked_list[vi]=True
    min_path_list = [10**27 for i in range(N)] #問題によりここを変える
    min_path_list[vi] = 0
    while len(Q)>0:
        v = Q.pop()
        for v1 in e_list[v]:
            if not checked_list[v1]:
                checked_list[v1]=True
                Q.appendleft(v1)
                min_path_list[v1]=min(min_path_list[v1],min_path_list[v]+1) #問題によりここを変える
    max_d = 0
    for i in range(N):
        if min_path_list[i]<10**27:
            max_d = max(max_d,min_path_list[i])
    return max_d
ans = 0
for i in range(N):
    ans = max(BFS(i),ans)

print(ans)

Measured memory_bytes: 43100
#include <iostream>
#include <vector>
#include <algorithm>
#include <complex>
#include <climits>

using namespace std;

using ll = long long;

int main() {
    string n;

    cin >> n;

    if(n.at(0) == '7' || n.at(1) == '7' || n.at(2) == '7')
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 3572
/// Bismillahir Rahmanir Rahim

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define PI acos(-1)
#define IOS ios::sync_with_stdio(false);
using namespace std;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
int main()
{
    IOS
    int n;
    cin>>n;
    while(n>1){
        if(n%10==7) {
            cout<< "Yes\n";
            return 0;
        }
        n/=10;
    }
    cout << "No\n";
    return 0;
}
///Alhamdulillah


Measured memory_bytes: 3640
import sys
from collections import Counter
from operator import itemgetter, attrgetter
n=0
 
word = input()
w1=None
w2=None
isNG=False
for w in word:
    if w1 == None or w1 == w:
        w1=w
        
    else:
        if w2 == None or w2 == w:
            w2=w
        else:
            isNG = True
if isNG or w1 == None or w2 == None:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
using namespace std;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a + b > c + d) {
		cout << "Left" << endl;
	}
	else {
		if (a + b < c + d) {
			cout << "Right" << endl;
		}
		else {
			cout << "Balanced" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
open Scanf
open Printf

let rotates s = let rec f n = if n = String.length s
                 then []
                 else (String.sub s n (String.length s - n) ^ String.sub s 0 n) :: f (n+1)
  in s :: (f 1)

let f s t = List.fold_left ( || ) false (List.map (fun u -> u = t) @@ rotates s)

let () = if scanf "%s\n%s\n" f
    then printf "Yes\n"
    else printf "No\n"

Measured memory_bytes: 384
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ones = n % 10;
        
        switch (ones) {
            case 2:
            case 4:
            case 5:
            case 7:
            case 9:
                System.out.println("hon");
                break;
            case 0:
            case 1:
            case 6:
            case 8:
                System.out.println("pon");
                break;
            case 3:
                System.out.println("bon");
                break;
        }
    }
}

Measured memory_bytes: 35820
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main() {
    int N, M; cin >> N >> M;
    vector<int> K(M);
    vector<vector<int>> S(M);
    for(int i=0; i<M; i++){
        cin >> K[i];
        for(int j=0; j<K[i]; j++){
            int s; cin >> s;
            s--;
            S[i].push_back(s);
        }
    }
    vector<int> P(M);
    for(int i=0; i<M; i++){
        cin >> P[i];
    }
    

    int ans = 0;
    for(int i=0; i<(1<<N); i++){
        int on = 0;
        for(int j=0; j<M; j++){
            int cnt = 0;
            for(int k=0; k<N; k++){
                if(((i>>k) & 1) && find(S[j].begin(), S[j].end(), k)!= S[j].end()) cnt++;
            }
            
            if(cnt%2 == P[j]) on++;
        }
        if(on == M) ans++;
    }
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
int n,p=1000000000,opt=1;
long long ans;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		if (x!=y) opt=0;
		ans=ans+x;
		if (x>y) p=std::min(p,y);
	}
	printf("%lld\n",opt?0:ans-p);
	return 0;
}

Measured memory_bytes: 1712
a=list(map(int, input().split()));x,y=a[2]-a[0],a[3]-a[1];r,u=x<0,y<0;x,y=abs(x),abs(y);v,h=["U","D"],["R","L"];print(v[u]*y+h[r]*x+v[u^1]*y+h[r^1]*(x+1)+v[u]*(y+1)+h[r]*(x+1)+v[u^1]+h[r]+v[u^1]*(y+1)+h[r^1]*(x+1)+v[u])

Measured memory_bytes: 3064
#include<cmath>
#include<iostream>
using namespace std; 
int n,now=0,ans;
char s;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>s;
        if(s=='I')
        {
            now++;
        }
        if(s=='D')
        {
            now--;
        }
        ans=max(ans,now);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	while(1){
		int a[5], b[3]={0}, i, flag=1, count=0;	
		
		for(i=0; i<5; i++){
			scanf(" %d", &a[i]);
			if(a[i]==0){
				flag=0;
				break;
			}
			if(b[a[i]-1]==0) count++;
			b[a[i]-1]++;
		}
		if(flag==0) break;
		
		if(count==2){
			int memo;
			for(i=0; i<3; i++){
				if(b[i]==0) memo=i+1;
			}	
			
			//printf("memo=%d\n", memo);
			
			for(i=0; i<5; i++){
				if(a[i] == ( ((memo+1)%3==0) ? 3:(memo+1)%3) ) a[i]=1;
				else a[i]=2;
			}
		
		}
		else{
			for(i=0; i<5; i++)
				a[i] = 3;
		}
		
		for(i=0; i<5; i++)
			printf("%d\n", a[i]);
	
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
int main() {

  int n;
  int h[105];
  int sum = 0;

  cin >> n;

  h[0] = 0;

  for ( int i = 1; i <= n; ++i ) {
    cin >> h[i];
    if ( h[i-1] < h[i] ) sum += h[i]-h[i-1];
  }

  cout << sum << endl;

  return 0;

}


Measured memory_bytes: 256
A = list(map(int, input().split()))
five_cnt = 0
seven_cnt = 0

for a in A:
    if a == 5:
        five_cnt += 1
    if a == 7:
        seven_cnt += 1

if five_cnt == 2 and seven_cnt == 1:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <utility>

using namespace std;
#define ll long long

int main(){
    ll A,B,K;
    int a;
    cin >> A >> B >> K;
    for(int i = A; i <= min(B, A + K - 1); i++){
        cout << i << endl;
    }
    for(int i = max(B - K + 1, A + K); i <= B; i++){
        cout<< i << endl;
    }
}

Measured memory_bytes: 256
import sys
read = sys.stdin.read
from math import gcd
def main():
    n = int(input())
    t = [int(input()) for _ in range(n)]
    if n == 1:
        print(t[0])
        sys.exit()
    r = (t[0] * t[1]) // gcd(t[0], t[1])
    if n == 2:
        print(r)
        sys.exit()
    for i1 in range(2, n):
        r = (r * t[i1]) // gcd(r, t[i1])
    print(r)

if __name__ == '__main__':
    main()



Measured memory_bytes: 9176
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int x = scanner.nextInt();
        for (int i = 0; i < m; i++) {
            if (scanner.nextInt() > x) {
                System.out.println(Math.min(i, m - i));
                return;
            }
        }
    }
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int l, r, d;
  cin >> l >> r >> d;
  
  int ans = 0;
  for (int i = l; i <= r; i++) {
    if (i % d == 0) ans++;
  }
  
  cout << ans << '\n';
}

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

using namespace std;

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

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	ll n;
	cin >> n;
	ll ans, tmp;
	REP(i, 0, n){
		cin >> tmp;
		if(i == 0) ans = tmp;
		else{
			ll t = __gcd(ans, tmp);
			ans = ans/t;
			ans *= tmp;
		}
	}
	cout << ans;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<double, double> P;
typedef pair<double,P> dP;

dP calc_eq (double xa, double ya, double xb, double yb )
{
	double a = (xb - xa );
	double b = (yb - ya );
	double c = (xb - xa)*(xb + xa )/2. + (yb - ya)*(yb+ya )/2.;

	return dP (a, P (b, c ) );		
}

double calc_radius (double xa, double ya, double xb, double yb )
{
	double res = (xa - xb)*(xa - xb) + (ya - yb)*(ya - yb );

	return sqrt (res );
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.CCT", "r", stdin );
	int n;
	cin >> n;
	rep (i, n ){
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		dP l1 = calc_eq (x1, y1, x2, y2 );
		dP l2 = calc_eq (x1, y1, x3, y3 );

		double a = l1.first, b = l1.second.first, c = l1.second.second;
		double d = l2.first, e = l2.second.first, f = l2.second.second;
/*
		cerr << "a: " << a << " b: " << b << " c: " << c << endl;
		cerr << "d: " << d << " e: " << e << " f: " << f << endl;
*/
		double x = 0.0, y = 0.0, r = 0.0;
		x = (c*e - b*f)/(a*e - b*d);
		y = (c*d - a*f)/(b*d - a*e);
		r = calc_radius (x, y, x1, y1 );

		if (fabs(x) < 1.0e-3){
			x = 0.0;
		} // end if
		if (fabs(y) < 1.0e-3){
			y = 0.0;
		} // end if

		printf ("%.3f %.3f %.3f\n", x, y, r );

	} // end loop
		
	return 0;
}

Measured memory_bytes: 1244
"""

https://atcoder.jp/contests/agc037/tasks/agc037_c

合わせていく順番を考える
小さくなるのがあるとダメ
大きいやつを合わせてから両隣の小さいやつを合わせるのは不可能
→小さいやつから合わせていくこととなる

逆操作を考える
最大のやつを作る前は両隣が合った状態になる
aMbとしたとき、合わせ始める前は M - k(a+b)でなくてはならない
また、a or bを合わせたときにはMはそれより小さくなくてはならない？
→元の値は一意に定まる

より深く考えよう
ある瞬間があることを保証するためにはどんな瞬間が必要かを考えて戻していく
今最大のやつを考える
→左右どちらも初期値の場合→いまの自分の値が初期値から左右を足して作成可能ならおk
→左右どちらかが初期値でない場合
→少なくとも一度自分を足してそれになることがあったはずなので、
→M-k(a+b)で、なおかつ初期値でない数字より小さい数字に置き換える
→初期値と同じになったらおk　下回ったらアウト

"""

import sys
from sys import stdin
import heapq

N = int(stdin.readline())
A = list(map(int,stdin.readline().split()))
B = list(map(int,stdin.readline().split()))
ans = 0

q = []
for i in range(N):
    if A[i] != B[i]:
        heapq.heappush(q, (-1*B[i],i) )
    if A[i] > B[i]:
        print (-1)
        sys.exit()

while len(q) > 0:

    num,ind = heapq.heappop(q)
    num *= -1
    #print (B,num,ind)

    if A[(ind-1)%N] == B[(ind-1)%N] and A[(ind+1)%N] == B[(ind+1)%N]:
        diff = num - A[ind]
        if diff >= 0 and diff % (A[(ind-1)%N]+A[(ind+1)%N]) == 0:
            ans += diff // (A[(ind-1)%N]+A[(ind+1)%N])
            B[ind] = A[ind]
        else:
            print (-1)
            sys.exit()

    else:

        ans += num // (B[(ind-1)%N]+B[(ind+1)%N])
        rem = num % (B[(ind-1)%N]+B[(ind+1)%N])
        if rem == num:
            print (-1)
            sys.exit()

        B[ind] = rem
        if B[ind] < A[ind]:
            print (-1)
            sys.exit()
        elif B[ind] == A[ind]:
            continue
        else:
            heapq.heappush(q , (-1*B[ind],ind) )

print (ans)
        


Measured memory_bytes: 135232
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define pb push_back
#define ll long long
#define ld long double
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define X first
#define Y second
#define fr(i,a,n) for(int i=a;i<n;i++)
#define mod 1000000007
#define fi ios_base::sync_with_stdio(false);cin.tie(NULL);

//#include <bits/stdc++.h>
//using namespace Std;
//typedef long long ll;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;


int n;
ll a[100005];
int b[100005];




void convert()
{
    int t[n+1];
    for(int i=0;i<n+1;i++)
    t[i]=b[i];
    
    sort(t,t+n+1);

    for(int i=0;i<n+1;i++)
    {
        b[i]=lower_bound(t,t+n+1,b[i])-t+1;
    }
   
}

int lsb(int i)
{
    return i & -i;
}


ll getSum(ll bit[],int i)
{
    ll sum=0;
    while(i>0)
    {
        sum+=bit[i];
        i-=lsb(i);
    }
    return sum;
}

void update(ll bit[],int i)
{
    while(i<=n)
    {
        bit[i]+=1;
        i+=lsb(i);
    }
}

ll inversioncnt()
{
   ll cnt=0;
   convert();
   ll BIT[n+10];
   fr(i,0,n+1)
   BIT[i]=0;

   for(int i=n;i>=0;i--)
   {
      cnt+=getSum(BIT, b[i]-1);
      update(BIT,b[i]);
   }
   return cnt;
}

bool fun(ll p)
{
   ll k= ((ll)n* (n+1))/2 ;
   ll bnd=(k>>1) + (k%2);
   ll cc=0;
   b[0]=0;
   fr(i,1,n+1)
   {
      if(a[i-1]>=p)
      b[i]=1;
      else
         b[i]=-1;

   }
   fr(i,1,n+1)
   b[i]+=b[i-1];

   
   ll cnt=inversioncnt();

   return (k-cnt)>= bnd;

}

int main()
{
  
cin>>n;
 //cout<<n;
   fr(i,0,n)
   {
 
    cin>>a[i];
   }

   ll s=0,e=1e9+12,ans=-1;
   while(e-s>1)
   {
      ll mid=(s+e)>>1;
      
      if (fun(mid))
      {
         s=mid;
      
      }
      else
      e=mid;
   }
  
   cout<<s;
   
   
}

Measured memory_bytes: 5540
import java.util.*;

public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        List<String> list = new ArrayList<>();

        StringBuilder sba = new StringBuilder();
        for (int i=0; i < a; i++) {
            sba.append(b);
        }
        list.add(sba.toString());

        StringBuilder sbb = new StringBuilder();
        for (int i=0; i < b; i++) {
            sbb.append(a);
        }
        list.add(sbb.toString());

        list.sort(Comparator.naturalOrder());

        System.out.println(list.get(0));
    }
}


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

int n, m;
int a[100];
int b[100];
int s[100];

int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; i++){
		cin >> a[i];
	}
	for (int i = 0; i < m; i++){
		for (int j = 0; j < n; j++){
			cin >> b[j];
			if (b[j] == a[i]) s[j]++;
			else s[a[i] - 1]++;
		}
	}
	for (int i = 0; i < n; i++){
		cout << s[i] << endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  string s; cin >> s;
  int res = 0;
  for(int i = 0; i < n; ++i) {
    if(i + 2 >= n) break;
    string h = "";
    for(int j = i; j <= i + 2; ++j) h += s[j];
    if(h == "ABC") res++;
  } 
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
import sys

w,h,x,y = [ int(x) for x in sys.stdin.readline().split() ]
wh = w / 2
hh = h / 2
#
if abs(wh-x)<0.01 and abs(hh-y)<0.01: flag= 1
else: flag= 0
#
print( "{:>.9f} {:>d}".format( (w*h/2),flag ) )

Measured memory_bytes: 3060
#include <iostream>
#include<cmath>
#include<string>
#include<iomanip>
#include<algorithm>
#include<map>
#define LL long long int
using namespace std;
int num[200200];
bool check()
{
    for(int i=0;i<200200;i++)if(num[i]%2)return false;
    return true;
}
int main()
{
    int n,m; cin>>n>>m; bool flag=false;
    int x,y;
    for(int i=0;i<m;i++)
    {
        cin>>x>>y; num[x]++; num[y]++;
    }
    if(check())cout<<"YES";
    else cout<<"NO";
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
string N;
int main()
{
    cin>>N;
    for(int i=0;i<N.size();i++)
    {
        if(N[i]=='9'){cout<<"Yes"<<endl;return 0;}
    }
    cout<<"No"<<endl;


    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class A_168_Therefore 
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            //string s = Console.ReadLine();

            // 整数の入力
            int x = int.Parse(Console.ReadLine());

            //// 文字列配列の入力
            //string[] inputStrArray = Console.ReadLine().Split(' ');

            // 整数配列の入力
            //var x = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            //if (x % 10 == 2 | x % 10 == 4 | x % 10 == 5 | x % 10 == 7 | x % 10 == 9)
            //{
            //    Console.WriteLine("hon");
            //}

            switch (x % 10)
            {
                case 2:
                case 4:
                case 5:
                case 7:
                case 9:
                    Console.WriteLine("hon");
                    break;
                case 0:
                case 1:
                case 6:
                case 8:
                    Console.WriteLine("pon");
                    break;
                default:
                    Console.WriteLine("bon");
                    break;
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 27436
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111
	
	
	

	void solve(){


		char x;
		in(x);
		if(x == toupper(x)){out("A");}
		else out("a");
			
			
			


				
		


		
		
		
		

		


		
		
	}



	



















int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


Measured memory_bytes: 3608
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX 1000000001
using ll=long long;

int main(){
    int n,m;
    cin>>n>>m;
    vector<ll> s(n+1,0);
    rep(i,m){
        int a;cin>>a;
        s[a]=-1;
    }

    s[0]=1;
    for(int now=0;now<=n;now++)if(s[now]!=-1){
        for(int next=now+1;next<=min(now+2,n);next++)if(s[next]!=-1){
            s[next]+=s[now];
            s[next]%=1000000007;
        }
    }
    cout<<s[n]<<endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
using namespace std;

int n, ma, mb, a[41], b[41], c[41];
int dp[41][401][401];
const int INF = 1e9;

int main(){
	scanf("%d %d %d", &n, &ma, &mb);
	for(int i=1; i<=n; i++)
		scanf("%d %d %d", &a[i], &b[i], &c[i]);

	for(int i=0; i<=400; i++)
		for(int j=0; j<=400; j++)
			dp[0][i][j]=INF;
	dp[0][0][0]=0;

	for(int i=1; i<=n; i++)
		for(int j=0; j<=400; j++)
			for(int k=0; k<=400; k++){
				dp[i][j][k]=dp[i-1][j][k];
				if(j>=a[i] && k>=b[i]) dp[i][j][k]=min(dp[i][j][k], dp[i-1][j-a[i]][k-b[i]]+c[i]);
			}
	int ans=INF;
	for(int i=0; i<=400; i++)
		for(int j=0; j<=400; j++){
			if(i*j==0) continue;
			if(i*mb==j*ma) ans=min(ans, dp[n][i][j]);
		}
	if(ans==INF) puts("-1");
	else printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 25856
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

int const N = 1e5 + 20 ;
int n , m ;
vector <int> g[N] ;

struct edge {
	int u , v ;
	bool in ;
} e[N] ;

vector <int> vec1 , vec2 ;
int d , ans , h[N] ;
bool vis[N] ;

int dfs (int v) {
	int d = 1 ;
	vis[v] = 1 ;
	for (int i : g[v]) {
		int u = e[i].u ^ e[i].v ^ v ;
		if (!vis[u]) {
			e[i].in = 1 ;
			h[u] = h[v] ^ 1 ;
			d -= dfs(u) ;
		}
	}

	ans += abs(d) ;

	return d ;
}

bool fl[N] ;
int token[N] ;
int want = -1 ;

int X , Y ;

int get (int v) {
	vis[v] = 1 ;
	int d = token[v] ;

	for (int i : g[v]) {
		int u = e[i].u ^ e[i].v ^ v ;

		if (!vis[u]) {
			d += get(u) ;
			fl[v] |= fl[u] ;
		}
	}

	if (v == X || !fl[v]) vec1.push_back(d) ;
	else vec2.push_back(d) ;
	ans += abs(d) ;
	return d ;
}

int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
	
	cin >> n >> m ;

	for (int i = 0 ; i < m ; i ++) {
		cin >> e[i].u >> e[i].v ;
		e[i].u -- , e[i].v -- ;

		g[e[i].u].push_back(i) ;
		g[e[i].v].push_back(i) ;
	}

	d = dfs(0) ;

	if (m == n - 1) {
		if (!d) cout << ans << '\n' ;
		else cout << "-1\n" , 0 ;
		return 0 ;
	}

	bool odd_cycle = 0 ;

	for (int i = 0 ; i < m ; i ++)
		if (!e[i].in && h[e[i].u] == h[e[i].v]) odd_cycle = 1 ;

	memset(vis , 0 , sizeof vis) ;

	if (odd_cycle) {
		if (d & 1) return cout << "-1\n" , 0 ;

		d /= 2 ;

		for (int i = 0 ; i < m ; i ++)
			if (!e[i].in) want = h[e[i].u] , token[e[i].u] = token[e[i].v] = (want ? d : -d) ;

		for (int i = 0 ; i < n ; i ++) {
			if (h[i] == want) token[i] ++ ;
			else token[i] -- ;
		}

		ans = abs(d) ;
		get(0) ;
		cout << ans << '\n' ;
	}
	else {
		if (d) return cout << "-1\n" , 0 ;
		
		for (int i = 0 ; i < n ; i ++) token[i] = (h[i] ? +1 : -1) ;

		for (int i = 0 ; i < m ; i ++)
			if (!e[i].in) X = e[i].u , Y = e[i].v ;

		fl[Y] = 1 ;
		get(X) ;

		ans = 0 ;

		sort(vec2.begin() , vec2.end()) ;
	
		for (int p : vec1) ans += abs(p) ;
		if (vec2.size()) {
			int x ;
			if (_sz(vec2) & 1) {
				x = -vec2[_sz(vec2) / 2] ;
			}
			else {
				int low = -vec2[_sz(vec2) / 2] , high = -vec2[_sz(vec2) / 2 - 1] ;
				if (low <= 0 && 0 <= high) x = 0 ;
				else if (high < 0) x = high ;
				else x = low ;
			}

			for (int p : vec2) ans += abs(p + x) ;
			ans += abs(x) ;
		}

		cout << ans << '\n' ;
	}
}


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

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

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    int n; cin>>n;
    vector<ll> a(n);
    for(int i=0; i<n; i++) cin>>a[i];

    sort(a.begin(), a.end(), greater<ll>());

    ll h=0, w=0;
    int i=0;
    while(i<n-1){
        if(a[i] == a[i+1] && h == 0){
            h=a[i];
            i+=2;
        }
        else if(a[i] == a[i+1] && w == 0){
            w=a[i];
            cout << h*w << endl;
            return 0;
        }
        else i++;
    }
    cout << 0 << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main() {
	ll a,b,k;
	cin >> a >> b >> k;
	ll ans1,ans2;
	ans1 = max(a-k,(ll)0);
	ans2 = max(b-(k-(a-ans1)),(ll)0);

	cout << ans1 << " " << ans2 << endl;
  return 0;
}


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

namespace _1_5_B
{
    class Program
    {
        static void Main(string[] args)
        {
            for(int i = 1; i > 0; i++)
            {
                string[] str = Console.ReadLine().Split(' ');
                int H = int.Parse(str[0]);
                int W = int.Parse(str[1]);
                if (H == 0 && W == 0) break;
                else
                {
                    for (int j = 0; j < W; j++)
                    {
                        Console.Write("#");
                    }
                    Console.Write("\n");
                    for (int j = 0; j < H-2; j++)
                    {
                        Console.Write("#");
                        for (int g =0;g < W-2; g++)
                        {
                            Console.Write(".");
                        }
                        Console.Write("#");
                        Console.Write("\n");
                    }
                    for (int j = 0; j < W; j++)
                    {
                        Console.Write("#");
                    }
                    Console.Write("\n");
                    Console.Write("\n");
                }
            }
        }
    }
}



Measured memory_bytes: 15876
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];

int main(){
  int x1,y1,x2,y2 ;
  cin >> x1 >> y1 >> x2 >> y2 ;
  int ax = x2 -x1 ;
  int ay = y2 -y1 ;
  cout<<x2-ay<<" "<<y2+ax<<" "<<x2-ay-ax<<" "<<y2+ax-ay<<endl;
}
  

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
int main(){
    int n,m;
    bool included=true;
    cin >> n >> m;
    char a[n][n];
    char b[m][m];
    REP(i,n){
        REP(j,n){
            cin >> a[i][j];
        }
    }
    REP(i,m){
        REP(j,m){
            cin >> b[i][j];
        }
    }

    REP(x,n-m+1){
        REP(y,n-m+1){
            included = true;
            FOR(i,x,x+m){
                FOR(j,y,y+m){
                    if(a[i][j] != b[i-x][j-y]){
                        included = false;
                    }
                }
            }
            if(included){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256