akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<set>
#include<iostream>
#include<stdlib.h>
#include<vector>
using namespace std;
typedef long long ll;


int main(void) {
	int R;
	cin >> R;
	if (R < 1200)cout << "ABC" << endl;
	else {
		if (R < 2800)cout << "ARC" << endl;
		else cout << "AGC" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
z = Array.new(m){gets.split.map(&:to_i)}
b = Array.new(n + 1){0}
b[1] = 1
c = Array.new(n + 1){1}
z.each do |x, y|
  if b[x] == 1
    b[y] = 1
  end
  c[x] -= 1
  c[y] += 1
  b[x] = 0 if c[x] == 0
end
puts b.count(1)

Measured memory_bytes: 11132
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 5100;
const int MOD = 1000000007;

struct edge {
    int from;
    int to;
    int cost;
};

int V, E, d[MAX];
edge es[MAX];

bool has_negative_loop(int s) {
    fill(d, d + V, INF);
    d[s] = 0;
    for (int i = 0; i < V; i++) {
        for (int j = 0; j < E; j++) {
            edge e = es[j];
            if (d[e.to] > d[e.from] + e.cost and d[e.from] != INF) {
                d[e.to] = d[e.from] + e.cost;
                if (i == V - 1) {
                    return true;
                }
            }
        }
    }
    return false;
}


int main(){
  cin>>V>>E;
  int r;cin>>r;
  rep(i,E){
    int from,to,cost;
    cin>>from>>to>>cost;
    es[i] = edge({from, to, cost});
  }

  if(has_negative_loop(r)){
    cout<<"NEGATIVE CYCLE"<<endl;
  }
  else{
    rep(i,V){
      if(d[i] < INF) cout<<d[i]<<endl;
      else cout<<"INF"<<endl;
    }
  }
}



Measured memory_bytes: 3136
//DivRem Number

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define YN(flag) (flag?"Yes":"No")
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n;cin>>n;
    map<int,int>a;
    int ans = 0;
    for(int i=1;i*i<=n;i++){
        if(n%i==0){
            a[i];
            a[n/i];
        }
    }
    for(auto i:a){
        if(i.first==1)continue;
        if(n/(i.first-1)==n%(i.first-1)){
            ans+=i.first-1;
        }
    }
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 3828
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

a,b=MI()
s=input().rstrip()
s=list(s)
count=0
lis=[str(i) for i in range(10)]
if len(s)!=a+b+1:
    print("No")
    #print(1)
    sys.exit()
if s[a]!="-":
    #print(2)
    print("No")
    sys.exit()
for i in range(a):
    if not(s[i] in lis):
        #print(3)
        print("No")
        sys.exit()
for i in range(a+1,a+b+1):
    if not(s[i] in lis):
        #print(4)
        print("No")
        sys.exit()
print("Yes")

Measured memory_bytes: 3316
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

// #define amari(x) ((x) % 1000000007)
#define amari(x) ((x) % 998244353)

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(int i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

int wa(int a) {
  int res = 0;
  for (int i = a; a > 0; a/=10) {
    res += a%10;
  }
  return res;
}

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

  int n;
  cin >> n;
  
  int res = INF;

  for (int i = 1; i < n; i++) {
    res = min(res, wa(i) + wa(n-i));
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
#define ll long long
#define N 305
#define Abs(x) ((x) > 0 ? (x) : -(x))
#define Min(x,y) ((x) < (y) ? (x) : (y))
#define Max(x,y) ((x) > (y) ? (x) : (y))
inline ll read(){
	ll x = 0,f = 1;char ch = getchar();
	while(ch < '0' || ch > '9'){if(ch == '-')f = -1;ch = getchar();}
	while(ch >= '0' && ch <= '9'){x = x*10+ch-'0';ch = getchar();}
	return x*f;
}

int n,m;
int ans = 1e9;
bool vis[N];
int num[N];
queue<int> q[N];

int main(){
	n = read(); m = read();
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= m;j++){
			int x = read();
			q[i].push(x);
		}
	}
	// puts("1");
	for(int i = 1;i <= m;i++){
		memset(num,0,sizeof num);
		int Mx = 0,Mxx = 0;
		for(int j = 1;j <= n;j++){
			while(!q[j].empty() && vis[q[j].front()]) q[j].pop();
			num[q[j].front()]++;
		}
		for(int j = 1;j <= m;j++)
			if(!vis[j] && num[j] > Mx){
				Mx = num[j];
				Mxx = j;
			}
		if(ans > Mx) ans = Mx;
		vis[Mxx] = true;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 768
import java.io.*;
import java.util.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] line1 = br.readLine().split(" ");
    int n = Integer.parseInt(line1[0]);
    int m = Integer.parseInt(line1[1]);
    int k = Integer.parseInt(line1[2]);
  
    int[] numFriends = new int[n];
    int[] numBlock = new int[n];
    UnionFind unionFind = new UnionFind(n);
    String[] data;
    int a;
    int b;
    
    for (int i=0; i<m; i++){
      data = br.readLine().split(" ");
      a = Integer.parseInt(data[0]) -1;
      b = Integer.parseInt(data[1]) -1;
      
      unionFind.union(a, b);
      numFriends[a]++;
      numFriends[b]++;
    }
    for (int i=0; i<k; i++){
      data = br.readLine().split(" ");
      a = Integer.parseInt(data[0]) -1;
      b = Integer.parseInt(data[1]) -1;
      
      if (unionFind.isSameRoot(a, b)){
        numBlock[a]++;
        numBlock[b]++;
      }
    }
    StringJoiner stringJoiner = new StringJoiner(" ");
    for (int i=0; i<n; i++){
      stringJoiner.add(String.valueOf(unionFind.getSize(i) - numFriends[i] - numBlock[i] - 1));
    }
    
    System.out.println(stringJoiner);
  }
  
}
class UnionFind {
  private int[] tree;
  private int[] size;
  private int[] height;
  
  UnionFind(int size){
    this.tree = new int[size];
    this.size = new int[size];
    this.height = new int[size];
    for (int i=0; i<size; i++){
      this.tree[i] = i;
      this.size[i] = 1;
      this.height[i] = 0;
    }
  }
  
  int find(int idx) {
    if(tree[idx]==idx) return idx;
    else return tree[idx] = find(tree[idx]);
  }
  
  void union(int idx1,int idx2) {
    int root1 = find(idx1);
    int root2 = find(idx2);
    
    if (root1 == root2){
      return;
    }
    if (height[root1] > height[root2]){
      tree[root2] = root1;
      size[root1] += size[root2];
    } else if (height[root1] < height[root2]){
      tree[root1] = root2;
      size[root2] += size[root1];
    } else {
      tree[root2] = root1;
      size[root1] += size[root2];
      height[root1]++;
    }
  }
  
  public boolean isSameRoot(int idx1, int idx2){
    return find(idx1) == find(idx2);
  }
  
  public int getSize(int idx){
    return size[find(idx)];
  }
}


Measured memory_bytes: 61024
#include <algorithm>
#include <iostream>
#include <cmath>
#include <map>

using namespace std;

const long long size_max = 1000000;
const long long mod = 1e9 + 7;

long long fac[size_max], inv[size_max], finv[size_max];
bool primes[size_max];

map<long long, long long> p;

long long N, M;

void make_table()
{
    fac[0] = fac[1] = 1LL;
    finv[0] = finv[1] = 1LL;
    inv[1] = 1LL;
    for (int i = 2; i < size_max; i++)
    {
        fac[i] = (fac[i - 1] * i) % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int k)
{
    if (n < k)
        return 0LL;
    if (n < 0 || k < 0)
        return 0LL;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

void cntp()
{
    int sqrtm = sqrt(M);
    for (int i = 2; i < sqrtm; i++)
    {
        if(primes[i] == false)
        {
            for (int j = 2; i * j < size_max;j++)
            {
                primes[i * j] = true;
            }
        }
    }

    int m = M;

    for (int i = 2; i <= sqrtm;i++)
    {
        if (primes[i] == true)
        {
            continue;
        }
        while(m % i == 0)
        {
            if(p.find(i) == p.end())
            {
                p.insert(make_pair(i, 1));
            }
            else
            {
                p[i]++;
            }
            m /= i;
        }
    }
    if (m != 1)
    {
        p[m]++;
    }
}

int main()
{
    make_table();
    cin >> N >> M;
    cntp();

    long long ans = 1;

    for (auto const &x : p)
    {
        long long b = x.second;
        ans = (ans * comb(b + N - 1, b)) % mod;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 24952
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int x;
    cin >> x;
    if(x >= 30)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3644
//
//  main.cpp
//  ABC124
//
//  Created by hiroaki on 2019/05/07.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>


//pair sort firstに揃う

#define int long long
#define pb(n) push_back(n)
#define Rap(n,i) for(int (i)=0;(i)<(n);(i)++)
#define Pr(n) cout<<n<<endl;
#define PairV vector<pair<int , int> >
#define F first
#define S second
#define Vector1  vector<int>
#define vector2 vector<vector<int> >
#define index(v,x) find((v).begin(), (v).end(), (x))-(v).begin()
#define ctoi(c) (int)(c-'0')
#define incin(n) int (n); cin>>(n);
#define stcin(s) string (s); cin>>(s);
#define all(v) (v).begin() , (v).end()
#define PI 3.14
#define Rad2Deg  57.29578

using namespace std;

int MD(pair<int,int> a,pair<int,int> b){//ManhattanDisRance
    return abs(a.first-b.first) + abs(a.second-b.second);
}

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

    int n,m;
    cin >> n >> m;
    PairV s(n),c(m);
    Rap(n,i){
        cin >> s.at(i).F >> s.at(i).S;
    }
    Rap(m,i){
        cin >> c.at(i).F >> c.at(i).S;
    }

    int log;
    Rap(n,i){
        int min = 1000000000000;
        Rap(m,j){
            if(MD(s[i],c[j])<min){
                min=MD(s[i],c[j]);
                log=j+1;
            }
        }
        Pr(log);
    }
    return 0;
}


Measured memory_bytes: 256
N=int(input())
A=[]
for j in range(2):
    A.append(list(map(int,input().split())))
     
X=[]
#k(1<=k<=N)列目で下に行くとする。
for k in range(1,N+1):
    wa=0
    for j in range(1,k+1):
       wa+=A[0][j-1]
    for i in range(k,N+1):
        wa+=A[1][i-1]
        X.append(wa)
        
print(max(X))

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

int main() {
  vector<vector<int>> a(3,vector<int>(3)),c(3,vector<int>(3));
  rep(i,3)rep(j,3)cin>>a[i][j];
  int n;cin>>n;
  vector<int> b(n);
  rep(i,n)cin>>b[i];
  rep(i,n){
    rep(j,3)rep(k,3)if(a[j][k]==b[i])c[j][k]=1;
  }
  bool ans=false;
  rep(i,3){
    int cnt=0;
    rep(j,3)cnt+=c[i][j];
    if(cnt==3)ans=true;
  }
  rep(i,3){
    int cnt=0;
    rep(j,3)cnt+=c[j][i];
    if(cnt==3)ans=true;
  }
  {
    int cnt=0;
    rep(i,3)cnt+=c[i][i];
    if(cnt==3)ans=true;
  }
  {
    int cnt=0;
    rep(i,3)cnt+=c[i][2-i];
    if(cnt==3)ans=true;
  }
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3580
s = gets.split("")
ans = 0

if s.include?("R")
  if s[0] == "R" && s[1] == "R" && s[2] == "R"
    ans = 3
  elsif s[0] == "R" && s[1] == "R" || s[1] == "R" && s[2] == "R"
    ans = 2
  else
    ans = 1
  end
else
  ans = 0
end
puts ans

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

using namespace std;

int main(){
  int N;
  cin >> N;
  
  long long int ans;
  for(int i = 0; i < N; i++){
    int a, b;
    cin >> a >> b;
    ans += b - a + 1;
  }
  cout << ans;
}


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

int c()
{
    int a;
    std::cin >> a;
    
    double len = (long double) a / 3;
    double ans = len * len * len;
    
    std::cout << std::setprecision(25) << ans;
    
    return 0;
}

int main(int argc, const char * argv[])
{
    c();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N;
  cin >> N;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  sort(rng(A));
  v(ll) sum(N+1,0);
  rep(i,N) {
    sum[i+1] = sum[i] + (ll)A[i];
  }
  int ans = 1;
  drep(i,N) {
    if(sum[i] * 2 >= A[i]) {
      ans++;
    } else {
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1408
using System;
using System.Collections.Generic;
using System.Linq;
public class FootPrint
{

    public long First { get; set; }
    public FootPrint(long t)
    {
        First = t;
    }

}

public class AtCoder
{

    public static void Main()
    {
        //入力を保持する
        var input = Console.ReadLine().Split().Select(e => long.Parse(e)).ToArray();
        var N = input[0];
        var K = input[1];

        var teleport = Console.ReadLine().Split().Select(e => long.Parse(e)).ToArray();

        var position = 1L;
        var count = 0L;
        var footprints = new FootPrint[N];
        footprints[0] = new FootPrint(0);

        for (var i = K - 1; i >= 0; i--)
        {
            position = teleport[position - 1];
            count++;
            if (footprints[position - 1] != null)
            {
                i = i % (count - footprints[position - 1].First);
            }
            else 
            {
                footprints[position - 1] = new FootPrint(count);
            }
        }
        Console.WriteLine(position);
    }
}


Measured memory_bytes: 48972
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};


int main(){
	string s;
	cin>>s;
	int res=0,t=0,x=0;
	for(auto c:s){
		if(c=='R'){
			x=(x+1)%4;
			if(x==t+1||x==0&&t==3) t++;
			if(t==4){
				t=0;
				res++;
			}
		}
		else{
			x=(x+3)%4;
			if(x==0) t=0;
		}
	}
	cout<<res<<endl;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define vi vector<int>
#define MAX_N 200005
#define i197 1000000007

using namespace std;


typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,P1> P2;
const int inf=1000000000;
P1 xy[MAX_N]={};
bool dp[100001]={};

int main() {
	int n;
	cin>>n;
	int a[100001];
	rep(i,n)cin>>a[i];
	int t=0;

	rep(i,n){
		if(dp[i])continue;
		bool dp2[100001]={};
		dp[i]=true;
		dp2[i]=true;
		int k=(i+a[i])%n;
		while(1){
			if(dp2[k]){
				if(k==i){
					//success
					t++;
					k=(k+a[k])%n;
					while(k!=i){
						t++;
						dp[k]=true;
						k=(k+a[k])%n;
					}
				}
				break;
			}
			if(dp[k]){
//				rep(j,n){
//					if(dp2[j])dp[j]=true;
//					//false
//				}
//				break;
			}
			dp2[k]=true;
			k=(k+a[k])%n;
		}
	}
	cout<<t<<endl;
	return 0;
}



Measured memory_bytes: 6788
package main

import (
	"fmt"
	"math"
)

func main() {
	var N int
	fmt.Scan(&N)
	div := 0
	for i := int(math.Sqrt(float64(N))); i > 1; i-- {
		if N%i == 0 {
			div = i
			break
		}
	}
	if div == 0 { // N is prime number
		fmt.Println(N - 1)
	} else {
		fmt.Println(N/div - 1 + div - 1)
	}
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void) {

  long a,b,c;
  scanf("%ld %ld %ld", &a, &b, &c);
  long count = 0;
  long next_a,next_b,next_c;
  while (1) {
    if (a%2 != 0 || b%2 != 0 || c%2 != 0) {
      break;
    }
    if (a == b && b == c) {
      printf("-1\n");
      return 0;
    }
    count++;
    next_a = (b+c)/2;
    next_b = (c+a)/2;
    next_c = (a+b)/2;
    a = next_a;
    b = next_b;
    c = next_c;
  }
  printf("%ld\n", count);

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>

#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

using ll = long long;
using pii = pair<int, int>;

#define pb push_back
#define mp make_pair

#define NMAX 200100

int v[NMAX];

bool possible(const int max_len, const int N, int K) {
    for (int i = 1; i <= N; i++) {
        if (v[i] <= max_len) {
            continue;
        }
        const int needed = v[i] / max_len;
        K -= needed;
        if (K < 0) {
            return false;
        }
    }
    return true;
}

int cbin(const int N, const int K) {
    int p = 1, q = 1;
    for (int i = 1; i <= N; i++) {
        q = max(q, v[i]);
    }
    int sol = -1;
    while (p <= q) {
        int mij = (p + q) / 2;
        if (possible(mij, N, K)) {
            sol = mij;
            q = mij - 1;
        }
        else {
            p = mij + 1;
        }
    }
    return sol;
}

int main()
{
    ios::sync_with_stdio(false), cin.tie(0);
    // cout.setf(ios::fixed), cout.precision(20);

#ifdef LOCAL
    // ifstream cin("input.txt");
#endif

    int N, K;
    cin >> N >> K;
    for (int i = 1; i <= N; i++) {
        cin >> v[i];
    }
    cout << cbin(N, K) << '\n';

    return 0;
}

Measured memory_bytes: 3916
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define endl "\n"
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int fast_pow(int x, int y, int p);

void solve() {
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n,greater<int>());
    int sum=0;
    for(int i=0;i<n;i++){
        if(k>0)k--;
        else{
            sum+=a[i];
        }
    }
    cout<<sum<<endl;

}

int32_t main() {
    IOS;
    int test = 1;
    // cin >> test;
    while (test--) {
        solve();
    }
    return 0;
}
int fast_pow(int x, int y, int p) {
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

Measured memory_bytes: 1792
public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		java.util.Scanner sc = new java.util.Scanner(System.in);

		int first, second, third, temp;

		first = sc.nextInt(); // i=0

		temp = sc.nextInt(); // i=1
		if (temp > first) {
			second = first;
			first = temp;
		} else {
			second = temp;
		}

		temp = sc.nextInt(); // i=2
		if (temp > first) {
			third = second;
			second = first;
			first = temp;
		} else if (temp > second) {
			third = second;
			second = temp;
		} else {
			third = temp;
		}

		for (int i=3; i < 10; i++) {
			temp = sc.nextInt();
			if (temp > first) {
				third = second;
				second = first;
				first = temp;
			} else if (temp > second) {
				third = second;
				second = temp;
			} else if (temp > third) {
				third = temp;
			}
		}

		System.out.println(first);
		System.out.println(second);
		System.out.println(third);
	}

}

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

int main(){
  string s;
  cin >> s;
  int n = s.size();
  if(s[0] != 'A'){
    puts("WA");
    return 0;
  }
  int count = 0;
  for(int i = 2;i < n-1;++i){
    if(s[i] == 'C'){
      ++count;
    }
  }
  if(count != 1){
    puts("WA");
    return 0;
  }
  rep(i,n){
    int cnt = 0;
    if(s[i] == 'A') continue;
    if(s[i] == 'C') continue;
    for(char c = 'a';c <= 'z';++c){
      if(s[i] == c) ++cnt; 
    }
    if(cnt == 0){
      puts("WA");
      return 0;
    }
  }
  puts("AC");
  return 0;
}


Measured memory_bytes: 256
# atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7

# main
N,T = map(int,input().split())
A = list(map(int,input().split()))

ans = 0
for i in range(1,N):
    if A[i] > A[i-1]+T:
        ans += T
    else:
        ans += A[i]-A[i-1]

ans += T

print(ans)

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

using ll = long long;
using namespace std;


int main()
{
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    c += c;
    int nax = 1000000000;

    for(int i = 0; i <= 200000; i++){
        int X = max(0,x - i);
        int Y = max(0,y - i);

        int cur = 0;
        cur += i * c;
        cur += X * a + Y * b;
        nax = min(cur,nax);
        //cout << i << " " << X << " " << Y << endl;
    }

    cout << nax << endl;

}

Measured memory_bytes: 256
/*
* @Author: _dp95
* @Date:   2020-04-03 08:52:05
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end() 
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

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

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

signed main( ){
  timesaver ;
  ll x, y ;
  cin >> x >> y ;
  ll ans = x*(x-1)>>1 ;
  ans += y*(y-1)>>1 ;
  cout << ans << nl ;
}

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

using namespace std;

int digit(int n); 
int main()
{
    int a[200],b[200];
    int len=0;

    while (cin >> a[len] >>  b[len])
        len++;

    for (int i=0; i < len; i++) {
        cout << digit(a[i]+b[i]) << endl;
    }   

    return 0;
}

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

Measured memory_bytes: 1156
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sr = new Scanner(System.in);
		int a = sr.nextInt();
		int b = sr.nextInt();
		
		
		int c = b-a;
		int counter = 0;
		for(int i = 1; i<=c; i++) {
			counter = counter + i;
		}
		int s=counter-b;
		
		System.out.println(s);
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>

using namespace std;

int main(){
  int N, a;
  int ans = 0;
  cin >> N;

  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> a;
    vec.at(i) = a;
  }

  while(1){
    bool exit = false; // フラグ

    for (int i = 0; i < N; i++){ // 奇数があればフラグを立てる
      if(vec.at(i) % 2 != 0){
        exit = true;
      }
    }

    if(exit == true) break; // 奇数なら処理を抜ける

    for (int i = 0; i < N; i++){
      vec.at(i) =  vec.at(i)/2;
      if(i == N-1){
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}



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


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  //  int t=1;
  //  cin >> t;
    int n,m;
    cin >> n >> m;
    vector<vector<int>> adj(n+1);
    for(int i=0;i<m;i++)
    {
        int u,v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    vector<bool> visit(n+1,false);
    vector<int> ans(n+2);
    queue<int> q;
    q.push(1);
    visit[1]=true;
    while(!q.empty())
    {
        int node = q.front();
        q.pop();
        for(auto &i: adj[node])
        {
            if(!visit[i])
            {
                visit[i] = true;
                ans[i] = node;
                q.push(i);
            }
        }
    }
    bool hit=1;
    for(int i=2;i<=n;i++)
    {
        if(!visit[i]) hit=0;
    }
    if(hit)
    {
        cout << "Yes\n";
        for(int i=2;i<=n;i++) cout << ans[i] << "\n";
    }
    else cout << "No\n";
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<pair<int,int>> d(n);
  int count = 0;
  for (auto &&i : d)
  {
    int a,j;cin>>a>>j;
    i = make_pair(a,j);
  }
  for (auto &&i : d)
  {
    if (i.first == i.second)
    {
      count++;
    }
    else
    {
      count = 0;
    }
    if (count == 3)
    {
      break;
    }
    
  }
  if (count == 3)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  
  
  
  
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<array>
#include<algorithm>
#include<deque>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<list>

int main(void) {
	using namespace std;
	int N, a;
	int b = 0;
	vector<int>vec;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a;
		vec.push_back(a);
	}
	sort(vec.begin(), vec.end());

	for (int i = 0; i < N - 1;i++) {
		b += vec[i];
	}
	if (vec[N - 1] < b) {
		cout << "Yes" << endl;
	}
	else if (vec[N - 1] >= b) {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            List<string> sList = new List<string>();
            int ansAC = 0;
            int ansWA = 0;
            int ansTLE = 0;
            int ansRE = 0;
            for(int i = 0; i <N; i++)
            {
                sList.Add(Console.ReadLine());
                if (sList[i] == "AC")
                    ansAC++;
                else if (sList[i] == "WA")
                    ansWA++;
                else if (sList[i] == "TLE")
                    ansTLE++;
                else if (sList[i] == "RE")
                    ansRE++;
            }
            Console.WriteLine("AC x " + ansAC);
            Console.WriteLine("WA x " + ansWA);
            Console.WriteLine("TLE x " + ansTLE);
            Console.WriteLine("RE x " + ansRE);

        }
    }
}
//int i = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray();

Measured memory_bytes: 32628
#include <iostream>
using namespace std;
int main()
{
	int n,l;
	int x,y;
	string temp;
	string a[110];
	cin>>n>>l;
	for(x=1;x<=n;x++)
	{
		cin>>a[x];
	}
	for(x=1;x<n;x++)
	{
		for(y=x+1;y<=n;y++)
		{
			if(a[x]>a[y])
			{
				temp=a[x];
				a[x]=a[y];
				a[y]=temp;
			}
		}
	}
	for(x=1;x<=n;x++)
	{
		cout<<a[x];
	}
	cout<<endl;
	return 0;
	
	
}

Measured memory_bytes: 256
flg = True
inputs = []
while flg:
    inp = input()
    if inp != "#":
        inputs.append(inp)
    else:
        flg = False

right = "yuiophjklnm"
for inp in inputs:
    status = None
    cnt = 0
    for item in inp:
        if status is None:
            if item in right:
                status = "r"
            else:
                status = "l"
            continue
        if status == "r" and item in right:
            continue
        elif status == "l" and item in right:
            status = "r"
            cnt += 1
        elif status == "r" and item not in right:
            status = "l"
            cnt += 1
        elif status == "l" and item not in right:
            continue
    print(cnt)



Measured memory_bytes: 5592
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<iomanip>
#include<algorithm>
#define lint long long int
#define FOR(x, to) for(int x=0; x<(to); x++) // for簡略表記
#define DUMP(ar) for(int i=0; i<ar.size(); i++) cout << "[" << i << "]:" << ar[i] << endl // 配列一覧表示
#define COUT(x) cout << x << endl // 単要素出力
#define ALL(ar) ar.begin(), ar.end() // コンテナの全要素
using namespace std;
// cout << fixed << setprecision(4) で小数点以下4桁の桁そろえ
// goto ANSWER; で最後へ飛ぶ

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, q;
    cin >> n;
    vector<int> s(n);
    FOR(i, n) cin >> s[i];
    cin >> q;
    vector<int> t(q);
    FOR(i, q) cin >> t[i];

    int cnt = 0;
    for(int i=0; i<q; i++){
        for(int k=0; k<n; k++){
            if(s[k] == t[i]){
                cnt++;
                break;
            }
        }
    }
    
ANSWER:
    COUT(cnt);
    return 0;
}


Measured memory_bytes: 3156
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b = map(int, readline().split())
s = readline().decode()
bl = '-' == s[a] and '-' not in s[:a:]+s[-b::]
print('Yes' if bl else 'No')

Measured memory_bytes: 3064
N=int(input())
S=input()
E=[0]*N
W=[0]*N

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

EW=[0]*N
for i in range(N):
  EW[i]=E[i]+W[i]
print(N-1-(max(EW)-1))

Measured memory_bytes: 29620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
void solve()
{
	ll n,i,ans=1;
	cin>>n;
	ll a[n];
	map<int,int> m;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		m[a[i]]++;
	}
	for(auto it:m)
	{
		if(it.first==0 && it.second!=1)
			{
				ans=0;
				break;
			}
			else if(it.first==0)
			{
				continue;
			}
			else if(it.second!=2)
			{
				ans=0;
				break;
			}
			else
			{
				ans=ans*2;
				ans=ans%MOD;
			}
	}
	cout<<ans<<endl;

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

Measured memory_bytes: 3968
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
  string W;
  cin >> W;
  
  sort(W.begin(),W.end());

  for (string::iterator itr = W.begin(); itr != W.end(); itr+=2)
  {
    if(*itr != *(itr+1))
    {
      cout << "No" << endl;
      return 0;
    }
    
  }
  cout << "Yes" << endl;
  


  return 0;
}

Measured memory_bytes: 760
#include<iostream>

int main(){
	int n, m;
	std::cin >> n >> m;
	for(int i=0; i<m; i++){
		int a;
		std::cin >> a;
		n -= a;
		if(n < 0){
			std::cout << "-1" << std::endl;
			return 0;
		}
	}
	std::cout << n << std::endl;
	return 0;
}

Measured memory_bytes: 3612
//This program is written by Brian Peng.
#pragma GCC optimize("Ofast","inline","no-stack-protector")
#include<bits/stdc++.h>
using namespace std;
#define Rd(a) (a=read())
#define Gc(a) (a=getchar())
#define Pc(a) putchar(a)
int read(){
	int x;char c(getchar());bool k;
	while(!isdigit(c)&&c^'-')if(Gc(c)==EOF)exit(0);
	c^'-'?(k=1,x=c&15):k=x=0;
	while(isdigit(Gc(c)))x=(x<<1)+(x<<3)+(c&15);
	return k?x:-x;
}
void wr(int a){
	if(a<0)Pc('-'),a=-a;
	if(a<=9)Pc(a|'0');
	else wr(a/10),Pc((a%10)|'0');
}
signed const INF(0x3f3f3f3f),NINF(0xc3c3c3c3);
long long const LINF(0x3f3f3f3f3f3f3f3fLL),LNINF(0xc3c3c3c3c3c3c3c3LL);
#define Ps Pc(' ')
#define Pe Pc('\n')
#define Frn0(i,a,b) for(int i(a);i<(b);++i)
#define Frn1(i,a,b) for(int i(a);i<=(b);++i)
#define Frn_(i,a,b) for(int i(a);i>=(b);--i)
#define Mst(a,b) memset(a,b,sizeof(a))
#define File(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout)
#define N (200010)
int n,k,c,f[N],g[N],st[N],e[N],p(1);
char s[N];
stack<int>ans;
signed main(){
	Rd(n),Rd(k),Rd(c),cin>>s+1,Mst(g,0x3f);
	Frn1(i,1,n){
		if(i>c+1)p=max(p,f[i-c-1]+1);
		if(s[i]=='o'){
			if(p>k)exit(0);
			f[i]=p;
		}
	}
	Frn_(i,n,1){
		if(i+c<n)p=min(p,g[i+c+1]-1);
		if(s[i]=='o')g[i]=p;
	}
	Frn1(i,1,n)if(f[i]==g[i])e[f[i]]=i;
	Frn_(i,n,1)if(f[i]==g[i])st[f[i]]=i;
	Frn1(i,1,k)if(st[i]==e[i])wr(st[i]),Pe;
	exit(0);
}

Measured memory_bytes: 4864
#include <stdio.h>
int main(){
int i,n,l=0,x[100];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d ",&x[i]);
}
for(i=1;i<n-1;i++){
if((x[i-1]<x[i]&&x[i]<x[i+1])||(x[i-1]>x[i]&&x[i]>x[i+1]))
l++;
}
printf("%d ",l);
}

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

int main() {
  int W, a, b;
  cin >> W >> a >> b;
  
  if(b<a){
    int tmp=a;
    a=b;
    b=tmp;
  }
  
  cout << max(0, b-(a+W)) << endl;
}

Measured memory_bytes: 256
from itertools import combinations_with_replacement as c 
n, m, q = map(int, input().split()) 
arr = [] 
for i in range(q): 
    l = [*map(int, input().split())] 
    arr.append(l) 
res = 0
for g in c(list(range(1, m+1)), n): 
    f = 0 
    for h in arr:
        if g[h[1]-1] - g[h[0]-1] == h[2]: 
            f += h[3]
    res = max(res, f) 
print(res)


Measured memory_bytes: 9080
def chk(a):
    L = []
    for i in range(13000):
        if a >> i & 1:
            L.append(i)
    return L
H, W = map(int, input().split())
A = [[int(a) for a in input().split()] for _ in range(H)]
B = [[int(a) for a in input().split()] for _ in range(H)]
C = [[A[i][j] - B[i][j] for j in range(W)] for i in range(H)]
m = (1 << 12800) - 1
X = [[0] * (W) for _ in range(H)]
X[0][0] = (1 << 80 + C[0][0]) | (1 << 80 - C[0][0])
for i in range(H):
    for j in range(W):
        if i:
            X[i][j] |= (X[i-1][j] << 80 + C[i][j]) | (X[i-1][j] << 80 - C[i][j])
        if j:
            X[i][j] |= (X[i][j-1] << 80 + C[i][j]) | (X[i][j-1] << 80 - C[i][j])
        X[i][j] &= m
s = bin(X[-1][-1] + (1<<13000))
mi = 1<<100
for i in range(len(s)):
    if s[-i-1] == "1":
        mi = min(mi, abs(i-(H+W-1)*80))
print(mi)

Measured memory_bytes: 52060
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL //デバッグ出力系
#define dout cout
#define debug() if(true)
#else
#define dout if(false) cout
#define debug() if(false)
#endif//
#define next asdnext
#define prev asdprev
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define vrep(i, v) for(auto &i : v)
#define all(x) (x).begin(),(x).end()
#define vout(v) for(auto &i:v){cout<<i<<" ";}cout<<"\n"; //配列出力
#define vin(v) for(auto &i:v)cin>>i; //配列入力
#define vec(v,n) vector<int> v(n,0);
typedef long long ll;
typedef unsigned long long ull;

void Main() {
	int N, M;
	cin >> N >> M;
	vec(a, M);
	vin(a);
	vector<bool> broken(N+1,false);
	vrep(i, a) broken[i] = true;
	vector<ll> dp(N+2, 0);
	dp[N] = 1;
	for (int i = N - 1; i >= 0; i--) {
		if (broken[i] == 1) {
			dp[i] = 0;
			continue;
		}
		dp[i] = (dp[i + 1] + dp[i + 2]) % 1000000007;
		dout << i << ":" << dp[i] << "\n";
	}

	cout << (dp[0] % 1000000007) << endl;
}

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


Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main() {
	int x, y;
	cin >> x >> y;
	if (x%y == 0) {
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}







}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Threading.Tasks;
using System.IO;
using System.Xml;
//using System.Windows;
namespace _0593
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] ans = new int[n[0]];
            int[] a = new int[n[0]];
            int[] b = new int[n[1]];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < b.Length; i++)
            {
                b[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < b.Length; i++)
            {
                for (int k = 0; k < a.Length; k++)
                {
                    if (a[k] <= b[i]) { ans[k]++; break; }
                }
            }
            int max = 0;
            int Ans = 0;
            for (int i = 0; i < a.Length; i++)
            {
                if (ans[i] > max) { max = ans[i]; Ans = i; }
            }
            Console.WriteLine(Ans + 1);
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9528
N,A,B,C,D = map(int,input().split())
# 1-indexed
S = ["$"] + list(input())

if A < B < D < C:
    flag = False

    for i in range(B+1,D+2):
        if S[i-2] == S[i-1] == S[i] == ".":
            flag = True
            break
    for i in range(A+1,C+1):
        if S[i] == S[i-1] == "#":
            flag = False
            break
    
    if flag:
        print("Yes")
    else:
        print("No")

elif A < B < C < D:
    flag = True
    for i in range(A+1,D+1):
        if S[i] == S[i-1] == "#":
            flag = False
            break
    
    if flag:
        print("Yes")
    else:
        print("No")
        
elif A < C < B < D:
    flag = True
    for i in range(A+1,C+1):
        if S[i] == S[i-1] == "#":
            flag = False
            break
    for i in range(B+1,D+1):
        if S[i] == S[i-1] == "#":
            flag = False
            break
    if flag:
        print("Yes")
    else:
        print("No")

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

typedef long long ll;

int n, a[109]; ll dp[109][22];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	n--; dp[0][a[0]] = 1;
	for (int i = 1; i < n; i++) {
		for (int j = 0; j <= 20; j++) {
			if (j - a[i] >= 0) dp[i][j] += dp[i - 1][j - a[i]];
			if (j + a[i] <= 20) dp[i][j] += dp[i - 1][j + a[i]];
		}
	}
	cout << dp[n - 1][a[n]] << endl;
	return 0;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h> 
using namespace std;
///////////////////////////////////////////
const long long int INF = 100000000000;
const long long int Mod = 1000000007;
using ll = long long int; //long long int は64bit
using vi = vector<int>; using Vi = vector<long long int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
#define np nullptr
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define fill(x,num) memset(x,num,sizeof(x));
typedef vector<vector<ll> > matrix;
//       cin.tie(0);ios::sync_with_stdio(false);
void cinit(){cin.tie(0);ios::sync_with_stdio(false);}
typedef pair<ll,ll> Pair;
bool p_compare(const Pair& firstP, const Pair& secondP)
 { return firstP.first < secondP.first; }//sort(all(v),p_compare)で昇順ソート
//////////////////////////^^ *Emile ^^^//////////////////////////////////////////////////////
 
bool ck(char c){
	if(c=='A')return true;
	if(c=='C')return true;
	if(c=='G')return true;
	if(c=='T')return true;
	else return false;
}
 
ll n,q;
string s;
 
vi l,r;
ll sum[10000000]={0};
 
void init(){
	rep(i,s.size()){
		if(i==0)continue;
		if(s[i-1]=='A'&&s[i]=='C'){
			sum[i]=sum[i-1]+1;
		}else{
			sum[i]=sum[i-1];
		}
	}
}
 
int main(){
	cin>>n>>q>>s;
	ll lll,rrr;
	rep(i,q){
		cin>>lll>>rrr;
		l.pb(lll-1);r.pb(rrr-1);
	}//input
	init();
	//rep(i,n)cout<<sum[i];
	//cout<<""<<endl;
	rep(i,q){
		cout<<sum[r[i]]-sum[l[i]]<<endl;
	}
	return 0;
}

Measured memory_bytes: 2804
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <utility>
using namespace std;

int main()
{
    int p, q, r, min;
    cin >> p >> q >> r;

    if(p < q){
        if(q < r){
            cout << p + q;
        }
        else{
            cout << p + r;
        }
    }
    else{
        if(p < r){
            cout << p + q;
        }
        else{
            cout << q + r;
        }
    }


    return 0;
}

Measured memory_bytes: 256
//#define _USE_MATH_DEFINES
//#include <cmath>

#include <iostream>


using namespace std;


int N, R;




int main()
{

	cin >> N;
	cin >> R;

	int ans = R;

	if (N < 10) {
		ans = R + 100 * (10 - N);
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int AC=0;
	int WA=0;
	int TLE=0;
	int RE=0;
	int batas;
	scanf("%d", &batas);
	for(int i=1;i<=batas;i++){
		char string[6]="";
		scanf("%s", &string);
		if(string[0]=='A') AC++;
		else if(string[0]=='W') WA++;
		else if(string[0]=='T') TLE++;
		else if(string[0]=='R') RE++;
	}
	printf("AC x %d\n", AC);
	printf("WA x %d\n", WA);
	printf("TLE x %d\n", TLE);
	printf("RE x %d\n", RE);
	return 0;
}

Measured memory_bytes: 1732
import sys
def main():
    input = sys.stdin.readline
    A,B,Q=map(int, input().split())
    S=[int(input()) for _ in range(A)]
    T=[int(input()) for _ in range(B)]
    X=[int(input()) for _ in range(Q)]
    from bisect import bisect_left
    INF=10**11
    S=[-INF] + S + [INF]
    T=[-INF] + T + [INF]
    for x in X:
        sr = bisect_left(S, x)
        tr = bisect_left(T, x)
        sl,tl=sr-1,tr-1
        ans=INF
        ans = min(ans, abs(S[sl]-T[tl]) + min(abs(S[sl]-x), abs(T[tl]-x)))
        ans = min(ans, abs(S[sl]-T[tr]) + min(abs(S[sl]-x), abs(T[tr]-x)))
        ans = min(ans, abs(S[sr]-T[tl]) + min(abs(S[sr]-x), abs(T[tl]-x)))
        ans = min(ans, abs(S[sr]-T[tr]) + min(abs(S[sr]-x), abs(T[tr]-x)))
        print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 152284
#include<bits/stdc++.h>
using namespace std;
#define y1 A2Dalek
#define y0 Cyberman
#define yn RoseTyler
#define j1 JackHarkness
#define fs first
#define sd second
const int N=6000;
const int oo=1e9+5;
int du[]={-1,0,0,1};
int dv[]={0,-1,1,0};
const long long mod=998244353;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
long long sqr(long long x) {return x*x;}
int getbit(int state, int i) {return ((state>>i)&1);}

long long Pow2[N+5],tu[N+5],mau[N+5],ans[N+5];
long long Pow(long long x, long long y)
{
    if (y==0) return 1;
    long long tmp=Pow(x,y/2);
    tmp=tmp*tmp%mod;
    if (y%2) return tmp*x%mod;
    return tmp;
}
long long C(int n, int k)
{
    if (k>n) return 0;
    return tu[n]*mau[k]%mod*mau[n-k]%mod;
}
void khoitao()
{
    Pow2[0]=1;
    for (int i=1;i<=N;i++) Pow2[i]=Pow2[i-1]*2%mod;
    tu[0]=1;
    for (int i=1;i<=N;i++) tu[i]=tu[i-1]*i%mod;
    mau[N]=Pow(tu[N],mod-2);
    for (int i=N-1;i>=0;i--) mau[i]=mau[i+1]*(i+1)%mod;
}
int n,k;
int dem(int val)
{
    int tmp=0;
    for (int i=1;i<=k;i++) if (val-i<=k && i<val-i) tmp++;
    return tmp;
}
int main()
{
	//freopen("Stop. Otherwise....inp","r",stdin);
	//freopen("Stop. Otherwise....out","w",stdout);
	ios_base::sync_with_stdio(false);
	khoitao();
    cin>>k>>n;
    for (int val=3;val<=2*k-1;val+=2)
    {
        int g=dem(val);
        for (int num=0;num<=g;num++) ans[val]=(ans[val] + C(n+k-2*g-1,k-2*g+num-1)*C(g,num)%mod*Pow2[num]%mod)%mod;
    }
    for (int val=2;val<=2*k;val+=2)
    {
        int g=dem(val);
        for (int num=0;num<=g;num++)
        {
            ans[val]=(ans[val] + C(n+k-2*g-1-1,k-2*g-1+num-1)*C(g,num)%mod*Pow2[num]%mod)%mod;
            ans[val]=(ans[val] + C(n-1+k-2*g-1-1,k-2*g-1+num-1)*C(g,num)%mod*Pow2[num]%mod)%mod;
        }
    }
    for (int i=2;i<=2*k;i++) cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 512