akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    pair<bool, ll> flag;
    ll ans = 0;
    for (ll i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end(), greater<ll>());
    for (ll i = 0; i < n; i++) {
        ans += a[i];
        if (a[i] % 10) {
            flag.first = true;
            flag.second = i;
        }
    }
    if(!(ans%10)){
        if (flag.first)
            ans -= a[flag.second];
        else
            ans = 0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3528
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long unsigned int ll;
 
int main() {
	
  vector<string> s(3);
  int a,b,c,d,i,j,k;
  cin >> s[0];
  cin >> s[1];
  cin >> s[2];

  a=0;
  while(1){
    if(s[a].length()<1){
      cout << char('A'+a) <<endl;
      return 0;
    }else{
      b=int(s[a].front()-'a');
      s[a].erase(0,1);
      a=b;
      
    }
  }
  
  
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int maxn = 500;
#define LL long long 
struct pp{
  int x,y;
}R[maxn*maxn];
int fr;
int n,m,d;
int mp[maxn * maxn];
map<int,LL> sum[maxn * maxn];
LL cost(int pos)
{
   return abs(R[mp[pos]].x - R[mp[pos + d]].x) + abs(R[mp[pos]].y - R[mp[pos + d]].y);
}
int main(){
   int cnt = 0;
   scanf("%d%d%d",&n,&m,&d);
   for (int i = 1; i <= n; i++){
     for (int j = 1; j <= m; j++){
        int v;
        scanf("%d",&v);
        R[cnt].x = i;
        R[cnt].y = j;
        mp[v] = cnt;
        cnt++;
     }
   }
   int q;
   scanf("%d",&q);
  // memset(sum,0,sizeof(sum));
   for (int i = 1; i <= d; i++){
       for (int j = i + d; j <= n * m; j += d){
          //cout<<i<<" "<<j - d<<endl;
          sum[i][j] = sum[i][j - d] + cost(j - d);
       }
   }
   while (q--){
      int l,r;
      scanf("%d%d",&l,&r);
      //cout << l % d<<endl;
      int now = l % d == 0 ? d : l % d;
      printf("%lld\n",sum[now][r] - sum[now][l]);
   }
} 

Measured memory_bytes: 14336
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

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

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

int main() {
  int x;
  cin >> x;
  cout << 10 - x / 200 << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
int main() {
  int n, m, x; cin >> n >> m >> x;
  vector<int>a(m);
  rep(i,m) cin >> a[i];
  int count1=0;
  for(int i=x; i < n+1; i++){
    rep(j,m){
    if(i==a[j]) count1++;
    }
  }
  int count2=0;
  rep(i, x){
    rep(j,m){
    if(i==a[j]) count2++;
    }
  }
  cout << min ( count1, count2 ) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>

int main(){

    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);

    int a,b,c;
    std::cin >> a >> b >> c;

    std::swap(a,b);
    std::swap(a,c);

    std::cout << a << ' ' << b << ' ' << c << '\n';

}

Measured memory_bytes: 256
w,h= map(int,input().split())
p = sorted([int(input()) for _ in range(w)],reverse=True)
q = sorted([int(input()) for _ in range(h)],reverse=True)
sumrp = [0]*w
sumrp[-1]=p[-1]
for i in range(w-2,-1,-1):sumrp[i]=sumrp[i+1]+p[i]
sumrq = [0]*h
sumrq[-1]=q[-1]
for i in range(h-2,-1,-1):sumrq[i]=sumrq[i+1]+q[i]
gen=0
pid = qid = 0
w+=1
h+=1
while True:
    if pid==w-1:
        gen+=sumrq[qid]
        break
    if qid==h-1:
        gen+=sumrp[pid]
        break
    if p[pid]>=q[qid]:
        gen+=p[pid]
        gen+=sumrq[qid]
        pid+=1
    elif p[pid]<q[qid]:
        gen+=q[qid]
        gen+=sumrp[pid]
        qid+=1
print(gen)

Measured memory_bytes: 20520
x1, y1, x2, y2 = list(map(int, input().split()))
x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)
x4 = x3 - (x2 - x1)
y4 = y3 - (y2 - y1)
print("{} {} {} {}".format(x3, y3, x4, y4))

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if (a == b && a != c)
    {
        printf("Yes\n");
    }
    else if (a == c && a != b)
    {
        printf("Yes\n");
    }
    else if (c == b && a != c)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sort stable_sort
using namespace std; 
 
int _;
 
int n,x,t; 
  
int main()
{
	//for(scanf("%d",&_);_;_--)
	scanf("%d%d%d",&n,&x,&t);
	printf("%d\n",((n-1)/x+1)*t); 
	return 0;
}

Measured memory_bytes: 3784
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] w = new int[n+1];
        for(int i = 1;i<=n;i++){
            w[i] += w[i-1] + Integer.parseInt(sc.next());
        }
        int min = Integer.MAX_VALUE;
        for(int i = 1;i<=n;i++){
            if(min > Math.abs(w[n] - w[i] * 2)){
                min = Math.abs(w[n] - w[i] * 2);
            }
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 21844
#include<iostream>
using namespace std;
int main(){
  int n,a = 100000;
  cin >>n;
  while(n--){
    a = (int)((double)a*1.05);
    if(a%1000) a = (a/1000+1)*1000;
  }
  cout <<a<<endl;
  return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ABC143A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B;
            var word = Console.ReadLine().Split(' ');
            A = int.Parse(word[0]);
            B = int.Parse(word[1]);
            if (A<=B*2)
            {
             Console.WriteLine(0);
            }
            else if (A>B*2)
            {
             Console.WriteLine(A - B * 2);
            }
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11092
import itertools

n = int(input())
p = tuple(int(i) for i in input().split())
q = tuple(int(i) for i in input().split())

c = 0
for s in itertools.permutations(range(1, n+1), n):
    c += 1
    if s == p:
        a = c
    if s == q:
        b = c

ans = abs(a - b)
print(ans)


Measured memory_bytes: 39024
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
	const double base[] = { 0.0, 0.2, 0.6, 1.1, DBL_MAX };
	//»è	Í
	//A	1.1Èã
	//B	0.6Èã1.1¢
	//C	0.2Èã0.6¢
	//D	0.2¢ 

	string str = "";
	vector <vector <int> > t (4, vector<int> (2, 0 ) );
	int size = sizeof (base )/sizeof (base[0] );
	int i,j;

	while (getline (cin, str ) ){

		vector <double> eyes(2, 0.);
		stringstream ss(str);
		ss >> eyes[0] >> eyes[1];	// left, right order

		for (i = 0; i < 2; ++i){
			for (j = 0; j < size - 1; ++j){
				if (eyes[i] >= base[j] && eyes[i] < base[j+1] ){
					++t[j][i];
				} // end if
			} // end for
		} // end for
	} // end while

	for (i = 3; i >= 0; --i){
		cout << t[i][0] << ' ' << t[i][1] << endl;
	} // end for
		
	return 0;
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M; cin >> N >> M;
    pair<int, int> need[M+1];
    need[0] = make_pair(-mod, mod);
    rep(i, M){
        int a, b; cin >> a >> b;
        need[i+1] = make_pair(a, b);
    }
    sort(need, need+(M+1));
    int ans = 0;
    int mxl = need[0].first, mnr = need[0].second;
    for(int i = 1; i <= M; i++){
        if(need[i].first >= mnr){
            ans++;
            mxl = need[i].first;
            mnr = need[i].second;
        }
        else{
            mxl = max(mxl, need[i].first);
            mnr = min(mnr, need[i].second);
        }
    }
    cout << ans+1 << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using o_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define M 1000010

int main(){
	IOS;
	
	string s;cin>>s;
	string s3,s4;
	rep(i,0,2)s3+=s[i];
	rep(i,2,4)s4+=s[i];
	ll s1=stoi(s3),s2=stoi(s4);
	ll e1= (s1>0 and s1<=12);
	ll e2= s1>12;
	ll e3= (s2>0 and s2<=12);
	ll e4= s2>12;
	if(e1 and e3)cout<<"AMBIGUOUS";
	else if(e1 and (e4 or s2<1))cout<<"MMYY";
	else if(e3 and (e2 or s1<1))cout<<"YYMM";
	else cout<<"NA";
	return 0;
}



Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <math.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  long long H[n];
  for(int i = 0; i < n; i++){
    cin >> H[i];
  }
  int ans[n] = {0};
  for(int i = n-2; i >= 0; i--){
    if(H[i] >= H[i+1]){
      ans[i] = ans[i+1] + 1;
    }else{
      ans[i] = 0;
    }
  }
  int max = 0;
  for(int i = 0; i < n; i++){
    max = std::max(max,ans[i]);
  }
  printf("%d\n", max);
  return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	vector <int> a(3);
	for (int i=0; i<3; i++)
		cin>>a[i];
	cout<<(a[0]+a[1]+a[2]<=21?"win":"bust")<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n; int a[n]; 
  unordered_map<int,int> a1,a2,a3;
  for(int i=0;i<n;i++){ cin>>a[i];a1[a[i]]++; }
  sort(a,a+n);
  for(int i=0;i<n;i++){
    if(!a2[a[i]]){
    for(int j=a[i];j<=1e6;j+=a[i]){
      a3[j]+=a1[a[i]];
    }
      a2[a[i]]=1;
    }
  }
  int cnt=0;
  for(int i=0;i<n;i++){
    if(a3[a[i]]==1){ cnt++;}
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 60188
a, b, c, k = map(int, input().split())
total = 0
m = k

m -= a
if m > 0:
    total += a
    m -= b
    if m > 0:
        m -= c
        if m > 0:
            print(a-c)
        else:
            print(a-(c+m))
    else:
        print(a)
else:
    print(k)

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

using namespace std;
using P = pair<int, int>;

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; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int N; cin >> N;
    vector<int> d( N );
    REP( i, N ) cin >> d[i];
    sort( ALL( d ) );

    cout << d[N / 2] - d[N / 2 - 1] << endl;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
//#pragma GCC target ("avx,tune=native")
//Use above if bruteforcing with lots of small operations. Or just use it anytime, there's no downside.
//AVX is better slightly
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef long double ld;

ll inv(ll a, ll b){
    return (a > 1 ? b - inv(b%a, a)*b/a : 1);
}

#define rc(s) return cout << s, 0
#define fi first
#define se second
#define L (nod << 1)
#define R (L | 1)
#define smax(X, Y) ((X) > (Y) ? (X) : (Y))
#define smin(X, Y) ((X) < (Y) ? (X) : (Y))

const ld e = 2.71828182845904523536028747;
const ld PI = 3.14159265359;
const ll inf = (1LL<<62);
const int iinf = (1<<30);
//CLOCKS_PER_SEC

int n, m;

int main(){
    //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    //ios_base::sync_with_stdio(0); cin.tie(0);
    //ifstream cin ("test.in");
    cin >> n >> m;
    ll ans = 0;
    if (n > 1) ans += n * (n - 1) / 2;
    if (m > 1) ans += m * (m - 1) / 2;
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <string>
using namespace std;
int a[100010];
char s[100010];
int n, dir[4][2] = {{0, 0}, {1, 1}, {0, 1}, {1, 0}};
int main ()
{
    scanf("%d", &n);
    scanf("%s", s);
    int f = 0;
    for(int i = 0; i < 4; i++)
    {
        a[0] = dir[i][0];
        a[1] = dir[i][1];
        for(int j = 1; j <= n; j++)
        {
            if(!a[j])
            {
                if(s[j%n] == 'o')
                    a[j+1] = a[j-1];
                else
                    a[j+1] = !a[j-1];
            }
            if(a[j])
            {
                if(s[j%n] == 'o')
                    a[j+1] = !a[j-1];
                else
                    a[j+1] = a[j-1];
            }
        }
        if(a[n] == a[0] && a[n+1] == a[1])
        {
            f = 1;
            break;
        }
    }
    if(f)
    {
        for(int i = 0; i < n; i++)
            if(a[i]) printf("W");
            else  printf("S");
        printf("\n");
    }
    else printf("-1\n");
}


Measured memory_bytes: 768
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  (n, m, x) = InputLine.to_ia

  c = [0] * n
  a = [nil] * n
  n.times do |i|
    line = InputLine.to_ia
    
    c[i] = line[0]
    a[i] = line[1..]
  end

  min_cost = 1e+12.to_i
  (1 << n).times do |bs|
    s = [0] * m
    t = 0

    n.times do |i|
      if ((bs >> i) & 1) == 1 then
        m.times do |j|
          s[j] += a[i][j]
        end
        t += c[i]
      end
    end

    flag = true
    m.times do |j|
      flag = false unless s[j] >= x
    end
    min_cost = [min_cost, t].min if flag
  end

  if min_cost == 1e+12.to_i then
    puts (-1).to_s
  else
    puts min_cost.to_s
  end
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 14472
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'
 
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll K;
  cin >> K;
  string ans;
  string s = "ACL";
  for (int i = 0; i < K; ++i) ans += s;
  cout << ans << endl;

}


Measured memory_bytes: 3608
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if((a * b) % 2 == 0){
            System.out.println("Even");
        }
        else{
            System.out.println("Odd");
        }
    }
}

Measured memory_bytes: 21844
def main():
    from collections import deque
    s = deque(input())
    q = int(input())

    flag = 0
    query = []

    for _ in range(q):
        temp = input().split()
        if len(temp) == 1:
            flag += 1
        else:
            query.append(temp + [flag%2])

    for q in query:
        if q[-1] == 0:
            if q[1] == "1":
                s.appendleft(q[2])
            else:
                s.append(q[2])
        else:
            if q[1] == "1":
                s.append(q[2])
            else:
                s.appendleft(q[2])

    if flag % 2 == 1:
        print("".join(list(s)[::-1]))
    else:
        print("".join(s))

main()


Measured memory_bytes: 34876
LEFT = "L"
RIGHT = "R"
LOOP_STR="RL"

S = gets.chomp

def S.find_rl_idx
  rl_idxes = []
  pre_s = ""
  self.chars.each_with_index do |s, i|  
    if pre_s == RIGHT && s == LEFT
      rl_idxes << i-1
    end
    pre_s = s
  end
  rl_idxes.size < 10 ? rl_idxes : nil
end

def find_terminal_idx i, rl_idxes
  if rl_idxes
    rl_idx = if S[i] == RIGHT
      rl_idxes.find{|j| j >= i}
    else
      rl_idxes.reverse.find{|j| j < i}
    end
  else
    rl_idx = if S[i] == RIGHT
      i + S[i..-1].index(LOOP_STR)
    else
      S[0..i].rindex(LOOP_STR)
    end
  end
  used_times = (rl_idx - i).abs
  used_times.even? ? rl_idx : rl_idx + 1
end

rl_idxes = S.find_rl_idx
ans_data = S.size.times.map do |i|
  find_terminal_idx i, rl_idxes
end

ans = Array.new(S.size, 0)
ans_data.each do |datum|
  ans[datum] += 1
end

puts ans.join(" ")


Measured memory_bytes: 100828
def get_int(): return int(input())
def get_float(): return float(input())
def get_line(): return input().split()
def get_lines(v): return [get_line() for _ in range(v)]
def get_int_line(): return list(map(int, get_line()))
def get_int_lines(v): return [get_int_line() for _ in range(v)]
def get_float_line(): return list(map(float, get_line()))
def get_float_lines(v): return [get_float_line() for _ in range(v)]

N = get_int()
L = get_int_line()
L.sort()
sum = 0
for i in range(N - 1):
  sum += L[i]
if (sum > L[N - 1]):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()

int main() {
    int n;
    scanf("%d", &n);
    int ma=0, mi=1000000001;
    rep(i,n) {
        int c;
        scanf("%d", &c);
        ma = max(ma, c);
        mi = min(mi, c);
    }
    printf("%d\n", ma-mi);
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		int maxN = 100001;
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			int[] a = in.nextIntArray(n);
			Arrays.sort(a);

			int[] nums = new int[maxN];
			for (int i : a) {
				nums[i]++;
			}

			for (int i = 0; i < nums.length; i++) {
				if (nums[i] >= 3 && nums[i] % 2 == 1) {
					nums[i] = 1;
				} else if (nums[i] >= 3 && nums[i] % 2 == 0) {
					nums[i] = 2;
				}
			}

			int count = 0;
			for (int i : nums) {
				if (i == 2) {
					count++;
				}
			}

			long sum = 0;
			for (int i : nums) {
				sum += i;
			}
			if (count % 2 == 0) {
				sum -= count;
			} else {
				sum -= count+1;
			}

			System.out.println(sum);
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 36192
#include<iostream>
#include<cmath>
#include<cctype>
#include<algorithm>
using namespace std;
const int N=1e5+5;
inline int read(){
	int x=0,w=0;char ch=0;
	while(!isdigit(ch)) w|=ch=='-',ch=getchar();
	while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return w?-x:x;
}
int n,c,k,cnt,ans,d,t[N];
int main(){
	n=read(),c=read(),k=read();
	for(int i=1;i<=n;++i) t[i]=read();
	if(c==1){
		printf("%d\n",n);
		return 0;
	}
	sort(t+1,t+n+1);
	int last=t[1]+k,cnt=1;
	for(int i=2;i<=n;++i){
		if(!last){
			++cnt,last=t[i]+k;continue;
		}
		if(t[i]<=last){
			++cnt;
		}
		else{
			++ans;d=i-1;cnt=1;
			last=t[i]+k;
		}
		if(cnt==c){
			++ans;last=0;cnt=0;d=i;
		}
	}
	if(d^n) ++ans;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
template <class T> vector<T> make_vec(size_t a, T val) {
    return vector<T>(a, val);
}
template <class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec(ts...))>(a, make_vec(ts...));
}
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
template <typename T> struct edge {
    int to;
    T cost;
    edge(int t, T c) : to(t), cost(c) {}
};
template <typename T> using WGraph = vector<vector<edge<T>>>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    string S;
    cin >> S;
    if(S.back() == 's') {
        cout << S << "es" << endl;
    } else {
        cout << S << "s" << endl;
    }
}

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

int main(){
	long long n,m;
	cin>>n>>m;

	vector<pair<long long,long long>> pt;

	for(int i = 0; i < n; i++){
		int x,y;cin>>x>>y;
		pt.emplace_back(make_pair(x,y));
	}
	sort(pt.begin(),pt.end());
	long long int res = 0;

	for(auto &p : pt){
		if(m==0) break;
		long long mn = min(m,p.second);
		res+=(long long)(mn*p.first);
		m-=mn;
	}
	cout<<res;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
#include <ext/numeric>
#define     __        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define     pi        acos(-1)
#define     ll        long long int
#define     mem(a)    memset(a,0,sizeof(a))
#define     mems(a)   memset(a,-1,sizeof(a))
#define     pii       pair<int,int>
#define     N         3000000
using namespace std;


int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    
    int a,b;
    
    cin >> a >> b;
    
    if(a<b) cout <<0;
    else cout << 10;
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){

  string S;
  cin >> S;
  int ans = 1;
  int pre_start = 0;
  string tmp1 = "";
  tmp1 = tmp1 + S[0];
  string tmp2 = "";

  for(int i=1;i<S.size();i++){
    tmp2 = tmp2 + S[i];
    if(tmp1 != tmp2){
      ans +=1;
      tmp1 =tmp2;
      tmp2 ="";
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 640
function parseInt(x) parse(Int, x) end

function main()
	n = parseInt(readline())
	a = map(parseInt, split(readline()))
	b = Array{Int}(n)
	if n%2 == 0
		for i in 1:2:n
			b[div(n,2)-div(i,2)] = a[i]
		end
		for i in 2:2:n
			b[div(n,2)+div(i,2)] = a[i]
		end
		for i in 1:n
			println(b[n-i+1])
		end
	else
		for i in 1:2:n
			b[div(n,2)+1-div(i,2)] = a[i]
		end
		for i in 2:2:n
			b[div(n,2)+1+div(i,2)] =a[i]
		end
		for i in 1:n
			println(b[i])
		end
	end
end

main()

Measured memory_bytes: 214176
#include<stdio.h>

int main()
{
   int i;
   int n;
   scanf("%d", &n);
   int R[n];

   for(i=0; i<n; ++i){
      scanf("%d", &R[i]);
   }

   int min = R[0];
   int max = R[1]-R[0];

   for(i=1; i<n; ++i){
      max = (max<(R[i]-min)) ? (R[i]-min) : max;
      min = (min>R[i]) ? R[i] : min;
   }

   printf("%d\n", max);

   return 0;
}

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

#define int long long

using namespace std;

const int mod = 1e9 + 7;

int32_t main() {
    ios_base::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<vector<int>> dp(2, vector<int>(k + 1, 0));
    dp[0][k] = 1;
    for (int i = 1; i <= n; i++) {
        vector<int> sum(k + 2);
        for (int j = 0; j <= k; j++) {
            sum[j + 1] = sum[j] + dp[(i - 1) % 2][j];
            sum[j + 1] %= mod;
        }
        for (int j = 0; j <= k; j++) {
            dp[i % 2][j] = (sum[min(k, j + a[i - 1]) + 1] - sum[j] + mod) % mod;
        }
    }
    cout << dp[n % 2][0] << endl;
}


Measured memory_bytes: 5612
import java.io.*;


class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String line;
            String[] aList = null;
            String[] bList = null;
            int cnt = 0;
            while((line = br.readLine()) != null){
            	if(cnt == 0) {
            		cnt++;
            		aList = line.split(" ", 0);
            	}else{
            		bList = line.split(" ", 0);
            		cnt = 0;
            		System.out.println(hitAndBlow(aList, bList));
            	}
            }
            
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * @param aList bList
     *         
     * @return ???????????¢????????????????????????
     */
    private static String hitAndBlow(String[] aList, String[] bList) {
    	int hit = 0;
    	int blow = 0;
    	for (int i = 0; i < 4; i++) {
    		for (int j = 0; j < 4; j++) {
        		if(Integer.parseInt(aList[i] ) == Integer.parseInt(bList[j])) {
        			if(i == j) {
        				hit ++;
        			}else {
        				blow ++;
        			}
        		}
        	}
    	}
    	return(hit + " " + blow);
    }
}

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

int N, T;
int c[110];
int t[110];
const int INF = 100000;

int main() {
  cin >> N >> T;
  for(int i = 0; i < N; i++) {
    cin >> c[i] >> t[i];
  }

  int cost_min = INF;
  for(int i = 0; i < N; i++) {
    if(t[i] <= T && c[i] < cost_min) {
      cost_min = c[i];
    }
  }

  if(cost_min == INF) {
    cout << "TLE" << endl;
  }
  else {
    cout << cost_min << endl;
  }
  return 0;
}

Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()
lr = [list(map(int, input().split())) for _ in range(Q)]

# 累積和
cumSum = [0] * (N + 1)

cnt = 0

for i in range(1, N):
    pre = S[i - 1]
    now = S[i]

    if pre == "A" and now == "C":
        cnt += 1

    cumSum[i + 1] = cnt
    pre = now

for l, r in lr:
    print(cumSum[r] - cumSum[l])


Measured memory_bytes: 29976
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <set>

using namespace std;

const int MAXN = 100005;

typedef long long s64;

struct Node *nil = 0;
struct Node
{
	int dep;
	Node *c[2];
	
	Node() {}
	Node(int x) : dep(x)
	{
		c[0] = c[1] = nil;	
	}
};

class Trie
{
private:
	s64 L;
	Node *root;
	
public:
	
	Trie(s64 x) : L(x)
	{ 
		root = new Node(0);
	}
	
	void insert(const string &s)
	{
		Node *p = root;
		for (int i = 0; i < s.size(); i++)
		{
			int x = s[i] - '0';
			if (p->c[x] == nil)
				p->c[x] = new Node(p->dep + 1);
			p = p->c[x];
		}
	}
	
	void dfs(Node *p, s64 &v)
	{
		s64 h = L - p->dep;
		if ((p->c[0] == nil) ^ (p->c[1] == nil))
		{
			v ^= (h & -h);
		}
		if (p->c[0] != nil) dfs(p->c[0], v);
		if (p->c[1] != nil) dfs(p->c[1], v);
	}
	
	s64 getans()
	{
		s64 ret = 0;
		dfs(root, ret);
		return ret;
	}
};

string s;

s64 n, L;

int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> L;
	Trie t(L);
	for (int i = 1; i <= n; i++)
		cin >> s, t.insert(s);
	s64 res = t.getans();
	if (res == 0)
		cout << "Bob" << endl;
	else
		cout << "Alice" << endl;
	return 0;	
}


Measured memory_bytes: 4048
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N;
  cin >> N;
  vector<pair<ll,int>> ai(N);
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    ai.at(i)=mp(a,i);
  }

  sort(all(ai));
  reverse(all(ai));
  vector<vector<ll>> dp(N+1,vector<ll>(N+1,0));
  for(int num=0;num<N;num++){
    for(int l=0;l<=num;l++){
      int r=num-l;
      ll a=ai.at(num).fi;
      int i=ai.at(num).se;
      dp.at(l+1).at(r)=max(dp.at(l+1).at(r),dp.at(l).at(r)+a*abs(i-l));
      dp.at(l).at(r+1)=max(dp.at(l).at(r+1),dp.at(l).at(r)+a*abs(i-(N-1-r)));
    }
  }
  ll ans=0;
  for(int i=0;i<=N;i++)  ans=max(ans,dp.at(i).at(N-i));
  cout << ans << endl;

  return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;


int N;
int prime[101];

int num(int x){
    int ret = 0;
    REP(i, N + 1) if(prime[i] >= x - 1) ret++;
    return ret;
}

signed main(){
    cin >> N;
    REP(i, N + 1) prime[i] = 0;
    FOR(i, 2, N + 1){
        int n = i;
        FOR(j, 2, i + 1){
            while(n % j == 0){
                prime[j]++;
                n /= j;
            }
        }
    }
    PRINT(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) + num(5) * (num(5) - 1) * (num(3) - 2) / 2);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include <vector>
using namespace std;
int main() {
	long long n, a, ans = 0; cin >> n;
	int test[123456] = { 0 };
	for (int h = 1; h <= n; h++) {
		cin >> a; test[h] = a;
	}
	for (int h = 1; h <= n; h++) {
		if (test[h] == h && h != n) {
			int uio = test[h];
			test[h] = test[h + 1];
			test[h + 1] = uio;
			ans++;
		}
		if (test[h] == h && h == n) {
			int uio = test[h];
			test[h] = test[h - 1];
			test[h - 1] = uio;
			ans++;
		}
	}
	cout << ans << endl;
	cin >> n;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;
 
int main() {
  ll n,m;
  cin >> n >> m;
  vec v(m);
  vector<set<ll>> E(m);
  for(ll i=0;i<m;i++) {
    ll b;
    cin >> v[i] >> b;
    for(ll j=0;j<b;j++) {
      ll temp;
      cin >> temp;
      temp--;
      E[i].insert(temp);
    }
  }
  vec dp((1<<n),inf);
  dp[0]=0;
  for(ll i=0;i<(1<<n);i++) {
    if(dp[i]==inf) continue; 
    for(ll j=0;j<m;j++) {
      ll nex=i;
      for(ll u:E[j]) {
        if(!((nex>>u)%2)) {
          nex+=(1<<u);
        }
      }
      dp[nex]=min(dp[nex],dp[i]+v[j]);
    }
  }
  ll ans=dp[(1<<n)-1];
  if(ans==inf) ans=-1;
  cout << ans << endl;
}

Measured memory_bytes: 896
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#define ll long long
#define inf 2147483647
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define repp(i,a,b,c) for(int i=a;i<=b;i+=c)
#define reph(i,a,b) for(i=a;i<=b;++i)
#define reg(i,head,d,a) for(int i=head[d];i;i=a[i].next)
#define rap(i,a,b) for(int i=a;i>=b;--i)
#define me(a,b) memset(a,b,sizeof(a));
#define poi(lx,ly,rx,ry) ((lx>rx or ly>ry)?0:(ice[rx][ry] + ice[lx-1][ly-1] - ice[rx][ly-1] - ice[lx-1][ry]))
int n, m, sx, sy;
int ice[45][45], ans = inf, f[45][45][45][45];
char temp;

using namespace std;

int main() {
    ios::sync_with_stdio(0);

    cin >> n >> m;
    me(f, 0x7f);
    f[1][1][n][m] = 0;
    rep(i, 1, n) {
        rep(j, 1, m) {
            cin >> temp;
            if (temp == 'P')
                sx = i, sy = j;
            ice[i][j] = ice[i - 1][j] + ice[i][j - 1] - ice[i - 1][j - 1] + ((temp == '#') ? 1 : 0);
        }
    }
    rep(i, 1, sx) {
        rep(j, 1, sy) {
            rap(o, n, sx) {
                rap(p, m, sy) {
                    ans = min(ans, f[i][j][o][p]+min(min(poi(i,j,sx,sy),poi(i,sy,sx,p)),min(poi(sx,j,o,sy),poi(sx,sy,o,p))));
                    rep(s, i, o) {
                        rep(t, j, p) {
                            if (sx <= s and sy <= t)
                				f[i][j][s][t]=min(f[i][j][s][t],f[i][j][o][p]+poi(i,t + 1,s,p)+poi(s + 1,j,o,t));
            				if (sx <= s and sy >= t)
            				    f[i][t][s][p]=min(f[i][t][s][p],f[i][j][o][p]+poi(i,j,s,t - 1)+poi(s + 1,t,o,p));
            				if (sx >= s and sy >= t)
            				    f[s][t][o][p]=min(f[s][t][o][p],f[i][j][o][p]+poi(i,t,s - 1,p)+poi(s,j,o,t - 1));
            				if (sx >= s and sy <= t)
            				    f[s][j][o][t]=min(f[s][j][o][t],f[i][j][o][p]+poi(i,j,s - 1,t)+poi(s,t + 1,o,p));
                        }
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <queue>

using namespace std;

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

struct B {
  string s;
  int p;
  int i;
};

int n;

vector<B> a;

void input() {
  cin >> n;

  a = vector<B>(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].s >> a[i].p;

    a[i].i = i + 1;
  }
}

void solve1() {
  sort(a.begin(), a.end(), [](const auto& a, const auto& b) {
    if (a.s != b.s)
      return a.s < b.s;

    return a.p > b.p;
  });

  for (auto&& i : a)
    cout << i.i << '\n';
}

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  preambule();
  input();
  solve1();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b;
	cin>>a>>b;
	long long c,d,e;
	c=a+b;
	d=a-b;
	e=a*b;
    	if(c>=d && c>=e) cout<<c;
    	else if(d>=c && d>=e) cout << d;
    	else cout << e;
	} 

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#include <unordered_map>

using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e9;
const int MB = 20;
const int MOD = 1e9 + 7;

void solve() {
    int a, b;
    cin >> a >> b;
    if (a <= 5) cout << 0;
    else if (a <= 12) cout << b / 2;
    else cout << b;
}

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

Measured memory_bytes: 256
class SegTree:
    def __init__(self, init_val, ide_ele, seg_func):
        self.segfunc = seg_func
        n = len(init_val)
        self.num = 2**(n-1).bit_length()
        self.ide_ele = ide_ele
        self.seg=[self.ide_ele]*2*self.num
        for i in range(n):
            self.seg[i+self.num-1]=init_val[i]    
        for i in range(self.num-2,-1,-1) :
            self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) 
        
    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        # k+1ではなくkでは？
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
        
    def query(self, p, q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res
import sys;input=sys.stdin.readline
mod = 998244353
N=int(input())
X = []
Y = []
for _ in range(N):
    x, d = map(int, input().split())
    X.append((x,d))
X.sort(key=lambda x:x[0])
for i, (x, d) in enumerate(X):
    Y.append((2*x,i,0))
    Y.append((2*x+2*d-1,i,1))
Y.sort(key=lambda x:x[0])
C = [0]*N
for x, i, t in Y:
    if t==0:
        j = i
    elif t==1:
        C[i] = j
st = SegTree(C, -1, max)
dp1 = [0]*(N+1)
dp2 = [1]*(N+1)
for i in range(N-1, -1, -1):
    y=st.query(i, C[i]+1)
    st.update(i, y)
    dp1[i] = (dp1[i+1]+dp2[i+1]) % mod
    dp2[i] = (dp1[y+1]+dp2[y+1]) % mod
print((dp1[0]+dp2[0])%mod)


Measured memory_bytes: 122540
#include<stdio.h>
int main(void)
{
  char str1[3],str2[3],str3[3];
  scanf("%s", str1);
  scanf("%s", str2);
  scanf("%s", str3);
  printf("%c%c%c", str1[0],str2[1],str3[2]);
  return 0;
}

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

#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(var,start,end) for(int var=start; var<end; var++)
#define repr(var,start,end) for(int var=start; var>=end; var--)
#define repi(var,start,end) for(int var=start; var<=end; var++)
#define debg(var) cerr<<#var<<" : "<<var<<" "
#define pb push_back
#define mp make_pair

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

void solve() {
    int n;
    cin>>n;
    map<string, int> freq;
    freq["AC"] = 0;
    freq["WA"] = 0;
    freq["TLE"] = 0;
    freq["RE"] = 0;
    rep(i,0,n) {
        string s;
        cin>>s;
        freq[s]++;
    }
    cout<<"AC x "<<freq["AC"]<<'\n';
    cout<<"WA x "<<freq["WA"]<<'\n';
    cout<<"TLE x "<<freq["TLE"]<<'\n';
    cout<<"RE x "<<freq["RE"]<<'\n';
}
int main() {
    fastio
    int t = 1;
    //cin>>t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

#define NUM 1000000

int n,tetra_sum[NUM],odd_sum[NUM];

void tetrahedral(int sum[],int tetra)
{
  for(int i=tetra;i<NUM;i++)
    sum[i]=min(sum[i],sum[i-tetra]+1);
}

int main()
{
  tetra_sum[0]=0; odd_sum[0]=0;
  for(int i=1;i<NUM;i++){
    tetra_sum[i]=NUM; odd_sum[i]=NUM;
  }
  for(int i=1;i<=180;i++){
    int tetra=i*(i+1)*(i+2)/6;
    tetrahedral(tetra_sum,tetra);
    if(tetra%2) tetrahedral(odd_sum,tetra);
  }
  for(;;){
    cin>>n;
    if(!n) break;
    cout<<tetra_sum[n]<<" "<<odd_sum[n]<<endl;
  }
}


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

int main() {
  string S;
  cin >> S;
  int ans = 0;
  for(int i = 0; i < 4; i++) {
    if(S.at(i) == '+')
      ans++;
    else
      ans--;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
          int r=sc.nextInt();
          int c=sc.nextInt();
          int[][]t=new int[r+1][c+1];
           
          for(int i=0;i<r;i++){
                for(int j=0;j<c;j++){
                    t[i][j]=sc.nextInt();
                }
            }
         int sum=0;
       	 for(int i=0;i<r;i++){
                for(int j=0;j<c;j++){
                    t[i][c]+=t[i][j];
                   sum+=t[i][j];
                }
            }
         t[r][c]=sum;
         for(int i=0;i<r;i++){
                for(int j=0;j<c;j++){
                    t[r][j]+=t[i][j];
                }
            }
        
     	for(int i=0;i<r+1;i++){
           for(int j=0;j<c+1;j++){
              System.out.print(t[i][j]);
              if(j!=c)System.out.print(" ");
           }
         System.out.println();
        }
        sc.close(); 
  }
}



Measured memory_bytes: 42524
//include
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

// conversion
inline int
toInt(string s)
{
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
template <class T>
inline string toString(T x)
{
    ostringstream sout;
    sout << x;
    return sout.str();
}

//change
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

//math
template <class T>
inline T sqr(T x) { return x * x; }

template <class T>
inline T nCr(T n, T r)
{
    T num = 1;
    for (int i = 1; i <= r; ++i)
    {
        num *= (n - i + 1) / i;
    }
    return num;
}
template <class T>
inline T nPr(T n, T r)
{
    r = n - r;
    T sum = 1;
    int i;
    for (i = n; i >= r + 1; --i)
        sum *= i;
    return sum;
}

template <class T>
inline T facctorial(T k)
{
    T sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

//numeric
template <class T>
inline T gcd(T a, T b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }

    return b ? gcd(b, a % b) : a;
}

template <class T>
inline T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())

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

//constant
constexpr double EPS = 1e-10;
const double PI = acos(-1.0);
constexpr LL INF = 1e10;

//clear memory
#define CLR(a) memset((a), 0, sizeof(a))

//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

int main()
{
    string s, t;
    int cnt = 0;
    cin >> s >> t;
    if (s[0] == t[0])
    {
        ++cnt;
    }
    if (s[1] == t[1])
    {
        ++cnt;
    }
    if (s[2] == t[2])
    {
        ++cnt;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
def examC():
    N,M = LI()
    S = SI()
    V = [[] for _ in range(N)]
    ok = [1]*N
    acnt = [0]*N; bcnt = [0]*N
    for _ in range(M):
        a, b = LI()
        V[a-1].append(b-1)
        V[b-1].append(a-1)
        if S[a-1]=="A":
            acnt[b-1] +=1
        else:
            bcnt[b-1] +=1
        if S[b-1]=="A":
            acnt[a-1] +=1
        else:
            bcnt[a-1] +=1
    NGque = deque()
    for i in range(N):
        if acnt[i]==0 or bcnt[i]==0:
            ok[i]=0
            NGque.append(i)
#    print(ok,acnt,bcnt)
#    print(NGque)
    while(NGque):
        cur = NGque.pop()
        for i in V[cur]:
            if ok[i]==1:
                if S[cur] == "A":
                    acnt[i] -= 1
                else:
                    bcnt[i] -= 1
                if acnt[i] == 0 or bcnt[i] == 0:
                    ok[i] = 0
                    NGque.append(i)
    if max(ok)==1:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)

import sys,copy,bisect,itertools,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


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

#define rep(i, N) for(int i = 0; i < (int)N; i++)
#define ll long long
const ll INF = 2LL<<60;

int main()
{
    int N, Q;
    string S;
    cin >> N >> Q >> S;

    vector<int> num(S.size(), 0);
    
    int tmp = 0;
    rep(i, S.size())
    {
        if(S[i] == 'A' && S[i + 1] == 'C')
        {
            tmp++;
        }
        num[i + 1] = tmp;
    }

    rep(i,Q)
    {
        int l, r;
        cin >> l >> r;
        cout << num[r - 1] - num[l - 1] << endl;
    }
}

Measured memory_bytes: 1408
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<algorithm>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;


int main(){

   int n,k;
   cin >> n >> k;
   vector<int> l(n);

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

   sort(l.begin(),l.end());

   int sum = 0;
   rep(i,k){
      sum += l[n-1-i];
   }

   cout << sum <<endl;


   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
typedef long long int ll;
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define m0(x) memset(x,0,sizeof(x))

int main(void){
	char s[3];
	scanf("%s",s);
	if(strlen(s)==2){
		printf("%s",s);
	}
	else {
		char sr[3];
		rep(i,3){
			sr[i]=s[2-i];
			printf("%c",sr[i] );
		}
		
	}
	return 0;
}

Measured memory_bytes: 128