akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

class Main
{
  public static void main(String[] args)throws IOException
  {
    BufferedReader br =
     new BufferedReader(new InputStreamReader(System.in));

    String S = br.readLine();

    switch(S){
       case "SUN":
          System.out.println(7);
          break;
       case"MON":
          System.out.println(6);
          break;
       case"TUE":
          System.out.println(5);
          break;
       case"WED":
          System.out.println(4);
          break;
       case"THU":
          System.out.println(3);
          break;
       case"FRI":
          System.out.println(2);
          break;
       case"SAT":
          System.out.println(1);
          break;
    }
  }
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
int a1,a2,a3,a4;
string s;
int main(){
    int n;
    cin>>n;
    while(n--){
        cin>>s;
        if(s=="AC") ++a1;
        if(s=="WA") ++a2;
        if(s=="TLE") ++a3;
        if(s=="RE") ++a4;
    }
    printf("AC x %d\n",a1);
    printf("WA x %d\n",a2);
    printf("TLE x %d\n",a3);
    printf("RE x %d\n",a4);
    return 0;
}

Measured memory_bytes: 3760
#include <stdio.h>
int max(int x,int y){
    if(x>y) return x;
    else return y;
}
int a[100000];
int main(void){
    int n,m,l,r,i,l_max=-1,r_min=100001;
    scanf("%d%d",&n,&m);
    for(i=0;i<m;i++){
        scanf("%d%d",&l,&r);
        if(l_max<l) l_max=l;
        if(r_min>r) r_min=r; 
    }
    printf("%d",max(0,r_min-l_max+1));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
const int mod=1e9+7;
const int maxn=1e5+5;
int a[maxn],b[maxn];
char s[maxn];
ll dp[maxn][15];
int main()
{
    scanf("%s",s);
    int len=strlen(s);
    if(s[0]=='?')
    {
        for(int i=0;i<=9;i++)
            dp[0][i]=1;
    }
    else
        dp[0][(s[0]-'0')]=1;
    for(int i=1;i<len;i++)
    {
        for(int j=0;j<13;j++)
        {
            if(s[i]=='?')
            {
                for(int k=0;k<=9;k++)
                    dp[i][(j*10+k)%13]=(dp[i][(j*10+k)%13]+dp[i-1][j])%mod;
            }
            else
            {
                int d=s[i]-'0';
                dp[i][(j*10+d)%13]=(dp[i][(j*10+d)%13]+dp[i-1][j])%mod;
            }
        }
    }
    printf("%lld",dp[len-1][5]);
    return 0;
}



Measured memory_bytes: 12544
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main(void) {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    ll n;
    cin >> n;
    vl a(n);
    rep(i,0,n) {
        cin >> a[i];
    }
    ll ret = 0;
    rep(i,0,n-1) {
        ret += a[i]/2;
        a[i] %= 2;
        if(a[i] && a[i+1]) {
            ret++;
            a[i]--;
            a[i+1]--;
        }
    }
    ret += a[n-1]/2;
    cout << ret << '\n';
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
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 long long INF = 1LL << 60;
const int inf = 1001001001;
 
int main(){

    ll n,m,ac=0,wa=0;
    cin >> n >> m;
    map<ll,string> data;
    map<ll,ll> sayuri;
    for(ll i=0; i<m; i++){
        ll p;
        string s;
        cin >> p >> s;

        if(data.count(p)){
            if(data.at(p)=="WA"){
                if(s=="WA"){
                    sayuri[p]=sayuri.at(p)+1;
                }
                else if(s=="AC"){
                    ac++;
                    data[p]="AC";
                    wa+=sayuri.at(p);

                }

            }
            else if(data.at(p)=="AC"){
                continue;
            }
        }
        else{
            if(s=="WA"){
                sayuri[p]=1;
                data[p]="WA";

            }
            else if(s=="AC"){
                ac++;
                data[p]="AC";

            }
                
        }

    }
    
    cout << ac << " " << wa << endl;
    
 
}

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

int main() {
  int64_t X,M,Y;
  cin >> X ;
  M = 100;
  Y = 0;
  while (M<X) {
    M *= 1.01;
    Y++;
  }

  cout << Y << endl;


  // ここにプログラムを追記
  // (ここで"試合結果の表"の2次元配列を宣言)
}


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

int main(){
    vector<int> a(5);
    int ans=0;
    int ansplace=0;
    for(int i=0;i<5;i++){
        cin >> a[i];
    }

    vector<int> b(5);

    
    int min=10;
    for(int i=0;i<5;i++){
        b[i]=a[i]%10;
        //cout << b[i] << endl;
        if(min > b[i] && b[i]!=0){
        ansplace=i;
        min=b[i];
        }

    }


    for(int i=0;i<5;i++){
        if(i!=ansplace){
            if(10-a[i]%10!=10){
                a[i]+=(10-a[i]%10);
            }

        //cout << a[i] <<endl;
        ans+=a[i];
        }
        else{
           ans+=a[i]; 
          // cout << a[i] <<endl;
        }

    }

    cout << ans <<endl;
}

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

int main()
{
	long long ans;
	int n;

	scanf("%d", &n);
	if (n == 0) ans = 1;
	else {
		ans = n;
		while (--n > 1) ans *= n;
	}
	printf("%lld\n", ans);
	return 0;
}



Measured memory_bytes: 2040
#include <vector>
#include <iostream>
#include <limits>

using namespace std;

struct edge {
    int from;
    int to;
    int weight;
};

int main() {
    const auto INF = numeric_limits<int>::max();

    int V, E, r;
    cin >> V >> E >> r;

    vector<edge> edges;
    for (int i = 0; i < E; ++i) {
        int s, t, d;
        cin >> s >> t >> d;

        edges.push_back(edge{s, t, d});
    }

    // Bellman-Ford algorithm
    vector<int> d(V, INF);
    d[r] = 0;
    for (auto i = 0; i < V - 1; ++i) {
        for (auto& e : edges) {
            if (d[e.from] != INF && d[e.from] + e.weight < d[e.to]) {
                d[e.to] = d[e.from] + e.weight;
            }
        }
    }
    for (auto& e : edges) {
        if (d[e.from] != INF && d[e.from] + e.weight < d[e.to]) {
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }

    for (auto x : d) {
        if (x == INF) {
            cout << "INF" << endl;
        } else {
            cout << x << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3168
n = int(input())
a = [int(i) for i in input().split()]
b = []
count1 = 0
count2 = 0
for s in range(n):
	b.append(abs(a[s]))
	if a[s] < 0:
		count1 += 1
	elif a[s] == 0:
		count2 += 1
if count1 % 2 == 0 or count2 != 0:
	print(sum(b))
else:
	print(sum(b) - min(b)*2)

Measured memory_bytes: 14260
#include <queue>
#include <vector>
#include <iostream>
using namespace std;
struct edge {
	int to, cost;
};
int main() {
	int N;
	cin >> N;
	vector<vector<edge> > G(N);
	for (int i = 0; i < N - 1; ++i) {
		int a, b, c;
		cin >> a >> b >> c; --a, --b;
		G[a].push_back(edge{ b, c });
		G[b].push_back(edge{ a, c });
	}
	vector<long long> dist(N, -1);
	dist[0] = 0;
	queue<int> que;
	que.push(0);
	while (!que.empty()) {
		int u = que.front(); que.pop();
		for (edge e : G[u]) {
			if (dist[e.to] == -1) {
				dist[e.to] = dist[u] + e.cost;
				que.push(e.to);
			}
		}
	}
	for (int i = 0; i < N; ++i) {
		cout << dist[i] % 2 << '\n';
	}
	return 0;
}

Measured memory_bytes: 7168
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  
  cin>>s;
  if(s=="hi"s||s=="hihi"s||s=="hihihi"s||s=="hihihihi"s||s=="hihihihihi"s){cout<<"Yes"<<endl;}
  else{cout<<"No" <<endl;}
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


mod = 1000000007
inf = 1e10

#solve


def solve():
    n, m, v, p = LI()
    a = LI()
    a.sort(reverse=True)
    ok = p - 1
    ng = n
    def f(x):
        tmp = (p - 1) * m + (n - x) * m
        t = a[x] + m
        if t < a[p - 1]:
            return False
        for i in range(p - 1, x):
            tmp += t - a[i]
        return tmp >= m * v
        
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if f(mid):
            ok = mid
        else:
            ng = mid
    print(ok + 1)
    return


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


Measured memory_bytes: 58992
n = int(input())
l = list(map(int, input().split()))

l0 = l[::2]
l1 = l[1::2]

l0.sort()
l1.sort()

# print(l0)
# print(l1)

memo0 = [[1, l0[0]]]
memo1 = [[1, l1[0]]]
for i in range(1, n//2):
    if memo0[-1][1] == l0[i]:
        memo0[-1][0] += 1
    else:
        memo0.append([1, l0[i]])

    if memo1[-1][1] == l1[i]:
        memo1[-1][0] += 1
    else:
        memo1.append([1, l1[i]])

memo0.sort(reverse=True)
memo1.sort(reverse=True)

memo0.append([0, -1])
memo1.append([0, -1])

# print(memo0)
# print(memo1)

if memo0[0][1]!=memo1[0][1]:
    print(n-memo0[0][0]-memo1[0][0])
else:
    ans1 = n- memo0[0][0]-memo1[1][0]
    ans2 = n- memo0[1][0]-memo1[0][0]
    print(min(ans1, ans2))

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

using namespace std;

int main() {
	int n, t;
	cin >> n >> t;
	vector<int> c(n);
	vector<int> s(n);
	int a = 1001, x = 0;
	for (int i = 0; i < n; i++) {

		cin >> c[i] >> s[i];

		if (s[i] <= t) {
			a = min(c[i], a);
			x++;
		}
	}
	if (x == 0) {
		cout<<"TLE"<<endl;
	}
	else {
        cout << a << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
//abc078_b.cpp
//Sat Feb 24 17:34:13 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
using namespace std;

int main(){
	int x;
	int y;
	int z;
	cin >> x;
	cin >> y;
	cin >> z;

	int answer = (x-z)/(y+z);

	cout << answer << endl;
}

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

#define pb push_back
#define F first
#define S second
#define int long long
#define lint long long
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define SET(x, val) memset(x, val, sizeof(x))
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 202, D=62, MOD1 = 1e9 + 7, MOD2 = 998244353;
const lint INF = 1e18;

int n, a[N], pw2[D];
int basis[D]; // basis[i] keeps the mask of the vector whose f value is i
int sz; // Current size of the basis
string s;

bool insertVector(int mask, int p1 = 0) {
    for (int i = 0; i < D; i++) {

        if ((mask & pw2[i]) == 0LL) continue; // continue if i != f(mask)

        if (!basis[i]) { // If there is no basis vector with the i'th bit set, then insert this vector into the basis
            if(p1) return true;
            basis[i] = mask;
            ++sz;
            return true;
        }
        mask ^= basis[i]; // Otherwise subtract the basis vector from this vector
    }
    return false;
}
void solve()
{
    for(int i = 0; i < D; i++) basis[i] = 0;
    sz = 0;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    cin >> s;
    for(int i = n-1; i >= 0; i--)
    {
        if(s[i]=='0')
        {
            insertVector(a[i]);
        }
        else
        {
            bool ret = insertVector(a[i], 1);
            if(ret)
            {
                cout << 1 << endl;
                return;
            }
        }
    }
    cout << 0 << endl;
}
signed main()
{
    pw2[0]=1;
    for(int i = 1; i < D; i++) pw2[i] = pw2[i-1]*2;
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
}

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

int main() {
  int n; cin>>n;
  vector<float>v(n);
  rep(i, n){
    cin>>v[i];
  } 
  sort(v.begin(), v.end());
  float ans=(v[0]+v[1])/2;
  for(int i=2; i<n; ++i){
    ans = (ans+v[i])/2;
    
  }

  cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define lowbit(x) (x&(-x))
#define max(x,y) (x>=y?x:y)
#define min(x,y) (x<=y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define ios() ios::sync_with_stdio(true)
#define INF 1044266558
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
int n,x;
int main()
{
    while(scanf("%d%d",&n,&x)!=EOF)
    {
        printf("%d\n",n*n-x);
    }
    return 0;
}

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

public class Main{

	/*
	 *****class, math TEST point
	 *
	 * n People
	 *
	 * 1) midTest > m ***** 2) lastTest > f
	 * m,f<=50
	 * 3) retryTest > r
	 * r<=100
	 *
	 * 4) noTest > -1
	 *
	 ******* output constraint
	 *
	 * 1. 1) || 2) -1 > F
	 * 2. 1) + 2) 80~ > A
	 * 3. 1) + 2) 65~80 > B
	 * 4. 1) + 2) 50~65 > C
	 * 5. 1) + 2) 30~50 > D -- but, +3) 50~ > C
	 * 6. 1) + 2) 30 > F
	 *
	 *********** " ", m,f,r
	 ******** m,f,r > -1-1-1 > exit;
	 *
	 */
	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		/*
		 * 40 42 -1??? 20 30 -1??? 0 2 -1 ???-1 -1 -1
		 */
		do{
		// ?????±????????????
		String[] point = br.readLine().split(" ");

			//for (int i = 0; i < point.length; i++) {
			int midTest = Integer.parseInt(point[0]);
			int lastTest = Integer.parseInt(point[1]);
			int retryTest = Integer.parseInt(point[2]);
			int totPoint = midTest + lastTest;

			// 1???????????????
			if (midTest == -1 && lastTest == -1 && retryTest == -1)
				break;
			else if (midTest == -1 || lastTest == -1 || totPoint < 30)
				System.out.println("F");
			else if (totPoint >= 80)
				System.out.println("A");
			else if (totPoint < 80 && totPoint >= 65)
				System.out.println("B");
			else if (totPoint < 65 && totPoint >= 50 || retryTest >= 50)
				System.out.println("C");
			else
				System.out.println("D");
	}while(true);
}
}

Measured memory_bytes: 24480
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,m;
  cin>>n>>m;
  int visited[n];
  rep(i,n){
    visited[i]=INF;
  }
  vector<int> v[n];
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  visited[0]=0;
  int ans[n];
  queue<int> bfs;
  bfs.push(0);
  while(!bfs.empty() ){
    int x=bfs.front();
    bfs.pop();
    rep(j,v[x].size() ){
      if(visited[x]+1 < visited[v[x][j]]){
	visited[v[x][j]]=visited[x]+1;
	ans[v[x][j]]=x;
	bfs.push(v[x][j]);
      }
    }
  }
  cout<<"Yes"<<endl;
  repi(i,1,n){
    cout<<ans[i]+1<<endl;
  }

  return 0;
}


Measured memory_bytes: 13836
import java.util.Scanner;

public class Main {
    private static Scanner input = new Scanner(System.in);
    private static int q    ;

    public static void main(String[] args) {
        int a = input.nextInt();
        String b = input.next();

        for(int i = 0; i < b.length(); i++) {
            Character c = b.charAt(i);

            if (c.equals('R')) {
                q = q + 1;
            }
        }

            if (q > (a/2)) {
                System.out.println("Yes");
            }
            else {
                System.out.println("No");
            }
    }
}


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

int main (void){
  int n;
  cin >> n;
  vector<int>b;
  for(int i = 0; i < n - 1; i++){
    int j;
    cin >> j;
    b.push_back(j);
  }
  
  int sum = b[0] + b[n-2];
  for(int i = 0; i < n - 2; i++){
    if(b[i] <= b[i+1]){
      sum += b[i];
    }
    else{
      sum += b[i+1];
    }
  }
  cout << sum;
  return 0;
}


Measured memory_bytes: 256
a,b=map(int,input().split())
ans=[]

for i in range(50):
  l=[]
  for j in range(100):
    if i%2==0 and j%2==0 and a>1:
      l.append('.')
      a-=1
    else:
      l.append('#')
  ans.append(l)

for i in range(50):
  l=[]
  for j in range(100):
    if i%2==1 and j%2==1 and b>1:
      l.append('#')
      b-=1
    else:
      l.append('.')
  ans.append(l)

print(100,100)
for i in range(100):
  print(''.join(ans[i]))

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

#define M 100000
int N,v[M],dp[M],K;

inline int sol (int ind)
{
	if(ind>=N) return 1e6;
	if(dp[ind]!=-1) return dp[ind];
	
	int so=1e9,el=0;
	for(int i=1; i<=K && i+ind<N; i++) el=abs(v[ind]-v[ind+i]),el+=sol(ind+i), so=min(so,el);
	return dp[ind]=so;
}

int main ()
{
	cin >> N >> K;
	for(int i=0; i<N; i++) cin >> v[i];
	for(int i=0; i<M; i++) dp[i]=-1;
	dp[N-1]=0; cout << sol(0);
}

Measured memory_bytes: 4096
def main():
    n = int(input())
    a = list(map(int, input().split()))

    for num in a:
        if num % 2 == 0:
            if num % 3 != 0 and num % 5 != 0:
                break
    else:
        print("APPROVED")
        return
    print("DENIED")


if __name__ == "__main__":
    main()



Measured memory_bytes: 61412
(* O(n^4) *)
let n = Scanf.scanf " %d" @@ (+) 0
let xys = Array.init n @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a, b
let ans = ref max_int
let _ =
  if n = 1 then (print_endline "1"; exit 0);
  (xys |> Array.iteri @@ fun i (x0, y0) ->
    xys |> Array.iteri @@ fun j (x, y) ->
      if i <> j then
        let p, q = x - x0, y - y0 in
        let e = ref 0 in
        xys |> Array.iter @@ fun (x1, y1) ->
          (xys |> Array.iter @@ fun (x2, y2) ->
            if x2 - x1 = p && y2 - y1 = q then incr e);
          ans := min !ans @@ n - !e);
  Printf.printf "%d\n" @@ !ans

Measured memory_bytes: 2560
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;

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

	cin >> N >> M;
	while (N) {
		int num[200] = {};
		for (int i = 0; i < N; i++) {
			cin >> K;
			for (int j = 0; j < K; j++) {
				cin >> L;
				num[L]++;
			}
		}
		int box = 0;
		for (int i = 1; i <= 100; i++) {
			if (num[i] >= M&&num[i] > num[box]) {
				box = i;
			}
		}
		cout << box << endl;
		cin >> N >> M;
	}
	return 0;
}

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

char str[(size_t) 1e5 + 5];

int main() {
    scanf("%s", str);
    int cnt = 0;
    for (int i = 0, _ = strlen(str) - 1; i < _; i++)
        cnt += (str[i] != str[i + 1]);
    printf("%d\n", cnt);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define T pair<int, int>
#define ordered_set tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define MOD 1000000007
#define pb push_back 
#define ins insert
#define fast(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int p(int a, int b) {
    if (b==0) return (int)1;
    int x = p(a, b>>1);
    if (b & 1) return m(x*m(a*x));
    return m(x*x);
}
signed main(){
    fast();
    long double n;
    cin >> n;
    n /= 3;
    n = n*n*n;
    cout << fixed << setprecision(12) << n << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	long long n, m, a, b, e = 0;
	cin >> n >> m;
	int test[200001] = { 0 };
	for (int h = 1; h <= m; h++) {
		cin >> a >> b;
		if (a == 1) {
			test[b] += 1;
		}
		if (b == n) {
			test[a] += 1;
		}
		if (test[b] == 2 && e == 0) {
			e++;
		}
		if (test[a] == 2 && e == 0) {
			e++;
		}
	}
	if (e >= 1) {
		cout << "POSSIBLE" << endl;
	}
	if (e == 0) {
		cout << "IMPOSSIBLE" << endl;
	}
	cin >> e;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	int ans = INF;
	for (int j = -100; j <= 100; j++) {
		int now = 0;
		rep(i, n) {
			now += (a[i] - j)*(a[i] - j);
		}
		chmin(ans, now);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
static const int MAX_N = 100000;

int N, Q;
int parent[MAX_N];
bool marked[MAX_N];
vector<pair<char, int> > va;

int par[MAX_N];
int rnk[MAX_N];

int rec(int v){
	if(v == 0) return 0;
	if(rnk[v] != -1) return rnk[v];
	return rnk[v] = rec(parent[v]) + 1;
}
void init(int N){
	for(int i = 0; i < N; i++){
		par[i] = i;
	}
}
int find(int x){
	if(par[x] == x){
		return x;
	}else{
		return par[x] = find(par[x]);
	}
}
void unite(int x, int y){
	x = find(x);
	y = find(y);
	if(x == y) return;
	if(rnk[x] > rnk[y]){
		par[x] = y;
	}else{
		par[y] = x;
		if(rnk[x] == rnk[y]) rnk[x]++;
	}
}
bool same(int x, int y){
	return find(x) == find(y);
}

int main(){
	for(;;){
		cin >> N >> Q;
		if(N == 0 && Q == 0) break;
		for(int i = 1; i < N; i++){
			cin >> parent[i];
			parent[i]--;
		}
		fill(marked, marked + N, false);
		fill(rnk, rnk + N, -1);
		for(int i = 0; i < Q; i++){
			char ch; int v;
			cin >> ch >> v;
			v--;
			if(ch == 'M'){
				if(marked[v]) continue;
				marked[v] = true;
			}
			va.push_back(make_pair(ch, v));
		}
		reverse(va.begin(), va.end());
		init(N);
		for(int i = 0; i < N; i++) rnk[i] = rec(i);
		for(int i = 0; i < N; i++){
			if(!marked[i]) unite(parent[i], i);
		}
		ll res = 0LL;
		for(int i = 0; i < va.size(); i++){
			if(va[i].first == 'M'){
				unite(parent[va[i].second], va[i].second);
			}else{
				res += (ll)(find(va[i].second) + 1);
			}
		}
		cout << res << endl;
		va.clear();
	}
	return 0;
}



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

using namespace std;

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

  uint64_t N;
  cin >> N;

  auto y = (N * 100) / 108;

  if ((y * 108) / 100 == N) {
    cout << y << endl;
  } else if (((y + 1) * 108) / 100 == N) {
    cout << (y + 1) << endl;
  } else {
    cout << ":(" << endl;
  }


}


Measured memory_bytes: 256
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

template<class T>bool umax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool umin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

// gcd
int gcd(int a, int b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

int main() {
    long long N,M;
    long long ans=0;

    cin >> N >> M;
    if(N==1 && M==1){
        ans = 1;
    }else if(min(N,M)==1 && max(N,M) != 1){
        ans = max(N,M)-2;
    }else{
        ans = (N-2)*(M-2);
    }
    cout << ans << endl;
    return 0;
}



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

int main(){
double x,y,angle,t,r;
x=0;
y=0;
angle=M_PI/2;
while(1){
scanf("%lf,%lf",&r,&t);
if(r==0&&t==0)break;
x+=r*cos(angle);
y+=r*sin(angle);
angle+=t*M_PI/180;
}
printf("%d\n%d\n",(int)-x,(int)y);
return 0;
}

Measured memory_bytes: 1060
import numpy as np
import copy
import itertools

H, W, K = map(int, input().split())
S = []
for _ in range(H):
    S.append(list(input()))
S = np.array(S)
S = np.where(S == '#', 1, 0)

comb_H = []
for k in range(H + 1):
    comb_H += list(itertools.combinations(range(1, H + 1), k))
comb_W = []
for k in range(W + 1):
    comb_W += list(itertools.combinations(range(1, W + 1), k))

ans = 0
comb = list(itertools.product(comb_H, comb_W))
for h, w in comb:
    S_tmp = copy.deepcopy(S)
    if len(h) > 0:
        for i in h:
            S_tmp[i - 1, :] = 0
    if len(w) > 0:
        for j in w:
            S_tmp[:, j - 1] = 0

    if np.count_nonzero(S_tmp == 1) == K:
        ans += 1
print(ans)

Measured memory_bytes: 27576
public class Main {

  private static void solve() {
    int h = ni();
    int w = ni();
    int d = ni();
    
    char[][] ret = new char[h][w];
    char[] c = "RGBY".toCharArray();

    for (int i = 0; i < h; i ++) {
      for (int j = 0; j < w; j ++) {
        int p = i + j;
        int q = i - j;
        
        int x = (p % (d * 2) + d * 2) % (d * 2) / d;
        int y = (q % (d * 2) + d * 2) % (d * 2) / d;
        ret[i][j] = c[(x * 2 + y) % 4];
      }
    }
    for (char[] v : ret) {
      out.println(v);
    }
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = System.getProperty("debug");
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
int res=0;
int main()
{
    int n;
    int cnt[4]={0};
    for(int i=0;i<6;i++)
	{
    	cin>>n;
    	cnt[n-1]++;
    }
    for(int j=0;j<4;j++)
	{
    	if(cnt[j]%2==1)res++;
   	}
   	if(res==2)
   	{
   		cout<<"YES"<<endl;
		return 0;
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
#include<deque>
#include<stack>
#include<queue>
#include<string>
#include<iostream>
#include<tuple>
#include<utility>
#include<set>
#include<queue>
#include<iomanip>
#include<iterator>
#include<map>
#include<bitset>
#include<array>
#include<cmath>
#include<functional>
#include<list>
using namespace std;
typedef long long int llint;
typedef long double lldo;
const llint big=2e18+100000;
const int mod=1e9+7;
const lldo eps=1e-7;
const long double pai=3.141592653589793238462643383279502884197;
#define mt make_tuple
#define mp make_pair
#define fir first
#define sec second
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define res resize
#define ins insert
#define era erase
#define dme(in) cout<<in<<endl;return 0
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
int main(void){
	int i,j,n;cin>>n;
	vector<int>oya(n+1);
	vector<vector<int>>ko(n+1);
	vector<int>ran(n+1);
	for(i=1;i<=n;i++){cin>>oya[i];ko[oya[i]].pub(i);}
	for(i=n;i>=0;i--){
		ran[i]++;
		maxeq(ran[oya[i]],ran[i]);
	}
	vector<deque<pair<int,int>>> aru(n+1);
	vector<int>kabu;
	for(int h=0;h<=n;h++){
		int ter=n-h;//順序
		if(ko[ter].size()==0){
			aru[ter].puf(mp(1,1));
		}else{
			int sra=-1,sde=-1;
			for(auto it:ko[ter]){if(sra<=ran[it]){sde=it;sra=ran[it];}}
			aru[ter]=move(aru[sde]);
			aru[sde].clear();aru[sde].shrink_to_fit();
			for(auto it:ko[ter]){
				if(sde==it){continue;}
				auto sor=move(aru[it]);
				aru[it].clear();aru[it].shrink_to_fit();
				if(kabu.size()<sor.size()){kabu.res(sor.size());}
				for(j=0;j<sor.size();j++){
					llint ar=(llint)aru[ter][j].fir*sor[j].sec+(llint)aru[ter][j].sec*(llint)sor[j].fir;ar%=mod;
					llint na=(llint)aru[ter][j].sec*sor[j].sec;na%=mod;
					llint ka=(llint)kabu[j]*((llint)sor[j].fir+sor[j].sec)+(llint)aru[ter][j].fir*(llint)sor[j].fir;ka%=mod;
					aru[ter][j]=mp((int)ar,(int)na);kabu[j]=ka;
				}
			}
			for(j=0;j<kabu.size();j++){aru[ter][j].sec+=kabu[j];aru[ter][j].sec%=mod;}
			aru[ter].puf(mp(1,1));
		}
		kabu.clear();
	}
	auto saiaru=move(aru[0]);
	ko.clear();ko.shrink_to_fit();
	aru.clear();aru.shrink_to_fit();
	ran.clear();ran.shrink_to_fit();
	vector<int>fuka(n+1);
	vector<int>fkaz(n+1);fkaz[0]=1;
	for(i=1;i<=n;i++){fuka[i]=fuka[oya[i]]+1;fkaz[fuka[i]]++;}//逆深さ
	oya.clear();oya.shrink_to_fit();
	llint ans=0;
	vector<int>nzyo(n+2);nzyo[0]=1;
	for(i=1;i<=n+1;i++){nzyo[i]=(nzyo[i-1]*2)%mod;}
	for(j=0;j<saiaru.size();j++){
		ans+=(llint)nzyo[n+1-fkaz[j]]*saiaru[j].fir;
		ans%=mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 244724
#include <cstdlib>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 100005
#define pb push_back
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double PI  =3.141592653589793238463;
long long MOD = 1000000007;

int stringToInteger(string x){
    int gg=0;
    //stringstream geek(x);
    //geek >> gg;
    return gg;
}

ll powmod(ll a,ll b,ll m)
{
    ll ans=1;
    while(b>0){ if(b%2)
        {ans*=a; ans%=m;}
         b/=2; a=a*a; a=a%m;
        }
        return ans%m;
}
ll gcd(ll a,ll b)
{

    return __gcd(a,b);
}
ll mulmod(ll a,ll b,ll m)
{  ll ans=0;
    a %=m;
    while (b>0)
    {       if(b&1) ans = (ans + a) % m;
        a = (a * 2)%m;
        b /= 2;
    }
    return ans % m;
}

ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a;
 while(b > 0)
 	{
 		if(b%2 == 1)
 	{
 		x=(x*y);
 		if(x>MOD) x%=MOD;
 	}
 	y = (y*y);
 	if(y>MOD) y%=MOD;
 	b /= 2;
 	}
 return x;
}
ll modInverse(ll a, ll m)
{
    a = a%m;
    for (int x=1; x<m; x++)
       if ((a*x) % m == 1)
          return x;
}
ll maxDivide(ll a, ll b)
{
  while (a%b == 0)
   a = a/b;
  return a;
}
  set<ll>ans;
void primeFactors(ll n)
{

    while (n % 2 == 0)
    {
       ans.insert(2);
        n = n/2;
    }

    for (ll i = 3; i <= sqrt(n); i = i + 2)
    {
        // While i divides n, print i and divide n
        while (n % i == 0)
        {
            ans.insert(i);
            n = n/i;
        }
    }

    // This condition is to handle the case when n
    // is a prime number greater than 2
    if (n > 2)
        ans.insert(n);
}
ll is(ll no)
{   if(no==1) return 0;
    set<ll>::iterator it;
for(it=ans.begin();it!=ans.end();it++){
  no = maxDivide(no, *it);
  if(no==1) return 1;
//  if()
 // no = maxDivide(no, 3);
 // no = maxDivide(no, 5);
}
//if(no==1) return 1;
//for(it=ans.begin();it!=ans.end();it++){
//if(no==*it) return 1;
//}
  return 0;
}

int comp(string a,string b)
{
    string aa = a.append(b);
    string bb = b.append(a);

    return aa.compare(bb) > 0 ? 1: 0;

}
int main()
{
    //cout<<powmod(2,7,9)<<endl;
int t;
t=1;
while(t--){

       //int n,k;
        int a,b;
        float t;
       cin>>a>>b>>t;
       int aa = (t+0.5)/a;
       cout<<b*aa<<endl;
}
}




Measured memory_bytes: 256
class Tree:
    nodes = []
    def __init__(self):
        self.root = None
    def insert(self, nodenum, leftnum, rightnum):
        if leftnum != -1:
            self.nodes[nodenum].left = self.nodes[leftnum]
            self.nodes[leftnum].type_ = "internal node"
            self.nodes[leftnum].parent = self.nodes[nodenum]
            self.nodes[nodenum].degree += 1
        else:
            self.nodes[nodenum].left = -1
        if rightnum != -1:
            self.nodes[nodenum].right = self.nodes[rightnum]
            self.nodes[rightnum].type_ = "internal node"
            self.nodes[rightnum].parent = self.nodes[nodenum]
            self.nodes[nodenum].degree += 1
        else:
            self.nodes[nodenum].right = -1
        if leftnum != -1 and rightnum != -1:
            self.nodes[leftnum].sibling = rightnum
            self.nodes[rightnum].sibling = leftnum
    def depth(self, node):
        if node.left != -1:
            node.left.depth += node.depth + 1
            self.depth(node.left)
        if node.right != -1:
            node.right.depth += node.depth + 1
            self.depth(node.right)
    def height(self, node):
        if node.left == -1 and node.right == -1:
            node.type_ = "leaf"
            return 0
        elif node.left == -1:
            x = self.height(node.right)
            node.height = x + 1
            return x + 1
        elif node.right == -1:
            x = self.height(node.left)
            node.height = x + 1
            return x + 1
        else:
            x = max(self.height(node.left), self.height(node.right)) + 1
            node.height = x
            return x
class Node:
    def __init__(self, label, left = -1, right = -1):
        self.label = label
        self.type_ = "root"
        self.parent = -1
        self.sibling = -1
        self.depth = 0
        self.height = 0
        self.degree = 0
        self.left = left
        self.right = right

tree = Tree()
n = int(input())
for i in range(n):
    tree.nodes.append(Node(i))
for i in range(n):
    num, left, right = map(int, input().split())
    tree.insert(num, left, right)
for i in tree.nodes:
    if i.parent == -1:
        tree.depth(i)
        tree.height(i)
if n == 1:
    tree.nodes[0].type_ = "root"
for i in tree.nodes:
    print("node {0:}: parent = ".format(i.label), end = "")
    if i.parent == -1:
        print(i.parent, end = "")
    else:
        print(i.parent.label, end = "")
    print(", sibling = {0:}, degree = {1:}, depth = {2:}, height = {3:}, {4:}".format(i.sibling, i.degree, i.depth, i.height, i.type_))


Measured memory_bytes: 5616
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<string.h>
using namespace std;
int n,m;
string a[51], b[51];
int main(){
	while (~scanf("%d%d", &n,&m)){
		for (int i = 0; i < n; i++){
			cin >> a[i];
		}
		for (int i = 0; i < m; i++){
			cin >> b[i];
		}
		bool h=true;
		for (int i = 0; i < n-m+1 ; i++){
			for (int j = 0; j < n-m+1 ; j++){
				h = true;
				for (int k = 0; k < m; k++){
					for (int w = 0; w < m; w++){
						//if ((i + k) >= n || (j + w) >= n){ h = false; break; }
						if (b[k][w] != a[i + k][j + w]){
							h = false; break;
						}
					}
					if (h == false)break;
				}
				if (h == true)break;
			}
			if (h == true)break;
		}
		if (h == true){ printf("Yes\n"); }
		else{ printf("No\n"); }
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
  	int n,m,x,cnt1=0,cnt2=0;
  	cin>>n>>m>>x;
  	int a[n];
  	for(int i=0;i<m;i++){
  		cin>>a[i];
  		if(a[i]<x)
  			cnt1++;
  		if(a[i]>x)
  			cnt2++;
	}
	cout<<min(cnt1,cnt2)<<endl;
  	return 0;
}

Measured memory_bytes: 256
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra

xs, ys, xt, yt = map(int, input().split())
n = int(input())

p = [(xs,ys,0),(xt,yt,0)]
for i in range(2,n+2):
    p.append(tuple(map(int,input().split())))
edge = [[-1]*(n+2)for i in range(n+2)]
 
for i in range(n+2):
    for j in range(i+1,n+2):
        edge[i][j] = edge[j][i] =  max(((p[i][0]-p[j][0])**2+(p[i][1]-p[j][1])**2)**0.5 - p[i][2] - p[j][2],0.0)

#ここから
G = csgraph_from_dense(edge,null_value=-1)
print(dijkstra(G,indices=0)[1])

Measured memory_bytes: 63152
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int n,k;
	string s;
	cin>>n>>k;
	cin>>s;
	s[k-1]=tolower(s[k-1]);
	cout<<s<<endl;

	return 0;

}


Measured memory_bytes: 256
n,k =map(int, input().split())
#d = list(map(int, input().split()))
d = list(input().split())
#print(d)

def check(kakaku, negative_number):
  check_sum = 1
  for i in negative_number:
    if i in str(kakaku):
      #print(i)
      check_sum = 0
      break
    else:
      pass
  return check_sum

while check(n, d) == 0:
  n += 1

print(n)

Measured memory_bytes: 3064
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    a2 = [ae&1 ^ 1 for ae in a]
    if all(a2):
        print('second')
    else:
        print('first')


if __name__ == '__main__':
    main()


Measured memory_bytes: 86048
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>

int N, W;
std::vector<int> ww[4];
std::vector<int > w(104), v(104);

bool check(int I, int J, int K, int L){
  long long wsum=0;
  for (int i=0; i<I; i++){
    wsum+=w[0];
  }
  for (int j=0; j<J; j++){
    wsum+=w[0]+1;
  }
  for (int k=0; k<K; k++){
    wsum+=w[0]+2;
  }
  for (int l=0; l<L; l++){
    wsum+=w[0]+3;
  }
  //printf("Wsum(%d, %d, %d, %d)=%d\n", I, J, K, L, wsum);
  return wsum<=W;
}

long long sum(int I, int J, int K, int L){
  long long ret = 0;
  for (int i=0; i<I; i++){
    ret+=ww[0][i];
  }
  for (int j=0; j<J; j++){
    ret+=ww[1][j];
  }
  for (int k=0; k<K; k++){
    ret+=ww[2][k];
  }
  for (int l=0; l<L; l++){
    ret+=ww[3][l];
  }
  return ret;
}

int main(){
  scanf("%d", &N);
  scanf("%d", &W);
  ww[0].push_back(0);
  ww[1].push_back(0);
  ww[2].push_back(0);
  ww[3].push_back(0);
  for (int i=0; i<N; i++){
    scanf("%d", &w[i]);
    scanf("%d", &v[i]);
    ww[w[i]-w[0]].push_back(v[i]);
    //printf("%d  .push %d\n", w[i]-w[0], v[i]);
  }
  for (int j=0; j<4; j++){
    std::sort(ww[j].begin(), ww[j].end(), std::greater<int>());
  }
  long long ans = 0;
  //printf("size=(%d, %d, %d, %d)\n", ww[0].size(),ww[1].size(),ww[2].size(),ww[3].size());
  for (int i=0; i<ww[0].size(); i++){
    for (int j=0; j<ww[1].size(); j++){
      for (int k=0; k<ww[2].size(); k++){
	for (int l=0; l<ww[3].size(); l++){
	  //printf("(%d, %d, %d, %d)\n", i,j,k,l);
	  if (check(i,j,k,l)){
	    ans = std::max(ans, sum(i,j,k,l));
	  }
	}
      }
    }
  }
  std::cout << ans << std::endl;
  return 0;
}
 

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

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

int main () {
  int n,m,x;
  cin >> n >> m >> x;
  vector<int> price(n);

  vector<vector<int>> a(n, vector<int>(m));
  for(int i=0;i<n;i++){
    cin >> price[i];
    for(int j=0;j<m;j++){
    cin >> a[i][j];
    }
  }
  int ans=2000000;
  bool exist = false;
for (int bit = 0; bit < (1 << n); ++bit) {
    vector<int> S = IntegerToVector(bit, n);

    int sum = 0;
    vector<int> judge(m,0);
    for (int i : S) sum += price[i];
    for (int i : S){
      for(int j=0;j<m;j++){
        judge[j]+=a[i][j];
      }
    }
   int flag=0;
   for(int j=0;j<m;j++){
     if(judge[j]>=x)flag++;
   }
   if(flag==m){
     exist=true;
     ans=min(ans,sum);
   }
}
if(exist)cout << ans << endl;
else cout << -1 << endl;


}

Measured memory_bytes: 3644
#include<iostream>
#include<cstring>
using namespace std;
int n, m,map[150][150];
int bord[4][2] = { 1,0,-1,0,0,1,0,-1 };
char a[150][150];
void dfs(int x, int y,char z) {
	for (int i = 0; i < 4; i++) {
		int A = x + bord[i][0];
		int B = y + bord[i][1];
		if (A >= 0 && B >= 0 && A < n && B < m && map[A][B] == 0 && a[A][B] == z) {
			map[A][B] = 1;
			dfs(A, B, z);
		}
	}
}
int main() {
//#ifdef LOCAL
//	freopen("Text.txt", "r", stdin);
//#endif // DEBUG

	while (cin >> n >> m && n != 0 && m != 0) {
		memset(map, 0, sizeof(map));
		int people = 0;
		for (int i = 0; i < n; i++)
			for (int g = 0; g < m; g++)
				cin >> a[i][g];
		for (int i = 0; i < n; i++) {
			for (int g = 0; g < m; g++) {
				if (map[i][g] == 0) {
					people++;
					dfs(i, g, a[i][g]);
				}
			}
		}
		cout << people << endl;
	}
	return 0;
}


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

long long int N;
long long int x[100], y[100];
struct pos{
  long long int x=0;
  long long int y=0;
  bool operator<(const pos& value) const {
    if(x<value.x) return true;
    if(x>value.x) return false;
    if(y<value.y) return true;
    if(y>value.y) return false;
    return false;
  }
};

map<pos,long long int> cnt;
int main(void){
  cin>>N;
  for(long long int i=0;i<N;i++){
    cin>>x[i]>>y[i];
  }
  for(long long int i=0;i<N;i++){
    for(long long int j=0;j<N;j++){
      if(i==j) continue;
      pos p; p.x = x[i]-x[j], p.y = y[i]-y[j];
      cnt[p]++;
    }
  }
  long long int max = 0;
  for(map<pos,long long int>::iterator i = cnt.begin(); i != cnt.end(); ++i) {
    if(i->second>max){
      max=i->second;
    }
  }
  cout<<N-max<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>

using namespace std;


int main(){
    int ans=0;
    int N;
    cin>>N;

    vector<int> p;

    for(int i=0;i<N;i++){
        int a=0;
        cin>>a;
        p.push_back(a);
    }

    int min=p[0];

    for(int i=0;i<N;i++){
        
        if(min>=p[i]){
            min=p[i];
            ans++;
        }
    }
   
    //cout<<fixed << setprecision(15)<<max<<endl;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1400