akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define F2(i,a,b) for(int i=a;i<(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define MN 505
#define MM 600005
#define ll long long
#define mod 1000000007
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
int n;
int a[MN][MN];
void s(int o,int n,int k){
	if(n==1)return;
	int x=n/2;
	F(i,1,x)F(j,x+1,n)a[o+i][o+j]=k;
	s(o,x,k+1),s(o+x,n-x,k+1);
}
int main(){
	scanf("%d",&n);
	s(0,n,1);
	F(i,1,n-1)F(j,i+1,n)printf("%d%c",a[i][j]," \n"[j==n]);
	return 0;
}

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef string str;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

#define MAX_D 10

int main() {
    int d, g;
    cin >> d >> g;
    vi p(d), c(d);
    REP(i, d) {
        cin >> p[i] >> c[i];
    }
    int ans = INT_MAX;
    for(int bit = 0; bit < (1 << d); bit++) {
        bitset<MAX_D> b(bit);
        int score = 0, max_not_select_idx = -1, count = 0;
        REP(i, d) {
            if(b[i]) {
                score += p[i] * 100 * (i + 1) + c[i];
                count += p[i];
            }
            else {
                max_not_select_idx = max(max_not_select_idx, (int)i);
            }
        }
        if(score >= g) ans = min(ans, count);
        else if(score + (p[max_not_select_idx] - 1) * 100 * (max_not_select_idx + 1) >= g) {
            ans = min(ans, count + (g - score + (100 * (max_not_select_idx + 1)) - 1) / (100 * (max_not_select_idx + 1)));
        }
    }
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
# A - Airport Bus
# https://atcoder.jp/contests/agc011/tasks/agc011_a

n, c, k = map(int, input().split())
T = [int(input()) for _ in range(n)]

T.sort()

ans = 1
cnt = 0
st = T[0]
for t in T:
  cnt += 1
  if t - st > k or cnt > c:
    ans += 1
    st = t
    cnt = 1

print(ans)

Measured memory_bytes: 7384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b > c+d)cout << "Left" << endl;
    else if(a+b == c+d)cout << "Balanced" << endl;
    else cout << "Right" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

class Main {
	public static void main(String args[]) {
		run();
	}
	public static void run() {
		Scanner scanner = new Scanner(System.in);
		int  num = scanner.nextInt();//要素数
        Node[] node = new Node[num];
        boolean[] root = new boolean[num];
        Arrays.fill(root, true);
		//要素ごとの親と子の関係構築
		for(int i = 0; i < num; i ++ ){
			int id = scanner.nextInt();
            int k = scanner.nextInt();
            int[] children = new int[k];
            for (int j = 0; j < k; j++) {
                children[j] = scanner.nextInt();
                root[children[j]] = false;
            }
            node[id] = new Node(children);
		}
		
		//ノードごとにデータ作成
		for( int i = 0; i < num ; i ++ ){
			if( root[i] ){
				tree( node, -1, i, 0 );
			}
		}		
		
		output(node, num);
		
		scanner.close();
	}
	
	public static void output(Node[] node, int num){
	   //出力
	   StringBuilder sb = new StringBuilder("");
	   for (int i = 0; i < num; i++) {
			sb.append(node[i].tree).append("\n");
	   }
		System.out.print(sb);
	}
	
	public static void tree(Node[] nodes, int parent, int id, int depth){ 
		StringBuilder sb = new StringBuilder("");
		sb.append("node ").append(id).append(": parent = ").append(parent)
			.append(", depth = ").append(depth).append(", ");
		
		if (parent == -1) sb.append("root");
        else if (nodes[id].children.length == 0) sb.append("leaf");
        else sb.append("internal node");
 
        sb.append(", [");
        for (int i = 0; i < nodes[id].children.length; i++) {
            sb.append(nodes[id].children[i]);
            if (i != nodes[id].children.length - 1) sb.append(", ");
 
            tree(nodes, id, nodes[id].children[i], depth + 1);
        }
        sb.append("]");
        nodes[id].tree = sb.toString();
	}
}
class Node{
    public int[] children;
    public String tree;
    public Node(int[] children) {
        this.children = children;
    }
	
}



Measured memory_bytes: 143512
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>


int main(void)
{
  char S[100001];
  scanf("%s",S);
  int N = strlen(S);
  int i;
  int s[N];
  for(i=0;i<N;i++){
    s[i] = S[i] -48;
    //  printf("%d ",s[i]);
  }
  int A=0;
  int B=0;
  for(i=0;i<N;i++){
    //A
    if(!(i%2)){
      if(s[i] == 0) A ++;      
      if(s[i] == 1) B ++;      
      //B
    }else{
      if(s[i] == 1) A ++;      
      if(s[i] == 0) B ++;      
    }
  }
  int max = A; 
  if(A < B) max =B;
  printf("%d", N - max); 

  return (0);
}


Measured memory_bytes: 640
//
// Created by Akash on 22-08-2020.
//

#include <iostream>
#include <cmath>
#include <algorithm>
#include <limits>
#include <vector>
#include <bitset>
#include <cstdlib>
#include <cstdio>
#include <string>

using namespace std;
#define LL long long
#define ULL unsigned long long
#define LD long double


int main()
{
    ULL n,count=0,max=0;
    cin>>n;
    vector<int> v;
    ULL input;
    for (int i = 0; i < n; ++i) {
        cin >> input;
        v.push_back(input);
    }
    for (int j = 0; j < n-1; ++j) {
        if(v[j]>max){
            max= v[j];
        }
        if(max>v[j+1]){
            int res = max-v[j+1];
            count +=res;
        }
    }
    cout<<count;

    return 0;
}

Measured memory_bytes: 3780
package main

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

const INFINITY = math.MaxInt64/2 - 1

func exec(stdin *Stdin, stdout *Stdout) {
	x := stdin.ReadInt()
	ans := x/500*1000 + (x%500)/5*5
	stdout.Println(ans)
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), INFINITY)
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Min(a int, b ...int) int {
	for _, v := range b {
		if v < a {
			a = v
		}
	}
	return a
}

func Max(a int, b ...int) int {
	for _, v := range b {
		if a < v {
			a = v
		}
	}
	return a
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}

func Pow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x *= x
			y /= 2
		} else {
			z *= x
			y -= 1
		}
	}
	return z
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        long K = sc.nextLong();

        long[] a = new long[N+1];
        long[] b = new long[M+1];
        for (int i = 1; i <= N; i++) {
            a[i] += a[i-1] + sc.nextInt();
        }

        for (int i = 1; i <= M; i++) {
            b[i] += b[i-1] + sc.nextInt();
        }
        
        int max = 0;
        int idx = M;
        for (int i = 0; i <= N; i++) {
            long diff = K - a[i];
            if (diff < 0) {
                break;
            }

            int j = idx;
            while (j >= 0) {
                if (diff >= b[j]) {
                    max = Math.max(max, i+j);
                    break;
                } else {
                    idx = j--;
                }
            }
        }
        
        System.out.println(max);
    }
}


Measured memory_bytes: 62592
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
char mp[3][3][4];
string str[10];
bool used[9];long long cnt,ans;
void saiki2(int num){
  int ex[] ={0,0,2,2};
  int ey[] ={2,0,0,2};
  int tx[4][2] = {{1,0},{0,1},{-1,0},{0,-1}};
  int ty[4][2] = {{0,-1},{1,0},{0,1},{-1,0}};
  if(num == 4) ans++;
  else
    for(int i=0;i<9;i++){
      if(used[i] == 1) continue;
      for(int j=0;j<4;j++){
	int nx = ex[num]+tx[num][0];
	int nx2 = ex[num]+tx[num][1];
	int ny = ey[num]+ty[num][0];
	int ny2 = ey[num]+ty[num][1];
	if(abs(str[i][j] - mp[ny][nx][(num+3)%4])=='a'-'A' &&
	   abs(str[i][(j+3)%4] - mp[ny2][nx2][(num+2)%4]) == 'a'-'A'){
	  
	  used[i] = 1;
	  saiki2(num+1);
	  used[i] = 0;
	}	 
      }
    }
}

void saiki(int num){
int dx[] = {0,-1,0 ,1};
int dy[] = {1,0,-1,0};
  if(num == 4) {
    saiki2(0);
    return;
  }
  for(int i=0;i<9;i++){
    if(used[i] == 1) continue;
    for(int j=0;j<4;j++)
      if(abs(mp[1][1][(num+2)%4] - str[i][j])=='a'-'A') {
	for(int k=0;k<4;k++) mp[1+dy[num]][1+dx[num]][(k+num)%4] = str[i][(j+k)%4];
	used[i] = 1;
	saiki(num+1);
	used[i] = 0;
      }
  }
}

int main(){
  int n;
  cin >> n;
  while(n--){
    ans = 0;
  for(int i=0;i<9;i++) cin >> str[i];
  for(int i=0;i<=9;i++){
    for(int j=0;j<4;j++) mp[1][1][j] = str[i][j];
    used[i] = 1;
    saiki(0);
    used[i] = 0;
  }
  cout << ans*4<<endl;
  }
  return 0;     
}

Measured memory_bytes: 1208
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }




int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> h(n);
    REP(i, n){
        cin >> h[i];
    }
    sort(h.begin(), h.end());
    ll ans = INF;
    REP(i, n - k + 1){
        ans = min(ans, h[i + k - 1] - h[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main {
    public static void main(String[] argas){
        Scanner sc = new Scanner(System.in);
        int n,d,x,choco_num=0;
        n=sc.nextInt();
        d=sc.nextInt();
        x=sc.nextInt();
        choco_num =n;
        int [] a = new int[n];
        for(int b=0;b<n;b++){
            a[b] = sc.nextInt();
        }

        for(int b=0;b<n;b++){
            int num=0;
            for(int c=1;c<d;c++){
                int day = c*a[b]+1;
                if(day<=d){
                    num = num+1;
                }
                else break;
            }
            choco_num = choco_num+num;
        }
        choco_num+=x;
        System.out.println(choco_num);
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

// *** at 2018/**/**

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solveA();
    }

    private void solveA() {
        Scanner sc = new Scanner(System.in);
        char nums[] = sc.nextLine().toCharArray();

        int five = 0;
        int seven = 0;

        for (char c : nums) {
            if (Character.getNumericValue(c) == 5) {
                five++;
            } else if (Character.getNumericValue(c) == 7) {
                seven++;
            }
        }
        if (five == 2 && seven == 1) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

    private void solveB() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveC() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveD() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveE() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveF() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

}

Measured memory_bytes: 21844
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] array = new int[2];
        array[0] = sc.nextInt();
        array[1] = sc.nextInt();
        int k = sc.nextInt();
        Arrays.sort(array);
        int aux = array[0] + 1;
        int cont = 0;

        while (true) {
            if (array[1] % aux == 0 && array[0] % aux == 0) {
                cont++;
                if(cont == k) {
                    break;
                }
            }
            aux--;
        }
        System.out.println(aux);
    }
}

Measured memory_bytes: 22740
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n; cin >> n;int b = 0;
	string s; cin >> s;
	for (int i = 0; i < n; i++) {
		if (s[i] == s[i + 1])
			continue;
		else
			++b;
	}
	cout <<  b << endl;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n; cin>>n;
    int p = n/2;
    int q = (n+1)/2;
    cout << setp(10) << (double)q/(p+q) << "\n";
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


class Main {
	public static void main(String args[]) {
		
		//????????£????????§??´??°?????????????????????
	    Scanner sc = new Scanner(System.in);
	    String s1 = sc.next();
	    int a = Integer.parseInt(s1);
	    String s2 = sc.next();
	    int b = Integer.parseInt(s2);
	    String s3 = sc.next();
	    int c = Integer.parseInt(s3);
	    int sum = 0;
	    
	    //??´??°a???b???c????????¶??????????????????????????????????????????a<=b??§??????????¢????
	    if(1 <= a && a <= 10000){
	    	if(1 <= b && b <= 10000){
	    		if(1 <= c && c <= 10000){
	    			if(a <= b){
	    					
	    			    //c?´???°???a??????b?????§?????????????????????????¨????
	    				for(int i = a; i <= b; i++){
	    					if(c % i == 0){
	    					    sum++;
	    					}
	    				}
	    				
	    				//?´???°?????°?????¨???
	    				System.out.println( sum );
	    			}
	    		}
	    	}
	    }
	}
}

Measured memory_bytes: 17276
N = int(input())
# D = [*map(int,input().split())]
D = [d for d in map(int,input().split())]
ans = 0
# for i in range(N-1):
#     for j in range(i+1,N):
for j in range(N):
    for i in range(j):
        ans += D[i] * D[j]
print(ans)


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

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

    if (S == "AAA" || S == "BBB") {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  using ll = long long;
  ll mx = 1000;
  pair<ll, ll> p{};
  while (n--) {
    ll a;
    cin >> a;
    ll nmx = max(mx, p.first * a + p.second);
    pair<ll, ll> np = max(p, make_pair(mx / a, mx % a));
    swap(mx, nmx);
    swap(p, np);
  }
  cout << mx << '\n';
}


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

using namespace std;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

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

    vector<pair<int,int>> x(n);

    for (int i = 0; i < n; i++) {
        x[i] = make_pair(a[i], a[a[i] - 1]);
    }

    sort(x.begin(), x.end(), compare_by_b);

    for (int i = 0; i < x.size() - 1; i++) {
        cout << x[i].first << " ";
    }
    cout << x[x.size() - 1].first;

    return 0;
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int mod=1e+9+7;

int main(){
  ll N;
  cin>>N;
  vector<ll>data(N);
  for(ll i=0;i<N;i++)cin>>data[i];
  ll res=0;
  for(ll d=0;d<60;d++){
    ll one=0,zero=0;
    for(ll i=0;i<N;i++){
      if((data[i]>>d)&1)one++;
      else zero++;
    }
    ll tmp=one*zero%mod;
    ll v=(1ll<<d)%mod;
    ll num=tmp*v%mod;
    res=(res+num)%mod;
  }
  cout<<res<<endl;

}

Measured memory_bytes: 2560
def counting_sort(array, max_val = 10000):
    max_val = min(max(array), max_val)
    counting_array = [0 for x in range(0, max_val+1)]
    sorted_array = [0 for x in range(len(array))]

    for i in array:
        counting_array[i] += 1

    for i in range(1, max_val + 1):
        counting_array[i] += counting_array[i-1]

    for i in range(len(array))[::-1]:
        val = array[i]
        sorted_array[counting_array[val]-1] = val
        counting_array[val] -= 1

    return sorted_array


def main():
    n = int(input())
    array = [int(x) for x in input().split()]
    sorted_array = counting_sort(array)
    print(" ".join(map(str, sorted_array)))
    return

main()


Measured memory_bytes: 242196
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define MAXN 200010
#define LL long long
using namespace std;

int n,m;
LL a[MAXN],sd[MAXN],A,B;
LL f[MAXN];

struct Fenwick{
	LL c[MAXN];

	Fenwick(){ memset(c,0x77,sizeof c); }

	void modify(int x,LL v){
		while(x<=m){
			if(v<c[x]) c[x]=v;
			x+=x&(-x);
		}
	}

	LL getMin(int x){
		LL res=1LL<<50;
		while(x){
			if(c[x]<res) res=c[x];
			x-=x&(-x);
		}
		return res;
	}
}s1,s2;

int main(){
	scanf("%d%d%lld%lld",&m,&n,&A,&B);
	for(int i=1;i<=n;i++) scanf("%lld",a+i);
	for(int i=2;i<=n;i++) sd[i]=abs(a[i]-a[i-1]);
	for(int i=1;i<=n;i++) sd[i]+=sd[i-1];
	f[0]=min(abs(A-a[1]),abs(B-a[1]));
	s1.modify(A,abs(B-a[1])-A-sd[1]);
	s2.modify(m-A+1,abs(B-a[1])+A-sd[1]);
	s1.modify(B,abs(A-a[1])-B-sd[1]);
	s2.modify(m-B+1,abs(A-a[1])+B-sd[1]);
	for(int i=1;i<n;i++){
		f[i]=min(a[i+1]+sd[i]+s1.getMin(a[i+1]),-a[i+1]+sd[i]+s2.getMin(m-a[i+1]+1));
		s1.modify(a[i],f[i]-a[i]-sd[i+1]);
		s2.modify(m-a[i]+1,f[i]+a[i]-sd[i+1]);
	}
	LL ans=1LL<<62;
	for(int i=0;i<n;i++) ans=min(ans,f[i]+sd[n]-sd[i+1]);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a) for(int i=1;i<=a;i++)
#define base 139
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case %lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
const ll N=300010;
string s;
int main()
{
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
        printf("Yes\n");
    else printf("No\n");
    return 0;
}

/*

*/


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

using u32 = uint32_t;
using u64 = uint64_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr i64 INF = std::numeric_limits<i64>::max()/2;

int main()
{
	std::ios_base::sync_with_stdio(0);
	
	i64 n;

	std::cin >> n;

	std::vector<i64> h(n);

	for(i64 i=0; i<n; ++i)
	{
		std::cin >> h[i];
	}

	i64 dp[n];
	dp[0]=0;
	dp[1]=0;

	for(i64 i=0; i<n; ++i)
	{
		i64 a1 = INF;
		i64 a2 = INF;
		if(i-1 >= 0)
		{
			a1 = dp[i-1] + std::abs(h[i-1]-h[i]);
		}
		if(i-2 >= 0)
		{
			a2 =  dp[i-2] + std::abs(h[i-2]-h[i]);
		}
		std::clog << "a1=" << a1 << " a2=" << a2 << std::endl;
		if(a1==INF && a2==INF) continue;
		if(a1 < a2)
		{
			dp[i] = a1;
		}
		else
		{
			dp[i] = a2;
		}
		std::clog << "dp[" << i << "]=" << dp[i] << std::endl;
	}

	std::cout << dp[n-1] << "\n";
	
	return 0;
}

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

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

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int a,b,q;
	cin >> a >> b >> q;
	vector<ll> s(a),t(b);
	FOR(i,0,a)cin >> s[i];
	s.pb(LLINF);
	sort(ALL(s));
	FOR(i,0,b)cin >> t[i];
	t.pb(LLINF);
	sort(ALL(t));
	FOR(i,0,q){
		ll x;
		cin >> x;
		int sr = lower_bound(ALL(s), x) - s.begin();
		int tr = lower_bound(ALL(t), x) - t.begin();
		ll ans = LLINF;
		ans = min(ans, max(s[sr], t[tr]) - x);
		if(sr != 0 && tr != 0)
			ans = min(ans, x - min(s[sr-1], t[tr-1]));
		if(sr != 0){
			ans = min(ans, (x - s[sr-1]) * 2 + t[tr] - x);
			ans = min(ans, x - s[sr-1] + (t[tr] - x) * 2);
		}
		if(tr != 0){
			ans = min(ans, (s[sr] - x) * 2 + x - t[tr-1]);
			ans = min(ans, s[sr] - x + (x - t[tr-1]) * 2);
		}
		ANS(ans);
	}
	return 0;
}


Measured memory_bytes: 2912
//
//  main.cpp
//  competitive
//
//  Created by shinku on 2018/10/06.
//  Copyright © 2018 shinku. All rights reserved.
//

#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    if(n == 1) cout << "Hello World";
    else {
        int a,b;
        cin >> a >> b;
        cout << a + b;
    }
}


Measured memory_bytes: 256
package main

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

func newScanner() *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	// buf := make([]byte, 10000)
	// scanner.Buffer(buf, 1000000)
	return scanner
}

func scanInt(s *bufio.Scanner) int {
	if s.Scan() {
		t := s.Text()
		if v, err := strconv.Atoi(t); err == nil {
			return v
		}
		panic(fmt.Sprintln("Could't scan int from input", t))
	}
	panic(s.Err())
}

func scanInts(s *bufio.Scanner, n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt(s)
	}
	return a
}

func main() {
	sc := newScanner()
	h, w := scanInt(sc), scanInt(sc)
	if h == 1 || w == 1 {
		fmt.Println(1)
		return
	}
	s := h * w
	fmt.Println(s/2 + s&1)
}


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

int calc(int x){int sum = 0; while(x){sum += x % 10; x /= 10;} return sum;}

int main(){
	int N , ans = 1e9; cin >> N;
	for(int i = 1 ; i < N ; ++i) ans = min(ans , calc(i) + calc(N - i));
	cout << ans; return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
using namespace std;
int main()
{
	char c1, c2, c3, c4, c5, c6;
	while(~scanf(" %c%c%c\n%c%c%c", &c1, &c2, &c3, &c4, &c5, &c6))
		if(c1 == c6 && c2 == c5 && c3 == c4)
		{	
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
typedef __int128_t Int;
typedef pair<int, int> P;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, 0, N) { cin >> a[i]; }
  vector<int> b(N);
  rep(i, 0, N) { cin >> b[i]; }
  int x = accumulate(all(b), 0ll) - accumulate(all(a), 0ll);
  dump(x);
  if (x < 0) {
    cout << "No" << endl;
    return 0;
  }

  int A = 0, B = 0;
  rep(i, 0, N) {
    if (a[i] > b[i])
      A += abs(a[i] - b[i]);
    else {
      B += abs(a[i] - b[i]) / 2;
      if (abs(a[i] - b[i]) & 1)
        A++, B++;
    }
  }
  if (A <= B) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;

  return 0;
}


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

constexpr int MOD = 1e9 + 7;
using fint64 = int_fast64_t;
template<fint64 MOD>
struct ModInt {
	fint64 x;
	ModInt():x(0){}
	ModInt(fint64 x):
		x(x>=0?x%MOD:(MOD-(-x)%MOD)%MOD)
		{}
	// 負号
	ModInt operator -() const{
		return ModInt(-x);
	}
	// 加算
	ModInt &operator +=(const ModInt &rhs){
		x+=rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator +(const ModInt &rhs) const{
		return ModInt(*this)+=rhs;
	}
	// 減算
	ModInt &operator -=(const ModInt &rhs){
		x+=MOD-rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator -(const ModInt &rhs) const{
		return ModInt(*this)-=rhs;
	}
	// 乗算
	ModInt &operator *=(const ModInt &rhs){
		x*=rhs.x;
		if(x>=MOD) x%=MOD;
		return (*this);
	}
	ModInt operator *(const ModInt &rhs) const{
		return ModInt(*this)*=rhs;
	}
	// 除算
	ModInt &operator /=(const ModInt &rhs){
		(*this)*=rhs.inverse();
		return (*this);
	}
	ModInt operator /(const ModInt &rhs) const{
		return ModInt(*this)/=rhs;
	}
	// 等号
	bool operator ==(const ModInt &rhs){
		return x==rhs.x;
	}
	bool operator !=(const ModInt &rhs){
		return x!=rhs.x;
	}
	// 累乗
	ModInt pow(fint64 n) const{
		fint64 tmp=x;
		fint64 ret=1;
		while(n>0){
			if(n&1) ret=ret*tmp%MOD;
			tmp=tmp*tmp%MOD;
			n>>=1ll;
		}
		return ModInt(ret);
	}
	// 逆元
	ModInt inverse() const{
		fint64 a=x,b=MOD,s=1,t=0;
		while(b>0){
			fint64 u=a/b;
			a-=u*b;
			s-=u*t;
			swap(a,b);
			swap(s,t);
		}
		return ModInt(s);
	}
	// 入出力
	friend istream &operator >>(istream &lhs,ModInt<MOD> &rhs){
		fint64 x; lhs>>x;
		rhs=ModInt<MOD>(x);
		return lhs;
	}
	friend ostream &operator <<(ostream &lhs,const ModInt<MOD> &rhs){
		return lhs<<rhs.x;
	}
};
using mint = ModInt<MOD>;

// dp[i][j][k] := i人操作，未定j人，k枠空位
mint dp[310][310][310];
int main() {
	int n; cin >> n;
	vector<char> c;
	for(int i = 0; i < n; ++i) {
		char cc; cin >> cc;
		if(cc != '-') {
			c.push_back(cc);
		}
	}
	n = c.size();
	dp[0][0][0] = 1;
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j <= n; ++j) {
			for(int k = 0; k <= n; ++k) {
				if(c[i] == 'U') {
					dp[i + 1][j][k] += dp[i][j][k] * j;
					dp[i + 1][j + 1][k + 1] += dp[i][j][k];
				}
				if(c[i] == 'D') {
					if(j - 1 >= 0 and k - 1 >= 0) dp[i + 1][j - 1][k - 1] += dp[i][j][k] * j * k;
					dp[i + 1][j][k] += dp[i][j][k] * k;
				}
			}
		}
	}
	cout << dp[n][0][0] << '\n';
	return 0;
}


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

int n, k;

int main() {
	scanf("%d %d",&n, &k);
	double p = 0.0;
	for(int i = 1;i<=n;i++){
		if(i >= k)
			p += 1.0/n;
		else{
			int score = i;
			double p1 = 1.0/n;
			while(score<k){
				score *= 2;
				p1 /= 2;
			}
			p += p1;
		}	
	}
	printf("%.12f",p);
	return 0;
}

Measured memory_bytes: 256
n,m,r  = map(int,input().split())
r_list = list(map(int,input().split()))
matrix = [[float("inf") for i in range(n)] for j in range(n)]
for c in range(n):
  matrix[c][c] = 0
for v in range(m):
  a,b,c = map(int,input().split())
  if matrix[a-1][b-1] > c:
    matrix[a-1][b-1] = c
    matrix[b-1][a-1] = c
import numpy as np
matrix = np.array(matrix)
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
load = shortest_path(matrix, directed=False)
import itertools
ans_list = []
for balls in itertools.permutations(r_list):
    balls = list(balls)
    ans = 0
    for i in range(1,len(r_list)):
      ans += load[balls[i-1]-1][balls[i]-1]
    ans_list.append(int(ans))
    
print(min(ans_list))
      




Measured memory_bytes: 26804
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please



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


	string S;
	cin >> S;
	int kotae = 0;
	rep(i, 4) {
		if (S[i] == '2') kotae++;
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
/*---> 04 April 2020 <--- > 20:03:24 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#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__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N=1e5+5;
bool isP(string &s){
	int n=s.size();
	for(int i=0;i<n/2;i++){
		if(s[i]!=s[n-i-1])
			return false;
	}
	return true;
}
int32_t main(){__
	string s;
	cin>>s;
	int n=s.size();
	int en=(n-1)/2;
	string s1(s.begin(),s.begin()+en);
	en=(n+3)/2;
	en--;
	string s2(s.begin()+en,s.end());
	debug()<< imie(s1) imie(s2);
	if(isP(s) && isP(s1) && isP(s2))
		cout<<"Yes\n";
	else
		cout<<"No\n";
return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(){
    int n,m,p;
    while(scanf("%d%d%d",&n,&m,&p),n||m||p){
        int sum=0,c;
        for(int i=1;i<=n;i++){
            int val;
            scanf("%d",&val);
            sum+=val;
            if(i==m)c=val;
        }
        if(c==0){
            puts("0");
            continue;
        }
        double ans=100.0*sum/c*(100-p)/100;
        printf("%d\n",(int)ans);
    }
    return 0;
}

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

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

	vector<string> s(h);
	for (int i = 0; i < h; ++i) cin >> s[i];

	int ans = h + w - 2;

	for (int horizonPat = 0; horizonPat < 1 << (h - 1); ++horizonPat)
	{
		vector<int> cutPos;
		cutPos.clear();
		cutPos.emplace_back(0);

		int tmpAns = 0;

		for (int i = 0; i < h; ++i)
		{
			if (horizonPat >> i & 1)
			{
				tmpAns++;
				cutPos.emplace_back(i + 1);
			}
		}

		cutPos.emplace_back(h);

		vector<vector<int>> a;
		vector<int> b;
		a.clear();
		b.clear();

		for (int i = 0; i < cutPos.size() - 1; ++i)
		{
			b.clear();

			for (int column = 0; column < w; ++column)
			{
				int cnt = 0;

				for (int row = cutPos.at(i); row < cutPos.at(i + 1); ++row)
				{
					if (s[row][column] == '1') cnt++;
				}

				b.emplace_back(cnt);
			}

			a.emplace_back(b);
		}

		int startColumnIdx = 0;
		bool isCotinue = false;
		for (int verticalIdx = 0; verticalIdx < w; ++verticalIdx)
		{
			for (int i = 0; i < a.size(); ++i)
			{
				int checkVal = 0;

				for (int j = startColumnIdx; j <= verticalIdx; ++j)
				{
					checkVal += a.at(i).at(j);

					if (checkVal > k)
					{
						if (startColumnIdx == verticalIdx)
						{
							i = a.size();
							verticalIdx = w;
							isCotinue = true;
							break;
						}
						else
						{
							startColumnIdx = verticalIdx;
							tmpAns++;
							break;
						}
					}
				}
			}
		}

		if (!isCotinue && (ans > tmpAns)) ans = tmpAns;
	}

	std::cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t Ln, Lb;
  Lb=2;
  Ln=1;
  int N;
  cin >> N;
  
  for(int i=0;i<N;i++){
    int64_t a;
    a=Ln+Lb;
    Lb=Ln;
    Ln=a;
  }
  
  cout << Lb << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long
#define mod 1000000007
#define max(p,q)((p)>(q)?(p):(q))
ll powe(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
ll n;
ll times[212345];

int main(){
  scanf("%lld",&n);
  ll ans=1;
  for(int i=2;i<n;i++){
    ll count=0;
    int j=1;
    for(j=1;j*j<i;j++){
      if(i%j==0){
	count++;}
    }
    ans+=2*count;
    if(j*j==i) ans++;
  }
  printf("%lld\n",ans);

  
  return 0;
}


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

using namespace std;

#define rep(i, n) for(int i=0; i<(int)(n); i++)

int main() {
    int N;
    cin >> N;
    vector<long long int> powers(N*3);
    rep(i, powers.size()){
        cin >> powers.at(i);
    }
    sort(powers.begin(), powers.end(), greater<long long int>());
    vector<vector<long long int>> teams(N, vector<long long int>(3));
    int c = 0;
    int d = 0;
    rep(i, powers.size()){
        if(i < N*2){
            teams.at(c).at(0) = powers.at(i);
            i++;
            teams.at(c).at(1) = powers.at(i);
            c++;
        } else {
            teams.at(d).at(2) = powers.at(i);
            d++;
        }
    }
    long long int ans = 0;
    rep(i, teams.size()){
        ans += teams.at(i).at(1);
        // rep(j, 3){
        //     cout << teams.at(i).at(j);
        // }
        // cout << endl;
    }

    cout << ans << endl;
}

Measured memory_bytes: 8064
#include <stdio.h>
#include <stdbool.h>

#define SIZE 36

typedef struct {
    char suit;
    int val;
} card;

void
selectionSort(card [], int);

void
bubbleSort(card [], int);

void
print(card [], int);

bool
compare(card [], card [], int);

int main(void)
{
    int n, i;
    card c1[SIZE], c2[SIZE];

    scanf("%d", &n);
    getchar();
    for (i = 0; i < n; i++) {
        scanf("%c %d", &c1[i].suit, &c1[i].val);
        c2[i] = c1[i];
        getchar();
    }

    bubbleSort(c1, n);
    selectionSort(c2, n);

    print(c1, n);
    printf("Stable\n");
    print(c2, n);
    printf("%s\n", compare(c1, c2, n) ? "Stable" : "Not stable");

    return 0;
}


void
bubbleSort(card arr[], int n)
{
    int i, j;
    card v;

    for (i = 0; i < n; i++)
        for (j = n - 1; j > i; j--)
            if (arr[j].val < arr[j - 1].val) {
                v = arr[j];
                arr[j] = arr[j - 1];
                arr[j - 1] = v;
            }
}


void
selectionSort(card arr[], int n)
{
    int i, j, min;
    card v;

    for (i = 0; i < n - 1; i++) {
        min = i;
        for (j = i + 1; j < n; j++)
            if (arr[j].val < arr[min].val) {
                min = j;
            }
        v = arr[i];
        arr[i] = arr[min];
        arr[min] = v;
    }
}


void
print(card arr[], int n)
{
    int i = 0;
    printf("%c%d", arr[i].suit, arr[i].val);
    for (i++ ; i < n; i++)
        printf(" %c%d", arr[i].suit, arr[i].val);
    putchar('\n');
}

bool
compare(card c1[], card c2[], int n)
{
    int i;
    for (i = 0; i < n; i++)
        if (c1[i].suit != c2[i].suit)
            return false;
    return true;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------


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

   if (isupper(s))
   {
       cout << "A" << endl;
   }
   else
   {
       cout << "a" << endl;
   }
}


Measured memory_bytes: 3592
<?php
fscanf(STDIN, "%d%d", $n, $k);
$a = array_map("intval", explode(" ", trim(fgets(STDIN))));
$t = 0;
for($i = 0; $i < $n; $i++){
  for($j = $i+1; $j < $n; $j++){
    if($a[$i] > $a[$j])$t++;
  }
}
$T = 0;
for($i = 0; $i < $n; $i++){
  for($j = 0; $j < $n; $j++){
    if($a[$i] > $a[$j])$T++;
  }
}
$mod = 10**9+7;
$kk = (($k-1) * $k / 2)%$mod;
echo ($t*$k + ($T * $kk)%$mod)%$mod;



Measured memory_bytes: 4856
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n, m;
map<ll, ll> mpl;

int main() {
	cin >> n;
	rep(i, n) {
		int num;
		cin >> num;
		mpl[num]++;
	}
	bool f = 1;
	cin >> m;
	rep(i, m) {
		int num;
		cin >> num;
		if (mpl[num] == 0)f = 0;
		else mpl[num]--;
	}
	if (f)cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 12800
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>

#define MAX 101

using namespace std;

int main(){
	int H,W,flag=0;
	int tmp=1;
	int ans[MAX][MAX];
	scanf("%d %d",&H,&W);
	for(int i=0;i<H;i++){
		string st;
		cin>>st;
		for(int j=0;j<W;j++){
			if(st[j]=='c'){
				ans[i][j]=0;
				flag=1;
				tmp=1;
			}
			else{
				if(flag==0)
				ans[i][j]=-1;
				else{
					ans[i][j]=tmp;
					tmp++;
				}
			}
		}
		flag=0;
		tmp=1;
	}
	for(int i=0;i<H;i++){
		printf("%d",ans[i][0]);
		for(int j=1;j<W;j++){
			printf(" %d",ans[i][j]);
		}
		printf("\n");
	}
}

Measured memory_bytes: 3360
#include <bits/stdc++.h>
#include <cctype>
using namespace std;
 
#define MD 1000000007
typedef long long int ll;

int main(){
    string a,b,c;
    cin>>a>>b>>c;
    string ans;
    ans+=toupper(a[0]);ans+=toupper(b[0]);ans+=toupper(c[0]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int X = sc.nextInt();
    int[] m = new int[N];
    int m_min = Integer.MAX_VALUE;
    int count = 0;
    for (int i = 0; i < N; i++) {
      m[i] = sc.nextInt();
      X -= m[i];
      count++;
      if (m[i] < m_min) {
        m_min = m[i];
      }
    }
    count += (X / m_min);
    System.out.println(count);
  }
}

Measured memory_bytes: 24148
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, K; 
  cin >> N >> K;

  vector<int> cnt(N);

  REP(i, K){
    int d;
    cin >> d;
    REP(j, d){
      int A;
      cin >> A;
      cnt[A-1]++;
    }
  }

  int ans = 0;
  REP(i, N) if(cnt[i] == 0) ans++;

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 3656
#include <math.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
int main(){
	int n,m,k[11],s[11][11]={0},p[11],ans=0,all[11];
	scanf("%d%d",&n,&m);
	rep(i,m){
		scanf("%d",&k[i]);
		rep(j,k[i])scanf("%d",&s[i][j]);
	}
	rep(i,m)scanf("%d",&p[i]);
	rep(i,pow(2,n)){	//2進数全探索
		all[1]=i%2;
		Rep(j,2,n+1)all[j]=(i%(int)pow(2,j))/pow(2,j-1);
		int flag=0;
		rep(j,m){
			int P=0;
			rep(l,k[j])if(all[s[j][l]])P++;
			if(P%2==p[j])flag++;
		}
		if(flag==m)ans++;
	}
	printf("%d",ans);
}


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

#define rep(i, N) for (int i = 0; i < N; i++)
#define rep1(i, N) for (int i = 1; i <= N; i++)
const int intinf = numeric_limits<int>::max();

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define MOD 1000000007

void solve()
{
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> S(H);
    rep(i, H) cin >> S[i];

    vector<vector<int>> s(H, vector<int>(W));
    rep(i, H) rep(j, W) s[i][j] = S[i][j] - '0';

    int ans = (H - 1) * (W - 1);
    rep(a, 1 << (H - 1))
    {
        int ncut = __builtin_popcount(a);
        int ans_a = ncut;
        int h = ncut + 1;

        vector<vector<int>> bigs(h, vector<int>(W, 0));
        int ii = 0;
        rep(i, H)
        {
            rep(j, W)
                bigs[ii][j] += s[i][j];
            if (a & (1 << i))
                ii++;
        }

        bool is_impossible = false;
        vector<int> bigk(h, 0);
        rep(j, W)
        {
            bool is_ok = true;
            rep(ii, h)
            {
                if (bigs[ii][j] > K)
                {
                    is_impossible = true;
                    break;
                }
                if (bigk[ii] + bigs[ii][j] > K)
                {
                    is_ok = false;
                    break;
                }
            }

            if (is_impossible)
                continue;

            if (!is_ok)
            {
                ans_a++;
                bigk.clear();
                bigk.resize(h, 0);
            }
            rep(ii, h) bigk[ii] += bigs[ii][j];
        }
        if (is_impossible)
            continue;

        ans = min(ans, ans_a);
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
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; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}
ll MOD=1000000007;

int main(){
  string s;cin>>s;
  int n;
  n=s.size();
  int ans=0;
  int ans2=0;
  int tmp=0;
  for(int i=0;i<n;i++){ //1から
    if(tmp==0){
      tmp=1;
      if(s.at(i)=='0') ans++;
    }else{
      tmp=0;
      if(s.at(i)=='1') ans++;
    }
  }
  tmp=1;
  for(int i=0;i<n;i++){ //0から
    if(tmp==0){
      tmp=1;
      if(s.at(i)=='0') ans2++;
    }else{
      tmp=0;
      if(s.at(i)=='1') ans2++;
    }
  }
  cout<<min(ans,ans2)<<endl;
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  double t,x; cin>>t>>x;
  double ans = t/x;
  cout<<ans;
  

  return 0;
}


Measured memory_bytes: 256