akhauriyash/Code-Regression huggingface dataset:
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let q: usize = sc.read();
    for _ in 0..q {
        let a: i64 = sc.read();
        let b: i64 = sc.read();
        let (a, b) = if a < b { (a, b) } else { (b, a) };

        let mut ok = 0;
        let mut ng = 1 << 33;
        while ng - ok > 1 {
            let m = (ok + ng) / 2;
            let e = vec![(a + 1) * m, a + m].into_iter().max().unwrap();
            let max = ((-5)..5)
                .map(|d| d - (a + 1 - m) / 2)
                .filter(|&x| 0 <= x && x < m)
                .map(|x| (a + 1 + x) * (m - x))
                .max()
                .unwrap_or(e);
            if max < a * b {
                ok = m;
            } else {
                ng = m;
            }
        }

        let ans = a - 1 + ok;
        sc.write(ans);
        sc.write("\n");
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
using namespace std;
typedef pair<int,int> P;//Pでpair<-,->を表す。
typedef long long LL; 
LL MOD=1000000007;

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

    int n=s.size();
    if(n%2!=0){
        cout<<"No"<<endl;
        return 0;
    }
    int flg=0;
    int ans=1;
    for(int i=0;i<n;i++){
        if(flg==0){
            if(s[i]!='h'){ans=0;}
        }
        else{
            if(s[i]!='i'){ans=0;}
        }
        flg=1-flg;
    }
    if(ans==0){cout<<"No"<<endl;}
    else{cout<<"Yes"<<endl;}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Max=1e5+10;
const int Mod=1e9+7;
int a[Max];
int cnt[Max];
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    ll sum=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        cnt[a[i]]++;
    }
    bool flag=1;
    ll ans=1;
    if(n&1){
        if(cnt[0]!=1){
            flag=0;
        }
        for(int i=2;i<=n-1;i+=2){
            if(cnt[i]!=2){
                flag=0;
                break;
            }
        }
        for(int i=1;i<=n;i+=2){
            if(cnt[i]){
                flag=0;
                break;
            }
        }
    }else{
        for(int i=1;i<=n-1;i+=2){
            if(cnt[i]!=2){
                flag=0;
                break;
            }
        }
        for(int i=0;i<=n;i+=2){
            if(cnt[i]){
                flag=0;
                break;
            }
        }
    }
    if(flag){
        for(int i=1;i<=n/2;i++){
            ans=ans*2;
            ans%=Mod;
        }
    }else{
        ans=0;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;

char s0[1011]="CODEFESTIVAL2016";
char s[1011];
int n;
int ans;
int main()
{
	int i,j,k;
	
	
	cin>>s;
	n=strlen(s);
	ans=0;
	for(i=0;i<n;i++)
	{
		if(s[i]!=s0[i])ans++;
	}
	cout<<ans<<endl;
	
	return 0;
} 

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> H(N);
  int A, B;
  vector<bool> X(N,true);
  for(int i=0; i<N; i++) cin >> H[i];
  for(int i=0; i<M; i++){
    cin >> A >> B;
    if(H[A-1]>=H[B-1]) X[B-1]=false;
    if(H[B-1]>=H[A-1]) X[A-1]=false;
  }
  int cnt=0;
  for(int i=0; i<N; i++){
    if(X[i]==true) cnt++;
  }
  cout <<cnt <<endl;
}

Measured memory_bytes: 3780
#include<bits/stdc++.h>
#define ll long long int
#define N (ll)(1e9+7)
#define T int
#define P pair<T,T>
#define umap unordered_map<T,T>
#define uset unordered_set<T>
#define rep(i,n) for(i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define print(v) for(auto x:v) cout<<x<< " "
#define pb push_back
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    string s;
    cin>>a;
    cin>>s;
    if(a<3200)
    	cout<<"red"<<endl;
    else
    	cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))

dp = [0] * N
dp[1] = abs(H[1]-H[0])
for i in range(2, N):
    dp[i] = min((dp[i-1]+abs(H[i-1]-H[i]), dp[i-2]+abs(H[i-2]-H[i])))

print(dp[N-1])

Measured memory_bytes: 13980
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll a,b,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    long double r,t,y;
    long double ep=1.0E-14;
   cin>>r>>t>>y;
   if(sqrt(r)+sqrt(t)+ep<sqrt(y)) Yes;
   else No;

    //cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define ll long long 
/*void setIO(string name = "") { 
    if(sz(name)){
        freopen((name+".in").c_str(), "r", stdin); // see Input & Output
        freopen((name+".out").c_str(), "w", stdout);
    }
}
*/

void fast(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
}

int main() {
   fast();
   int n;
   cin>>n;
   string s;
   cin>>s;
   long long int ans=0;
   
   long long int f=0;
   long long int g=0;
   long long int h=0;
   for(int i=0;i<n-2;i++){
    for(int k=i+2;k<n;k++){
      int j=(i+k)/2;
      if(s[i]!=s[j] && s[j]!=s[k] && s[k]!=s[i] && j!=i && j!=k && i!=k && (i+k)%2==0){
        ans++;
      }
    }
   }
   for(int i=0;i<n;i++){
      if(s[i]=='R'){
         f++;
      }else if(s[i]=='G'){
         g++;
      }else{
        h++;
      }
   }
 
   cout<<f*g*h-ans<<endl;





   










}

Measured memory_bytes: 3652
l = list([1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51])
print(l[int(input())-1])

Measured memory_bytes: 3060
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

n, m, q = MAP()
arr = [[]]
for i in range(n):
    tmp = deepcopy(arr)
    arr = []
    for j in range(1, m + 1):
        for k in range(len(tmp)):
            if len(tmp[k]) == 0 or tmp[k][-1] <= j:
                arr.append(deepcopy(tmp[k]))
                arr[-1].append(j)

point = [0 for _ in range(len(arr))]
for i in range(q):
    a, b, c, d = MAP()
    for j in range(len(arr)):
        if arr[j][b - 1] - arr[j][a - 1] == c:
            point[j] += d
#print(point)
print(max(point))


Measured memory_bytes: 165724
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

# 割引券を使用しない場合は各品の最低金額合計が解となる
ans = min(a) + min(b)

# 割引券を使用して安くなるケースがないか調べる
for _ in range(M):
    x, y, c = map(int, input().split())
    tmp = a[x-1] + b[y-1] - c
    if tmp < ans:
        ans = tmp

print(ans)


Measured memory_bytes: 18736
using System;
using System.Linq;
using System.Collections.Generic;
 
namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int W = int.Parse(input[0]);
            int H = int.Parse(input[1]);
            int x = int.Parse(input[2]);
            int y = int.Parse(input[3]);
            double S = (double)W * (double)H;
            if ((x + x == W && y + y == H))
            {
                Console.WriteLine((S / 2d).ToString("F9") + " 1");
            }
            else
            {
                Console.WriteLine((S / 2d).ToString("F9") + " 0");
            }
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define int long long int
#define FILEIO  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 
#define maxn 1000000
 

using namespace std;

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

signed main() {
//FILEIO;
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n;
cin>>n;
int arr[n];
for (int i = 0; i < n; ++i)
{
	/* code */
	cin>>arr[i];
}
int cnt = 0;
for(int i = 0; i < n; i++)
{
	if(i%2 == 0 and arr[i]%2 == 1)
		cnt++;
}
cout<<cnt;










    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()      //昇順
#define RALL(obj) (obj).rbegin(), (obj).rend()   //降順
#define print(obj) cout << obj << endl
#define scan(obj) cin >> obj

typedef long long ll;

using namespace std;

int main(void){
    int n;
    cin >> n;
    vector<int> l;
    rep(i, n){
        int temp;
        cin >> temp;
        l.pb(temp);
    }
    sort(ALL(l));
    int MAX = l[n - 1];
    l.pop_back();
    int sum = 0;
    rep(i, l.size()){
        sum += l[i];
    }
    if(MAX < sum){
        print("Yes");
        return 0;
    }
    print("No");
}

Measured memory_bytes: 256
# coding: utf-8
# Here your code !

import sys
sys.setrecursionlimit(10**6)
N = int(input())
v = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    v[a].append([b,i])
 
ans = [None] * (N-1)
 
def decide_colord(cur,color):
    cnt = 1
    for (to,j)in v[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        decide_colord(to,cnt)
        cnt += 1
decide_colord(0,0)
print(max(ans))
[print(a) for a in ans]

Measured memory_bytes: 70944
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int price[41][401][401];
int main(void) {
  int n, ma, mb;
  cin >> n >> ma >> mb;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];
  int inf = 100000;
  for (int i = 0; i < 41; i++) {
    for (int j = 0; j < 401; j++) {
      for (int k = 0; k < 401; k++) {
        price[i][j][k] = inf;
      }
    }
  }
  price[0][0][0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= 10 * i; j++) {
      for (int k = 0; k <= 10 * i; k++) {
        if (price[i][j][k] == inf) continue;
        price[i + 1][j][k] = min(price[i + 1][j][k], price[i][j][k]);
        price[i + 1][j + a[i]][k + b[i]] = min(price[i + 1][j + a[i]][k + b[i]], price[i][j][k] + c[i]);
      }
    }
  }
  int ans = inf;
  for (int i = 1; i <= 10 * n; i++) {
    for (int j = 1; j <= 10 * n; j++) {
      if (i * mb == j * ma) {
        ans = min(ans, price[n][i][j]);
      }
    }
  }
  if (ans == inf) ans = -1;
  cout << ans << endl;
  return 0;
}

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

ll read() {
    ll x = 0, f = 1; char ch = getchar();
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    while (isdigit(ch)) { x = x * 10 + ch - '0'; ch = getchar(); }
    return x * f;
}

#define ls x << 1
#define rs x << 1 | 1
const ll Max = 100033;
const ll mod = 1000000007;
ll n, k, m, tag[Max * 4], s[Max], ans;
ll a[Max], b[Max], g[Max * 2], L[Max], R[Max], f[Max];

void pushdown(ll x) {
    if (tag[x]) {
        tag[ls] = tag[rs] = tag[x];
        tag[x] = 0;
    }
}
void change(ll x, ll l, ll r, ll L, ll R, ll g) {
	if (L > R) return;
    if (L <= l && r <= R) {
        tag[x] = g;
        return;
    }
    pushdown(x);
    ll mid = (l + r) >> 1;
    if (L <= mid) change(ls, l, mid, L, R, g);
    if (R > mid) change(rs, mid + 1, r, L, R, g);
}
ll query(ll x, ll l, ll r, ll p) {
    if (l == r) return tag[x];
    pushdown(x);
    ll mid = (l + r) >> 1;
    if (p <= mid) return query(ls, l, mid, p);
    else return query(rs, mid + 1, r, p);
}
ll calc(ll x) {
    ll y = query(1, 1, m, x);
    return y ? f[y] + (g[L[y]] - g[x] + k) % k : y;
}

int main() {
    n = read(), k = read();
    for (ll i = 1; i <= n; i++) {
        a[i] = read(), b[i] = read();
        s[i] = s[i - 1] + a[i];
        if (b[i] == 1 && 2ll * a[i] > k) {
            puts("-1"); return 0;
        }
    }
    for (ll i = 1; i <= n; i++) {
        if (b[i] & 1) {
            R[i] = ((-2ll * s[i]) % k + k) % k;
            L[i] = ((-2ll * s[i - 1]) % k + k) % k;
        }
        else L[i] = 0, R[i] = k - 1;
        g[++m] = L[i], g[++m] = R[i];
    }
    sort(g + 1, g + m + 1);
    m = unique(g + 1, g + m + 1) - g - 1;
    for (ll i = n; i >= 1; i--) {
        L[i] = lower_bound(g + 1, g + m + 1, L[i]) - g;
        R[i] = lower_bound(g + 1, g + m + 1, R[i]) - g;
        f[i] = calc(L[i]);
        if (L[i] > R[i]) change(1, 1, m, R[i] + 1, L[i] - 1, i);
        else {
            change(1, 1, m, 1, L[i] - 1, i);
            change(1, 1, m, R[i] + 1, m, i);
        }
    }
    ans = f[1];
    for (ll i = 1; i <= m; i++)
        ans = min(ans, calc(i));
    cout << ans + s[n] * 2ll << endl;
    return 0;
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()
int main(){
    int x;cin>>x;
    if(x<1200)cout<<"ABC"<<endl;
    else cout<<"ARC"<<endl;
}


Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
const long long INF = 1LL << 60;

int main() {
    ll l, r; cin >> l >> r;
    
    ll min_mod = INF;
    ll min_mod2 = INF;

    if(l == 0){
        cout << 0 << endl;
        return 0;
    }

    if(r-l > 2017){
        cout << 0 << endl;
        return 0;
    }
    else{
        for(ll i=l; i<=r; i++){
            for(ll j=i+1; j<=r; j++){
                min_mod = min(min_mod, (i*j)%2019);
            }
        }
        cout << min_mod << endl;
    
    }
}


Measured memory_bytes: 256
N = int(input())
A = [int(x) for x in input().split()]

def gcd(x, y):
    while (y):
        x, y = y, x % y
    return x

F = [0] * N
B = [0] * N
for i in range(N):
    if i - 1 <= -1:
        F[i] = A[i]
    else:
        F[i] = gcd(F[i - 1], A[i])

for i in range(N-1,-1,-1):
    if i + 1 >= N:
        B[i] = A[i]
    else:
        B[i] = gcd(B[i + 1], A[i])


ans = 0
for i in range(1,N-1):
    ans = max(ans, gcd(F[i - 1], B[i + 1]))

ans = max(ans, F[N - 2])
ans = max(ans, B[1])

print(ans)

Measured memory_bytes: 14428
n, q = map(int,input().split())
s = "_" + input() + "_"
l, r = 0, n+1

for (t,d) in [input().split() for i in range(q)][::-1]:
  L = d == 'L'
  R = d == 'R'
  l += (t==s[l+1] and L) - (t==s[l] and R)
  r += (t==s[r] and L) - (t==s[r-1] and R)
print(r-l-1)


Measured memory_bytes: 41364
A = list(map(int, input().split()))
first = max(A)
A.remove(max(A))
cost1 = 0
cost1 += abs(first - A[0])
cost1 += abs(A[0] - A[1])
cost2 = 0
cost2 += abs(first - A[1])
cost2 += abs(A[0] - A[1])
print(min(cost1, cost2))



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

int main(){
  int k;
  string s;
  
  cin >> k;
  cin >> s;
  
  if(s.size() <= k) cout << s << endl;
  else{
    s = s.substr(0, k);
    cout << s << "..." << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3556
S = input()

count = 0
for i in S:
    if count % 2 == 0:
        if i =='L':
            print('No')
            break
        else:
            count += 1
            continue
    else:
        if i == 'R':
            print('No')
            break
        else:
            count += 1
            continue

if count == len(S):
    print('Yes')


Measured memory_bytes: 2940
#include<iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int devisor[n+1];
    for(int i=1;i<=n;i++)devisor[i] = 0;

    for(int i=2;i<=n;i++){
        int tmp = i;
        for(int j=2;j<=i;j++){
            if(tmp%j == 0){
                devisor[j]++;
                tmp /= j;
                j--;
            }
        }
    }
    long ans = 1;
    for(int i=2;i<=n;i++){
        //cout << '#' << i << '=' <<devisor[i] << endl;
        ans = (ans * (devisor[i]+1)) % 1000000007;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <algorithm>
#include <deque>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    int n; cin >> n;
    vector<vector<int> > adj(n, vector<int> (n));
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            int a; cin >> a;
            adj[i][j] = (a == -1 ? INF : a);
        }
    }

    int u , minv;
    int unvisited = 0; int visited = 1; int fixed = 2;
    vector<int> dist(n, INF), parent(n, -1), status(n, unvisited);

    dist[0] = 0;

    while(1) {
        u = -1;
        minv = INF;
        for(int i = 0; i < n; i++) {
            if(minv > dist[i] && status[i] != fixed) {
                u = i;
                minv = dist[i];
            }
        }
        if(u == -1) break;
        status[u] = fixed;
        for(int v = 0; v < n; v++) {
            if(status[v] != fixed && adj[u][v] != INF) {
                if(dist[v] > adj[u][v]) {
                    dist[v] = adj[u][v];
                    parent[v] = u;
                    status[v] = visited;
                }
            }
        }
    }
    int sum = 0;
    for(int i = 0; i < n; i++) {
        sum += dist[i];
    }

    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 3200
import Data.List

main::IO()
main = do
    n <- readLn::IO Int
    xs <-map read . words <$> getLine::IO [Int] 
    print $ (query . group . sort) xs

query::[[Int]] -> Int
query[] = 0
query (x:xs) = if x!!0 == length x then query xs
                  else sbtrct x + query xs  

sbtrct::[Int] -> Int
sbtrct x = if length x <= x!!0 then length x 
              else (length x) - (x!!0)



Measured memory_bytes: 37500
N = int(input())
S = input()

s = S[::-1]
w = [0]*(N+1)
e = [0]*(N+1)
cnt_w = 0
cnt_e = 0

for i in range(N):
    if(S[i] == "W"):
        cnt_w += 1
        w[i+1] = cnt_w
    else:
        w[i+1] = cnt_w

for i in range(N):
    if(s[i] == "E"):
        cnt_e += 1
        e[i+1] = cnt_e
    else:
        e[i+1] = cnt_e

e = e[::-1]        
ans = 2*N

for i in range(N+1):
    ans = min(ans, e[i]+w[i])
print(ans)

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

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


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int[] a = new int[n];
		int[] b = new int[200010];
		Arrays.fill(b, 0);
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[a[i]]++;
		}

		ArrayList<Integer> c = new ArrayList<>();
		for (int i = 0; i < 200010; i++) {
			if (b[i] != 0) 	c.add(b[i]);
		}
		Collections.sort(c, Comparator.reverseOrder());
		long ans = 0;
		for (int i = k; i < c.size(); i++) {
			ans += c.get(i);
		}
		System.out.println(ans);
	}
}


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* na, Arg1&& arg1, Args&&... args) {
  const char* c = strchr(na + 1, ',');
  cerr.write(na, c - na) << " : " << arg1 << " , ";
  __f(c + 1, args...);
}
#define endl "\n"
typedef long long LL;
const int mod = 1e9 + 7;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 1e5 + 5;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif // LOCAL
  int tot, n;
  cin >> tot >> n;
  int can = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    can += x;
  }
  cout << (can >= tot ? "Yes" : "No") << endl;
  return 0;
}



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


int isSquare(int n){
    for(int i=0;i<=n;i++){
        if(i*i==n){
            return true;
        }else if(i*i>n){
            return false;
        }
    }
    return false;
}

int main(){
    int N, D;
    cin >> N >> D;

    int X[N][D];

    for(int i=0;i<N;i++){
        for(int j=0;j<D;j++){
            cin >> X[i][j];
        }
    }

    int count = 0;

    for(int i=0;i<N;i++){
        for(int k=i+1;k<N;k++){
            int dist = 0;
            for(int j=0;j<D;j++){
                dist += (X[i][j]-X[k][j])*(X[i][j]-X[k][j]);
            }
            if(isSquare(dist)){
                count++;
            }
        }
    }
    cout << count;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int main(){
	char x[2], y[2]; scanf("%s %s", x, y);
	if(x[0] == y[0]) puts("=");
	if(x[0] < y[0]) puts("<");
	if(x[0] > y[0]) puts(">");
	return 0;
}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int n, k;
    
    cin >> n >> k;
    ll ans = k;

    irep(i, n-1) {
        ans *= k-1;
    }
    cout << ans << endl;
    return 0;
}
/** atcoder **/


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

int main() {
	
	int n;
	cin >> n;
	
	if(n<10){
		cout << n << endl;
	}else if(n<100){
		cout << 9 << endl;
	}else if(n<1000){
		cout << 9+(n-99) << endl;
	}else if(n<10000){
		cout << 9+900 << endl;
	}else if(n<100000){
		cout << 9+900+(n-9999) << endl;
	}else{
		cout << 9+900+90000 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
	int sec, minute, hour;
	int temp;

	cin >> sec;

	hour = sec / 3600;
	temp = sec % 3600;
	minute = temp / 60;
	sec = temp % 60;

	cout << hour << ":" << minute << ":" << sec << endl;
    return 0;
}


Measured memory_bytes: 3084
def main():
    import math
    n = int(input())
    inlis = list(map(int, input().split()))
    ans = 0
    for i in range(1, n-1):
        if inlis[i-1] < inlis[i] and inlis[i] < inlis[i+1]:
            ans += 1
        if inlis[i-1] > inlis[i] and inlis[i] > inlis[i+1]:
            ans += 1
    print(ans)
        

    
if __name__ == "__main__":
    main()


Measured memory_bytes: 61836
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

# Union-Find
def root(i):
    if node_groups[i] == i:
        return i
    else:
        node_groups[i] = root(node_groups[i])
        return node_groups[i]

def same(a, b):
    return root(a) == root(b)

def size(i):
    return group_sizes[root(i)]

def unite(a, b):
    a = root(a)
    b = root(b)

    if a == b:
        return

    if group_ranks[a] < group_ranks[b]:
        group_sizes[b] += size(a)
        node_groups[a] = b
    else:
        group_sizes[a] += size(b)
        node_groups[b] = a
        if group_ranks[a] == group_ranks[b]:
            group_ranks[a] += 1


n,m,k = get_nums_l()

lines = list(map(lambda s: s.strip(), sys.stdin.readlines()))
friends = list(map(lambda s: list(map(int, s.split())), lines[:m]))
blocks = list(map(lambda s: list(map(int, s.split())), lines[m:]))


nodes = n+1
node_groups = [ i for i in range(nodes)]
group_sizes = [ 1 for _ in range(nodes)]
group_ranks = [ 0 for _ in range(nodes)]

edges = []
for f in friends:
    unite(f[0], f[1])

group_nodes = [set() for _ in range(nodes)]
for node in range(1, n+1):
    group_nodes[root(node)].add(node)

kouho = [0] * nodes
for node in range(1, n+1):
    kouho[node] = (len(group_nodes[root(node)]) -1 )
# log("kouhoA", kouho)

for fr in friends:
    kouho[fr[0]] -= 1
    kouho[fr[1]] -= 1
for bl in blocks:
    if same(bl[0], bl[1]):
        kouho[bl[0]] -= 1
        kouho[bl[1]] -= 1

print(" ".join(map(str, kouho[1:])))

Measured memory_bytes: 126556
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main (string[] args)
        {
            string[] str;
            str = Console.ReadLine ().Split (' ');

            int N = int.Parse (str[0]);
            int X = int.Parse (str[1]);
            int T = int.Parse (str[2]);

            Console.WriteLine (Math.Ceiling ((decimal) (N) / (decimal) (X)) * T);
        }
    }

    class MyLibrary
    {
        public static int GCD (int a, int b)
        {
            if (a % b == 0) return b;
            return GCD (b, a % b);
        }
    }
}

Measured memory_bytes: 27596
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
  vector <int> a(3);
  for(int i=0;i<3;++i) cin >> a[i];
  sort(a.begin(),a.end());
  int ans=0;
  for(int i=0;i<2;++i) {
    ans+=a[i+1]-a[i];
  }
  cout << ans << endl;
}



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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int x;
    cin >> x;

    // 処理
    // 出力
    cout << (x >= 1200 ? "ARC" : "ABC") << endl;

    return 0;
}


Measured memory_bytes: 256
n=int(input())
xu=[]
for i in range(n):
    xu.append(list(input().split(" ")))
sumation=0
for i in range(n):
    if xu[i][1]=="JPY":
        sumation+=float(xu[i][0])
    else:
        sumation+=380000*float(xu[i][0])
print(sumation)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

using namespace std;

int main(int argc, char const *argv[]) {
    string S;
    std::cin >> S;
    for (size_t i = 0; i < S.size(); i++) {
        if(S[i]=='A' && i!=S.size()-1){
            if(S[i+1]=='C'){
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <cstdlib>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)<0?(-(a)):(a))
#define CS while(cases())
#define I(n) int n = gi()
#define II(n) n = gi()
#define L(n) ll n = gli()
#define LL(n) n = gli()
#define F0(i, n) for (int i = 0; i < n; i++)
#define F1(i, n) for (int i = 1; i < n; i++)
#define Fi(n, a) for (int i = 0; i < n; i++) a[i] = gi()
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

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

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int cases() {
    static int t = gi();
    return t--;
}

#define MD 1000000007

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x = gi();
    int y = gi();
    if (y%2 == 0 && y >= 2*x && y <= 4*x)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


Measured memory_bytes: 3692
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

#define MAX_N 1000
#define MAX_W 1000
#define max(a, b) ((a) > (b) ? (a) : (b))

int
main(int argc, char **argv)
{
	int dp[2][MAX_W + 1];
	int n, W;
	int v, w;
	int i, j, k;

	for (k = 1;; ++k)
	{
		scanf("%d", &W);
		if (W == 0)
			break;

		scanf("%d", &n);
		for (j = 0; j <= W; ++j)
			dp[0][j] = 0;

		for (i = 0; i < n; ++i)
		{
			scanf("%d,%d", &v, &w);
			for (j = 0; j <= W; ++j)
			{
				if (j < w)
					dp[(i + 1) & 1][j] = dp[i & 1][j];
				else
					dp[(i + 1) & 1][j] = max(dp[i & 1][j], dp[i & 1][j - w] + v);
			}
		}

		v = dp[n & 1][W];
		for (W--; W >= 0 && dp[n & 1][W] == v; --W)
			;

		printf("Case %d:\n", k);
		printf("%d\n", v);
		printf("%d\n", W + 1);
	}

	return 0;
}

Measured memory_bytes: 608
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

#[fastout]
fn main() {
   input! {
      s: Bytes,
   }
   let ans = if s[0] == b'R' && s[1] == b'R' && s[2] == b'R' {
      3
   } else if s[0] == b'R' && s[1] == b'R' {
      2
   } else if s[1] == b'R' && s[2] == b'R' {
      2
   } else if s[0] == b'R' || s[1] == b'R' || s[2] == b'R' {
      1
   } else {
      0
   };
   println!("{}", ans);
}


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

int main(){
    int a, b;
    scanf("%d %d",&a,&b) ;
    
    int d = a/b;
    int r = a%b;
    double f = (double)a/b;
    
    printf("%d %d %f",d,r,f);
    
    return 0;
    
}


Measured memory_bytes: 2744
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
        switch(str){
          case "A":
            str = "T";
              break;
          case "T":
            str = "A";
              break;
          case "C":
            str = "G";
              break;
          case "G":
            str = "C";
              break;
        }
        System.out.println(str);
	}
}

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

using namespace std;

using int64 = long long;

namespace FastFourierTransform
{
  using C = complex< double >;

  void DiscreteFourierTransform(vector< C > &F, bool rev)
  {
    const int N = (int) F.size();
    const double PI = (rev ? -1 : 1) * acos(-1);
    for(int i = 0, j = 1; j + 1 < N; j++) {
      for(int k = N >> 1; k > (i ^= k); k >>= 1);
      if(i > j) swap(F[i], F[j]);
    }
    C w, s, t;
    for(int i = 1; i < N; i <<= 1) {
      for(int k = 0; k < i; k++) {
        w = std::polar(1.0, PI / i * k);
        for(int j = 0; j < N; j += i * 2) {
          s = F[j + k];
          t = C(F[j + k + i].real() * w.real() - F[j + k + i].imag() * w.imag(),
                F[j + k + i].real() * w.imag() + F[j + k + i].imag() * w.real());
          F[j + k] = s + t, F[j + k + i] = s - t;
        }
      }
    }
    if(rev) for(int i = 0; i < N; i++) F[i] /= N;
  }

  vector< long long > Multiply(const vector< int > &A, const vector< int > &B)
  {
    int sz = 1;
    while(sz <= A.size() + B.size()) sz <<= 1;
    vector< C > F(sz), G(sz);
    for(int i = 0; i < A.size(); i++) F[i] = A[i];
    for(int i = 0; i < B.size(); i++) G[i] = B[i];
    DiscreteFourierTransform(F, false);
    DiscreteFourierTransform(G, false);
    for(int i = 0; i < sz; i++) F[i] *= G[i];
    DiscreteFourierTransform(F, true);
    vector< long long > X(A.size() + B.size() - 1);
    for(int i = 0; i < A.size() + B.size() - 1; i++) X[i] = F[i].real() + 0.5;
    return (X);
  }
};

int main()
{
  int N, M, Q, A[40001], B[40001], C[100000];
  vector< int > F(200001), G(200001);

  scanf("%d %d %d", &N, &M, &Q);
  for(int i = 0; i < N; i++) scanf("%d", &A[i + 1]), A[i + 1] += A[i];
  for(int i = 0; i < M; i++) scanf("%d", &B[i + 1]), B[i + 1] += B[i];
  for(int i = 0; i < Q; i++) scanf("%d", &C[i]);

  for(int i = 1; i <= N; i++) {
    for(int j = 0; j < i; j++) {
      ++F[A[i] - A[j]];
    }
  }
  for(int i = 1; i <= M; i++) {
    for(int j = 0; j < i; j++) {
      ++G[B[i] - B[j]];
    }
  }
  reverse(begin(G), end(G));
  auto X = FastFourierTransform::Multiply(F, G);
  for(int i = 0; i < Q; i++) {
    if(C[i] == 0) printf("%lld\n", X[200000]);
    else printf("%lld\n", X[200000 - C[i]] + X[200000 + C[i]]);
  }
}

Measured memory_bytes: 25028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}
const int MOD = 1000000007;

int main() {
    int n; cin >> n;
    int ans = 0;
    for(int i = 0;i < n;i++){
        ll x; cin >> x;
        int cnt = 0;
        if(x%2==0){
            while(x % 2 == 0){
                x/=2;
                cnt++;
            }
        }
            ans += cnt;
    }
    cout << ans;
}



Measured memory_bytes: 256
import java.io.*;
 
public class Main {
	public static void main(String[] args) throws IOException{
		System.out.println(metodo());
	}
	
	public static long metodo() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line1 = br.readLine().split(" ");
		int N = Integer.parseInt(line1[0]);
		int W = Integer.parseInt(line1[1]);
		int[] n1 = new int[N+1];
		int[] n2 = new int[N+1];
		for(int i = 1; i <= N ; i++) {
			line1 = br.readLine().split(" ");
			n1[i] = Integer.parseInt(line1[0]);
			n2[i] = Integer.parseInt(line1[1]);
		}
		
		long[][] matrix = new long[N+1][W+1];
		
		
		for(int i = 1; i <= N ; i++) {
			for(int w = 1; w <= W ; w++) {
				matrix[i][w] = matrix[i-1][w];
				if(w >= n1[i]) {
					 matrix[i][w] = Math.max(matrix[i][w], n2[i]+ matrix[i-1][w-n1[i]]);
				}
			}
		}
		
		return matrix[N][W];
	}
}


Measured memory_bytes: 130788
#include <stdio.h>          // printf(), scanf()
#include <math.h>           // sqrt()
#include <stdbool.h>

#define MAX_V 31623
#define min(a, b) ((a) < (b) ? (a) : (b))

int
main(int argc, char** argv)
{
	int x;
	bool f[MAX_V + 1];
	int i, j;

	scanf("%d", &x);
	printf("%d:", x);

	for (i = 0; i < min(x, MAX_V); ++i)
		f[i] = true;

	int a = x;
	int e = min(sqrt(x), MAX_V);
	for (i = 2; i <= e; ++i)
	{
		if (f[i])
		{
			for (j = i + i; j <= min(x, MAX_V); j += i)
				f[j] = false;

			while (a % i == 0)
			{
				a /= i;
				printf(" %d", i);
			}
		}
	}

	if (a != 1)
		printf(" %d", a);

	printf("\n");
	return 0;
}

Measured memory_bytes: 632
#include<bits/stdc++.h>
//cervello|Phoenix
using namespace std;
#define ll long long int
#define eb emplace_back
#define mk make_pair
#define all(x) x.begin(),x.end()
#define mod 1000000007
const int MAX_N = 200005;

vector<vector<int> > adj(MAX_N);
vector<bool> vis(MAX_N, 0);
vector<int> comp;

void dfs(int s){
  vis[s] = 1;
  comp.eb(s);
  for(auto i: adj[s])
    if(!vis[i])
      dfs(i);
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n,m; cin>>n>>m;
  set<pair<int,int> > s;
  for(int i=0; i<m; i++){
    int x, y; cin>>x>>y; x--, y--;
    s.insert({x,y});
    s.insert({y,x});
  }
  map<int,int> mp;
  for(auto i: s){
    int x = i.first, y= i.second;
    mp[x]++;
    mp[y]++;
    adj[x].eb(y);
  }
  int cnt = 0, ans = 0;
  for(int i=0; i<n; i++){
    if(!vis[i]){
      dfs(i);
      cnt = max(cnt,(int)comp.size());
      comp.clear();
    }
  }
  cout<<cnt<<"\n";
  return 0;
}

Measured memory_bytes: 55708
n = int(input())
c,s,f = [[0 for i in range(n-1)] for j in range(3)]
for i in range(n-1):
    c[i],s[i],f[i] = map(int,input().split())

for i in range(n):
    ans = 0
    for j in range(i,n-1):
        if ans < s[j]:
            ans = s[j]
        else:
            if ans%f[j] != 0:
                ans += f[j]-ans%f[j]
        ans += c[j]
    print(ans)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <map>

using namespace std;

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

    vector<int> A;
    for(int i=0; i<N; i++){
        int j;
        cin >> j;
        A.push_back(j);
    }

    map<int, int> m;

    for(auto it = A.begin(); it!=A.end(); ++it){
        m[*it] = distance(A.begin(), it);
    }

    vector<int> ans;
    for(auto it = m.begin(); it != m.end(); ++it){
        ans.push_back(it->second);
    }

    for(auto it = ans.begin(); it!=ans.end(); ++it){
        cout << *it + 1 << " ";
    }

}

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

typedef long long ll;
using namespace std;

int main(){
	ll n,m;
	cin>>n>>m;
	if(n*2>m){
		cout << m/2<<endl;
	}
	else if(n*2==m){
		cout << n<<endl;
	}
	else{
		ll a=m-n*2;
		a/=4;
		cout <<n+a<<endl;
	}
  return 0; 
}

Measured memory_bytes: 256
import sys, bisect, math

N, K = map(int, input().split())
A = list(map(int, sys.stdin.readline().rsplit()))

A.sort()
if bisect.bisect_left(A, K) == N:
    print("IMPOSSIBLE")
    exit()

a = A[0]
for aa in A[1:]:
    a = math.gcd(a, aa)

if K % a != 0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")


Measured memory_bytes: 19888
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		String week[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
		
		for(int i=0;i<7;i++) {
			if(str.equals(week[i])) {
				System.out.println(7-i);
			}
		}
	}	
}

Measured memory_bytes: 20820
S = input()
T = input()
N = len(S)
C_S = dict()
C_T = dict()
count_s = 0
count_t = 0
s_list = []
t_list = []
for i in range(N):
    if S[i] in C_S:
        C_S[S[i]] += 1
    else:
        C_S[S[i]] = 1
        count_s += 1
for i in range(N):
    if T[i] in C_T:
        C_T[T[i]] += 1
    else:
        C_T[T[i]] = 1
        count_t += 1
check = True
for skey in C_S.keys():
    s_list.append(C_S[skey])
for tkey in C_T.keys():
    t_list.append(C_T[tkey])
s_list.sort()
t_list.sort()

if count_s == count_t:
    for i in range(len(s_list)):
        if s_list[i] != t_list[i]:
            check = False
else:
    check = False

if check:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3632
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

k = int(input())

r = 7 % k
sum_r = r
if r == 0:
    print(1)
    sys.exit()

for i in range(10**6 + 1):
    r *= 10
    r %= k
    sum_r += r
    sum_r %= k
    if sum_r == 0:
        print(i + 2)
        sys.exit()
print(-1)

Measured memory_bytes: 63388
// ※※※ 解答不能 ※※※
// https://img.atcoder.jp/panasonic2020/editorial.pdf
#include <bits/stdc++.h>
using namespace std;

// 標準系となる文字列を作成して, 出力する.
// @param N: 与えられた正の整数.
// @param s: 標準系となる文字列.
// @param x: 追加する文字.
// @return : なし.
void dfs(int N, string s, char x){
    if(s.length() == N){
        printf("%s\n", s.c_str());
    }else{
        for(char c = 'a'; c <= x; c++){
            dfs(N, s + c, ((c == x) ? (char)(x + 1) : x));
        }
    }
}

int main(){
    
    // 1. 入力情報.
    int N;
    scanf("%d", &N);
    
    // 2. 標準系を抽出し, 出力.
    dfs(N, "", 'a');
    return 0;
}

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

char in[11];
pair<pair<string,int>,int> p[100];

int main()
{
  int n;
  cin >> n;
  for(int i=0; i<n; i++)
  {
    int t;
    cin >> in >> t;
    p[i] = make_pair(make_pair(in,-t),i);
  }
  sort(p,p+n);
  for(int i=0; i<n; i++)
  {
    cout << p[i].second+1 << endl;
  }
}


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

int N;

int digit(int n){
	int ans = 0;
	while(n!=0){
		ans += n%10;
		n /= 10;
	}
	return ans;
}

int main(){
	cin >> N;
	int ans = 1e9;
	for(int i=1;i<=N-1;i++){
		ans = min(ans,digit(i) + digit(N-i));
	}
	cout << ans << endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define intarr(arr, n)  ll arr[n];  for (ll i = 0; i < n; i++)  cin >> arr[i]
#define inpvec(vec,n) for(ll i=0;i<n;i++){ll var;cin>>var;vec.push_back(var);}
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define vec vector<ll>
#define pi pair<ll,ll>
#define changeline cout<<endl
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define mod2 998244353
#define NO cout << "NO" <<endl
#define YES cout << "YES" <<endl
#define mem(arr,val) memset(arr,val,sizeof(arr));
const ll mod=1e9+7;
#define piii 3.14159265358979323846264338327950
#define print(a, n, m)     for (ll i = n; i < m; i++) {  cout << a[i] << " "; }  cout << endl
#define con continue

bool prime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
bool isPerfectSquare(ll x) {   
  long double sr = sqrt(x); 
  return ((sr - floor(sr)) == 0); 
} 
bool subsequence_checker(string str1, string str2, ll m, ll n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
    if (str1[m-1] == str2[n-1]) 
        return subsequence_checker(str1, str2, m-1, n-1); 
    return subsequence_checker(str1, str2, m, n-1); 
}
bool cmp(const pair<int,int> &a,  const pair<int,int> &b) 
{ 
    if(a.ff == b.ff)
        return a.ss < b.ss;
    return (a.ff > b.ff); 
}
//////////////////////////////////////////////////// Lets Do It ////////////////////////////////////////////////////////
int gcd(int p, int q){
if(p % q == 0)return q;
return gcd(q, p % q);
}

void solve()
{

    int a = 1, b=1, c=1;
    int k;
    cin>>k;

    ll ans = 0;
    for(int p = a; p<=k ; p++)
    {
        for(int q = b; q<=k ; q++) 
        {
            for(int r = c; r<=k ; r++)
            {   
                int o = gcd(p,q);
                ans += gcd(o,r);
            }        
        }
    }
    cout<<ans;

    return;
}
 
int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
    IOS;
    ll t;
    //cin>>t;
    t=1;

    while(t--){
        solve();
        cout<<endl;
    }

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
} 

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXSIZE=10000020;
int bufpos;
char buf[MAXSIZE];
#define NEG 0
void init(){
    #ifdef LOCAL
        freopen("B.txt","r",stdin);
    #endif
    buf[fread(buf,1,MAXSIZE,stdin)]='\0';
    bufpos=0;
}
#if NEG
int readint(){
    bool isneg;
    int val=0;
    for(;!isdigit(buf[bufpos]) && buf[bufpos]!='-';bufpos++);
    bufpos+=(isneg=buf[bufpos]=='-');
    for(;isdigit(buf[bufpos]);bufpos++)
        val=val*10+buf[bufpos]-'0';
    return isneg?-val:val;
}
#else
int readint(){
    int val=0;
    for(;!isdigit(buf[bufpos]);bufpos++);
    for(;isdigit(buf[bufpos]);bufpos++)
        val=val*10+buf[bufpos]-'0';
    return val;
}
#endif
char readchar(){
    for(;isspace(buf[bufpos]);bufpos++);
    return buf[bufpos++];
}
int readstr(char* s){
    int cur=0;
    for(;isspace(buf[bufpos]);bufpos++);
    for(;!isspace(buf[bufpos]);bufpos++)
        s[cur++]=buf[bufpos];
    s[cur]='\0';
    return cur;
}
ll a[100005];
int main(){
    init();
    int n=readint();
    for(int i=1;i<=n;i++)
        a[i]=readint();
    if (a[n]!=2)
        return puts("-1"),0;
    ll l=2,r=3;
    for(int i=n-1;i;i--){
        if ((l-1)/a[i]==r/a[i])
            return puts("-1"),0;
        if (l%a[i])
            l+=a[i]-l%a[i];
        r-=r%a[i];
        r+=a[i]-1;
    }
    printf("%lld %lld",l,r);
}

Measured memory_bytes: 2048
# &演算子は、bit形式には使えない。でも、数値には使える
d, g = map(int, input().split())
p = [[0, 0] for i in range(d)]
for i in range(d):
    p[i][0], p[i][1] = map(int, input().split())
## bit全探索

ans = 100000
for i in range(2 ** d):
    sum = 0
    ans_tmp = 0
    s = bin(i)
    #　得点の合計とそれまでの数を反映。
    for j in range(d):
        if bin(2 ** j) == bin(2 ** j & i):
            sum += p[j][0] * (j+1) * 100 + p[j][1]
            ans_tmp += p[j][0]
    if sum < g:
        for j in range(d-1, -1, -1):
            if bin(2 ** j) != bin(2 ** j & i):
                for k in range(p[j][0]-1):
                    sum += (j+1) * 100
                    ans_tmp += 1
                    if g <= sum:
                        break
                if g <= sum:
                    if ans_tmp < ans:
                        ans = ans_tmp
                    break
            else:
                continue
    else:
        if ans_tmp < ans:
            ans = ans_tmp
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>

int main(){
 int alphabet[30]={},i=0;
 char moji[100];
 scanf("%s\n",moji);
  while(moji[i] !='\0'){
    alphabet[(int)(moji[i] - 'a')]++;
    i++;
  }
  for(i=0;i<26;i++){
    if((alphabet[i] % 2) !=0){
      printf("No");
      return 0;
    }
  }
  printf("Yes");
}

Measured memory_bytes: 128