akhauriyash/Code-Regression huggingface dataset:
/*	MASTER HAS FAILED MORE TIMES
	THAN BEGINNER HAS EVER TRIED
*/

#include <bits/stdc++.h>

using namespace std;

#define endl             '\n'
#define all(a)           a.begin(), a.end()
#define mem(a, n)        memset(a, n, sizeof(a))
#define Unique(n)        (n).erase(unique(all(n)), (n).end())
#define NumofDigits(n)   ((long long)log10(n)+1)
#define repeat(i, a, n)  for(int i=a; i<n; i++)
#define isPowerOfTwo(n)  (n && !(n & (n - 1)))

typedef long long ll;
typedef long double ld;

int sieve(int n);
unsigned long long pow(long long base, long long power);
long long gcd(long long a, long long b){ return a%b ? gcd(b, a%b) : b; }
long long lcm(long long a, long long b){ return a*b/gcd(a, b); }

void quicken(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
void file(){
    #ifdef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif /*ONLINE_JUDGE*/
}

int main(){
    quicken();

    int n, c=0; cin >> n;
    repeat(i, 1, n+1)
        if(NumofDigits(i)&1) c++;
    cout << c;

    return 0;
}

unsigned long long pow(long long base, long long power){ /// mod?
    if(power==0) return 1;
    if(power==1) return base;

    unsigned long long ans = pow(base, power/2); /// mod?
    ans *= ans; /// ((ans%mod)*(ans%mod))%mod;

    if(power&1) return ans*base; /// ((ans%mod)*(base%mod))%mod;
    return ans;
}

int sieve(int n){
    int c = 0;
    vector<bool> isPrime(n+1, true);
    isPrime[0] = isPrime[1] = 0;

    for(long long i=2; i*i<=n; i++)
        if(isPrime[i])
            for(long long j=i*2; j<=n; j+=i)
                isPrime[j] = 0;
    repeat(i, 0, n+1)
        if(isPrime[i]) c++;
    return c; /// primeCount [1:n]
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

using ll = long long;

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

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

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

    ll sum = 0;
    for (int i = 0; i < N - 1; ++i) {
        sum += min(A * (X[i + 1] - X[i]), B);
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,t[100],ans,che;
string a[100],p;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		cin>>a[i]>>t[i];
	cin>>p;
	for(int i=1;i<=n;i++)
	{
		if(che==1)
			ans+=t[i];
		if(a[i]==p)
			che=1;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
 
typedef long long int ll;
void hack(ll n)
{
    if(n==124)
    cout<<"hacked";   
}
ll gcd(ll a,ll b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
ll mod=998244353;
ll mod1=1e9+6;
#define int ll
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0) return power(a*a%mod,b/2);
    else return a*power(a*a%mod,b/2)%mod;
}
ll power1(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0) return power(a*a%mod1,b/2);
    else return a*power(a*a%mod1,b/2)%mod1;
}
void show(vector <pair<int,int>> v)
{
    for(int i=0;i<v.size();++i) cout<<v[i].first<<" "<<v[i].second<<" ";
        cout<<endl;
}
#define endl '\n'


int32_t main()
{
    IOS
   
 
   int n,m,p;
   cin>>n>>m>>p;
   pair<int,pair<int,int>> x[m];
   for(int i=0;i<m;++i)
   {
      int a,b,c;
      cin>>a>>b>>c;
      x[i]=make_pair(a,make_pair(b,p-c));
   }
   int dis[n+1];

   for(int i=1;i<=n;++i)
    dis[i]=1e18;
  dis[1]=0;

    for(int i=1;i<=n-1;++i)
    {
        for(int j=0;j<m;++j)
        {
          int u=x[j].first;
          int v=x[j].second.first;
          int we=x[j].second.second;
          if(dis[u]!=1e18 and dis[u]+we<dis[v])
          {
            dis[v]=dis[u]+we;
          }
        }
    }
   
        int temp=dis[n];

         for(int i=1;i<=n-1;++i)
    {
        for(int j=0;j<m;++j)
        {
          int u=x[j].first;
          int v=x[j].second.first;
          int we=x[j].second.second;
          if(dis[u]!=1e18 and dis[u]+we<dis[v])
          {
            dis[v]=dis[u]+we;
          }
        }
    }
    if(dis[n]!=temp)
    {
      cout<<-1;
      return 0;
        
    }
    cout<<max(-dis[n],(ll)0);
    


}


Measured memory_bytes: 384
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	@SuppressWarnings("unchecked")
	private void run() {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			n = scanner.nextInt();
			if (n == 0)
				break;
			lists = new ArrayList[n];
			for (int i = 0; i < n; i++)
				lists[i] = new ArrayList<Edge>();
			for (int i = 0; i < n - 1; i++) {
				int from = scanner.nextInt() - 1;
				int to = scanner.nextInt() - 1;
				int cost = scanner.nextInt();
				lists[from].add(new Edge(to, cost));
				lists[to].add(new Edge(from, cost));
			}
			for (int i = 0; i < n; i++) {
				if (lists[i].size() == 1 && i != 0) {
					lists[i].get(0).cost = INF;
				} else
					for (Edge edge : lists[i]) {
						if (lists[edge.to].size() == 1 && edge.to != 0)
							edge.cost = INF;
					}
			}
			int sum = 0;
			for (List<Edge> list : lists)
				for (Edge edge : list)
					if (edge.cost != INF)
						sum += edge.cost;
			PriorityQueue<Edge> pq = new PriorityQueue<Edge>();
			pq.offer(new Edge(0, 0));
			int[] costs = new int[n];
			Arrays.fill(costs, 1 << 24);
			costs[0] = 0;
			while (!pq.isEmpty()) {
				Edge edge = pq.poll();
				for (Edge e : lists[edge.to]) {
					if (costs[e.to] > e.cost + edge.cost) {
						costs[e.to] = e.cost + edge.cost;
						pq.offer(new Edge(e.to, costs[e.to]));
					}
				}
			}
			int max = 0;
			for (int ans : costs) {
				if (ans == INF)
					continue;
				max = Math.max(max, ans);
			}
			System.out.println(sum - max);
		}
	}

	int n;
	List<Edge>[] lists;
	int INF = 1 << 24;

	class Edge implements Comparable<Edge> {
		int to, cost;

		Edge() {
		}

		public Edge(int to, int cost) {
			super();
			this.to = to;
			this.cost = cost;
		}

		@Override
		public String toString() {
			return "Edge [to=" + to + ", cost=" + cost + "]";
		}

		@Override
		public int compareTo(Edge o) {
			return this.cost - o.cost;
		}

	}
}

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

int main()
{
    char c;
    while(cin >> c)
    {
        if(c == 'a' || c == 'e' || c == 'i' || c == 'o'|| c == 'u')
        cout << "vowel" << endl;
        else
        cout << "consonant" << endl;
    }
    return 0;
}


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

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

int main() {
  int w, h;
  while (cin >> w >> h, w) {
    vector<string> c(h);
    for (auto &e : c) {
      cin >> e;
    }
    vector<pair<int, int>> p;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if (c[i][j] == '*') {
          p.push_back({i, j});
        } else if (c[i][j] == 'o') {
          p.insert(begin(p), {i, j});
        }
      }
    }

    vector<vector<int>> v(p.size(), vector<int>(p.size(), 1e9));
    for (int i = 0; i < p.size(); i++) {
      vector<vector<int>> bfs(h, vector<int>(w, 1e9));
      bfs[p[i].first][p[i].second] = 0;
      queue<pair<int, int>> q;
      q.push(p[i]);
      while (!q.empty()) {
        auto t = q.front();
        q.pop();
        for (int j = 0; j < 4; j++) {
          int y = t.first + dy[j], x = t.second + dx[j];
          if (0 <= y && y < h && 0 <= x && x < w && c[y][x] != 'x' && bfs[y][x] == (int)1e9) {
            bfs[y][x] = bfs[t.first][t.second] + 1;
            q.push({y, x});
          }
        }
      }
      for (int j = 0; j < p.size(); j++) {
        v[i][j] = bfs[p[j].first][p[j].second];
      }
    }

    vector<vector<int>> dp(1 << p.size(), vector<int>(p.size(), 1e9));
    dp[1 << 0][0] = 0;
    for (int i = 0; i < 1 << p.size(); i++) {
      for (int j = 0; j < p.size(); j++) {
        if (!(i & (1 << j))) {
          for (int k = 0; k < p.size(); k++) {
            dp[i | (1 << j)][j] = min(dp[i | (1 << j)][j], dp[i][k] + v[k][j]);
          }
        }
      }
    }

    int m = 1e9;
    for (int i = 0; i < p.size(); i++) {
      m = min(m, dp[(1 << p.size()) - 1][i]);
    }
    cout << (m == (int)1e9 ? -1 : m) << endl;
  }
}



Measured memory_bytes: 3156
def main():
    """最長: s + t

    abc
      abc

    abc
     abc

    abc
    abc
    """
    N = int(input())
    s = input()
    t = input()

    ans = s + t
    for i in range(1, N+1):
        if s[-i:] == t[:i]:
            ans = s[:-i] + s[-i:] + t[i:]

    print(len(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import           Control.Monad.State
import qualified Data.ByteString.Char8        as B

type Parser a = StateT B.ByteString Maybe a

parseInt :: Parser Int
parseInt = StateT $ B.readInt . B.dropWhile ((==) ' ')

readParser :: Parser a -> IO a
readParser p = maybe (error "parser error") fst . runStateT p <$> B.getLine

main :: IO ()
main = do
  (s, w) <- readParser $ (,) <$> parseInt <*> parseInt
  putStrLn $ solve s w

solve :: Int -> Int -> String
solve s w
  | w >= s    = "unsafe"
  | otherwise = "safe"


Measured memory_bytes: 3772
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;


int f(long long int a,long long int b){
  return max((int)log10((double)a)+1,(int)log10((double)b)+1);
}

int main (){
  long long int N;
  cin >> N;
  int a=(int)pow(N,0.5)+1;
  int b=0;
  int c=100;
  for(int i=1;i<a;i++){
    if(N%i==0){
      b=f(i,N/i);
      c=min(b,c);
    }
  }
  cout << c << endl;
}


Measured memory_bytes: 256
N, M = map(int,input().split())
K = []
S = []
for i in range(M):
    k = 0
    s = []
    k, *s = map(int,input().split())
    K.append(k)
    S.append(s)
P = list(map(int,input().split()))
res = 0
for bit in range(1 << N):
    judge = True
    for i in range(M):
        cnt = 0
        for s in S[i]:
            cnt += (bit >> s-1) & 1
        if cnt % 2 != P[i]:
            judge = False
            break
    if judge:
        res += 1
print(res)

Measured memory_bytes: 9144
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! (
        n: usize,
        x: usize,
        t: usize,
    );

    let c = if (n%x == 0) {
        n/x
    } else {
        n/x + 1
    };

    println!("{}", t*c);
}


Measured memory_bytes: 2152
#include "bits/stdc++.h"
using namespace std;

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()





int main(){
  int N, ans;
  cin >> N;

  ans = N/2;
  if (N%2 != 0){
    ans++;
  }
  cout << ans << endl;
}


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

using namespace std;

int main()
{
	int n;
	cin>>n;
	int a[n],b[n],c[n];
	for(int i=0;i<n;i++)
		cin>>a[i]>>b[i]>>c[i];
	int dp[n+1][3]={};
	dp[0][0]=a[0];dp[0][1]=b[0];dp[0][2]=c[0];

	for(int i=1;i<n;i++)
	{
        dp[i][0]=max(dp[i][0],a[i]+max(dp[i-1][1],dp[i-1][2]));
        dp[i][1]=max(dp[i][1],b[i]+max(dp[i-1][2],dp[i-1][0]));
        dp[i][2]=max(dp[i][2],c[i]+max(dp[i-1][0],dp[i-1][1]));
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
using namespace std;
 
int main()
{
  int r,c;
  cin >> r >> c;
  vector<vector<int> > v(r+1,vector<int>(c+1,0));
  for(int i=0; i<r; i++){
    for(int j=0; j<c; j++){
      int n;
      cin >> n;
      v[i][j] = n;
      v[i][c] += n;
      v[r][j] += n;
      v[r][c] += n;
    }
  }
  for(int i=0; i<=r; i++){
    for(int j=0; j<=c; j++){
      if(j != 0) cout << " ";
      cout << v[i][j];
    }
    cout << endl;
  }
  return 0;
}

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

int main(){
    int N,K;
    cin >> N >> K;
    vector<ll> V(N);
    rep(i,N){
        cin >> V[i];
    }
    ll ans = 0;
    for(int l=0;l<=min(N,K);l++){
        for(int r=0;r<=min(N,K);r++){
            if(l+r>min(N,K))  continue;
            priority_queue<int> pq;
            ll s=0;
            for(int i=0;i<l;i++){
                s+=V[i];
                if(V[i]<0){
                    pq.push(-V[i]);
                }
            }
            for(int i=0;i<r;i++){
                s+=V[N-i-1];
                if(V[N-i-1]<0){
                    pq.push(-V[N-i-1]);
                }
            }
            int cnt=1;
            while(1){
                if(cnt>K-(l+r)||pq.size()<=0) break;
                s += pq.top();
                pq.pop();
                cnt++;
            }
            ans = max(ans,s);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
A=list(map(int,input().split()))
import fractions
B=[]
C=[]
for i in A:
  B.append(i//2)
cnt=0
for i in A:
  C.append(cnt)
  cnt=0
  while i%2==0:
    i/=2
    cnt+=1
cnt=0
y=A[-1]
while y%2==0:
  y/=2
  cnt+=1
C.append(cnt)
D=C[1:]
if len(set(D))!=1:
  print(0)
else:

  ans = B[0]
  for i in range(1, N):
    ans=ans*B[i] // fractions.gcd(ans,B[i])

  x=M//ans
  if x%2==1:
    print((x+1)//2)
  else:
    print(x//2)

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



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

int main(){
    int N;
    cin>>N;
    int p[1000][1000];
    for(int i=0;i<N;i++){
        for(int j=0;j<3;j++){
            cin>>p[i][j];
        }
        sort(p[i],p[i]+3);
    }
    int o=0;
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
        if(p[i][0]==p[j][0]&&p[i][1]==p[j][1]&&p[i][2]==p[j][2]){
            o++;
            break;
        }  
        }
    }
    cout<<o<<"\n";
    return 0;
}


Measured memory_bytes: 7036
// A.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 2020, dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

typedef pair<int, int> pii;

int n, m, dist[MAX_N][MAX_N];
char S[MAX_N][MAX_N];

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)
        scanf("%s", S[i] + 1);
    memset(dist, 0x3f, sizeof(dist));
    queue<pii> q;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            if (S[i][j] == '#')
                dist[i][j] = 0, q.push(make_pair(i, j));
    while (!q.empty())
    {
        int x = q.front().first, y = q.front().second;
        q.pop();
        for (int d = 0; d < 4; d++)
        {
            int dstx = x + dx[d], dsty = y + dy[d];
            if (S[dstx][dsty] != '\0' && dist[dstx][dsty] > dist[x][y] + 1)
                dist[dstx][dsty] = dist[x][y] + 1, q.push(make_pair(dstx, dsty));
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            ans = max(ans, dist[i][j]);
    printf("%d\n", ans);
    return 0;
}

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


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

Measured memory_bytes: 256
from sys import stdin
import string
n = int(stdin.readline().rstrip())
w_dic = dict()
for i in string.ascii_lowercase:
    w_dic[i] = 0

dup = set(string.ascii_lowercase)
for _ in range(n):
    S = (stdin.readline().rstrip())
    dup = dup & set(S)
    for j in string.ascii_lowercase:
        if w_dic[j] == 0:
            w_dic[j] = S.count(j)
        else:
            w_dic[j] = min(w_dic[j],S.count(j))

ans = ""
dup = sorted(dup)
for k in dup:
    ans += (k*w_dic[k])
print(ans)

Measured memory_bytes: 3772
#include <bits/stdc++.h>
using intl = long long;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)((n) - 1); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define INF = 1e9;
#define debug(x) cout << #x << ":" << x << endl
using namespace std;
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
int main(){
    string s;
    cin >> s;
    fp((s[0] != s[1])||(s[1] != s[2]));
    return 0;
}

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

using namespace std;

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

	int ans = 0;
	for (int i = 1; i < n; i++) {
		if (a[i] == a[i - 1]) {
			a[i] = -1;
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

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

using namespace std;

int main(){
	ios_base::sync_with_stdio (false);
	cout << fixed;
	cout.precision(10);
	if(fopen("joke.in", "r")){
		freopen ("joke.in","r",stdin);
		freopen ("joke.out","w",stdout);
	}

	int n;
	cin >> n;
	vector<long double> x(n);
	vector<string> u(n);
	for(int i = 0; i < n; ++i){
		cin >> x[i] >> u[i];
	}

	long double res = 0.0;
	for(int i = 0; i < n; ++i){
		if(u[i][0] == 'J'){
			res += x[i];
		}else{
			res += (380000.0 * x[i]);
		}
	}

	cout << res;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
const LL MOD=1000000007ll;
const LL INF=2000000000ll;

long power(long a,long b){return b?power(a*a%MOD,b/2)*(b%2?a:1)%MOD:1;}
long comb(int N,int K)
{
	long x=1,y=1;
	for(int i=1;i<=K;i++)
	{
		x=x*(N-i+1)%MOD;
		y=y*i%MOD;
	}
	return x*power(y,MOD-2)%MOD;
}

long hcomb(int N, int K){
    return comb(N+K-1, N-1);
}

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(10);

    int n, x, ans;
    cin >> n >> x;

    while(n || x) {
        ans = 0;
        for (int i = 1; i <= n; i++){
            for (int j = i+1; j <= n; j++){
                for (int k = j+1; k <= n; k++){
                    if (i+j+k == x) ans++;
                }
            }
        }
        cout << ans << endl;

        cin >> n >> x;
    } 
}



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

#define arr_print(arr) for(auto i : arr)

using namespace std;

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

vector<pair<char, int>>RLE(vector<char>a) {
	vector<pair<char, int>>ret;
	int cnt = 1;
	for (int i = 1; i < a.size(); i++) {
		if (a[i] == a[i - 1]) {
			cnt++;
		}
		else {
			ret.push_back(pair<char, int>(a[i - 1], cnt));
			cnt = 1;
		}
	}
	ret.push_back(pair<char, int>(a[a.size() - 2], cnt));
	return ret;
}

int main() {
	string S; cin >> S;
	vector<pair<char, int>>rle;
	vector<int>r,r_pos,sum;
	vector<char>s;
	for (auto i : S) {
		s.push_back(i);
	}
	rle = RLE(s);
	arr_print(rle) {
		r.push_back(i.second);
	}
	int c = 0;
	for (int i = 0; i < r.size(); i++) {
		if (i % 2 == 0) {
			c += r[i];
		}
		else {
			sum.push_back(c + r[i]);
			c = 0;
		}
	}
	for (int i = 1; i < sum.size(); i++) {
		sum[i] += sum[i - 1];
	}
	r_pos.push_back(rle[0].second);
	for (int i = 1; i < r.size(); i++) {
		r[i] += r[i - 1];
		if (i % 2 == 0) {
			r_pos.push_back(r[i]);
		}
	}
	vector<int>r_pos1 = r_pos;
	for (int i = 0; i < sum.size() - 1; i++) {
		r_pos[i + 1] -= sum[i];
	}
	for (int i = sum.size()-1; i>=1; i--) {
		sum[i] -= sum[i - 1];
	}
	vector<int>ans;

	for (int i = 0; i < r_pos.size(); i++) {
		if (r_pos[i] % 2 == 0) {
			ans.push_back(sum[i] / 2);
			ans.push_back(sum[i]-sum[i] / 2);
		}
		else {
			if (sum[i] % 2 == 0) {
				ans.push_back(sum[i] / 2);
				ans.push_back(sum[i] - sum[i] / 2);
			}
			else {
				ans.push_back(sum[i] / 2 + 1);
				ans.push_back(sum[i] - sum[i] / 2 - 1);
			}
		}
	}
	int index = 0;
	vector<int>ret(S.length(), 0);
	for (int i = 0; i < r_pos1.size(); i++) {
		ret[r_pos1[i] - 1] = ans[index];
		ret[r_pos1[i]] = ans[index+1];
		index += 2;
	}
	arr_print(ret) {
		cout << i << ' ';
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3828
import sys

def solve():
      input = sys.stdin.readline
      N, Q = map(int, input().split())
      total = (N - 2) ** 2
      rb = N
      db = N
      D = [N] * (N + 1)
      R = [N] * (N + 1)
      for _ in range(Q):
            a, b = map(int, input().split())
            if a == 1: #横向き
                  if b < db:
                        total -= (rb - 2)
                        for i in range(b, db): R[i] = rb
                        db = b
                  else:
                        total -= (R[b] - 2)
            else: #縦向き
                  if b < rb:
                        total -= (db - 2)
                        for i in range(b, rb): D[i] = db
                        rb = b
                  else:
                        total -= (D[b] - 2)

      print(total)

      return 0

if __name__ == "__main__":
      solve() 

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

int main(){
	string s1, s2;
	cin >> s1 >> s2;
	if(s1 == s2) {
		cout << "EQUAL";
	} else {
		if(s1.size() > s2.size()) {
			cout << "GREATER";
		} else if (s1.size() < s2.size()) {
			cout << "LESS";
		} else {
			if (s1 > s2) {
				cout << "GREATER";
			} else {
				cout << "LESS";
			}
		}
	}
	return 0;
}



Measured memory_bytes: 256
n = input()
a = "357"
count357 = ["3", "5", "7"]
i = 0
while int(count357[-1]) <= int(n):
    for j in range(3):
        count357.append(str(int(count357[i])*10 + int(count357[j])))
        if int(count357[-1]) > int(n):
            break
    i += 1
count357.pop(-1)
count = 0
for i in range(len(count357)):
    count += 1 if "3" in count357[i] and "5" in count357[i] and "7" in count357[i] else 0

print(count)

Measured memory_bytes: 5156
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<pair<int,int> >A;
long h,w,dp[3333],n,mod=1e9+7,fac[2<<17],inv[2<<17];
long p(long a,long b){return b?p(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
long f(long a,long b)
{
	return fac[a+b]*inv[a]%mod*inv[b]%mod;
}
main()
{
	cin>>h>>w>>n;
	fac[0]=inv[0]=1;
	for(int i=1;i<2<<17;i++)fac[i]=fac[i-1]*i%mod,inv[i]=p(fac[i],mod-2);
	for(int i=0;i<n;i++)
	{
		int a,b;cin>>a>>b;
		A.push_back(make_pair(a,b));
	}
	A.push_back(make_pair(h,w));
	sort(A.begin(),A.end());
	for(int i=0;i<=n;i++)
	{
		long now=f(A[i].first-1,A[i].second-1);
		for(int j=0;j<i;j++)
		{
			if(A[j].second<=A[i].second)
			{
				now=(now-dp[j]*f(A[i].first-A[j].first,A[i].second-A[j].second)%mod+mod)%mod;
			}
		}
		dp[i]=now;
	}
	cout<<dp[n]<<endl;
}


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

const int MAXN=1111;
int ans[MAXN][MAXN];
int n, k;
int main() {
	scanf("%d", &k);
	if(k==1) {
		puts("1\n1");
		return 0;
	}
	n=2*((k+3)/4);
	printf("%d\n", n);
	for(int i=0;i<n;++i) {
		for(int j=0;j<n;++j) {
			ans[i][j]=(i+j)%n+1;
			if((j&1) && ans[i][j]+n<=k) ans[i][j]+=n;
			printf("%d ", ans[i][j]);
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  ll s = a * b * c;
  if(s%2==0){
    cout << 0 << endl;
    return 0;
  }
  cout << min({a * b, b * c, a * c}) << endl;

  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	h := nextInt()
	w := nextInt()
	ss := make([]string, h)

	for i := 0; i < h; i++ {
		ss[i] = nextWord()
	}

	left := make([][]int, h)
	right := make([][]int, h)
	up := make([][]int, h)
	down := make([][]int, h)

	for i := 0; i < h; i++ {
		left[i] = make([]int, w)
		right[i] = make([]int, w)
		up[i] = make([]int, w)
		down[i] = make([]int, w)
	}

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if ss[i][j] == '.' {
				if j == 0 {
					left[i][j] = 1
				} else {
					left[i][j] = left[i][j - 1] + 1
				}
			}

			if ss[i][w - j - 1] == '.' {
				if j == 0 {
					right[i][w - j - 1] = 1
				} else {
					right[i][w - j - 1] = right[i][w - j] + 1
				}
			}
		}
	}

	max := 0
	for i := 0; i < w; i++ {
		for j := 0; j < h; j++ {
			if ss[j][i] == '.' {
				if j == 0 {
					up[j][i] = 1
				} else {
					up[j][i] = up[j - 1][i] + 1
				}
			}

			if ss[h - j - 1][i] == '.' {
				if j == 0 {
					down[h - j - 1][i] = 1
				} else {
					down[h - j - 1][i] = down[h - j][i] + 1
				}
			}
		}

		for j := 0; j < h; j++ {
			num := left[j][i] + right[j][i] + up[j][i] + down[j][i] - 3
			if num > max {
				max = num
			}
		}
	}
	fmt.Println(max)
}


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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

Measured memory_bytes: 138240
def main():
    H, W = list(map(int, input().split(' ')))
    N = int(input())
    A = list(map(int, input().split(' ')))
    colors = list()
    for i, a in enumerate(A):
        c = i + 1
        for _ in range(a):
            colors.append(c)
    assert len(colors) == H * W
    ans = [[0 for _ in range(W)] for _ in range(H)]
    # 蛇腹状にぬっていく
    for i, c in enumerate(colors):
        w = i // H
        h = min([i % (2 * H), 2 * H - 1 - (i % (2 * H))])
        ans[h][w] = c
    for row in ans:
        print(' '.join(map(str, row)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include<cmath>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<bitset>
#define int unsigned long long
#define hh putchar('\n')
#define kg putchar(' ')
#define lowbit(x) ((x)&(-x))
using namespace std;
const int maxn=200005,mod=998244353;
int dis[maxn],n,m,cnt,head[maxn],ans[maxn];
struct edge
{
	int to,next;
}e[maxn<<1];
queue<int>q;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
		if(ch=='-')
			f=-1;
		ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
    }
    return x*f;
}
inline void write(int a)
{
    if(a<0)
    {
		putchar('-');
		putchar('1');
//		write(-a);
    }
    else
    {
		if(a>=10)
			write(a/10);
		putchar(a%10+'0');
    }
}
int quickmi(int a,int b)
{
	int kotae=1;
	while(b)
	{
		if(b&1)
			kotae=kotae*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return kotae;
}
void add(int from,int to)
{
	e[++cnt]=(edge){to,head[from]};
	head[from]=cnt;
}
void bfs(int s)
{
	dis[s]=1;
	q.push(s);
	while(!q.empty())
	{
		int now=q.front();
		q.pop();
		for(int i=head[now];i;i=e[i].next)
		{
			int to=e[i].to;
			if(!dis[to])
				dis[to]=dis[now]+1,q.push(to);
		}
	}
}
signed main()
{
	n=read(),m=read();
	for(int i=1;i<=m;++i)
	{
		int u=read(),v=read();
		add(u,v),add(v,u);
	}
	bfs(1);
	for(int i=2;i<=n;++i)
	{
		int flag=0;
		for(int j=head[i];j;j=e[j].next)
		{
			int to=e[j].to;
			if(dis[to]==dis[i]-1)
			{
				ans[i]=to;
				flag=1;
				break;
			}
		}
		if(!flag)
		{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	for(int i=2;i<=n;++i)
		write(ans[i]),hh;
	return 0;
}





Measured memory_bytes: 12480
#include <cstdio>
#include <iostream>

using namespace std;

char d[101][101];
int X,Y;
bool Flag;

void solve(int x,int y){
  if(d[x][y]=='.'){
    Flag=1;
    X=x;Y=y;
    return;
  }
  if(d[x][y]==-1){
    return;
  }
  if(d[x][y]=='>'){
    d[x][y]=-1;
    solve(x,y+1);
  }
  if(d[x][y]=='<'){
    d[x][y]=-1;
    solve(x,y-1);
  }
  if(d[x][y]=='v'){
    d[x][y]=-1;
    solve(x+1,y);
  }
  if(d[x][y]=='^'){
    d[x][y]=-1;
    solve(x-1,y);
  }
  return;
}

int main(){
  int h,w;
  while(cin>>h>>w,h!=0&&w!=0){
    for(int i=0;i<h;i++){
      cin>>d[i];
    }
    Flag=0;
    solve(0,0);
    if(Flag){
      printf("%d %d\n",Y,X);
    }else{
      printf("LOOP\n");
    }
  }
  return 0;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int a, b, c;
    cin >> a >> b >> c;

    // 処理
    // 出力
    cout << (a == b + c || a + b == c || a + c == b ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <string>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  int p, q, r;
  cin >> p >> q >> r;
  cout << min({p + q, q + r, r + p}) << endl;

  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
typedef pair<int, int> p;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9

int num[1001];

void prime(int N) {
	for (int i = 2; i <= N; i++) {
		while (N%i == 0) {
			num[i]++;
			N /= i;
		}
	}
}

int main() {
	int n;
	cin >> n;
	for (int i = 2; i <= n; i++) prime(i);
	ll ans = 1;
	for (int i = 2; i <= 1000; i++) {
		ans *= (num[i] + 1);
		ans %= modulo;
	}
	cout << ans << endl;

	return 0;
}

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

typedef long long int ll;

#define endl '\n'

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);


    ll x,a;
    cin>>x>>a;

    if(x<a){
        cout<<0<<endl;
    }
    else{
        cout<<10<<endl;
    }




}


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

void solve() {
  int n;
  cin >> n;
  cout << n * 800 - (n / 15) * 200 << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) solve();
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int main(){
	int n;
	scanf("%d",&n);
	int mx=0,ans=0;
	
	while(n--){
		int a,b;
		scanf("%d%d",&a,&b);
		if(umax(mx,a))
			ans=a+b;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
//constexpr int MOD = 10e9+7;
constexpr int INF = 1e9;
inline int in() {int x; cin >> x; return x;}
template <typename T> inline void out(const T& x) {cout << x << endl;}
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 
  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//

int N;
int A,B,C;
int l[10];

int dfs(int i,int a,int b,int c)
{
  //縺昴ｌ縺槭ｌ縺ｮ螂ｴ縺ｫ蟇ｾ縺励※菴ｿ縺・√◎縺励※菴ｿ繧上↑縺・・蝗帶萱繧偵◎繧後◇繧後↓縺､縺・※蜈ｨ謗｢邏｢
  if(i == N)
  {
    int ans = abs(a -A) + abs(b-B) + abs(c -C) - 30 ;
    if(min({a,b,c})<= 0) 
    {
      return INF;
    }
    return ans;
  }
  auto ret1 =  dfs(i+1,a+l[i],b,c)+10;
  auto ret2 =  dfs(i+1,a,b+l[i],c)+10;
  auto ret3 =   dfs(i+1,a,b,c+l[i]) +10;
  auto ret0 =   dfs(i+1,a,b,c);
  return min({ret0,ret1,ret2,ret3});
}
signed main()
{
  ios();
  cin >> N; 
  cin >> A >> B >> C ;
  rep(i,N){
    cin >> l[i];
  } 
  cout << dfs(0,0,0,0) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int table[] = new int[3];

		Scanner sc = new Scanner(System.in);

		table[0] = sc.nextInt();
		table[1] = sc.nextInt();
		table[2] = sc.nextInt();

		int work;

		for(int base_loc = 0; base_loc <= 1; base_loc++){
			for(int comp_loc = table.length-1;comp_loc >= base_loc+1; comp_loc--){
				if(table[comp_loc] < table[comp_loc-1]){
					work = table[comp_loc-1];
					table[comp_loc-1] = table[comp_loc];
					table[comp_loc] = work;
				}
			}
		}

		for(int i = 0; i < table.length; i++){
			if(i != 0)System.out.printf(" ");
			System.out.printf("%d", table[i]);
		}
		System.out.printf("\n");
	}
}




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

int main(){
    int a,b;
    while (cin >> a >> b) {
        int koua,koub;
        koua = a;
        koub = b;
        if(koua < koub) {
            int temp = koua;
            koua = koub;
            koub = temp;
        }
        int r;
        while ((r =koua % koub) != 0) {
            koua = koub;
            koub = r;
        }
        int baia = a, baib = b;
        while(baia != baib) {
            if (baia < baib) {
                baia += a;
            }
            else {
                baib += b;
            }
        }
        cout<< koub << " " << baia << endl;
    }
    return 0;
}

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


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	string s;
	cin >> s;
	n = s.size();
	vector<int> ans(n);
	rep(ri, 2) {
		int cnt = 0;
		rep(i, n) {
			if (s[i] == 'R') cnt++;
			else {
				ans[i] += cnt / 2;
				ans[i - 1] += (cnt + 1) / 2;
				cnt = 0;
			}
		}

		reverse(ans.begin(), ans.end());
		reverse(s.begin(), s.end());
		rep(i, n) {
			if (s[i] == 'L') s[i] = 'R';
			else s[i] = 'L';
		}
	}

	rep(i, n) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1104
n = int(input())
ta = [list(map(int, input().split())) for _ in range(n)]
for i in range(0, n-1):
	r = max((ta[i][0]-1)//ta[i+1][0]+1, (ta[i][1]-1)//ta[i+1][1]+1)
	ta[i+1][0] = ta[i+1][0] * r
	ta[i+1][1] = ta[i+1][1] * r
print(sum(ta[n-1]))

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

#define cc(x) cout << (x) << endl
#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)
typedef long long ll;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

const ll inf = 1LL<<58;
const int iinf = 1<<30;

int main(){
    int bh, bw, h, w;
    cin >> bh >> bw;
    cin >> h >> w;
    cc(bh*bw-h*bw-w*bh+h*w);
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define FOREACH(element, vec_name) for (auto &(element) : (vec_name))
#define VECCIN(vec_name) for (auto &element : (vec_name)) cin >> element

#define ALL(obj) (obj).begin(), (obj).end()

#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

//dump出力
    // vector
    template <typename T>
    istream &operator>>(istream &is, vector<T> &vec)
    {
        for (T &x : vec)
            is >> x;
        return is;
    }
    // pair
    template <typename T, typename U>
    ostream &operator<<(ostream &os, pair<T, U> &pair_var)
    {
        os << "(" << pair_var.first << ", " << pair_var.second << ")";
        return os;
    }
    // vector
    template <typename T>
    ostream &operator<<(ostream &os, const vector<T> &vec)
    {
        os << "{";
        for (int i = 0; i < vec.size(); i++)
        {
            os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
        }
        os << "}";
        return os;
    }
    // map
    template <typename T, typename U>
    ostream &operator<<(ostream &os, map<T, U> &map_var)
    {
        os << "{";
        repi(itr, map_var)
        {
            os << *itr;
            itr++;
            if (itr != map_var.end())
                os << ", ";
            itr--;
        }
        os << "}";
        return os;
    }
    // set
    template <typename T>
    ostream &operator<<(ostream &os, set<T> &set_var)
    {
        os << "{";
        repi(itr, set_var)
        {
            os << *itr;
            itr++;
            if (itr != set_var.end())
                os << ", ";
            itr--;
        }
        os << "}";
        return os;
    }

    #define DUMPOUT cerr

    void dump_func()
    {
        DUMPOUT << endl;
    }
    template <class Head, class... Tail>
    void dump_func(Head &&head, Tail &&... tail)
    {
        DUMPOUT << head;
        if (sizeof...(Tail) > 0)
        {
            DUMPOUT << ", ";
        }
        dump_func(std::move(tail)...);
    }
    #ifdef DEBUG_
    #define DEB
    #define dump(...)                                                       \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                     \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" \
                << endl                                                     \
                << "    ",                                                  \
            dump_func(__VA_ARGS__)
    #else
    #define DEB if (false)
    #define dump(...)
    #endif

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

const int INF = 1e9;
const int MOD = 1e9+7;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }//最小公倍数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }//最小公倍数

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()
{
    char c;
    cin >> c;
    c++;
    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	string s; cin >> s;
	string s_year = s.substr(0, 4);
	string s_month = s.substr(5, 2);
	string s_day = s.substr(8, 2);
	int a = atoi(s_year.c_str());
	int b = atoi(s_month.c_str());
	int c = atoi(s_day.c_str());
	if (a <= 2019 && b <= 4 && c <= 30) {
		cout << "Heisei" << endl;
		return;
	}
	cout << "TBD" << endl;
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ordered_set<ll> ods;

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

ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}

ll invmod(ll a, ll m)
{
    return power(a,m-2,m);
}

void solve(ll t)
{
    // cout<<"Case #"<<t<<":\n";
    ld r;
    cin>>r;
    ld PI=3.1415926535;
    ld ans=2*PI*r;
    cout<<setprecision(10)<<ans<<endl;
}

int main()
{
    IOS;
    ll t;
    // cin>>t;
    t=1;
    ll tt=1;
    while(t--)
    {
        solve(tt);
        tt++;
    }
}     


Measured memory_bytes: 3828
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

const int N = 300 + 1;

vector <int> a[N];

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            int x;
            scanf("%d", &x);
            x--;
            a[i].push_back(x);
        }
    }
    int ans = 1e9;
    for (int i = 0; i < m; i++)
    {
        vector <int> cnt(m);
        for (int i = 0; i < n; i++)
        {
            cnt[a[i][0]]++;
        }
        int j = 0;
        for (int i = 0; i < m; i++)
        {
            if (cnt[i] > cnt[j])
            {
                j = i;
            }
        }
        ans = min(ans, cnt[j]);
        int x = j;
        for (int i = 0; i < n; i++) 
        {
            for (int j = 0; j < (int) a[i].size(); j++)
            {
                if (a[i][j] == x)
                {
                    a[i].erase(a[i].begin() + j);
                    break;
                }
            }
        }
    }
    printf("%d\n", ans);
}


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

int N, A, B, C;
int l[8];

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

  int ans = 3000;
  for(int bit = 0; bit < (1 << (2 * N)); bit++){
    int cnt[3] = {};
    int length[3] = {};
    int bit_tmp = bit;
    int ans_tmp = 0;
    for(int i = 0; i < N; i++){
      if((bit_tmp % 4) != 0){
	length[bit_tmp % 4 - 1] += l[i];
	cnt[bit_tmp % 4 - 1]++;
	if(cnt[bit_tmp % 4 - 1] > 1){
	  ans_tmp += 10;
	}
      }
      bit_tmp /= 4;
    }
    if(length[0] == 0 || length[1] == 0 || length[2] == 0){
      continue;
    }
    ans_tmp += abs(length[0] - A) + abs(length[1] - B) + abs(length[2] - C);
    ans = min(ans, ans_tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL; 
const int P = 1e9 + 7;
namespace Comb {
const int U = 2000 * 2000;
int f[U + 3], rf[U + 3];
LL inv(LL a, LL m) { return (a == 1 ? 1 : inv(m % a, m) * (m - m / a) % m); }
void init() {
    f[0] = 1;
    for (int i = 1; i <= U; i++) f[i] = (LL)f[i - 1] * i % P;
    rf[U] = inv(f[U], P);
    for (int i = U; i; i--) rf[i - 1] = (LL)rf[i] * i % P;
}
LL C(int n, int m) {
    if (m < 0 || m > n) return 0;
    return (LL)f[n] * rf[m] % P * rf[n - m] % P;
}
}  // namespace Comb
using namespace Comb;
const int N = 2010;
int dp[N][N];
int main() {
	int n, k;
    init();
    scanf("%d%d", &n, &k);
    if (k == 1) {
        puts("1");
        return 0;
    }
    dp[0][0] = 1;
    for (int i = 0; i <= n; i++) {
        for (int j = i; j <= n; j++) {
            dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % P;
            int lft = n * k - (i * (k - 1) + j) - 1;
            dp[i + 1][j] = (1ll * dp[i][j] * C(lft, k - 2) % P + dp[i + 1][j]) % P;
        }
    }
    printf("%lld\n", 1ll * dp[n][n] * f[n] % P);
    return 0;
}

Measured memory_bytes: 47232
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=5e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,a,b,c,ans=0,p;
  cin >> n >> m;
  priority_queue<P> pq;
  for(int i=0; i<n; i++) {
    cin >> a;
    pq.push({a,1});
  }
  for(int i=0; i<m; i++) {
    cin >> b >> c;
    pq.push({c,b});
  }
  for(int i=0; i<n; i++) {
    P p=pq.top();
    pq.pop();
    ans+=p.first,p.second--;
    if(p.second>0) {
      pq.push(p);
      p.second--;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 2548
from sys import stdin
input = stdin.readline


def main():
  N, K = list(map(int, input().split()))
  A = list(map(int, input().split()))

  # S = [1]*(N+1)
  # for i in range(1, N+1):
  #   S[i] = S[i-1] * A[i-1]

  # pre = S[K]/S[0]
  # out = []
  for i in range(K+1, N+1):
    if A[i-K-1] < A[i-1]:
      print('Yes')
    else:
      print('No')
    # temp = S[i]/S[i-K]
    # if pre < temp:
    #   # print('Yes')
    #   out.append('Yes')
    # else:
    #   # print('No')
    #   out.append('No')
    # pre = temp

  # print(*out, sep='\n')


if(__name__ == '__main__'):
  main()


Measured memory_bytes: 92260
#include <unordered_set>
#include <iostream>

using namespace std;

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

    unordered_set<long long> memo(10 ^ 9);
    for (int i = 0; i < N; i++) {
        long long a;
        cin >> a;
        if (memo.find(a) == memo.end()) {
            memo.emplace(a);
        } else {
            memo.erase(a);
        }
    }

    cout << memo.size() << endl;
    return 0;
}

Measured memory_bytes: 4240
#include <stdio.h>

int main(void) {
  int i, n, cnt[100001], a, ans = 0;
  scanf("%d", &n);
  for(i = 0; i < 100001; ++i) cnt[i] = 0;
  for(i = 0; i < n; ++i) {
    scanf("%d", &a);
    cnt[a]++;
  }
  for(i = 1; i < 100000; ++i) if(ans < cnt[i - 1] + cnt[i] + cnt[i + 1]) ans = cnt[i - 1] + cnt[i] + cnt[i + 1];
  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 512