akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
 
 
public class Main {

	static long MOD = 1_000_000_007;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//int N = Integer.parseInt(sc.next());
		//long L = Long.parseLong(sc.next());
		//char[] c = sc.next().toCharArray();
		//int INF = Integer.MAX_VALUE;
		int ans;
		Scanner sc = new Scanner(System.in);
		int P = Integer.parseInt(sc.next());
		int Q = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		if(P<=Q){
			if(Q<=R){
				ans = P+Q;
			}else{
				ans = P+R;
			}
		}else{
			if(P<=R){
				ans = Q + P;
			}else{
				ans = Q+R;
			}
			
		}
		
		System.out.println(ans);
		
	}
	
	
}



Measured memory_bytes: 23380
#include <stdio.h>
#define N 100
#define INF (1 << 21)


int Matrix_Chain_Order(int, int []);

int main(void){

  int i, j = 0;
  int x[N], y[N];
  int data[N+1];
  int min;
  int num;

  scanf("%d",&num);
  
  for(i = 0;i < num;i++)
    scanf("%d %d",&x[i], &y[i]);
  
  
  data[0] = x[0];
  for(i = 1;i <= num;i++)
    data[i] = y[j++];

  //data[0]にx[0]が入っているため配列が１つ多くなっている。
  /*
  for(i = 0;i < num + 1;i++)
    printf("%d ",data[i]);
  */

  min = Matrix_Chain_Order(num, data);
  
  printf("%d\n",min);  
  return 0;
}

int Matrix_Chain_Order(int num, int p[]){
  int n = num;
  int q;
  int l, k;
  int i, j;
  int m[n+1][n+1];

  for(i = 1;i <= n;i++)
    m[i][i] = 0;

  for(l = 2;l <= n;l++){
    for(i = 1;i <= n - l + 1;i++){
      j = i + l - 1;
      m[i][j] = INF;
      for(k = i;k <= j - 1;k++){
	q = m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j];
	if(m[i][j] > q)
	  m[i][j] = q;
      }
    }
  }

  return m[i-1][j];
}

Measured memory_bytes: 632
class Array
	def accum
		inject([0]){|a, x| a + [a[-1] + x]}
	end

	def accum!
		(1..size-1).each{|i|
			self[i] += self[i-1]
		}
		self.unshift(0)
	end

	def accum_2d
		ac = map{|r| r.accum}
		(1..size-1).each{|i|
			(1..ac[0].size-1).each{|j|
				ac[i][j] += ac[i-1][j]
			}
		}
		ac.unshift([0] * ac[0].size)
		ac
	end

	def accum_2d!
		each{|r| r.accum!}
		(1..size-1).each{|i|
			(1..self[0].size-1).each{|j|
				self[i][j] += self[i-1][j]
			}
		}
		unshift([0] * self[0].size)
	end
		
	def bsearch_first_index(l = 0, r = size - 1, &pred)
		return nil if l > r
		c = (l + r) / 2 
		if pred[self[c]]
			bsearch_first_index(l, c-1, &pred) || c
		else
			bsearch_first_index(c+1, r, &pred)
		end
	end

	def bsearch_first_item(l = 0, r = size - 1, &pred)
		i = bsearch_first_index(l, r, &pred)
		i ? self[i] : nil
	end

	def bsearch_last_index(l = 0, r = size - 1, &pred)
		return nil if l > r
		c = (l + r) / 2 
		if pred[self[c]]
			bsearch_last_index(c+1, r, &pred) || c
		else
			bsearch_last_index(l, c-1, &pred)
		end
	end

	def bsearch_last_item(l = 0, r = size - 1, &pred)
		i = bsearch_last_index(l, r, &pred)
		i ? self[i] : nil
	end
end

require 'set'

hash = {}
(1..200).each{|h|
	(h+1..200).each{|w|
		r2 = h*h + w*w
		(hash[r2] ||= Set.new) << h
	}
}

a = hash.map{|k, set| [k, set.to_a.sort]}.sort_by(&:first)

loop {
	h, w = gets.split.map &:to_i
	break if h == 0
	i = a.index{|r2, _| r2 == h*h + w*w}
	r2 = h*h + w*w
	b = a[i][1]
	x = b.find{|x| x > h}
	if !x
		r2 = a[i+1][0]
		x = a[i+1][1][0] 
	end
	puts "#{x} #{Math.sqrt(r2-x*x).to_i}"
}

Measured memory_bytes: 14832
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
string s;

int main(){
  cin >> s;
  string t = s;
  t = t.substr(2,t.size() - 3);
  int M = 0;
  for(char c : s){
    if('a' <= c && c <= 'z'){
      M++;
    }
  }
  if(s.front() == 'A' && count(all(t),'C') == 1 && M == s.size() - 2){
    cout << "AC" << endl;
  }
  else{
    cout << "WA" << endl;
  }
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int factorize(int n){
	set<int> res; res.clear();
	for (int p = 2; p <= n; ++p){
		if (n % p == 0){
			res.insert(p);
			res.insert(n/p);
		} // end if
	} // end for

	return (int)res.size();
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int N; cin >> N;

	int res = 0;
	for (int i = 1; i <= N; i+= 2){
		int ans = factorize(i);
//		cerr << "i: " << i << " ans: " << ans << endl;
		if (ans == 8){
			++res;
		} // end if
	} // end for

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl;
#define pno cout << "no" << endl;
#define pYe cout << "Yes" << endl;
#define pNo cout << "No" << endl;
#define pYE cout << "YES" << endl;
#define pNO cout << "NO" << endl;
#define prin(num) cout << num << endl;
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000
#define MOD 1000000007LL
#define MAX 200005
#define NIL -1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll gcd(ll a, ll b) {
    if(b==0) return a;
    return gcd(b, a%b);
}

int main(void) {
    ll N, X, x[100000];
    cin >> N >> X;
    ll i;
    for(i=0; i<N; i++) {
        cin >> x[i];
    }
    
    if(N==1) {
        prin(abs(x[0]-X));
        return 0;
    }
    
    ll ans=gcd(abs(x[0]-X), abs(x[1]-X));
    
    for(i=2; i<N; i++) {
        ans=gcd(ans, abs(x[i]-X));
    }
    
    prin(ans)
}


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

int main() {
  int h,w; cin>>h>>w;
  vector<vector<int>> c(10, vector<int>(10));
  vector<vector<int>> a(h, vector<int>(w));
  rep(i, 10) rep(j, 10) cin>>c[i][j];
  rep(i, h) rep(j, w) cin>>a[i][j];

  rep(k, 10) {
    rep(i, 10) {
      rep(j, 10) {
        c[i][j]=min(c[i][j], c[i][k]+c[k][j]);
      }
    }
  }
  ll ans=0;
  rep(i, h) {
    rep(j, w) {
      if (a[i][j]==-1) continue;
      ans+=c[a[i][j]][1];
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        int count=0;
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        if(N<105)count=0;
        else if(N<135) count=1;
        else if(N<165)count=2;
        else if(N<189)count=3;
        else if(N<195)count=4;
        else count=5;
        System.out.println(count);
    }
}

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

int n;
long long ans;
string a,z;
map<pair<string,string>,int> M;

void dfs(int i,int j,string x,string y)
{
	if(i>j)
	{
		z="";
		for(int i=x.size()-1;i>=0;i--)z+=x[i];
		x=z,z="";
		for(int i=y.size()-1;i>=0;i--)z+=y[i];
		y=z;
		M[make_pair(x,y)]++;
		return ;
	}
	dfs(i+1,j,x+a[i],y);
	dfs(i+1,j,x,y+a[i]);
}

void dfs2(int i,int j,string x,string y)
{
	if(i>j)
	{
		ans+=M[make_pair(x,y)];
		return ;
	}
	dfs2(i+1,j,x+a[i],y);
	dfs2(i+1,j,x,y+a[i]);
}

int main()
{
	cin>>n>>a;
	dfs(0,n-1,"","");
	dfs2(n,n*2-1,"","");
	cout<<ans;
	return 0;
}


Measured memory_bytes: 89856
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
a = []
b = []
for i in ab:
    if i[0] == 1:
        b.append(i[1])
    elif i[1] == n:
        a.append(i[0])
if len(set(a) & set(b)):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

template <const ll M>
class mint {
   private:
    ll x;

   public:
    constexpr mint(ll x = 0) : x((x % M + M) % M) {}
    constexpr ll value() { return x; }
    constexpr mint operator-() const { return mint(-x); }
    constexpr mint &operator+=(const mint &a) {
        if ((x += a.x) >= M) x -= M;
        return *this;
    }
    constexpr mint &operator-=(const mint &a) {
        if ((x += M - a.x) >= M) x -= M;
        return *this;
    }
    constexpr mint &operator*=(const mint &a) {
        (x *= a.x) %= M;
        return *this;
    }
    constexpr mint &operator/=(const mint &a) { return (*this) *= a.inv(); }
    constexpr mint operator+(const mint &a) const {
        mint res(*this);
        return res += a;
    }
    constexpr mint operator-(const mint &a) const {
        mint res(*this);
        return res -= a;
    }
    constexpr mint operator*(const mint &a) const {
        mint res(*this);
        return res *= a;
    }
    constexpr mint operator/(const mint &a) const {
        mint res(*this);
        return res /= a;
    }
    constexpr mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    constexpr mint inv() const { return pow(M - 2); }
    constexpr bool operator==(const mint &a) const { return x == a.x; }
    constexpr bool operator!=(const mint &a) const { return x != a.x; }
    friend istream &operator>>(istream &in, mint &a) {
        in >> a.x;
        if (a.x < 0) a.x += M;
        a.x %= M;
        return in;
    }
    friend ostream &operator<<(ostream &out, const mint &a) {
        out << a.x;
        return out;
    }
};

int main() {
    ll N;
    cin >> N;
    vector<mint<1000000007>> A(N);
    vector<mint<1000000007>> S(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    S[0] = A[0];
    for (int i = 1; i < N; i++) S[i] = S[i - 1] + A[i];
    mint<1000000007> ans = 0;
    for (int i = 0; i < N - 1; i++) {
        ans += A[i] * (S[N - 1] - S[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6416
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define mp make_pair
ll mod = 1000000007;
ll mod2 = 998244353;

int main(){
	ll a;cin>>a;
    string b;cin>>b;
    b.erase(1,1);
    ll ans = a*stoi(b);
    cout<<ans/100<<endl;
}

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

using namespace std;

int main()
{
    int x,y,z,c,d;
    cin>>x>>y>>z;
    c=x;
    x=y;
    y=c;
    d=x;
    x=z;
    z=d;
    cout<<x<<" "<<y<<" "<<z;


    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define p pair<ll,ll>
#define IOS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
ll mod= 1e9+7;
ll a[200005];
void init()
{
     a[1]=1;
     for(int i=2;i<=200000;i++)
      {
           a[i] = a[i-1]+i ;
      }
}
int main()
{     
    //   init();
    // ll n,k;
    // cin>>n>>k;
    // ll ans=0;
    // for(int i=k;i<=n+1;i++)
    //   {   if(i==n+1){ans++;continue;}
    //      ans+=  ( a[n]-a[n-i] -a[i-1] +1   )%mod;

    //   }
    // cout<<ans%mod<<endl;
    long double a,b,c,d;cin>>a>>b>>c>>d;
    ll num1=ceil(c/b ),num2=ceil(a/d);
    if(num1<=num2) cout<<"Yes";
    else cout<<"No";

    
    return 0;
}



Measured memory_bytes: 3728
#include<iostream>
using namespace std;
int main()
{
  int h, w ;
  while(1){
  cin >> h >> w ;
  if(h==0 && w==0) return 0;
  for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
          if(i==0 || i==(h-1) || j==0 || j==(w-1)){
          cout << "#" ;
          }else{
          cout << "." ;
          }
      }
        cout << "\n" ;
  }
        cout << "\n" ;
  }
 return 0;  

}



Measured memory_bytes: 3076
INF=1<<30
N = int(input())
t = [int(_) for _ in input().split()]
st=[0]*(N+1)
for i in range(N):
    st[i+1]=t[i]+st[i] # st[i] i番目の区間の終了時刻、ただし0番目の区間は時刻0に終了したものとする
T=st[N]
st.append(T)
v = [int(_) for _ in input().split()] # i番目の区間の制限速度
v.insert(0,0)
v.append(0)
l =[0]

now=0.5
ind = 1 # 現在いる区間の番号

while now < T:
    v1=INF
    v2=INF
    for j in range(ind):
        v1=min(v1,v[j]+now-st[j])
    for j in range(ind,N+1):
        v2=min(v2,v[j+1]-now+st[j])
    l.append(min(v[ind],v1,v2))
    now+=0.5
    if now>=st[ind]:
        ind+=1

l.append(0)
res=0

for i in range(len(l)):
    res+=l[i]/2

print(res)
    

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

using namespace std;

int convert[26];
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	string s,t;
	int n;

	cin >> s;
	cin >> t;

	n = s.length();

	memset(convert,-1,sizeof(convert));

	for(int i=0;i<n;i++)
	{
		int x = s[i] - 'a';
		int y = t[i] - 'a';

		if(convert[x]==-1)
		{
			convert[x] = y;
		}
		else
		{
			if(convert[x]!=y)
			{
				cout << "No" << '\n';
				return 0;
			}
		}
	}

	memset(convert,-1,sizeof(convert));

	for(int i=0;i<n;i++)
	{
		int x = s[i] - 'a';
		int y = t[i] - 'a';

		if(convert[y]==-1)
		{
			convert[y] = x;
		}
		else
		{
			if(convert[y]!=x)
			{
				cout << "No" << '\n';
				return 0;
			}
		}
	}
	cout << "Yes" << '\n';
	return 0;
}

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    stack<char> st;

    for (int i = 0; i < N; i++) {
        if (st.empty()) {
            st.push(S[i]);
        } else {
            if (st.top() != S[i]) {
                st.push(S[i]);
            }
        }
    }

    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define lld long long

int main(){
    int N,M;
    int num[100];
    bool flg = false;
    for(int i=0;i<100;i++){
        num[i] = -1;
    }
    cin >> N >> M;
    for(int i=0;i<M;i++){
        int s,c;
        cin >> s >> c;
        if(num[s] != -1 && num[s] != c){
            flg = true;
        } else {
            num[s] = c;
        }
    }
    if(flg == true){
        cout << "-1" << endl;
    } else if(N > 1 && num[1] == 0) {
        cout << "-1" << endl;
    } else {
        for(int i=1;i<=N;i++){
            if(num[i] == -1){
                if(i == 1 && N > 1) num[i] = 1;
                else num[i] = 0;
            }
            cout << num[i];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
use std::io::Read;
use std::cmp;


fn main() {
    let mut buf = String::new();

    // 標準入力から全部bufに読み込む
    std::io::stdin().read_to_string(&mut buf).unwrap();

    // 読み込んだStringを空白で分解する
    let mut iter = buf.split_whitespace();

    let N: i64 = iter.next().unwrap().parse().unwrap();
    let mut a: Vec<(i64)> = (0..N+1)
        .map(|_| { iter.next().unwrap().parse().unwrap() })
        .collect();
    let mut b: Vec<(i64)> = (0..N)
        .map(|_| { iter.next().unwrap().parse().unwrap() })
        .collect();

    let mut ans: i64 = 0;
    for i in 0..N {
        let j = i as usize;
        let t = cmp::min(a[j], b[j]);
        a[j] -= t;
        b[j] -= t;
        ans += t;

        let t = cmp::min(a[j+1], b[j]);
        a[j+1] -= t;
        b[j] -= t;
        ans += t;
    }
    println!("{}", ans)
}



Measured memory_bytes: 10232
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;


int main() {
	int N;
	cin >> N;
	int A = 0;
	int B = 0;
	int C = 0;
	int D = 0;

	vector<string>S(N);
	for (int i = 0; i < N; i++) {
		cin >> S.at(i);
		if (S.at(i) == "AC") {
			A++;
		}
		else if (S.at(i) == "WA") {
			B++;
		}
		else if (S.at(i) == "TLE") {
			C++;
		}
		else {
			D++;
		}
	}
	cout << "AC" << " " << "x" << " " << A << endl;
	cout << "WA" << " " << "x" << " " << B << endl;
	cout << "TLE" << " " << "x" << " " << C << endl;
	cout << "RE" << " " << "x" << " " << D << endl;
}

Measured memory_bytes: 6424
from itertools import accumulate
N, K = map(int, input().split())
A = list(map(int, input().split()))
acc = [0]
acc.extend(list(accumulate(A)))
#print(acc)
scores = []
for i in range(K, N + 1):
  scores.append(acc[i] - acc[i - K])
#print(scores)
for i in range(1, N - K + 1):
  if scores[i] > scores[i - 1]:
    print('Yes')
  else:
    print('No')
  

Measured memory_bytes: 35880
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;

using namespace std;

int main()
{
	int n,a;
	int ans=0;
	
	cin>>n;
	cin>>a;
	if(n%500<=a)
	{
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 2e5 + 10;

int n,q;
vector<int> g[N],dp(N,0);

void dfs(int u,int p=-1){
   for(auto &v : g[u]){
      if(v!=p){
         dp[v]+=dp[u];
         dfs(v,u);
      }
   }
}


int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   cin >> n >> q;
   int u,v;
   f(i,1,n){
      cin >> u >> v;
      g[u].pb(v);
      g[v].pb(u);
   }
   while(q--){
      int x,p;
      cin >> p >> x;
      dp[p] += x;
   }
   dfs(1);
   f(i,1,n+1){
      cout << dp[i] << ' ';
   }
   return 0;
} 

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

int main(){
    
    int maxi = 0;
    int a, b, c1[5555], c2[5555];
    
    cin >> a >> b;
    for(int i = 0; i < a; i++) cin >> c1[i];
    for(int i = 0; i < b; i++) cin >> c2[i];
    
    int cnt = 0;
    for(int i = 0; i < b; i++){
        int idx = i;
        for(int j = 0; j < a; j++){
            if(c2[idx] == c1[j]){
                cnt++; idx++;
            }
        }
        maxi = max(maxi, cnt);
        cnt = 0;
    }
    cout << maxi << endl;
    
}

Measured memory_bytes: 1204
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int Menu[] = new int[5];
        int min = 9; 
        int last = 0; 
        int i = 0;
        int count = 0; 
		// 数の入力
		for(i = 0;i < 5;i++){
          Menu[i] = sc.nextInt();
          if(Menu[i] % 10 <= min && Menu[i] % 10 != 0 ){
            min = Menu[i] % 10;
            last = i;
          }
        }
      	for(i = 0;i < 5;i++){
          if(i != last){
            if(Menu[i] % 10 == 0){
              count += Menu[i]; 
            }else{
              count += (Menu[i] / 10 + 1) * 10;
            }
          }
        }
		count += Menu[last];
    System.out.println(count);            
    }
}

Measured memory_bytes: 35692
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> n >> s;
	//vector<ll>	aa(256);
	//for(i=0;i<n;i++) cin >> aa[i];
	//vector<ll>	dp(n+1,INFL);
	//vector<vector<ll>>	dp2(x , vector<ll>(y,INFL));
	map<char,int> mae , ato;
	for(c=1;c<n;c++) {
		mae.clear();
		ato.clear();
		for(i=0;i<n;i++) {
			if (i<c) {
				mae[s[i]] = 1;
			} else {
				ato[s[i]] = 1;
			}
		}
		a = 0;
		for(auto p:mae) {
			if (ato.count(p.first)) a++;
		}
		ans = max(ans,a);
	}
	cout << ans << endl;
	return 0;
}


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



int main()
{
  int n;cin>>n;
  std::vector<int> c(n-1),s(n-1),f(n-1);
  for (int i = 0; i < n-1; ++i)
  {
    cin>>c[i]>>s[i]>>f[i];
  }
  for (int i = 0; i < n; ++i)
  {
    int ans=0;
    for (int j = i; j < n; ++j)
    {
      if(j==n-1) {
        cout<<ans<<endl;
        break;
      }
      if(s[j]>=ans) {
        ans=s[j]+c[j];
        continue;
      }
      if((ans-s[j])%f[j]==0){
        ans+=c[j];
        continue;
      }
      int m=ans-s[j];
      ans=s[j]+m-m%f[j]+f[j];
      ans+=c[j];
    }
  }
}

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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using db = double;
using ii = pair <int, int>;

#define int long long
#define FOR(a, b, c) for(int a = b, _c = c; a <= _c; ++a)
#define FORD(a, b, c) for(int a = b, _c = c; a >= _c; --a)
#define REP(a, b, c) for(int a = b, _ = c; a < _; ++a)
#define ALL(a, b) for(auto &a : b)
#define pb push_back
#define mp make_pair
#define all(a) begin(a), end(a)
#define reset(f, x) memset(f, x, sizeof(f))
#define fi first
#define se second
#define bit(x, i) (x >> (i - 1) & 1ll)
#define onbit(x, i) (x | (1ll << (i - 1)))
#define offbit(x, i) (x & ~(1ll << (i - 1)))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll

template <class T> void Max(T &x, T y) { x = (x > y) ? x : y;}

const int N = 105;
int n, m, a[N], v[N], dp[N][N * 1000];

main() {
  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cin >> n >> m;
  FOR(i, 1, n) cin >> a[i] >> v[i];
  reset(dp, 127);
  int oo = dp[0][0];
  dp[0][0] = 0;
  FOR(i, 0, n - 1) {
    FOR(j, 0, 1e5) {
      if(dp[i][j] != oo) {
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
        if(a[i + 1] + dp[i][j] <= m) dp[i + 1][j + v[i + 1]] = min(dp[i + 1][j + v[i + 1]], dp[i][j] + a[i + 1]);
      }
    }
  }
  int ans = 0;
  int tot = 1e5;
  while(dp[n][tot] == oo) tot--;
  cout << tot << '\n';
}


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

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

class modint {
  public:
    using ll = long long;
    ll num;
    static const ll MOD = 1e9+7;
    static vector<modint> factorial;

    modint(): num(0) {};
    modint(ll n_): num((n_ + MOD) % MOD) {}
    modint(const modint &r): num(r.num) {}
    operator ll() const { return (num+MOD)%MOD; }
    friend istream& operator>>(istream& is, modint &r){
        ll num_;
        is >> num_;
        r = num_;
        return is;
    }
    modint operator+(const modint &r) const { return modint(num + r.num); }
    modint operator-(const modint &r) const { return modint(num - r.num); }
    modint operator*(const modint &r) const { return modint(num * r.num); }

    template<typename T>
    modint operator^(const T &r) const {
        if(r == 0) return 1;
        return (((*this)*(*this)) ^ (r/2)) * modint(r&1 ? num : 1);
    }
    modint operator/(const modint &r) const { return num * (r^(MOD-2)); }

    modint operator+=(const modint &r) { return *this = *this + r; }
    modint operator-=(const modint &r) { return *this = *this - r; }
    modint operator*=(const modint &r) { return *this = *this * r; }
    modint operator/=(const modint &r) { return *this = *this / r; }

    template<typename T>
    modint operator^=(const T &r) { return *this = *this ^ r; }

    static modint pow(const modint x, ll r) {
        return x^r;
    }

    static modint fact(int n){
        if((int)factorial.size() <= n) {
            int size = factorial.size();
            factorial.resize(n+1);
            for (int i = size; i <= n; i++) {
                factorial[i] = factorial[i-1] * modint(i);
            }
        }
        return factorial[n];
    }

    static modint C(ll n,ll r){
        return n >= r ? fact(n)/(fact(n-r)*fact(r)) : modint(0);
    }
};
vector<modint> modint::factorial = {1};
#define fact(n) modint::fact(n)
#define C(n,r) modint::C(n,r)
#define H(a,b) C(a+b, a)

// -------- END : snippet -------- //

int main(void) {
    int n;
    cin >> n;
    cout << modint::pow(10,n) - modint::pow(9,n)*modint(2) + modint::pow(8,n) << endl;
    return 0;
}


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

using namespace std;

#define sp << " " <<

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s,t="keyence";
    cin >> s;
    if(s.length()<7)
        cout << "NO";
    else
    {
        int d=0,p=0;
        while(s[d]==t[d])
            d++;
        while(s[s.length()-1-p]==t[6-p])
            p++;
        if(d+p>=7)
            cout << "YES";
        else
            cout << "NO";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stdio.h>

using namespace std;

int main()
{
    int k,n;
    cin >> k >> n;
    
    std::vector<int> a;
    int first = 0;
    int last = -1;
    int tmp = 0;
    for(int i=0; i<n; i++){
        //int tmp;
        cin >> tmp;
        if(last!=-1){
           a.push_back(tmp-last);
           //cout << tmp-last << endl; 
        }else{
            first = tmp;
        }
        last = tmp;
        
    }
    a.push_back(k-tmp+first);
    //cout << k-tmp << endl; 
    std::sort(a.begin(), a.end());
    
    long long int ans = 0;
    for(int i=0; i<n-1; i++){
        ans += a[i];
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 1400
#!/usr/bin/env python

from functools import reduce
import math

# GCD and LCM are not in math module.  They are in gmpy, but these are simple enough:

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b // gcd(a, b)

N = int(input())
ts = []
for _ in range(N):
  T = int(input())
  ts.append(T)

# print(reduce(lcm, ts))
ans = 1
for i in range(N):
  ans = lcm(ans, ts[i])
print(ans)


Measured memory_bytes: 3572
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int R, C, d;
	cin >> R >> C >> d;
	string clr = "RGBY";
	for (int i = 0; i<R; ++i, puts(""))
		for (int j = 0; j < C; ++j) {
			int a = (i - j + 500) / d % 2;
			int b = (i + j + 500) / d % 2;
			printf("%c", clr[a * 2 + b]);
		}
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(){
   int p,q,r,m;
    
   scanf("%d %d %d",&p,&q,&r);
   if (p>q) m=p;
   else     m=q;
   if (m<r) m=r;
   printf("%d\n",p+q+r-m);
   return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int INF=0x3f3f3f3f;
const int maxn=1005;

struct edge{int to,cost;};

int n,m,s,cnt;
int d[maxn];
int qh,qt,q[maxn*maxn];
bool ok=1,inq[maxn];
vector<edge>G[maxn];

int main() {
	cin>>n>>m>>s;
	for (int i=0;i<m;i++) {
		int u,v,w; cin>>u>>v>>w;
		G[u].pb(edge{v,w});
	}
	memset(d,0x3f,sizeof(d));
	d[s]=0;
	q[qt++]=s; inq[s]=1;
	while (qh<qt) {
		int u=q[qh++]; inq[u]=0;
		for (edge e:G[u]) {
			if (d[e.to]>d[u]+e.cost) {
				d[e.to]=d[u]+e.cost;
				if (!inq[e.to]) {
					q[qt++]=e.to;
					inq[e.to]=1;
					++cnt;
				}
			}
		}
		if (cnt>n*n+5) {ok=0;break;}
	}
	if (!ok) {
		cout<<"NEGATIVE CYCLE"<<'\n';
		return 0;
	}
	else for (int i=0;i<n;i++) 
		if (d[i]==INF) cout<<"INF"<<'\n';
		else cout<<d[i]<<'\n';
}


Measured memory_bytes: 5576
import queue
K=int(input())
x=queue.Queue()
for j in range(1,10):
    x.put(j)
for i in range(K):
    y=x.get()
    if y%10!=0:
        x.put(10*y+y%10-1)
    x.put(10*y+y%10)
    if y%10!=9:
        x.put(10*y+y%10+1)
print(y)

Measured memory_bytes: 12452
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""

a,b=ml()
if(b==0):
    n=set()
else:
    n=ll()
    n=set(n)
r=0
for i in range(a,1001):
    if(i not in n):
        r=i
        break
l=0    
for i in range(a-1,-1,-1):
    if(i not in n):
        l=i
        break
if(abs(l-a)<=abs(r-a)):
    print(l)
else:
    print(r)

Measured memory_bytes: 65192
N = int(input())
a_list = list(map(int, input().split()))
#print(a_list)
myans = 0
for a, b in enumerate(a_list):
    #print(a,b)
    if (a+1)%2 != 0 and b%2 != 0:
        myans += 1
print(myans)

Measured memory_bytes: 9080
#include <bits/stdc++.h>
 
using namespace std;  
 
typedef long long ll;
typedef long double ld;
 
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define rs resize
#define all(x) x.begin(), x.end()   
 
void pre(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

void pudge(){
    int n;
    cin >> n;
    ld t = n / 1.08;
    for (int i = t - 1; i <= t + 1; i++){
        if (int(i * 1.08) == n){
            cout << i << '\n';
            return;
        }
    }
    cout << ":(";
}
 
int main(){ 
    pre();
    pudge();
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int max=-1000000,min=1000000;
		double sum=0;
		for(int i=0;i<n;i++){
			int a=sc.nextInt();
			if(a>max){
				max=a;
			}
			if(a<min){
				min=a;
			}
			sum+=a;
		}
		System.out.printf("%d %d %.0f\n",min,max,sum);
	}
}

Measured memory_bytes: 41044
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
    
int main(){
	int n;
    string s;
    cin>>n>>s;
    int a[10][n+1]={0};
    REP(i,10){
        REP(j,n+1){
            a[i][j]=0;
        }
    }
    //vector<vector<int>> a(n,vector(n),0);
   // OUT(a[2][n]);
    REP(i,n){
        a[s.at(i)-'0'][i]++;
        REP(j,10){
            a[j][i+1]=a[j][i];
        }
    }
    //OUT(a[3][n-1]);
    map<int,int> m;
    for(int i=0;i<n-1;i++){
        vector<int> le;
        vector<int> ri;
        REP(j,10){
        if(a[j][i]!=0){
            le.push_back(j);
        }
        if((a[j][n-1]-a[j][i+1])!=0){
            ri.push_back(j);
        }
        }
        REP(p,SZ(le)){
            REP(q,SZ(ri)){
                int x=100*le.at(p)+10*(s.at(i+1)-'0')+ri.at(q);
               // OUT(x);
                m[x]++;
            }
        }
    }
    OUT(SZ(m));
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define sum accumulate
typedef long long ll;
const int INF = 100000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 998244353LL;
int main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
	ll n,k;
	std::cin >> n>>k;
	if(k>(n+1)/2){
		std::cout << -1 << std::endl;
		exit(0);
	}
	if(n%2==0){
		for (ll i = 1; i <=n/2; i++) {
			/* code */
			std::cout << k+2*(i-1)<< " "<<k+2*n-i <<" " << k+2*n+i+n/2-1<< std::endl;
		}
		for (ll i = 1; i <=n/2; i++) {
			/* code */
			std::cout << k+1+2*(i-1)<<" " << k+2*n-i-n/2 <<" " << k+2*n+i-1<< std::endl;
		}
	}else{
		for (ll i = 1; i <=n/2+1; i++) {
			/* code */
			std::cout << k+2*(i-1)<< " "<<k+2*n-i <<" " << k+2*n+i+n/2-1<< std::endl;
		}
		for (ll i = 1; i <=n/2; i++) {
			/* code */
			std::cout << k+1+2*(i-1)<<" " << k+2*n-i-n/2-1 <<" " << k+2*n+i-1<< std::endl;
		}
	}
}

Measured memory_bytes: 2304
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<queue>
#include<utility>
#include<cmath>
#include<sstream>
#include<istream>

using namespace std;


int main()
{

  int N, K;
  cin >> N >> K;

  int cnt = 0;
  for(int i = 0; i < N; i++){
    int h;
    cin >> h;
    if(h >= K)  cnt++;
  }

  cout << cnt << endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/
 

 
const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };



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

    int n, m; cin >> n >> m;
    vector<int> imos(100005, 0);

    for(int i=0; i<m; ++i){
        int l, r; cin >> l >> r;
        ++imos[l]; --imos[r+1];
    }

    int ans = 0;
    for(int i=1; i<=n; ++i){
        imos[i] += imos[i-1];
        if(imos[i] == m) ++ans;
    }
    
    cout << ans << endl;

	return 0;
}

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

#define int long long
#define rep(i,n) for(int i=0;i<n;i++)

int sx, tx, sy, ty;

signed main()
{
    cin >> sx >> sy >> tx >> ty;
    
    rep(i, tx - sx)cout << 'R';
    rep(i, ty - sy)cout << 'U';
    
    rep(i, tx - sx)cout << 'L';
    rep(i, ty - sy)cout << 'D';

    cout << 'D';
    rep(i, tx - sx + 1)cout << 'R';
    rep(i, ty - sy + 1)cout << 'U';
    cout << 'L';
    
    cout << 'U';
    rep(i, tx - sx + 1)cout << 'L';
    rep(i, ty - sy + 1)cout << 'D';
    cout << 'R' << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cmath>
#include <algorithm>

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

using namespace std;

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

	rep(i,n)
	{
		double a,b;
		char c;
		cin >> a >> c >> b;

		double r = a*30 + b*6/12;
		double r2 = b*6;
		if(r2 < r) swap(r2,r);

		double rad = min(r2-r,360 - (r2-r));

		if(rad < 30) cout << "alert" << endl;
		else if(90 <= rad && rad <= 180) cout << "safe" << endl;
		else cout << "warning" << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn get<T: std::str::FromStr + Clone>() -> T {
    let line = read_vec::<T>();
    line[0].clone()
}

fn main() {
    let n = get::<usize>();
    let chars = get::<String>();
    let mut string = Vec::<char>::with_capacity(n);
    for c in chars.chars() {
        string.push(c)
    }

    let k = get::<usize>();
    let c = string[k - 1];

    for x in 0..n {
        if string[x] == c {
            print!("{}", c)
        } else {
            print!("*")
        }
    }
    println!()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define pf push_front
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
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;

int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}

int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}

int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}

int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}

int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main(){
  lint n;
  cin>>n;
  deque<lint> l;
  vector<int> a;
  rep(i,n){
    lint r;
    cin>>r;
    if(r==0){
      lint d,x;cin>>d>>x;
      if(d==0)l.push_front(x);
      else l.push_back(x);
    }
    else if(r==1){
      lint p;cin>>p;
      a.pb(l[p]);
    }
    else{
      lint d;cin>>d;
      if(d==0)l.pop_front();
      else l.pop_back();
    }
  }
  for(int i=0;i<a.size();i++){
    cout<<a[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 6212
using namespace std;

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <numeric>
typedef long long ll;
typedef pair<int,int> p;


int main()
{
  int n;
  cin >> n;
  int maxv = 0;
  int maxv2 = 1;

  for (int i = 2; i <= n; i++)
  {
    int count = 0;
    int tmp = i;
    while(tmp % 2 == 0){
      tmp /= 2;
      count++;
    }
    if (count >= maxv)
    {
      maxv2 = i;
      maxv = count;
    }
  }

  cout << maxv2 << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int imos[100001] = {};
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    imos[l]++;
    imos[r + 1]--;
  }
  int cum[100001] = {};
  for (int i = 1; i <= n; i++) {
    cum[i] = cum[i - 1] + imos[i];
  }
  int result = 0;
  for (int i = 1; i <= n; i++) {
    if (cum[i] == m) result++;
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 1024
/* ex 7_1 AtCoder Beginner Contest 108 B
   nk777 */

// ↑y
// →x

#include <stdio.h>
// 頂点を返す構造体point
typedef struct point{
    int x_elem;
    int y_elem;
}point;
// ある頂点についてx軸、y軸について移動させた頂点を返す関数
// 求めたい点の2個前の点point_2before, 1個前の点point_1before
point shift_point(point point_2before, point point_1before){
    // 求めたい頂点point_next
    point point_next;
    // 符号付きの差lenX, lenY
    int lenX, lenY;
    lenX = point_1before.x_elem - point_2before.x_elem;
    lenY = point_1before.y_elem - point_2before.y_elem;
    // 1個前の点にxとyの差を入れ替えて足す。ただしyの差は符号を変える
    point_next.x_elem = point_1before.x_elem - lenY;
    point_next.y_elem = point_1before.y_elem + lenX;
    return point_next;
}

int main(void){
    // 点point1(x1,y1), 点point2(x2,y2), 点point3, 点point4
    point point1, point2, point3, point4;
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);

    // 点point1(x1,y1), 点point2(x2,y2)を構造体に入れる
    point1.x_elem = x1;
    point1.y_elem = y1;
    point2.x_elem = x2;
    point2.y_elem = y2;
    // 移動した値を代入
    point3 = shift_point(point1, point2);
    point4 = shift_point(point2, point3);

    // 出力
    printf("%d %d %d %d\n", point3.x_elem, point3.y_elem, point4.x_elem, point4.y_elem);

    return 0;
}

Measured memory_bytes: 1708
fn qa() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    let n : i32 = input.trim_right().parse().unwrap();
    if n == 1 {
        println!("{}", "Hello World");
    }
    else {
        let mut input = String::new();
        std::io::stdin().read_line(&mut input).unwrap();
        let a : i32 = input.trim_right().parse().unwrap();
        let mut input = String::new();
        std::io::stdin().read_line(&mut input).unwrap();
        let b : i32 = input.trim_right().parse().unwrap();

        println!("{}", a + b);
    }
}


fn main() {
    qa();
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vec h(N+1,0);
    REP(i,0,N) cin >> h[i];
    ll cnt = 0;
    REP(i,1,101) {
        ll c = 0;
        bool f = false;
        REP(j,0,N+1) {
            if(f) {
                if(i > h[j]) {
                    f = false;
                    ++c;
                }
            }
            else {
                if(i <= h[j]) f = true;
            }
        }
        cnt += c;
    }
    PR(cnt);

    return 0;
}

/*



*/

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int,int> 
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
int inf=1000001000;
ll INF=100000000000000000;
ll MOD=1000000007;
//g++ code.cpp   ./a.out 
 
int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt=0;
    for(int i=0; i<=n-2; i++){
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') cnt++;
    }
    cout << cnt << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
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; }



int main(int argc, char const *argv[]) {
  ll k;
  cin >> k;
  ll ans = 1, now = 7;
  rep(i, 1e6) {
    if (now % k == 0) {
    cout << ans << endl;
    return 0;
    }
    now *= 10;
    now += 7;
    now %= k;
    ans++;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3560
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <cmath>
#include <set>
#include <queue>
#include <string>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int>  pii;
template<class T>
void read(T &res)
{
    res = 0;
    char c = getchar();
    T f = 1;
    while(c < '0' || c > '9')
    {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9')
    {
        res = res * 10 + c - '0';
        c = getchar();
    }
    res *= f;
} 
map<int,int> mm;
const ll mod = 1e9+7;
int gcd(int a,int b){return b == 0? a : gcd(b,a % b);}
ll getpow(ll a,ll b)
{
	ll ans = 0;
	while(b)
	{
		if(b & 1)
			ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

const int maxn = 2e5 + 5;
 
int main()
{
	int n;
	read(n);
	ll ans =0 ;
	for (int  i= 1; i <= n; i ++ )
	{
		if(i % 3 == 0 || i % 5 == 0)
			continue;
		ans += 1ll * i;

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

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

int main(){
	string str;
	cin>>str;
	if(str=="Sunny")cout<<"Cloudy"<<endl;
	if(str=="Cloudy")cout<<"Rainy"<<endl;
	if(str=="Rainy")cout<<"Sunny"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

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

int main() {

	int N;
	cin >> N;

	vector<lint> A(N + 1);
	for (int i = 0; i <= N; i++) cin >> A[i];

	// if N not 0 B_0 = 1
	// B_(i-1) <= A_i + B_i <= 2*B_(i-1)
	vector<lint> B(N + 1, LINF);
	B[0] = 1;
	for (int i = 1; i <= N; i++) {
		chmin(B[i], 2 * B[i - 1] - A[i]);
	}

	lint sum = 0;
	for (int i = N; i >= 0; i--) {
		chmin(B[i], sum);
		sum += A[i];
	}

	lint ans = 0;
	if (any_of(B.begin(), B.end(), [](auto b) { return b < 0; }) || A[0] != 0 && N != 0 || A[0] != 1 && N == 0) {
		ans = -1;
	}
	else {
		ans = accumulate(A.begin(), A.end(), 0LL) + accumulate(B.begin(), B.end(), 0LL);
	}

	cout << ans << "\n";

	return 0;
}



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

int main() {
    int n;
    string s;
    cin >> n >> s;

    vector<int> w(n+1, 0);
    vector<int> e(n+1, 0);
    for (int i = 1; i <= n; i++) {
        if (s[i-1] == 'W') {
            w[i] += w[i-1] + 1;
            e[i] += e[i-1];
        } else {
            w[i] += w[i-1];
            e[i] += e[i-1] + 1;
        }
    }
    int mn = n + 1;
    for (int i = 1; i <= n; i++) {
        mn = min(mn, w[i-1] + e[n] - e[i]);
    }
    cout << mn << endl;
}

Measured memory_bytes: 3076
/*
Wai u read my code xD
*/
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vi vector <ll> 
#define qu queue <ll>
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;


void solve()
{
    ll a[3]; for (int i = 0; i < 4; i++) cin >> a[i];
    sort(a,a+3);
    int k = a[2]/2;
    nout(abs((a[0]*a[1]*k)-(a[0]*a[1]*(a[2]-k))));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Control.Applicative
import Data.Char

splitBy :: (a -> Bool) -> [a] -> [[a]]
splitBy pred []  = []
splitBy pred str = a : (splitBy pred $ dropWhile pred b)
                 where (a, b) = break pred str

solve :: String -> Int
solve str = do
	let [x1, y1, r1, x2, y2, r2] = map read $ splitBy isSpace str :: [Double]
	let d = sqrt $ (dx * dx + dy * dy)
		where dx = x1 - x2
		      dy = y1 - y2
	if d > (r1 + r2)
		then 0
		else
			if (r2 + d) < r1
				then 2
				else
					if (r1 + d) < r2
						then (-2)
						else 1

main :: IO ()
main = do
	n <- readLn :: IO Int
	lines <- replicateM n getLine
	mapM_ print $ map solve lines

Measured memory_bytes: 4428
S = input()
k = int(input())
abc = []
for i in range(len(S)):
    for j in range(1, k+1):
        if i+j <= len(S):
            s = S[i:i+j]
            if not s in abc:
                abc.append(S[i:i+j])
    
abc = sorted(abc)
print(abc[k-1])


Measured memory_bytes: 4084