akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    string s; cin>>s;
    vector<vi> dp(n+1,vi(n+1));
    int ans=0;
    rep(i,n)rep(j,n){
        if (s[i]==s[j]) dp[i+1][j+1]=min(dp[i][j]+1,j-i);
        chmax(ans,dp[i+1][j+1]);
    }
    cout<<ans<<"\n";
    return 0;
}


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

using namespace std;

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

    map<int, int> mp;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        mp[a]++;
    }

    int ans = 0;
    for (auto &p:mp) {
        int x = p.first;
        int cnt = p.second;
        if (cnt >= x) {
            ans += cnt - x;
        } else {
            ans += cnt;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4736
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX = 8;
int main()
{
  int n,i,f=0,ff,res=0;
  int p[N_MAX],q[N_MAX];
  cin >> n;
  for(i=0;i<n;i++)
    cin >> p[i];
  for(i=0;i<n;i++)
    cin >> q[i];
  for(i=0;i<n;i++)
    if(p[i]<q[i]){
      f=1; break;
    }else if(p[i]>q[i]){
      f=-1; break;
    }
  if(f>0){
    do{
      ff=0;
      for(i=0;i<n;i++)
        if(p[i]!=q[i]){
          ff=1; break;
        }
      if(ff==0){
        cout << res << endl;
        return 0;
      }
      res++;
    }while(next_permutation(p,p+n));
  }else if(f<0){
    do{
      ff=0;
      for(i=0;i<n;i++)
        if(p[i]!=q[i]){
          ff=1; break;
        }
      if(ff==0){
        cout << res << endl;
        return 0;
      }
      res++;
    }while(next_permutation(q,q+n));
  }else{
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 256
c1 = [int(i) for i in input().split()]
c2 = [int(i) for i in input().split()]
c3 = [int(i) for i in input().split()]
flag = False

if c1[1] - c1[0] == c2[1]- c2[0]:
    if c1[1] - c1[0] == c3[1]- c3[0]:
        if c1[2] - c1[0] == c2[2]- c2[0]:
            if c1[2] - c1[0] == c3[2]- c3[0]:
                if c1[0] - c2[0] == c1[1] - c2[1]:
                    if c1[0] - c2[0] == c1[2] - c2[2]:
                        if c1[0] - c3[0] == c1[1] - c3[1]:
                            if c1[0] - c3[0] == c1[2] - c3[2]:
                                flag = True
                                print('Yes')
if not flag:
    print('No')

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

int main() {
    int d,n;
  cin>>d>>n;
  int kosu=0;
  int i=1;
  
  while(kosu<n){
    int kaisu =0;
    int j=i;
    while(i%100==0){
      i/=100;
      kaisu++;}
    if(kaisu==d){
      kosu++;}
    i=j;
    i++;}
  cout << i-1<<endl;
}


Measured memory_bytes: 256
from collections import deque
N, M = map(int, input().split())  # N頂点, M個の辺

graph = [[] for _ in range(N)]
edges = []

# グラフを定義する
# あとで辺の情報を使いたいから辺を格納するリストを用意する
for i in range(M):
    a, b = map(lambda x: int(x)-1, input().split())
    graph[a].append(b)
    graph[b].append(a)
    edges.append((a, b))


ans = 0
# ある辺を取り除いても全頂点に到達できるかを幅優先で調べる、最後にその辺を戻してあげる
for a, b in edges:
    graph[a].remove(b)
    graph[b].remove(a)
    q = deque([0])  # 開始のノード
    flag = [False] * N

    while len(q):
        v = q.pop()

        flag[v] = True  # 部分木の根を到達済みにする
        for e in graph[v]:  # vを根にもつノード全てに操作をする
            # graphは子のみを格納するのではなく、そのノードから出ている辺を
            # 親とか子供とか関係なく全て格納してしまうため、親の方向に
            # 対して走っていかないようにflagで管理する
            if flag[e]:  # 頂点eがvの親であればスルー
                continue

            # この時点でeはvの子供であることが確定する
            q.append(e)

    graph[a].append(b)
    graph[b].append(a)
    if not all(flag):
        ans += 1

print(ans)


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

using namespace std;

template <class T> using V = vector<T>;

using ll = long long;
using ch = char;
using vch = V<ch>;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)

void Solve();

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

void Solve(){
  ll n;
    cin>>n;
  ll past=0;
  vch s(0);
  FOR(i,0,n){
    ll now;
      cin>>now;
    if(i>0){
      if(past<now){
        s.push_back('<');
      }
      else if(past>now){
        s.push_back('>');
      }
    }
    past=now;
  }

  ll a=s.size();
  ll ans=1;

  FOR(i,0,a-1){
    if(s[i]!=s[i+1]){
      ans++;
      i++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main (){
    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;
    int mx;
    mx = e-a;
    if( mx > k ){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }
}



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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define all(v) (v).begin(), (v).end()

typedef long long ll;

template <class T = int>
T in() { T x; cin >> x; return x; }
#define output(e) cout << e << '\n'

#ifdef LOCAL
#define dr_elem(x) cout << #x << "->" << x << " "
#define dr_end() << "\n"
#else
#define dr_elem(x)
#define dr_end(x)
#endif


//
// Implementation
//

ll calc_sum(int N, vector<int> a, ll sum, ll start) {
  ll prev = start;
  for (int i=1; i<N; i++) {
    ll curr = prev + a[i];
    dr_elem(prev); dr_elem(curr); dr_elem(a[i]) dr_end();
    if (prev < 0 && curr < 0) {
      sum += abs(curr) + 1;
      curr = 1;
    } else if (prev > 0 && curr > 0) {
      sum += abs(curr) + 1;
      curr = -1;
    } else if (prev > 0 && curr == 0) {
      curr -= 1;
      sum++;
    } else if (prev < 0 && curr == 0){
      curr += 1;
      sum++;
    }
    prev = curr;
  }
  return sum;
}

int main() {
  int N = in();
  vector<int> a(N);
  rep(i, N) a[i] = in();

  int start1;
  int start2;
  ll sum1 = 0;
  ll sum2 = 0;
  if (a[0] == 0) {
    start1 = 1;
    start2 = -1;
    sum1 += 1;
    sum2 += 1;
  } else {
    start1 = a[0];
    if (a[0] > 0) {
      start2 = -1;
    } else {
      start2 = 1;
    }
    sum2 += abs(a[0]) + 1;
  }
  
  ll res1 = calc_sum(N, a, sum1, start1);
  ll res2 = calc_sum(N, a, sum2, start2);
  
  output(min(res1, res2));
}


Measured memory_bytes: 1028
#include<stdio.h>
#include<math.h>
main(){
	double x1,y1,x2,y2;
	double d2jou,d;

	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
//	printf("%f %f %f %f\n",x1,y1,x2,y2);
	d2jou = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
	d = sqrt(d2jou);
	
	printf("%f\n",d);

	return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>h(n); for(auto&&i:h)cin>>i;
	h.emplace_back(0);
	vector<int>dp(n+1,1e9+1); dp.front()=0;
	for(int i=0;i<n-1;++i){
		dp.at(i+1)=min(dp.at(i+1),dp.at(i)+abs(h.at(i+1)-h.at(i)));
		dp.at(i+2)=min(dp.at(i+2),dp.at(i)+abs(h.at(i+2)-h.at(i)));
	}
	cout<<dp.at(n-1)<<"\n"s;
}


Measured memory_bytes: 3972
using System;
using System.Collections.Generic;

class AOJ
{

    public static void Main()
    {
        string str;
        int rect = 0, loze = 0;

        while ((str = Console.ReadLine()) != null)
        {
            string[] s = str.Split(',');
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            int c = int.Parse(s[2]);

            if (c * c == a * a + b * b)
                rect++;
            else if (a == b)
                loze++;
        }
        Console.WriteLine(rect);
        Console.WriteLine(loze);
    }
}

Measured memory_bytes: 5604
function gcd(a, b){
  if (a%b == 0) return b;
  return gcd(b, a%b);
}

function lcm(a, b){
  return a*b / gcd(a, b);
}

function Main(input) {
	input = input.split(" ");
	var a = parseInt(input[0], 10);
	var b = parseInt(input[1], 10);
	console.log(lcm(a, b));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] p = new int[n];
        for(int i = 0;i < n;i++) {
            p[i] = in.nextInt();
        }
        int minZ = p[0], cnt = 1;
        for(int i = 1;i < n;i++) {
            if(minZ >= p[i]) {
                minZ = p[i];
                cnt++;
            }
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 66528
#include<bits/stdc++.h>
using namespace std;
long long l[101];
long long n;

int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>l[i];
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            for(int z=j+1;z<=n;z++)
            {
                if(l[i]!=l[j] && l[j]!=l[z] && l[i]!=l[z])
                    if(l[i]+l[j]>l[z] && l[i]+l[z]>l[j] && l[j]+l[z]>l[i])
                       ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3616
N, M = gets.split.map(&:to_i)

paths = M.times.map do
  gets.split.map(&:to_i)
end

path_from_1 = {}

paths.each do |path|
  if path[0] == 1
    path_from_1[path[1]] = true
  end
end

possible = false
paths.each do |path|
  if path[1] == N
    if path_from_1[path[0]] == true
      possible = true
      break
    end
  end
end

if possible
  puts 'POSSIBLE'
else
  puts 'IMPOSSIBLE'
end


Measured memory_bytes: 22780
using System;
using System.Linq;

class Procon {
  public Procon () { }
  static void Main (string[] agrs) {
    new Procon ().Do ();
  }

  Scanner cin;

  public void Do () {
    cin = new Scanner ();
    int N = cin.nextInt ();
    int M = cin.nextInt ();
    int[] count = new int[M];
    for (int i = 0; i < N; i++) {
      int K = cin.nextInt ();
      for (int j = 0; j < K; j++) {
        int A = cin.nextInt ();
        count[A - 1]++;
      }
    }

    int ret = 0;
    for (int i = 0; i < M; i++) {
      if (count[i] == N) {
        ret++;
      }
    }
    Console.WriteLine (ret);
  }
}

class Scanner {
  string[] s;
  int i;
  int max_i;

  public Scanner () {
    s = new string[0];
    max_i = 0;
    i = 0;
  }

  public string nextString () {
    if (i >= s.Length) {
      s = Console.ReadLine ().Split (' ');
      max_i = s.Length;
      i = 0;
      if (max_i == 0) {
        return "";
      }
      return s[i++];
    } else {
      return s[i++];
    }
  }

  public int nextInt () {
    return int.Parse (nextString ());
  }

  public long nextLong () {
    return long.Parse (nextString ());
  }

  public double nextDouble () {
    return double.Parse (nextString ());
  }

  public string[] arrayString () {
    return Console.ReadLine ().Split (' ');
  }

  public int[] arrayInt () {
    string[] str = Console.ReadLine ().Split (' ');
    int[] array = new int[str.Length];
    for (int i = 0; i < str.Length; i++) {
      array[i] = int.Parse (str[i]);
    }
    return array;
  }

  public long[] arrayLong () {
    string[] str = Console.ReadLine ().Split (' ');
    long[] array = new long[str.Length];
    for (int i = 0; i < str.Length; i++) {
      array[i] = long.Parse (str[i]);
    }
    return array;
  }

  public double[] arrayDouble () {
    string[] str = Console.ReadLine ().Split (' ');
    double[] array = new double[str.Length];
    for (int i = 0; i < str.Length; i++) {
      array[i] = double.Parse (str[i]);
    }
    return array;
  }
}

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

int main()
{
  int s1, s2;
  while (cin >> s1 >> s2 && s1 != 0){
    int cnt = 0, max = s1 + s2;
    for (int i = 1; i < 5; i++){
      cin >> s1 >> s2;
      if (max < s1 + s2){
        max = s1 + s2;
        cnt = i;
      }
    }
    printf("%c ", 'A' + cnt);
    cout << max << endl;
  }
}

Measured memory_bytes: 1192
#include <iostream>
#include <algorithm>
using namespace std;
 
typedef long long ll;
 
int N;
ll L;
ll a[100010];
 
int main() {
  cin >> N >> L;
  for (auto i = 0; i < N; i++) {
    cin >> a[i];
  }
  int ind = -1;
  for (auto i = 0; i < N-1; i++) {
    if (a[i] + a[i+1] >= L) {
      ind = i;
      break;
    }
  }
  if (ind == -1) {
    cout << "Impossible" << endl;
    return 0;
  }
  cout << "Possible" << endl;
  for (auto i = 0; i < ind; i++) {
    cout << i+1 << endl;
  }
  for (auto i = N-2; i > ind; i--) {
    cout << i+1 << endl;
  }
  cout << ind+1 << endl;
}



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

using namespace std;

#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define MP make_pair
#define PB push_back
#define PH push
#define fst first
#define snd second
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;

const int INF = 1e9 + 7;
const int maxn = 3005;
const int maxm = 3005;

inline void uadd(int &x, int y){ (x += y) %= INF; return; }

int n, m, ans;
int dp[maxm << 1][maxn][2];

int main(){
	scanf("%d%d", &n, &m);
	
	REP(j, 0, n){
		dp[0][j][!j] = 1;
	}
	
	FOR(i, 0, m << 1) REP(j, 0, n + 2) FOR(o, 0, 2) if(dp[i][j][o]){
		if(i & 1){
			if(j)
				uadd(dp[i + 1][j - 1][o | (!(j - 1))], dp[i][j][o]);
			if(n + 1 - j)
				uadd(dp[i + 1][j][o], dp[i][j][o]);
		}
		else{
			if(j)
				uadd(dp[i + 1][j - 1 + 1][o | (!(j - 1))], dp[i][j][o]);
			if(n - j)
				uadd(dp[i + 1][j + 1][o], dp[i][j][o]);
		}
	}
	
	REP(j, 0, n)
		uadd(ans, dp[m << 1][j][1]);
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 144440
#include<stdio.h>
int main(void)
{
    int a,b,c,i;
    scanf("%d%d%d",&a,&b,&c);
    if(b<a)
    {
        i=b;
        b=a;
        a=i;
    }
    if(c<a)
    {
        i=c;
        c=a;
        a=i;
    }
    if(c<b)
    {
        i=c;
        c=b;
        b=i;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}

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

int main(){
  int d;
  cin >> d;
  if(d == 25){
   cout << "Christmas" << endl;
  }
  else if(d == 24){
    cout << "Christmas Eve" << endl;
  }
  else if(d == 23){
    cout << "Christmas Eve Eve" << endl;
  }
  else if(d == 22){
    cout << "Christmas Eve Eve Eve" << endl;
  }
}

Measured memory_bytes: 256
H,W,N=map(int,input().split())
sr,sc=map(int,input().split())
S=input()
T=input()
mtl=S.count("L")
mtr=S.count("R")
mtu=S.count("U")
mtd=S.count("D")
mal=T.count("L")
mar=T.count("R")
mau=T.count("U")
mad=T.count("D")
tl,tr,tu,td=0,0,0,0
al,ar,au,ad=0,0,0,0
a=1
for i in range(N):
    if S[i]=="L":
        tl+=1
        if sc-tl+ar==0:
            a=0
            break
    elif S[i]=="R":
        tr+=1
        if sc+tr-al>W:
            a=0
            break
    elif S[i]=="U":
        tu+=1
        if sr-tu+ad==0:
            a=0
            break
    else:
        td+=1
        if sr+td-au>H:
            a=0
            break
    if T[i]=="L":
        al+=1
        if mtr-tr-mal+al>=W:
            a=0
            break
    elif T[i]=="R":
        ar+=1
        if mtl-tl-mar+ar>=W:
            a=0
            break
    elif T[i]=="U":
        au+=1
        if mtd-td-mau+au>=H:
            a=0
            break
    else:
        ad+=1
        if mtu-tu-mad+ad>=H:
            a=0
            break
print("YES" if a else "NO")

Measured memory_bytes: 3896
import sys
# import io, os
# input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
def main():
    n = int(input())
    a = sorted(list(map(int,input().split())))
    t = 10**10
    if a[-1]%2 == 0:
        for e in a:
            if abs(e-a[-1]//2) < abs(t-a[-1]//2):
                t = e
    else:
        for e in a:
            if abs(e-(1+a[-1])//2) < abs(t-(1+a[-1])//2):
                t = e
    print(a[-1],t)
if __name__ == '__main__':
    main()


Measured memory_bytes: 14428
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 1000000000
#define MAX_N 100005
using namespace std;

int main(){
    int n,a=0,b=0,c=0;
    cin>>n;
    rep(i,0,n){
        cin>>c;
        if(c%2==0)a++;
        else b++;
    }
    
    if(b%2==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


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

int main(){
  int A, B;
  string S;
  cin >> A >> B >> S; 
  int flag=0;
  for(int i=0; i<A; i++){
    if(S.at(i)!='-') flag++;    
  }
  if(S.at(A)=='-') flag++;
  for(int i=A+1; i<S.size(); i++) if(S.at(i)!='-') flag++;
  if(flag==S.size()) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    H, W = map(int, input().split())

    c = []
    for i in range(10):
        c.append(list(map(int, input().split())))

    for k in range(10):
        c = [
            [min(c[i][j], c[i][k]+c[k][j]) for j in range(10)]
            for i in range(10)
        ]

    A = []
    for i in range(H):
        A.extend(list(map(int, input().split())))

    print(sum(map(lambda i: c[i][1] if i >= 0 else 0, A)))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3492
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void debug(String str) {
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        int M;
        int[] Xn;
        int[] Yn;
        int[] Zn;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            M = sc.nextInt();
            Xn = new int[M];
            Yn = new int[M];
            Zn = new int[M];
            for(int i =0;i < M;i++){
                Xn[i] = sc.nextInt()-1;
                Yn[i] = sc.nextInt()-1;
                Zn[i] = sc.nextInt();
            }
        }
        UnionF union = new UnionF(N);
        for(int i =0;i < M;i++){
            union.mergeSet(Xn[i], Yn[i]);
        }
        Set<Integer> set = new HashSet<>();
        for(int i = 0;i < N;i++){
            set.add(union.root(i));
        }

        System.out.println(set.size());

    }
    public static class UnionF {
        int[] elements;
        int[] rank;

        public UnionF(int size) {
            this.elements = new int[size];
            this.rank = new int[size];
            for (int i = 0; i < elements.length; i++) {
                elements[i] = i;
                rank[i] = 0;
            }
        }

        public void mergeSet(int x, int y) {
            int i = root(x);

            int j = root(y);

            if (i == j) {
                return;
            }

            if (rank[i] > rank[j]) {
                elements[j] = i;

            } else {
                elements[i] = j;
                if (rank[i] == rank[j]) {
                    rank[i]++;
                }
            }
        }

        public int root(int x) {
            int i = x;
            while (elements[i] != i) {
                i = elements[i];
            }
            int root = i;
            //経路圧縮
            i = x;
            while (elements[i] != i) {
                i = elements[i];
                elements[i] = root;
            }
            return root;
        }

        public boolean isSameSet(int x, int y) {
            int i = root(x);

            int j = root(y);

            return i == j;
        }

        @Override
        public String toString() {
            return this.elements.toString();
        }

    }
}


Measured memory_bytes: 94908
#![allow(dead_code)]
use std::io;

fn main() {
    solve_d();
}

fn solve_d() {
    let mut x = String::new();

    io::stdin().read_line(&mut x).unwrap();

    let v: Vec<u32> = x.trim()
        .split(' ')
        .map(|s| s.parse::<u32>().unwrap())
        .collect();

    let a = v[0];
    let b = v[1];
    let c = v[2];
    let mut count = 0;
    for i in a..(b + 1) {
        if (c % i) == 0 {
            count += 1;
        }
    }
    println!("{}", count);
}



Measured memory_bytes: 5028
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int x;
  cin >> x;
  int ans = 1;
  if(x<600) ans=8;
  else if(x<800) ans=7;
  else if(x<1000) ans=6;
  else if(x<1200) ans=5;
  else if(x<1400) ans=4;
  else if(x<1600) ans=3;
  else if(x<1800) ans=2;
  cout << ans << endl;
}


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

int main() {
    long N;
    cin >>N;
    vector<long> x(N, 0);
    vector<long> y(N, 0);
    for (long i=0; i<N; i++)
        cin >>x.at(i);
    for (long i=0; i<N; i++)
        cin >>y.at(i);

    long D1=0;
    long S2=0;
    long S3=0;
    long D=0;
    for (long i=0; i<N; i++) {
        long l=abs(x.at(i)-y.at(i));
        D1 +=l;
        S2 +=l*l;
        S3 +=l*l*l;
        D=max(D, l);;
    }
    cout <<fixed <<setprecision(10) <<(double)D1 <<endl <<sqrt(S2) <<endl <<pow(S3, 1.0/3.0) <<endl <<(double)D <<endl;
    return 0;
}


Measured memory_bytes: 3428
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    vector<vector<bool> > dp( 63, vector<bool> (60,false) );
    ll now = 0;
    while( now <= 60*60){
	for(ll i=0;i<a;i++){
	    dp[ now/60 ][now%60] = true;
	    now++;
	}
	now += b;
    }
    ll res = -1;
    for(ll i=0;i<60;i++){
	if( dp[i][c-1] ) {
	    cout<<i*60 + c<<endl;
	    return 0;
	}
    }
    cout<<res<<endl;
    return 0;
}



Measured memory_bytes: 3120
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] s  = sc.next().toCharArray();
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0 ; i < n ; i++) {
            if (map.containsKey(s[i])) {
                map.put(s[i], map.get(s[i]) + 1);
            } else {
                map.put(s[i], 1);
            }
        }
        long ans = 1;
        int mod = 1000000007;
        for (Entry<Character, Integer> entry : map.entrySet()) {
            ans *= (entry.getValue()  + 1 ) % mod;
            ans %= mod;
        }
        System.out.println((ans + mod - 1) % mod);
    }


}


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

int n;
int r[200005];

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

int ans = -1000000000;
int min = r[0];

for(int i=1;i<n;i++) {
if(r[i] - min > ans) ans = r[i]-min;
if(r[i] < min) min = r[i];
}

cout << ans << endl;

return 0;
}

Measured memory_bytes: 1944
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define scn(var)         cin >> var;
#define pYes()           prt("Yes")
#define pNo()            prt("No")
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\n"

//----------------------------------------------------------------
int main(void) {
  int a, b, q;
  cin >> a >> b >> q;
  arrll(s,a);
  arrll(t,b);
  arrll(x,q);

  //prtall(s);
  //prtall(t);
  //prtall(x);

  rep(i,q){
    //prt3(i, "start->", x[i]);
    auto it_a = upper_bound(all(s), x[i]);
    auto it_b = upper_bound(all(t), x[i]);

    int jinja_right = it_a - s.begin();
    int tera_right = it_b - t.begin();

    ll j_left, j_right, t_left, t_right;
    if(jinja_right==0){
      j_right = s[jinja_right];
      j_left = -3e10;
    } else if(jinja_right==a){
      j_right = 3e10;
      j_left = s[jinja_right-1];
    } else {
      j_right = s[jinja_right];
      j_left = s[jinja_right-1];

    }
    if(tera_right==0){
      t_right = t[tera_right];
      t_left = -3e10;
    } else if(tera_right==b){
      t_right = 3e10;
      t_left = t[tera_right-1];
    } else {
      t_right = t[tera_right];
      t_left = t[tera_right-1];
    }

    //prt2(j_left, j_right);
    //prt2(t_left, t_right);

    ll cond1 = min((x[i] - min(j_left, t_left)), max(j_right, t_right) - x[i]);
    ll cond2 = min(2*(x[i]-j_left)+t_right-x[i],2*(j_right-x[i])+x[i]-t_left);
    ll cond3 = min(2*(x[i]-t_left)+j_right-x[i],2*(t_right-x[i])+x[i]-j_left);
    ll ans = min(cond1, min(cond2, cond3));

    //prt2("Ans--->", ans);
    prt(ans);
  }

}


Measured memory_bytes: 3712
s = int(input())
a = []
a.append(s)
for i in range(1, 1000000):
    if a[i-1] % 2 == 0:
        a.append(a[i-1]/2)
    else:
        a.append(3*a[i-1]+1)
    for j in range(i-1, -1, -1):
        if a[j] == a[i]:
            print(int(i+1))
            exit()



Measured memory_bytes: 3060
#include<stdio.h>

long long solve(long long h,long long w){
  if(w==1 || h==1) return 1;
  return (h*w+1)/2;
}

int main(){
  long long h,w;
  scanf("%llu %llu",&h,&w);
  printf("%llu",solve(h,w));
  return 0;
}

Measured memory_bytes: 128
#maspyさんの神解答
import itertools
N,K = map(int,input().split())
x = (N-1)*(N-2)//2
if x < K:
    print(-1)
    exit()

edge = [(1,n) for n in range(2,N+1)]
edge += list(itertools.combinations(range(2,N+1),2))[:x-K]

print(len(edge))
for x,y in edge:
    print(x,y)

Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007

//read question carefully!

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int a[n];
        int sum = 0;
        for (int i = 0; i < n; ++i)
        {
            cin >> a[i];
            sum += a[i];
        }
        int p = sum / n;
        //cout << p << "\n";
        int ans = 0, ans1 = 0;

        for (int i = 0; i < n; ++i)
        {
            int val = abs(a[i] - p);
            ans += val * val;
        }
        p++;
        for (int i = 0; i < n; ++i)
        {
            int val = abs(a[i] - p);
            ans1 += val * val;
        }
        cout << min(ans, ans1) << "\n";
    }
}

Measured memory_bytes: 3632
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N, K, Q = sc.nextLong()
  val as = List.fill(Q.toInt)(sc.nextInt()).groupBy(identity).mapValues(_.length)
  val f = (i: Int) => if (0 < K - Q + i) "Yes" else "No"
  (1 to N.toInt).foreach(i => println(f(as.getOrElse(i, 0))))
}


Measured memory_bytes: 74656
#include <stdio.h>
#include <stdlib.h>
int upi(const void*a, const void*b){return*(int*)a-*(int*)b;}
void sortup(int*a,int n){qsort(a,n,sizeof(int),upi);}
int f(int n){
	if(n>1)return f(n/2)+f(n-n/2)+n;
	return 0;
}

int a[500010];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	sortup(a,n);
	for(int i=0;i<n;i++)printf("%d%c",a[i],i==n-1?10:32);
	printf("%d\n",f(n));
}


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

int main() {
  int N;
  cin >> N;
  
  int num = N;
  int sum = 0;
  while (num > 0)
  {
    sum += num % 10;
    num /= 10;
  }

  if (N % sum == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int x, y, z;
    cin >> x >> y >> z;
    put((x - z) / (y + z));
    return 0;
}

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


int main(){

  int x ,y;
  cin >>x>>y;

  if (2*x ==y){cout <<"Yes";}
  else if(4*x ==y){cout <<"Yes";}
  else if((y-(2*x)) <= 2*x  && (y-(2*x)) >0 &&  (y-(2*x))%2 == 0){cout << "Yes";}
  else{cout <<"No";}
  return 0;
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = j;i <= k;++i)
#define repp(i,j,k) for(int i = j;i >= k;--i)
#define rept(i,x) for(int i = linkk[x];i;i = e[i].n)
#define P pair<int,int>
#define Pil pair<int,ll>
#define Pli pair<ll,int>
#define Pll pair<ll,ll>
#define pb push_back 
#define pc putchar
#define mp make_pair
#define file(k) memset(k,0,sizeof(k))
#define ll long long
int rd()
{
    int sum = 0;char c = getchar();bool flag = true;
    while(c < '0' || c > '9') {if(c == '-') flag = false;c = getchar();}
    while(c >= '0' && c <= '9') sum = sum * 10 + c - 48,c = getchar();
    if(flag) return sum;
    else return -sum;
}
int a[300];
int main()
{
    int n = rd();
    rep(i,1,2*n) a[i] = rd();
    sort(a+1,a+2*n+1);
    int ans = 0;
    for(int i = 1;i <= 2*n;i += 2) ans += a[i];
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    bool primes[1000002] = {true};
    memset(primes,true,sizeof(primes));
    primes[1] = false;
    FOR(i,2,1e6+1){
	for(int j=2;j*j<=i;j++){
	    if(i % j == 0){
		primes[i] = false;
		break;
	    }
	}
    }
    while(true){
	int a,d,n;
	cin >> a >> d >> n;
	if(a == 0 && d == 0 && n == 0) break;
	int count = 0;
	while(count < n){
	    if(primes[a]){
	       	count++;
		if(count == n) cout << a << endl;
	    }
	    a += d;
	}
    }
    return 0;
}

Measured memory_bytes: 2140
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int read()
{
    char c=getchar();
    int d=0;
    while(c<'0' || c>'9')c=getchar();
    while(c>='0' && c<='9'){d=(d<<3)+(d<<1)+(c^48);c=getchar();}
    return d;
}

#define MAXN 50

int n;
string s;
int a[MAXN+1][27];

int main()
{
    n=read();
    for(int i=1;i<=n;i++)
    {
        getline(cin,s);
        for(int j=0;j<s.size();j++)a[i][s[j]-'a'+1]++;
    }
    for(int i=1;i<=26;i++)
    {
        int minn=233;
        for(int j=1;j<=n;j++)
        {
            minn=min(minn,a[j][i]);
            if(!minn)break;
        }
        for(int j=1;j<=minn;j++)putchar(i-1+'a');
    }
}

Measured memory_bytes: 256
from collections import Counter

n = int(input())
s = []
for i in range(n):
    s.append(''.join(sorted(input())))
    
v = list(Counter(s).values())
ans = []
for i in range(len(v)):
    if v[i] >= 2:
        ans.append((v[i] * (v[i]-1))/2)

print(int(sum(ans)))

Measured memory_bytes: 19760
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    
    int A, B; cin >> A >> B;
    
    cout << ((A%2!=0 && B%2!=0) ? "Yes" : "No") << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N;
    in(N);

    vll L(N);
    inN(L, N);
    sort(all(L));

    int count = 0;

    rep(i, N)
    {
        reps(j, i + 1, N)
        {
            reps(k, j + 1, N)
            {
                if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i]) continue;

                if (L[k] < L[i] + L[j]) count++;
            }
        }
    }

    outl(count);

    return 0;
}

Measured memory_bytes: 3664
while (m,f,r=gets.split.map &:to_i)!=[-1,-1,-1]
s=m+f
if m==-1||f==-1
puts"F"
next
end
puts"A" if 79<s
puts"B" if 64<s&&s<80
puts"C" if (49<s&&s<65)||(29<s&&s<50&&49<r)
puts"D" if 29<s&&s<50&&r<50
puts"F" if s<30
end

Measured memory_bytes: 8560
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <iostream>
#include <deque>
#include <functional>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

using namespace std;

// #define int long long

#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

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

#define debug(x) cerr << #x << ": " << x << endl;

const int MOD = 1e9 + 7;

signed main(void)
{
  int a, b; cin >> a >> b;

  int num = 0;
  int sum = 0;
  vector<int> v = {1};
  sum = 1;

  if (sum >= b) {
    
  }

  while (sum < b) {
    if (v.size() != a) {
      while (v.size() != a) v.push_back(1);
      sum = a;
      num = 1;
    } else {
      int n = v.back();
      v.pop_back();
      v.push_back(n - 1 + a);
      sum += a - 1;
      num += 1;
    }
    
  }
  cout << num << endl;
  
}


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

#include <algorithm>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
typedef long long ll;
typedef pair<ll, ll> P;

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)
vector<long long> dijkstra(vector<vector<pair<long long, long long>>> graph, long long s) {
    vector<long long> ans(graph.size(), -1);
    priority_queue<pair<long long, long long>, vector<pair<long long, long long>>, greater<pair<long long, long long>>>
        pq;
    pq.push({0, s});
    while (pq.size() > 0) {
        ll cur1 = 0;
        ll cur2 = 0;
        if (ans[pq.top().second] != -1) {
            pq.pop();
        } else {
            cur1 = pq.top().first;
            cur2 = pq.top().second;
            pq.pop();
            ans[cur2] = cur1;
            for (long long i = 0; i < graph[cur2].size(); i++) {
                pq.push({cur1 + graph[cur2][i].second, graph[cur2][i].first});
            }
        }
    }
    return ans;
}
signed main() {
    long long n;
    cin >> n;
    vector<int> as(n);
    vector<int> cnt(1e6 + 23);
    REP(i, n) {
        cin >> as[i];
        cnt[as[i]]++;
    }
    sort(as.begin(), as.end());
    int ans = 0;
    REP(i, n) {
        if (cnt[as[i]] > 1) {
            // cout << as[i] << endl;
            continue;
        }
        bool div = false;
        for (int j = 1; j <= sqrt(as[i]); j++) {
            // cout << as[j] << endl;
            if (as[i] == j) {
                continue;
            }
            if (j == 1) {
                if (cnt[j] > 0) {
                    div = true;
                }
                continue;
            }
            if (as[i] % j == 0) {
                if (cnt[j] > 0) {
                    div = true;
                }
                if (cnt[(as[i] / j)] > 0) {
                    div = true;
                }
            }
        }
        if (div == false) {
            // cout << endl;
            ans++;
        }
    }
    cout << ans << endl;
}


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

void solve(long long X, long long Y, long long A, long long B, long long C, std::vector<long long> p, std::vector<long long> q, std::vector<long long> r){
    sort(p.begin(),p.end(),greater<ll>());
    sort(q.begin(),q.end(),greater<ll>());
    sort(r.begin(),r.end(),greater<ll>());
    ll p_min = X-1;
    ll q_min = Y-1;
    ll r_min = 0;
    while(1){
        if ( (p_min>=0 && q_min>=0) && (p[p_min] < q[q_min]) && (p[p_min] < r[r_min]) ){
            r_min+=1;
            p_min-=1;
        }else if ( (p_min>=0 && q_min>=0) && (p[p_min] >= q[q_min]) && (q[q_min] < r[r_min]) ){
            r_min+=1;
            q_min-=1;
        }else if ( (q_min>=0) && (q[q_min] < r[r_min]) ) {
            r_min+=1;
            q_min-=1;
        }else if ( (p_min>=0) && (p[p_min] < r[r_min])){
            r_min+=1;
            p_min-=1;
        }else{
            break;
        }
        if (r_min >= C) break;
    }
    ll ans = accumulate(p.begin(),p.begin()+p_min+1,0LL) + accumulate(q.begin(),q.begin()+q_min+1,0LL) + 
    accumulate(r.begin(),r.begin()+r_min,0LL);
    printf("%lld\n",ans);

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    std::vector<long long> p(A);
    for(int i = 0 ; i < A ; i++){
        scanf("%lld",&p[i]);
    }
    std::vector<long long> q(B);
    for(int i = 0 ; i < B ; i++){
        scanf("%lld",&q[i]);
    }
    std::vector<long long> r(C);
    for(int i = 0 ; i < C ; i++){
        scanf("%lld",&r[i]);
    }
    solve(X, Y, A, B, C, std::move(p), std::move(q), std::move(r));
    return 0;
}


Measured memory_bytes: 2560
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val n = s.length
    val dp = Array(n + 1) { Array(3) {-1} }
    dp[1][1] = 1
    if (n >= 2) {
        dp[2][2] = 1
    }
    for (i in 1 until n) {
        for (j in 1..2) {
            if (dp[i][j] == -1) {
                continue
            }
            val pre = s.substring(i - j, i)
            val next = s.substring(i, i + 1)
            if (pre != next) {
                dp[i + 1][1] = Math.max(dp[i + 1][1], dp[i][j] + 1)
            }

            if (i + 2 > n) {
                continue
            }
            val next2 = s.substring(i, i + 2)
            if (pre != next2) {
                dp[i + 2][2] = Math.max(dp[i + 2][2], dp[i][j] + 1)
            }
        }
    }
    println(Math.max(dp[n][1], dp[n][2]))
}

Measured memory_bytes: 66988
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    int n,a,b;
    bool YYMM_flag=false,MMYY_flag=false;

    cin>>n;
    a=n/100;
    b=n%100;
    //cout<<"a: "<<a<<" b: "<<b<<endl;
    if(a==0){
        MMYY_flag=false;
        if(b<=12 && b>0){
            YYMM_flag=true;
        }
    }else if(b==0){
        YYMM_flag=false;
        if(a<=12 && a>0){
            MMYY_flag=true;
        }
    }else if(a>12){
        MMYY_flag=false;
        if(b<=12){
            YYMM_flag=true;
        }
    }else if(a<=12 && b>12){
        MMYY_flag=true;
    }else{
        YYMM_flag=true;
        MMYY_flag=true;
    }
    
    if(YYMM_flag && MMYY_flag){
        cout<<"AMBIGUOUS"<<endl;
    }else if(YYMM_flag){
        cout<<"YYMM"<<endl;
    }else if(MMYY_flag){
        cout<<"MMYY"<<endl;
    }else{
        cout<<"NA"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int i,a,b,c[7];
for(i=0;i<=6;i++){
scanf("%d",&a);
scanf("%d",&b);

c[i]=a-b;
}
for(i=0;i<=6;i++){
printf("%d\n",c[i]);}
return 0;}

Measured memory_bytes: 1860
using System;
class Program
{
    static void Main()
    {
        long a = long.Parse(Console.ReadLine());
        for (long i = (long)Math.Sqrt(a); i > 0; i--)
        {
            if (a % i == 0)
            {
                Console.WriteLine(Math.Max(i.ToString().Length, (a / i).ToString().Length));break;
            }
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std ; 
int main()
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	int n  , arr[3]  , flag = 0;  
	cin >> n ;
	for(int i = 0 ; i < 3 ; ++i)
	{
		arr[i] = n % 10 ; 
		n /= 10 ; 
		if(arr[i] == 7)
		{
			 flag = 1 ; 
			break ; 
		}
	}
	if(flag)
	{
		cout << "Yes" ; 
	}
	else
	{
		cout << "No" ; 
	}
	
}



Measured memory_bytes: 3636
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int main(void){
    int N;
    cin>>N;
    string s,t;
    cin>>s>>t;
    const ll MOD=1000000007;
    ll res=(s[0]==t[0]?3:6);
    s=s+'#';
    t=t+'#';
    rep(i, N-1){
      if (s[i+1] == s[i]) continue;
      else {
        if (s[i] != t[i] && s[i+1] == t[i+1]) continue;
        else if(s[i] != t[i] && s[i+1] != t[i+1]){res *= 3; res %= MOD;}
        else if(s[i] == t[i] && s[i+1] == t[i+1]){res*=2;res%=MOD;}
        else {res *=2; res %= MOD;}
      }
    }
    cout << res << endl;
  }


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

#define int long long

using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007,INF=1e18;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};




int n,l,a[100010];
 
signed main(){
	cin>>n>>l;
	int sum=0;
	rep(i,0,n){
	    cin>>a[i];
	    sum+=a[i];
	}
	bool can=false;
	rep(i,0,n-1){
	    if(a[i]+a[i+1]>=l){
	        can=true;
	    }
	}
	if(can)cout<<"Possible"<<endl;
	else{
	    cout<<"Impossible"<<endl;
	    return 0;
	}
	int mae=1,usiro=n-1;
	string s;
	rep(i,0,n-2){
	    if(a[mae-1]+a[mae]>=a[usiro]+a[usiro-1]){
	        sum-=a[usiro];
	        cout<<usiro<<endl;
	        usiro--;
	    }
	    else{
	        sum-=a[mae-1];
	        cout<<mae<<endl;
	        mae++;
	    }
	}
	cout<<mae<<endl;
	
	
	return 0;
}

Measured memory_bytes: 1664
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
import bisect
con = 10 ** 9 + 7; INF = float("inf")

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

#処理内容
def main():
	N, M, K = getlist()
	A = getlist()
	B = getlist()
	Asum = [0] * (N + 1)
	Bsum = [0] * (M + 1)
	for i in range(N):
		Asum[i + 1] = Asum[i] + A[i]

	for i in range(M):
		Bsum[i + 1] = Bsum[i] + B[i]

	ans = 0
	for i in range(N + 1):
		val = i
		cnt = K - Asum[i]
		if cnt < 0:
			continue

		ind = bisect.bisect_left(Bsum, cnt + 1) - 1
		ans = max(ans, val + ind)

	print(ans)



if __name__ == '__main__':
	main()

Measured memory_bytes: 107256