akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(ll i = a; i < (n); ++i)
#define repD(i, a, n) for(ll i = a; i > (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (long long) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
// #define mp make_pair
#define pb push_back
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
const long double PI = 3.141592653589793238462643383;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<double> vd;
typedef vector<pii> vii;
long long Ceil(long long a, long long b){
    if(a%b==0) return a/b;
    else return (a/b)+1;
}
ll p=1000000007;
float E = 0.00000000000001;
ll power(ll x, ll y){
    if(y==0){
        return 1;
    }
    if(y%2==0){
        ll q=power(x,y/2);
        q=q%p;
        return (q*q)%p;
    }
    ll q=power(x,y/2);
    q=q%p;
    return ((x%p)*((q*q)%p))%p; 
}
bool isPowerOfTwo (long long x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}  

long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a); 
}
long long int mod(long long int a, long long int b) {
    long long int ret = a%b; return ret>=0? ret: ret+b; 
}
int main(){
    std::ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);   
    freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector <int> vec(n);
        for(int i = 0 ; i < n ; i++)
            cin>>vec[i];
        int ans = 0;
        for(int i = 0 ; i < n ; i+=2)
            if(vec[i]%2)
                ans++;
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3612
n = int(input())
As = [int(i) for i in input().split()]

while True:
    m = min(As)
    idx = As.index(m)
    As = [a if i == idx else a % m for i, a in enumerate(As)]
    As = [a for a in As if a > 0]
    if len(As) == 1:
        break
print(As[0])

Measured memory_bytes: 64920
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    long long int i,j,k,l,n,sum=0,s=0,flag=0;
    cin >> n;
    while(n!=0)
    {
        flag=1;
        if(n<5)
        {
            break;
        }
        else if(n>=500)
        {
            s=n/500;
            sum+=s*1000;
            n=n-s*500;
        }
        else
        {
            s=n/5;
            sum+=s*5;
            n=n-s*5;
        }
    }
    if(flag==1)
    {
        cout << sum << endl;
    }
    else
    {
        cout << n << endl;
    }
    return 0;
}


Measured memory_bytes: 256
// AtCoder165 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

int revcompare(const void* a, const void* b) {
    return *(int*)b- *(int*)a;
}


int main() {
    int i,j;
    int n;
    int a;
    int* order;

    scanf("%d", &n);
    order = (int*)malloc(sizeof(int) * n);

    for(i=0;i<n;i++){
        scanf("%d", &a);
        order[a-1] = i+1;
    }

    for(i=0;i<n;i++){
        printf("%d ", order[i]);
    }

    return 0;
}

Measured memory_bytes: 1152
n=input()
n=int(n)
val=list(map(int,input().strip().split(' ')))
val.sort()
res=0
if val and n>=2:
    if len(val)==1:
        print(val[0]/2)
    elif len(val)==2:
        print((val[0]+val[1])/2)
    else:
        #res=(val[0]+val[1])/2
        res=(val[0]+val[1])/2
        for i in range(2,len(val)):
            res=(res+val[i])/2
           # print(res)
        print(res)
else:
    #print('error')
    pass

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    // とりあえず言い換え．
    // コスト1を使ってビスケットを1枚増やす
    // コスト2を使ってビスケットa枚からb枚にする
    ll k,a,b;cin>>k>>a>>b;
    if(a>=b||k<a||a+1==b){
        cout<<1+k<<endl;
        return 0;
    }
    ll ans=1;
    ans+=a-1;
    k-=a-1;

    ans+=(b-a)*(k/2);
    k%=2;
    ans+=k;
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def divisors(n):
    # 約数列挙

    divisors = []

    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    return divisors


def main():
    from itertools import accumulate
    n, k = map(int, readline().split())
    a = list(map(int, readline().split()))
    s = sum(a)
    divs = divisors(s)
    divs.sort()

    ans = 1
    for div in divs:
        rem = [0] * n
        rem2 = [0] * n
        for i, x in enumerate(a):
            rem[i] = x % div
        rem.sort()
        for i in range(n):
            rem2[i] = div - rem[i]
        acc = list(accumulate(rem))
        acc2 = list(accumulate(rem2))
        for i in range(n):
            cnt = max(acc[i], acc2[-1] - acc2[i])
            if cnt <= k:
                ans = div
                break

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 74660
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int s=700,i;
	char c;
	for(i=0;i<3;i++)
	{
		scanf("%c",&c);
		if(c=='o')
		{
			s+=100;
		}
	}
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int N;
char S[10010][22];
char T[22];

int main(){
	scanf("%d" , &N);
	repp(i,0,N){
		scanf(" %s" , S[i]);
	}
	scanf(" %s" , T);
	int a = 1 , q = 0;
	repp(i,0,N){
		for(int j = 0 ; j < 22 ; ++j){
			if(T[j] == 0){
				if(S[i][j] == 0){
					++q;
				}
				break;
			} else if(S[i][j] == 0){
				++a;
				break;
			}
			if(S[i][j] == '?'){
				if(T[j] == 'a' || T[j] == 'z') continue;
				++q;
				break;
			} else if(S[i][j] == T[j]){
				continue;
			} else if(S[i][j] < T[j]){
				++a;
				break;
			} else {
				break;
			}
		}
	}
	repp(i,0,q+1){
		printf("%d%c" , a+i , i == q ? '\n' : ' ');
	}
	return 0;
}


Measured memory_bytes: 384
var
a,s,d,f,g:integer;
begin
read(g);
for a:=1 to 9 do
for s:=0 to 9 do
for d:=0 to 9 do
for f:=0 to 9 do
if a*1000+s*100+d*10+f=g then
if ((a=s) and (a=d)) or ((s=d) and (s=f)) or ((a=s) and (a=d) and (a=f))
then writeln('Yes')
else writeln('No');
end.


Measured memory_bytes: 128
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N, P = map(int, input().split())
    A = list(map(int, input().split()))
    even=0
    odd=0
    for i in range(N):
        if A[i] % 2==0:
            even+=1
    odd=N-even

    if odd==0:
        print(2**N if P==0 else 0)
    else:
        print(2**(N-1))

resolve()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define INF 9223372036854775807
const ll mod=998244353;

 
int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll n;
    cin>>n;
    ll a=0,w=0,t=0,r=0;
    for(ll i=0;i<n;i++){
        string s;
        cin>>s;
        if(s=="AC") a++;
        else if(s=="TLE") t++;
        else if(s=="WA") w++;
        else if(s=="RE") r++;
    }
    cout<<"AC x "<<a<<"\n";
    cout<<"WA x "<<w<<"\n";
    cout<<"TLE x "<<t<<"\n";
    cout<<"RE x "<<r<<"\n";





    return 0;
}

Measured memory_bytes: 3668
#include <stdio.h>
int main (void)
{
    long long a,b,c,ans;
    ans = 0;
    scanf("%lld %lld %lld",&a,&b,&c);
    if(c-1 <= b + a)    ans = b+c;
    else    ans = a+2*b+1;
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()
 
using namespace std;

inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}
 
inline ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}
 
inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
 
inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return dividend / divisor;
}
 
inline vector<pair<ll, int>> factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}
 
inline bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
 
ll mod = 1e9+7;

int main(void){
    ll n, m;
    cin >> n >> m;
    priority_queue<ll> a;
    rep(i, n){
        ll x;
        cin >> x;
        a.push(x);
    }
    
    rep(i, m){
        ll x = a.top() / 2;
        a.pop();

        a.push(x);
    }
    
    ll ans = 0;
    rep(i, n){
        ans += a.top();
        a.pop();
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1400
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
 
#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e4 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;
    FOR (i, 0, 2)
        if (s[i] == '7') {cout << "Yes"; return 0;}
    cout << "No";
        
}














Measured memory_bytes: 3660
#include <cstdio>

int main()
{
    int n, a;
    scanf("%d", &n);
    int counter = 0;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a);
        if ((i % 2 == 1) && (a % 2 == 1)) {
            counter++;
        }
    }
    printf("%d\n", counter);
    return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
#define ll long long
#define maxn 201000
using namespace std;
int a[110];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	int ans=1e9;
	for(int i=0;i<=100;i++){
		int sum=0;
		for(int j=0;j<n;j++) sum+=(a[j]-i)*(a[j]-i);
		ans=min(ans,sum);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

template <class Abel> class unionfind
{
public:
  vector<ll> parent;
  vector<ll> rank;
  vector<Abel> diffw;

  unionfind(ll N, Abel U = 0)
  {
    parent = vector<ll>(N, -1);
    rank = vector<ll>(N, 0);
    diffw = vector<Abel>(N, U);
  }

  ll root(ll X)
  {
    if (parent.at(X) < 0) return X;
    ll R = root(parent.at(X));
    diffw.at(X) += diffw.at(parent.at(X));
    return parent.at(X) = R;
  }

  ll size(ll X)
  {
    return -parent.at(root(X));
  }

  Abel weight(ll X)
  {
    root(X);
    return diffw.at(X);
  }

  Abel diff(ll X, ll Y)
  {
    return weight(Y) - weight(X);
  }

  bool same(ll X, ll Y)
  {
    return (root(X) == root(Y));
  }

  bool unite(ll X, ll Y, Abel W = 0)
  {
    W += weight(X);
    W -= weight(Y);

    X = root(X);
    Y = root(Y);
    if (X == Y) return false;
    
    if (rank.at(X) < rank.at(Y)) 
    {
      swap(X, Y);
      W = -W;
    }
    if (rank.at(X) == rank.at(Y)) rank.at(X)++;
    parent.at(X) += parent.at(Y);
    parent.at(Y) = X;
    diffw.at(Y) = W;
    return true;
  }
};

int main()
{
  ll N, M;
  cin >> N >> M;

  vector<vector<ll>> A(M);
  for (ll i = 0; i < N; i++)
  {
    ll K;
    cin >> K;
    for (ll j = 0; j < K; j++)
    {
      ll L;
      cin >> L;
      L--;

      A.at(L).push_back(i);
    }
  }

  unionfind<ll> uf(N);
  for (ll i = 0; i < M; i++)
  {
    ll K = A.at(i).size();
    for (ll j = 1; j < K; j++)
    {
      uf.unite(A.at(i).at(0), A.at(i).at(j));
    }
  }
  
  for (ll i = 1; i < N; i++)
  {
    if (!uf.same(0, i))
      FINALANS("NO");
  }
  FINALANS("YES");
}

Measured memory_bytes: 5876
// Sky's the limit :)
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    //int t = 1; cin >> t; while(t--)
    {
        int n, k;
        cin >> n >> k;
        set<int> st;
        while(k--) {
            int x;
            cin >> x;
            while(x--) {
                int y;
                cin >> y;
                st.insert(y);
            }
        }

        cout << n - st.size() << '\n';
    }
    
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



Measured memory_bytes: 3868
from sys import stdin
input=lambda : stdin.readline().strip()
from math import ceil,sqrt,factorial,gcd
from collections import deque
n=int(input())
l=list(map(int,input().split()))
z=[float("infinity") for i in range(n)]
z[0]=0
for i in range(n):
	if i<n-1:
		z[i+1]=min(z[i+1],z[i]+abs(l[i]-l[i+1]))
	if i<n-2:
		z[i+2]=min(z[i+2],z[i]+abs(l[i]-l[i+2]))
print(z[-1])

Measured memory_bytes: 20944
//
//  main.cpp
//  zero
//
//  Created by 叶金炜 on 2019/4/2.
//  Copyright © 2019 okstal. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#define pi acos(-1)
using namespace std;
int main() {
    int x,y;
    char c;
    while(cin>>x>>c>>y)
    {
        if(c=='+')cout<<x+y<<endl;
        else if(c=='-')cout<<x-y<<endl;
        else if(c=='*')cout<<x*y<<endl;
        else if(c=='/')cout<<x/y<<endl;
        else if(c=='?')return 0;
    }
    return 0;
}



Measured memory_bytes: 3096
#include <cstddef>
#include <cstdint>
#include <vector>

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

template <typename T>
std::vector<T> make_v(usize a) { return std::vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(usize a, Ts... ts) {
  return std::vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename V>
typename std::enable_if<std::is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename std ::enable_if<std::is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
  for (auto &e : t) fill_v(e, v);
}

template <typename T, typename V>
inline void chmin(T &a, V b) {
  if (a > b) a = b;
}
template <typename T, typename V>
inline void chmax(T &a, V b) {
  if (a < b) a = b;
}

} // namespace null_null

class UnionFind {
private:
  std::vector<int> data;

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

  bool doUnite(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return (false);
    if (data[x] > data[y]) std::swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  int getFind(int k) {
    if (data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int getSize(int k) {
    return (-data[find(k)]);
  }

public:
  UnionFind(int N) {
    data.resize(N, -1);
  }

  int same(int x, int y) { return isSame(x, y); }
  bool unite(int x, int y) { return doUnite(x, y); }
  int find(int k) { return getFind(k); }
  int size(int k) { return getSize(k); }
};

#include <algorithm>
#include <iostream>
#include <utility>

namespace null_null {

void main_() {
  usize N, M;
  std::cin >> N >> M;

  UnionFind uf(N);

  for (usize i = 0; i < M; i++) {
    u64 a, b;
    std::cin >> a >> b;
    a--, b--;
    uf.unite(a, b);
  }

  i64 a = uf.size(0), b = uf.size(1);
  if (a < b) std::swap(a, b);
  a += N - a - b;

  auto c = [&](i64 x) {
    return x * (x - 1) / 2;
  };

  std::cout << c(a) + c(b) - M << std::endl;
}

} // namespace null_null

int main() {
  null_null::main_();
  return 0;
}


Measured memory_bytes: 640
import sys

sys.setrecursionlimit(10**7)
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
printn = lambda x: print('\n'.join(x))

n, m = nm()
h = nl()
w = [True]*n
for _ in range(m):
    a, b = nm()
    a -= 1; b -= 1
    if h[a] <= h[b]:
        w[a] = False
    if h[a] >= h[b]:
        w[b] = False
print(sum(w))


Measured memory_bytes: 20216
pattern = {'N':(1,5,2,3,0,4),'S':(4,0,2,3,5,1),'E':(3,1,0,5,4,2),'W':(2,1,5,0,4,3)}
dice_num = input().split()
for x in input():
    dice_num = [dice_num[i] for i in pattern[x]]
print(dice_num[0])


Measured memory_bytes: 5568
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

int dp[110][10010];

int main()
{
    int n,w;
    cin >> n >> w;
    int value[n],weight[n];
    for(int i = 0; i < n; i++){
        cin >> value[i] >> weight[i];
    }
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= w; j++){
            if(j >= weight[i]){
                dp[i+1][j] = max(dp[i][j],dp[i+1][j - weight[i]] + value[i]);
            }else{
                dp[i+1][j] = dp[i][j];
            }
        }
    }
    cout << dp[n][w] << endl;
}


Measured memory_bytes: 7004
#include<bits/stdc++.h>
using namespace std;
void input()
{
	freopen("/home/rakib/input.txt","r",stdin);
	freopen("/home/rakib/output.txt","w",stdout);
}
int main()
{
	//input();
	int tt;
	cin>>tt;
	cout<<tt+pow(tt,2)+pow(tt,3)<<endl;
}

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

void printArr(int N, int *arr){
    for(int i=0;i!=N;i++){
        if(i>0)cout<<" "; //隣接する要素の間に1つの空白を出力
        cout<<arr[i];
    }
    cout<<endl;
}

void printArrCol(int N, int *arr){
    for(int i=0;i!=N;i++){
        cout<<arr[i]<<endl;
    }
}

void reverseArr(int N, int *arr){
    int temp;
    for(int i=0;i!=N/2;i++){
        temp=arr[i];
        arr[i]=arr[N-i-1];
        arr[N-i-1]=temp;
    }
}

int insertionSort(int N, int *arr, int gap){
    int i, j, temp;
    int cnt=0;
    for(i=gap;i<N;i++){
        temp=arr[i];
        j=i-gap;
        while(arr[j]>temp && j>=0){
            arr[j+gap]=arr[j];
            j-=gap;
            cnt++;
        }
        arr[j+gap]=temp;
    }
    return cnt;
}

int shellSort(int N, int *arr, int m, int *gap){
    int cnt=0;
    
    for(int i=0;i<m;i++){
        cnt+=insertionSort(N, arr, gap[i]);
    }
    return cnt;
}

void generateGaps(int *gap, int &m, int N) {
    int h = 1;
    for (m = 0; h <= N; m++) {
        gap[m] = h;
        h = 3 * h + 1;
    }
    reverseArr(m, gap);
}

int main(){
    
    int N;
    cin>>N;
    int arr[N];
    for(int i=0;i!=N;i++){
        cin>>arr[i];
    }
    
    int gap[N];
    int m;
    generateGaps(gap, m, N);
    
    cout<<m<<endl;
    printArr(m, gap);
    cout<<shellSort(N, arr, m, gap)<<endl;
    printArrCol(N, arr);
    cout<<endl;
    
    return 0;
}



Measured memory_bytes: 7020
import scala.io.StdIn._
object Main extends App {
  val sr = new StdinReader
  val n, m, q = sr.nextInt

  val arr = Array.ofDim[Int](n + 1, n + 1)
  (1 to m).foreach{i =>
    val l, r = sr.nextInt
    arr(l)(r) += 1
  }

  for {
    l <- (1 to n)
    r <- (1 to n)
  } {
    arr(l)(r) += arr(l - 1)(r) + arr(l)(r - 1) - arr(l - 1)(r - 1)
  }

  val ans = Array.ofDim[Int](n + 1, n + 1)
  for {
    l <- (1 to n)
    r <- (1 to n)
  } {
    ans(l)(r) = arr(r)(r) - arr(l - 1)(r) - arr(r)(l - 1) + arr(l - 1)(l - 1)
  }

  (1 to q).foreach{i =>
    val l, r = sr.nextInt
    println(ans(l)(r))
  }
}




class StdinReader {
  val is = System.in
  val buffer = new Array[Byte](1024 * 1024)
  var size = 0
  var pos = 0

  private def readByte: Byte = {
    if (pos >= size) {
      pos = 0;
      size = is.read(buffer);
    }
    if (size < 0) -1
    else {
      val ret = buffer(pos)
      pos += 1
      ret
    }
  }

  // support single byte char only
  def next: String = {
    @scala.annotation.tailrec
    def r(sb: StringBuilder, reading: Boolean): String = {
      readByte match {
        case b if ('!' <= b && b <= '~') => r(sb.append(b.asInstanceOf[Char]), true)
        case _ => if (reading) sb.toString else r(sb, false)
      }
    }
    r(new StringBuilder, false)
  }

  def nextInt: Int = {
    @scala.annotation.tailrec
    def r(i: Int, reading: Boolean): Int = {
      readByte match {
        case '-' => r(i * -1, true)
        case b if '0' <= b && b <= '9' => r(i * 10 + (b - '0'), true)
        case _ => if (reading) i else r(i, false)
      }
    }
    r(0, false)
  }
}

Measured memory_bytes: 41304
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstring>

using namespace std;

typedef long long LL;

int c0, c1;

void solve()
{
    int n;
    cin >> n;
    int x;
    for(int i = 0; i < n; ++ i) {
        scanf("%d", &x);
        if (x & 1) c1++;
        else c0++;
    }
    if (c1 % 2 == 0) {
        cout << "YES" << endl;
    } else {
        if (c0) {
            cout << "NO" << endl;
        } else {
            cout << "YES" << endl;
        }
    }

}

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


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

int main(int argc, const char * argv[]) {
    uint64_t N;
    cin >> N;
    if (N % 2 != 0) {
        N += 1;
    }
    
    uint64_t ans = N / 2;
    cout << ans-1;
    
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) 
{   
    int n,p;
	while(cin>>n>>p)
	{
	int sum;
	sum=n*3+p;
	cout<<sum/2<<endl; 
	 } 
	return 0;
}

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

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    string s;
    cin >> s;
    int n = s.size() + 1;
    vector<int> a(n);
    for (int i = 1; i < n; i++) {
        if (s[i - 1] == '<') a[i] = a[i - 1] + 1;
    }
    vector<int> b(n);
    for (int i = n - 2; i >= 0; i--) {
        if (s[i] == '>') b[i] = b[i + 1] + 1;
    }
    long res = 0;
    for (int i = 0; i < n; i++) {
        res += max(a[i], b[i]);
    }
    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 4764
#include <iostream>
using namespace std;
int main(void){
    int K, S;
    cin >> K >> S;
    int result = 0;
    for (int X = 0; X <= K; X++){
        for (int Y = 0; Y <= K; Y++){
            int Z = S - X - Y;
            if (Z >=0 && Z <= K){
                result += 1;
            }
        }
    }
    
    cout << result;
    
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int[] n = new int[9];
            char[] list = sc.nextLine().toCharArray();
            for (int i : list) {
                n[i - '1']++;
            }
            List<Integer> result = new ArrayList<>();

            for (int i = 0; i < 9; i++) {
                next: for (int j = 0; j < 9; j++) {
                    if (n[i] < 4 && (n[j] >= 2 || n[i] >= 1)) {
                        int[] temp = n.clone();
                        temp[i]++;
                        temp[j] -= 2;
                        for (int k = 0; k < 7; k++) {
                            if ((temp[k] == 1 || temp[k] == 4) && temp[k + 1] > 0 && temp[k + 2] > 0) {
                                temp[k]--;
                                temp[k + 1]--;
                                temp[k + 2]--;
                            }
                            if (temp[k] == 2 && temp[k + 1] >= 2 && temp[k + 2] >= 2) {
                                temp[k] -= 2;
                                temp[k + 1] -= 2;
                                temp[k + 2] -= 2;
                            }
                            if (temp[k] % 3 != 0) {
                                continue next;
                            }
                        }
                        if (temp[7] % 3 == 0 ) {
                            result.add(i + 1);
                            break;
                        }
                    }
                }
            }
            if (result.isEmpty()) {
                System.out.println(0);
            } else {
                for (int i = 0; i < result.size(); i++) {
                    System.out.print(result.get(i) + (i < result.size() - 1 ? " " : "\n"));
                }
            }
        }
    }
}


Measured memory_bytes: 26112
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 **/

int main(){
    int mod=1000000007;
    int a,b;
    while (scanf("%d %d",&a,&b)!=EOF) {
        int tmp=a+b,ans=1;
        while (tmp>=10) {
            tmp/=10;
            ans++;
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 3100
N = int(input())
cur = 0
ok = False
for _ in range(N):
    D1, D2 = input().split()
    if D1 == D2:
        cur += 1
    else:
        cur = 0
    if cur == 3:
        ok = True
if ok:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9164
#奇数だったら左にずらす。
#左にずらせないのであれば、下にずらす
h, w = map(int, input().split())
grid = []
ans = []
for i in range(h):
    grid.append(list(map(int, input().split())))
for i in range(h):
    for j in range(w):
        if grid[i][j] % 2 != 0:
            if j == w - 1:
                if i != h - 1:
                    ans.append([i+1,j+1,i+2,j+1])
                    grid[i+1][j] += 1
            else:
                ans.append([i+1,j+1,i+1,j+2])
                grid[i][j+1] += 1
n = len(ans)
print(n)
for i in ans:
    print("{} {} {} {}".format(i[0], i[1],i[2],i[3]))


Measured memory_bytes: 66652
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 10005;

int n;
LL a[100];

int main()
{
	a[0] = 2; a[1] = 1;
	for(int i = 2; i <= 86; i++)
		a[i] = a[i - 1] + a[i - 2];
	while(scanf("%d", &n) != EOF)
	{
		printf("%lld\n", a[n]);
	}
	return 0;
}

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

int main(){
  int n;
  string s;
  cin>>n>>s;
  if(n%2){
    cout<<"No"<<endl;
    return 0;
  }
  rep(i,n/2){
    if(s.at(i)!=s.at(i+n/2)){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef long long ll;

const int MOD = 1000000007;

void solve() {
  int H, N;
  cin >> H >> N;
  vi A(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(rall(A));
  for (int i = 0; i < N; i++) {
    H -= A[i];
  }
  string ans = "No";
  if (H <= 0) ans = "Yes";
  cout << ans << endl;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define QWQ puts("successfully enter.")
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define FILL(a,val) memset(a,val,sizeof(a))
string a,b; 
void display(initializer_list<int> out)
{
	cout<<"DISPLAY:";
	for(auto x:out) cout<<x<<' ';
	puts("");
}
int main()
{
	cin>>a>>b;
	cout<<b<<a;
	return 0;
}

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

using namespace std;
int h[100009];long long int dp[100009];
int main()
{
int n ; int k ; 
cin>>n>>k ; 
for(int i = 0 ;i<n ; i++)
scanf("%i",&h[i]);

dp[0]= 0 ; 
dp[1]= abs(h[0]-h[1]);

for(int i =2 ; i<n ; i++)
{
	dp[i]= abs(h[i]-h[i-1])+dp[i-1];
	for(int p = 2; p<=(min(i,k)) ; p++)
	{
		dp[i]= min(dp[i-p]+abs(h[i]-h[i-p]),dp[i]);
	}
}
cout<<dp[n-1];

return(0);
}


Measured memory_bytes: 1408
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
string solve(string s,char order){
    if(order=='C'){
        char hoge=s[0];
        s.erase(s.begin());
        s.push_back(hoge); return s;
    }if(order=='J'){
        char hoge=s[s.size()-1];
        s.insert(s.begin(),hoge);
        s.erase(s.end()-1);
        return s;
    }if(order=='E'){
        
        string hoge;
        if(s.size()%2)hoge.push_back(s[(s.size()-1)/2]);
        for(int i=0; i<=(s.size()-1)/2;i++){
            if(i==(s.size()-1)/2&&s.size()%2)continue;
            hoge.push_back(s[i]);
        }
        string gotiusa;
        for(int i=(int)(s.size()-1)/2+1;i<s.size();i++)
            gotiusa.push_back(s[i]);
        return (gotiusa+hoge);
    }if(order=='A'){
        reverse(s.begin(),s.end());
        return s;
    }if(order=='P'){
        rep(i,s.size()){
            if('0'<=s[i]&&s[i]<='9'){
                if(s[i]=='0')s[i]='9';
                else{string hoge=to_string(s[i]-'1'); s[i]=hoge[0];}
            }
        }
        return s;
    }if(order=='M'){
        rep(i,s.size()){
            if('0'<=s[i]&&s[i]<='9'){
                if(s[i]=='9')s[i]='0';
                else{string hoge=to_string(s[i]-'0'+1); s[i]=hoge[0];}
            }
        }
        return s;
    }
    
    return s;
}
int main(){
    int gotiusa; cin>>gotiusa;
    rep(_,gotiusa){
        string key,s;
        cin>>key;
        cin>>s;
        for(int i=(int)key.size()-1; i>=0;i--){
            s=solve(s,key[i]);
        }
        cout<<s<<endl;
    }
}

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

const int INF=1e9;
typedef long long ll;
typedef pair<int,int> P;

ll N,W; 
P wv[105];
vector<int> v[5];
ll cnt[5][105];
  
int main(){
 
cin>>N>>W;

int Min=INF;
for(int i=0; i<N; i++){
    scanf("%d %d",&wv[i].first,&wv[i].second); Min=min(Min,wv[i].first);
}

for(int i=0; i<N; i++){
    for(int j=0; j<4; j++){
        if(wv[i].first==Min+j){
            v[j].push_back(wv[i].second);
        }
    } 
}

for(int i=0; i<4; i++){
    sort(v[i].begin(),v[i].end()); reverse(v[i].begin(), v[i].end());
}

for(int j=0; j<4; j++){
    for(int i=0; i<v[j].size(); i++) cnt[j][i+1]=cnt[j][i]+v[j][i];
}

ll w0=Min,w1=w0+1,w2=w1+1,w3=w2+1; ll Max=0LL;

for(ll l=0; l<=N; l++){
    if(l*w0>W) continue;
    for(ll k=0; k<=N; k++){
        if(l*w0+k*w1>W) continue;
        for(ll i=0; i<=N; i++){
            if(l*w0+k*w1+i*w2>W) continue;
            for(ll j=0; j<=N; j++){
                if(l*w0+k*w1+i*w2+j*w3>W) continue;
                Max=max(Max,cnt[0][l]+cnt[1][k]+cnt[2][i]+cnt[3][j]);
            }
        }
    }
}

cout<<Max<<endl;

}

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

long long M = 1000000007;
long long A[300001];

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

    for (long long i = 1; i <= N; ++i) cin >> A[i];

    long long ans = 0;

    for (long long j = 0; j < 60; ++j) {
        long long mask = 1LL << j;
        long long a0 = 0;
        long long a1 = 0;

        for (long long i = 1; i <= N; ++i) {
            (A[i] & mask) ? ++a1 : ++a0;
        }

        ans = (ans + (a0 * a1 % M) * (mask % M) % M) % M;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
long long p = 998244353;
int n;
long long s, a;
long long dp[6001];
int main() {
	scanf("%d%lld", &n, &s);
	dp[0] = 1;
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a);
		for (int j = 0; j <= s; j++)dp[j] *= 2;
		for (int j = s - 1; j >= 0; j--) {
			dp[j + a] += dp[j] / 2;
		}
		for (int j = 0; j <= s; j++) {
			dp[j] %= p;
		}
	}
	printf("%lld\n", dp[s]);
}

Measured memory_bytes: 1760
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path;
//***********//
int main() {
	cin >> N;
	ans = INF;
	vl X(N);
	ll ave = 0;
	for (i = 0; i < N; i++) {
		cin >> X[i];
		ave += X[i];
	}
	ave /= N;
	for (k = 1; k <= 100; k ++) {
		ll pre = 0;
		for (i = 0; i < N; i++) {
			pre += pow(X[i] - k, 2);
		}
		ans = min(ans, pre);
	}
	
	cout << ans;
}


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

public class Main {
	static FastReader input = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	static int n, m;
	static long[][] memo;
	static char[][] a;
	static boolean[][] visited;

	static long solve(int i, int j) {

		if (i >= n || j >= m || a[i][j] == '#')
			return 0;

		if (i == n - 1 && j == m - 1)
			return 1L;

		if (visited[i][j])
			return memo[i][j];

		visited[i][j] = true;

		long x = solve(i + 1, j);
		long y = solve(i, j + 1);

		return memo[i][j] = ((x + y) % ((long) 1e9 + 7));
	}

	public static void main(String[] args) throws NumberFormatException, IOException {

		n = input.nextInt();
		m = input.nextInt();

		a = new char[n][m];

		memo = new long[n + 10][m + 10];
		visited = new boolean[n + 10][m + 10];

		for (int i = 0; i < n; i++) {
			a[i] = input.nextLine().toCharArray();
		}

		System.out.println(solve(0, 0));

	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		String nextLine() throws IOException {
			String str = "";
			str = br.readLine();
			return str;
		}
	}
}


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

int main(){
	int N,K,P;

	cin>>N;
	for(int i=0;i<N;i++){
		int w;
		cin>>K>>P;
		if(K%P!=0){
			cout<<K%P<<endl;
		}else {
			cout<<P<<endl;
		}
	}

return 0;
}

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

int main(void) {
    int h, w, count = 0;
    cin >> h >> w;
    for (int i = 0; i < h * w; i++) {
        char c;
        cin >> c;
        if (c == '#') {
            count++;
        }
    }
    cout << (count == h + w - 1 ? "Possible" : "Impossible") << endl;
    return 0;
}


Measured memory_bytes: 256
import time

start_time = time.time()

#input
D = int(input())
c_list = list(map(int, input().split()))

s_grid = []
for i in range(D):
    array = list(map(int, input().strip().split(' ')))
    s_grid.append(array)

t_list = [(i % 26) for i in range(D)] #task_list

def calculate_score(t_list,score_list,last_grid,change_query_number):
    score_list = score_list[:change_query_number]
    last_grid = last_grid[:change_query_number]

    if len(score_list) > 1:
        score = score_list[change_query_number-1]
        last_list = last_grid[change_query_number-1]
    else:
        score = 0
        last_list = [0 for i in range(26)]

    for d in range(change_query_number,D):
        score += s_grid[d][t_list[d]]
        last_list = [n+1 for n in last_list]
        last_list[t_list[d]] = 0
        for i in range(26):
            score -= c_list[i]*last_list[i]
        score_list.append(score)
        last_grid.append(last_list)
    return score_list, last_grid

#first cal.
previous_s, previous_l = calculate_score(t_list,[],[[0 for i in range(26)]],0)
score = previous_s[-1]

for k in range(D - 1, 0, -1):
    X = -1  # k-日目に変える番号を探す
    t_list_loop = t_list
    for i in range(26):  # 26通り試す
        t_list_loop[k] = i
        score_list_k, last_grid_k = calculate_score(t_list_loop, previous_s, previous_l, k)
        if score_list_k[-1] > score:
            X = i
            score = score_list_k[-1]
            score_list_t = score_list_k
            last_grid_t = last_grid_k

    if X != -1:
        t_list[k] = X
        previous_s = score_list_t
        previous_l = last_grid_t
        
    # print(k,X,score)

    if time.time() - start_time > 1.9:
        break

#final result
for j in range(len(t_list)):
    print(int(t_list[j]) + 1)

Measured memory_bytes: 9704
from collections import Counter
import math

N = int(input())
A = list(map(int, input().split()))

C = Counter(A)
cnt = 0
for k, v in C.items():
    cnt += v-1

if cnt % 2 == 0:
    ans = N - cnt
else:
    ans = N - cnt - 1
print(ans)


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

#define INF 0x3f3f3f3f
#define int long long
#define pii pair<int, int>

const int N = 100005;



int32_t main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int a, b;
    cin >> a >> b;
    cout << (a*b) << endl;
    return 0;
}

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

#define MAX_LEN (1200)

using namespace std;

int main()
{ 
    char* str = new char[MAX_LEN + 1];
   
    cin.getline(str, MAX_LEN, '\n');

    for (int i = 0; str[i] != '\0'; i++) {
         if (str[i] >= 'A' && str[i] <= 'Z') {
             str[i] = tolower(str[i]);
         } else if (str[i] >= 'a' && str[i] <= 'z') {
             str[i] = toupper(str[i]);
         }  
    }                               
     
    cout << str << endl;

    delete[] str;     
	   
    return (0);
}

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

namespace ABC114A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());
            if (x==3||x==5||x==7)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 04/08/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  char c; cin>>c;
  cout << char(c+1) << endl;

  return 0;
}


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

int main() {
	int m, d, cont = 0;
	cin >> m >> d;
	for(int i = 1; i <= m; i++) {
		for(int j = 10; j <= d; j++) {
			int dec = j/10, un = j%10;
			if(dec >= 2 and un >= 2) {
				if(dec * un == i) cont++;
			}			
		}
	}
	cout << cont;
	return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
ll solve(ll x, ll y) {
    ll best = 1e18;
    if (x <= y) {
        best = min(best, y - x);
    }
    if (-x <= y) {
        best = min(best, 1 + y + x);
    }
    return best;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    ll x, y;
    cin >> x >> y;
    cout << min(solve(x, y), solve(x, -y) + 1);
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    ll n,k;
    while(cin>>n>>k,n+k){
    vl dp;
    vl sum(n,0);
    rep(i,n){
        ll ujimatu; cin>>ujimatu;
        dp.push_back(ujimatu);
        if(!i)sum[i]=ujimatu;
        else if(i<k)sum[i]=sum[i-1]+ujimatu;
        else sum[i]=ujimatu+sum[i-1]-dp[i-k];
        
    }
    ll ans=-INF*INF;
    rep(i,n)if(i>=k-1)cmax(ans,sum[i]);
    ///ep(i,n)if(i>=k-1)cout<<sum[i]<<endl;
    cout<<ans<<endl;
    }
}

Measured memory_bytes: 4676
list = input().split(" ")
x = [int(y) for y in list]
if x[0] == 1 and x[1] == 1:
    count =1
elif x[0] == 1 or x[1] == 1:
    count = max(x[0], x[1])-2
else:
    count = (x[0]-2)*(x[1]-2)
print(count)

Measured memory_bytes: 3064
import java.util.*;
public class Main {
    public static void main(String[] ano) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
        int sum1 =scan.nextInt() + scan.nextInt() + scan.nextInt() + scan.nextInt();
        int sum2 =scan.nextInt() + scan.nextInt() +scan.nextInt() +scan.nextInt();
      System.out.println(Math.max(sum1, sum2));
}
}

Measured memory_bytes: 12000