akhauriyash/Code-Regression huggingface dataset:
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def f(S, i):
    D = [-1] * len(S)
    P = [set() for _ in range(len(S))]
    
    Q = deque()
    Q.append(i)
    D[i] = 1

    while Q:
        v = Q.popleft()

        for w in S[v]:
            if w in P[v]:
                continue
            
            if D[w] > 0 and D[w] < D[v] + 1:
                return -1

            if D[w] < 0:
                Q.append(w)
            P[w].add(v)
            D[w] = D[v] + 1

    return D[v]


def main():
    N = int(input())
    S = [input().strip() for _ in range(N)]
    L = [set(j for j in range(N) if S[i][j] == "1") for i in range(N)]

    res = -1
    for i in range(N):
        r = f(L, i)
        res = max(res, r) 
    
    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 74260
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
Int INF = 1e18;
double EPS = 0.00000001;
//Int mod = 1e6+3;

Int n, m;
vector<Int> G[200005];
Int depth[200005];
Int deg[200005];
vector<pair<Int, Int>> res;

void dfs(Int cur, Int pre) {
    for (Int i : G[cur]) {
        if (depth[i] == -1) {
            depth[i] = depth[cur] + 1;
            dfs(i, cur);
        }
        else {
            if (depth[i] > depth[cur]) {
                res.emplace_back(cur, i);
                deg[cur]++;
            }
        }
    }
    if (deg[cur] % 2 == 1) {
        res.emplace_back(cur, pre);
        deg[cur]++;
    }
    else {
        if (pre != 0) {
            res.emplace_back(pre, cur);
            deg[pre]++;
        }
    }
}

int main() {
    cin >> n >> m;
    for (Int i = 0; i < m; i++) {
        Int a, b;
        cin >> a >> b;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }
    if (m % 2 == 1) {
        dump(-1);
        return 0;
    }
    memset(depth, -1, sizeof(depth));
    depth[1] = 0;
    dfs(1, 0);
    for (Int i = 0; i < (Int)res.size(); i++) {
        cout << res[i].fi << " " << res[i].se << endl;
    }
    return 0;
}

Measured memory_bytes: 19440
n = gets.to_i
a = gets.split.map(&:to_i)
histo = Hash.new(0)
a.each do |k|
  histo[k] += 1
end
combi = {}
combi2 = {}
histo.each do |k, v|
  combi[k] = v * (v - 1) / 2
  combi2[k] = (v - 1) * (v - 2) / 2
end
combi_sum = combi.values.inject(:+)
a.each do |k|
  puts combi_sum - combi[k] + combi2[k]
end


Measured memory_bytes: 47876
#include<bits/stdc++.h>
using namespace std;
int a[26];
string s; 
int main(){
	cin>>s;
	for(int i=0;i<4;i++)
		a[s[i]-'A']++;
	for(int i=0;i<26;i++)
		if(a[i]!=2&&a[i]!=0){
			cout<<"No";
			return 0;
		}
	cout<<"Yes";
	return 0;
}

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

int main() {
  string s;
  cin>>s;
  int n = s.length();

  for (int i=0; i<n-1; i++) {
    if (s[i] == s[i+1]) {
      cout<<i+1<<" "<<i+2<<endl;
      return 0;
    }
    if (i == n-2) {
      break;
    }
    if (s[i] == s[i+2]) {
      cout<<i+1<<" "<<i+3<<endl;
      return 0;
    }
  }
  cout<<"-1 -1"<<endl;
}

Measured memory_bytes: 512
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict
import bisect

INF = float("inf")
con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, D, A = getlist()
	XH = []
	for i in range(N):
		X, H = getlist()
		XH.append([X, H])
	XH = sorted(XH)
	X = []
	H = []
	for i in range(N):
		X.append(XH[i][0])
		H.append(XH[i][1])

	X.append(INF)

	#回数に変換
	for i in range(N):
		h = H[i]
		if h % A == 0:
			H[i] = int(h // A)
		else:
			H[i] = int(h // A) + 1

	imos = [0] * (N + 1)
	ans = 0
	x = bisect.bisect_right(X, X[0] + 2 * D)
	imos[0] -= H[0]
	imos[x] += H[0]
	ans += H[0]
	for i in range(N - 1):
		imos[i + 1] += imos[i]
		if H[i + 1] + imos[i + 1] > 0:
			x = bisect.bisect_right(X, X[i + 1] + 2 * D)
			ans += H[i + 1] + imos[i + 1]
			imos[x] += H[i + 1] + imos[i + 1]
			imos[i + 1] = -H[i + 1]
	
	print(ans)


if __name__ == '__main__':
	main()

Measured memory_bytes: 104668
n = int(input())
l = [list(map(int,input().split())) for _ in range(n)]
l1 = list( [0 for i in range(n)] for _ in range(n))
for i in l:
  a,b,*c = i
  for j in c:
    l1[a-1][j-1] = 1
for k in l1:
  print(*k)
    


Measured memory_bytes: 6388
#include <iostream>
using namespace std;
static int const MAX_COUNT = 200000;
static int const MIN_VALUE = 1;
static int const MAX_VALUE = 1e9;


int main()
{
    int R[MAX_COUNT], n;
    cin>>n;
    for(int i=0;i<n;i++)cin >> R[i];

    int maxv = MIN_VALUE- MAX_VALUE;
    int minv = R[0];

    for(int i=1;i<n;i++){
      maxv=max(maxv,R[i]-minv);
      minv = min(minv,R[i]);
    }

    cout<< maxv <<endl;

    return 0;
}

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

using namespace std;

long long n, a, b;

int main() {

	scanf("%lld %lld %lld", &n, &a, &b);

	if (a % 2 == b % 2) {
		printf("%lld\n", (b - a) / 2LL);
	} else {
		printf("%lld\n", min((a - 1) + 1, (n - b) + 1) + (b - a - 1) / 2LL);
	}

	return 0;

}

Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
	int a[100001],s,d,f,g,h,i,j,k,z,x;
	scanf("%d %d",&z,&d);
	a[1]=0;
	f=0;
	for(i=2;i<=z;i++){
		scanf("%d",&x);
		a[i]=x+a[i-1];
	}
//	for(i=1;i<=z-1;i++)	printf("a=%d \n",a[i]);
	
	k=0;
	g=1;
	for(i=1;i<=d;i++){
		scanf("%d",&s);
		h=g+s;
	//	printf("h=%d g=%d\n",h,g);
		if(h>g){
			k=((a[h]-a[g])+k)%100000;
		}
		if(h<g){
			k=((a[g]-a[h])+k)%100000;
		}
	//	printf("k=%d\n",k);
		g=h;
	}
	printf("%d\n",k);
	return 0;
}

Measured memory_bytes: 1416
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch EvenRelation | diff EvenRelation.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address EvenRelation.cpp && ./a.out

/*
 
 5/19/2019
 
 5:21-
 
 */

const int MAX_N=1e6+1;
vector<pair<LL,int>> G[MAX_N];
int N;

int res[MAX_N];
void dfs(int u, int pre, int col) {
  res[u]=col;
  FORR(p,G[u]) if(p.second!=pre) {
    LL w=p.first;
    int col2=w%2==0?col:1-col;
    dfs(p.second,u,col2);
  }
}
void solve() {
  dfs(0,-1,0);
  REP(i,N) cout<<res[i]<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N;
  REP(i,N-1) {
    int u,v; LL w; cin>>u>>v>>w;
    --u,--v;
    G[u].emplace_back(w,v);
    G[v].emplace_back(w,u);
  }
  solve();
  
  return 0;
}


Measured memory_bytes: 33536
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;

int main(){
  int a;
  string s;
  cin>>a>>s;
  if(a>=3200)cout<<s;
  else cout<<"red";

}


Measured memory_bytes: 3596
from collections import deque
from sys import stdin
input = stdin.readline

INF = 1 << 21


def main():
  H, W = list(map(int, input().split()))
  M = [input()[:-1] for _ in range(H)]

  blacks = deque()
  whites = []
  d = [[INF]*W for _ in range(H)]
  for i in range(H):
    for j in range(W):
      if M[i][j] == '#':
        blacks.append((i, j))
        d[i][j] = 0
      elif M[i][j] == '.':
        whites.append((i, j))

  def bfs(q, d):
    is_visited = [[0]*W for _ in range(H)]
    while len(q):
      ur, uc = q.popleft()
      d_ur = d[ur]
      for vr, vc in [(ur+1, uc), (ur-1, uc), (ur, uc-1), (ur, uc+1)]:
        if 0 <= vr < H and \
           0 <= vc < W:

          d_vr = d[vr]
          is_visited_vr = is_visited[vr]
          if not(is_visited_vr[vc]) and not(M[vr][vc] == '#') and \
             (d_vr[vc] > d_ur[uc] + 1):

            d_vr[vc] = d_ur[uc] + 1
            is_visited_vr[vc] = True
            q.append((vr, vc))
    return d_ur[uc]

  print(bfs(blacks, d))


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

Measured memory_bytes: 167756
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;

using namespace std;
int MOD = 1000000007;


int n,m,x;
struct b {
  int c;
  int a[20];
};
vector<struct b> bs;

int check(int mask) {
  vector<int> v(n);
  for(int i = 0; i < n; ++i ) {
    if( (mask & (1 << i)) != 0 ) {
      for(int j = 0; j < m; ++j) {
        v[j] += bs[i].a[j];
      }
    }
  }
  int ok = 1;
  for(int i = 0; i < m; ++i) {
    if( v[i] >= x) continue;
    else {
      ok = 0;
      break;
    }
  }
  return ok;
}

int cost(int mask) {
  int ret = 0;
  for(int i = 0; i < n; ++i ) {
    if( (mask & (1 << i)) != 0 ) {
      ret += bs[i].c;
    }
  }
  return ret;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m >> x;
  bs.resize(n);
  REP(i,n) {
    int c;
    cin >> c;
    bs[i].c = c;
    REP(j,m) {
      int a2;
      cin >> a2;
      bs[i].a[j] = a2;
    }
  }
 // REP(i,n) {
 //   cout << bs[i].c << endl;
 //   REP(j,m) {
 //      cout << bs[i].a[j] << " " << endl;
 //   }
 //   cout << endl;
 // }
  int ret = 1e9;
  for(int mask = 0 ; mask < (1 << n) ; ++mask) {
    if( check(mask) ) {
      ret = min(ret,cost(mask));
    } 
  
  }
  if( ret != 1e9 ) {
    cout << ret << endl;
  }else {
    cout << -1 << endl;
  }


  return 0;
}



Measured memory_bytes: 3224
from collections import deque
que = deque()

n = int(input())
for _ in range(n):
    command = input()
    if command == 'deleteFirst':
        que.popleft()
    elif command == 'deleteLast':
        que.pop()
    else:
        x, y = command.split()
        if x == 'insert':
            que.appendleft(int(y))
        elif int(y) in que:
            que.remove(int(y))

print(' '.join(map(str, que)))


Measured memory_bytes: 45944
#include <stdio.h>

int main(void)
{
	int ka, ki, ku, i = 0, x;

	scanf("%d %d %d", &ka, &ki, &ku);

	for (x = ka; x <= ki; x++){

		if (ku % x == 0)
		i++;

		else;
	}
	printf("%d\n" ,i);
	return 0;
}

Measured memory_bytes: 1028
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>
using namespace std;
#define ll long long

int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    for(int i = 0; i < n-1; i++) {
        int a;
        cin >> a;
        mp[a]++;
    }
    for(int i = 1; i <= n; i++) {
        cout << mp[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 12972
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;

int main(){
    int mod=1000000007;
    int n;
    int w[10];
    w[0]=1;
    for (int i=1;i<10;++i) {
        w[i]=w[i-1]<<1;
    }
    while (scanf("%d",&n)!=EOF) {
        int tmp=0;
        stack<int> st;
        for (int i=9;i>=0;--i) {
            if (w[i]<=n) {
                st.push(w[i]);
                n-=w[i];
                tmp++;
            }
        }
        for (int i=0;i<tmp-1;++i) {
            printf("%d ",st.top());
            st.pop();
        }
        printf("%d\n",st.top());
    }
    return 0;
}

Measured memory_bytes: 3216
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int l = sc.nextInt();
		
		int sum = n*(2*l + n - 1)/2;
		
		if(l >= 0) {
			sum -= l;
		}
		else if(l <= -n) {
			sum -= l + n - 1;
		}
		
		System.out.println(sum);
	}

}


Measured memory_bytes: 23892
using System;

class Program
{
    static void Main(string[] args)
    {
        var nm = Console.ReadLine().Split();
        var n = int.Parse(nm[0]);
        var m = int.Parse(nm[1]);
        var a = new int[m];
        for (int i = 0; i < m; i++)
        {
            a[i] = int.Parse(Console.ReadLine());
        }

        var dp = new int[n + 1];
        dp[0] = 1;
        for (int i = 1; i < n + 1; i++)
        {
            if (m1(a, i, 0, m)) continue;

            if (i < 2)
            {
                dp[i] = dp[i - 1];
            }
            else
            {
                dp[i] = dp[i - 1] + dp[i - 2];
            }
            dp[i] %= 1000000007;
        }

        Console.WriteLine(dp[n]);
    }

    static bool m1(int[] a, int n, int x, int y)
    {
        if (x == y)
        {
            if (0 <= x && x < a.Length)
            {
                return a[x] == n;
            }
            else
            {
                return false;
            }
        }

        var k = (x + y) / 2;
        if (n <= a[k]) return m1(a, n, x, k);
        else return m1(a, n, k + 1, y);
    }
}


Measured memory_bytes: 13664
s = input()

if 0<int(s[:2])<13:
  if 0<int(s[2:])<13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 0<int(s[2:])<13:
    print("YYMM")
  else:
    print("NA")
    

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

typedef long long ll;

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

int main()
{
    ll n, m;
    std::string s, t;
    std::cin >> n >> m >> s >> t;
    ll g = gcd(n, m);
    ll l = n / g * m; //lとは最小公倍数lcmのこと
    ll sstep = n / g;
    ll tstep = m / g;
    for(int i = 0; i < g; i++){
        if(s[sstep*i] != t[tstep*i]){
            std::cout << -1 << std::endl;
            return 0;
        }
    }

    std::cout << l << std::endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    string s;
    cin>>s;
    int ans=0;
    rep(i,s.size()-1){
        if(s[i]!=s[i+1]) ++ans;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i,a) for(long i=0;i<(a);++i)

int H, W;
int main() {
    std::cin >> H >> W;
    int cnt = 0;

    char c;
    REP(i, H) {
        REP(j, W) {
            std::cin >> c;
            cnt += (int)(c == '#');
        }
    }

    std::cout << (((H+W-1) == cnt) ? "Possible" : "Impossible") << std::endl; 
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        FKnapsackForAllSegments solver = new FKnapsackForAllSegments();
        solver.solve(1, in, out);
        out.close();
    }

    static class FKnapsackForAllSegments {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            int s = in.nextInt();
            int[] a = new int[n];

            ModInt[][] dp = new ModInt[n][3001];
            ModInt ans = new ModInt(0);
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }

            for (int i = 0; i <= s; i++) {
                dp[0][i] = new ModInt(0);
            }
            dp[0][a[0]] = new ModInt(1);
            for (int i = 1; i < n; i++) {
                for (int j = 1; j <= s; j++) {
                    if (j < a[i]) {
                        dp[i][j] = dp[i - 1][j];
                    } else if (j == a[i]) {
                        dp[i][j] = dp[i - 1][j].add(i + 1);
                    } else {
                        dp[i][j] = dp[i - 1][j].add(dp[i - 1][j - a[i]]);
                    }
                }
                ans = ans.add(dp[i][s]);
            }

            out.println(ans.getVal());

        }

    }

    static class ModInt {
        long val;
        int MOD = 998244353;

        public ModInt(long i) {
            this.val = (int) ((i + MOD) % MOD);
        }

        public ModInt add(long l) {
            return new ModInt(this.val + l);
        }

        public ModInt add(ModInt m) {
            return new ModInt(this.val + m.getVal());
        }

        public long getVal() {
            return val;
        }

    }
}



Measured memory_bytes: 291848
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

void solve(ll a, ll b) {
  auto d = b - a - 1;
  auto ans = (d * (d+1))/2 - a;
  cout << ans << endl;
}

int main() {
  ll a;
  cin >> a;
  ll b;
  cin >> b;
  solve(a, b);
  return 0;
}


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

using namespace std;
using p = pair<long long, int>;
#define INF 100000000
using Graph = vector<vector<int> >;

int main(){
	long long x;
	cin >> x;
	int year = 0;
	long long bank = 100;
	
	while(bank < x){
		bank*=1.01; year++;
		
	}
	 cout << year << endl;
	
}
	
	


Measured memory_bytes: 3632
N,M,H=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for i in range(N):
  A=list(map(int,input().split()))
  ans=0
  for k in range(M):
    ans+=A[k]*B[k]
  if ans+H>0:
    count+=1
print(count)


Measured memory_bytes: 9104
/* おまじない　*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

int main(){
    init();
    ll N,A,B,C,D;cin>>N>>A>>B>>C>>D;
    string s;cin>>s;
    A--;B--;C--;D--;
    if(D<C){
        //間に岩2つ連続であったらだめ
        for(int i=A;i<C;i++){
            if(s[i]=='#'&&s[i+1]=='#'){
                //アウト
                cout<<"No"<<endl;
                return 0;
            }
        }
        for(int i=B;i<D;i++){
            if(s[i]=='#'&&s[i+1]=='#'){
                //アウト
                cout<<"No"<<endl;
                return 0;
            }
        }

        //抜かさなきゃいけない
        bool isOK=false;
        for(int i=B-1;i<D;i++){
            if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.')isOK=true;
        }
        if(isOK)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        return 0;
    }
    //間に岩2つ連続であったらだめ
    for(int i=A;i<C;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            //アウト
            cout<<"No"<<endl;
            return 0;
        }
    }
    for(int i=B;i<D;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            //アウト
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;    
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin >> n;
    int t=1;
    ll num=1;
    ll sum=0;
    while(sum+num*26<n){
        t++;
        num*=26;
        sum+=num;
    }
    vector<ll> x(t);
    x[0]=1;
    FOR(i,1,t){
        x[i]=x[i-1]*26;
    }
    ll res=0;
    string ans="";
    n-=sum;
    n--;
    REP(i,t){
        for(ll j=25;j>=0;j--){
            if(res+j*x[t-1-i]<=n){
                res+=j*x[t-1-i];
                ans.push_back(char(j+'a'));
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3652
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>

#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const int INF = 1e9+7;
const ll mod = 998244353;


string S;
ll N,ans,K;


int main() {

	cin >> N >> K;
	cin >> S;

	S[K - 1] += 32;

	cout << S << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
using ll = long long;
using ui = unsigned int;


int main() {
    ll L, R;
    cin >> L >> R;
    ll MOD = 2019;

    ll res = 1e10;
    for(ll i = L; i < R; i++) {
        for (ll j = i+1; j <= R; j++) {
            res = min(res, i*j % MOD);
            if (res == 0)
                goto OUTPUT;
        }       
    }
OUTPUT:
    cout << res << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    int cnt = 1, p = 1;
    while(cnt<n){
        p = a[p-1];
        if(p==2){
            break;
        }
        cnt++;
    }
    if(p==2){
        cout << cnt << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3780
use std::io::Read;
use std::cmp::min;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: isize = iterator.next().unwrap().parse().unwrap();
    let x: isize = iterator.next().unwrap().parse().unwrap();
    let y: isize = iterator.next().unwrap().parse().unwrap();

    let mut counts: Vec<usize> = vec![0; (n + 1) as usize];

    for i in 1..n {
        for j in i + 1 .. n + 1 {
            let mut count = j - i;
            count = min(count, (x - i).abs() + 1 + (j - y).abs());
            counts[count as usize] += 1;
        }
    }

    let mut ans = String::new();
    for i in 1..n {
        ans.push_str(&format!("{}\n", counts[i as usize]))
    }
    return ans.trim().to_string();
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;


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

    vector<int> numbers;

    //ベクターnを構成
    for (auto a : n) {
        numbers.push_back(a - '0');
    }
    int l = n.size();  //nの長さ

    vector<vector<vector<ll>>> dp(l + 1, vector<vector<ll>>(2, vector<ll>(5, 0)));

    dp[0][0][0] = 1;  //初期条件。他は0で初期化されている
    for (int i = 0; i < l; i++) {
        for (int smaller = 0; smaller < 2; smaller++) {
            for (int j = 0; j < 5; j++) {
                for (int x = 0; x <= (smaller ? 9 : numbers[i]); x++) {
                    if (x != 0) {
                        dp[i + 1][smaller || x < numbers[i]][min(j + 1, 4)] += dp[i][smaller][j];
                    } else {
                        dp[i + 1][smaller || x < numbers[i]][j] += dp[i][smaller][j];
                    }
                }
            }
        }
    }

    cout << dp[l][0][k] + dp[l][1][k] << endl;

}




Measured memory_bytes: 256
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;

// code
// ------------------------------------------------
int main() {

  string n;
  cin >> n;

  ll keta = sz(n);
  if(keta == 1)
  {
    // この場合はそのままの数が一番大きい
  }
  else
  {
    // 繰り下がって全部9にしたほうが大きいか、そのまま（＝上から2桁目以降が全部9）がいいか。
    bool flg = true;
    for(int i = 1; i < keta; ++i)
    {
      if(n[i] != '9')
      {
        flg = false;
        break;
      }
    }

    if(flg)
    {
      // そのままがいい
    }
    else
    {
      if(n[0] == 1)
      {
        keta--;
        n[0] = '9';
      }
      else
      {
        n[0]--;
      }
    }
  }
  
  
  ll first = n[0] - 48;
  ll ans = first + 9 * (keta - 1);

  cout << ans << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
import java.util.Scanner;

import java.util.*;


public class Main {

    public static void main(String[] args) {

      Scanner scanner = new Scanner(System.in);
 
      String as = scanner.nextLine();
      String bs = scanner.nextLine();
      String cs = scanner.nextLine();

      Map<Character, char[]> members = new HashMap<>();
      members.put(Character.valueOf('a'), as.toCharArray());
      members.put(Character.valueOf('b'), bs.toCharArray());
      members.put(Character.valueOf('c'), cs.toCharArray());

      char current = 'a';

      while(true) {
        char[] cards = members.get(current);
        if (cards.length == 0) {
          System.out.println(String.valueOf(current).toUpperCase());
          break;
        }

        char prev = current;
        current = cards[0];

        char[] tmpCards = new char[cards.length - 1];
        for (int i = 0; i < cards.length - 1; i++){
          tmpCards[i] = cards[i + 1];
        }

        members.put(Character.valueOf(prev), tmpCards);
      }

      scanner.close();
  }
}


Measured memory_bytes: 22612
x1, x2, x3, x4, x5 = gets.chomp.split(" ").map(&:to_i)

if x1 == 0
  puts "1"
elsif x2 == 0
  puts  "2"
elsif x3 == 0
  puts "3"
elsif x4 == 0
  puts "4"
elsif x5 == 0
  puts "5"
end

Measured memory_bytes: 14220
#include <bits/stdc++.h>
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
using namespace std;

typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;

template <typename _T>
inline void read(_T &f) {
    f = 0; _T fu = 1; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') fu = -1; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    f *= fu;
}

template <typename T>
void print(T x) {
    if(x < 0) putchar('-'), x = -x;
    if(x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}

template <typename T>
void print(T x, char t) {
    print(x); putchar(t);
}

const double PI = acos(-1.0);
const int N = 3005;

int a[N];
double sx, sy;
int n, L;

int main() {
    read(n); read(L);
    for(register int i = 1; i <= n; i++) read(a[i]);
    for(register int i = 1; i <= n; i++) {
        for(register int j = i + 1; j <= n; j++) {
            double a1 = (double)(a[i] + a[j]) / 2 / L, a2 = a1 + 0.5;
            if(a2 >= 1) a2 -= 1;
            sx += cos(a1 * 2 * PI) * (n - (j - i + 1));
            sy += sin(a1 * 2 * PI) * (n - (j - i + 1));
            sx += cos(a2 * 2 * PI) * (j - i - 1);
            sy += sin(a2 * 2 * PI) * (j - i - 1);
        }
    }
    ll cnt = 1ll * n * (n - 1) * (n - 2) / 6;
    printf("%.9lf %.9lf\n", sx / cnt, sy / cnt);
    return 0;
}

Measured memory_bytes: 256
// comment
// x, y 분리해서 생각하다가 망함. 그래프 그렸으면 바로 풀었을 듯
#include <bits/stdc++.h>

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
using ll = long long;
using pi = pair<int, int>;
const int INF = 0x3f3f3f3f;
const ll LINF = 1ll * INF * INF;

const int MAX_N = 1e3 + 10;

int N, Nr[MAX_N][2];
// R, U, L, D;
int cx[4] = {1, 0, -1, 0};
int cy[4] = {0, 1, 0, -1};
vector<int> Line;
vector<int> Ans[MAX_N];

void pushAns(int i, int x, int y, int l) {
	if(x == 0 && y == 0) return;
	int k = -1;
	if (x-y > 0 && x+y > 0) k = 0;
	else if (x-y < 0 && x+y > 0) k = 1;
	else if (x-y < 0 && x+y < 0) k = 2;
	else k = 3;
	Ans[i].push_back(k);
	pushAns(i, x-cx[k]*l, y-cy[k]*l, l>>1);
}

int main() {
	cin >> N;
	for(int i=0; i<N; i++) for(int j=0; j<2; j++) scanf("%d", &Nr[i][j]);

	int value = abs(Nr[1][0]+Nr[1][1]) % 2;
	for(int i=0; i<N; i++) {
		if(value != abs(Nr[i][0]+Nr[i][1])%2) {
			puts("-1");
			return 0;
		}
	}
	if((Nr[1][0] + Nr[1][1]) % 2 == 0) {
		Line.push_back(1);
		for(int i=0; i<N; i++) {
			int k = 0;
			Nr[i][0] -= cx[k] * 1;
			Ans[i].push_back(k);
		}
	}
	int K = 30;
	for(int k=K; k>=0; k--) Line.push_back(1<<k);
	for(int i=0; i<N; i++) {
		pushAns(i, Nr[i][0], Nr[i][1], 1<<K);
	}

	printf("%d\n", SZ(Line));
	for(int x: Line) printf("%d ", x); puts("");
	for(int i=0; i<N; i++) {
		string S="RULD";
		for(int k: Ans[i]) printf("%c", S[k]); puts("");
	}
	return 0;
}


Measured memory_bytes: 3932
# https://atcoder.jp/contests/abc089/tasks/abc089_c

import itertools
import collections
import bisect

def main():
    N = int(input())
    A = {}
    for key in ['M', 'A', 'R', 'C', 'H']:
        A[key] = []
    for _ in range(N):
        a = input()
        if a[0] in ['M', 'A', 'R', 'C', 'H']:
            A[a[0]].append(a)

    # print(A)
    ans = 0

    for c in itertools.combinations(['M', 'A', 'R', 'C', 'H'], 3):
        ans += len(A[c[0]]) * len(A[c[1]]) * len(A[c[2]])

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10540
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<pii> p(n);
	vector<pii> f(m);
	for (int i = 0; i < n; i++) {
		cin >> p[i].fs >> p[i].sc;
	}
	for (int i = 0; i < m; i++) {
		cin >> f[i].fs >> f[i].sc;
	}
	for (int i = 0; i < n; i++) {
		int min = INF,minpos;
		for (int j = 0; j < m; j++) {
			int tmp = abs(f[j].fs - p[i].fs) + abs(f[j].sc - p[i].sc);
			if (tmp < min) {
				min = tmp;
				minpos = j;
			}
		}
		cout << minpos+1 << endl;
	}
}


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

using namespace std;

struct edge {
    int to, cost;
};

vector<edge> G[200010];
bool vis[100010];
int d[100010];

bool dfs(int v, int dist) {
    if (vis[v]) {
        if (d[v] != dist) {
            return true;
        }
        else {
            return false;
        }
    }
    vis[v] = true;
    d[v] = dist;
    for (int i = 0; i < (int)G[v].size(); i++) {
        if (dfs(G[v][i].to, d[v] + G[v][i].cost)) {
            return true;//その頂点における判定で一つでも矛盾があれば、全てtrueを返して終了。
        }
        //何も矛盾が無ければ次のリストを見る。
    }
    return false;//連結している頂点が最後まで探索できたという証。
}

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

    for (int i = 0; i < M; i++) {
        int L, R, D;
        cin >> L >> R >> D;
        L--; R--;
        G[L].push_back({ R,D });
        G[R].push_back({ L,-D });
    }
    for (int i = 0; i < N; i++) {//連結していない頂点があった場合に探索していく
        if (!vis[i] && dfs(i, 0)) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 14464
#include<stdio.h>
int main(){
	long i, cnt, hikaku=0, min=0, max=0; 
	long sum=0;
	scanf("%ld", &cnt);
	long number[cnt];
	// init number[]
	for(i=0;i < cnt;i++){
		number[i] = 0;
	}
	
	for(i=0;i < cnt;i++){
		scanf("%ld", &number[i]);
	}
	hikaku = number[0];
	for(i=0;i < cnt;i++){
		if(number[i] <= hikaku){
			min=number[i];
			hikaku = min;
		}
	}
	hikaku = number[0];
	for(i=0;i < cnt;i++){
		if(number[i] >= hikaku){
			max=number[i];
			hikaku = max;
		}
	}
	for(i=0;i < cnt;i++){
		sum = sum + number[i];
	}
	printf("%ld %ld %ld\n", min, max, sum);
	return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
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; }
//end

vector<int> g[101000];

int dfs(int v,int p){
   int res=0;
   for(int nxt:g[v])if(nxt!=p)res^=dfs(nxt,v);
   return res+1;
}

int main(){
   int n; scanf("%d",&n);
   rep(_,0,n-1){
      int x,y; scanf("%d%d",&x,&y); x--; y--;
      g[x].push_back(y); g[y].push_back(x);
   }
   printf(dfs(0,-1)==1?"Bob\n":"Alice\n");
   return 0;
}

Measured memory_bytes: 10368
W, H, N = map(int, input().split())
ans = W*H
L_x = 0
D_y = 0


for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        if x >= W:
            ans = 0
            break
        elif L_x <= x < W:
            L_x = x

    elif a == 2:
        if x <= L_x:
            ans = 0
            break
        elif L_x <= x <= W:
            W = x

    elif a == 3:
        if H <= y:
            ans = 0
            break
        elif D_y <= y < H:
            D_y = y

    else:
        if y <= D_y:
            ans = 0
            break
        elif D_y < y <= H:
            H = y
if ans == 0:
    print(ans)
else:
    print((H - D_y) * (W - L_x))


Measured memory_bytes: 3064
#include<iostream>
#include<map>
#include<set>

using namespace std;

int main(){
  int n, m;
  string s[109];
  map<string , int> mp;
  cin >>n;
  for(int i=0;i<n;i++){
    cin >> s[i];
    mp[s[i]]++;
  }
  cin >> m;
  for(int j=0;j<m;j++){
    string tmp;
    cin >> tmp;
    mp[tmp]--;
  }
  int mx=0;
  for(int i=0;i<n;i++){
    mx = max(mx, mp[s[i]]);
  }
  cout << mx << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long long ll;

template <typename T> void max_self(T& a, T b){
  a = max(a,b);
}

template <typename T> void min_self(T& a, T b){
  a = min(a,b);
}

void solve(){	
  int n;cin>>n;
  if(n%1000)
    cout<<1000-(n%1000)<<endl;
  else
    cout<<0<<endl;
}

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


Measured memory_bytes: 3656
def resolve():
    a, b, c = map(int, input().split())
    if a%2 != 0 or b%2 != 0 or c%2 != 0:
        print(0)
        exit()
    if a == b == c:
        print(-1)
        exit()
    ans = 0
    while (a % 2 == 0 and b % 2 == 0 and c % 2 == 0): 
        a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
        ans += 1
    print(ans)
resolve()

Measured memory_bytes: 9044
import java.util.*;

class Main {
public static void main(String[] args){

Scanner sc = new Scanner(System.in);
String s1 = sc.next();
String s2 = sc.next();
String s3 = sc.next();
s1 = s1.substring(0,1);
s1 = s1.toUpperCase();
s2 = s2.substring(0,1);
s2 = s2.toUpperCase();
s3 = s3.substring(0,1);
s3 = s3.toUpperCase();
System.out.println(s1 + s2 + s3);


}
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    string S; cin >> S;
    cout << S.substr(0, 3) << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int main(){
	int n,i;
	int A[100];
	cin>>n;
	for(i=0;i<n;i++){
		cin>>A[i];
	}
	for(i=n-1;i>=0;i--){
		if(i>0)cout<<A[i]<<" ";
	}
        cout<<A[0]<<endl;
}


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

int main() {
    ll k;
    cin >> k;
    ll now=0;
    ll count=0;
    while(count<100000000){
        count++;
        now=(now*10+7)%k;
        if(now==0){
            cout << count << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

ll p[100010];
ll q[100010];
ll r[100010];

void solve(){

    ll x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;
    rep(i,a){
        cin >> p[i];
    }
    rep(i,b){
        cin >> q[i];
    }
    rep(i,c){
        cin >> r[i];
    }
    sort(p,p+a,greater<ll>());
    sort(q,q+b,greater<ll>());
    sort(r,r+c,greater<ll>());

    priority_queue< ll,
      std::vector<ll>,
      std::greater<ll> > que;

      ll ans = 0;
    rep(i,x){
        que.push(p[i]);
        ans += p[i];
    }
    rep(i,y){
        que.push(q[i]);
        ans += q[i];
    }

    ll pointer=0;
    while(que.top()<r[pointer]){
        ans -= que.top();
        que.pop();
        ans += r[pointer];
        pointer++;
    }

    cout << ans << endl;



}

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


Measured memory_bytes: 4724
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define ALL(obj) (obj).begin(),(obj).end()

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template<class T> void corner(bool flg, T hoge) {
	if (flg) {
		cout << hoge << endl;
		exit(0);
	}
	else return;
}

template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {
	o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;
}

template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {
	o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;
}

template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {
	o << "{" << obj.first << ", " << obj.second << "}"; return o;
}

template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

void print(void) {
	cout << endl;
}

template <class Head> void print(Head&& head) {
	cout << head;
	print();
}

template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {
	cout << head << " ";
	print(forward<Tail>(tail)...);
}

void YN(bool flg) {
	cout << ((flg) ? "YES" : "NO") << endl;
}

void Yn(bool flg) {
	cout << ((flg) ? "Yes" : "No") << endl;
}

void yn(bool flg) {
	cout << ((flg) ? "yes" : "no") << endl;
}

int main() {
	int N, Ma, Mb,ans = 10000; cin >> N >> Ma >> Mb;
	V<int> a(N+1,0), b(N+1,0), c(N+1,0);
	FOR(i,1,N+1) cin >> a[i] >> b[i] >> c[i];
	V<V<V<int>>> dp(41, V<V<int>>(401, V<int>(401, 10000)));
	dp[0][0][0] = 0;
	FOR(i,1,N+1){
		REP(j,401){
			REP(k,401){
				dp[i][j][k] = min(dp[i][j][k], dp[i - 1][j][k]);
				if (j - a[i] < 0 || k - b[i] < 0) continue;
				dp[i][j][k] = min(dp[i][j][k], dp[i - 1][j - a[i]][k - b[i]] + c[i]);
			}
		}
	}
	FOR(j,1,401) {
		FOR(k,1,401) {
			if(j*Mb==k*Ma)ans = min(ans,dp[N][j][k]);
		}
	}
	cout << ((ans==10000)?-1:ans) << endl;
	return 0;
}



Measured memory_bytes: 27264
N = input()
book = []
for i in range(int(N)):
    book.append(list(input().split()))
    book[i][1]=int(book[i][1])
    book[i][1] *= -1
    book[i].append(i+1)
book.sort()
for i in range(int(N)):
    book[i][1] *= -1
    print(book[i][2])

Measured memory_bytes: 3060
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

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

func main() {
	defer stdout.Flush()
	a := readInt()
	b := readInt()
	c := readInt()

	if a == b && b == c {
		println("Yes")
	} else {
		println("No")
	}
}

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


Measured memory_bytes: 640