akhauriyash/Code-Regression huggingface dataset:
N = int(input())

import collections
i2unkinds = collections.defaultdict(set)
i2honest = collections.defaultdict(set)
for i in range(N):
  A = int(input())
  for _ in range(A):
    x, y = map(int, input().split())
    if (y == 0):
      i2unkinds[i].add(x - 1)
    else:
      i2honest[i].add(x - 1)



ans = 0
def recursive(i, says, honest, unkinds):
  if i == N:
    if not (honest & unkinds) and not (honest ^ says) and says:
      global ans
      ans = max(ans, len(honest))
  else:
    recursive(i + 1, says | {i}, honest | {i} | i2honest[i], unkinds | i2unkinds[i])
    recursive(i + 1, says, honest, unkinds)

recursive(0, set(), set(), set())
print(ans)


Measured memory_bytes: 3316
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
# 盤面の受け取り
H,W = map(int,input().split())
board = [[] for _ in range(H*2)]
for i in range(H):
    board[2*i] = list(input())
    board[2*i+1] = board[2*i].copy()

# print(*ans)   # unpackして出力。間にスペースが入る
for row in board:
    print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 4608
a,b,c = map(int,input().split())
ans = 0

while True:
    if a%2 == 0 and b%2 == 0 and c%2 == 0:
        pass
    else:
        print(ans)
        exit()
    
    last_a = a
    last_b = b
    last_c = c
    a,b,c = (b+c)//2, (a+c)//2, (a+b)//2
    
    ans += 1
    
    if last_a == a and last_b == b and last_c == c:
        print(-1)
        exit()

Measured memory_bytes: 3064
/*
 * src.cpp
 *
 *  Created on: 2016/08/04
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

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

const int MAX_N=1e4;

int n;
int p[3];

char out[MAX_N+5];

int main(){
	do{
		cin>>n;
		if (n){
			REP(i,n){
				int ave=0;
				bool f=false;
				REP(j,3){
					cin>>p[j];
					ave+=p[j];
					if (p[j]==100){
						f=true;
					}
				}
				if (f){
					out[i]='A';
				}else if (p[0]+p[1]>=180){
					out[i]='A';
				}else if (ave>=80*3){
					out[i]='A';
				}else if (ave>=70*3){
					out[i]='B';
				}else if (ave>=50*3 && (p[0]>=80 || p[1]>=80)){
					out[i]='B';
				}else{
					out[i]='C';
				}
			}
			REP(i,n){
				cout<<out[i]<<endl;
			}
		}
	}while (n);
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

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

int x[100010];
signed main(void)
{
	int n, a, b;
	cin >> n >> a >> b;
	REP(i, n) cin >> x[i];
	
	int ret = 0;
	FOR(i, 1, n) {
		ret += min(a*(x[i]-x[i-1]), b);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    int i;
    string S;
    cin >> S;
    if(S == "ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
    return 0;
}



Measured memory_bytes: 3576
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]

X = I()

a = X // 500
c = (X - 500*a) // 5


print(a*1000 + c*5)

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}
string Decode(string s, int n){
  string res = s;
  rep(i,s.size()){
    if(s[i] != '.' && s[i] != ' '){
      if(s[i] + (n%26) > 'Z'){
        res[i] = 'A' + (s[i] + (n%26) - 'Z')-1;
      }
      else{
        res[i] = s[i] + (n%26);
      }
    }
  }
  return res;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  getline(cin,s);
  cout << Decode(s,23) << endl;
}

Measured memory_bytes: 3220
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int k = sc.nextInt();
		int x = sc.nextInt();
		for (int i = -k + 1; i < k; i++) {
			System.out.print(x + i);
			if (i == k - 1) {
				System.out.println();
			}else {
				System.out.print(" ");
			}
		}
	}
}


Measured memory_bytes: 22608
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long LL;
const LL INF=1e18;
int N,K,i,j;
int X[1234];
int A[1234][1234];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>K;
    if(K<=500)
    {
        cout<<K;
        for(i=0;i<K;i++)
        {
            cout<<'\n';
            for(j=0;j<K;j++)
                cout<<j+1<<' ';
        }
        cout<<endl;
        return 0;
    }
    N=K+3>>2<<1;
    for(i=0;i<N;i++)
        for(j=0;j<N;j++)
            A[i][j]=(i&1)*N+(i+j)%N;
    for(i=0;i<K;i++)
        X[i]=i;
    for(i=K;i<N*2;i++)
        X[i]=i-N;
    cout<<N;
    for(i=0;i<N;i++)
    {
        cout<<'\n';
        for(j=0;j<N;j++)
            cout<<X[A[i][j]]+1<<' ';
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
#define ROUNDUP(divisor,dividend) (divisor + (dividend - 1)) / dividend
int w,h,x,y;
int main(){
  cin >> w >> h >> x >> y;
  printf("%.10lf %d\n", (double(w)*double(h))/2 ,((double)w/2 == x && (double)h/2 == y ? 1 : 0));
}


Measured memory_bytes: 256
n,m = map(int,input().split())
a = []
b = []
ans = False
for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())
for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            for l in range(m):
                if a[i+k][j+l] != b[k][l]:
                    break
            else:
                continue
            break
        else:
            ans = True
if ans:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string.h>
#include <stdlib.h>
#include <limits>
#include <iomanip>
using namespace std;

int main(){

    int A1, A2, A3;

    cin >> A1 >> A2 >> A3;

    int sum = A1 + A2 + A3;
    if(sum >= 22) cout << "bust" << endl;
    else cout << "win" << endl;


}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 20:52:57 2020

@author: over-
"""


N, K=map(int,input().split())
a=input().split()
a=[int(i) for i in a]
a.sort()

dp=[0]*(K+1)
dp[0]=1

for i in range(1,K+1):
    dp[i]=1
    for j in a:
        if j > i: break
        if dp[i-j]==1: 
            dp[i]=0
            break
          
            

    
if dp[-1]==0:
    print('First')
else:
    print('Second')
        
        
        





Measured memory_bytes: 3828
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#ifndef LOCAL
#define endl '\n'
#endif

const int mod = 1e9 + 7;

int pwr(int a,int b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	if(s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int a,b,c,d,e;
  for(e=1;;e++){
  scanf("%d %d",&b,&d);
  if(b==0&&d==0)break;
  for(a=0;a<b;a++){
  for(c=0;c<d;c++){
    printf("#");
  }
  printf("\n");
  }
  printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int count = 0;
		for(int i=1;i<=n;i++) {
			count = count + i;
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 19668
#include <bits/stdc++.h>
    using namespace std;
    #define PB push_back
    #define MP make_pair
    #define fora(i,a,b) for(int i = a ; i<b ;i++)
    typedef long long ll;
    typedef int i;
    typedef vector<i>vi;
    typedef pair<i,i>pi;
     
    ll v[100010][10];
    ll dp[110][100010];
    ll f(int i, ll W){
        if(W < 0) return -1e9;
        if(i == 0) return 0;
        ll &r = dp[i][W];
        if(r !=-1) return r;
        r = max( f(i-1 ,W)  , f(i-1 , W-v[i][0])+v[i][1]);
        return r;
    }
    int main(){
        //freopen("in.txt","r",stdin);
        ios::sync_with_stdio(0);
        cin.tie(0);
        int n;
        ll W;
        cin>>n>>W;
        memset(dp,-1,sizeof dp);
        fora(i,1,n+1) cin>>v[i][0]>>v[i][1];
        cout<<f(n,W)<<"\n";
        return 0;
    }

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

using namespace std;

using int64 = long long;

template< typename Monoid, typename OperatorMonoid = Monoid >
struct LazySegmentTree
{
  using F = function< Monoid(Monoid, Monoid) >;
  using G = function< Monoid(Monoid, OperatorMonoid) >;
  using H = function< OperatorMonoid(OperatorMonoid, OperatorMonoid) >;
  using P = function< OperatorMonoid(OperatorMonoid, int) >;

  int sz;
  vector< Monoid > seg, lazy;
  const F f;
  const G g;
  const H h;
  const P p;
  const Monoid M1;
  const OperatorMonoid OM0;


  LazySegmentTree(int n, const F f, const G g, const H h, const P p, const Monoid &M1, const OperatorMonoid OM0)
      : f(f), g(g), h(h), p(p), M1(M1), OM0(OM0)
  {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
    lazy.assign(2 * sz, OM0);
  }

  void set(int k, const Monoid &x)
  {
    seg[k + sz] = x;
  }

  void build()
  {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void propagate(int k, int len)
  {
    if(lazy[k] != OM0) {
      if(k < sz) {
        lazy[2 * k + 0] = h(lazy[2 * k + 0], lazy[k]);
        lazy[2 * k + 1] = h(lazy[2 * k + 1], lazy[k]);
      }
      seg[k] = g(seg[k], p(lazy[k], len));
      lazy[k] = OM0;
    }
  }

  Monoid update(int a, int b, const OperatorMonoid &x, int k, int l, int r)
  {
    propagate(k, r - l);
    if(r <= a || b <= l) {
      return seg[k];
    } else if(a <= l && r <= b) {
      lazy[k] = h(lazy[k], x);
      propagate(k, r - l);
      return seg[k];
    } else {
      return seg[k] = f(update(a, b, x, 2 * k + 0, l, (l + r) >> 1),
                        update(a, b, x, 2 * k + 1, (l + r) >> 1, r));
    }
  }

  Monoid update(int a, int b, const OperatorMonoid &x)
  {
    return update(a, b, x, 1, 0, sz);
  }


  Monoid query(int a, int b, int k, int l, int r)
  {
    propagate(k, r - l);
    if(r <= a || b <= l) {
      return M1;
    } else if(a <= l && r <= b) {
      return seg[k];
    } else {
      return f(query(a, b, 2 * k + 0, l, (l + r) >> 1),
               query(a, b, 2 * k + 1, (l + r) >> 1, r));
    }
  }

  Monoid query(int a, int b)
  {
    return query(a, b, 1, 0, sz);
  }

  Monoid operator[](const int &k)
  {
    return query(k, k + 1);
  }
};


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

  auto f = [&](int64 a, int64 b) { return a + b; };
  auto p = [&](int64 a, int b) { return a * b; };
  LazySegmentTree< int64 > seg(N, f, f, f, p, 0, 0);

  while(Q--) {
    int T, X, Y;
    scanf("%d %d %d", &T, &X, &Y);
    if(T == 0) {
      int Z;
      scanf("%d", &Z);
      seg.update(X - 1, Y, Z);
    } else {
      printf("%lld\n", seg.query(X - 1, Y));
    }
  }
}



Measured memory_bytes: 7072
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let A: usize = sc.get();
    let B: usize = sc.get();
    let mut cur = 1;
    let mut ans = 0;
    while cur < B {
        cur -= 1;
        cur += A;
        ans += 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
using System;

namespace ABC132
{
    class C
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');

            int[] d = new int[N];
            for (int i = 0; i < N; i++)
            {
                d[i] = int.Parse(input[i]);
            }

            Array.Sort(d);

            int[] s = new int[N];
            int tmp = d[0];
            int res = 0;
            for (int i = 0; i < N - 1; i++)
            {
                if (tmp != d[i + 1])
                {
                    if (d.Length - (i + 1) == (i + 1))
                    {
                        res = d[i + 1] - d[i];
                        Console.WriteLine(res);
                        return;
                    }
                    tmp = d[i + 1];
                }
            }

            Console.WriteLine(0);

        }
    }
}


Measured memory_bytes: 17248
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct {
	char name[100]; //Is it OK if name isn't array?
	int t;
} P;

P Q[LEN];
int head, tail, n;

void enqueue(P x) {
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}

P dequeue() {
	P x = Q[head];
	head = (head + 1) % LEN;
	return x;
}

int min( int a, int b) { return a < b ? a : b;}

int main() {
	int elaps = 0, c;
	int i, q;
	P u;
	scanf("%d %d", &n, &q);

	for ( int i = 1; i <= n; i++) {
		scanf("%s", Q[i].name); //Q.name??????????????????? name[100]??????????????????
		scanf("%d", &Q[i].t);
		}
head = 1; tail = n + 1;

while(head != tail ) {
	u = dequeue();
	c = min(q, u.t);
	u.t -= c;
	elaps += c;
	if( u.t > 0 ) enqueue(u);
	else {
		printf("%s %d\n", u.name, elaps);
	}
}

return 0;
}

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

using namespace std;

const int maxn = 22;
const int mod = 1e9+7;

typedef long long ll;

int n;

ll dp[1<<maxn][maxn];

bool a[maxn][maxn];

ll solve(int mask, int pos)
{
	if (pos == n) return 1;
	if (dp[mask][pos] != -1) return dp[mask][pos];

	ll ans = 0;
	for (int i = 0; i < n; i++)
		if (!(mask&(1<<i)) && a[pos][i])
			ans = (ans+solve(mask|(1<<i), pos+1))%mod;

	return dp[mask][pos] = ans;
}

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

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

	memset(dp, -1, sizeof dp);

	cout << solve(0, 0) << "\n";
}

Measured memory_bytes: 721152
N, M = map(int, input().split())

ab_list = []
for i in range(N):
    a, b = map(int, input().split())
    ab_list.append((a, b))

ab_list = sorted(ab_list, key=lambda x: x[0])

buy_num = 0
money = 0
for cur_ab in ab_list:
    a, b = cur_ab[0], cur_ab[1]
    if b < (M - buy_num):
        buy_num += b
        money += a * b
    else:
        money += a * (M - buy_num)
        buy_num = M
        break

print(money)

Measured memory_bytes: 18932
#include <iostream>
using namespace std;
int main(void){    
    int candy;
    while(cin >> candy){
        int num=candy % 39;
        if(num == 0) cout << "3C39" << endl;
        else if(num >= 1 && num <= 9) cout << "3C0" << candy % 39 << endl;
        else cout << "3C" << candy % 39 << endl;
    }
    
}



Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,b;
  cin>>n>>a>>b;
  if ((abs(a-b))%2==0){cout<<"Alice"<<endl;}
  else if ((abs(a-b))%2!=0){cout<<"Borys"<<endl;}
  else {cout<<"Draw"<<endl;}
        return 0;

}


Measured memory_bytes: 256
import java.util.Scanner

fun main(args:Array<String>){
    val cin = Scanner(System.`in`)
    val w = cin.nextInt()
    val h = cin.nextInt()
    val x = cin.nextInt()
    val y = cin.nextInt()
    val r = cin.nextInt()

    if(0 <= x-r && x-r <= w && 0 <= x+r && x+r <= w && 0 <= y-r && y-r <= h && 0 <= y+r && y+r <= h ){
	println("Yes")
    }else{
	println("No")
    }
}



Measured memory_bytes: 25636
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws Exception
	{
		int n=nextInt();
		int c0=0,c1=0,c2=0,c3=0;
		for(int i=1;i<=n;i++)
		{
			String s=nextLine();
			switch(s)
			{
				case "AC":c0++;break;
				case "RE":c1++;break;
				case "WA":c2++;break;
				case "TLE":c3++;break;
			}
		}
		out.println("AC x "+c0);
		out.println("WA x "+c2);
		out.println("TLE x "+c3);
		out.println("RE x "+c1);
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws Exception
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws Exception{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws Exception{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws Exception{
		return br.readLine();
	}
	int nextInt()throws Exception{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws Exception{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws Exception{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 42796
#include <iostream>
#define MOD 1000000007

typedef long long Long;

int n;
int arr[200001];
Long sum[200001];

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

    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", arr+i);
        sum[i] = sum[i-1] + arr[i];
    }

    Long result = 0;
    for (int i = 1; i <= n; ++i)
    {
        result += (arr[i] % MOD) * (sum[i-1] % MOD);
        result %= MOD;
    }

    printf("%lld", result);

    return 0;
}

Measured memory_bytes: 6152
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n,m = f()
    ans = 0
    if m< n*2:
        print(m//2)
    else:
        ans += n
        m -= 2*n
        print(ans + m//4)

solve()


Measured memory_bytes: 2940
num = list(map(int, input()))

f = num[0]*10 + num[1]
b = num[-2]*10 + num[-1]

if 0 < f <= 12 and 0 < b <= 12:
    print('AMBIGUOUS')
elif 0 < f <= 12:
    print('MMYY')
elif 0 < b <= 12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
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;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

void solve(){
    ll n,m;cin>>n>>m;
    vvl a(n,vl(m));rep(i,n)rep(j,m)cin>>a[i][j];
    vl b(m);rep(i,m)cin>>b[i];

    vl c(n);
    rep(i,n){
        rep(j,m){
            c[i]+=a[i][j]*b[j];
        }
    }
    rep(i,n){
        cout<<c[i]<<endl;
    }
}

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



Measured memory_bytes: 3208
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int INF = 1 << 30;
const int N = 500010;
int n,cnt;
int A[N]; int L[N>>1]; int R[N>>1];
void Merge(int left, int mid, int right)
{
	int n1 = mid - left;
	int n2 = right - mid;

	for(int i = 0; i < n1; i ++)
		L[i] = A[left + i];
	for(int i = 0; i < n2; i ++)
		R[i] = A[mid + i];
	L[n1] = INF; R[n2] = INF;
	int i = 0; int j = 0;
	for(int k = left; k < right; k ++)
	{
		cnt ++;
		if(L[i] <= R[j]) {A[k] = L[i]; i++;}
		else { A[k] = R[j];j++;}
	}
}
void Merge_Sort(int left,int right)
{
  	if (left+1 < right)
  	{
    	int mid = (left + right) >> 1;
        Merge_Sort(left, mid);
        Merge_Sort(mid, right);
        Merge(left, mid, right);
    }
}
void print()
{
	for(int i = 0; i < n; i ++)
	{
		if(i == n-1) printf("%d\n",A[i]);
		else printf("%d ",A[i]);
	}
	printf("%d\n",cnt);
	return ;
}
int main()
{
	cnt = 0;
	scanf("%d",&n);
	for(int i = 0; i < n; i ++)
		scanf("%d",&A[i]);
	Merge_Sort(0,n);
	print();
	return 0;
}

Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
const int maxn=4e5+5;
const int inf=0x3f3f3f3f;
inline int read(){
	char c=getchar();int t=0,f=1;
	while((!isdigit(c))&&(c!=EOF)){if(c=='-')f=-1;c=getchar();}
	while((isdigit(c))&&(c!=EOF)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int n,s,t;
struct edge{
	int v,p,w;
}e[maxn<<1];
int h[maxn],cnt=1;
inline void add(int a,int b,int c){
	e[++cnt].p=h[a];
	e[cnt].v=b;
	e[cnt].w=c;
	h[a]=cnt;
}
int dis[maxn];
bool bfs(){
	queue<int> q;
	while(!q.empty())q.pop();
	q.push(s);
	memset(dis,0,sizeof(dis));
	dis[s]=1;
	while(!q.empty()){
		int u=q.front();q.pop();
		for(int i=h[u];i;i=e[i].p){
			int v=e[i].v;
			if(e[i].w&&!dis[v]){
				dis[v]=dis[u]+1;
				q.push(v);
			}
		}
	}
	return dis[t];
}
int ht[maxn];
int dfs(int u,int rest){
	if((u==t)||rest==0)return rest;
	int tot=0;
	for(int &i=ht[u];i;i=e[i].p){
		int v=e[i].v;
		if(e[i].w&&dis[v]==dis[u]+1){
			int di=dfs(v,min(rest,e[i].w));
			e[i].w-=di;e[i^1].w+=di;
			rest-=di;tot+=di;
			if(rest==0)break;
		}
	}
	return tot;
}
int dinic(){
	int ans=0;
	while(bfs()){
		int di=0;
		for(int i=s;i<=t;i++)ht[i]=h[i];
		while(di=dfs(s,inf))ans+=di;
	}
	return ans;
}
int cho[maxn];
vector<int> g[maxn];
typedef pair<int,int> pii;
pii res[maxn];
bool get(){
	for(int u=1;u<n;u++){
		for(int i=h[u];i;i=e[i].p){
			int v=e[i].v;
			if(v!=s&&(e[i].w==0)){cho[v-n]=u;}
		}
	}
	queue<int> q;
	while(!q.empty())q.pop();
	q.push(n);int sum=0;
	while(!q.empty()){
		int u=q.front();q.pop();sum++;
		for(int i=0;i<g[u].size();i++){
			int v=g[u][i];
			if(cho[v])res[v]=pii(u,cho[v]),q.push(cho[v]),cho[v]=0;
		}
	}
	return sum==n;
}
signed main(){
	n=read();s=0,t=n+n;
	for(int i=1;i<n;i++){
		int k=read();
		for(int j=1;j<=k;j++){
			int x=read();
			if(x!=n){
			add(x,i+n,1);
			add(i+n,x,0);
			}
			g[x].push_back(i);
		}
		add(s,i,1);
		add(i,s,0);
		add(i+n,t,1);
		add(t,i+n,0);
	}
	if(dinic()<n-1){puts("-1");return 0;}
	if(!get()){puts("-1");return 0;}
	for(int i=1;i<n;i++)
	printf("%d %d\n",res[i].first,res[i].second);
	return 0;
}


Measured memory_bytes: 33044
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

ll dp[110][100100];
	
int main(){
	ll n, wc; cin >> n >> wc;
	vector<ll> w(n+1, 0);
	vector<ll> v(n+1, 0);
	for( int i = 1; i <= n; ++i ){
		cin >> w[i] >> v[i];
	}
	for( int i = 0; i < 100100; ++i ){
		dp[0][i] = INF;
	}
	for( int i = 0; i < 110; ++i ){
		dp[i][0] = 0;
	}
	ll sum = 0;
	for( ll i = 1; i <= n; ++i ){
		sum += v[i];
		for( ll j = 1; j < 100100; ++j ){
			dp[i][j] = dp[i-1][j];
			if( j >= v[i] ){
				dp[i][j] = min( dp[i][j], dp[i-1][j-v[i]] + w[i] ); 
			}
		}
	}
	/*
	for( int i = 0; i <= 3; ++i ){
		for( int j = 0; j <= 14; ++j ){
			if( dp[i][j] == INF ){
				cout << "∞ ";
			} else {
				cout << dp[i][j] << " ";
			}
		}
		cout << endl;
	}
	*/
	int ans = 0;
	for( int i = sum; i > 0; --i ){
		if( dp[n][i] <= wc ){
			ans = max(ans, i);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 86272
N, M = map(int, input().split())
C = list(map(int, input().split()))

# dp[i][j] := C[i]までのコインを使ってj円を支払うときのコインの最小枚数
dp = [[10 ** 9] * (N+1) for _ in range(M+1)]
dp[0][0] = 0
for i in range(1,M+1):
    for j in range(N+1):
        if j - C[i-1] >= 0:
            dp[i][j] = min(dp[i][j-C[i-1]]+1, dp[i-1][j])
        else:
            dp[i][j] = dp[i-1][j]

print(dp[M][N])



Measured memory_bytes: 43732
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n = int(input())
    d = defaultdict(int)
    ans = 0
    for i in range(n):
        s = input()
        ans+=s.count("AB")
        if s[0] == "B" and s[-1] == "A":
            d[0] += 1
        elif s[0] == "B":
            d[1]+=1
        elif s[-1] == "A":
            d[2] += 1

    if d[0] > 0:
        ans += d[0] - 1
        if d[1] > 0 and d[2] > 0:
            ans += 2
            ans += min(d[1] - 1 , d[2] - 1)
        elif d[1] > 0 and d[2] == 0:
            ans += 1
        elif d[1] == 0 and d[2] > 0:
            ans += 1
    else:
        ans+=min(d[1] , d[2])

    print(ans)

if __name__ == '__main__':
    main()


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

typedef pair<int, int> P;

int main(){
    while (1){
        int r, n;
        cin >> r >> n;
        if (r == 0 && n == 0) break;
        vector<double> rnd(2*r + 1, -r);
        for (int i = 0; i <= r; i++){
            rnd[r - i] += sqrt(r * r - i * i);
            if (i != 0) rnd[r + i] += sqrt(r * r - i * i);
        }
        vector<int> border(2*r, 0);
        for (int i = 0; i < n; i++){
            int left, right, height;
            cin >> left >> right >> height;
            for (int j = left; j < right; j++){
                if (j + r < 0 || j + r >= 2*r) continue;
                border[j+r] = max(border[j+r], height);
            }
        }
        double t = 0.0000;
        bool flag = false;
        while (1){
            for (int i = 0; i <= 2*r; i++) rnd[i] += 0.00005;
            for (int i = 0; i < 2*r; i++){
                if (border[i] < rnd[i] || border[i] < rnd[i+1]){
                    cout << t << endl;
                    flag = true;
                    break;
                }
            }
            if (flag) break;
            t += 0.00005;
        }
    }
}


Measured memory_bytes: 3296
#pragma GCC optimize("Ofast")
#include <iostream>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <utility>
#include <complex>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;

const ll oo=1e18;
const int MOD=1000000007;
const int INF=1000000000;
const ld EPS=0.000000001;

int a[100005]={0};

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int l=0,r,tmp;
    string s;
    cin>>r;
    cout<<l<<endl;
    cin>>s;
    if(s[0]=='V') return 0;
    else if(s[0]=='M') a[l]=0;
    else a[l]=1;
    a[r]=a[0];
    tmp=(l+r)/2;
    while(1) {
        cout<<tmp<<endl;
        cin>>s;
        if(s[0]=='V') return 0;
        else if(s[0]=='M') a[tmp]=0;
        else a[tmp]=1;
        if((a[l]!=a[tmp]&&(tmp-l)%2==0)||(a[l]==a[tmp]&&(tmp-l)%2==1)) {
            r=tmp;
        }
        else l=tmp;
        tmp=(l+r)/2;
    }
    return 0;
}


Measured memory_bytes: 972
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ull N;
  cin >> N;
  cout << N * (N - 1) / 2 << endl;
  return 0;
}


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

#define _ << " " <<
#define tr(x) cout << #x _ x << endl
#define fi first
#define se second

#ifdef _WIN32
#define LD "%I64d"
#else
#define LD "%ld"
#endif

using namespace std;

typedef long long ll;

char s[12];

int read() {
    if (scanf("%s", s) < 1) {
        return 0;
    }
    return 1;
}

void solve() {
    for (int i = 0; i < 12; i++) {
        printf("%c", s[i]);
        if (i == 3) printf(" ");
    }
    printf("\n");
}

int main(int argc, char *argv[]) {
    while (read()) {
        solve();
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

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

    int n, k;
    cin >> n >> k;
    YES((n + 1) / 2 >= k);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-6;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair

ll Q,H,S,D,N;

void solve()
{
	ll ans = S*N;
	if(4*Q < S) ans = min(ans, 4*N*Q);
	ans = min(ans, 2*H*N);
	if(N >=2){
		ll useT = N/2, left = N%2;
		ans = min(ans, useT*D+left*S);
		ans = min(ans, useT*D+left*2*H);
		ans = min(ans, useT*D+left*4*Q);
	}	
	cout << ans << endl;
}

int main()
{
	cin >> Q >> H >> S >> D >> N;
	solve();
}

Measured memory_bytes: 256
class UnionFind(object):
    def __init__(self, size):
        self.parent = [i for i in range(size)]
        self.rank = [0 for _ in range(size)]
        self.sizes = [1 for _ in range(size)]

    
    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            return self.find(self.parent[x])
    
    def root(self, x):
        if self.parent[x] == x:
            return x
        else:
            root_x = self.root(self.parent[x])
            self.parent[x] = root_x
            return root_x


    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
            self.sizes[y] += self.sizes[x]
        else:
            self.parent[y] = x
            self.sizes[x] += self.sizes[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def size(self, x):
        return self.sizes[self.find(x)]

N,M = map(int, input().split())

u = UnionFind(N)

for m in range(M):
    xyz = [int(i)-1 for i in input().split()]
    u.unite(xyz[0],xyz[1])

for n in range(N):
    u.root(n)

print(len(list(set(u.parent))))

Measured memory_bytes: 87840
#!/usr/bin/env python3
#キーエンス C

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7

n = int(sys.stdin.readline())
a = list(map(int,sys.stdin.readline().split()))
b = list(map(int,sys.stdin.readline().split()))
s = 0
c = []
ans = 0
for i in range(n):
    if a[i] < b[i]:
        s += b[i] - a[i]
        ans += 1
    else:
        c.append(a[i]-b[i])
c.sort(reverse = True)
for i in c:
    if s > 0:
        s -= i
        ans += 1
    else:
        break
if s > 0:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 73648
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 20000005
#define eps 1e-10
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	int n,a,b;
	read(n);read(a);read(b);
	out(min(a,b));space;out(max(0,a + b - n));enter;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using ll = unsigned long long;
using namespace std;

ll my_lower_bound(ll val, ll* target, size_t tsize){

    ll mid = 0;
    ll l = 0;
    ll r = tsize;

    while(l < r) {
        mid = (l + r)/2;
        if(target[mid] < val) {
            l = mid + 1;
        } else{
            r = mid; 
        }
    }

    return l;
}

ll my_upper_bound(ll val, ll* target, size_t tsize){

    ll mid = 0;
    ll l = 0;
    ll r = tsize;

    while(l < r) {
        mid = (l + r)/2;
        if(val < target[mid]) {
            r = mid;
        } else{
            l = mid + 1; 
        }
    }

    return l;
}

int main(void) {
    int n;
    cin >> n;

    ll *a,*b,*c;
    a = new ll[n];
    b = new ll[n];
    c = new ll[n];

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

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

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

    sort(a, a+n);
    sort(b, b+n);
    sort(c, c+n);

    size_t sum = 0;
    for(size_t i = 0; i < n; ++i) {

        // lower bound search : 最低k以上の要素を探す
        // upper bound search : 最高k未満の要素を探す
        // ll num_c = my_lower_bound(b[i], c, n);
        // ll num_a = my_upper_bound(b[i], a, n);
        auto iter_a = lower_bound(a, a+n, b[i]);
        auto iter_c = upper_bound(c, c+n, b[i]);

        ll val_a = iter_a - a;
        ll val_c = c+n - iter_c;

        sum += val_a * val_c;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 2560
/* ----------------------------
 * ABC 90 B
 * ---------------------------- */
#include <iostream>
using namespace std;

bool isCycle(int targer);
int main(){
	int a, b;
	cin >> a >> b;
	int ans = 0;
	for(int i = a; i <= b; i++){
		ans += isCycle(i);
	}
	cout << ans << endl;
	return 0;
}
// 10進数で5桁だとわかっているので楽ができる
bool isCycle(int target){
	// dx: x桁目の数字
	int d1 = target % 10;
	int d5 = target / 10000 % 10;
	int d2 = target / 10 % 10;
	int d4 = target / 1000 % 10;
	return d1 == d5 && d2 == d4;
}


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

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int inf = 1000000;

int main(int argc, const char * argv[]) {
  double T, X;
  cin >> T >> X;
  
  cout << setprecision(11);
  cout << (double) (T / X) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;

signed main(){
	ios_base::sync_with_stdio(0);
	int a,b;
	cin>>a>>b;
	cout<<(b<a?a-1:a);
	re 0;
}

Measured memory_bytes: 3648
x = int(input())
res = 0
if 400 <= x < 600:
    res = 8
elif 600 <= x < 800:
    res = 7
elif 800 <= x < 1000:
    res = 6
elif 1000 <= x < 1200:
    res = 5  
elif 1200 <= x < 1400:
    res = 4 
elif 1400 <= x < 1600:
    res = 3
elif 1600 <= x < 1800:
    res = 2
else:
    res = 1

print(res)    

Measured memory_bytes: 9188
#include <stdio.h>

int main(void){
  long i,j,k,n,m,l;
  long A[101][101],B[101][101],C[101][101]={0};
  scanf(" %ld %ld %ld",&n,&m,&l);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      A[i][j]=0;
    }
  }
  for(i=0;i<m;i++){
    for(j=0;j<l;j++){
      B[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      C[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf(" %ld",&A[i][j]);
    }
  }
  for(i=0;i<m;i++){
    for(j=0;j<l;j++){
      scanf(" %ld",&B[i][j]);
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      for(k=0;k<m;k++){
        C[i][j]=C[i][j]+(A[i][k]*B[k][j]);
      }
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      printf("%ld",C[i][j]);
      if(j!=l-1){
        printf(" ");
      }
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2104
#include <stdio.h>
int main (){
    	
    int ctr = 0;
    int n;
    scanf("%d\n", &n);
    char s[n];
   	scanf("%s", s);
    int temp = 0;
    	
    for (int i=0; i<n; i++){
    	if (s[i] == 'I')ctr++;
    	if (s[i] == 'D')ctr--;
    	if (ctr > temp) temp++;
    }
    printf("%d", temp);	
    return 0;
}

Measured memory_bytes: 1724
#include <iostream>
#include <algorithm>
using namespace std;
int n, ans, maxim;
int main() {
	cin >> n;
	ans = 1;
	maxim = 0;
	for (int i = 1; i <= n; i++) {
		int a = i;
		int cnt = 0;
		while (a % 2 == 0) {
			a /= 2;
			cnt++;
		}
		if (cnt > maxim) {
			maxim = cnt;
			ans = i;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M=1e9+7;

ll ways(vector<ll>&v,ll k){
	vector<vector<ll>> dp(v.size()+1,vector<ll>(k+1,0));
	ll sum=0;
	for(ll i=1;i<=v.size();i++){
		dp[i][0]=1;
		sum+=v[i-1];
		for(ll j=1;j<=k && j<=sum;j++){
			dp[i][j]=(dp[i][j-1]+dp[i-1][j])%M;
			if(j-1-v[i-1]>=0){
				dp[i][j]=(dp[i][j]-dp[i-1][j-1-v[i-1]]+M)%M;
			}
			//cout<<dp[i][j]<<" ";
		}
		//cout<<endl;
	}
	return dp[v.size()][k];
}

int main(){
 ll n,k;
 cin>>n>>k;
 vector<ll> v(n);
 for(ll i=0;i<n;i++){
 	cin>>v[i];
 }
 cout<<ways(v,k)<<endl;
 return 0;
}



Measured memory_bytes: 83016
package main

import (
	"fmt"
	"strconv"
)

func main(){

	diff := 1000000

	var str string
	fmt.Scan(&str)

	for i:=0; i+3<= len(str); i++{
		tmpInt, _ := strconv.Atoi(str[i:i+3])

		diff = min(diff, abs(tmpInt - 753))
	}

	fmt.Println(diff)

}

func abs(x int) int{
	if x < 0{
		return -x
	}else{
		return x
	}
}

func min(x int, y int) int{
	if x < y{
		return x
	}else{
		return y
	}
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main
{
	static int a[][];
	static int b[][];
	static int light[][];
	static int first[];
	static boolean judge;
	static int dx[]={0,-1,0,1,0};
	static int dy[]={-1,0,0,0,1};
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		int N=in.nextInt();
		while(N-->0)
		{
			a=new int[10][10];
			b=new int[10][10];
			first=new int[10];
			judge=false;
			for(int i=0;i<10;i++)
				for(int j=0;j<10;j++)
				{
					int c=in.nextInt();
					a[i][j]=c;
					b[i][j]=c;
				}
			make(0,first);
			for(int i=0;i<10;i++)
				for(int j=0;j<10;j++)
				{
					if(j!=9)
						System.out.print(light[i][j]+" ");
					else
						System.out.println(light[i][j]);
				}
		}
	}

	static void make(int n, int first[])//1行目の粒子通過パターンを全列挙
	{
		if(judge)
			return;
		if(n==10)
		{
			light=new int[10][10];
			for(int i=0;i<10;i++)
				for(int j=0;j<10;j++)
					a[i][j]=b[i][j];
			judge=solve(first,light,a);
			if(judge)
				return;
		}
		else
		{
			first[n]=0;
			make(n+1,first);
			if(judge)
				return;
			first[n]=1;
			make(n+1,first);
			if(judge)
				return;
		}
	}
	static boolean solve(int first[],int light[][],int a[][])
	{

		for(int i=0;i<10;i++)
		{
			if(first[i]==1)
			{
				light[0][i]=1;
				for(int j=0;j<5;j++)
				{
					int ny=dy[j];
					int nx=i+dx[j];
					if(nx>=0&&10>nx&&ny>=0&&10>ny)
					{
						if(a[ny][nx]==1)
							a[ny][nx]=0;
						else
							a[ny][nx]=1;	 
					}
				}

//				if(a[0][i]==1)
//					a[0][i]=0;
//				else
//					a[0][i]=1;
//
//				if(i+1<10&&a[0][i+1]==1)
//					a[0][i+1]=0;
//				else if(i+1<10)
//					a[0][i+1]=1;
//
//				if(i-1>=0&&a[0][i-1]==1)
//					a[0][i-1]=0;
//				else if(i-1>=10)
//					a[0][i-1]=1;
//
//				if(a[1][i]==1)
//					a[1][i]=0;
//				else
//					a[1][i]=1;
			}
		}

		for(int i=1;i<10;i++)
			for(int j=0;j<10;j++)
			{
				if(a[i-1][j]==1)
				{
					light[i][j]=1;
					lightOn(i,j);
				}
			}

		for(int i=0;i<10;i++)//全部消えてるかチェック
		{
			for(int j=0;j<10;j++)
			{
				if(a[i][j]==0)
					judge=true;
				else
					judge=false;
				if(!judge)
					break;
			}
			if(!judge)
				break;
		}
		return judge;
	}

	static void lightOn(int i,int j) //粒子を通過させる　座標を含め5箇所を反転
	{
		for(int k=0;k<5;k++)
		{
			int ny=i+dy[k];
			int nx=j+dx[k];
			if(nx>=0&&10>nx&&ny>=0&&10>ny)
			{
				if(a[ny][nx]==1)
					a[ny][nx]=0;
				else
					a[ny][nx]=1;	 
			}
		}
		
		
//		if(a[i][j]==1)
//			a[i][j]=0;
//		else
//			a[i][j]=1;
//
//		if(j+1<10&&a[i][j+1]==1)
//			a[i][j+1]=0;
//		else if(j+1<10)
//			a[i][j+1]=1;
//
//		if(a[i-1][j]==1)
//			a[i-1][j]=0;
//		else
//			a[i-1][j]=1;
//
//		if(i+1<10&&a[i+1][j]==1)
//			a[i+1][j]=0;
//		else if(i+1<10)
//			a[i+1][j]=1;
//
//		if(j-1>=0&&a[i][j-1]==1)
//			a[i][j-1]=0;
//		else if(j-1>=0)
//			a[i][j-1]=1;
	}
}

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

using namespace std;


int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> k(m),p(m);
    vector<vector<int>> s(m);
    for(int i = 0;i < m;i++){
        cin >> k[i];
        vector<int> ss(k[i]);
        s[i] = ss;
        for(int j = 0;j < k[i];j++){
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    for(int i = 0;i < m;i++){
        cin >> p[i];
    }

    int ans = 0;
    for(int i = 0;i < (1 << n);i++){
        bool f = true;
        for(int j = 0;j < m;j++){
            int cnt = 0;
            for(int id : s[j]){
                if((i >> id) & 1){
                    cnt++;
                }
            }
            if(cnt % 2 != p[j]){
                f = false;
            }
        }
        if(f){
            ans++;
        }
    }

    cout << ans;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
const ll mod=2019 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

int main() {
   
     int n ;
     cin >> n;
   vector<int> A(n) ;
   rep(i,n) cin>> A[i] ;
   map<int,int> mp ;
   ll ans =0 ;
   rep(i,n){
   int gap= i-A[i] ;
   mp[gap] ++ ;
   }
   rep(i,n){
     int sum =i+A[i] ;
     ans += mp[sum] ;
   }
   cout<<ans <<endl;
    return 0;
}



Measured memory_bytes: 21088