akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <functional>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

// binary search result
struct BSR {
    bool found; // 条件を満たす範囲が見つかったか。falseの場合、begin,endは意味を持たない。
    int128_t begin; // [begin, end]で条件が成り立つ。
    int128_t end;
    BSR(bool found_in, int128_t begin_in, int128_t end_in) { found = found_in; begin = begin_in; end = end_in; }
    //BSR(bool found_in, int128_t begin_in, int128_t end_in) : found(found_in), begin(begin_in), end(end_in) {}
};

//template<class Fn> BSR binary_search(int128_t L, int128_t R, Fn func) {
BSR binary_search(int128_t L, int128_t R, std::function<bool(int128_t)> func) {
    const bool res_L = func(L);
    const bool res_R = func(R);
    if (res_L && res_R) {
        return BSR(true, L, R);
    } else if (!res_L && !res_R) {
        return BSR(false, 0, 0);
    } else {
        int128_t lb = L;
        int128_t ub = R;
        while (lb + 1 < ub) {
            int128_t mid = (lb + ub) / 2;
            if (res_L == func(mid)) {
                lb = mid;
            } else {
                ub = mid;
            }
        }
        return res_L ? BSR(true, L, lb) : BSR(true, ub, R);
    }
}

const int MAX_N = 200050;

int N, Q;
std::string S;

char tile[MAX_N];
char t[MAX_N], d[MAX_N];

int cal_pos(int pos) {
    for (int i = 1; i <= Q; i++) {
        if (t[i] == tile[pos]) {
            if (d[i] == 'L') {
                pos--;
            } else {
                pos++;
            }
        }
        if (pos == 0 || pos == N + 1) {
            break;
        }
    }
    return pos;
}

int main(int argc, char **argv) {
    std::cin >> N >> Q;
    std::cin >> S;

    for (int i = 1; i <= Q; i++) {
        std::cin >> t[i] >> d[i];
    }

    for (int i = 0; i < S.size(); i++) {
        tile[i+1] = S[i];
    }

    int ret = N;
    BSR bsr = binary_search(1, N, [](int j){
        return cal_pos(j) == 0;
    });
    if (bsr.found) {
        ret -= bsr.end - bsr.begin + 1;
    }
    bsr = binary_search(1, N, [](int j){
        return cal_pos(j) == N + 1;
    });
    if (bsr.found) {
        ret -= bsr.end - bsr.begin + 1;
    }

    std::cout << ret << std::endl;

    return 0;
}



Measured memory_bytes: 1156
while True:
    H,W=map(int, input().split())
    if H == 0 and W == 0:
        break
 
    for i in range(H):
        for j in range(W):
            if (i+j+1)%2 == 0:
                print(".", end="")
            else:
                print("#", end="")
        print("")
    print("")

Measured memory_bytes: 9008
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define INF 1000000007

typedef long long int lli;

typedef struct
{
  int front;
  int rear;
  int data[MAX][3];
} queue;

queue que;

void initQueue(queue *p)
{
  p->front = p->rear = 0;
}

bool emptyQueue(queue *p)
{
  return p->front == p->rear;
}

bool fullQueue(queue *p)
{
  return (p->front - 1 == p->rear) || (p->front == 0 && p->rear == MAX - 1);
}

void queuePop(queue *p)
{
  if (emptyQueue(p))
  {
    printf("UnderFlow\n");
    exit(1);
  }
  else
  {
    p->front++;
    if (p->front == MAX)
      p->front = 0;
  }
}

void queuePush(queue *p, int x, int y, int d)
{
  if (fullQueue(p))
  {
    printf("OverFlow\n");
    exit(1);
  }
  else
  {
    p->data[p->rear][0] = x;
    p->data[p->rear][1] = y;
    p->data[p->rear][2] = d;
    p->rear++;
    if (p->rear == MAX)
      p->rear = 0;
  }
}


int main(void) {
  char s[22][22];
  int h, w;
  scanf("%d %d", &h, &w);
  rep(hi, 0, h) {
    scanf("%s", s[hi]);
  }

  int mx[4] = { 0, 1, 0, -1 };
  int my[4] = { 1, 0, -1, 0 };
  int ans = 0;
  rep(hi, 0, h) {
    rep(wi, 0, w) {
      if ( s[hi][wi] == '#' ) continue;
      int visited[21][21] = {0};
      initQueue(&que);
      visited[hi][wi] = 1;
      queuePush(&que, hi, wi, 0);
      while ( !emptyQueue(&que) ) {
        int x = que.data[que.front][0];
        int y = que.data[que.front][1];
        int d = que.data[que.front][2];
        queuePop(&que);
        rep(mi, 0, 4) {
          int nextX = x + mx[mi];
          int nextY = y + my[mi];
          if ( nextX < 0 || h <= nextX ) continue;
          if ( nextY < 0 || w <= nextY ) continue;
          if ( visited[nextX][nextY] )   continue;
          if ( s[nextX][nextY] == '#' )  continue;
          visited[nextX][nextY] = 1;
          ans = max(ans, d + 1);
          queuePush(&que, nextX, nextY, d + 1);
        }
      }
    }
  }

  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int l = a + b;
  int r = c + d;
  if (l > r) {
    cout << "Left" << endl;
  }
  else if (l == r) {
    cout << "Balanced" << endl;
  }
  else if (l < r) {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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 gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

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

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}


//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
string s;
cin>>s;
ll k;
cin>>k;
set<string>se;
for(ll i=0;i<s.size();i++){
    for(ll j=1;j<=min((ll)5,(ll)s.size()-i);j++){
        se.insert(s.substr(i,j));
    }
}
auto itr=se.begin();
for(ll i=0;i<k-1;i++){
    itr++;
}
cout<<*itr<<endl;
}








Measured memory_bytes: 1664
#include <stdio.h>
int main(void) {
   int a, b, c;
   int min;
   int notmin;
   a=0;
   b=0;
   c=0;
   
   scanf("%d",&a);
   scanf("%d",&b);
   scanf("%d",&c);
   
   if(a+b<a+c){
      min=a+b;
   }
   else{
      min=a+c;
   }
   
   if(min<b+c);
   else{
      min=b+c;
   }
   
   printf("%d\n",min);
   
      

}

Measured memory_bytes: 128
#include<stdio.h>
typedef long long ll;
ll func(ll);
ll memo[21];

int main(void){
  ll x,i;
  for(i=0;i<21;i++)
    memo[i]=0;
  scanf("%lld",&x);
  printf("%lld\n",func(x));
  return 0;
}

ll func(ll n){

  if(n==0)return 1;
  if(memo[n]!=0)return memo[n];
  return memo[n]=n * func(n-1);
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    int c[3][3];
    for (int i=0;i<3;i++){
        for (int j=0;j<3;j++){
            cin >> c[i][j];
        }
    }
    for (int k=-100;k<=100;k++){
        bool correct = true;
        int a[3];  
        int b[3];
        a[0] = k;
        b[0] = c[0][0] - a[0];
        b[1] = c[0][1] - a[0];
        b[2] = c[0][2] - a[0];
        a[1] = c[1][0] - b[0];
        a[2] = c[2][0] - b[0];
        for (int l=0;l<3;l++){
            if (a[l]<-100||a[l]>100) {
                correct = false;
            }
        }
        for (int l=0;l<3;l++){
            if (b[l]<-100||b[l]>100) {
                correct = false;
            }
        }        
        for (int i=0;i<3;i++){
            for (int j=0;j<3;j++){
                if (c[i][j]!=a[i]+b[j]) correct=false;
            }
        }
        if (correct){
                    cout << "Yes" << endl;
                    return 0;
                }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

typedef tuple<int, int, int> T;
// get<K>(tuple型の変数)



int main(void){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll C=0;
    priority_queue<ll> zen;
    priority_queue<ll, vector<ll>, greater<ll>> kou;
    ll zensum=0;
    ll kousum=0;

    int q; cin >> q;
    while(q--){
        int type; cin >> type;
        if(type==1){
            ll a, b; cin >> a >> b; C+=b;
            if(zen.size()>kou.size()){
                ll t=zen.top();
                if(a>=t) kou.push(a), kousum+=a;
                else{
                    zen.pop(), zensum-=t;
                    zen.push(a), zensum+=a;
                    kou.push(t), kousum+=t;
                }
            }
            else{
                if(zen.empty()) zen.push(a), zensum+=a;
                else{
                    ll t=kou.top();
                    if(a<=t) zen.push(a), zensum+=a;
                    else{
                        kou.pop(), kousum-=t;
                        kou.push(a), kousum+=a;
                        zen.push(t), zensum+=t;
                    }
                }
            }
        }
        else{
            ll x=zen.top();
            cout << x << ' ' << x*(ll)zen.size() - zensum + kousum - x*(ll)kou.size() + C << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3828
N = int(input())
h = [int(x) for x in input().split()]

dp = [0] * (N)
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(0,N-2):
    dp[i+2] = min( dp[i] + abs(h[i+2] - h[i]), dp[i+1] + abs(h[i+2] - h[i+1]))

print(dp[-1])


Measured memory_bytes: 13980
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int stk[200111],top,cnt[200111],a[200111],n;
LL sum[200111],ans;
int main()
{
	get1(n);
	for(int i=1;i<=n;i++)
	{
		get1(a[i]);
		int all=1;
		while(top&&a[stk[top]]>=a[i])
		{
			all+=cnt[top];
			top--;
		}
		stk[++top]=i;
		cnt[top]=all;
		sum[top]=sum[top-1]+1ll*cnt[top]*a[i];
		ans+=sum[top];
	}
	printendl(ans);
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

vector<LL> v;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int k;
    cin >> k;
   	for(int i=1; i<10; i++) v.PB(i);
   	int i=0;
   	while(v.size()<k) {
   		LL a=v[i];
   		int d=a%10;
   		if ( d>0 ) v.push_back(a*10+d-1);
   		v.push_back(a*10+d);
   		if ( d+1<10 ) v.push_back(a*10+d+1);
   		i++;
   	}
   	cout << v[k-1] << '\n';
    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    string S;
    cin>>S;
    int ans=0;
    int sum=0;
    rep(i,3){
        if(S[i]=='R')sum++;
        else{
            ans=max(ans,sum);
            sum=0;
        }
    }
    ans=max(ans,sum);
    cout <<ans<<endl;

    



}


Measured memory_bytes: 3648
n,x = map(int,input().split())
li = list(map(int,input().split()))

res_abs = []
res = []

s = 10**10

for i in range(n):
    s = abs(li[i] - x)
    res_abs.append(s)
    
    s = li[i] - x
    res.append(s)
    
res.sort()

temp = 10**10

for i in range(n-1):
    temp = min(temp, res[i+1] - res[i])

    
s = min(min(res_abs), temp)
    
while True:
    for i in range(n):
        if res_abs[i]%s != 0:
            break
    else:
        print(s)
        exit()
        
    s -= 1

Measured memory_bytes: 15504
while True:
    n = int(input())
    if n == 0:
        break
    dataset = [list(map(int, input().split())) for _ in range(n)]
    for p in dataset:
        x = sum(p) // 3
        if 100 in p:
            print("A")
        elif (p[0] + p[1]) // 2 >= 90:
            print("A")
        elif x >= 80:
            print("A")
        elif x >= 70:
            print("B")
        elif x >= 50 and (p[0] >= 80 or p[1] >= 80):
            print("B")
        else:
            print("C")

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader sysin = new BufferedReader(new InputStreamReader(System.in));
		String str;
		switch (sysin.readLine()) {
		case "Sunny":
			str = "Cloudy";
			break;
		case "Cloudy":
			str = "Rainy";
			break;
		default:
			str = "Sunny";
			break;
		}
		System.out.println(str);
	}
}

Measured memory_bytes: 32340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

ll N;   // 入力
ll ans; // 答え

bool check(ll n); // N以下の七五三数か判定
void dfs(ll n);   // 七五三数を生成

int main()
{
    cin >> N;
    ans = 0;
    dfs(ans);
    cout << ans << endl;
}

bool check(ll n)
{
    // 3,5,7の数
    ll t = 0;
    ll f = 0;
    ll s = 0;
    ll a = n;
    while (a > 0)
    {
        if (a % 10 == 3)
        {
            t++;
        }
        if (a % 10 == 5)
        {
            f++;
        }
        if (a % 10 == 7)
        {
            s++;
        }
        a /= 10;
    }
    // 3,5,7のうち一つでも欠けていたら七五三数でない
    if (t * f * s == 0)
    {
        return false;
    }
    else
    {
        return true;
    }
}

void dfs(ll n)
{
    if (n > N) // Nより大きいならスルー
    {
        return;
    }
    if (check(n)) // 七五三数ならカウントを進める
    {
        ans++;
    }
    // 再帰的に七五三数の候補を生成
    dfs(10 * n + 3);
    dfs(10 * n + 5);
    dfs(10 * n + 7);
    return;
}

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

#define F first
#define S second
#define MP make_pair
#define PB emplace_back

using namespace std;

const int N = 1e6+100;

long long int wop(long long int x, long long int y) {
    long long int ret=1;
    for(;y>=1;y/=2) {
        if(y&1)ret*=x;
        x*=x;
    }
    return ret;
}

int main () {
    long long int n, m;
    cin >> n >> m;
    n = n*(n-1);
    m=m*(m-1);
    m/=2;
    n/=2;
    cout <<n+m;
}


Measured memory_bytes: 256
s = input()
l = len(s)
count1 = 0
count2 = 0
for i in range(l//2 + l%2):
    if s[2*i] == "R" or s[2*i] == "U" or s[2*i] == "D":
        count1 += 1
for j in range(l//2):
    if s[2*j + 1] == "L" or s[2*j + 1] == "U" or s[2*j + 1] == "D":
        count2 += 1
if count1 == l//2 + l%2 and count2 == l//2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223000000000000000
#define INF 2147000000
#define MOD 1000000007
using namespace std;

ll d[105][105];

int main(int argc, char* argv[])
{
    long a,b;
    scanf("%ld%ld", &a, &b);

    if(b%a==0) {
        printf("%ld\n", a+b);
    }
    else {
        printf("%ld\n", b-a);
    }

    return 0;
}


Measured memory_bytes: 128
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for _ in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))


if __name__ == "__main__":
    a = str_in()
    out("A" if a == a.upper() else "a")


Measured memory_bytes: 62068
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define dd(x) cout<<#x<<" = "<<x<<" "
#define mes(p) memset(p,0,sizeof(p))
#define per(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(x) x.begin(),x.end()
#define rson mid+1,r,rt<<1|1
#define sz(x) (int)x.size()
#define lson l,mid,rt<<1
#define pb push_back
#define mp make_pair
//#define ls (rt<<1)
#define se second
//#define rs (ls|1)
#define fi first
typedef pair <int ,int > pi;
typedef vector <int > vi;
typedef long long ll;
int main(){	
	ios_base::sync_with_stdio(0);
    cin.tie(0);
	int n , m;
	cin >> n >> m;
	if((n+m)&1) cout << "IMPOSSIBLE";
	else  cout << (n+m)/2;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll N, M, V, P; cin >> N >> M >> V >> P;
  vector<ll> A(N); rep(i, N) cin >> A[i];
  sort(range(A));
  int ans = 0;
  int l = -1;
  int r = N - 1;
  auto check = [&](int m) -> bool {
    int k = upper_bound(range(A), A[m]) - A.begin();
    if (N - k <= P - 1) return true;
    if (V - k - (P - 1) <= 0) return A[m] + M >= A[N - 1 - (P - 1)];
    ll rem = (V - k - (P - 1)) * M;
    for (int i = k; i < N - (P - 1); i++) {
      if (A[m] + M < A[i]) return false;
      rem = max(0LL, rem - min(A[m] + M - A[i], M));
    }
    return rem == 0;
  };
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (check(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << (N - r) << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
  
#define repd(i,a,b) for (int i=(a);i<=(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}
  
int main()
{
  string s, t;
  int ans = 0;
  cin >> s >> t;

    if(s[0] == t[0]){ans++;}
    if(s[1] == t[1]){ans++;}
    if(s[2] == t[2]){ans++;}

    cout << ans << endl;

  return 0;
}


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

using namespace std;

int N, dp[400009], bit[200009], p2[200009], v[200009];
char initSir[200009];
const int mod = 998244353;

int add (int x, int y) {int ans = x + y; if (ans >= mod) ans -= mod; return ans;}
int subtract (int x, int y) {if (x >= y) return x - y; return x - y + mod;}
int mul (int x, int y) {return 1LL * x * y % mod;}
void adto (int &x, int y) {x += y; if (x >= mod) x -= mod;}

int power (int a, int b)
{
    int p = 1;
    for (int i=0; (1<<i) <= b; i++)
    {
        if (b & (1 << i)) p = mul (p, a);
        a = mul (a, a);
    }
    return p;
}

int fac[2000009], inv[2000009];
void Prec (int lim){fac[0] = inv[0] = 1;for (int i=1; i<=lim; i++)fac[i] = mul (fac[i - 1], i);
inv[lim] = power (fac[lim], mod - 2);for (int i=lim - 1; i>=0; i--)inv[i] = mul (inv[i + 1], i + 1);}
int comb (int N, int K){if (K > N || N < 0 || K < 0) return 0; int ans = mul (fac[N], inv[N - K]);ans = mul (ans, inv[K]);return ans;}

int gcd (int a, int b)
{
    int r;
    while (b)
        r = a % b,
        a = b,
        b = r;
    return a;
}

bool isBig = 0;
int getCount (int P)
{
    int D = gcd (P, N); ///number of cycles
    if ((P / D) % 2 == 1) return 0;
    if (isBig) return p2[D];
    int ans = 0;
    for (int i=N - 1; i>=N - D; i--)
        if (bit[i])
            adto (ans, p2[D - (N - i)]);
    for (int i=N - 1; i>=N-D; i--)
    {
        v[i] = bit[i];
        for (int step = 1, j = i; step < N / D; step ++, j = (j + P) % N)
            v[(j + P) % N] = v[j] ^ (j + P >= N);
    }
    int i = N - 1;
    while (i >= 0 && v[i] == bit[i])
        i --;
    if (i >= 0 && bit[i] == 1)
        adto (ans, 1);
    return ans;
}

void add1 ()
{
    int i = 0;
    while (bit[i] == 1)
        bit[i] = 0, i ++;
    bit[i] = 1;
    isBig = (i == N);
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d\n%s", &N, initSir);
for (int i=0; i<N; i++)
    bit[i] = initSir[N - 1 - i] - '0';
add1 ();
p2[0] = 1;
for (int i=1; i<=N; i++)
    p2[i] = add (p2[i - 1], p2[i - 1]);
int ans = 0;
for (int i=0; i<=N; i++)
    if (bit[i])
        adto (dp[2 * N], p2[i]); ///all dp is referring to numbers strictly smaller than X
for (int i=1; i<2 * N; i++)
    if ((2 * N) % i == 0)
    {
        //printf ("%d: %d\n", i, getCount (i));
        adto (dp[i], getCount (i));
        for (int j=i + i; j<=2 * N; j+=i)
            dp[j] = subtract (dp[j], dp[i]);
    }
for (int i=1; i<=2 * N; i++)
    if ((2 * N) % i == 0)
        adto (ans, mul (dp[i], i));
printf ("%d\n", ans);
return 0;
}


Measured memory_bytes: 5760
/*
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,fma")
*/
#include <bits/stdc++.h>
#define LL              long long
#define ll              long long
#define SL(n)           scanf("%lld",&n)
#define LF              double
#define SF(n)           scanf("%lf",&n)
 
#define pb              push_back
#define mp              make_pair
 
#define ON(n,i)         (n|(1LL<<i))
#define OFF(n,i)        (n&(~(1LL<<i)))
#define CHK(n,i)        (n&(1LL<<i))

#define ff              first
#define ss              second
 
#define SET(arr)        memset( arr , -1 , sizeof arr)
#define RESET(arr)      memset( arr,0,sizeof arr)
 
#define srt(v)          sort(v.begin(),v.end())
#define uniq(v)			v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define found( s,d )    (s.find(d) != s.end())
 
#define FOR(i,s,e)      for( LL i = s ; i<=e ; i++ )
#define RFOR(i,e,s)     for( LL i = e ; i>=s ; i-- )
         
 
#define FILEIN          freopen("in.txt","r",stdin)
#define FILEOUT         freopen("out.txt","w",stdout)
 
#define DEBUG(x)        cerr<<#x<<" = "<<x<<endl
#define PRINTALL(v)     {cerr<<endl<<"Printing: "<<#v<<endl;for(LL i = 0 ; i<v.size(); i++) DEBUG(v[i]); cerr<<endl;}
 
using namespace std;

int main(){
   LL a,b;
   SL(a); SL(b);
   cout<<(a*b)<<endl;
return 0;}

Measured memory_bytes: 3760
#include<cstdio>
#include<algorithm>

using namespace std;

int n,m;
int x;

int main(){
	//freopen("in","r",stdin);
	scanf("%d%d%d",&n,&m,&x);
	int l = max(n,m);
	int res = (x + l -1) / l;
	printf("%d\n", res);
}

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

int main() {
  int N,ans=0;
  string C;
  cin >> N >> C;
  int i=0,j=N-1;
  while(1){
    while(i<N&&C[i]=='R')
      i++;
    while(j>=0&&C[j]=='W')
      j--;
    if(i==j){
      if(i>0&&(C[i-1]=='W'&&C[i]=='R')) ans++;
      else if(i==0&&(C[i]=='W'&&C[i+1]=='R')) ans++;
      break;
    }
    else if(i>j)
      break;
    if(C[i]=='W'&&C[j]=='R')
	    ans++;
    i++;j--;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3740
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
const ll mod = 1000000007;
const ll mod9 = 1000000009;

ll d[109];
ll f[109];
ll u[109];
ll k[109];
ll v[109][109];
ll t=0;

ll  dfs(ll n){
    if(d[n]==0){
        t++;
        d[n]=t;
    // cout<<" d "<<n<<" "<<t<<endl;
    }

    ll ct=0;
    rep(i,k[n]){
        if(d[v[n][i]-1]==0) dfs(v[n][i]-1),ct++;
    }
    t++;
    f[n]=t;
    // cout<<" f "<<n<<" "<<t<<endl;
    return 0;
}

signed main(){
    ll n;
    cin>>n;
    rep(i,n){
        ll a;
        cin>>u[i]>>k[i];
        rep(j,k[i]){
            cin>>v[i][j];
        }
    }
    rep(i,n){
        if(d[i]==0) dfs(i);
    }
    rep(i,n){
        printf("%lld %lld %lld\n",i+1,d[i],f[i]);
    }
}




Measured memory_bytes: 3224
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

long long a[209];
vector<long long> v;

int bc(long long n)
{
	int s = 0;
	while (n) {
		s++;
		n /= 2;
	}
	return s;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int tc; cin >> tc;
	for (int ti = 0; ti < tc; ti++) {
		v.clear();
		int n; cin >> n;
		for (int i = 0; i < n; i++)
			cin >> a[i];
		string s; cin >> s;
		bool f = true;
		for (int i = n - 1; i >= 0; i--) {
			long long p = a[i];
			for (int j = 0; j < v.size(); j++)
				if (bc(v[j]) == bc(p))
					p = (p ^ v[j]);
			if (!p) continue;
			else {
				if (s[i] == '1') {
					f = false;
					break;
				}
				for (int j = 0; j < v.size(); j++)
					if (bc(v[j]) == bc(a[i]))
						a[i] = (a[i] ^ v[j]);
				v.push_back(a[i]);
				sort(v.begin(), v.end()); reverse(v.begin(), v.end());
			}
		}
		if (f) cout << 0 << '\n';
		else cout << 1 << '\n';
	}
	return 0;
}


Measured memory_bytes: 3620
#include <iostream>

using namespace std;

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

  int a, b;
  cin >> a >> b;
  if (a == 1) a = 14;
  if (b == 1) b = 14;
  if (a < b)
    cout << "Bob" << endl;
  else if (a > b)
    cout << "Alice" << endl;
  else
    cout << "Draw" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	int n,m;
	cin >> n >> m;
	vector <int> a(n);
	int sum =0;
	for (int i =0;i <n;i++) {
		cin >> a[i];
		sum += a[i];
	}
	double b = sum * ((double)1/(4*m));
	int count =0;
	for (int i =0; i<n;i++) {
		if (a[i] >= b) {
			count++;
		}
	}
	if (count >= m) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 888
n = int(input())
li=[]
for z in range(n):
    li.append(input())
acc = li.count('AC')
wrg = li.count('WA')
time = li.count('TLE')
run_time = li.count('RE')
print(f"AC x {acc}")
print(f"WA x {wrg}")
print(f"TLE x {time}")
print(f"RE x {run_time}")

Measured memory_bytes: 16280
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define pll pair<LL,LL>
int main()
{
    string s;
    map<string,int> ma,mb;
    int n,m;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        ma[s]++;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>s;
        mb[s]++;
    }
    int b,maxx=0;
    for(map<string,int>::iterator it=ma.begin();it!=ma.end();it++)
    {
        if(mb.count(it->first))
            b=ma[it->first]-mb[it->first];
        else
            b=ma[it->first];
        if(b>maxx)
            maxx=b;
    }
    cout<<maxx;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main () {
  int n;
  cin >> n;
  if (n == 111) cout << 999 << endl;
  if (n == 119) cout << 991 << endl;
  if (n == 191) cout << 919 << endl;
  if (n == 199) cout << 911 << endl;
  if (n == 911) cout << 199 << endl;
  if (n == 919) cout << 191 << endl;
  if (n == 991) cout << 119 << endl;
  if (n == 999) cout << 111 << endl;
}


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

int main(void)
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a==b && a==c)
        cout << "No" << endl;
    else if (a==b || a==c || b==c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(k,i,n) for(long long i=k;i<n;++i)
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    ll  N;
    cin>>N;
    rep(1,i,1e5){
        if((int)floor(i*1.08)==N){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
//typedef pair<int, int> P;
struct P {
	int x, y;
	P(int x, int y):x(x), y(y){}
	P(){}
};

struct PP {
	P a, b;
	int time;
	PP(P a, P b, int t) : a(a), b(b), time(t) {}
	PP() {}
};

/** Problem0223 : Stray Twins **/
int main()
{
	int W, H;
	while (cin>>W>>H, W||H) {
		bool wall[W][H];
		int tx, ty, kx, ky;
		cin>>tx>>ty>>kx>>ky;
		tx--, ty--, kx--, ky--;
		
		rep(y, H) rep(x, W) cin>>wall[x][y];
		
		queue<PP> Q;
		
		bool vis[51][51][51][51] = {0};
		Q.push(PP(P(tx, ty), P(kx, ky), 0));
		vis[tx][ty][kx][ky] = true;
		
		while (Q.size()) {
			PP pp = Q.front(); Q.pop();
//			cerr << pp.a.x << " " << pp.a.y << " " << pp.b.x << " " << pp.b.y << endl;
			
			if (pp.time > 100) continue;
			if (pp.a.x == pp.b.x && pp.a.y == pp.b.y) {
				cout << pp.time << endl;
				goto end;
			}
			
			rep(i, 4) {
				PP np = pp;
				np.a.x += dx[i];
				np.b.x -= dx[i];
				np.a.y += dy[i];
				np.b.y -= dy[i];
				np.time++;
				
				if_range(np.a.x, np.a.y, W, H) {
					if (!wall[np.a.x][np.a.y])
						;
					else
						np.a = pp.a;
				} else np.a = pp.a;
				
				if_range(np.b.x, np.b.y, W, H) {
					if (!wall[np.b.x][np.b.y])
						;
					else
						np.b = pp.b;
				} else np.b = pp.b;
				
				if (!vis[np.a.x][np.a.y][np.b.x][np.b.y]) {
					vis[np.a.x][np.a.y][np.b.x][np.b.y] = true;
					Q.push(np);
				}
			}
		}
		
		cout << "NA" << endl;
	end:;
	}
}

Measured memory_bytes: 8132
N, M = gets.chomp.split(" ").map(&:to_i)
E = Array.new(N+1).map{Array.new}
M.times{
  a, b, c = gets.chomp.split(" ").map(&:to_i)
  E[a] << [b, c]
}

ans = Array.new(N+1)
ans[1] = 0
bef = [1]
wk = nil
(2*N).times{|i|
  nxt = []
  tmp = (i==N ? 10 ** 9 * N : 0)
  bef.each{|n|
    E[n].each{|b, c|
      if ans[b].nil? || ans[b] < ans[n] + c then
        ans[b] = ans[n] + c + tmp
        nxt << b
      end
    }
  }
  bef = nxt.uniq
  break if bef.empty?
  wk = ans[N] if i == N-1
}

if wk.nil? then
  puts ans[N]
elsif wk == ans[N] then
  puts ans[N]
else
  puts 'inf'
end


Measured memory_bytes: 19836
function Main(input) {
  input = input.split(" ");
  sum = input[0] * input[1];
  
  if (sum % 2 == 0) {
    console.log("Even");
  } else {
    console.log("Odd");
  }
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef std::vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())

int main() {

	int n;
	cin >> n;
	vector<ll> a(n), b;
	FOR(i, n)cin >> a[i];
	int i = n - 1;
	if (n % 2 == 0) {
		while (i > 0) {
			b.push_back(a[i]);
			i -= 2;
		}
		i++;
		while (i < n) {
			b.push_back(a[i]);
			i += 2;
		}
	}
	else {
		while (i >= 0) {
			b.push_back(a[i]);
			i -= 2;
		}
		i += 3;
		while (i < n) {
			b.push_back(a[i]);
			i += 2;
		}
	}

	FOR(i, n)cout << b[i] << " ";
	cout << endl;

	return 0;
}


Measured memory_bytes: 5488
#include<iostream>

int max_profit(int n,int a[]){
	
	int min,maxd;
	min=a[0];
	maxd=a[1]-a[0];
	
	for(int i=1;i<n-1;i++){
		
				if(a[i]<min){
			min=a[i];	
		}
		
		if(a[i+1]-min>maxd){
			maxd=a[i+1]-min;
		}
	}

	return maxd;
	
}

int main(void){
	
	int n;
	
	std::cin>>n;
	
	int array[n];
	
	for(int i=0;i<n;i++){
		std::cin>>array[i];
	}
	
	std::cout<<max_profit(n,array)<<'\n';
	
}


Measured memory_bytes: 3860
#include<bits/stdc++.h>
using namespace std;
void solve()
{
   long long n;
   cin>>n;
   double x=n/(3.0);
   double ans=x*x*x;
 cout << fixed << setprecision(6); 

   cout<<ans<<" ";
}
main()
{
int t;
t=1;
while(t--)
{
solve();

}
}

Measured memory_bytes: 256
while True:
    H , W = map(int, input().split())
    if(H == 0 and W == 0):
        break
    for i in range(H):
        for j in range(W):
            if(i+j)%2 == 0:
                print("#" , end = "")
            else:
                print("." , end = "")
        print()
    print()


Measured memory_bytes: 7004
from collections import Counter

#input
c = int(input())
str_input = []
sort_str_input = []

for i in range(c):
    str_input.append(input())
    char_input = []
    for j in range(len(str_input[i])):
        char_input.append(str_input[i][j])
    char_input.sort()
    sort_str_input.append(''.join(map(str,char_input)))

test = Counter(sort_str_input)
test = test.most_common()
count=0
for i in range(len(test)):
    for j in range(test[i][1]-1):
        count = count +(test[i][1]-1-j)
print(count)

Measured memory_bytes: 31596
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;

int compare(string taro,string hana,int *t,int *h){
		int m;

		if( taro == hana){
				*t += 1;
				*h += 1;
		}

		m = (taro.size() > hana.size()) ? taro.size():hana.size();
		for(int i = 0;i < m;i++){
				if(taro[i] -'a' > hana[i] - 'a'){
						*t += 3;
						break;
				}else if(taro[i] -'a' < hana[i] -'a'){
						*h += 3;
						break;
				}
		}
		return 0;
}

int main(){
		int n,taro_score = 0,hana_score = 0;
		string taro,hana;

		cin >> n;
		for(int i = 0;i < n;i++){
				cin >> taro >> hana;
				compare(taro,hana,&taro_score,&hana_score);
		}
		cout << taro_score << " " << hana_score << endl;
		return 0;
}

Measured memory_bytes: 1216
#include<stdio.h>
int main(void){
int i,j,n,b,a;
int s[11][7]={{0,1,1,1,1,1,1},{0,0,0,0,1,1,0},{1,0,1,1,0,1,1},{1,0,0,1,1,1,1},{1,1,0,0,1,1,0},{1,1,0,1,1,0,1},{1,1,1,1,1,0,1},{0,1,0,0,1,1,1},{1,1,1,1,1,1,1},{1,1,0,1,1,1,1},{0,0,0,0,0,0,0}};
int ans[7];

while(scanf("%d",&n),n!=-1){
b=10;
for(i=0;i<n;i++){
scanf("%d",&a);
for(j=0;j<7;j++){
if(s[b][j]==s[a][j]) ans[j]=0;
else ans[j]=1;
}
b=a;
for(j=0;j<7;j++){
printf("%d",ans[j]);
}
puts("");
}
}
return 0;}

Measured memory_bytes: 608
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	long long a,b,c,d,t,s,minv=999999999,e,z;
	cin>>a>>b>>c>>d>>e;
	minv=d*a+e*b;
	if(d>e)
	t=1;
	else
	t=0;
	if(t==0)
	{
		s=d*c*2+(e-d)*b;
		z=2*e*c;
	}
	else
	{
		s=e*c*2+(d-e)*a;
		z=2*d*c;
	}
	
	if(s>=minv && z>=minv)
	cout<<minv;
	else if(z>=s)
	cout<<s;
	else
	cout<<z;
	return 0;	
}

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

int main(){
    
    int array[3];
    int a,b,c,f = 0,s = 0;
    cin >> a >> b >> c;
    array[0] = a;
    array[1] = b;
    array[2] = c;
    
    for (int x = 0; x <= 3; x++) {
        switch (array[x]) {
            case 5:
                f++;
                break;
            case 7:
                s++;
                break;
            default:
                break;
        }
    }
    
    if(f == 2 && s == 1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a>=13){
  	cout<<b;
    //return 0;
  }
  else if(a>=6 && a<=12){
  	cout<<b/2;
    //return 0;
  }
  else
    cout<<0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};

int a[100000];
int leaf_num = 1; // 一番下にある頂点の個数
int seg[400000];
 
int func(int x, int y) {
    return x + y;
}

int identity_element() {
    return 0;
}

void init(int n) {
    while(leaf_num < n) {
        leaf_num *= 2;
    }
    for(int i = 0 ; i < n; i++) {
        seg[i + leaf_num - 1] = a[i];
    }
    for(int i = leaf_num - 2; i >= 0; i--) {
        seg[i] = func(seg[i * 2 + 1], seg[i * 2 + 2]);
    }
}
 
void update(int k, int x) {
    k--;
    k += leaf_num - 1;
    seg[k] += x;
    while(k != 0) { //  親に到達するまで
        k = (k - 1) / 2; // 頂点をひとつ上に移動
        seg[k] = func(seg[k * 2 + 1], seg[k * 2 + 2]);
    }
}
 
int _get_interval(int a, int b, int k, int l, int r) {
    if(b <= l || r <= a) return identity_element();
    if(a <= l && r <= b) {
        return seg[k];
    }
    int lch = _get_interval(a, b, k * 2 + 1, l, (l + r) / 2);
    int rch = _get_interval(a, b, k * 2 + 2, (l + r) / 2, r);
    return func(lch, rch);
}
 
int get_interval(int l, int r) {
    return _get_interval(l - 1, r, 0, 0, leaf_num);
}



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

	int N, Q;
	cin >> N >> Q;
	init(N);

	rep(i, Q) {
		int com, x, y;
		cin >> com >> x >> y;
		
		if(com == 0) {
			update(x, y);
		} else {
			cout << get_interval(x, y) << endl;
		}
	}
	return 0;
}


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

int main(void){
    int N, D;cin>>N>>D;
    vector<vector<double>> v(N, vector<double>(D, 0));    
    
    for(int i=0;i<N;i++)for(int j=0;j<D;j++){
        cin>>v[i][j];
    }
    ll res = 0;
    
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            double ans = 0;
            for(int k=0;k<D;k++){
                ans += pow((v[i][k]-v[j][k]), 2);
            }
            ans = sqrt(ans);
            int aa = ans;
            if(ans==aa)res++;
        }
    }cout<<res<<endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int h,w, x,y;
    cin >> h >> w >> x >> y;
    cout << h * w  - x * w - h * y + x * y << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace PracticeForAtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            int n = int.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');
            int[] a = new int[n];

            for(int i = 0; i < n; i++)
            {
                a[i] = int.Parse(str[i]);
            }

            a = a.OrderBy(s => s).ToArray();

            for(int i = 1; i < n; i++)
            {
                if (a[i] == a[i - 1])
                {
                    Console.WriteLine("NO");
                    return;
                }
            }
            Console.WriteLine("YES");



            //ここまで
        }
    }
}


Measured memory_bytes: 36252
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define reps(i,n) for(int i=1;i<=(int)n;i++)
#define all(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    int N; cin >> N;
    bool flag = false;
    reps(i,N){
        if(i*108/100 == N){
            flag = true;
            cout << i << endl;
            return 0;
        }
    }

    if(!(flag)){
        cout << ":(" << endl;
    }
    return 0;
}

Measured memory_bytes: 3632