akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int a = input[0];
            int b = input[1];
            int c = input[2];

            int d = a - b;
            if(d >= c)
            {
                Console.WriteLine(0);
            }else
            {
                Console.WriteLine(c - d);
            }
        }
    }
}


Measured memory_bytes: 13268
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <array>
#include <deque>
#include <bitset>
typedef long long ll;
using namespace std;
#define trace(x) cerr << #x << " is " << x << endl;

const int INF = 1e9 + 7;
int helper(vector<vector<int>> A, int x) {
    int n = A.size();
    int m = A[0].size() - 1;
    int res = INF;
    for (int i = 1; i < (1 << n); i++) {
        int cost = 0;
        vector<int> cur (m + 1, 0);
        for (int j = 0; j < n; j++) {
            if ((1 << j) & i) {
                for(int k = 1; k <= m; k++) {
                    cur[k] += A[j][k];
                }
                cost += A[j][0];
            }
        }
        int flag = 1;
        for (int j = 1; j <= m; j++) {
            if(cur[j] < x) {
                flag = false;
                break;
            }
        }
        if (flag) {
            res = min(res, cost);
        }
    }
    if (res == INF) return -1;
    return res;
}

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

    int n, m, x;
    cin >> n >> m >> x;
    vector<vector<int>> A(n, vector<int>(m + 1));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= m; j++) {
            cin >> A[i][j];
        }
    }
    cout << helper(A, x) <<endl;
    
    return 0;
}


Measured memory_bytes: 3592
N = int(input())
a = []
typ = ["S ", "H ", "C ", "D "]
for i in range(N):
    a.append(input())

for i in range(4):
    for j in range(1, 14):
        if typ[i] + str(j) not in a:
            print(typ[i] + str(j))

Measured memory_bytes: 7636
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"

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

    int n, m, s, c;
    cin >> n >> m;
    if(m == 0){
        if(n == 1)
            cout << 0;
        else
            cout << int(pow(10, n - 1) + 0.5);
        cout << endl;
        return 0;
    }
    map<int, set<int> > mp;
    for(int i = 0; i < m; i++){
        cin >> s >> c;
        mp[s].insert(c);
    }

    bool flag = false;
    int maxm = INT_MIN;
    int minm = INT_MAX;
    for(auto &i : mp){
        if(i.second.size() > 1 || (*i.second.begin() == 0 && i.first == 1 && n > 1) || i.first > n){
            flag = true;
            break;
        }
        minm = min(minm, i.first);
        maxm = max(maxm, i.first);
    }
    if(flag){
        cout << -1;
    }
    else{
        int arr[n + 1] = {0};
        if(n > 1)
            arr[1] = 1;
        for(auto &i : mp){
            arr[i.first] = *i.second.begin();
        }
        for(int i = 1; i <= n; i++)
            cout << arr[i];
    }
    cout << endl;
    return 0;
}

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

typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define pi pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vvl vector<vector<long long> >
#define vl vector<ll>
#define vii vector<pair<int,int> >
#define vll vector<pair<long long,long long> >
#define pb push_back
#define mp make_pair3

const ll mod=1e9+7;
#define MAX 100000

int modulo = 420047;

ll binexpo(ll a,ll b,ll c){

    if(b==0) return 1;
    else if(b%2==0) return binexpo(((a%c)*(a%c))%c,b/2,c)%c;
    else return ((a%c)*(binexpo(((a%c)*(a%c))%c,b/2,c)%c))%c;
}

int main(){

    int n;
    cin>>n;

    int a[n],b[n],c[n];
    FOR(i,0,n) cin>>a[i]>>b[i]>>c[i];

    int dp[n][3];
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];

    FOR(i,1,n){
        FOR(j,0,3){
            if(j == 0)
                dp[i][j] = a[i] + max(dp[i-1][1],dp[i-1][2]);
            else if(j == 1)
                dp[i][j] = b[i] + max(dp[i-1][0],dp[i-1][2]);
            else if(j == 2)
                dp[i][j] = c[i] + max(dp[i-1][0], dp[i-1][1]);
        }
    }

    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));

    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define LLINF (1LL<<60)
#define INF (1<<30)
#define F first
#define S second
#define i1(a) cin>>a;
#define i2(a,b) cin>>a>>b;
#define i3(a,b,c) cin>>a>>b>>c;
#define i4(a,b,c,d) cin>>a>>b>>c>>d;
#define i5(a,b,c,d,e) cin>>a>>b>>c>>d>>e;
#define ol(a) cout<<a<<endl;
#define os(a) cout<<a<<" ";
#define o(a) cout<<a;
#define ol(a) cout<<a<<endl;
#define ol2(a,b) cout<<a<<" "<<b<<endl;
#define ol3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl;
using namespace std;
main(){
  long long n,k;
  long long d[10]={0};
  i2(n,k);
  for(int i=0;i<k;i++){
    int num;
    cin>>num;
    d[num]=1;
  }
  while(1){
    long long cpy=n;
    long long out=0;
    while(cpy>0){
      if(d[cpy%10]){
	out=1;
      }
      cpy/=10;
    }
    if(out==0){
      cout<<n<<endl;
      return 0;
    }
    n++;
  }
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3

output:
0 0
1 2
2 2
3 1
4 3
"""

import sys
import heapq as hp

WHITE, GRAY, BLACK = 0, 1, 2
D_MAX = int(5e10 + 1)


def generate_adj_table(v_table):
    for each in v_table:
        v_index, v_adj_length, *v_adj_list = map(int, each)
        # assert len(v_adj_list) == v_adj_length * 2
        for pair in zip(v_adj_list[::2], v_adj_list[1::2]):
            init_adj_table[v_index][pair[0]] = pair[1]

    return init_adj_table


def dijkstra_path_heap():
    # path search init
    path_list[init_vertex_index] = 0
    path_heap = []
    # heapq: rank by tuple[0], at here it's d[u]
    hp.heappush(path_heap, (0, init_vertex_index))

    while len(path_heap) >= 1:
        current_vertex = hp.heappop(path_heap)[1]

        color[current_vertex] = BLACK

        current_vertex_adjs = adj_table[current_vertex]
        for adj_vertex, adj_weight in current_vertex_adjs.items():
            # adj_weight = current_vertex_adjs.get(adj_vertex)
            if color[adj_vertex] is not BLACK:
                # alt: d[u] + w[u,v]
                alt_path = path_list[current_vertex] + adj_weight
                if alt_path < path_list[adj_vertex]:
                    # update path_list
                    path_list[adj_vertex] = alt_path
                    # update heap
                    hp.heappush(path_heap, (alt_path, adj_vertex))
                    parent_list[adj_vertex] = current_vertex
                    color[adj_vertex] = GRAY

    return path_list


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices_num = int(_input[0])
    init_vertices_table = map(lambda x: x.split(), _input[1:])
    # assert len(init_vertices_table) == vertices_num

    parent_list, path_list = [-1] * vertices_num, [D_MAX] * vertices_num
    color = [WHITE] * vertices_num
    init_adj_table = tuple(dict() for _ in range(vertices_num))
    init_vertex_index = 0

    adj_table = generate_adj_table(init_vertices_table)
    ans = dijkstra_path_heap()
    for i, v in enumerate(ans):
        print(i, v)

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

int main(void) {
    string s;
    cin >> s;
    int g = 0, p = 0;
    int ans = 0;

    for(auto &t : s) {
        if(t == 'g') {
            if(g == p) {
                g++;
            }
            else {
                p++;
                ans++;
            }
        }
        else {
            if(g == p) {
                g++;
                ans--;
            }
            else {
                p++;
            }
        }
    }
    cout << ans;
}

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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] x = new int[m];
        int[] y = new int[m];
        for (int i = 0 ; i < m; i++) {
            x[i] = sc.nextInt() -1;
            y[i] = sc.nextInt() - 1;
        }
        int[] a = new int[n];
        int[] b = new int[n];
        Arrays.fill(a, 1);
        b[0] = 1;
        for (int i = 0 ; i < m ; i++) {
            if (a[x[i]] > 0) {
                a[x[i]] -= 1;
                a[y[i]] += 1;
                if (b[x[i]] > 0) {
                    b[y[i]] = 1;
                }
                if (a[x[i]] == 0) {
                    b[x[i]] = 0;
                }

            }
        }

        int c = 0;
        for (int i = 0 ; i < n ; i++) {
            if (b[i] > 0) c++;
        }
        System.out.println(c);

    }

}

Measured memory_bytes: 81788
from collections import Counter
def get(S):
    return list(map(S, input().split()))

N, M = get(int)
roads = Counter()

for i in range(M):
    a, b = get(int)
    roads[a] += 1
    roads[b] += 1

for i in range(N):
    print(roads[i + 1])


Measured memory_bytes: 3316
#include <iostream>

 

using namespace std;

 

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if (a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else if (b <= a && a <= c)
        cout << b << " " << a << " " << c << endl;
    else if (b <= c && c <= a)
        cout << b << " " << c << " " << a << endl;
    else if(c <= a && a <= b)
        cout << c << " " << a << " " << b << endl;
    else 
        cout << c << " " << b << " " << a << endl;
}


Measured memory_bytes: 3092
package main

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

// const abcd = "abcdefghijklmnopqrstuvwxyz"
// const ABCD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

// var dy = [...]int{1, 1, 0, -1, -1, -1, 0, 1}
// var dx = [...]int{0, 1, 1, 1, 0, -1, -1, -1}

// var dx = [...]int{0, 1, 0, -1}
// var dy = [...]int{1, 0, -1, 0}

var inf int = 1e13
var mod = 1000000007

// ---------------------------------------------------------
func main() {
	log.SetFlags(log.Lshortfile)
	next := newScanner()
	s := next.next()
	ans := 0
	for i := len(s) - 1; i >= 0; i-- {
		if check(s[:i]) {
			log.Println(s[:i])
			ans = len(s[:i])
			break
		}
	}

	fmt.Println(ans)
}

func check(s string) bool {
	if len(s)%2 != 0 {
		return false
	}
	for i := 0; i < len(s)/2; i++ {
		if s[i] != s[len(s)/2+i] {
			return false
		}
	}
	return true
}

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

// Pair is liked C++ pair
type Pair struct {
	a, b int
}

// Pairs is sorted by []Pair struct
type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a < p[j].a {
		return true
	} else if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return false
}

// -------------------------------
func in(c, a, z int) bool {
	return c >= a && c < z
}

func btoi(b bool) int {
	if b {
		return 1
	}
	return 0
}

func itob(a int) bool {
	if a == 0 {
		return false
	}
	return true
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func sum(a ...int) int {
	r := a[0]
	if len(a) > 1 {
		for i := 1; i < len(a); i++ {
			r += a[i]
		}
	}
	return r
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

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

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

// ---------- buffered scanner -----------------------------------------
type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) Line() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) Int() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) Int64() int64 {
	v, _ := strconv.ParseInt(s.next(), 10, 64)
	return v
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>

int main()
{
    int n, m, x;
    int a[105] = {};
    scanf("%d %d %d", &n, &m, &x);

    for(int i = 0; i < m; ++i)
    {
        int temp;
        scanf("%d", &temp);
        a[temp] = 1;
    }

    int ansl = 0, ansr = 0, i;
    for(i = x; i <= n; ++i)
    {
        ansr += a[i];
    }
    for(i=x; i >= 0; --i)
    {
        ansl += a[i];
    }

    printf("%d\n", std::min(ansl, ansr));
    return 0;
}


Measured memory_bytes: 128
h, w = map(int, input().split())
s = [list(input()) for i in range(h)]

a = [0, 0, 1, -1, 1, -1, 1, -1]
b = [1, -1, 1, -1, -1, 1, 0, 0]
for i in range(h):
    for j in range(w):
        if s[i][j] == '.':
            sub = 0
            for k in range(8):
                if i + a[k] >= 0 and j + b[k] >= 0 and i + a[k] < h and j + b[k] < w:
                    if s[i + a[k]][j + b[k]] == '#':
                        sub += 1
            s[i][j] = sub

for i in range(h):
    for j in range(w):
        print(s[i][j], end="")
    print()

Measured memory_bytes: 3444
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println(run(sc));
        sc.close();
    }

    private static String run(Scanner sc) {
        int n = Integer.parseInt(sc.next());
        String s = sc.next();

        if ((n % 2) != 0) {
            return "No";
        }
        String first = s.substring(0, n / 2);
        String last = s.substring((n / 2));
        if (first.equals(last)) {
            return "Yes";
        }
        return "No";
    }
}


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

int a[100010],n,m,v,p,l,r,mid,ans;

bool check(int mid)
{
	while (mid<n&&a[mid+1]==a[mid]) mid++;
	if (a[mid]+m<a[n-p+1]) return 0;
	int nw=v-mid-(p-1);
	if (nw<=0) return 1;
	long long ans=0;
	for (int i=mid+1; i<=n-p+1; i++) ans+=(a[mid]+m-a[i]);
	if (ans<1ll*m*nw) return 0; else return 1;
}

int main()
{
	scanf("%d%d%d%d",&n,&m,&v,&p);
	for (int i=1; i<=n; i++) scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	l=1,r=n-p,ans=n-p+1; 
	while (l<=r)
	{
		mid=(l+r)>>1;
		if (check(mid)) r=mid-1,ans=mid; else l=mid+1;
	}
	printf("%d\n",n-ans+1);
	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int n, d; cin >> n >> d;
    cout << (n % (2*d+1) != 0?n / (2*d+1) + 1:n / (2*d+1))  << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int H,W,K;
  char c[7][7];
  int ans=0;
  scanf("%d %d %d\n",&H,&W,&K);
  for(int i=0;i<H;i++)
    scanf("%s\n",c[i]);
  for(int i=0;i<1<<H;i++){
    for(int j=0;j<1<<W;j++){
      int S=0;
      for(int k=0;k<H;k++){
        for(int l=0;l<W;l++){
          if(((i>>k) & 1)==1 || ((j>>l) & 1)==1)continue;
          else if(c[k][l]=='#')
            S++;
          if(S>K) break;
        }
      }
      if(S==K) ans++;
    }
  }
  printf("%d\n",ans);
  return 0;
}

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

int main() {
	string s; cin >> s;
    int count_a = 0, count_b = 0;
    rep(i,3) {
        char c = s[i];
    	if (s[i] == 'A') count_a++;
        else count_b++;
    }
    if (count_a == 3 || count_b == 3) cout << "No" << endl;
    else cout << "Yes" << endl;
    
    return 0;
}

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

int main() {
  using std::vector;
  constexpr int inf = 1e9;
  int n, m;
  std::cin >> n >> m;
  vector<vector<int>> d(n, vector<int>(n, inf));
  for (int i = 0; i < n; i++) {
    d.at(i).at(i) = 0;
  }
  vector<int> a(m), b(m), c(m);
  for (int i = 0; i < m; i++) {
    std::cin >> a.at(i) >> b.at(i) >> c.at(i);
    a.at(i)--; b.at(i)--;
    d.at(a.at(i)).at(b.at(i)) = c.at(i);
    d.at(b.at(i)).at(a.at(i)) = c.at(i);
  }
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        d.at(i).at(j) = std::min(d.at(i).at(j), d.at(i).at(k) + d.at(k).at(j));
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < m; i++) {
    if (d.at(a.at(i)).at(b.at(i)) < c.at(i)) {
      ans++;
    }
  }
  std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace  std;
#define ll long long 
int main(){
    set<ll> s1 = { 1, 3 , 5 , 7 , 8 , 10 , 12 }  ;
    set<ll> s2 = { 4 , 6 , 9 , 11 } ;
    set<ll> s3 = { 2 } ;
    ll x , y ;
    cin >> x >> y ;
    if ( s1.find(x) != s1.end() && s1.find(y) != s1.end() ){
        cout << "Yes" ; return 0;
    }
      if ( s2.find(x) != s2.end() && s2.find(y) != s2.end() ){
        cout << "Yes" ; return 0;
    }
      if ( s3.find(x) != s3.end() && s3.find(y) != s3.end() ){
        cout << "Yes" ; return 0;
    }
    cout << "No" ;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string S;
    cin >> S;
    for (int i = 0; i < S.size() - 8; ++i) {
        cout << S[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
 
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
 
string N;
 
int main(){
  cin >> N;  
//--------------------------------------------------------
 
  int ok = 0;
  rep(i,3){
    if(N[i]=='7') ok = 1;
  }
//--------------------------------------------------------
  
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int n = fs.nextInt();
		int[] aArr = fs.nextIntArr(n);
		
		int ans = 0;
		for(int i = 0; i < n; i++) {
			
			if((i+1) % 2 == 1 && aArr[i] %2 == 1) {
				ans++;
			}
		}
		
		System.out.println(ans);
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


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

int main()
{
   long long n,i,j,k,r,res=0;
   cin>>n;
   for(i=1;i<=n;i++)
   {
      for(j=1;j<=n;j++)
      {
          for(k=1;k<=n;k++)
          {
              r=__gcd(i,j);
              r=__gcd(r,k);
              res+=r;
          }
      }
   }
  cout<<res<<endl;
    return 0;
}


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

#define endl '\n'

using namespace std;

const int N = (int)(1e5) + 3;

int n, m;
string s, t;
vector<int> let[26];

int search(char ch, int from_idx) {
    from_idx--;
    auto it = upper_bound(let[ch - 'a'].begin(), let[ch - 'a'].end(), from_idx);
    if(it == let[ch - 'a'].end()) return -1;
    return *it;
}

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

    cin >> s >> t;
    n = (int)s.size();
    m = (int)t.size();

    for(int i = 0; i < n; ++i) {
        let[s[i] - 'a'].push_back(i);
    }

    int last_idx = 0;
    long long ans = 0;

    for(int i = 0; i < m; ++i) {
        int nxt_idx = search(t[i], last_idx);
        if(nxt_idx == -1) {
            ans += n;
            nxt_idx = search(t[i], 0);
            if(nxt_idx == -1) {
                cout << -1 << endl;
                return 0;
            }
        }
        last_idx = nxt_idx + 1;
    }

    ans += last_idx;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1228
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        double[] abhm = Console.ReadLine().Split().Select(double.Parse).ToArray();
        var a = abhm[0];
        var b = abhm[1];
        var h = abhm[2];
        var m = abhm[3];

        double ang = (h * 60 + m) * 360 / (12 * 60) - m * 360 / 60;
        if (ang > 180) ang = 360 - ang;

        double radian = ang * Math.PI / 180;

        double tmp = (a * a) + (b * b) - 2 * a * b * Math.Cos(radian);
        double ans = Math.Sqrt(tmp);

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 28572
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <stack>
#include <cmath>
#include <functional>
#include <set>
#include <string>
#include <stdlib.h>
#include <utility>
 
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i = a;i<=b;i++)
#define ll long long int
#define ii pair<int,int>
#define mp make_pair
#define pb push_back
#define iii pair<ii,int >
#define ff first
#define ss second
#define vi vector<int>
 
using namespace std;


int main(){
	int n , W;
	cin >> n >> W;
	int w[n];
	ll v[n];
	FOR(i,n) cin >> w[i] >> v[i];
	ll dp[n][W+1];
	FOR(i,n)FOR(j,W+1)dp[i][j] = 0;
	dp[0][w[0]] = v[0];
	FOR(i,n){
		if(i == 0)continue;
		FOR(j,W+1){
			if(j >= w[i])dp[i][j] = max(dp[i-1][j],v[i] + dp[i-1][j-w[i]]);
			else dp[i][j] = dp[i-1][j];
		}
	}
	ll mx = 0;
	FOR(i,n)FOR(j,W+1)mx= max(dp[i][j],mx);
	cout << mx << endl;

	return 0;
}


Measured memory_bytes: 78464
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	dump((a + b) * c / 2)
}

Measured memory_bytes: 256
N = int(input())
F = []
P = []
def Base_2_to_10(S):
	L = len(S)-1
	out = 0
	for i in reversed(range(L+1)):
		if S[i] == "1":
			out += 2 ** (L-i)
	return out

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

for _ in range(N):
	s = "".join(list(map(str, input().split())))
	F.append(Base_2_to_10(s))

for _ in range(N):
	P.append(list(map(int, input().split())))

ans = float("inf") * (-1)

for i in range(1,2**10):
	tmp = 0
	for j in range(N):
		cmn = Base_10_to_n(i&F[j],2).count("1")
		tmp += P[j][cmn]
	ans = max(ans, tmp)

print(ans)


Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let N: i32 = read();
    let L: i32 = read();
    let sum;

    if L-1 >= 0 {
        sum = (2*L+N)*(N-1)/2;
    } else if L+N-1 < 0 {
        sum = (2*L+N-2)*(N-1)/2;
    } else {
        sum = (2*L+N-1)*N/2;
    }

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

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

vector<vector<pair<int, int>>> g;
long d[111111];
int main() {
    int n, m;
    cin >> n >> m;
    g.resize(n + 1);
    for(int i = 1; i < n; i++)
        g[i + 1].emplace_back(i, 0);
    for(int i = 0; i < m; i++) {
        int l, r, c;
        scanf("%d%d%d", &l, &r, &c);
        g[l].emplace_back(r, c);
    }
    priority_queue<pair<long, int>, vector<pair<long, int>>, greater<>> q;
    fill(d, d + n + 1, 1e18);
    q.emplace(0, 1);
    d[1] = 0;
    while(!q.empty()) {
        int u = q.top().second;
        q.pop();
        for(auto p : g[u]) {
            int v = p.first;
            auto l = d[u] + p.second;
            if(d[v] <= l)
                continue;
            d[v] = l;
            q.emplace(d[v], v);
        }
    }
    cout << (d[n] < 1e18 ? d[n] : -1) << endl;
    return 0;
}


Measured memory_bytes: 8440
def solve(s,p):
    if s[0]!='[':
        return[p//1000,p//100%10,p//10%10,p%10][ord(s[0])-ord('a')]
    i=3
    cs=[0,1][s[2]=='[']
    ce=0
    while cs!=ce:
        if s[i]=='[':
            cs+=1
        elif s[i]==']':
            ce+=1
        i+=1
    j=i+1
    cs=[0,1][s[i]=='[']
    ce=0
    while cs!=ce:
        if s[j]=='[':
            cs+=1
        elif s[j]==']':
            ce+=1
        j+=1
    l=solve(s[2:i],p)
    r=solve(s[i:j],p)
    if s[1]=='+':
        return l|r
    elif s[1]=='*':
        return l&r
    else:
        return l^r
while True:
    s=input()
    if s=='.':break
    p=int(input())
    a=solve(s,p)
    c=0
    for i in range(10000):
        if solve(s,i)==a:
            c+=1
    print(a,c)


Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define int long long
using namespace std;
const int MOD=1e9+7;
const int INF=1e15;
template<typename T> void cmax(T &a, T b) {a = max(a, b);}
template<typename T> void cmin(T &a, T b) {a = min(a, b);}



signed main(){
  int n;
  cin>>n;
  rep(i,n){
    string s;
    cin>>s;
    set<string> st;
    loop(i,1,s.size()){
      string t=s.substr(0,i);
      string u=s.substr(i);
  //cout<<t<<' '<<u<<endl;
      string rt=t,ru=u;
      reverse(all(rt));
      reverse(all(ru));

      st.insert(t+u);
      st.insert(u+t);
      st.insert(t+ru);
      st.insert(ru+t);
      st.insert(rt+u);
      st.insert(u+rt);
      st.insert(rt+ru);
      st.insert(ru+rt);
    }
    cout<<st.size()<<endl;
  }

 return 0;
}



Measured memory_bytes: 3056
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
template<class T>inline bool chmax(T& a, T b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T& a, T b){if(a > b){a = b; return 1;}return 0;}
const ll INF = 1LL<<60;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    ll n; cin >> n;
    vector<ll> ev(100001, 0), od(100001, 0);
    REP(i, n){
        ll v; cin >> v;
        if(i%2 == 0) ev[v]++;
        else od[v]++;
    }
    vector<pair<ll, ll>> eve, odd;
    REP(i, 100001){
        if(ev[i] != 0) eve.pb({ev[i], i});
        if(od[i] != 0) odd.pb({od[i], i});
    }
    sort(RALL(eve));
    sort(RALL(odd));
    //cout << eve << endl;
    //cout << odd << endl;
    ll evesiz = eve.size(), oddsiz = odd.size();
    if(evesiz == 1 && oddsiz == 1){
        if(eve[0].se == odd[0].se) cout << n/2 << endl;
        else cout << 0 << endl;
    }
    else{
        if(eve[0].se == odd[0].se){
            ll reseve = 0, resodd = 0;
            //eve[0].seを採用する
            for(int i=0; i<evesiz; i++){
                if(i != 0) reseve += eve[i].fi;
            }
            for(int i=0; i<oddsiz; i++){
                if(i != 1) reseve += odd[i].fi;
            }
            //odd[0].seを採用する
            for(int i=0; i<evesiz; i++){
                if(i != 1) resodd += eve[i].fi;
            }
            for(int i=0; i<oddsiz; i++){
                if(i != 0) resodd += odd[i].fi;
            }
            cout << min(reseve, resodd) << endl;
        }
        else{
            ll res = 0;
            for(int i=0; i<evesiz; i++){
                if(i != 0) res += eve[i].fi;
            }
            for(int i=0; i<oddsiz; i++){
                if(i != 0) res += odd[i].fi;
            }
            cout << res << endl;
        }
    }
    
}

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

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

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

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M); vector<vector<ll> > v(4);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()), sort(v.rbegin(), v.rend()); //sort
// char '' str ""
int main(void)
{
    vector<vector<int> > c(3);
    for(int i=0; i<3;i++){
      int ca,cc,ccc; cin>>ca>>cc>>ccc; c[i].push_back(ca); c[i].push_back(cc); c[i].push_back(ccc);
    }
    int aa,aaa,bb,bbb; bool flag=false;
    for(int a=0; a<=100;a++){
      for(int b=0; b<=100;b++){
        if(a+b == c[0][0]){
          bb = c[0][1] - a; bbb = c[0][2] - a;
          aa = c[1][0] - b; aaa = c[2][0] - b;
        }
        if( (aa+bb == c[1][1]) && (aa+bbb == c[1][2]) && (aaa+bb == c[2][1]) && (aaa+bbb == c[2][2])) flag = true;
      }
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

int main() {
  int a,b,k,cnt=0;
  cin >> a >> b >> k;
  for(int i=a; i>=1; i--) {
    if(a%i==0&&b%i==0) {
      cnt++;
    }
    if(cnt==k) {
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,K,Q;
  cin>>N>>K>>Q;
  vector<int>T(Q);
  for(int i=0;i<Q;i++){
	cin>>T.at(i);
  }
  vector<int>P(N);
  for(int i=0;i<Q;i++){
    P.at(T.at(i)-1)++;
  }
  for(int i=0;i<N;i++){
    if(P.at(i)>Q-K){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}

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

ll ans = -10e10;
int n;
ll k;
vector<int> p;
vector<ll> c;

void simulate(int st) {
  int next = st;

  // get loop cnt
  ll loop_score = 0;
  ll loop_cnt = 0;
  while(true) {
    next = p[next];
    loop_score += c[next];
    loop_cnt++;
    if(next == st) break;
  }

  ll score = 0;

  // get rest cnt
  ll rest_cnt = k;
  if(loop_score > 0 && k / loop_cnt >= 2) {
    score += loop_score * (k / loop_cnt - 1);
    rest_cnt -= loop_cnt * (k / loop_cnt - 1);
    ans = max(ans, score);
  } else if(loop_score <= 0) {
    rest_cnt = min(k, loop_cnt);
  }

  // calc scorex
  while(rest_cnt > 0) {
    score += c[next];
    next = p[next];
    rest_cnt--;
    ans = max(ans, score);
  }
  return;
};

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

  p.resize(n+1);
  rep(i, n) cin >> p[i+1];

  c.resize(n+1);
  rep(i, n) cin >> c[i+1];

  rep(i, n) {
    simulate(i+1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3704
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException{
		
		List<Integer>intList = new ArrayList<Integer>();
		String strINputNum = "";
		int intInputNum = 0;
		String strStopNum = "0";
		InputStreamReader isr= new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		
		do {
			strINputNum = br.readLine();
			intInputNum= Integer.parseInt(strINputNum);
			intList.add(intInputNum);

		}while(!(strINputNum.equals(strStopNum)));
		
		int intOutputCount = intList.size() - 1;
	
		for(int i = 0; i < intOutputCount; i++) {
				System.out.println("Case " + (i+1) + ": " + intList.get(i));
			}
	}
}


Measured memory_bytes: 32736
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U& u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
template<class T> bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T & a, const T & b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vi V(N), C(N);
	REP(i, N)cin >> V[i];
	REP(i, N)cin >> C[i];
	int ans = 0;
	REP(i, (1 << N)) {
		int sumc = 0;
		int sumv = 0;
		REP(j, N) {
			if ((i >> j) & 1 == 1) {
				sumv += V[j];
				sumc += C[j];
			}
		}
		chmax(ans, sumv - sumc);
	}
	cout << ans << endl;
	return 0;
}


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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const int INF = 1e9+7;
const int MOD = 1e9+7;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};

const int N = 10001;
string s; 
int p, cnt[N];

int main()
{
  fastio;
  int n;
  cin >> n >> p >> s;
  reverse(all(s));
  if (p == 2 || p == 5){
    long res = 0;
    for (int i = 0; i < n; i++){
      int x = s[i] - '0';
      if (x % p == 0) res += 1ll * (n - i);
    }
    cout << res; return 0;
  }
  long meow = 1; long cur = 0;
  long res = 0;  cnt[0] = 1;
  for (int i = 0; i < n; i++){
    int x = s[i] - '0';
    cur = (cur + meow * x) % p;
    (meow *= 10) %= p;
    res += cnt[cur];
    cnt[cur]++;
  }
  cout << res;
 
  return 0;
}

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

int main() {
  
    string s,t;
    cin >> s >> t;
    int len = s.size();
    int count = 0;
    for(int i=0;i<len;i++){
        if(s[i] != t[i]) count++;
    }
    
    cout << count << endl;
}

Measured memory_bytes: 3872
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int w, h;
int sx, sy;
int gx, gy;
int n;
int field[120][120];

void PrintField() {
  REP(y, h + 2) {
    REP(x, w + 2) {
      printf("%d", field[y][x]);
    }
    puts("");
  }
}

int main() {
  while (scanf("%d %d", &w, &h), w|h) {
    MEMSET(field, 0);
    scanf("%d %d", &sx, &sy);
    scanf("%d %d", &gx, &gy);
    scanf("%d", &n);
    REP(i, n) {
      int c, d, sx, sy;
      scanf("%d %d %d %d", &c, &d, &sx, &sy);
      int ex = sx + 2;
      int ey = sy + 2;
      if (d == 0) { ex += 2; }
      if (d == 1) { ey += 2; }
      FOR(y, sy, ey) {
        FOR(x, sx, ex) {
          field[y][x] = c;
        }
      }
    }
    w += 3;
    int sc = field[sy][sx];
    queue<int> que;
    que.push(sy * w + sx);
    while (!que.empty()) {
      int x = que.front() % w;
      int y = que.front() / w;
      que.pop();
      if (sc == 0) { break; }
      if (x == gx && y == gy) {
        puts("OK");
        goto next;
      }
      REP(dir, 4) {
        const int dx[4] = { 1, 0, -1, 0 };
        const int dy[4] = { 0, 1, 0, -1 };
        int nx = x + dx[dir];
        int ny = y + dy[dir];
        if (field[ny][nx] != sc) { continue; }
        field[ny][nx] = 9;
        que.push(ny * w + nx);
      }
    }
    puts("NG");
next:;
  }
}

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

using namespace std;

int n, k, m, v[2010], q;

pair< int, int > a[2010];

int p[2010], pt, t[2010], tt, all[2010], at, ans = 1e9;

int main()
{
	scanf("%d%d%d", &n, &k, &q);
	for (int i = 1; i <= n; ++i)
		scanf("%d", v + i), a[i] = make_pair(v[i], i);
	m = n;
	sort(v + 1, v + m + 1);
	m = unique(v + 1, v + m + 1) - v - 1;
	for (int i = 1; i <= m; ++i)
	{
		int w = v[i];
		at = 0;
		pt = 0;
		for (int j = 1; j <= n; ++j)
		{
			if (a[j].first < w)
			{
				p[++pt] = j;
			}
		}
		p[++pt] = n + 1;
		int qq = 0;
		for (int j = 1; j <= pt; ++j)
		{
			int l = p[j - 1] + 1, r = p[j] - 1;
			if (r - l + 1 < k) continue;
			int now = (r - l + 1) - k + 1;
			qq += now;
			tt = 0;
			for (int u = l; u <= r; ++u)
				t[++tt] = a[u].first;
			sort(t + 1, t + tt + 1);
			for (int i = 1; i <= now; ++i)
				all[++at] = t[i];
		}
		if (qq < q) continue;
		sort(all + 1, all + at + 1);
		ans = min(ans, all[q] - w);
	}
	printf("%d\n", ans);
	return 0;
}

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

int main(){
    int N, M;
    cin >> N >> M;
    int P[100000], Y[100000];
    vector<ll> h[100001];
    for(int i = 0; i < M; i++){
        cin >> P[i] >> Y[i];
        h[P[i]].push_back(Y[i]);
    }
    for(int i = 0; i < N; i++){
        sort(h[i+1].begin(), h[i+1].end());
    }
    for(int i = 0; i < M; i++){
        printf("%012lld\n", ll(P[i])*1000000+int(lower_bound(h[P[i]].begin(), h[P[i]].end(), Y[i])-h[P[i]].begin())+1);
    }
    return 0;
}

Measured memory_bytes: 7808
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
 
using namespace std;
 

int main(){
	string S;
	cin >> S;
	long long ans=0,count=0,a=0,b=0;
	if(S.size()==1)
	if(S[0]=='A' || S[0]=='C' || S[0]=='G' || S[0]=='T'){
		cout << 1 << endl;
		return 0;
	}
	for(int i=1; i<S.size(); i++){
		count+=1;
		ans=max(ans,count);
		count=0;
		for(int j=i; j<S.size(); j++){
		if(S[j-1]=='A' || S[j-1]=='C' || S[j-1]=='G' || S[j-1]=='T'){
			b=1;
			if(S[j]=='A' || S[j]=='C' || S[j]=='G' || S[j]=='T'){
				count+=1;
				a=1;
			}else j=S.size()-1;
		} else j=S.size()-1;
		}
	}
	count+=1;
	if(count>ans) ans=count;
	if(b==1 && a==0) cout << 1 << endl;
	else if(a==0 && b!=1) cout << 0 << endl;
	else cout << ans <<endl;
}

Measured memory_bytes: 256
s=input()
n=len(s)
ans=0

for i in range(2**(n-1)):
  ds=[]
  for j in range(n-1):
    ds.append(s[j])
    if ((i>>j)&1):
      ds.append("+")
  ds.append(s[-1])
  keisa="".join(ds)
  ans+=eval(keisa)
  
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#define mod 1000000007
typedef long long ll;

ll rev(ll a) {
  ll t = mod - 2, ans = 1;
  while(t) {
    if(t & 1) ans *= a, ans %= mod;
    a *= a, a %= mod, t >>= 1;
  }
  return ans;
}

int main(void) {
  ll i, j, x, y, sum, ans;
  scanf("%lld%lld", &x, &y);
  if((x + y) % 3) {
    printf("0");
    return 0;
  }
  sum = (x + y) / 3;
  if(x < sum || x > 2 * sum) {
    printf("0");
    return 0;
  }
  x -= sum;
  ll fact[sum + 1];
  fact[0] = 1;
  for(i = 1; i <= sum; ++i) fact[i] = (fact[i - 1] * i) % mod;
  ans = (fact[sum] * rev(fact[x])) % mod;
  ans *= rev(fact[sum - x]), ans %= mod;
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 5376
import math
from operator import itemgetter
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

a,b,c = IL()
if a <= c <= b or a >= c >= b:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 21756