akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main()
{
	int a,b,c,x;
	scanf("%d %d %d",&a,&b,&c);
	if(a<b&&a<c){
		if(b<c){
			x=a+b;
		}
		else{
			x=a+c;
		}
	}
	if(b<=a&&b<=c){
		if(a<=c){
			x=b+a;
		}
		else{
			x=b+c;
		}
	}
	if(c<=a&&c<=b){
		if(a<b){
			x=c+a;
		}
		else{
			x=c+b;
		}
	}
	printf("%d\n",x);
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int a, b, c, N, i;

    scanf("%d", &N);

    for(i=1; i<=N; i++)
    {
        scanf("%d %d %d", &a, &b, &c);
        if(a*a == b*b+c*c)
            printf("YES\n");
        else if(b*b == a*a+c*c)
            printf("YES\n");
        else if(c*c == a*a+b*b)
            printf("YES\n");

        else
            printf("NO\n");
    }
    return 0;
}

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

#define REP(i, s, n) for(int i = s; i < n; ++i)
#define rep(i, n)		 REP(i, 0, n)
#define SORT(c)			 sort((c).begin(), (c).end())
#define IINF	INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

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

/*
struct point{
	ll x;
	ll y;
	point(){x = 0;y = 0;}
	point(ll x, ll y):x(x), y(y){}
};
*/


int main() {

	string s;
	cin >> s;
	cout << s.substr(0, 5) <<" " << s.substr(6, 7) << " " << s.substr(14) << endl;

	
	return 0;
}


Measured memory_bytes: 256
a,b=map(int, input().split())
if (a-4)*(a-6)*(a-9)*(a-11)==0 and (b-4)*(b-6)*(b-9)*(b-11)==0:
  print('Yes')
elif (a-1)*(a-3)*(a-5)*(a-7)*(a-8)*(a-10)*(a-12)==0 and (b-1)*(b-3)*(b-5)*(b-7)*(b-8)*(b-10)*(b-12)==0:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
    int x, n;
    cin >> x >> n;
    set<int> p;
    for(int i = 0; i < n; i++){
        int temp;
        cin >> temp;
        p.insert(temp-x);
    }
    int i = 0;
    while(1){
        if(!p.count(-i)){
            cout << x-i << endl;
            break;
        } else if (!p.count(i)){
            cout << x+i << endl;
            break;
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>
int main(void){
	int x,y;
	do{
		scanf("%d %d",&x,&y);
		if(x!=0 || y!=0){
			if(x>y){
				printf("%d %d\n",y,x);
			}
			else{
				printf("%d %d\n",x,y);
			}
		}
	}while(x+y!=0);
		
	return 0;
}

Measured memory_bytes: 600
#include <stdio.h>

int main(int argc, char *argv[])
{
    char S[(int)(2e5 + 1)];
    long long wnum = 0, i, ans = 0;

    gets(S);

    for (i = 0; S[i]; i++) {
        if (S[i] == 'W') {
            ans += i - wnum;
            wnum++;
        }
    }

    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 384
#!/usr/bin/env pypy
from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__


def main():
    n = int(input())
    a = [int(ai) for ai in input().split()]
    b = [int(bi) for bi in input().split()]

    cnt = 0
    while True:
        prev_cnt = cnt
        for i in range(n):
            adj_sum = b[i - 1] + b[(i + 1) % n]
            k = (b[i] - a[i]) // adj_sum
            if k > 0:
                b[i] -= k * adj_sum
                cnt += k
        if cnt == prev_cnt:
            break

    if all(a[i] == b[i] for i in range(n)):
        print(cnt)
    else:
        print(-1)


# region fastio

BUFSIZE = 8192


class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0,
                              2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


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

map<pair<int, int>, int> cnt;

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

    int n;
    cin >> n;

    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        cnt[{s.front() - '0', s.back() - '0'}]++;
    }

    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        ans += cnt[{s.back() - '0', s.front() - '0'}];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{

	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static int nextInt() throws IOException {
		return Integer.parseInt(br.readLine());
	}

	public static int[] nextArr() throws IOException {
		String elements[] = br.readLine().split(" ");
		int arr[] = new int[elements.length];
		for (int j = 0; j < elements.length; j++)
			arr[j] = Integer.parseInt(elements[j]);
		return arr;
	}

	public static void printArr(int arr[]) {
		for (int i = 0; i < arr.length; i++)
			System.out.print(arr);
	}

	public static String next() throws IOException {
		return br.readLine();
	}

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

		Scanner s = new Scanner(System.in);
		Double r = s.nextDouble();
		System.out.println(2 * 3.14 * r);
	}

}


Measured memory_bytes: 37452
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
//

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

  int n, m;
  cin >> n >> m;
  vector<int> x(m), y(m);
  rep(i, m) cin >> x[i] >> y[i];

  vector<bool> visited(n + 1, false);
  vector<int> ball(n + 1, 1);
  visited[1] = true;

  rep(i, m) {
    ball[x[i]]--;
    ball[y[i]]++;
    if (visited[x[i]]) {
      if (ball[x[i]] == 0) visited[x[i]] = false;
      visited[y[i]] = true;
    }
  }

  int res = 0;
  rep(i, n + 1) {
    if (visited[i]) res++;
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 1408
import sys
from collections import deque
def solve():
    readline = sys.stdin.readline
    N = int(readline())
    G = [[] for i in range(N*N)]
    deg = [0]*(N*N)
    day = [0]*(N*N)
    F = set()
    for p in range(N):
        *A, = map(int, readline().split())
        for k in range(N-1):
            A[k] -= 1
        prv = A[0]+p*N if A[0] < p else p+A[0]*N
        F.add(prv)
        for a in A[1:]:
            i = a+p*N if a < p else p+a*N
            G[prv].append(i)
            deg[i] += 1
            prv = i
    que = deque()
    for i in F:
        if deg[i] == 0:
            que.append(i)
            day[i] = 1
    rest = N*(N-1)//2
    pop = que.popleft
    push = que.append
    while que:
        v = pop()
        rest -= 1
        d = day[v]+1
        for w in G[v]:
            deg[w] -= 1
            if deg[w] == 0:
                day[w] = d
                push(w)
    if rest > 0:
        print(-1)
    else:
        print(d-1)
solve()

Measured memory_bytes: 161300
n = int(input())

rains = list(map(int, input().split()))

start = 0

for i in range(n):
    if i%2:
        start -= rains[i]

    else:
        start += rains[i]

ans = start
print(start, end=' ')
for i in range(n-1):
    ans = 2 * rains[i] - ans
    print(ans, end=' ')

Measured memory_bytes: 14032
#import numpy as np
 
H, N = map(int, input().split())
A, B = [], []
for i in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
  
dp_max = 10000000000
dp = [dp_max for i in range(H+1)]
#dp = np.full(H+1, dp_max, dtype=int)
dp[0] = 0
 
for i in range(H+1):
  if dp[i] == dp_max:
    continue
 
  for j in range(N):
    ni = min(H, i + A[j])
 
    dp[ni] = min(dp[ni], dp[i] + B[j])
print(dp[H])

Measured memory_bytes: 41884
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define fi first
#define sc second
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << endl
#define RETURN(x)    \
  cout << x << endl; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << endl
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll N, A, B;
  cin >> N >> A >> B;
  ll ans = 0;
  rep(i, N + 1) {
    if (i == 0) continue;
    ll sum = 0;
    ll num = i;
    while (num) {
      sum += num % 10;
      num /= 10;
    }
    if (A <= sum && sum <= B) ans += i;
  }
  ANS;

  return 0;
}

Measured memory_bytes: 3668
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        String a = sc.next();
        String b = sc.next();
        
        if(a.equals("H") && b.equals("H")){
            System.out.println("H");
        }else if(a.equals("H") && b.equals("D")){
            System.out.println("D");
        }else if(a.equals("D") && b.equals("H")){
            System.out.println("D");
        }else if(a.equals("D") && b.equals("D")){
            System.out.println("H");
        }
    }           
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int x = in.nextInt();
		int y = in.nextInt();
		in.close();
		int ans = (0 <= x && x < y) || (x < y && y <= 0) ? y - x
				: (0 < y && y < x) || (y < x && x < 0) ? x - y + 2
				: Math.abs(Math.abs(x) - Math.abs(y)) + 1;
		System.out.println(ans);
	}
}


Measured memory_bytes: 23764
# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
# define mp make_pair
# define x first
# define y second
using namespace std;
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; }

int main() {
  int a, b, c, x, y; cin >> a >> b >> c >> x >> y;

  int ans;

  if(a + b <= 2 * c) ans = a * x + b * y;
  else{
    ans = 2 * c * min(x, y);
    int rest = max(x, y) - min(x, y);
    if(x > y){
      if(a <= 2 * c) ans+= rest*a;
      else ans += rest * 2 * c;
    } else {
      if(b <= 2 * c) ans+= rest*b;
      else ans += rest * 2 * c;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    //  cout << x << " ";
    while (y > 0)
    {

        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int lcm(int a, int b)
{
    return (a * b) / __gcd(a, b);
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc;
    tc = 1;
    while (tc--)
    {
        int n;
        int a, b ;
        cin >> a >> b;
        cout << lcm(a, b);
    }

    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;
bool chmx(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

bool chmn(int &a, int b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

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



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1010;

int n,odd,wd,bin[50];
char s[50];

struct P{ll x,y;}p[N];

int dx[6]={-1,1,0,0};
int dy[6]={0,0,-1,1};
char dr[6]={'R','L','U','D'};

inline ll as(ll x){return x<0?-x:x;}

inline void solve(P nw)
{
	int i,j,k;ll mn,res;
	for(i=wd;i;--i){
		mn=1e18;k=0;
		for(j=0;j<4;++j){
			res=max(as(nw.x+bin[i]*dx[j]),as(nw.y+bin[i]*dy[j]));
			if(res<mn) {mn=res;k=j;}
		}
		s[i]=dr[k];nw.x+=bin[i]*dx[k];nw.y+=bin[i]*dy[k];
	}
	for(i=1;i<=wd;++i) putchar(s[i]);
	puts("");
	//printf("%lld %lld\n",nw.x,nw.y);
}

int main(){
	int i,j;
	scanf("%d%lld%lld",&n,&p[1].x,&p[1].y);
	odd= ((p[1].x+p[1].y)%2+2)%2;
	for(i=2;i<=n;++i){
		scanf("%lld%lld",&p[i].x,&p[i].y);
		if(odd != ((p[i].x+p[i].y)%2+2)%2) break;
	}
	if(i<=n) {puts("-1");return 0;}
	bin[1]=1;
	for(i=2;i<=31;++i) bin[i]=bin[i-1]<<1;
	wd=31;if(!odd) bin[++wd]=1;
	printf("%d\n",wd);
	for(i=1;i<wd;++i) printf("%d ",bin[i]);
	printf("%d\n",bin[wd]);
	for(i=1;i<=n;++i) solve(p[i]);
	return 0;
}

Measured memory_bytes: 256
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
	int money=700;
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='o')
			money=money+100;
	}
	cout<<money;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

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

    int n; std::cin >> n;
    int fours = 0;
    int twos = 0;
    int a;
    for (int i = 0; i < n; i++) {
        std::cin >> a;
        if (a % 4 == 0) {
            fours++;
        } else if (a % 2 == 0) {
            twos++;
        }
    }
    int covered = fours * 2;
    covered += (twos > 1) ? twos : 1;
    bool r = covered >= n;
    std::cout << (r ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 256
// Koch Curve
#include <stdio.h>
#include <math.h>

typedef struct Point{
  double x;
  double y;
}point;

void koch(int n, point p1, point p2){
  point s, t, u;
  double sin, cos;
  if(n == 0)return;

  sin = sqrt(3) / (double)2; // 60度のときのsinを計算
  cos = 1 / (double)2;       // 60度のときのcosを計算
  
  s.x = (2*(double)p1.x + 1*(double)p2.x) / (double)3;
  s.y = (2*(double)p1.y + 1*(double)p2.y) / (double)3;
  t.x = (1*(double)p1.x + 2*(double)p2.x) / (double)3;
  t.y = (1*(double)p1.y + 2*(double)p2.y) / (double)3;
  
  u.x = (t.x - s.x) * cos - (t.y - s.y) * sin + s.x;
  u.y = (t.x - s.x) * sin + (t.y - s.y) * cos + s.y;
  
  // p1, p2 から s, t, u を計算
  koch(n-1, p1, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(n-1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(n-1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(n-1, t, p2);
}

int main(){
  int n;
  point p1, p2;
  scanf("%d", &n);
  p1.x = 0.0;
  p1.y = 0.0;
  p2.x = 100.0;
  p2.y = 0.0;
  
  printf("%.8f %.8f\n", p1.x, p1.y);
  koch(n, p1, p2);
  printf("%.8f %.8f\n", p2.x, p2.y);
  
  return 0;
}



Measured memory_bytes: 2092
def main():
    H, W = (int(i) for i in input().split())
    A = [input() for i in range(H)]
    ban_h = set()
    for h in range(H):
        if all(s == "." for s in A[h]):
            ban_h.add(h)
    ban_w = set()
    for w in range(W):
        if all("." == A[i][w] for i in range(H)):
            ban_w.add(w)

    for h in range(H):
        if h in ban_h:
            continue
        for w in range(W):
            if w in ban_w:
                continue
            print(A[h][w], end="")
        print()


if __name__ == '__main__':
    main()


Measured memory_bytes: 43096
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N, K; cin >> N >> K;
	vi P(N);
	REP(i,N) cin >> P[i];
	sort(ALL(P));
	int res = 0;
	REP(i,K) {
		res += P[i];
	}
	cout << res << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 3656
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
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; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll n,m;
  cin >> n >> m;
  ll a[m],b[m],c[m];
  ll disp[n][n];
  
  rep(i,n)rep(j,n)
  if(i==j) disp[i][j]=0;
  else disp[i][j]=INF;

  rep(i,m){
    cin >> a[i] >> b[i] >> c[i];
    disp[a[i]-1][b[i]-1]=c[i];
    disp[b[i]-1][a[i]-1]=c[i];
  }
  
  rep(k,n)rep(i,n)rep(j,n)
  disp[i][j]=min(disp[i][j],disp[i][k]+disp[k][j]);
  
  ll ans = m;
  rep(i,m){
    if(disp[a[i]-1][b[i]-1]==c[i])ans--;
  }
  pri(ans);
  
  return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++ i)
#define rrp(i,a,b) for (int i = (a); i >= (b); -- i)
#define gc() getchar()
#define fir first
#define sec second
typedef pair<int,int> pii;
typedef long double db;
typedef long long ll;
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc(); !isdigit(tmp); tmp = gc())
    key = (tmp == '-');
  for (; isdigit(tmp); tmp = gc())
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}

const int N = 510, MAX = 10000;
int isp[MAX + 10], pri[MAX], pcnt;
void prework() {
  rep (i, 2, MAX) {
    if (!isp[i]) pri[++pcnt] = i;
    for (int j = 1; pri[j] * i <= MAX; ++ j) {
      isp[pri[j] * i] = 1;
      if (i % pri[j] == 0) break;
    }
  }
}
ll mat[N][N];
int n, arr[2][N];
set<ll> st;
ll lcm(ll x,ll y) {
  return x / __gcd(x, y) * y;
}
int main() {
  prework();
  read(n);
  if (n == 2) {
    puts("4 7");
    puts("23 10");
    return 0;
  }
  int p = 0;
  rep (i, 1, n) arr[0][i] = pri[++ p];
  rrp (i, n, 1) arr[1][i] = pri[++ p];
  int tmp = (n+1) / 2;
  rep (i, 1, n) rep (j, 1, n) if ((i+j) % 2 == 0) {
    int vx = i + j, vy = i - j;
    vx /= 2;
    vy /= 2;
    vy += tmp;
    mat[i][j] = 1ll * arr[0][vx] * arr[1][vy];
  }
  rep (i, 1, n) rep (j, 1, n) if ((i+j)&1) {
    mat[i][j] = 1;
    if (i > 1) mat[i][j] = lcm(mat[i][j], mat[i-1][j]);
    if (i < n) mat[i][j] = lcm(mat[i][j], mat[i+1][j]);
    if (j > 1) mat[i][j] = lcm(mat[i][j], mat[i][j-1]);
    if (j < n) mat[i][j] = lcm(mat[i][j], mat[i][j+1]);
    mat[i][j] ++;
  }
  // (i-j, i+j)
  // rep (i, 1, n) rep (j, 1, n) {
  //   assert(!st.count(mat[i][j]));
  //   assert(mat[i][j] <= (ll)1e15);
  //   st.insert(mat[i][j]);
  // }
  rep (i, 1, n) {
    rep (j, 1, n) printf("%lld ", mat[i][j]);
    puts("");
  }
  return 0;
}


Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    int l=1;
    int r= *max_element(a,a+n);
    int ans;
    while(l<=r)
    {
        int mid = (l+r)/2;
        int  cnt=0;
        for(int i=0;i<n;i++)
            cnt+=(a[i]-1)/mid;
        if(cnt<=k)
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4396
/*    特徴    */

/*    教訓    */

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld  = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

#define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; i++ )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define p_b push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

// -------- template end - //




// - library ------------- //




// --------- library end - //



// - main() -------------- //

int main(){

  ll h1, m1, h2, m2, K;
  cin >> h1 >> m1 >> h2 >> m2 >> K;

  ll time1 = h1 * 60 + m1;
  ll time2 = h2 * 60 + m2;

  ll sumtime = time2 - time1;

  ll ans = max(0LL, sumtime - K);

  cout << ans << endl;



// ---------- main() end - //
}

Measured memory_bytes: 3632
#include <cstdio>

int main(){
	int n;
	int num;
	
	while(scanf("%d", &n) != EOF){
		num = n % 39;
		printf("3C");
		if(num < 10 && num != 0) putchar('0');
		if(num == 0) num = 39;
		printf("%d\n", num);
	}
	return 0;
}

Measured memory_bytes: 1028
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut a: Vec<i64> = vec![0; 100_005];
    for _ in 0..n {
        let ai: usize = read();
        a[ai + 1] += 1;
        a[ai] += 1;
        if ai != 0 {
            a[ai - 1] += 1;
        }
    }

    let mut maxv = 0;

    for i in 0..a.len() {
        let ai = a[i];
        if maxv < ai {
            maxv = ai;
        }
    }
    println!("{}", maxv);
}


Measured memory_bytes: 4352
import sys
# readline = sys.stdin.readline
read = sys.stdin.read
def main():
    n, k, *p = map(int, read().split())  # 1行目にnとk,2行目にh0,h1,,,hn
    p.sort()
    r = sum(p[:k])
    print(r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9236
#include <iostream>

using namespace std;
long long a,b,ans;
int main()
{
    cin>>a>>b;
    if(a<4)
    {
        ans+=(4-a)*1e5 ;
    }
    if(b<4)
    {
        ans+=(4-b)*1e5;
    }
    if(a+b==2)
        ans+=4*1e5;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl;
using namespace std;
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,k;
  cin >> n >> k;
  vector<int> x(n);
  rep(i,n) cin >> x[i];
  if(n == 1){
  	dunk(x[0]);
  	return 0;
  }
  
  int ans = 1e12 + 1;
  int l = k - 1;
  for(int i = l; i < n; i++){
  	int k = min(abs(x[i]) + abs(x[i] - x[i - l]), abs(x[i - l]) + abs(x[i] - x[i - l]));
  	
  	ans = min(ans, k);
  }
  
  
  dunk(ans);
  return 0;
}

Measured memory_bytes: 640
s=int(input())
a=s%100
b=s//100
if 1<=a<=12 and 1<=b<=12:
    print("AMBIGUOUS")
elif 1<=a<=12 and (b>12 or b==0):
    print("YYMM")
elif (a>12 or a==0) and 1<=b<=12:
    print("MMYY")
else:
    print("NA")


Measured memory_bytes: 2940
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;

int ab(int n) {
	if (n > 0) { return n; }
	else { return -n; }
}


int main() {
	int N, X, Y;
	int ans[2000];

	cin >> N >> X >> Y;
	for (int i = 0; i < N - 1; i++) {
		ans[i] = 0;
	}

	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			int dist = ab(i - j);
			int dist_ = ab(i + 1 - X) + ab(j + 1 - Y) + 1;
			if (dist > dist_) { dist = dist_; }
			ans[dist-1]++;
		}
	}

	for (int i = 0; i < N - 1; i++) {
		cout << ans[i] << "\n";
	}
}

Measured memory_bytes: 256
package main
 
import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)
  
var sc = bufio.NewScanner(os.Stdin)

func ReadStr() string {
	sc.Scan()
	return sc.Text()
}

func ReadInt() int {
	i, e := strconv.Atoi(ReadStr())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	N := ReadInt()
    mp := map[int]bool{}
  	for i := 0; i < N; i++{
      A := ReadInt()
        if _, ok := mp[A]; ok {
          			delete(mp, A)
        } else {
          	mp[A] = true
        }
    }
  	fmt.Println(len(mp))
}

 

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const int M = 110;
const int INF = 1e9 + 7;
int dp[N][M],v[N];

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	for(int i=0;i<N;++i)
		for(int j=0;j<M;++j)
			dp[i][j] = INF;

	int n,k;
	cin>>n;
	k = 2;
	
	for(int i=1;i<=n;++i) cin>>v[i];

	dp[1][0] = 0;

	for(int i=1;i<=n;++i)
		for(int j=1;j<=k;++j)
		{
			dp[i][j] = min(dp[i][j],dp[i][j-1]);
			int id = i - j;
			if(id < 0) continue;

			int x = abs(v[id] - v[i]);
			dp[i][j] = min(dp[i][j],dp[id][k] + x);
		}

	cout<<dp[n][k]<<"\n";
}

Measured memory_bytes: 43648
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int n;
int m;
int D[10001];
int P[10001];
priority_queue<pii> que;
int ans;//襲われる期待値
int main(){
	while(cin>>n>>m,n||m){
		ans = 0;
		for(int i =0;i< n;i++){
			cin>>D[i];
			cin>>P[i];
			que.push(pii(P[i],D[i]));
		}
		int d;//移動距離
		int p;//期待値
		while(!que.empty()){
			d = que.top().second;
			p = que.top().first;
			que.pop();
			if(m-d>=0){
				m -=d;
				continue;
			}else if(m -d<0){
				d -=m;
				ans +=d*p;
				m = 0;
			}
		}
		cout <<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int n;
    cin >> n;
    map <int,set<int>> mp;
    int a,b;
    long c[n];
    rep(i,n-1){
        cin >> a >> b;
        mp[a].insert(b);
        mp[b].insert(a);
    }
    rep(i,n){
        cin >> c[i];
    }
    sort(c,c+n,greater<long>());
    map<int,long> ans;
    queue<int> que;
    que.push(1);
    ans[1] = c[0];
    int i = 1;
    int tem,tem2;
    bool judge[n];
    rep(i,n+1){
        judge[i] = false;
    }
    judge[1] = true;
    while(!que.empty()){
        tem = que.front();
        if(mp[tem].size()==0){
            que.pop();
        }
        else{
            auto itr = mp[tem].begin();
            tem2 = *itr;
            if(judge[tem2]){
                mp[tem].erase(tem2);
                mp[tem2].erase(tem); 
            }
            else{
                judge[tem2]=true;
                ans[tem2]=c[i];
                i++;
                que.push(tem2);
            }
        }
    }
    long anss = 0;
    rep(i,n-1){
        anss+=c[i+1];
    }
    cout << anss << endl;
    rep(i,n){
        cout << ans[i+1] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 2560
import java.util.LinkedList;
import java.util.Scanner;

//Riffle Shuffle
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			int r = sc.nextInt();
			LinkedList<Integer> l = new LinkedList<Integer>();
			for(int i=0;i<n;i++)l.add(i);
			while(r--!=0){
				int k = sc.nextInt();
				LinkedList<Integer> b = new LinkedList<Integer>();
				LinkedList<Integer> c = new LinkedList<Integer>();
				for(int i=0;i<n/2;i++)b.add(l.removeFirst());
				while(!l.isEmpty()||!b.isEmpty()){
					for(int j=0;j<k;j++){
						if(l.isEmpty())break;
						c.add(l.removeFirst());
					}
					for(int j=0;j<k;j++){
						if(b.isEmpty())break;
						c.add(b.removeFirst());
					}
				}
				l = c;
			}
			System.out.println(l.getLast());
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

typedef long long ll;
typedef long double ld;

const int M = 200200;

int n, a[M];
ll sum = 0;
ll q[M], qs = 0, qf = 0;
ll l[M];

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

void add(int x) {
  ll len = 1;
  while (qs < qf && q[qf - 1] > x) {
    --qf;
    sum -= q[qf] * l[qf];
    len += l[qf];
  }

  sum += len * x;
  q[qf] = x;
  l[qf] = len;
  ++qf;
}

void kill() {
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    add(a[i]);
    ans += sum;
  }
  cout << ans << endl;
}

int main() {
  cout.precision(20);
  cout << fixed;
  ios_base::sync_with_stdio(false);
  
  read();
  kill();
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,a) rng(i,0,a)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,a) gnr(i,0,a)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define print(x) cout<<(x)<<'\n'
using ll=long long;
using pl=pair<ll,ll>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vs=vector<string>;

void solve() {
    ll N,Q;
    cin >> N >> Q;
    fenwick_tree<ll> fw(N);
    ll a;
    rep(i,N){
        cin >> a;
        fw.add(i,a);
    }
    ll t,x,y;
    rep(i,Q){
        cin >> t >> x >> y;
        if(t){
            print(fw.sum(x,y));
        }else{
            fw.add(x,y);
        }
    }
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}


Measured memory_bytes: 8248
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
int main(){
  int A, B, C, D ,E ,F;
  string S,Sa,Sb,Sc;
  cin >> A;
  int ans = 0;
  for(int i = 1;i < A;i += 2){
  for(int j = 0;j < A;j += 2){
  ans++;
  }
  }
cout << ans << endl;
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<stack>
#include<iostream>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define MOD 1000000007
#define vec(a) vector<int>a
using namespace std;


int main()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
	fastio
	ll n,r,i,j;
	cin>>n>>r;
	if(n<10)
		r=r+100*(10-n);
	cout<<r<<"\n";

	return 0;
}

Measured memory_bytes: 3648
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define LL long long
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(LL& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;	
}
using namespace std;
LL ans=-1ll<<60,n,same[101],f[101][11],p[101][11];
main()
{
	re(n);
	for(LL i=1;i<=n;++i)
		for(LL j=1;j<=10;++j)
			re(f[i][j]);
	for(LL i=1;i<=n;++i)
		for(LL j=0;j<=10;++j)
			re(p[i][j]);
	for(LL i=1;i<(1<<10);++i)
	{
		memset(same,0,sizeof same);
		for(LL c=i,j=1;j<=10;++j,c>>=1)
			if(c&1)
				for(LL k=1;k<=n;++k)
					if(f[k][j])
						++same[k];
		LL now=0;
		for(LL j=1;j<=n;++j)
			now+=p[j][same[j]];
		ans=max(ans,now);
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

#define INF 1000000000

using namespace std;

int main() {
    int M;
    cin >> M;

    cout << 24 + (24 - M) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int[] x = new int[10001];
		
		for(int i = 1; i < x.length ; i++) {
			x[i] = sc.nextInt();
		    if(x[i] == 0) break;
		}
		
		for(int i = 1 ; i < x.length ; i++) {
			
		    if (x[i] != 0) {
		    	System.out.println("Case " + i +": " + x[i]);
		    }
		}
		sc.close();
		
	  }
	}

Measured memory_bytes: 42940
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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; }

int R,G,B,N,ans;

int main(){
    cin>>R>>G>>B>>N;
    rep(i,N/R+1){
        rep(j,(N-i*R)/G+1){
            if((N-i*R-j*G)%B==0)ans++;
        }
    }
    out(ans);
}


Measured memory_bytes: 256
x,k,d= map(int, input().split())

if x-k*d>=0 :
  print(str(x-k*d))
elif x+k*d<=0 :
  print(abs(x+k*d))
else :
  a=x//d
  b=x%d
  if (k-a)%2==0 :
    print(str(b))
  else :
    print(str(d-b))

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

int main() {

	ll n; cin >> n;
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		ll a; cin >> a;
		ans += a;
		ans--;
	}

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

Measured memory_bytes: 256
/*
 * written by Yaqi Zhang (zhang623@wisc.edu)
 * University of Wisconsin-Madison
 * 2019
 */
#include <bits/stdc++.h>

#define INF 0x3f3f3f3f

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S, T;
    cin >> S >> T;
    int ns = S.length(), nt = T.length();
    if(ns + 1 == nt && T.substr(0, ns) == S) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 3648
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math

def calc(A, B, C, now_t):
    ans = A * now_t + B * math.sin(C * now_t * math.pi)
    return ans


def main():
    num, hint_num = map(int, input().split())
    data = [list(map(int, input().split())) for i in range(hint_num)]

    graph_data = defaultdict(set)
    dist_data = defaultdict(int)

    for i in range(hint_num):
        l, r , d = data[i]
        graph_data[l].add(r)
        graph_data[r].add(l)
        dist_data[(l, r)] = d
        dist_data[(r, l)] = -1 * d


    position = ['x' for i in range(num + 1)]
    flg = 1
    for i in range(1, num + 1):
        if position[i] != 'x':
            continue
        position[i] = 0
        now_set = set()
        next_set = set()
        now_set.add(i)

        while len(now_set) > 0:
            for now_ele in now_set:
                for next_ele in graph_data[now_ele]:
                    length = dist_data[(now_ele, next_ele)]
                    if position[next_ele] == 'x':
                        position[next_ele] = position[now_ele] + length
                        next_set.add(next_ele)
                    else:
                        if position[next_ele] != position[now_ele] + length:
                            flg = 0
                            break
            now_set = next_set
            next_set = set()

    # print(position)

    if flg:
        print('Yes')
    else:
        print('No')





if __name__ == '__main__':
    main()


Measured memory_bytes: 158796
#include <iostream>
using namespace std;
int main(){
	int h, m, s,hh,mm,ss,sum;
	for (int i = 0; i < 3; i++){
		cin >> h >> m >> s >> hh >> mm >> ss;
		sum = hh * 3600 + mm * 60 + ss;
		sum -= h * 3600 + m * 60 + s;
		cout << sum / 3600 << " " << sum % 3600 / 60  << " "<< sum % 3600 % 60 << endl;
	}
}

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

using namespace std;

#define fRead(x)  freopen(x,"r",stdin)
#define fWrite(x) freopen (x,"w",stdout)

#define LL long long
#define ULL unsigned long long
#define ff first
#define ss second
#define pb push_back
#define INF 2e16
#define PI acos(-1.0)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>


#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c,d)))
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
#define SQR(a) ((a)*(a))
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,b) for(int i=0;i<b;i++)
#define MEM(a,x) memset(a,x,sizeof(a))
#define ABS(x) ((x)<0?-(x):(x))

#define scanI(a) scanf("%d",&a)
#define scanI2(a,b) scanI(a) , scanI(b)
#define scanI3(a,b,c) scanI(a), scanI(b), scanI(c)
#define scanI4(a,b,c,d) scanI(a), scanI(b), scanI(c), scanI(d)

#define scanL(a) scanf("%I64d",&a)
#define scanL2(a,b) scanL(a) , scanL(b)
#define scanL3(a,b,c) scanL(a), scanL(b), scanL(c)
#define scanL4(a,b,c,d) scanL(a), scanL(b), scanL(c), scanL(d)

#define SORT(v) sort(v.begin(),v.end())
#define REV(v) reverse(v.begin(),v.end())


#define FastRead ios_base::sync_with_stdio(0);cin.tie(nullptr);
const int N = 100000;
int cnt ,ans,n;
int ara[N + 56];
int main()
{
    cin >> n;
    FOR(i,1,n)cin >> ara[i];
    FOR(i,1,n)
    {
        if(ara[i] == i)cnt++;
        else{
            ans += (cnt + 1)/2;
            cnt = 0;
        }
    }
    ans += (cnt + 1)/2;
    cout << ans << "\n";

}


Measured memory_bytes: 640
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
const ll INF = (1ll << 60);

int main() {
  ll H, W, K;
  cin >> H >> W >> K;

  vector<string> s(H);
  for (ll i = 0; i < H; i++) {
    cin >> s[i];
  }

  vvi ans(H, vi(W));
  ll next_id = 1;

  for (ll i = 0; i < H; i++) {
    ll cnt = 0;
    for (ll j = 0; j < W; j++)
      if (s[i][j] == '#') cnt++;

    if (cnt) {
      ll id = -1;
      for (ll j = 0; j < W; j++) {
        if (s[i][j] == '#') {
          id = next_id;
          next_id++;
        }
        ans[i][j] = id;
      }
      for (ll j = W - 2; j >= 0; j--) {
        if (ans[i][j] == -1) ans[i][j] = ans[i][j + 1];
      }
    } else {
      for (ll j = 0; j < W; j++) ans[i][j] = -1;
    }
  }

  for (ll i = 1; i < H; i++) {
    for (ll j = 0; j < W; j++) {
      if (ans[i][j] == -1 && ans[i - 1][j] != -1) {
        ans[i][j] = ans[i - 1][j];
      }
    }
  }
  for (ll i = H - 2; i >= 0; i--) {
    for (ll j = 0; j < W; j++) {
      if (ans[i][j] == -1 && ans[i + 1][j] != -1) {
        ans[i][j] = ans[i + 1][j];
      }
    }
  }

  for (ll i = 0; i < H; i++) {
    for (ll j = 0; j < W; j++) {
      cout << ans[i][j];
      if (j == W - 1)
        cout << endl;
      else
        cout << ' ';
    }
  }
}


Measured memory_bytes: 1664