akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    char c;cin >> c;
    if(c-'a'>=0)
    {
        cout << 'a' << endl;
    }else
    {
        cout << 'A' << endl;
    }
    
}

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

using namespace std;

int main() {

    int n, y, m, d;
    int sum_day;

    cin >> n;

    while(n--) {
        cin >> y >> m >> d;
        sum_day = 0;

        for(int i = y; i < 1000; ++i) {
            for(int j = (i == y ? m : 1); j <= 10; j++) {
                for(int k = (i == y && j == m ? d : 1); k <= (i % 3 ? 20 - (1 - j % 2) : 20); ++k) {
                    ++sum_day;
                }
            }
        }

        cout << sum_day << endl;
    }

}

Measured memory_bytes: 1160
import sys

s_args = sys.stdin.read().splitlines()

rows = []
rows.append([0] * (len(s_args[1])+2))
for s_arg in s_args[1:]:
    row = []
    for cell in s_arg:
        if cell == '.':
            row.append(0)
        else:
            row.append(-100000)
    rows.append([0] + row + [0])
rows.append([0] * (len(s_args[1])+2))

for (i, row) in enumerate(rows):
    if i == 0 or i == len(rows) - 1:
        continue
    for (j, cell) in enumerate(row):
        if j == 0 or j == len(row) - 1:
            continue
        if cell < 0:
            rows[i-1][j-1] += 1
            rows[i-1][j] += 1
            rows[i-1][j+1] += 1
            rows[i][j-1] += 1
            rows[i][j+1] += 1
            rows[i+1][j-1] += 1
            rows[i+1][j] += 1
            rows[i+1][j+1] += 1
            
for (i, row) in enumerate(rows):
    if i == 0 or i == len(rows) - 1:
        continue
    for (j, cell) in enumerate(row):
        if j == 0 or j == len(row) - 1:
            continue
        if cell < 0:
            print('#', end='')
        else:
            print(str(cell), end='')
    print('')


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    lli r;
    cin>>r;
    
    cout<<fixed<<setprecision(10)<<(2*(3.14159265358979323846)*(r));
    return 0;
}

Measured memory_bytes: 3792
#include <iostream>
using namespace std;
int main(void){
    int n,x,a[100],max,ans=0;// Your code here!
    cin>>n>>x;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    max=a[0];
    for(int i=0;i<n;i++){
        if(a[i]>0){
            ans=ans+a[i];
        }
    }
    
    for(int i=0;i<n;i++){
        if(a[i]<=max){
            max=a[i];
        }
    }
    
    cout<<(x-ans)/max+n<<endl;
    
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cstdlib>
#include<cmath>
#include <iomanip>
using namespace std;

int main(){
  int A,B,H,M;
  cin >> A >> B >> H >> M;
  double ta,tb;
  ta = 30*H+0.5*M;
  tb = 6*M;
  //ta = ta-tb;
  ta = abs(ta-tb);
  double C = sqrt(A*A + B*B - 2*A*B*cos(ta*M_PI/180));
  cout << fixed << setprecision(20) << C << endl;
  return 0;
}


Measured memory_bytes: 4260
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<time.h>
#include<math.h>
#include<memory>
#include<vector>
#include<bitset>
#include<fstream>
#include<stdio.h>
#include<utility>
#include<sstream>
#include<string.h>
#include<iostream>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int main()
{
    #ifdef absi2011
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);
    if ((b-a)%2==0)
    {
        puts("Alice");
    }
    else
    {
        puts("Borys");
    }
    return 0;
} 


Measured memory_bytes: 764
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] arr = reader.readLine().split(" ");
        int H = Integer.parseInt(arr[0]);
        String[] A = reader.readLine().split(" ");
        int accum = 0;
        for (int i = 0; i < A.length; i++)
            accum += Integer.parseInt(A[i]);
        System.out.println(1 < Math.ceil((double) H / accum) ? "No" : "Yes");
    }
}

Measured memory_bytes: 35540
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 2e5+100;
int n, a, b, c, d;
string s;
bool _z[N], *z = _z+1;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> a >> b >> c >> d >> s;
  a--; b--; c--; d--;
  if(c<d){
    z[a] = true;
    FOR(i, a+1, c+1) z[i] = (s[i]=='.') && (z[i-1]||z[i-2]);
    if(!z[c]) {
      cout << "No" << endl;
      return 0;
    }
    fill(z, z+N, false);
    z[b] = true;
    FOR(i, b+1, d+1) z[i] = (s[i]=='.') && (z[i-1]||z[i-2]);
    if(!z[d]) {
      cout << "No" << endl;
      return 0;
    }
    cout << "Yes" << endl;
  }else{
    z[b] = true;
    FOR(i, b+1, d+1) z[i] = (s[i]=='.') && (z[i-1]||z[i-2]);
    if(!z[d]) {
      cout << "No" << endl;
      return 0;
    }
    fill(z, z+N, false);
    z[a] = true;
    FOR(i, a+1, c+1) z[i] = (s[i]=='.') && (z[i-1]||z[i-2]);
    if(!z[c]) {
      cout << "No" << endl;
      return 0;
    }
    fill(z, z+N, false);
    FOR(i, b+1, d+2){
      if(s[i]=='.' && s[i-1]=='.'&&s[i-2]=='.'){
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
  }
}

Measured memory_bytes: 720
A, B, C, D = list(map(int, input().split()))
takahashi_flag = False
while True:
    C -= B
    if C <= 0:
        takahashi_flag = True
        break
    A -= D
    if A <= 0:
        break
if takahashi_flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9176
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A, B = sr().split()
A = int(A)
B = B.replace('.', '')
B = int(B)
answer = A*B // 100
print(answer)


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

int main() {
  string w;
  cin >> w;
  sort(w.begin(), w.end());

  int cnt = 1;
  if (w.size() == 1) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 1; i < w.size(); i++) {
    if (w[i - 1] == w[i]) {
      cnt++;
      continue;
    }
    if (cnt % 2 != 0) {
      cout << "No" << endl;
      return 0;
    }
    cnt = 1;
  }
  cout << "Yes" << endl;
}


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

using namespace std;

int main(){
	int n;
	cin >>n;
	long a[n];
	for(int i=0;i<n;i++){
		cin >>a[i];
	}
	sort(a,a+n,greater<int>());
	long long ans=0;
	for(int i=0;i<n-1;i++){
		int num=(i+1)/2;
		ans+=a[num];
	}
	cout <<ans<<endl;
	return 0;
}

Measured memory_bytes: 5200
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int y = sc.nextInt();
    int z = sc.nextInt();

    int t = y;
    y = x;
    x = t;

    int r = x;
    x = z;
    z = r;
    System.out.println(x + " " + y + " " + z);

  }
}


Measured memory_bytes: 21844
import numpy as np
n=int(input())
T=np.array([int(input()) for _ in range(n)], dtype=np.int64)

def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    return gcd(y, x%y)

ans=1
for t in T:
    ans*=t//gcd(t, ans)

print(ans)

Measured memory_bytes: 20388
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  char S_i;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    cin >> S_i;
    if (S_i == 'Y') {
      cout << "Four" << endl;
    break;
    }
    else if (i == N-1 && S_i != 'Y') {
      cout << "Three" << endl;
    }
  }
  
}

Measured memory_bytes: 256
def main():
  N = str(input())
  if N[-1] in ['2', '4', '5', '7', '9']:
    print("hon")
  elif N[-1] in ['0', '6', '1', '8']:
    print("pon")
  else:
    print("bon")
if __name__ == "__main__":
  main()

Measured memory_bytes: 9104
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

readline = stdin.buffer.readline

INF = 10 ** 10

N = int(readline())

cnt = 0

def dfs(A):
    global cnt
    if int(''.join(A)) > N:
        return
    
    if "3" in A and "5" in A and "7" in A:
        cnt += 1
    
    
    for i in ["3", "5", "7"]:
        A.append(i)
        dfs(A)
        A.pop()


dfs(["0"])

print(cnt)



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

const int N = 5000;

int n;
bool a[N + 5], b[N + 5];
char s[N + 5], t[N + 5];

int main() {
  scanf("%d%s%s", &n, s, t);

  if (n <= 2) {
      printf("%d\n", (s[0] != t[0]) + (s[1] != t[1]));
      return 0;
  }

  for (int i = 1; i < n; ++i) {
    a[i] = s[i] != s[i-1];
    b[i] = t[i] != t[i-1];
  }

  int ans = 0x3f3f3f3f;
  bool flag = s[0] != t[0];

  for (int i = flag; i < n; i += 2) {
    int res = 0;
    vector<int> tmp;
    for (int j = n - 1; j > 0; --j) if(a[j] == 0) tmp.push_back(j);
    for (int j = 0; j < i; ++j) tmp.push_back(0);

    for (int j = 1; j < n; ++j) if(b[j] == 0) {
      if (tmp.size()) {
        res += abs(j - tmp.back());
        tmp.pop_back();
      } else {
        res += n - j;
      }
    }

    while(!tmp.empty()) {
      res += n - tmp.back();
      tmp.pop_back();
    }
    ans = min(ans, res);
  }
  
  swap(a, b);
  for (int i = flag; i < n; i += 2) {
    int res = 0;
    vector<int> tmp;
    for (int j = n - 1; j > 0; --j) if(a[j] == 0) tmp.push_back(j);
    for (int j = 0; j < i; ++j) tmp.push_back(0);

    for (int j = 1; j < n; ++j) if(b[j] == 0) {
      if (tmp.size()) {
        res += abs(j - tmp.back());
        tmp.pop_back();
      } else {
        res += n - j;
      }
    }

    while(!tmp.empty()) {
      res += n - tmp.back();
      tmp.pop_back();
    }
    ans = min(ans, res);
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define rep(i,a,b) for(int i=a; i<b; i++)
#define dep(i,a,b) for(int i=a; i>=b; i--)
#define ALL(x)	(x).begin(), (x).end()
using namespace std;
const long long INF = 1e18 , MAXN =1e5, MOD = 1e9 + 7,N=1000010;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,w;cin>>n>>w;
	vector<pair<int,int>>knap;
	rep(i,0,n){
		int x,y;cin>>x>>y;
		knap.pb(make_pair(x,y));
	}
	ll ans[n+1][w+1];
	for(int i=0;i<=n;i++){
		for(int j=0;j<=w;j++){
			if (i==0||j==0)ans[i][j]=0;
			else if(knap[i-1].F<=j) ans[i][j]=max(knap[i-1].S+ans[i-1][j-knap[i-1].F],ans[i-1][j]);
			else ans[i][j]=ans[i-1][j];
		}
	}
	cout<<ans[n][w];
return 0;
}


Measured memory_bytes: 79232
N, K = map(int, input().split())
V = list(map(int, input().split()))
INF_MIN = -(10**10)
l = [[INF_MIN] * (K+1) for i in range(N+1)]
r = [[INF_MIN] * (K+1) for i in range(N+1)]

pop_sum = 0
for i in range(N+1):
    if i == 0:
        pop_sum = 0
        l[i][0] = 0
        r[i][0] = 0
        popV = []
    else:
        pop_sum += V[i-1]
        popV = list(sorted(V[0:i]))
        l[i][0] = pop_sum
    for k in range(1, K+1):
        if not (k-1 < len(popV)) or popV[k-1] > 0:
            l[i][k] = l[i][k-1]
        else:
            l[i][k] = l[i][k-1] - popV[k-1]

pop_sum = 0
for i in range(N+1):
    if i == 0:
        pop_sum = 0
        r[i][0] = 0
        popV = []
    else:
        pop_sum += V[N-i]
        popV = list(sorted(V[N-i:N]))
        r[i][0] = pop_sum
    for k in range(1, K+1):
        if not (k-1 < len(popV)) or popV[k-1] > 0:
            r[i][k] = r[i][k-1]
        else:
            r[i][k] = r[i][k-1] - popV[k-1]

#print(l)
#print(r)

max_val = INF_MIN
imax = min(N, K)
for i in range(imax+1):
    for k in range(K-i+1):
        jmax = min(N-i, K-i-k)
        for j in range(jmax+1):
            val = l[i][k] + r[j][K-i-k-j]
            if val > max_val:
                max_val = val
                #print(i, j, k, l[i][k], r[j][K-i-k-j])


print(max_val)


Measured memory_bytes: 3192
from collections import defaultdict
N, M = map(int, input().split())
X = [int(x) for x in input().split()]
X.sort()
Mod = [defaultdict(int) for _ in range(M)]
for x in X:
  Mod[x % M][x] += 1
cnt = 0
cnt += sum(list(Mod[0].values())) // 2
for i in range(1, -(-M // 2)):
  v1 = sum(list(Mod[i].values()))
  v2 = sum(list(Mod[M - i].values()))
  odd1 = sum([m % 2 for m in Mod[i].values()])
  odd2 = sum([m % 2 for m in Mod[M - i].values()])
  k = min(v1, v2)
  cnt += k
  if v1 == k:
    _k = k - min(odd2, k)
    cnt += (v2 - odd2 - _k) // 2
  else:
    _k = k - min(odd1, k)
    cnt += (v1 - odd1 - _k) // 2
if M % 2 == 0:
  cnt += sum(list(Mod[M // 2].values())) // 2
print(cnt)

Measured memory_bytes: 38620
#include<iostream>
using namespace std;
void print(int *num,int n){
	for(int i=0;i<n;i++){
		if(i>0) cout<<' ';
		cout<<num[i];
	}
	cout<<endl;
}
void insertSort(int *num,int n){
	int tmp;
	for(int i=1;i<n;i++){
		tmp=num[i];
		int j=i-1;
		while(j>=0&&num[j]>tmp){
			num[j+1]=num[j];
			j--;
		}
		num[j+1]=tmp;
		print(num,n);
	}
}
int main(){
	int n;
	int num[100];
	cin>>n;
	for(int i=0;i<n;i++) cin>>num[i];
	print(num,n);
	insertSort(num,n);
}

Measured memory_bytes: 3088
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
sys.setrecursionlimit(10**7)
# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###

N = ii()
ups = list(mi())
downs = list(mi())

maxval = 0
for i in range(N):
  maxval = max(maxval, sum(ups[0:i+1]) + sum(downs[i:N]))


print(maxval)




Measured memory_bytes: 38640
package main

import (
	"fmt"
	"os"
)

func main() {
	var h, n, a int
	fmt.Scan(&h, &n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		h -= a
		if h <= 0 {
			fmt.Println("Yes")
			os.Exit(0)
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 5504
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let (n, m): (usize, usize) = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        let mut ws = s.split_whitespace();
        let a = ws.next().unwrap().parse().unwrap();
        let b = ws.next().unwrap().parse().unwrap();
        (a, b)
    };

    let (larger, smaller) = if n < m { (m, n) } else { (n, m) };

    let mut s = String::new();
    for _ in 0..larger {
        s.push_str(&smaller.to_string());
    }

    println!("{}", s);
}


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

int f(char c){
  if(c=='J') return 4;
  else if(c=='O') return 2;
  else if(c=='I') return 1;
}

int main(){
  int n,dp[1001][8];
  char s[1000];
  scanf("%d %s",&n,s);
  fill(dp[0],dp[0]+8,0);
  dp[0][4] = 1;
  for(int i=1;i<=n;i++){
    for(int j=0;j<8;j++){
      dp[i][j] = 0;
      if((j&f(s[i-1]))==0) continue;
      for(int k=0;k<8;k++){
        if((j&k)!=0) dp[i][j]+=dp[i-1][k];
        dp[i][j]%=10007;
      }
    }
  }
  int ans = 0;
  for(int i=0;i<8;i++){
    ans+=dp[n][i];
    ans%=10007;
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 2760
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int n, ans;
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int l, r;
		cin >> l >> r;
		ans += r - l + 1;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,K,S;
    cin >> N >> K >> S;
    for(int i = 0; i < N; i++) {
        if(i < K) {
            cout << S;
        }
        else {
            if(S == INF) {
                cout << 1;
            }
            else {
                cout << INF;
            }
        }
        if(i+1 != N) {
            cout << " ";
        }
    }
}

Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;



int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ios_base& scientific (ios_base& str);

ll a, b;
cin >> a >> b;
ll max1 = max(a*b, max(a+b, a-b));
cout << max1;


return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    int K;
    cin >> K;

    if (K % 2 == 0) {
        cout << -1 << endl;
        return 0;
    }

    if (K % 7 == 0) {
        K /= 7;
    }

    int base = 1;
    int currMod = 1;
    int ans = 1;
    while (ans <= 1100000 && currMod % K != 0) {
        base = (base * 10) % K;
        currMod = (currMod + base) % K;
        ++ans;
    }
    if (1000000 < ans) {
        ans = -1;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3608
import copy
s = list(input())
c = copy.copy(s)
n = len(s)
cnt1 = cnt2 = 0
for i in range(n-1):
    if c[i+1]==c[i]:
        cnt1 += 1
        c[i+1] = '0' if c[i+1]=='1' else '1'
s[0] = '0' if s[0]=='1' else '1'
cnt2+=1
for i in range(1,n):
    if s[i-1]==s[i]:
        cnt2 += 1
        s[i] = '0' if s[i]=='1' else '1'
print(min(cnt1,cnt2))

Measured memory_bytes: 5160
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll x , y;
    cin >> x >> y;
    cout << x + (y/2)   << endl;
}


Measured memory_bytes: 256
#pragma comment (linker, "/STACK:256000000")
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T, class U>using vp = vector<pair<T, U>>;
template<class T>using vv = vector<vector<T>>; template<class T, class U>using vvp = vv<pair<T, U>>;
template<class T>vv<T> vvec(const size_t n, const size_t m, const T v) { return vv<T>(n, vector<T>(m, v)); }
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; }
constexpr ll pow2(const int n) { return 1ll << n; }
constexpr int INF = 1 << 28; constexpr ll LINF = 1ll << 60;
constexpr int MAX = 1e5 + 5; constexpr int MOD = 1e9 + 7; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }; constexpr int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int N, Q;
string S;
vector<char> T, D;

int main() {
    cin >> N >> Q >> S;
    T.resize(Q);
    D.resize(Q);
    rep(i, Q) {
        cin >> T[i] >> D[i];
    }
    reverse(all(T));
    reverse(all(D));

    int l = 0;
    int r = N - 1; // ゴーレムの端
    int lmax = l - 1;
    int rmin = r + 1;
    rep(i, Q) {
        //if (l < N && D[i] == 'L' && S[l] == T[i]) {
        //    l++;
        //    chmax(lmax, l - 1);
        //}
        //else if (-1 < r && r < N - 1 && D[i] == 'R' && S[r] == T[i]) {
        //    r--;
        //    chmin(rmin, r + 1);
        //}

        //if (0 < l && D[i] == 'R' && S[l] == T[i]) {
        //    if (l == lmax) lmax--;
        //    l--;
        //}
        //else if (r < N - 1 && D[i] == 'L' && S[r] == T[i]) {
        //    if (r == rmin) rmin++;
        //    r++;
        //}
        if (l <= N - 1 && D[i] == 'L' && S[l] == T[i]) {
            l++;
            chmax(lmax, l - 1);
        }
        else if (0 <= r && D[i] == 'R' && S[r] == T[i]) {
            r--;
            chmin(rmin, r + 1);
        }

        if (0 < l && D[i] == 'R' && S[l - 1] == T[i]) {
            //if (l == lmax) lmax--;
            l--;
        }
        else if (r < N - 1 && D[i] == 'L' && S[r + 1] == T[i]) {
            //if (r == rmin) rmin++;
            r++;
        }
    }

    //write(max(0, rmin - lmax - 1));
    write(max(0, r - l + 1));
}

Measured memory_bytes: 976
def solve(n):
    table = [0 for i in range(N + 1)]
    for i in range(1, n + 1):
        if i == 1:
            table[1] = 0
        elif i == 2:
            table[2] = abs(H[2] - H[1])
        else:
            table[i] = min(
                table[i - 1] + abs(H[i] - H[i - 1]), table[i - 2] + abs(H[i] - H[i - 2])
            )
    return table[n]


if __name__ == "__main__":
    N = int(input())
    H = [0] + [int(x) for x in input().split(" ")]

    print(solve(N))


Measured memory_bytes: 90616
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

void solve(ll n,ll m){
    vector<ll> a(n),b(n);
    rep(i,n){cin >> a[i];a[i]--;}
    rep(i,n){cin >> b[i],b[i]--;}
    vector<ll> c(n);
    rep(i,n) c[i] = (b[i]-a[i]+m)%m;

    //cout << c << endl;

    // dp[i][j] := i番目までを見たときにi番目がc[i]+jm回操作しているときの最小回数
    vector<vector<ll>> dp(n+5,vector<ll>(n+5,n*m+10));
    for(int i=0;i<=n;i++){
        dp[0][i] = c[0] + i * m;
    }

    for(int i=1;i<n;i++){
        for(int j=0;j<=n;j++){
            for(int k=max<ll>(0,j-3);k<=min<ll>(n,j+3);k++){
                dp[i][j] = min(dp[i][j], dp[i-1][k] + max(0ll,(c[i]+j*m) - (c[i-1]+k*m)));
            }
        }
    }

    ll ans = LINF;
    for(int i=0;i<=n;i++){
        ans = min(ans, dp[n-1][i]);
    }
    cout << ans << endl;

    /* for(int i=0;i<=n;i++){ */
    /*     for(int j=0;j<=m;j++){ */
    /*         cout << dp[i][j] << "\t"; */
    /*     } */
    /*     cout << endl; */
    /* } */
}

int main(){
    while(true){
        int n,m; cin >> n >> m;
        if(n==0 and m==0) break;
        solve(n,m);
    }
}



Measured memory_bytes: 10736
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n) - 1; i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

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

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

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

const int N = 1e5 + 10;
int p[N];

int get(int u) {
    return u == p[u] ? u : (p[u] = get(p[u]));
}

void unite(int u, int v) {
    u = get(u);
    v = get(v);
    p[u] = v;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    int n, m;
    cin >> n >> m;
    if (m == n - 1) {
        cout << 0 << '\n';
        return 0;
    }
    forn(i, 0, n) p[i] = i;
    vector<int> a(n);
    forn(i, 0, n) cin >> a[i];
    forn(i, 0, m) {
        int u, v;
        cin >> u >> v;
        unite(u, v);
    }
    vector<pair<int, int>> vals;
    forn(i, 0, n) vals.eb(a[i], get(i));
    sort(all(vals));
    vector<int> cnt(n);
    int lim = n - 1 - m;
    int num = 0;
    ll sum = 0;
    for (auto& pr : vals) {
        int val = pr.fs, comp = pr.sn;
        if (cnt[comp] == 0) {
            ++cnt[comp];
            ++num;
            sum += val;
            pr.sn = -1;
        }
    }
    for (auto pr : vals) {
        int val = pr.fs, comp = pr.sn;
        if (comp == -1) continue;
        if (cnt[comp] == lim) continue;
        ++cnt[comp];
        sum += val;
        ++num;
        if (num == 2 * lim) break;
    }
    if (num == 2 * lim) cout << sum << '\n';
    else cout << "Impossible\n";
}


Measured memory_bytes: 2168
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

const int N = 1e6 + 10;
char s[N];
int dp[N][2];
int n;

int solve(int pos, int carry) {
  if (pos == n) return carry ? INF : 0;
  int& ret = dp[pos][carry];
  if (ret >= 0) return ret;
  int x = s[pos] - '0';
  if (carry) x -= 10;
  ret = abs(x) + solve(pos + 1, 0);
  ret = min(ret, abs(x + 1) + solve(pos + 1, 1));
  return ret;
}

int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  s[0] = '0';
  n += 1;
  memset(dp, 255, sizeof(dp));
  int ret = solve(0, 0);
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 40320
import numpy as np
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
from operator import itemgetter

N = int(input())
P = []
for i in range(N):
  x,y = map(int, input().split())
  P.append((x,y,i))
  
data = [10, 20, 30, 40]
row = [0, 0, 1, 1]
col = [1, 2, 0, 2]

#print(csr_matrix((data, (row, col))).toarray())
  
data = []
row = []
col = []

P.sort() 
D = {}
for i in range(N-1):
  a,b,p = P[i]
  c,d,q = P[i+1]
  cost = min(abs(a-c), abs(b-d))
  data.append(cost)
  row.append(p)
  col.append(q)
  data.append(cost)
  row.append(q)
  col.append(p)
  D[(p,q)] = cost
  D[(q,p)] = cost

P.sort(key=itemgetter(1))
for i in range(N-1):
  a,b,p = P[i]
  c,d,q = P[i+1]
  if (p,q) in D:
    continue
  cost = min(abs(a-c), abs(b-d))
  data.append(cost)
  row.append(p)
  col.append(q)
  data.append(cost)
  row.append(q)
  col.append(p)
  D[(p,q)] = cost
  D[(q,p)] = cost

coo = coo_matrix((data, (row, col)), (N, N))
mst = minimum_spanning_tree(coo)
print(int(mst.sum()))

Measured memory_bytes: 133988
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
    string a,b,s;
    cin >> a >> b;
    s = a+b;
    int S = stoi(s);
    
    for(int i=0;i<1000;i++){
        if(S==pow(i,2)){
            cout << "Yes" <<endl;
            return 0;
    }
    }
    cout << "No" << endl;
        return 0;
    }


Measured memory_bytes: 256
S = input()

beautify = lambda s: s.rstrip('+').lstrip('+').replace('++', '+')

def dfs(depth, formula):
    if depth+1 >= len(formula):
        return eval(beautify(formula))

    res = 0
    res += dfs(depth+2, "{}{}{}".format(
        formula[:depth+1],
        '+',
        formula[depth+1:],
    ))
    res += dfs(depth+1, formula)

    return res

ans = dfs(0, S)
print(ans)


Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int memo[50], isok[50] = { 0 };

int fib(int n) {
	if (isok[n])
		return memo[n];
	else {
		isok[n] = 1;
		return memo[n] = fib(n - 1) + fib(n - 2);
	}
}

int main(void) {
	int n;

	memo[0] = 1, memo[1] = 1;
	isok[0] = 1, isok[1] = 1;

	scanf("%d", &n);

	printf("%d\n", fib(n));

	return 0;
}


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

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    if(c-b <= 0)cout << "delicious" << endl;
    else if(c-b <= a)cout << "safe" << endl;
    else cout << "dangerous" << endl;
}

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

using namespace std;


const int mod = 1e9 + 7;

struct mint {
  int n;
  mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { return (a.n += b.n) >= mod ? a.n - mod : a.n; }
mint operator-(mint a, mint b) { return (a.n -= b.n) < 0 ? a.n + mod : a.n; }
mint operator*(mint a, mint b) { return 1LL * a.n * b.n % mod; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }
ostream &operator<<(ostream &o, mint a) { return o << a.n; }

mint dp[101][8];

int main() {
  int h, w, K;
  cin >> h >> w >> K;

  dp[0][0] = 1;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      for (int k = 0; k < 1 << w - 1; k++) {
        bool valid = true;
        for (int l = 0; l + 1 < w - 1; l++) {
          valid &= (~k >> l & 1) || (~k >> l + 1 & 1);
        }
        if (!valid) continue;
        if (j > 0 && (k >> j - 1 & 1)) {
          dp[i + 1][j - 1] += dp[i][j];
        } else if (k >> j & 1) {
          dp[i + 1][j + 1] += dp[i][j];
        } else {
          dp[i + 1][j] += dp[i][j];
        }
      }
    }
  }
  cout << dp[h][K - 1] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
#define ll long long
/*int min(int a,int b){
	return a>b?b:a;
}
int abs(int a){
	return a>0?a:-a;
}
ll gcd(ll a,ll b){
	if(b==0){
		return a;
	}
	else if(a>b){
		return gcd(b,a%b);
	}
	else {
		return gcd(a,b%a);
	}
}*/
int main(){
	vector<pair<int,int> > v;//first deadline then duration
	int n,fst,snd,sum=0,flag=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>snd>>fst;
		v.push_back(make_pair(fst,snd));
	}
	sort(v.begin(),v.end());
	for(int i=0;i<n;i++){
		sum+=v[i].second;
		if(sum>v[i].first){
			cout<<"No";
			flag =1;
			return 0;
		}
	}
	if(flag==0){
		cout<<"Yes";
	}
	return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define MOD 1000000007

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int m = ri();
	int q = ri();
	std::string s[n];
	for (int i = 0; i < n; i++) std::cin >> s[i];
	
	std::vector<std::vector<int> > k(n + 1, std::vector<int>(m + 1));
	std::vector<std::vector<int> > yok(n, std::vector<int>(m + 1));
	std::vector<std::vector<int> > tat(n + 1, std::vector<int>(m));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (s[i][j] == '1') {
				k.at(i + 1).at(j + 1)++;
				if (i + 1 < n && s[i + 1][j] == '1') yok.at(i + 1).at(j + 1)++;
				if (j + 1 < m && s[i][j + 1] == '1') tat.at(i + 1).at(j + 1)++;
			}
		}
	}
	for (int i = 1; i < n; i++) {
		for (int j = 1; j <= m; j++) {
			k.at(i + 1).at(j) += k.at(i).at(j);
			if (j < m) tat.at(i + 1).at(j) += tat.at(i).at(j);
			if (i + 1 < n) yok[i + 1][j] += yok[i][j];
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j < m; j++) {
			k[i][j + 1] += k[i][j];
			if (i < n) yok[i][j + 1] += yok[i][j];
			if (j + 1 < m) tat[i][j + 1] += tat[i][j];
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= m; j++) {
			std::cerr << yok[i][j] << " ";
		}
		std::cerr << std::endl;
	}
	for (int i = 0; i < q; i++) {
		int x1 = ri() - 1, y1 = ri() - 1, x2 = ri() - 1, y2 = ri() - 1;
		int res = k[x2 + 1][y2 + 1] - k[x2 + 1][y1] - k[x1][y2 + 1] + k[x1][y1];
		res -= yok[x2][y2 + 1] - yok[x1][y2 + 1] - yok[x2][y1] + yok[x1][y1];
		res -= tat[x2 + 1][y2] - tat[x1][y2] - tat[x2 + 1][y1] + tat[x1][y1];
		std::cout << res << std::endl;
	}
	
	return 0;
}



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

using namespace std;

#define FOR(i,n,m) for(int i=n;i<m;++i)
#define ROF(i,n,m) for(int i=n;i>m;--i)
#define pb push_back
#define ll long long

const int INF = 0x3f3f3f3f;



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

    string s;
    cin >> s;
    s[0] = '2'; s[1] = '0'; s[2] = '1'; s[3] = '8';
    cout << s << '\n';

    return 0;
}

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

int main() {
    ll n;
    std::cin >> n;
    vector<ll> a(n),b(n);
    ll s = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        b[i] = a[i];
        s += a[i];
    }
    sort(b.begin(),b.end());
    vector<ll> sum(n+1,0);
    for (int i = 0; i < n; i++) {
        sum[i+1] = sum[i]+b[i];
    }
    ll rem = s;
    ll now = 0;
    for (int i = 0; i < n; i++) {
        if(now>=a[i]){
            std::cout << 0 << std::endl;
            continue;
        }
        now = a[i];
        auto idx = distance(b.begin(),upper_bound(b.begin(),b.end(),now));
        std::cout << rem-(sum[n]-sum[idx]-now*(n-idx)) << std::endl;
        rem -= rem-(sum[n]-sum[idx]-now*(n-idx));
    }
}


Measured memory_bytes: 5632
#include<stdio.h>
#include<math.h>
#include<string.h>
#define T 1000000007
int main() {
	long long int a,sum=1;
	scanf("%lld",&a);
	for(int i=1;i<=a;i++){
		sum=(sum*i)%T;
	}
	printf("%lld",sum);
	return 0;
}

Measured memory_bytes: 128
# C - Tsundoku
def main():
    n, m, k = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    a, b = [0], [0]

    for i in range(n):
        a.append(a[i] + A[i])
    for i in range(m):
        b.append(b[i] + B[i])

    ans, j = 0, m

    for i in range(n+1):
        if a[i] > k:
            break
        while b[j] > k - a[i]:
            j -= 1
        ans = max(ans, i + j)
    print(ans)
            


    
if __name__ == '__main__':
    main()

Measured memory_bytes: 47484
import sys
si = sys.stdin.readline


def main():
    s = si()[:-1]
    m, cnt = 0, 0
    for e in s:
        if e == 'R':
            cnt += 1
        elif e == 'S':
            cnt = 0
        m = max(m, cnt)
    print(m)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9044
import sys
C = [0] * 26
S = input()
N = len(S)
for s in S:
    C[ord(s) - ord('a')] += 1
if N < 26:
    for i in range(26):
        if C[i] == 0:
            print(S + chr(i + ord('a')))
            sys.exit()
else:
    V = [S[N - 1]]
    i = N - 2
    while i >= 0:
        for v in V:
            if S[i] < v:
                print(S[:i] + v)
                sys.exit()
        V.append(S[i])
        V.sort()
        i -= 1
    print(-1)


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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}


bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;



int main() {
    int t;
    cin >> t;
    rep(_, t) {

        bool ok = []() -> bool {
            ll a, b, c, d;
            cin >> a >> b >> c >> d;
            if (b > a) return false;
            if (b > d) return false;
            if (c >= b) return true;

            ll g = __gcd(b, d);
            ll ma = b - g + (a % g);
            if (ma > c) return false;
            return true;


        }();
        cout << (ok ? "Yes" : "No") << endl;
    }


}


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

int main()
{
	double w, h, x, y;
	cin >> w >> h >> x >> y;
	cout << w * h / 2.0 << " " << (x * 2.0 == w && y * 2.0 == h ? "1" : "0") << endl;
	return 0;
}

Measured memory_bytes: 380
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const int INF=1000100010;
int main(){
  int n,m,x;cin>>n>>m>>x;
  int c[n];
  vector<vector<int>> a(n,vector<int>(m));
  rep(i,n){
    cin>>c[i];
    rep(j,m){
      cin>>a[i][j];
    }
  }
  int ans=INF;
  rep(bit,1<<n){
    int sum=0;
    int abi[m]={0};
    rep(i,n){
    if(bit>>i&1){
       sum+=c[i];
       rep(j,m){
       abi[j]+=a[i][j];
       }
    }
  }
    bool ok=true;
    rep(j,m)if(abi[j]<x)ok=false;
    if(ok)ans=min(ans,sum);
 }
 if(ans==INF)cout<<-1<<endl;
 else cout<<ans<<endl;
 return 0;
}

Measured memory_bytes: 3612
package main

import "fmt"

func allsum(num int) int {
	sum := 0
	for num > 0 {
		sum += num % 10
		num = num / 10
	}
	return sum
}

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)

	nums := []int{}

	for i := a; i <= n; i++ {
		sum := allsum(i)
		if a <= sum && sum <= b {
			nums = append(nums, i)
		}
	}

	res := 0
	for i := 0; i < len(nums); i++ {
		res += nums[i]
	}
	fmt.Println(res)
}


Measured memory_bytes: 896
#![allow(non_snake_case,unused_imports)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let N = buf_it.next().unwrap().parse::<usize>().unwrap();
    let M = 60;
    let A:Vec<_> = (0..N).map(|_| buf_it.next().unwrap().parse::<usize>().unwrap()).collect();

    let MOD:usize = 1_000_000_007;
    
    let mut C:Vec<usize> = (0..M).map(|_| 0).collect();
    for &a in &A{
        for i in 0..M{
            if (a>>i)&1==1{
                C[i] += 1;
            }
        }
    }

    let mut ans:usize = 0;
    
    for &a in &A{
        for i in 0..M{
            if (a>>i)&1==1{
                ans += ((1<<i)%MOD)*((N-C[i])%MOD)%MOD;
            } else {
                ans += ((1<<i)%MOD)*((C[i])%MOD)%MOD;
            }
            ans %= MOD
        }
    }
    ans *= (MOD+1)/2;
    ans %= MOD;
    println!("{}",ans);

}


Measured memory_bytes: 13688
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
#define long long long // for codeforces

int main(){
  string s;
  cin>>s;
  int ans = 0;
  for(char c : s) if(c=='1') ans++;
  cout << ans << endl;

  return 0;
}


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

int main(){
  int N;
  cin >> N;
  int64_t Ans=0;
  vector<vector<char>> S(N, vector<char>(10));
  for(int i=0; i<N; i++){
    for(int j=0; j<10; j++){
      cin >> S.at(i).at(j);
    }
    sort(S.at(i).begin(), S.at(i).end());
  }
  sort(S.begin(), S.end());
  int64_t now=0;
  for(int i=0; i<N; i++){
    if(i==0){
      now++;
    }
    else if(S.at(i)==S.at(i-1)){
      now++;
    }
    else{
      Ans+=now*(now-1)/2;
      now=1;
    }
  }
  Ans+=now*(now-1)/2;
  cout << Ans << endl;
}
    

Measured memory_bytes: 5760
S = list(input())
flag = 0
ans_1 = 0
ans_2 = 0
# 最初を変える
S1 = S[0]
if (S1 == "0"):
    flag_a = 1
else:
    flag_a = 0
for i in range(1, len(S)):
    if (flag_a == 0):
        if (S[i] == "1"):
            ans_1 += 1
        flag_a = 1
    else:
        if (S[i] == "0"):
            ans_1 += 1
        flag_a = 0
if (len(S) != 1):
    if (S[0] != S[1]):
        ans_1 = 1000000

# 最初を変えない
S1 = S[0]
if (S1 == "1"):
    flag_b = 1
else:
    flag_b = 0
for i in range(1, len(S)):
    if (flag_b == 0):
        if (S[i] == "0"):
            ans_2 += 1
        flag_b = 1
    else:
        if (S[i] == "1"):
            ans_2 += 1
        flag_b = 0
if (len(S) != 1):
    if (S[0] == S[1]):
        ans_2 = 1000000

print(min(ans_1, ans_2))


Measured memory_bytes: 4084