akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    int n;
    cin >> n;
    if(400<=n&&n<=599)cout<<8<<endl;
    else if(n<=799)cout<<7<<endl;
    else if(n<=999)cout<<6<<endl;
    else if(n<=1199)cout<<5<<endl;
    else if(n<=1399)cout<<4<<endl;
    else if(n<=1599)cout<<3<<endl;
    else if(n<=1799)cout<<2<<endl;
    else if(n<=1999)cout<<1<<endl;
}
    



Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;cin>>a>>b;
  b = 2*b+1;
  if (a%b==0){
    cout<<a/b<<endl;
  }else{
    cout<<a/b+1<<endl;
  }
  return 0;
}

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


vector<double>vec;

int main ()
{


    vec.push_back(1.00);

    double a;
    cin>>a;

    int sq = (int)sqrt(a);

    for(double i=2; i<=sq; i++)
    {
        for(double j=2;; j++)
        {
            double res = pow(i,j);
            if(res>a)
            {
                break;
            }
            vec.push_back(res);

        }

    }
    sort(vec.begin(),vec.end());
    cout<<(int)vec.back()<<endl;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
	int N;
	cin >> N;
	
	int input[10];
	
	for (int i=0; i<N; i++) {
		for (int j=0; j<10; j++) cin >> input[j];
		
		int a[11] = {0};
		int b[11] = {0};
		
		bool success = true;
		
		for (int j=0, a_top=1, b_top=1; j<10; j++) {
			if (a[a_top-1] < input[j]) a[a_top++] = input[j];
			else if (b[b_top-1] < input[j]) b[b_top++] = input[j];
			else { success = false; break; }
		}
		if (success) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String[] lines = in.readLine().split(" ");
      int x1 = Integer.parseInt(lines[0]);
      int y1 = Integer.parseInt(lines[1]);
      int x2 = Integer.parseInt(lines[2]);
      int y2 = Integer.parseInt(lines[3]);

      int dx = x2 - x1;
      int dy = y2 - y1;

      int x3 = x2 - dy;
      int y3 = y2 + dx;

      int x4 = x3 - dx;
      int y4 = y3 - dy;

      System.out.println(x3 + " " + y3 + " " + x4 + " " + y4);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

Measured memory_bytes: 21204
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int max = a;
    int min = a;
    if (a>b) {min=b;}
    else {max=b;}
    if (max<c) max=c;
    if (min>c) min=c;
    System.out.println(max-min);
  }
}


Measured memory_bytes: 21844
#include<stdio.h>
int main(void) {
	int min = 1000, max = 0, n, a;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a);
		max = (a > max) ? a : max;
		min = (a < min) ? a : min;
	}
	printf("%d", max - min);
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;


public class Test
{
	public static void Main( )
	{
		int n = int.Parse( Console.ReadLine().Trim() );
		var S = Console.ReadLine().Trim().Split().Select( x => int.Parse( x )  ).ToList();
		
		int q = int.Parse( Console.ReadLine().Trim() );
		var T = Console.ReadLine().Trim().Split().Select( x => int.Parse( x )  ).ToList();
		
		int cnt = 0;
		foreach( var i in T ) {
			if( 0 <= S.BinarySearch( i ) ) {
				cnt++;
			}
		}
		Console.WriteLine( cnt );
		return;
	}
}


Measured memory_bytes: 34976
using System;
using System.Collections.Generic;
using System.Text;

namespace AtCoder
{
  class Program
  {
    static void Main(string[] args)
    {
      string[] ss = Console.ReadLine().Split(' ');
      int N = int.Parse(ss[0]);
      int A = int.Parse(ss[1]);
      int B = int.Parse(ss[2]);
      int amount = 0;
      int c = 0;
      for(int i = 0; i <= N; i++)
      {
        int sum = GetSum(i);
        if(A <= sum && sum <= B)
          amount += i;
      }
      Console.WriteLine(amount);
      Console.ReadLine();
    }

    private static int GetSum(int i)
    {
      int sum = 0;
      while(true)
      {
        sum += i % 10;
        i /= 10;
        if(i == 0)
          return sum;
      }
    }
  }
}

Measured memory_bytes: 27516
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  if((10 * b + c) % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jul  7 20:52:12 2019

@author: YudNK
"""

L,R = map(int, input().split())

if R - L >= 2019:
    print(0)
else:
    a = L%2019
    mod = [a]
    for i in range(R - L):
        if a + i + 1 < 2019:
            mod.append(a + i + 1)
        else:
            mod.append(0)
    mini = 2018
    while len(mod) > 1:
        for i in range(len(mod) - 1):
            b = (mod[-1] * mod[i]) % 2019
            if b < mini:
                mini = b
        mod.pop(-1)
    print(mini)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi					3.14159265359
ll INF=1e18+10;
ll MOD=1000000007;

int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	ll n;cin>>n;
	ll a[n],pos[n+1];
	multiset<ll> s;
	rep(i,0,n)
	{
	    cin>>a[i];
	    pos[a[i]]=i;
	}

	s.insert(-1);s.insert(-1);
	s.insert(n);s.insert(n);
	ll ans=0;
	for(ll i=n;i>=1;i--)
    {
        s.insert(pos[i]);
        auto x=s.find(pos[i]);
        auto y=x;
        x--;y++;
        int a=*x;x--;
        int b=*x;
        int p=*y;y++;
        int q=*y;
        //cout<<b<<" "<<a<<" "<<p<<" "<<q<<endl;
        ans+=((i*(a-b))*(p-pos[i]));
        ans+=((i*(q-p))*(pos[i]-a));
    }
    cout<<ans;
}


Measured memory_bytes: 6528
(defn for-input []
  (->> (clojure.string/split (read-line) #"\s")
    (map #(Integer/parseInt %))))

(defn input []
  (vector
    (for-input)
    (for-input)
    (for-input)))

(defn Palace [[[N] [T A] Hs]]
  (letfn [(temp [x] (Math/abs (- A (- T (* x 0.006)))))]
    (let [Hs' (mapv temp Hs)]
      (inc (.indexOf Hs' (apply min Hs'))))))

(->> (input)
  Palace
  println)

Measured memory_bytes: 68312
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		if (S.contains("RRR")) {
			System.out.println(3);
		} else if (S.contains("RR")) {
			System.out.println(2);
		} else if (S.contains("R")) {
			System.out.println(1);
		} else {
			System.out.println(0);
		}

	}

}

Measured memory_bytes: 35524
/*************************************************************************
  >         File: B.cc
  >       Author: lyyllyyl
  >         Mail: riho.yoshioka@yandex.com
  > Created Time: Sun 04 Sep 2016 08:18:12 PM CST
*************************************************************************/
#include <bits/stdc++.h>
using LL = long long;
int a[2222];
LL b[2222];

int main() {
  std::ios::sync_with_stdio(0);
  int n, x;
  std::cin >> n >> x;
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
    b[i] = a[i];
  }
  LL answer = 1LL << 60;
  for (int itr = 0; itr < n; itr++) {
    for (int i = 0; i < n; i++) b[(i + itr) % n] = std::min(b[(i + itr) % n], 1LL * a[i]);
    LL sum = std::accumulate(b, b + n, 0LL);
    answer = std::min(answer, sum + 1LL * itr * x);
  }
  std::cout << answer << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;


int main() {
    long N;
    cin >> N;
    vector<long> C(5), T(5);
    for (long i = 0; i < 5; i++) {
        cin >> C[i];
        T[i] = (N % C[i] > 0) ? N / C[i] + 1 : N / C[i];
    }

    sort(T.begin(), T.end());
    cout << T[4] + 4 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 1000000

int main(void){
  int i,j;
  int num[N];
  int a,d,n;

  num[0]=0;
  for(i=1;i<N;i++)
    num[i]=1;
  for(i=1;i<N;i++)
    if(num[i]==1)
      for(j=2*i+1;j<N;j+=i+1)
        num[j]=0;

  for(;;){
    scanf("%d%d%d",&a,&d,&n);
    if(a==0 && d==0 && n==0)
      break;

    for(i=a-1,j=0;;i+=d){
      if(num[i])
        j++;
      if(j==n){
        printf("%d\n",i+1);
        break;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 0
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n int
    fmt.Scan(&n)
    ans := "AGC"
    switch{
        case n < 1200:
            ans = "ABC"
        case n < 2800:
            ans = "ARC"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


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

using namespace std;


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

    for (int i = 0; i < n; ++i) {
        for (int j = 1; j < 9; ++j) {
            if (400 * (j - 1) <= a[i] && a[i] < 400 * j) ++cnt[j - 1];
        }
        if (a[i] >= 3200) ++cnt[8];
    }

    int cnt1 = 0, cnt2 = cnt[8];
    for (int i = 0; i < 8; ++i) {
        if (cnt[i] > 0) ++cnt1;
    }

    if (cnt1 == 0) cout << 1 << " " << cnt2 << endl;
    else cout << cnt1 << " " << cnt1 + cnt2 << endl;
}

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

#define R 0
#define D 1
#define L 2
#define U 3

#define MAX_R 20
#define MAX_C 20

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

int r, c;
string pg[MAX_R];
bool used[MAX_R][MAX_C][4][16]; // 座標, 方向

bool stop(int y, int x, int dir, int m) {
    while (true) {
        if (used[y][x][dir][m]) return false;
        used[y][x][dir][m] = true;
        switch (pg[y][x]) {
            case '<':
                dir = L;
                break;
            case '>':
                dir = R;
                break;
            case '^':
                dir = U;
                break;
            case 'v':
                dir = D;
                break;
            case '_':
                if (m == 0) dir = R;
                else dir = L;
                break;
            case '|':
                if (m == 0) dir = D;
                else dir = U;
                break;
            case '?':
                for (int i = 0; i < 4; i++) {
                    dir = i;
                    int ny = y + dy[dir];
                    if (ny < 0) ny = r-1;
                    if (ny >= r) ny = 0;
                    int nx = x + dx[dir];
                    if (nx < 0) nx = c-1;
                    if (nx >= c) nx = 0;
                    if (stop(ny, nx, dir, m)) return true;
                }
                return false;
            case '.':
                // Do nothing
                break;
            case '@':
                return true;
            case '0':
            case '1': case '2': case '3': 
            case '4': case '5': case '6':
            case '7': case '8': case '9':
                m = pg[y][x] - '0';
                break;
            case '+':
                if (m == 15) m = 0;
                else m++;
                break;
            case '-':
                if (m == 0) m = 15;
                else m--;
                break;
        }
        int ny = y + dy[dir];
        if (ny < 0) ny = r-1;
        if (ny >= r) ny = 0;
        int nx = x + dx[dir];
        if (nx < 0) nx = c-1;
        if (nx >= c) nx = 0;
        y = ny;
        x = nx;
    }
}

int main() {
    cin >> r >> c;
    for (int i = 0; i < r; i++) cin >> pg[i];
    int y, x;
    int m; // memory
    int dir; // direction
    y = x = 0;
    m = 0;
    dir = R;
    cout << (stop(y, x, dir, m) ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 2744
// template version 1.14
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;
const int MOD=1e9+7;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

signed main() {
  string s;cin>>s;
  int n = sz(s);
  int ans = 0;
  rep(i, n/2){
    if (s[i]!=s[n-1-i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


A, B = read_ints()
if A-B*2 > 0:
    print(A - B * 2)
else:
    print(0)


Measured memory_bytes: 3064
#include <stdio.h>
#define MAX_N (42)
int n;
int Pre[MAX_N];
int In[MAX_N];
int Post[MAX_N];

int pre_i;
int count;
void dfs(int l, int r);

int findIn(int l, int r, int v);


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

    for ( int i = 0; i < n; i++ ) {
	scanf("%d", &Pre[i]);
    }

    for ( int i = 0; i < n; i++ ) {
	scanf("%d", &In[i]);
    }

    pre_i = 0;
    count = 0;

    dfs( 0, n );

    return 0;
}


void dfs(int l, int r)
{
    if ( l < r ) {
	int cur = Pre[pre_i++];
	int m = findIn( l, r, cur );
	dfs( l, m );		// ?????¨?????¨
	dfs( m + 1, r );	// ?????¨?????¨
	printf("%d%c", cur, (count == n-1) ? '\n' : ' ');
	count++;
    }
}


int findIn(int l, int r, int v)
{
    for ( int i = l; i < r; i++ ) {
	if ( In[i] == v ) return i;
    }

    return -1;
}

Measured memory_bytes: 1024
import java.util.Scanner;

/**
 *
 * @author k16075kk
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        int[][] A = new int[n][m];
        int[] B = new int[m];
        int[] C = new int[n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                A[i][j] = sc.nextInt();
            }
        }
        for (int i = 0; i < m; i++) {
            B[i] = sc.nextInt();
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                C[i] += A[i][j] * B[j];
            }
        }

        for (int i = 0; i < n; i++) {
            System.out.println(C[i]);
        }
    }

}



Measured memory_bytes: 41444
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(){

	int a,b;
	vector<int> sums;
	
	while(cin>>a>>b){
		
		sums.push_back(a+b);
	}
	
	int sum = a+b;
	int ten=1, shou;
	vector<int> keta;
	

	for(int i=0 ; i<sums.size() ; i++){
		keta.push_back(0);
		while(1){
			shou = sums[i]/ten;
			
			if(shou == 0){
				break;
			}
			
			keta[i]++;
			ten *= 10;
		}
		ten = 1;
	}

	for(int i ; i<sums.size() ; i++){
		cout<<keta[i]<<endl;
	}
	
return 0;
}

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

using namespace std;

int main() {
	int n;
	int a = 0, d = 0;
	cin >> n;
	for (int s = 0; s <= n; s++) {
		int n_n = n - s;
		for (int i = 1; i * i <= n_n; i++) {
			if (n_n % 2 != 1) break;
			if (n_n % i == 0) {
				d++;
				if (i * i != n_n) d++;
			}
		}
		if (d == 8) a++;
		d = 0;
	}
	cout << a << endl;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)//少数出力
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {

	int n;
	scanf("%d", &n);
	while (n) {
		vector<ll> dp(n + 3);
		dp[0] = 1;
		rep(i, n) {
			dp[i + 1] += dp[i];
			dp[i + 2] += dp[i];
			dp[i + 3] += dp[i];
		}
		dp[n] = ceil(dp[n] / (double)10);
		dp[n] = ceil(dp[n] / (double)365);
		printf("%lld\n", dp[n]);
		scanf("%d", &n);
	}

	return 0;
}



Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define SORT(v) sort(v.begin(),v.end())
#define fori(i,a,b) for(ll i=a;i<b;i++)
#define M 1000000007
#define deb(x) cout<< #x << " " << x << endl;

double pi=3.14159265358979323846;

typedef pair<int,int> pii;
typedef pair<long long int, long long int>pll;
typedef vector<int>vi;
typedef vector<long long int>vl;
#define MAXN 10000001
 
int main ()
{
    ll T;
    T=1;
   //cin>>T;
    while(T--)
    {	
    ll a;
    cin>>a;
    cout<<(a+a*a +a*a*a);
  
    }
    
  
    
    return 0;
}


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

int64_t modpow(int64_t a, int64_t p, int64_t m)
{
  int64_t res = 1;
  for (int64_t e = a; p > 0; e = e * e % m, p /= 2) {
    if ((p & 1) != 0) {
      res *= e;
      res %= m;
    }
  }
  return res;
}

int main()
{
  int64_t n;
  cin >> n;
  const int64_t mod = 1'000'000'007;
  int64_t ans = 0;
  ans += modpow(10, n, mod);
  ans += modpow(8, n, mod);
  ans -= modpow(9, n, mod);
  ans -= modpow(9, n, mod);
  cout << (ans + mod + mod) % mod << endl;
}


Measured memory_bytes: 3608
from collections import Counter
from itertools import permutations
import sys
input = sys.stdin.readline
N, C = map(int, input().split())
D = [[int(x) for x in input().split()] for _ in range(C)]

cnt = [Counter() for _ in range(3)]

for i in range(N):
    c = [int(x)-1 for x in input().split()]
    for j in range(3):
        cnt[j].update(c[(3-(i+2)+j)%3::3])

ans = 1000*500*500+5
for p in permutations(range(C), 3):
    s = 0
    for j in range(3):
        for k, v in cnt[j].items():
            s += D[k][p[j]] * v
    ans = min(ans, s)

print(ans)

Measured memory_bytes: 3440
N=int(input())
A=[int(i) for i in input().split()]
S=[0]*(N+1)
for i in range(1,N+1):
    S[i]=S[i-1]+A[i-1]
dp=[[0]*N for i in range(N)]
for i in range(N):
    dp[i][i]=A[i]
for k in range(1,N):
    for i in range(N-k):
        j=i+k
        dp[i][j]=max(S[j]-S[i]-dp[i][j-1]+A[j],S[j+1]-S[i+1]-dp[i+1][j]+A[i])
print(2*dp[0][N-1]-S[N])

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
#define ALL(a)  (a).begin(),(a).end()
#define SZ(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

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

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    string S; cin >> S;
    ll ans = 0;
    REP(i, S.length() - 1) {
        if (S[i] != S[i + 1]) ans++;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) (v).begin(),(v).end()

using namespace std;

int main()
{
    while(1){
        int n;
        cin >> n;
        if(n==0){
            break;
        }
        vector<int> cnt(26,0);
        vector<string> c(n);
        bool flag = true;
        rep(i,n){
            cin >> c[i];
            if(flag){
                cnt[c[i][0]-'A']++;
                vector<int> vec = cnt;
                sort(all(vec),greater<int>());
                if(vec[0] > vec[1]+n-1-i){
                    cout << (char)('A' + (int)(max_element(all(cnt)) - cnt.begin())) << " " << i+1 << "\n";
                    flag = false;
                }
            }
        }
        if(flag){
            cout << "TIE\n";
        }
    }
}



Measured memory_bytes: 3140
#include <stdio.h>
#include <stdlib.h>

int main()
{
	char O[51], E[51];
	scanf("%s", O);
	scanf("%s", E);
	
	char pass[101];
	int i;
	for (i = 0; E[i] != 0; i++) {
		pass[i * 2] = O[i];
		pass[i * 2 + 1] = E[i];
	}
	if (O[i] != 0) {
		pass[i * 2] = O[i];
		pass[i * 2 + 1] = 0;
	} else pass[i * 2] = 0;
	
	printf("%s\n", pass);
	fflush(stdout);
	return 0;
}

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


int main() {
	string S, T;
	cin >> S;
	cin >> T;
	bool is_yes = true;
	for (int i = 0; i < S.length(); i++) {
		if (S[i] != T[i]) {
			is_yes = false;
			break;
		}
	}
	if (is_yes == true) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(x) x.begin(), x.end();
using namespace std;
using ll = long long;
using ii = pair<int, int>;

int main(){
	ios::sync_with_stdio(0);
	int n, x;
	cin >> n >> x;
	int pos = 0;
	int ans = 1;
	for(int i=0; i<n; ++i){
		int k; cin >> k;
		pos+=k;
		if(pos>x) continue;
		++ans;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 30
#define SIZE 16

int N,C;
int POW[17];
int shine_table[NUM][SIZE],push_table[NUM][SIZE];
int shine_value[NUM+1],push_value[NUM];
int dp[2][65536];

void func(){

	int sum;

	for(int i = 0; i < N; i++){

		sum = 0;
		for(int k = 0; k < SIZE; k++){
			scanf("%d",&shine_table[i][k]);

			sum += shine_table[i][k]*POW[k];
		}
		shine_value[i] = sum;
	}

	shine_value[N] = POW[SIZE]-1;

	for(int i = 0; i < C; i++){

		sum = 0;
		for(int k = 0; k < SIZE; k++){
			scanf("%d",&push_table[i][k]);

			sum += push_table[i][k]*POW[k];
		}
		push_value[i] = sum;
	}

	int CURRENT = 0,NEXT = 1;

	for(int state = 0; state < POW[SIZE]; state++){
		dp[CURRENT][state] = -1;
		dp[NEXT][state] = -1;
	}

	dp[CURRENT][shine_value[0]] = 0;
	int rest,next_state,add;

	for(int i = 0; i < N; i++){

		for(int state = 0; state < POW[SIZE]; state++){
			if(dp[CURRENT][state] == -1)continue;

			next_state = state|shine_value[i+1];
			dp[NEXT][next_state] = max(dp[NEXT][next_state],dp[CURRENT][state]);

			for(int k = 0; k < C; k++){

				add = 0;
				rest = 0;

				for(int loop = 0; loop < SIZE; loop++){

					if((state & (1 << loop))){
						if(push_table[k][loop] == 1){
							add++;
						}else{
							rest += POW[loop];
						}
					}
				}

				next_state = rest|shine_value[i+1];

				dp[NEXT][next_state] = max(dp[NEXT][next_state],dp[CURRENT][state]+add);
			}
		}

		for(int state = 0; state < POW[16]; state++){
			dp[CURRENT][state] = -1;
		}

		swap(CURRENT,NEXT);
	}

	int ans = 0;
	for(int state = 0; state < POW[SIZE]; state++)ans = max(ans,dp[CURRENT][state]);

	printf("%d\n",ans);
}

int main(){

	for(int i = 0; i < 17; i++)POW[i] = pow(2,i);

	while(true){
		scanf("%d %d",&N,&C);
		if(N == 0 && C == 0)break;

		func();
	}

	return 0;
}



Measured memory_bytes: 3892
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
const int INF = 1<<29;
//const int MODINF = 1000000007;
using namespace std;

int main(){
    int H, W, K;
    cin >> H >> W >> K;
    vector<vector<char>> S(H,vector<char>(W));
    rep(i, 0, H){
        rep(j, 0, W){
            cin >> S.at(i).at(j);
        }
    }
    int line_f = H * W;
    for(int tmp = 0; tmp < (1 << (H - 1)); tmp++){
        if (pow(2, H) <= tmp) break;
        vector<bool> h(W, false);
        bitset<10> t(tmp);
        int num = 0;
        rep (k, 0, 9){
            if(t.test(k)) num++;
        }
        int line = num;
        vector<int> line_count(num + 1, 0);
        rep(j, 0, W){
            int address = 0;
            rep(i, 0, H){
                
                if(S.at(i).at(j) == '1'){
                    line_count.at(address)++;
                }
                if(line_count.at(address) > K){
                    line++;
                    rep(k, 0, num + 1) line_count.at(k) = 0;
                    if (j == 0 || h.at(j - 1)){
                        line = INF;
                        goto SKIP;
                    }
                    h.at(j - 1) = true;
                    j--;
                    break;
                    
                }
                if(t.test(i)) address++;
            }
        }
        SKIP:
        line_f = min(line, line_f);
    }
    cout << line_f << endl;
}

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

#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define all(v) v.begin(), v.end()
#define rip return;
#define fo(i,a,b) for(int i = a ; a < b ? i <= b : i >= b ; i += (a < b ? 1 : -1))

#define F first
#define S second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using pii = pair <int, int>;
using pll = pair <ll, ll>;
using ld = long double;

const int mod = 1e9 + 7;
// const int mod = 998244353;
const ll inf = 2e9;
const ll INF = 1e18;
const ld EPS = 1e-7;

const int N = 1e6 + 55;

int dp[N], dp2[N];

int solve (string s) {
	s = "0" + s;
	int n = s.size();
	fo (i, 0, n + 1) {
		dp[i] = 0, dp2[i] = 0;
	}
	dp2[0] = 1;
	fo (i, 1, n) {
		int u = s[i - 1] - '0';
		dp[i] = min (dp[i - 1] + u, dp2[i - 1] + 10 - u);
		dp2[i] = min (dp2[i - 1] + 9 - u, dp[i - 1] + 1 + u);
	}
	return dp[n];
}

int to_int (string s) {
	int res = 0;
	for (char c : s) {
		res = res * 10 + c - '0';
	}
	return res;
}

int dig (int x) {
	int res = 0;
	while (x) res += x % 10, x /= 10;
	return res;
}

pair <int, int> brute (string s) {
	int u = to_int (s);
	int best = dig (u), sec = u;
	for (int v = u ; v <= 1e7 ; ++ v) {
		int cur = dig (v) + dig (v - u);
		if (cur < best) {
			sec = v;
			best = cur;
		}
		// best = min (best, dig (v) + dig (v - u));
	}
	return {best, sec};
}

int main () {
	// ios;
	// cout << fixed << setprecision (10);
	int tt = 1;
	// cin >> tt;
	while (tt-- || 0) {
		string s;
		cin >> s;
		// cout << brute (s).F << " " << brute (s).S << "\n";
		// if (solve (s) != brute (s).F) {
			// cout << "ERROR " << solve (s) << " " << brute (s).F << "\n\t" << brute (s).S << "\nERROR " << s << "\n";
			// return 0;
		// }
		cout << 
		solve(s);
		// cout << "\n";
	}
}




Measured memory_bytes: 10116
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n, k; cin >> n >> k;
    vector<ll> l(n);
    rep(i, n) cin >> l[i];
    sort(all(l));
    reverse(all(l));
    cout << accumulate(l.begin(), l.begin() + k, 0) << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  int a,b;
  cin>>a>>b;

  out(max(max((a+b),(a-b)),a*b));

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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 x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




int main(){
  ll n,m,d;
  cin>>n>>m>>d;

  ll ka=0;
  repo(i,n+1){
    if(i-d>0) ka++;
    if(d!=0 && i+d<n+1) ka++;
  }

  ld kaku=ka;
  kaku/=n*n;

  cout << fixed << setprecision (20); 
  cout << kaku*(m-1) << endl;

}

Measured memory_bytes: 256
#include "bits/stdc++.h" 
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i = ll(a); i <= ll(b); i++)
int main()
{
    ll n,a,b,cnt=0,b_rank=0;
    string s;
    cin>>n>>a>>b;
    cin>>s;
    cout<<endl;
    REP(i,0,s.length()-1)
    {
        if(s[i]=='a')
        {   
            if(cnt<(a+b))
            {
                cout<<"Yes"<<endl;
                cnt++;
            }
            else
                cout<<"No"<<endl;                  
        }
        else if(s[i]=='b')
        {   
            if(b_rank<b && cnt<(a+b))
            {
                cout<<"Yes"<<endl;
                cnt++;
                b_rank++;
            }
            else
                cout<<"No"<<endl;                    
        }
        else if(s[i]=='c')
            cout<<"No"<<endl;        
    }     
}

Measured memory_bytes: 896
N, T = map(int, input().split())
List = []
List2 = []
min = 1001

for i in range(N):
    M, B = map(int, input().split())
    List.append([M,B])
    M, B = 0, 0

for k in range(N):
    if int(List[k][1]) <= T:
        List2.append(List[k])

for n in range(len(List2)):
    if List2[n][0] <= min:
        min = List2[n][0]

if min == 1001:
    print('TLE')
else:
    print(min)


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

int main() {
    int n,k;
    int ans=0;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
       cin>>arr[i];
    sort(arr,arr+n);
    for(int i=0;i<k;i++)
       ans+=arr[i];
    cout<<ans;
	return 0;
}

Measured memory_bytes: 3612
#!/usr/bin/env python3
import sys
import numpy as np


def solve(K: int, N: int, A: "List[int]"):

    left = sorted(_left(K, A))
    right = sorted(_right(K, A))

    ans = max(sum(left[: len(left) - 1]), sum(right[: len(right) - 1]))

    print(ans)
    return


def _left(K, A):
    rev_a = list(A[::-1])
    end = A[0] + K - A[len(A) - 1]
    left = np.ediff1d(np.array(rev_a), to_end=[end]).tolist()
    left = [abs(l) for l in left]
    return left


def _right(K, A):
    end = A[0] + K - A[len(A) - 1]
    right = np.ediff1d(np.array(A), to_end=[end]).tolist()
    return right


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(K, N, A)


if __name__ == "__main__":
    main()


Measured memory_bytes: 43276
import sys
import numpy as np

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n = int(input())
    aa = np.array(input().split(), dtype="i8")
    bb = np.array(input().split(), dtype="i8")
    ans = 0
    for k in range(29):
        t = 1 << k
        t2 = t << 1
        am = aa % t2
        bm = bb % t2
        # am.sort(reverse=True)
        bm.sort()
        # print(am)
        # print(bm)
        cnt = n % 2
        cnt += sum(np.sum(np.searchsorted(bm, tk - am)) for tk in range(t, t * 4, t))
        if cnt % 2:
            ans += t
    print(ans)

main()


Measured memory_bytes: 37768
n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))
count = 0

for i in range(q):
    left = 0
    right = n
    while right - left > 1:
        mid = (left + right) // 2
        if S[mid] <= T[i]:
            left = mid
        else:
            right = mid
    count += (T[i] == S[left])

print(count)


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

#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x)	cout << #x << " " << x << endl;

typedef long long int ll;

int main() {

	IOS

	double x;
	cin >> x;

	double a = 100;
	int years = 0;

	while (a < x) {
		a = floor(a + a*0.01);
		years++;
	}

	cout << years << endl;

	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

#define int long long 

signed main()
{
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;

  if(a > b) swap(a, b);
  b -= a;

  int e = d-c; 
  bool ans = false;
  rep(i, n){
    if((n-1-i)%2 == 0){
      int f = (n-1-i) / 2; 
      if(i*c-e*f <= b and b <= i*d+e*f){
        ans = true;
//        cout << i << ":" << f << endl;
      }
    }
  }

  cout << (ans ? "YES" : "NO") << endl;


  return 0;
}


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

def solve(N: int, a: "List[int]"):
    min_cost = 10**9

    for target in range(-100,101):
        tmp = 0
        for i in range(N):
            tmp += (a[i]-target)**2
        min_cost = min(min_cost,tmp)
    print(min_cost)
    return


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
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std ;
int main()
{
     int n;
     int arr;
     int odd, eve1, eve2;
     while(cin >> n) {
        odd = eve1 = eve2 = 0;
        for(int i=0; i<n; i++) {
            cin >> arr;
            if(arr % 4 == 0) {
                eve2++;
            }
            else if(arr %2 == 0) {
                eve1++;
            }
            else {
                odd++;
            }
        }
        if(eve2 >= odd) {
            cout << "Yes\n";
        }
        else if(odd-1 == eve2 && !eve1) {
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
     }

    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [int(input()) for _ in range(m)]
ans = []

for i in range(n):
    calc = 0
    for j in range(m):
        calc += a[i][j] * b[j]
    ans.append(calc)

print(*ans, sep='\n')


Measured memory_bytes: 6020
//要は5が二つ7が一つあればよい
#include <stdio.h>
//はじめ
int main(void)
{
  int num[4],i,count5=0,count7=0;
  char str[16];
//数値を読み取る
  fgets(str,sizeof(str),stdin);
  sscanf(str,"%d%d%d",&num[0],&num[1],&num[2]);
//3回ループ
  for(i=0;i<3;i++)
  {
//数値を一つずつ調べる
    switch (num[i])
    {
//5か7ならそれぞれカウント
      case 5:
        count5++;
        break;
      case 7:
        count7++;
        break;
      default :
        break;
    }
//ループここまで
  }
//カウンターをチェック,結果を表示
  if((count5==2)&&(count7==1))
  {
    printf("YES");
  }
  else
  {
    printf("NO");
  }
  return 0;
}
//おわり

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll N, M;
    cin >> N >> M;

    ll olt, ort, elt, ert, olen, elen;
    olen = M;
    elen = M-1;
    if(olen % 2 == 0) swap(olen, elen);

    olt = 1;
    ort = olt + olen;
    elt = ort + 1;
    ert = elt + elen;

    while(olt < ort) {
        cout << olt << " " << ort << endl;
        olt++, ort--;
    }
    while(elt < ert) {
        cout << elt << " " << ert << endl;
        elt++, ert--;
    }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,i,c=0;
  string is;
  cin>>A>>B;
  for(i=A;i<=B;i++){
    is = to_string(i);
    if(is[0]==is[4] && is[1]==is[3])c++;
  }
  cout<<c<<endl;
}

Measured memory_bytes: 256
m = Array.new(5){Array.new(5, 0)}
3.times do
  a, b = gets.chomp.split(" ").map(&:to_i)
  m[a][b] = 1
  m[b][a] = 1
end

[1, 2, 3, 4].permutation do |x|
  flag = true
  x.each_cons(2) do |a, b|
    if m[a][b] == 0
      flag = false
      break
    end
  end
  if flag
    puts "YES"
    exit
  end
end
puts "NO"

Measured memory_bytes: 1788
A[5][4][11],N,i,j,k,t;
main(void){
    for(scanf("%d",&N);N--;){
        scanf("%d%d%d%d",&i,&j,&k,&t);
        A[i][j][k]+=t;
    }
    for(i=1;i<5;i++){
        for(j=1;j<4;j++){
            for(k=1;k<11;k++){
                printf(" %d%s",A[i][j][k],k==10?"\n":"");
            }
        }
        if(i<4)
        puts("####################");
    }
}

Measured memory_bytes: 1800
import itertools

n,m,q= map(int, input().split())
x= [list(map(int, input().split())) for i in range(q)]

ans=0
y=[i for i in range(m)]
for v in itertools.combinations_with_replacement(y,n):
    cnt=0
    for a,b,c,d in x:
        a-=1
        b-=1
        if v[b]-v[a]==c:
            cnt+=d
    ans=max(cnt,ans)
print(ans)

Measured memory_bytes: 67760
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 1004
#define mod 998244353
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define vll vector<ll>
#define out(s) cout<<s
#define outs(s,a) cout<<s<<a
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
void solve(){
    ll a,b,c,d;
    in2(a,b);
    in2(c,d);
    while(true){
        if(a>0){
            c-=b;
        }else{
            cout<<"No\n";
            return;
        }
        if(c>0){
            a-=d;
        }else{
            cout<<"Yes\n";
            return;
        }
    }
}
int main(){
    clock_t t1=clock();
    gear_change;
    ll test=1;
    // in(test);
    while(test--){
        solve();
    }
    clock_t t2=clock();
    cerr<<"Time elapsed:- "<<(double)(t2-t1)/CLOCKS_PER_SEC<<'\n';
}    

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


void solve() {
    int i,j,k,l,r,x,y; string s;
    bool exit = false;
    int N;
    cin>>N;
    vector<string> W;
    FOR(i,N){
        cin >> s;
        W.push_back(s);
    }
    //double
    set<string> setW(ALL(W));
    if(setW.size() != W.size()){
        cout<<"No"<<endl;
        return;
    }
    FOR(i,N-1){
        if(W[i][W[i].size()-1] != W[i+1][0]){
            cout<<"No"<<endl;
            return;
        }
    }






    cout<< "Yes" <<endl;
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 256