akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;


int main(){

    int dinnerCount = 5;
    int l, cookTime[dinnerCount], k;
    
    int allCookTime = 0;

    int maxLossDinnerIndex = -1;

    for (int i = 0; i < dinnerCount ; i++)
    {
        cin >> l;
        cookTime[i] = l;

        // 1の位0以上かつ一番小さいものを選択
        if( maxLossDinnerIndex == -1 ||
            ( cookTime[i] % 10 != 0  && 
            ( cookTime[maxLossDinnerIndex] % 10 > cookTime[i] % 10) ) )
        {
            maxLossDinnerIndex = i;
        }

    }

    for (int i = 0; i < dinnerCount ; i++)
    {
        if ( cookTime[i] % 10 == 0 || i == maxLossDinnerIndex)
        {
            // cout << i << ":" << cookTime[i] << "\n";
            allCookTime += cookTime[i];
        }
        else 
        {
            
            // cout << i << ":" << ((cookTime[i]/10)+1)*10 << "\n";
            allCookTime += ((cookTime[i]/10)+1)*10;
        }
        
    }

    cout << allCookTime;


}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::{cmp::Reverse, collections::*};

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Chars, Usize1},
};

#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_imports)]
use num::Integer;

#[fastout]
pub fn main() {
    input! {
        x: i128, k: i128, d: i128,
    }

    if x == 0 {
        println!("{}", if k % 2 == 0 { 0 } else { d.abs() });
    } else if x > 0 {
        let n = (x as f64 / d as f64).ceil() as i128;
        if n > k {
            println!("{}", (x - k * d).abs());
        } else if (x - n * d).abs() > (x - (n - 1) * d).abs() {
            println!(
                "{}",
                if (k - (n - 1)) % 2 == 0 {
                    (x - (n - 1) * d).abs()
                } else {
                    (x - n * d).abs()
                }
            );
        } else {
            println!(
                "{}",
                if (k - n) % 2 == 0 {
                    (x - n * d).abs()
                } else {
                    (x - (n - 1) * d).abs()
                }
            );
        }
    } else {
        let n = (-x as f64 / d as f64).ceil() as i128;
        if n > k {
            println!("{}", (x + k * d).abs());
        } else if (x + n * d).abs() > (x + (n - 1) * d).abs() {
            println!(
                "{}",
                if (k - (n - 1)) % 2 == 0 {
                    (x + (n - 1) * d).abs()
                } else {
                    (x + n * d).abs()
                }
            );
        } else {
            println!(
                "{}",
                if (k - n) % 2 == 0 {
                    (x + n * d).abs()
                } else {
                    (x + (n - 1) * d).abs()
                }
            );
        }
    }
}


Measured memory_bytes: 2700
n = int(input())
a = list(map(int,input().split()))
ans1 = 0
num = 0
f1 = 1
for i in range(n):
    num += a[i]
    if f1:
        if num <=0:
            ans1 += 1-num
            num = 1
        f1 = 0
    else:
        if num >= 0:
            ans1 += num+1
            num = -1
        f1 = 1
ans2 = 0
num = 0
f1 = 0
for i in range(n):
    num += a[i]
    if f1:
        if num <=0:
            ans2 += 1-num
            num = 1
        f1 = 0
    else:
        if num >= 0:
            ans2 += num+1
            num = -1
        f1 = 1
print(min(ans1,ans2))

Measured memory_bytes: 63600
import javax.imageio.metadata.IIOMetadataFormatImpl;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(reader.readLine());
        String[] po = reader.readLine().split(" ");
        int[] arr = new int[N];
        int[] dp = new int[N];
        for (int i = 0; i < N; i++) {
            arr[i] = Integer.parseInt(po[i]);
        }
        dp[0] = 0;
        dp[1] = Math.abs(arr[1]-arr[0]);
        for (int i = 2; i <N ; i++) {
            dp[i] = Math.min(dp[i-1]+Math.abs(arr[i]-arr[i-1]),dp[i-2]+Math.abs(arr[i]-arr[i-2]));
        }
        System.out.println(dp[N-1]);
    }
}


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


template<typename T>
struct BIT{
    int n;
    vector<T> v;
    BIT(const int n_) : n(n_) , v(n+1 , T(0)){};

    void add(const int i,const T x){
        for(int idx=i+1;idx<=n;idx+= (idx & -idx))
            v[idx]+=x;
        return;
    }
    T subsum(const int i)const{
        T res(0);
        for(int idx=i+1;idx>0;idx-=(idx & -idx))
            res+=v[idx];
        return res;
    }
    T sum(const int l,const int r)const{//[l,r)
        return subsum(r-1)-subsum(l-1);
    }
    int lower_bound(const T w)const{//よくわからなくなってるので後で直す これは1_indexedの実装のまま放置しています
        if(w<=0)return 0;
        int x=0,r=1;//xは求めるindexの一つ左を持っている
        while(r<n) r<<=1;
        for(int len=r;len>0;len=len>>1){
            if(x+len<n && v[x+len]<w){
                w-=v[x+len];
                x+=len;
            }
        }
        return x+1;
    }
};

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/
    
    int n,q;cin >> n >> q;
    BIT<ll> b(n);
    vector<ll> out;
    rep(i,n){
        ll a;cin >> a;
        b.add(i,a);
    }
    rep(i,q){
        int com;cin >> com;
        if(com){
            int l,r;cin >> l >> r;
            out.emplace_back(b.sum(l,r));
        }else{
            int p;ll x;cin >> p >> x;
            b.add(p,x);
        }
    }
    rep(i,out.size())cout << out[i] << " \n"[i+1==out.size()];
}

Measured memory_bytes: 10308
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {

  int n;
  cin >> n;
  vector<int> p(n);
  for(int i = 0 ; i < n; i++) {
    cin >> p.at(i);
  }
  
  int s = 1;
  int tmp = 0;
  int t = 0;
  for(int i = 0; i < n; i++) {
    if(p.at(i) == i+1) {
      continue;
    } else if(s == 1) {
      tmp = p.at(i);
      t = i;
      s++;
    } else {
      if(tmp == i+1 && p.at(i) == t+1) {
        p.at(i) = tmp;
      } else {
        cout << "NO" << endl;
        return 0; 
      }
    }
  }
  cout << "YES"  << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

int main() {
    int n, t;
    double m, dist;
    vector<int> s(1010);

    while(1) {
        cin >> n;
        if(!n)
            break;
        t = 0;
        rep(i, n) {
            cin >> s[i];
            t += s[i];
        }
        m = 1. * t / n;
        dist = 0;
        rep(i, n) dist += (s[i] - m) * (s[i] - m);
        dist = sqrt(dist / n);
        printf("%.8lf\n", dist);
    }
}


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

int change_s(int h,int m,int s){
  return (h*3600+m*60+s);
}

int main(void)
{
  int i,j;
  int n,c;
  int dh[10000],dm[10000],ds[10000];
  int ah[10000],am[10000],as[10000];
  int min,tmp,minnum,maxhour;

  while(1){
    scanf("%d ",&n);
    if(n==0)break;

    maxhour = change_s(24,60,60);

    for(i=0;i<n;i++){
      scanf("%d:%d:%d %d:%d:%d ",&dh[i],&dm[i],&ds[i],&ah[i],&am[i],&as[i]);
    }     

    for(i=0;i<n;i++){
      if(ah[i]>=0){
      min = maxhour;
      minnum = -1;

      for(j=0;j<n;j++){
	if(i!=j){
	tmp = change_s(dh[j],dm[j],ds[j]) - change_s(ah[i],am[i],as[i]);
	if(tmp >= 0 && tmp <min){
	  min = tmp;
	  minnum = j;
	}
	}
      }
      if(minnum>=0){
	  dh[minnum]=dh[i];
	  dm[minnum]=dm[i];
	  ds[minnum]=ds[i];
	  ah[i]=25;
	  dh[i]=-1;
      }
      }
    }

    c = 0;
    for(i=0;i<n;i++){
      if(dh[i]>=0)c++;
    }
    printf("%d\n",c);
  }
  return 0;
}

Measured memory_bytes: 648
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
#include <map> // pair
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;
#define START 0
#define FORWARD 1
#define BACK 2
using namespace std;
using ll = long long;
typedef pair <ll, ll > pll;
//*********************************************************
// 最大公約数（Greatest Common Divisor）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************
ll gcd(ll a, ll b)
{
	ll tmp, r;
	if (a<b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	/* ユークリッドの互除法 */
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
	//// 引数に０がある場合は０を返す
	//if ((0 == m) || (0 == n))
	//	return 0;

	//// ユークリッドの方法
	//while (m != n)
	//{
	//	if (m > n) m = m - n;
	//	else         n = n - m;
	//}
	//return m;
}//gcd
int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll x[100004] = {};
	ll y[100004] = {};
	ll z[100004] = {};
	string s;
	string s1, s2;
	//IntStack yStack;
	//charStack Stack;
	//vector<pair<int, int> > pairs(a);

	cin >> a;
	cin >> b;
	

	cout << a-b+1 << endl;



	//cout << ans << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//sort(x, x + a, std::greater<ll>());

//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得
//
//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}
//
//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

int main() {
	int n;
	while(cin >> n, n) {
		vi S(n);
		REP(i, n) {
			cin >> S[i];
		}

		int count = 0;
		while(true) {
			vi C(n, 1);
			REP(i, n) {
				FOR(j, i+1, n-1) {
					if(S[i] == S[j]) {
						C[i]++;
						C[j]++;
					}
				}
			}

			if(S == C) {
				break;
			} else {
				S = C;
				count++;
			}
		}

		cout << count << endl;
		REP(i, n) {
			cout << S[i];
			if(i != n-1) {
				cout << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1216
N = int(input())
A = list(map(int, input().split()))

A.insert(0, 0)
A.insert(N+1, 0)

total = 0
for i in range(0, N + 2):
    total += abs(A[i] - A[i-1])

anss = []

for i in range(1, N+1):
    amount = total - abs(A[i] - A[i-1]) - abs(A[i+1] - A[i]) + abs(A[i+1] - A[i-1])
    anss.append(amount)

for ans in anss:
    print(ans)


Measured memory_bytes: 14048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program {

    public static void Main() {
        string[] input = Console.ReadLine().Split(' ');
        var numP = int.Parse(input[0]);
        var numQ = int.Parse(input[1]);
        var numR = int.Parse(input[2]);

        var intList = new List<int>();
        intList.Add(numP);
        intList.Add(numQ);
        intList.Add(numR);
        intList.Remove(intList.Max());

        Console.WriteLine(intList.Sum());
    }
}


Measured memory_bytes: 13152
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

int n;
int m;

typedef pair<int,int> P;

struct edge
{
	int to;
	bool used;
	int id;
};

vector<edge> edges[100010];

int main()
{
	cin >> n >> m;
	int id_c = 1;
	for(int i = 0;i < m;i++)
	{
		int a,b;
		cin >>a >> b;
		edges[a].push_back({b,false,id_c});
		id_c++;
		edges[b].push_back({a,false,id_c});
		id_c++;
	}
	vector<bool> vis(n + 1,false);
	vector<int> cou(n + 1,0);
	for(int i = 1;i <= n;i++)
	{
		if(vis[i] == false)
		{
		queue<P> que;
		que.push(P(i,-1));
		cou[i]--;

		while(!que.empty())
		{
			int v = que.front().first;
			int id = que.front().second;
			que.pop();
			cou[v]++;
			vis[i] == true;
			for(auto& e : edges[v])
			{
				if(e.id != id && e.used == false)
				{
					e.used = true;
					que.push(P(e.to,e.id));
					//cout << v << "->" << e.to << endl;
				}
			}
		}
		}
	}

	for(int i = 1;i <= n;i++)
	{
		//cout << i << ":" << cou[i] << endl;
		if(cou[i] % 2 == 1)
		{
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}


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

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

int N,M;
const ll mo=1000000007;

ll dp[5050][5050];
ll p2[5050],r2[5050];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	FOR(i,M+1) dp[0][i]=1;
	
	p2[0]=r2[0]=1;
	FOR(i,5010) {
		p2[i+1]=p2[i]*2%mo;
		r2[i+1]=r2[i]*(mo+1)/2%mo;
	}
	
	
	for(i=1;i<=N;i++) {
		dp[i][0]=1;
		ll sum=0;
		for(x=1;x<=M;x++) {
			// 000111
			(dp[i][x]+=dp[i-1][x]*(x+1))%=mo;
			if(x>=2) (sum+=(x-1)*dp[i-1][x-1]%mo*p2[M-x])%=mo;
			(dp[i][x]+=sum*r2[M-x])%=mo;
			/*
			// 00111000
			for(int len=2;len<=x;len++) {
				(dp[i][x]+=dp[i-1][x-(len-1)]*p2[len-2]%mo*(x-len+1))%=mo;
			}
			*/
		}
	}
	cout<<dp[N][M]<<endl;
}


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


Measured memory_bytes: 200992
// https://atcoder.jp/contests/abc048/tasks/abc048_a

#include <iostream>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  string a, b, c, i = "";
  cin >> a >> b >> c;

  i += a[0];
  i += b[0];
  i += c[0];

  cout << i << "\n";

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back
#define PS string qqwwee;cin>>qqwwee;
typedef pair<int,int> pii;

int main() {
    int ans = 0;
    string s;
    cin >> s;
    int cur = 0;
    for(char c : s) {
        if(c == 'R') ++cur;
        else cur = 0;
        ans = max(ans, cur);
    }
    cout << ans << endl;
}



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

int main() {
  int n, q;
  cin >> n >> q;
  vector<vector<int> > v(n);
  for (int i = 0; i < q; i++) {
    int cmd;
    cin >> cmd;
    if (cmd == 0) {
      int t, x;
      cin >> t >> x;
      v.at(t).push_back(x);
    }
    if (cmd == 1) {
      int t;
      cin >> t;
      if (v.at(t).empty()) {
        cout << endl;
      } else {
        for (int j = 0; j < v.at(t).size(); j++) {
          if (j == v.at(t).size() - 1) {
            cout << v.at(t).at(j) << endl;
          } else {
            cout << v.at(t).at(j) << " ";
          }
        }
      }
    }
    if (cmd == 2) {
      int t;
      cin >> t;
      if (!v.at(t).empty())
      v.at(t).clear();
    }
  }
}


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

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

    if (k % 2 == 1) {
        cout << (n / k) * (n / k) * (n / k) << endl;
    } else {
        cout << (n / k) * (n / k) * (n / k) + ((n + k / 2) / k) * ((n + k / 2) / k) * ((n + k / 2) / k) << endl;
    }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,T=map(int,input().split())
    AB=[tuple(map(int,input().split())) for _ in range(n)]
    AB.sort()

    dp=[0]*T
    ans=-INF
    for i in range(n):
        a,b=AB[i]
        ndp=dp[:]
        for t in range(T):
            if(t+a<T):
                ndp[t+a]=max(ndp[t+a],dp[t]+b)
            else:
                ans=max(ans,dp[t]+b)
        dp=ndp
    print(max(ans,max(dp)))
resolve()

Measured memory_bytes: 43228
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		sc.close();
		if(A * B * C == 175) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 23252
import sys
from collections import Counter

n = int(input())
s_list = [input() for i in range(n)]
s_cntr = Counter(s_list)
m = int(input())
t_list = [input() for i in range(m)]
t_cntr = Counter(t_list)
ans = 0


for k in dict(s_cntr).keys():
    if k in dict(t_cntr).keys():
        tmp = s_cntr[k] - t_cntr[k]
    else:
        tmp = s_cntr[k]
    if ans < tmp:
        ans = tmp

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <queue>
#define ll long long int
#define inf 3e18+1
#define all(v) (v).begin(),(v).end() 
#define N 200005
#define F first
#define S second
using namespace std;
ll mod=1e9+7;
int main()
{
    // added the two lines below 
    ios_base::sync_with_stdio (false); 
    cin.tie(NULL);
    cout.tie(0);    
    ll test=1;//cin>>test;
    while(test--){
        ll n;
        cin>>n;
        ll ans=0;
        for(int i=1;i<n;i++) {
            ans+=(n-1)/i;
        }
        cout<<ans<<endl;
    }
    return 0;
}




Measured memory_bytes: 3548
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
    public static void main (String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        StringBuffer sb = new StringBuffer();
        int a = Integer.parseInt(sc.nextLine());
        //String x =sc.nextLine();
        ArrayList<String> array = new ArrayList<String>();
        String[] str ={"S","H","C","D"};

        for(int i=0;i<str.length;i++){
        	for(int b=1;b<=13;b++){
        	array.add(str[i]+" "+ b);
        	}
        }
        for(int i=0;i<a;i++){
        	String x =sc.nextLine();
            array.remove(x);
        }

        for(int i=0;i<array.size();i++){
            System.out.println(array.get(i));
        }
        }


    }

Measured memory_bytes: 26124
import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
n=N()
import collections
from bisect import bisect, bisect_left, bisect_right

sei=[collections.defaultdict(list) for i in range(4)]
hu=[collections.defaultdict(list) for i in range(4)]
ziku=[collections.defaultdict(list) for i in range(4)]
s={"U":0 ,"R":1,"D":2,"L":3}
for i in range(n):
    x,y,u=input().split()
    x,y=int(x),int(y)
    t=s[u]
    
    sei[t][x-y].append(x)
    hu[t][x+y].append(x)
    if t%2==1:
        ziku[t][y].append(x)
    else:
        ziku[t][x].append(y)
def f(l,x):
    for i in l[x].keys():
        l[x][i].sort()
f(ziku,2)
f(ziku,3)
INF=float("inf")
ans=INF
def solve(l,x):
    ans=INF
    for k,v in l[x].items():
        if k in l[x^2]:
            for j in v:
                tmp=bisect(l[x^2][k],j)
                if tmp!=len(l[x^2][k]):
                    ans=min(ans,(l[x^2][k][tmp]-j)*5)
    return ans

ans=min(ans,solve(ziku,0))
ans=min(ans,solve(ziku,1))
f(sei,2)
f(sei,3)
def solve2(l,x):
    ans=INF
    for k,v in l[x].items():
        if k in l[3-x]:
            for j in v:
                tmp=bisect(l[3-x][k],j)
                if tmp!=len(l[3-x][k]):
                    ans=min(ans,(l[3-x][k][tmp]-j)*10)
    return ans
ans=min(ans,solve2(sei,0))
ans=min(ans,solve2(sei,1))
def solve3(l,x):
    ans=INF
    for k,v in l[x].items():
        if k in l[x^1]:
            for j in v:
                tmp=bisect(l[x^1][k],j)
                if tmp!=len(l[x^1][k]):
                    ans=min(ans,(l[x^1][k][tmp]-j)*10)
    return ans
f(hu,0)
f(hu,3)
ans=min(ans,solve3(hu,1))
ans=min(ans,solve3(hu,2))
if ans==INF:
    print("SAFE")
else:
    print(ans)

Measured memory_bytes: 185640
#include <bits/stdc++.h>
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define ll long long
#define mp make_pair
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i - - )
#define eps 1e - 9
#define all(x) (x).begin(), (x).end()
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == ' - ') f =  - 1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
int suma[200010], sumb[200010], n, x,y,X,Y;
char a[200010], b[200010];
int main()
{
    scanf("%s%s", a + 1, b + 1);
    for (int i = 1; a[i]; i ++) suma[i] = suma[i - 1] + a[i] - 'A' + 1;
    for (int i = 1; b[i]; i ++) sumb[i] = sumb[i - 1] + b[i] - 'A' + 1;
    scanf("%d",&n);
    while(n --)
    {
        scanf("%d%d%d%d", &x, &y, &X, &Y);
        puts((suma[y] - suma[x - 1]) % 3 == (sumb[Y] - sumb[X - 1]) % 3 ? "YES" : "NO");
    }
} 


Measured memory_bytes: 1536
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
pll dat[400010];
ll u;
void seginit(ll n){
    for(int i=0;;i++){
        ll y=pow(2,i);
        if(y>=n){
            u=y;
            break;
        }
    }
    fill(dat,dat+2*u,make_pair(-inf,-inf));
}
void add(ll n,ll x){
    ll i=n+u-1;
    dat[i]=make_pair(x,n);
    while(i>0){
        i=(i-1)/2;
        dat[i]=max(dat[2*i+1],dat[i*2+2]);
    }
}
pll que(ll a,ll b,ll k,ll l,ll r){
    if(a>=r||b<=l)return make_pair(-inf,-inf);
    if(a<=l&&b>=r)return dat[k];
    pll m1=que(a,b,2*k+1,l,(l+r)/2);
    pll m2=que(a,b,2*k+2,(l+r)/2,r);
    return max(m1,m2);
}
int main(){
    int n,m;cin>>n>>m;
    ll a[n],b[n];
    vector<ll> v[100001];
    rep(i,0,n){
        cin>>a[i]>>b[i];
        v[a[i]].push_back(b[i]);
    }
    rep(i,0,100001)sort(v[i].begin(),v[i].end(),greater<ll>());
    seginit(100002);
    int now[100001];
    rep(i,1,100001){
        now[i]=0;
        if(v[i].size()==0)continue;
        add(i,v[i][0]);
    }
    ll ans=0;
    rep(i,1,m+1){
        pll p=que(0,i+1,0,0,u);
        //cout<<p.first<<" "<<p.second<<endl;
        if(p.first<0)continue;
        ans+=p.first;
        int num=p.second;
        //cout<<p.second<<" ";
        now[p.second]++;
        if(now[p.second]==v[p.second].size())add(p.second,-inf);
        else add(p.second,v[p.second][now[p.second]]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 13748
import java.math.BigInteger

private class C {
    fun solve() {
        val str = nextToken()
        val lastChar = str.last()
        var ans = -1
        if (lastChar == '1' || lastChar == '3' || lastChar == '7' || lastChar == '9') {
            val x = str.toLong()
            var current = 0L
            for (i in 1..9) {
                if ((x * i) % 10 == 7L) {
                    current = x * i
                    break
                }
            }
            ans = 0
            while (current != 0L) {
                while (current % 10 == 7L) {
                    current /= 10
                    ans++
                }
                if (current == 0L) {
                    break
                }
                for (i in 1..9) {
                    if ((current + x * i) % 10 == 7L) {
                        current += x * i
                        break
                    }
                }
            }
        }
        println(ans)
    }

    var tokenBuffer = listOf<String>()
    var bufferPosition = 0

    private fun checkBuffer() {
        if (bufferPosition == tokenBuffer.size) {
            tokenBuffer = nextLine().split(" ")
            bufferPosition = 0
        }
    }

    fun nextLine() = readLine()!!
    fun nextInt(): Int {
        checkBuffer()
        return tokenBuffer[bufferPosition++].toInt()
    }

    fun nextLong(): Long {
        checkBuffer()
        return tokenBuffer[bufferPosition++].toLong()
    }

    fun nextDouble(): Double {
        checkBuffer()
        return tokenBuffer[bufferPosition++].toDouble()
    }

    fun nextToken(): String {
        checkBuffer()
        return tokenBuffer[bufferPosition++]
    }
}

fun main() {
    val reader = C().solve()

}


Measured memory_bytes: 36560
n,m = map(int,input().split())
x = list(map(int,input().split()))

x=sorted(x)

diff = [0]*(m-1)
for i in range(0,m-1):
  diff[i]=x[i+1]-x[i]
#print(diff)
diff = sorted(diff,reverse=True)
#print(diff)

ans =sum(diff)
for i in range(min(n-1,m-1)):
  ans = ans - diff[i]
print(ans)

Measured memory_bytes: 13968
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
using vi = vector<int>; using vvi = vector<vi>;
const ll MOD = 1e9+7; ll INF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0}; vi d4y = {0, 1, 0, -1};
//---------------------------------------

int main(){
    int n;
    string s;
    cin>>n>>s;
    bool ok=true;
    if(s.size()%2==1){
        ok=false;
    }else{
        string half;
        rep(i,s.size()/2){
            half+=s[i];
        }
        if((half+half)!=s){
            ok=false;
        }
    }
    cout<<(ok==true ? "Yes" : "No")<<endl;

}

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

int main()
{
  int N, D;
  int x[11][11];
  int res=0;
  cin >> N >> D;

  rep(i,N){
    rep(j,D){
      cin >> x[i][j];
    }
  }

  for(int i=0;i<N-1;i++){
    #if 0
    cout << "===" << i << "===" << endl;
    #endif
    for(int j=i+1;j<N;j++){
      int dist=0;
      for(int k=0;k<D;k++){
        int d = x[i][k]-x[j][k];
        dist+= d*d;
      }
      #if 0
      cout << dist << endl;
      #endif
      for(int j=1;j<=4000;j++){
        if(j*j==dist){
          res+= 1;
          break;
        }
      }
    }
  }
  cout << res << endl;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<cstdio>
#include<cstring>
#include<vector>
#define N 201
vector<int>G[N];
int n,m,low[N],dfn[N];
bool is_cut[N];
int father[N];
int tim=0;
int a,b;
void input()
{
    scanf("%d%d",&n,&m);
    int a,b;
    for(int i=1;i<=m;++i)
    {
        scanf("%d%d",&a,&b);
        G[a].push_back(b);/*ÁÚ½Ó±í´¢´æÎÞÏò±ß*/
        G[b].push_back(a);
    }
}
void Tarjan(int i,int Father)
{
    father[i]=Father;/*¼ÇÂ¼Ã¿Ò»¸öµãµÄ¸¸Ç×*/
    dfn[i]=low[i]=tim++;
    for(int j=0;j<G[i].size();++j)
    {
        int k=G[i][j];
        if(dfn[k]==-1)
        {
            Tarjan(k,i);
            low[i]=min(low[i],low[k]);
        }
        else if(Father!=k)/*¼ÙÈçkÊÇiµÄ¸¸Ç×µÄ»°£¬ÄÇÃ´Õâ¾ÍÊÇÎÞÏò±ßÖÐµÄÖØ±ß£¬ÓÐÖØ±ßÄÇÃ´Ò»¶¨²»ÊÇÇÅ*/
            low[i]=min(low[i],dfn[k]);//dfn[k]¿ÉÄÜ£¡=low[k]£¬ËùÒÔ²»ÄÜÓÃlow[k]´úÌædfn[k],·ñÔò»áÉÏ·­¹ýÍ·ÁË¡£
    }
}
void count()
{
    int rootson=0;
    Tarjan(1,0);
    for(int i=2;i<=n;++i)
    {
        int v=father[i];
        if(v==1)
        rootson++;/*Í³¼Æ¸ù½Úµã×ÓÊ÷µÄ¸öÊý£¬¸ù½ÚµãµÄ×ÓÊ÷¸öÊý>=2,¾ÍÊÇ¸îµã*/
        else{
            if(low[i]>=dfn[v])/*¸îµãµÄÌõ¼þ*/
            is_cut[v]=true;
        }
    }
    if(rootson>1)
    is_cut[1]=true;
    int re=0;
    for(int i=1;i<=n;++i)
    {
        int v=father[i];
        if(v>0&&low[i]>dfn[v])
        re++;
    }
    printf("%d\n",re);
}
int main()
{
 
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;++i)
    {
        scanf("%d%d",&a,&b);
        G[a].push_back(b);
        G[b].push_back(a);
    }
    memset(dfn,-1,sizeof(dfn));
    memset(father,0,sizeof(father));
    memset(low,-1,sizeof(low));
    memset(is_cut,false,sizeof(is_cut));
    count();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

int dp[10005];
int N;
int M;
int a[15];
int cost[15] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
string ans;

int rec(int n){
    if (dp[n] != -1) return dp[n];
    int ma = -2;
    for (int i = 0; i < M; i++){
        if (n-cost[a[i]] >= 0) ma = max(ma, rec(n-cost[a[i]]));
    }
    if (ma == -2) return dp[n] = ma;
    else return dp[n] = ma+1;
}

int bt(int n){
    int ma = -2;
    for (int i = 0; i < M; i++){
        if (n-cost[a[i]] >= 0) ma = max(ma, rec(n-cost[a[i]]));
    }
    for (int i = M-1; i >= 0; i--){
        if (n-cost[a[i]] >= 0 && ma == dp[n-cost[a[i]]]){
            ans.push_back('0' + a[i]);
            bt(n-cost[a[i]]);
            break;
        }
    }
    return 0;
}

int main(){
    cin.tie(0);
    memset(dp, -1, sizeof(dp));
    dp[0] = 0;
    cin >> N >> M;
    for (int i = 0; i < M; i++){
        cin >> a[i];
    }
    sort(a, a+M);
    bt(N);
    cout << ans << endl;

}


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

int ds[3] = {5,9,13};
int dx[13] = { 0,-1, 0, 1, 0,-1, 1,-1, 1, 0,-2, 2, 0};
int dy[13] = {-1, 0, 0, 0, 1,-1,-1, 1, 1,-2, 0, 0, 2};

int main() {

  int x,y,size;
  char c;
  int map[14][14] = {0};

  int cnt = 0;
  int map_max = 0;

  while( cin >> x >> c >> y >> c >> size ) {

    for ( int i = 0; i < ds[size-1]; i++ ) {

      map[ x+2 + dx[i] ][ y+2 + dy[i] ]++;

    }

  }

  for ( int i = 2; i < 12; i++ ) {
    for ( int j = 2; j < 12; j++ ) {
      
      if ( map[i][j] == 0 ) cnt++;
      map_max = max( map_max, map[i][j] );
      
    }
  }

  cout << cnt << endl << map_max << endl;

  return 0;

}

Measured memory_bytes: 1160
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,m = map(int,ipt().split())
    way = [[] for _ in [0]*n]
    for i in range(m):
        a,b = map(int,ipt().split())
        way[a-1].append((b-1,i))
        way[b-1].append((a-1,i))
    ans = 0
    q = queue.Queue()
    for i in range(m):
        al = [-1 for i in range(n)]
        q.put(0)
        al[0] = 0
        while not q.empty():
            qi = q.get()
            for j,wn in way[qi]:
                if wn == i or al[j] == 0:
                    continue
                else:
                    al[j] = 0
                    q.put(j)
        if -1 in al:
            ans += 1

    print(ans)

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 46440
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

int main(){
  int N, K, S; cin >> N >> K >> S;
  int A[N];
  if (S != 1e9){
    fill(A, A + N, 1e9);
  }else{
    fill(A, A + N, 1e9 - 1);
  }

  for (int i = 0; i < K; i++) A[i] = S;
  
  for (int i = 0; i < N; i++){
    cout << A[i];
    if (i == N - 1) cout << endl;
    else cout << " ";
  }

  return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
#define v_inputrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)

int main(){
    int n, k;
    cin >> n >> k;
    ll a = k * pow(k-1, n-1);
    cout << a;
}

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

int main(void) {
	int X, Y;
	scanf("%d", &X);
	scanf("%d", &Y);
	int b = (Y - 2 * X) / 2;
	bool ans = true;
	if ((Y - 2 * X) % 2 == 1) {
		ans = false;
	} else if (b > X) {
		ans = false;
	} else if (b < 0) {
		ans = false;
	}
	printf(ans ? "Yes" : "No");

	return 0;
}


Measured memory_bytes: 3228
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

def test(x):
  return x % 2 == 1 and sum(x % y == 0 for y in range(1, x+1)) == 8

S = input()
K = read() - 1
N = len(S)
i0 = next((i for i in range(N) if S[i] != '1'), N)
if K < i0:
  print(1)
else:
  print(S[i0])


Measured memory_bytes: 3828
A,B = map(int,input().split())

c = 0

for i in range(2, 41):
    a_mod = A % (2 ** i)
    b_mod = B % (2 ** i)
    if (a_mod <= (2 ** (i-1))-1) and (b_mod <= (2 ** (i-1))-1):
        c += 0
    if (a_mod <= (2 ** (i-1))-1) and (b_mod > (2 ** (i-1))-1):
        c += (2 ** i) * ((b_mod+1) % 2)
    if (a_mod > (2 ** (i-1))-1) and (b_mod <= (2 ** (i-1))-1):
        c += (2 ** i) * ((a_mod) % 2)
    if (a_mod > (2 ** (i - 1))-1) and (b_mod > (2 ** (i - 1))-1):
        c += (2 ** i) * ((a_mod+b_mod+1) % 2)

c = int(c/2)

if A % 2 == 0:
    if ((B-A) % 4 == 1) or ((B-A) % 4 == 2):
        c += 1
    else:
        c += 0
if A % 2 == 1:
    if ((B - A) % 4 == 0) or ((B - A) % 4 == 1):
        c += 1
    else:
        c += 0
print(c)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
void xin(){
	#ifndef ONLINE_JUDGE 
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}
int f[100005];


int main()
{
  	xin();
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    
    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
    {
    	cin>>a[i];
    }
    int ans =0;
    for(int i=1;i<=n;i++)
    {
    	if(i%2 != 0 && a[i]%2 != 0)
    	{
    		ans++;
    	}
    }
    cout<<ans<<endl;

 
 }

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;

vector<vector<int>> to(100000);
ll mod = 1000000007;
P dfs(int v, int p = -1){
    if(to[v].size() == 1 && to[v][0] == p){
        return make_pair(1, 1);
    }
    ll b = 1;
    ll w = 1;
    for(int t : to[v]){
        if(t == p)continue;
        P p = dfs(t, v);
        (b *= p.first) %= mod;
        (w *= (p.first + p.second)) %= mod;
    }
    return make_pair(w, b);
}

int main() {
    int n;
    cin >> n;
    rep(i, n-1){
        int x, y;
        cin >> x >> y;
        x--; y--;
        to[x].push_back(y);
        to[y].push_back(x);
    }
    P p = dfs(0);
    ll ans = (p.first + p.second) % mod;
    cout << ans << endl;
}

Measured memory_bytes: 14200
mod = 10**9 + 7
N = 200000
fact = [None] * (N+1)
fact[0] = 1
for i in range(1, N+1):
    fact[i] = fact[i-1] * i % mod

def comb(n, k):
    return fact[n] * pow(fact[k], mod-2, mod) * pow(fact[n-k], mod-2, mod) % mod

H, W, A, B = map(int, input().split())
ans = 0
for b in range(B+1, W+1):
    tmp = comb(H-A+b-2, b-1) * comb(A+W-b-1, A-1) % mod
    ans = (ans + tmp) % mod
print(ans)


Measured memory_bytes: 10868
#include<cstdio>

int main(void){
	double r, a, b;
	
	scanf("%lf", &r);
	a = r*r*3.141592653589;
	b = 2*r*3.141592653589;
	
	printf("%f %f\n",  a, b);
	
	return 0;
}

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

int main(int argc, char const *argv[]) {

    string str;
    getline(cin, str); 
    int len = str.length();
    for (int i = 0; i < len; i++) {
        if (isalpha(str[i])) {
            if (islower(str[i])) {
                str[i] = toupper(str[i]);
            } else {
                str[i] = towlower(str[i]);
            }
        }
    
    }

    cout << str << endl;



    return 0;
}



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

#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map

void doit(){
	ll n, i, x;
	cin >> n;
	set<ll>s;
	rep(i,0,n){
		cin >> x;
		s.insert(x);
	}
	if(s.size() == n)cout << "YES" << nl;
	else cout << "NO" << nl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}



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

int array[20][20];
int h, w, sx, sy;
int ans;

void out_array(void);
void input(void);
void search(int, int);

int main(){
	while(true){
		
		cin >> w >> h;
		if(w == 0 && h == 0){
			return 0;
		}

		input();
		ans = 0;
		search(sx, sy);
		cout << ans << endl;

	}
}
void out_array(void){
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			cout << array[i][j];
		}
		cout << endl;
	}
}

void input(void){
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			char c;
			cin >> c;
			
			switch(c){
				case '#':
					array[i][j] = 1;//??????
					break;
					
				case '.':
					array[i][j] = 0;//?????????
					break;
					
				case '@':
					array[i][j] = 0;
					sx = j;//????????????
					sy = i;
			}
		}
	}
}

void search(int x,int y){
	if(array[y][x] == 1 || x >= w || y >= h || x < 0 || y < 0){
		return;
	}else{
		array[y][x] = 1;
		ans++;
	}
	search(x - 1, y);
	search(x + 1, y);
	search(x, y - 1);
	search(x, y + 1);
	return;
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		if(H % h == 0 && W % w == 0){
			Console.WriteLine("No");
			return;
		}
		
		
		long b = 1000000000;
		long a = b / ( h * w - 1) - 1;
		
		long[][] M = new long[H][];
		for(int i=0;i<H;i++){
			M[i] = new long[W];
			for(int j=0;j<W;j++){
				if(i % h == h - 1 && j % w == w - 1){
					M[i][j] = - b;
				} else {
					M[i][j] = a;
				}
			}
		}
		
		Console.WriteLine("Yes");
		Console.WriteLine(String.Join("\n", M.Select(ar => String.Join(" ",ar))));
		
	}
	int H,W,h,w;
	public Sol(){
		 var d = ria();
		 H = d[0]; W = d[1]; h = d[2]; w = d[3];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 47052
// https://atcoder.jp/contests/abc152/tasks/abc152_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    int res = 0;
    vector<vector<int>> num(10, vector<int>(10));
    for (int n = 1; n <= N; ++n) {
        vector<int> d;
        int nn = n;
        while (nn) {
            d.push_back(nn % 10);
            nn /= 10;
        }
        int a = d.front();
        int b = d.back();
        if (a > 0 && b > 0) {
            num[a][b]++;
        }
    }
    for (int a = 1; a < 10; ++a) {
        for (int b = 1; b < 10; ++b) {
            res += num[a][b] * num[b][a];
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

const int MOD = 1e9 + 7;
int a, b;

int main() {
  cin >> a >> b;
  int abs = a - b;
  if (abs < 0) {
    abs = -abs;
  }
  if (abs % 2 != 0) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }

  cout << (a + b) /2 << endl;

}


Measured memory_bytes: 256
n = gets.to_i
s = gets.chomp.bytes
dot = '.'.ord
a = Array.new(n){Array.new(2, 0)}
if s[0] == dot
  a[0][0] = 1
else
  a[0][1] = 1
end
1.upto(n - 1) do |i|
  if s[i] == dot
    a[i][0] = a[i - 1][0] + 1
    a[i][1] = a[i - 1][1]
  else
    a[i][0] = a[i - 1][0]
    a[i][1] = a[i - 1][1] + 1
  end
end
min = [a[-1][0], a[-1][1]].min
n.times do |i|
  min = a[-1][0] - a[i][0] + a[i][1] if min > a[-1][0] - a[i][0] + a[i][1]
end
puts min

Measured memory_bytes: 16208
#include<iostream>

using namespace std;

int main(){
  int e;
  int minimum = 10000000, n= 0;
  while(1){
    minimum = 10000000;
    cin >> e;
    if(e == 0) break;
    for(int i = 0; i<101; i++){
      for(int j = 0; j<1001; j++){
	n = e - i*i*i -j * j;
	if(n+ i+ j < minimum && n>= 0) minimum = n+ i+ j;
      }
    }
    cout << minimum << endl;
  }
  return 0;
}
      

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    int K;
    cin >> n >> s >> K;
    K--;
    char tar = s[K];
    for (char& c : s) {
        c = (c == tar ? c : '*');
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;
#define lol long long
int main()
{
	int K, S;
	cin >> K >> S;
	lol ans = 0;
	for (int x = 0; x <= K; x++) {
		for (int y = 0; y <= K; y++) {
			int z = S - x - y;
			if (0 <= z && z <= K) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) = yorukatsu21c()

fun yorukatsu21c() {
    val n = readLine()!!.toInt()
    val lList = readLine()!!.split(' ').map { it.toLong() }.sorted().toLongArray()

    var answer = 0L

    for (i in 0 until n) {
        for (j in i + 1 until n) {
            val ci = lowerBound(lList, lList[i] + lList[j])
            if (ci > j) answer += ci - j - 1
        }
    }

    println(answer)
}

private fun lowerBound(list: LongArray, key: Long): Int {
    var ng = -1
    var ok = list.size

    while (ok - ng > 1) {
        val mid = (ok + ng) / 2
        if (list[mid] >= key) ok = mid else ng = mid
    }
    return ok
}


Measured memory_bytes: 36292