akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! flush {
    () => {
        std::io::stdout().flush().unwrap();
    };
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let a = sc.chars();
    let b = sc.chars();
    let mut ans = a.len();
    for i in 0..a.len() - b.len() + 1 {
        ans = min!(ans, (0..b.len()).filter(|&j| a[i + j] != b[j]).count());
    }
    put!(ans);
}

use std::collections::VecDeque;
use std::io::{self, Write};
use std::str::FromStr;

struct Scanner {
    stdin: io::Stdin,
    buffer: VecDeque<String>,
}
impl Scanner {
    fn new() -> Self {
        Scanner {
            stdin: io::stdin(),
            buffer: VecDeque::new(),
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.is_empty() {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.cin::<String>().chars().collect()
    }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.cin()).collect()
    }
}


Measured memory_bytes: 2128
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll n;
    cin >> n;
    vector<ll> h(n);
    rep(i,0,n) cin>>h[i];

    ll ans (0); 
    ll cur (0);

    rep(i,0,n)    
    {
        if (cur >= h[i])
            cur = h[i];
        else
            ans += h[i] - cur, cur = h[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n = 0;
    cin >> n;
    long A[100000],B[100000];
    for(int i = 0; i < 100000; i++){
        A[i] = 0;
        B[i] = 0;
    }
    cin >> A[0];
    B[0] = A[0];
    int m = 1;
    for(int i = 1; i < n; i++){
        cin >> A[i];
        if(A[i] != A[i-1]){
            B[m] = A[i];
            m++;
        }
    }
    for(int i = 0; i < m-1; i++){
        cout << B[i] << " ";
    }
    cout << B[m-1] << endl;
    return 0;
}



Measured memory_bytes: 4664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  int a,b;
  cin >> a >> b;
  if(a == 1&& b == 2)cout << 3 <<endl;
  if(a == 1&& b == 3)cout << 2 <<endl;
  if(a == 2&& b == 3)cout << 1 <<endl;
  if(a == 2&& b == 1)cout << 3 <<endl;
  if(a == 3&& b == 1)cout << 2 <<endl;
  if(a == 3&& b == 2)cout << 1 <<endl;
  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    REP(i,n){
        char c;
        cin >> c;
        if(c=='Y'){
            cout << "Four\n";
            return 0;
        }
    }
    cout << "Three\n";
    return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 11100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

int main(){
	int a;scanf("%d",&a);
	int cur=7%a;
	int ret=1;
	while(cur){
		cur=(cur*10+7)%a;
		ret++;
		if(ret>a){
			ret=-1;break;
		}
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 1720
N,A,B = map(int,input().split())
if A > B:
    print(0)
    exit()
if N == 1 and A != B:
    print(0)
    exit()
elif N == 1 and A == B:
    print(1)
    exit()


print( (B*(N-1) + A) - (A*(N-1) +B) + 1 )


Measured memory_bytes: 2940
ABCD = input()
A,B,C,D = [int(ABCD[i]) for i in range(4)]

for op1 in range(2):
    for op2 in range(2):
        for op3 in range(2):
            if A + ((-1)**op1)*B + ((-1)**op2)*C + ((-1)**op3)*D == 7:
                ans = str(A)
                if op1 == 0:
                    ans += "+"
                else:
                    ans += "-"
                ans += str(B)
                if op2 == 0:
                    ans += "+"
                else:
                    ans += "-"
                ans += str(C)
                if op3 == 0:
                    ans += "+"
                else:
                    ans += "-"
                ans += str(D)
                ans += "=7"
                print(ans)
                break
        else:
            continue
        break
    else:
        continue
    break


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N, Y;
    cin >> N >> Y;
    for (int oneThousand = 0; oneThousand <= N; ++oneThousand) {
        for (int fiveThousand = 0; fiveThousand <= N - oneThousand; ++fiveThousand) {
            if (Y == oneThousand * 1000 + fiveThousand * 5000 + (N - oneThousand - fiveThousand) * 10000) {
                printf("%d %d %d\n", N - oneThousand - fiveThousand, fiveThousand, oneThousand);
                return 0;
            }
        }
    }
    printf("%d %d %d\n", -1, -1, -1);
}

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

int R, C;
int dr[] = {-1, 0, 1, 0};
int dc[] = {0, 1, 0, -1};
char grid[MAXR + 3][MAXR + 3];

int getMaxDistance(int r, int c) {
    int dist[MAXR + 3][MAXR + 3];
    memset(dist, -1, sizeof(dist));

    queue<pair<int, int> > Q;
    Q.push({r, c});

    dist[r][c] = 0;

    int maxi = 0;
    while (!Q.empty()) {
        auto front = Q.front(); Q.pop();
        int ur = front.first, uc = front.second;

        for (int dir = 0; dir < 4; dir++) {
            int vr = ur + dr[dir];
            int vc = uc + dc[dir];

            if (vr >= 1 && vr <= R && vc >= 1 && vc <= C && grid[vr][vc] == '.' && dist[vr][vc] == -1) {
                dist[vr][vc] = dist[ur][uc] + 1;
                Q.push({vr, vc});

                maxi = max(maxi, dist[vr][vc]);
            }
        }
    }

    return maxi;
}

int main() {
    cin >> R >> C;
    for (int i = 1; i <= R; i++) {
        for (int j = 1; j <= C; j++) {
            cin >> grid[i][j];
        }
    }

    int maxi = 0;
    for (int i = 1; i <= R; i++) {
        for (int j = 1; j <= C; j++) {
            if (grid[i][j] == '.') {
                maxi = max(maxi, getMaxDistance(i, j));
            }
        }
    }

    cout << maxi << endl;
}


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

int main(){
  char A;
  cin >> A;
  int a=0;
  for (char c = 'A' ; c <= 'Z';c++){
    if(A==c){
      a=1;
    }
  }
  if(a==1){
    cout << 'A' <<endl;
  }
  else{
    cout << 'a' <<endl;
  }
}

  

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

int N=100;
int INF = 1234567890;
int n,M[100][100];
int d[100];
void bfs(int s){
  queue<int> q;
  q.push(s);
  for(int i=0;i<n;i++) d[i] = INF;
  d[s]=0;
  int u;
  while(!q.empty()){
    u = q.front();
    q.pop();
    for(int v=0;v<n;v++){
      if(M[u][v]==0) continue;
      if(d[v]!=INF) continue;
      d[v]=d[u]+1;
      q.push(v);
    }
  }
  for(int i=0;i<n;i++){
    if(d[i]==INF) cout<<i+1<<" "<<-1<<endl;
    else cout<<i+1<<" "<<d[i]<<endl;
  }
}

int main() {
int u,k,v;
cin>>n;
for(int i=0;i<n;i++) for(int j=0;j<n;j++) M[i][j]=0;

for(int i=0;i<n;i++) {
  cin>>u>>k;
  u--;
  for(int j=0;j<k;j++){
  cin>>v;
  v--;
  M[u][v]=1;
  }
}
  bfs(0);

}



Measured memory_bytes: 3124
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

def main():
    s = input()
    K = int(input())
    c = Counter(s)

    se = set()
    for k, v in sorted(c.items()):
        for i in range(len(s)):
            for n in range(1, 6):
                if s[i] == k and i + n <= len(s):
                    se.add(s[i:i+n])
        if len(se) > K:
            break

    print(list(sorted(list(se)))[K - 1])

if __name__ == '__main__':
    main()


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

int main()
{
    int n;

    cin >> n;

    for (int i = 1; i <= n; i++) {
        int x = i;
        if (x % 3 == 0) {
            cout << ' ' << i;
            continue;
        }
        while (x) {
            if (x % 10 == 3) {
                cout << ' ' << i;
                break;
            }
            x /= 10;
        }
    }
    cout << endl;
}


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

ll N, M, A, B;


void search(int start, vector<vector<ll>> &path, vector<ll> &dis, vector<ll> &prev) {
    priority_queue<P, vector<P>, greater<P>> pq;
    dis.at(start) = 0;
    pq.emplace(dis.at(start), start);
    while (!pq.empty()) {
        P p = pq.top();
        pq.pop();
        int room = p.second;
        if (dis.at(room) < p.first) continue;
        for (auto &x : path.at(room)) {
            if (dis.at(x) > dis.at(room) + 1) {
                dis.at(x) = dis.at(room) + 1;
                prev.at(x) = room;
                pq.emplace(dis.at(x), x);
            }
        }
    }
}

int main() {
    cin >> N >> M;
    vector<vector<ll>> path(N+1);
    vector<ll> dis(N+1, INFINITY), prev(N+1, -1);
    rep(i,M) {
        cin >> A >> B;
        path.at(A).push_back(B);
        path.at(B).push_back(A);
    }
    for (int i = 1; i <= N; ++i) {
        if (path.at(i).empty()) {
            cout << "No" << endl;
            return 0;
        }
    }

    search(1, path, dis, prev);
    cout << "Yes" << endl;
    for (int i = 2; i <= N; ++i) cout << prev.at(i) << endl;
}



Measured memory_bytes: 14332
import numpy as np
n, m = list(map(int,(input().split())))
a = np.array(list(map(int,(input().split()))))

all_b = sum(a)
t = 1/(4*m)*all_b
#all_t =a*t

ans = np.where(a>=t)
#print(ans)
#print(all_b[all_b >t])
#print(all_b,t)
#print(len(ans[0]))
if len(ans[0]) >= m:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 12500
n = int(input())
a_n = list(map(int, input().split()))

b_n = sorted(a_n)
flg = 0

for i in range(n - 1):
    if b_n[i] == b_n[i + 1]:
        flg = 1

if flg == 1:
    print("NO")
else:
    print("YES")

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

using namespace std;

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

int main(){
    string str;cin>>str;
    map<char,bool> data;
    REP(i,str.length()){
        data[str[i]]=true;
    }
    for(int i=0;i<='z'-'a';i++){
        if(data.count('a'+i)==0){
            cout<<(char)('a'+i)<<endl;
            return 0;
        }
    }
    cout<<"None"<<endl;
    return 0;
}

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define BIT(bit,a,n) for (int bit = a;bit < (1<<n);bit++) // {0, 1, ..., n-1} の部分集合の全探索 // n番目のフラグが立っている状態は (1<<n)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20

typedef long long ll;
using namespace std;

int n,k;
int ans = 1;
int main() {
    scanf("%d%d",&n,&k);
    rep(i,1,n+1){
        ans = min(ans+k,ans*2);
    }
    pout(ans);
    return 0;
}

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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

int cnt = 0;


void solve()
{
	int n; cin >> n;
	vector<int> a(n), b(n);
	forn(i, n)
	{
		cin >> a[i];
	}
	forn(i, n)
	{
		cin >> b[i];
	}
	ll res = 0;
		ll cnt = 0;
		for (int j = 0; j < n; ++j)
		{
			cnt = 0;
			for (int k = 0; k < n; ++k)
			{
				if (k < j)
				{
					cnt += a[k];
				}
				else if (k == j) 
				{
					cnt += b[k];
					cnt += a[k];
				}
				else cnt += b[k];
			}
			res = max(res, cnt);
		}
		//res = max(res, cnt);
	cout << res;
}

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


Measured memory_bytes: 3608
#include<stdio.h>
int main() {
	int a, b, c, d, e;
	scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
	if (a >= c + e && b >= d + e && 0 <= c - e && 0 <= d - e) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 2692
// 079 B - Lucas Number 2017/11/18
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

int main(){
    int n; cin >> n;
    uint64 a[n+1];
    a[0]=2; a[1]=1; 
    for(int i=2;i<=n;++i){
        a[i]=a[i-1]+a[i-2];
    }
    cout << a[n] << endl;
}

Measured memory_bytes: 256
using System;

namespace abc099A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            if (N > 999)
            {
                int A = N - 999;
                Console.WriteLine("ABD");
            }
            else
                Console.WriteLine("ABC");
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#include <iostream>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
//#define mod 1e9+7 // was not working
//const int mod=1e9+7; //works kool

vector<double>P(3000, 0.0);
vector<vector<double>>dp(3000,vector<double>(3000, 0.0));

int main() {
    fast;
    int N;
    cin>>N;
    
    
    for(int i=1;i<=N;i++)
       cin>>P[i];
    
    
    dp[0][0]=1.0;
    
    for(int i=1;i<=N;i++){
        for(int j=0;j<=N;j++){
            if(j==0)
                dp[i][j] = dp[i-1][j]*(1-P[i]);
            else{
                dp[i][j] = dp[i-1][j-1]*P[i] + dp[i-1][j]*(1-P[i]); //j heads till last coin so prob of tail here
            }
        }
    }

    double ans=0.0;
    
    for(int i=(N+1)/2;i<=N;i++)
        ans+=dp[N][i];
    
    printf("%.9f",ans);
    return 0;
}


Measured memory_bytes: 70784
def main():
    cells, can_jump = [int(x) for x in input().split()]
    jumps_from = [int(x) - 1 for x in input().split()]
    score_on = [int(x) for x in input().split()]

    ans = - 10**10
    for start in range(cells):
        route = []
        position = start
        while True:
            route.append(score_on[position])
            position = jumps_from[position]
            if position == start:  # Looped
                break

        length = len(route)
        total = sum(route)
        accum = 0
        for jumping, score in enumerate(route):
            jumping += 1
            accum += score
            if jumping > can_jump:
                break
            candidate = accum
            if total > 0:
                candidate += total * ((can_jump - jumping) // length)
            ans = max(ans, candidate)
    return ans


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


Measured memory_bytes: 83836
#!/usr/bin/env python3
import sys


def solve(N: int, T: int, t: "List[int]"):
    a = [[t[0]]]
    for tt in t[1:]:
        if a[-1][-1] + T < tt:
            a.append([tt])
        else:
            a[-1].append(tt)
    b = [aa[-1] - aa[0] + T for aa in a]    
    return sum(b)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    t = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, T, t))

def test():
    import doctest
    doctest.testmod()

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


Measured memory_bytes: 36120
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  string s; cin >> s;
  ll res = 1000;
  for (int i = 0; i <= s.size() - 3; ++i) {
    ll t = 0;
    t += 100 * (s[i] - '0');
    t += 10 * (s[i+1] - '0');
    t += s[i+2] - '0';
    if (abs(t-753) < res) res = abs(t-753);

  }

  cout << res << endl;
}


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

int main() { 
  string s,l,r; cin >> s;
  int size = s.size();
  
  if( s == "keyence") { cout << "YES\n"; return 0; }
  
  for(int i = 0;i < size;i++) {
    for(int j = i;j < size;j++) {
      l = s.substr(0,i);
      r = s.substr(j+1,size-1-j+1);
      if(l+r == "keyence") {
        cout << "YES\n";
        return 0;
      }
    }
  }
  
  cout << "NO\n";
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        
        int count = 0;
        
        // board[i][j]: 迷路
        char[][] board = new char[h][w];
        for (int i = 0; i < h; i++) {
            String str = sc.next();
            for (int j = 0; j < w; j++) {
                board[i][j] = str.charAt(j);
                
                if (board[i][j] == '#') count++;
            }
        }
        
        if (count == h + w - 1) {
            System.out.println("Possible");
        } else {
            System.out.println("Impossible");
        }
    }
}

Measured memory_bytes: 23636
#include <stdio.h>
int main(){
  int x,y,a;
  scanf("%d %d",&x,&y);
  
//ユークリッドの互除法

  if (x < y) {
    x += y;
    y = x - y;
    x -= y;
  }
  while (y != 0) {
      a = x % y;
      x = y;
      y = a;
    }
  
  printf("%d\n",x);
  return 0;
}



Measured memory_bytes: 2144
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int a, b, t;
  cin >> a >> b >> t;
  cout << b * (t / a) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include <cctype>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;

int main(){
    string a,b;
    cin >> a >> b;
    int total=0;
    rep(i,a.size()){
        if(a[i]!=b[i]) break;
        total++;
    }
    cout << (total==a.size() ? "Yes":"No") << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;


int main() {
  int n;
  while(cin>>n,n) {
    int y;cin >> y;
    int ans = 0;
    double hoge = 0;
    REP(i,n) {
      int b,r,t;cin>>b>>r>>t;
      double tmp;
      if (t==1) {
        tmp = 1+1.*y*r/100;
      } else {
        tmp = pow(1+1.*r/100,y);
      }
      if (tmp > hoge) ans = b, hoge = tmp;
    }
    cout << ans << endl;
  }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n,k;
    cin>>n>>k;
    Vec a(n);
    rep(i,n)cin>>a[i];

    Vec b(n);
    rep(i,n){
        b[i] = (a[i]-1)%k;
    }

    Vec c(n+1,0);

    rep(i,n){
        c[i+1]= (c[i]+b[i])%k;
    }

    ll ans=0;
    map<ll,ll>mp;
    rep(i,n+1){
        if(i>=k){
            mp[c[i-k]]--;
        }
        ans += mp[c[i]];
        mp[c[i]]++;
    }
    
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 17408
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>

using namespace std;

int main() {
  int n,r;
  cin >> n >> r;

  if(n >= 10) cout << r << endl;
  else cout << r + 100*(10-n) << endl;
}

Measured memory_bytes: 3552
#include <iostream>
#include <algorithm>
#include <string.h>
#include <set>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

int dp[110][110];
int a[1010],b[1010],c[1010];
int n,m;

int main() {
    memset(dp,INF,sizeof(dp));
    scanf("%d%d",&n,&m);
    for (int i=0;i<m;i++) {
        scanf("%d%d%d",a+i,b+i,c+i);
        dp[a[i]][b[i]]=dp[b[i]][a[i]]=c[i];
    }
    for (int i=1;i<=n;i++) dp[i][i]=0;
    for (int k=1;k<=n;k++) {
        for (int i=1;i<=n;i++) {
            for (int j=1;j<=n;j++) {
                dp[i][j]=min(dp[i][k]+dp[k][j],dp[i][j]);
            }
        }
    }
    int ans=0;
    for (int i=0;i<m;i++) {
        int A=a[i],B=b[i],C=c[i];
        bool flag=false;
        for (int j=1;j<=n;j++) {
            for (int k=1;k<=n; k++) {
                if (j == k) continue;
                if (dp[j][k]==dp[A][j]+dp[k][B]+C) {
                    flag=true;
                    goto Skip;
                }
            }
        }

        Skip:
            if (!flag) ans++;
    }
    printf("%d\n",ans);
}


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

int main() {
    string s;
    cin >> s;

    bool exists;
    string ans = "None";
    for (char c = 'a'; c != 'z' + 1; c++) {
        exists = true;
        int i;
        for (i = 0; i < s.size(); i++) {
            if (c == s.at(i)) break;
        }
        if (i == s.size()) {
            ans = c;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3736
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#define ll long long
using namespace std;
int main() {
	ll x, count = 1, t = 1;
	//double t = 1;
	cin >> x;
	for (ll i = 2; i*i <= x; i++) {
		for (ll j = 2; j*j <= x; j++) {
			if (pow(i, j) <= x) {
				t=max(pow(i,j),(double)t);
				//cout << i << " " <<j<< endl;

			}
		}
	}
	cout << t << endl;

}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main(){
	int a,b,h;
	cin>>a>>b>>h;
	cout<<(a+b)*h/2<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int N;
	int a[64];
	int i;
	int min, max;
	int minIdx, maxIdx;
	int sousaCount = 0;
	int sousa[128][2];
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &a[i]) != 1) return 1;
	}
	min = max = a[0];
	minIdx = maxIdx = 0;
	for (i = 1; i < N; i++) {
		if (min > a[i]) { min = a[i]; minIdx = i; }
		if (max < a[i]) { max = a[i]; maxIdx = i; }
	}
	if (min == 0 && max == 0) {
		puts("0");
		return 0;
	}
	if (min < 0 && 0 < max) {
		if (-min > max) {
			for (i = 0; i < N; i++) {
				if (a[i] >= 0) {
					sousa[sousaCount][0] = minIdx;
					sousa[sousaCount][1] = i;
					sousaCount++;
					a[i] += a[minIdx];
				}
			}
			max = 0;
		} else {
			for (i = 0; i < N; i++) {
				if (a[i] <= 0) {
					sousa[sousaCount][0] = maxIdx;
					sousa[sousaCount][1] = i;
					sousaCount++;
					a[i] += a[maxIdx];
				}
			}
			min = 0;
		}
	}
	if (min < 0) {
		if (a[N - 1] == 0) {
			sousa[sousaCount][0] = minIdx;
			sousa[sousaCount][1] = N - 1;
			sousaCount++;
		}
		for (i = N - 2; i >= 0; i--) {
			sousa[sousaCount][0] = i + 1;
			sousa[sousaCount][1] = i;
			sousaCount++;
		}
	} else {
		if (a[0] == 0) {
			sousa[sousaCount][0] = maxIdx;
			sousa[sousaCount][1] = 0;
			sousaCount++;
		}
		for (i = 1; i < N; i++) {
			sousa[sousaCount][0] = i - 1;
			sousa[sousaCount][1] = i;
			sousaCount++;
		}
	}
	printf("%d\n", sousaCount);
	for (i = 0; i < sousaCount; i++) {
		printf("%d %d\n", sousa[i][0] + 1, sousa[i][1] + 1);
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <stdlib.h>
#include <queue>
using namespace std;
static const int N = 100, WHITE = 0, GREY = 1, BLACK = 2;

int M[N][N], color[N], d[N], n, dis;
queue<int> q;


void label_not_reach()
{
	for(int u = 0; u < n; u++)
	{
		if(color[u] == WHITE) d[u] = -1;
	}
}


void bfs()
{
	int u = 0;
	
	q.push(u);
	
	color[u] = GREY;
	
	while(!q.empty())
	{
		u = q.front();
		for(int v = 0; v < n; v++)
		{
			if(M[u][v] == 1 && color[v] == WHITE)
			{
				color[v] = GREY;
				q.push(v);
				d[v] = d[u] + 1;
			}
		}
		color[u] = BLACK;
		q.pop();	
	}
	
	label_not_reach();
}




int main() 
{
	dis = 0;
	scanf("%d", &n); 
	
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < n; j++)
		{
			M[i][j] = 0;
		}
	}
	
	for(int i = 0; i < n; i++)
	{
		color[i] = WHITE;
		d[i] = 0;
	}
	
	for(int i = 1; i <= n; i++)
	{
		int u,k,v;
		scanf("%d %d", &u, &k);
		for(int j = 0; j < k; j++)
		{
			scanf("%d", &v);
			M[u-1][v-1] = 1;
		}
	}
	
	bfs();
	
	for(int i = 0; i < n; i++)
	{
		printf("%d %d\n", i+1, d[i]);
	}
	
//	system("pause");
	return 0;
}




Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;

int main() {
    int x, n;
    cin >> x >> n;
    vector<bool> p(102, false);

    for (int i = 0; i < n; i++) {
        int inp;
        cin >> inp;
        p[inp] = true;
    }

    pair<int, int> ans = make_pair(INF, INF);
    for (int i = 0; i <= 101; i++) {
        if (p[i] == false) {
            ans = min(ans, pair<int, int>(abs(x - i), i));
        }
    }
    cout << ans.second << endl;
}

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

typedef long long ll;

using namespace std;

int n, Q;
string s;

void update(int x, vector<int> &d, vector<int> &salsas)
{
    if (salsas[x] != Q)
    {
        salsas[x] ^= 1;
        if (d[x] == 1) d[x] = 2;
        else if (d[x] == 2) d[x] = 1;
    }
}

pair<vector<int>, vector<int> > solve(vector<int> last_p, vector<int> last_w)
{
    Q = 0;
    vector<int> p(3 * last_p.size()), w;
    int n = last_p.size();

    vector<int> d(3 * last_p.size());
    vector<int> salsas(3 * last_p.size());
    for (int i = 0; i < n; i++) d[i] = 0;
    for (int i = n; i < 2 * n; i++) d[i] = 1;
    for (int i = 2 * n; i < 3 * n; i++) d[i] = 2;

    for (int i = 0; i < s.size(); i++)
    {
        int x = last_w[i];

        update(x, d, salsas);
        update(x + n, d, salsas);
        update(x + 2 * n, d, salsas);

        if (d[x] == 2) w.push_back(x);
        if (d[n + x] == 2) w.push_back(n + x);
        if (d[2 * n + x] == 2) w.push_back(2 * n + x);
        if (s[i] == 'S')
        {
            Q ^= 1;
        }
        else
        {
            int x = last_w[i];
            d[x] = (d[x] + 1) % 3;
            d[n + x] = (d[n + x] + 1) % 3;
            d[2 * n + x] = (d[2 * n + x] + 1) % 3;
        }
    }

    for (int i = 0; i < 3 * n; i++) update(i, d, salsas);
    for (int i = 0; i < 3 * n; i++)
    {
        p[i] = last_p[i % n] + d[i] * n;
    }

    return {p, w};
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n;
    cin >> s;

    vector<int> last_p = {0, 1, 2};
    vector<int> last_w;
    for (int i = 0; i < s.size(); i++)
    {
        for (int j = 0; j < 3; j++) if (last_p[j] == 2) last_w.push_back(j);
        if (s[i] == 'S')
        {
            int t = 1;
            for (int k = 0; t && k < 3; k++)
            {
                for (int j = 0; t && j < 3; j++)
                {
                    if (last_p[k] == 2 && last_p[j] == 1)
                    {
                        swap(last_p[k], last_p[j]);
                        t = 0;
                    }
                }
            }
        }
        else
        {
            for (int j = 0; j < 3; j++) last_p[j] = (last_p[j] + 1) % 3;
        }
    }
    for (int i = 1; i < n; i++)
    {
        pair<vector<int>, vector<int> > gg = solve(last_p, last_w);
        last_p = gg.first;
        last_w = gg.second;
    }
    #ifdef LOCAL
    //return 0;
    #endif // LOCAL
    for (int i = 0; i < last_p.size(); i++)
    {
        cout << last_p[i] << " ";
    }
}


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

int main(){
  long long int N,ans=0;
  cin>>N;
  for(long long int i=1; i*(i+1)<N; ++i){
    if(N%i==0) ans+=N/i-1;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

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

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

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

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

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

signed main() {
  ll N;
  cin >> N;
  ll before = 0;
  ll count = 0;
  ll m = 0;
  rep(i, N) {
    ll h;
    cin >> h;
    if (i == 0) {
      before = h;
      continue;
    }

    if (h <= before) {
      count++;
    } else {
      if (m < count) {
        m = count;
      }
      count = 0;
    }
    before = h;
  }
  if (m < count) {
    m = count;
  }
  COUT(m);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 50;
int a[N];

int main()
{
	int n;
	while(cin >> n){
		for(int i = 0; i < n; i++)
			cin >> a[i];
		int sum = 0;
		for(int i = 0; i <= n; i++){
			for(int j = i+1; j <= n; j++){
				sum += a[i]*a[j];
			}
		}
		cout << sum << endl;
	}
	return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;

abstract class Main {

	public static void main(String[] args) {

		// 標準入力
		Scanner sc = new Scanner(System.in);

		// char型に変換
		String words = sc.nextLine();
		char ch[] = words.toCharArray();
				
		//char型の数だけ回す		
		for (int i = 0; i < ch.length; i++) {

			//
			if (Character.isUpperCase(ch[i])) {
				ch[i] = Character.toLowerCase(ch[i]);
			} else {
				ch[i] = Character.toUpperCase(ch[i]);
			}
		}
		
		for (char chage : ch) {
			System.out.print(chage);
		}
System.out.print("\n");
	}
}

Measured memory_bytes: 17228
import java.util.Scanner;

public class Main {
    private static final Scanner SC = new Scanner(System.in);

    public static void main(String[] args) {
        // 0000000000(0) -> 1111111111(1023)
        int cases = SC.nextInt();
        int[] balls = new int[10];
        while (cases-- > 0) {
            for (int i = 0; i < 10; i++) {
                balls[i] = SC.nextInt();
            }
            int methods = 1024;
            boolean can = true;
            while (methods-- > 0) {
                can = true;
                char[] bitArray = Integer.toBinaryString(1024| methods).substring(1).toCharArray();
                int left = 0;
                int right = 0;

                for (int i = 0; i < 10; i++) {
                    // putin left
                    if (bitArray[i] == '0') {
                        // can put
                        if(balls[i]>left){
                            left = balls[i];
                        }
                        else{
                            can = false;
                            break;
                        }
                    }
                    // putin right
                    else{
                        if(balls[i]>right){
                            right = balls[i];
                        }
                        else{
                            can = false;
                            break;
                        }
                    }
                }
                if (can){
                    break;
                }

            }
            if (can){
                System.out.println("YES");
            }
            else {
                System.out.println("NO");
            }

        }

    }
}



Measured memory_bytes: 28960
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;
bool flag=true;
int msnum[300000];

int main(){
	fill(msnum, msnum+300000, 1);
	for(int i=6; i<300000; ){
		if(msnum[i]==1){
			for(int j=i+i; j<300000; j+=i) msnum[j]=0;
		}
		if(flag) i+=2;
		else i+=5;
		flag = !flag;
	}
	
	while(1){
		int n; cin >>n;
		if(n==1) break;
		queue <int> q;
		flag=true;
		for(int i=6; i<=n; ){
			if(msnum[i]==1 && n%i==0)q.push(i);
			if(flag) i+=2;
			else i+=5;
			flag = !flag;
		}
		cout << n << ":";
		while(!q.empty()){
			cout << " " << q.front();
			q.pop();
		}
		cout << endl;
	}
}


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

using namespace std;

int main()
{
    int ret = 0;
    vector<int> tasks;

    for (int i = 0; i < 3; i++) {
        int x; cin >> x;
        tasks.push_back(x);
    }
    sort(tasks.begin(), tasks.end());

    for (int i = 1; i < 3; i++) {
        ret += tasks[i] - tasks[i - 1];
    }

    cout << ret << endl;

    return 0;
}

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

char reverse_direction(char d) {
    if (d == 'U') return 'D';
    if (d == 'D') return 'U';
    if (d == 'L') return 'R';
    return 'L';
}

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    string one;
    rep(i,tx-sx) {
        one += 'R';
    }
    rep(i,ty-sy) {
        one += 'U';
    }
    string two;
    rep(i,one.size()) {
        two += reverse_direction(one[i]);
    }
    string three = "DR" + one + "UL";
    string four = "UL" + two + "DR";
    string ans = one + two + three + four;
    cout << ans << endl;
}

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

int main() {
	int n,m,k;
	cin >> n >> m >> k;
	vector<int> a(n);
	vector<int> b(m);
	rep(i,n) cin >> a[i];
	rep(i,m) cin >> b[i];

	// m 冊読んだ時間
	ll t = 0;
	rep(i,m) t += b[i];
	// 尺とり法 two pointers
	int j = m;
	int ans = 0;
	rep(i,n+1) {
		while (j > 0 && t > k) {
			--j;
			t -= b[j];
		}
		if (t > k) break;
		ans = max(ans, i+j);
		if (i == n) break;
		t += a[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4844
import numpy as np
def min_rounte(s, sta, path):
    move = [[0,1],[0,-1],[1,0],[-1,0]]
    for i in move:
        ax = [sta[0]+i[0], sta[1]+i[1]]
        if s[ax[0]][ax[1]] == -1:
            continue
        if s[ax[0]][ax[1]] > path:
            s[ax[0]][ax[1]] = path
    return s
 
def bfs(s, sta):
    s_ = np.array(s)
    s_[sta[0]][sta[1]] = 0
    tmp = sta
    for i in range(400):
        ind = np.where(s_==i)
        for j in range(len(ind[0])):
            s_ = min_rounte(s_, [ind[0][j], ind[1][j]], i+1)
        if len(ind[0]) == 0:
            break
        tmp = [[ind[0][k], ind[1][k]] for k in range(len(ind[0]))]
    return i-1, tmp
        

h, w = map(int, input().split())
#s_ = [[0 if i=="." else -1 for i in input()] for j in range(h)]
s = [[-1 for i in range(w+2)] for j in range(h+2)]
for i in range(h):
    a = input()
    for j in range(w):
        if a[j] == ".":
            s[i+1][j+1] = 512
        else:
            s[i+1][j+1] = -1

for i in range(1, h+1):
    for j in range(1, w+1):
        if s[i][j] == -1:
            continue
        temp, ax = bfs(s, [i,j])
        break
ans = 1
for i in ax:
    ans_, t = bfs(s, i)
    if ans_ > ans:
        ans = ans_

print(ans)

Measured memory_bytes: 21092
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
typedef long long ll;
int main(){
    int N,K;
    cin>>N>>K;
    cout<<N-K+1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;++i)
bool vecfind(vector<int> A,int n){
  bool flag = false;
  int k = A.size();
  fol(i,k){
    if(A[i]==n)flag = true;
  }
  return flag;
}
int main(){
  int h,w;cin>>h>>w;
  string s[h];
  fol(i,h){
    cin>>s[i];
  }
  vector<int> a,b;
  fol(i,h){
    bool is = true;
    fol(j,w){
      if(s[i][j]=='#')is=false;
    }
    if(is)a.push_back(i);
  }
  fol(i,w){
    bool is = true;
    fol(j,h){
      if(s[j][i]=='#')is = false;
    }
    if(is)b.push_back(i);
  }
  fol(i,h){
    if(vecfind(a,i))continue;
    fol(j,w){
      if(vecfind(b,j))continue;
      cout << s[i][j];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 384
def main():
    num = int(input())
    mod = 1000000007
    ans = pow(10, num, mod) - pow(9, num, mod) * 2 + pow(8, num, mod)
    # # 0, 9 を含まない
    # ans -= pow(8, num, mod)
    # ans %= mod
    # # 0, 9 が片方ない
    # tmp = (pow(9, num, mod) - pow(8, num, mod)) * 2 % mod
    ans %= mod

    return ans


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


Measured memory_bytes: 9160
parseInt(x) = parse(Int, x)
parseFloat(x) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    if n==1
        println("Hello World")
    else
        a=parseInt(readline())
        b=parseInt(readline())
        println(a+b)
    end
end
main()

Measured memory_bytes: 106864
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

int i,j,k,N,X[100],ans,temp;

int main()
{
  cin >>N;
  for(i=0;i<N;i++)
  {
    cin>>X[i];
  }
  
  ans=10000000;
  
  for(i=1;i<101;i++)
  {
    temp=0;
    for(j=0;j<N;j++)
    {
      temp+=(X[j]-i)*(X[j]-i);
    }
    ans=min(ans,temp);
  }
  
  cout <<ans;
  
  
  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long A=sc.nextLong(),B=sc.nextLong(),C=sc.nextLong(),K=sc.nextLong();
		if((K%2)==1){
			System.out.println((B-A));
		}else{
			System.out.println((A-B));
		}
	}
}


Measured memory_bytes: 21844