akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, i;
  cin >> N >> K;
  int A = 1;

  for (i = 0; i < N; i++) {
    if (A <= K) A *= 2;
    else A += K;
  }
  
  cout << A << endl;
  
}

Measured memory_bytes: 256
n = int(input())
d = {}

for i in range(n):
  s = str(input())
  if s in d.keys():
    d[s] += 1
  else:
    d[s] = 1

max_count = max(d.values())

for i in sorted(d.keys()):
  if d[i] == max_count:
    print(i)

Measured memory_bytes: 35280
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include <string>



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


map<string, int> mp;
#define ll long long
int main() {
    int n;
    cin >> n;
    ll l[87];
    l[0] = 2;
    l[1] = 1;
    for (int i = 2; i <= n;i++) {
        l[i] = l[i - 1] + l[i - 2];
    }
    cout << l[n] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,e) for(int i = a;i < e;++i)
using LL = long long;

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

}




Measured memory_bytes: 256
X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
Z = P[:X]+Q[:Y]+R
Z.sort(reverse=True)
print(sum(Z[:X+Y]))

Measured memory_bytes: 23328
import java.util.*;

public class Main {

	static final int mod = 998244353;

	static class Point {
		int x, d;

		public Point(int x, int d) {
			this.x = x;
			this.d = d;
		}
	}

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Map<Integer, Integer> map = new TreeMap<Integer, Integer>();
		for (int i = 0; i < n; ++i) {
			int x = sc.nextInt();
			int d = sc.nextInt();
			map.put(x, d);
		}
		sc.close();
		Point robot[] = new Point[n];
		int i = 0;
		for (int key : map.keySet())
			robot[i++] = new Point(key, map.get(key));
		int r[] = new int[n];
		r[n - 1] = n - 1;
		for (i = n - 2; i >= 0; --i) {
			int rr = i;
			int x = robot[i].x + robot[i].d;
			while (rr + 1 < n && x > robot[rr + 1].x) {
				rr = r[rr + 1];
			}
			r[i] = rr;
		}
		int dp[] = new int[n + 1];
		dp[n] = 1 % mod;
		for (i = n - 1; i >= 0; --i) {
			int rr = r[i];
			int next = dp[i + 1] + dp[rr + 1];
			dp[i] = next % mod;
		}
		int ans = dp[0];
		System.out.println(ans);
	}
}


Measured memory_bytes: 134628
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];puts("");}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
// #define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};//RDLU
#define yes puts("YES")
#define no puts("NO")

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

	int n;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	vi out;
	rep(i,n){
		for(int j=n-1-i;j>=0;j--)if(in[j]==j+1){
			in.erase(in.begin()+j);
			out.pb(j+1);
			goto end;
		}
		cout<<-1<<endl;
		return 0;
		end:;
	}

	rep(i,n)cout<<out[n-1-i]<<endl;
}


Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())

u = 'U'
d = 'D'
r = 'R'
l = 'L'
x = tx - sx
y = ty - sy
result = []
# 1回目の行き
result += [u]*y
result += [r]*x
# 1回目の帰り
result += [d]*y
result += [l]*x

# 2回目の行き
result += [d]
result += [r]*(x+1)
result += [u]*(y+1)
result += [l]
# 2回目の帰り
result += [u]
result += [l]*(x+1)
result += [d]*(y+1)
result += [r]

print(''.join(result))

Measured memory_bytes: 3188
N = gets.to_i
H = gets.split.map(&:to_i)
 
dp = Array.new(N, 0)
1.step(H.size - 1) do |i|
  p1 = i-2 >= 0 ? dp[i-2] + (H[i-2] - H[i]).abs : Float::INFINITY
  p2 = i-1 >= 0 ? dp[i-1] + (H[i-1] - H[i]).abs : Float::INFINITY
  dp[i] = p1 > p2 ? p2 : p1
end
 
puts dp.last

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

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int ans = 0;
    int active = 0;
    rep(i, n) {
        if(active >= h[i]) {
            active = h[i];
        }
        else {
            ans += h[i] - active;
            active = h[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3576
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int i = 1;
		while(true){
			int x = i;
			if(x%3==0){
				System.out.printf(" %d",i);
			}else{
				
				while(true){
					if(x%10==3){
						System.out.printf(" %d",i);
						break;
					}
					x /= 10;
					if(x==0) break;
				}
			}
			if(++i > n) break;
		}
		System.out.println();
	}
}

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

sum_list = [0]

for i in range(N):
    if S[i] == 'C' and S[i-1] == 'A' and i:
        sum_list.append(sum_list[-1]+1)
    else:
        sum_list.append(sum_list[-1])

# [sum_list.append(sum_list[-1]+1) if s == 'C' and S[i-1] == 'A' else sum_list.append(sum_list[-1]) for i, s in enumerate(S)]

for l, r in lr_list:
    print(sum_list[r] - sum_list[l])

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

inline void check(int x, int y, int r, int width, int high)
{
	if (x - r >= 0 && x + r <= width && y - r >= 0 && y + r <= high) cout << "Yes" << endl;
	else cout << "No" << endl;
}

int main(void)
{
	int x, y, width, high, r;

	cin >> width >> high >> x >> y >> r;
	check(x, y, r, width, high);
	return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;
ll s[200100],t[200100];
int main(void){
    ll n,ans;
    cin>>n;
    for(int i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        s[i]=x+y,t[i]=x-y;
    }
    sort(s,s+n);
    sort(t,t+n);
    ans=max(abs(s[n-1]-s[0]),abs(t[n-1]-t[0]));
    cout<<ans<<endl;
}

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

#define rep(i, u) for (int i = 0; i < u; i++)

using ll = long long;
using ull = unsigned long long;

int main() {
  int n, m, l;
  ll a[100][100] = {}, b[100][100] = {};
  cin >> n >> m >> l;
  rep(i, n) rep(j, m) cin >> a[i][j];
  rep(i, m) rep(j, l) cin >> b[i][j];
  rep(i, n) {
    rep(j, l) {
      ll ans = 0;
      rep(k, m) ans += a[i][k] * b[k][j];
      cout << ans;
      if (j == l - 1) cout << endl;
      else cout << ' ';
    }
  } 
  return 0;
}



Measured memory_bytes: 3252
import java.io.*;

class Main {
	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try {
			String line = reader.readLine();
			int x = Integer.parseInt(line);
			System.out.println(x*x*x);
		} catch (IOException e) {
			System.out.println(e);
		} catch (NumberFormatException e) {
			System.out.println(e);
		}
	}
}


Measured memory_bytes: 24504
#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--)
using namespace std;
typedef long long ll;

const int INF = 1e9 + 7;
const int MN = 105;
const int MW = 100005;

ll dp[MN][MW];

int main(){
    int n, W;
    cin >> n >> W;
    ll w[n], v[n];
    rep(i, n) cin >> w[i] >> v[i];

    rrep(i, n){
        rep(j, W + 1){
            if (w[i] > j) dp[i][j] = dp[i + 1][j];
            else dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]);
        }
    }
    cout << dp[0][W] << endl;
}

Measured memory_bytes: 80128
input()
int_list = list(map(int, input().split()))
max_num = 10**18
ans = 1
for i in int_list:
    ans *= i
    if ans > max_num:
        if 0 in int_list:
            print(0)
        else:
            print(-1)
        break
else:
    print(ans)


Measured memory_bytes: 21556
#include <bits/stdc++.h>
#define rep(i, s, e) for(int i = s; i < e; i++)
#define rrep(i, s, e) for(int i = s; i > (s)-(e); i--)
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


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

  if (a+b == c || b+c == a || c+a == b) pr("Yes");
  else pr("No");


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
const int INF=0x3f3f3f3f;
inline int read()
{
	int x=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=x*10+c-'0';c=getchar();}
	return x*f;
}
struct edge{
	int to,nxt,cap,flow;
}e[30005];
int a[105],last[105],cur[105],dis[105],S,T,n,cnt=1;
ll min(ll x,ll y) {return x<y?x:y;}
void insert(int u,int v,int w)
{
	e[++cnt]=(edge){v,last[u],w,0};
	last[u]=cnt;
}
int bfs()
{
	queue<int> q;
	for(int i=1;i<=T;i++) dis[i]=INF;
	dis[S]=0;q.push(S);
	while(q.size())
	{
		int x=q.front();q.pop();
		for(int i=last[x];i;i=e[i].nxt)
		{
			if(e[i].cap>e[i].flow&&dis[e[i].to]==INF)
			{
				dis[e[i].to]=dis[x]+1;
				q.push(e[i].to);
			}
		}
	}
	return dis[T]!=INF;
}
ll dfs(int x,ll low)
{
	if(x==T||low==0) return low;
	ll ret=0,st;
	for(int &i=cur[x];i;i=e[i].nxt)
	{
		cur[x]=i;
		if(dis[e[i].to]==dis[x]+1&&(st=dfs(e[i].to,min(low,e[i].cap-e[i].flow)))>0)
		{
			ret+=st,low-=st;
			e[i].flow+=st,e[i^1].flow-=st;
			if(!low) break;
		}
	}
	return ret;
}
ll dinic()
{
	ll ret=0;
	while(bfs())
	{
		for(int i=1;i<=T;i++) cur[i]=last[i];
		ret+=dfs(S,INF);
	}
	return ret;
}
ll ans;
int main()
{
	n=read();for(int i=1;i<=n;i++) a[i]=read();
	S=n+1;T=n+2; 
	for(int i=1;i<=n;i++)
	{
		if(a[i]>0) ans+=a[i],insert(i,T,a[i]),insert(T,i,0);
		else insert(S,i,-a[i]),insert(i,S,0);
	}
	for(int i=1;i<n;i++)
		for(int j=2;j<=n/i;j++)
		{
			insert(i,i*j,a[i*j]);
			insert(i*j,i,0);
		}
	ans-=dinic();
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const a = arr[0];
  const length = a.length;
  let count = 0;

  for (let i = 0; i < Math.ceil(length / 2); i ++) {
    if (a[i] !== a[length - 1 - i]) {
      count++;
    }
  }
  
  console.log(count);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0127
"""
import sys
input = sys.stdin.readline


def decode(code):
    result = ''
    while code:
        try:
            c = code[:2]
            result += Code_table[c]
            code = code[2:]
        except:
            return 'NA'
    return result


Code_table = {
    '11': 'a', '21': 'f', '31': 'k', '41': 'p', '51': 'u', '61': 'z',
    '12': 'b', '22': 'g', '32': 'l', '42': 'q', '52': 'v', '62': '.',
    '13': 'c', '23': 'h', '33': 'm', '43': 'r', '53': 'w', '63': '?',
    '14': 'd', '24': 'i', '34': 'n', '44': 's', '54': 'x', '64': '!',
    '15': 'e', '25': 'j', '35': 'o', '45': 't', '55': 'y', '65': ' ',
}
def main(args):
    for line in sys.stdin:
        result = decode(line.strip())
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 7548
#include <vector>
#include <cfloat>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <string>
#include <iostream>
#include <cstdint>
#include <algorithm>
#include <cassert>
#include <random>
#include <queue>
#include <list>
#include <map>
#include <array>
#include <chrono>

using namespace std;

int color[100005];

vector<int>edge[100005];
vector<pair<int,pair<int, int> > >vec;

int dp[100003][12];

void dfs(int pos, int dist,int Color){
	if (dp[pos][dist] != 0) {
		return;
	}
	dp[pos][dist] = 1;
	if (color[pos] == 0) {
		color[pos] = Color;
	}
	if (dist == 0) {
		return;
	}
	dfs(pos, dist - 1,  Color);
	for (int i = 0; i < edge[pos].size(); i++) {
		int next = edge[pos][i];
		dfs(next, dist - 1, Color);
	}
}

int main() {

	int N, M;

	scanf("%d %d",&N,&M);

	int i;

	for (i = 0; i < M; i++) {
		int a, b;
		scanf("%d %d",&a,&b);
		edge[a].push_back(b);
		edge[b].push_back(a);
	}

	int Q;

	scanf("%d",&Q);

	for (i = 0; i < Q; i++) {
		int v, d, c;
		scanf("%d %d %d",&v,&d,&c);
		vec.push_back(make_pair(v, make_pair(d, c)));
	}

	for (i = Q - 1; i >= 0; i--) {
		dfs(vec[i].first, vec[i].second.first, vec[i].second.second);
	}

	for (i = 1; i <= N; i++) {
		printf("%d\n",color[i]);
	}

	return 0;
}

Measured memory_bytes: 13168
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		double a, b;
		a = sc.nextDouble();
		b = sc.nextDouble();
		
		sc.close();
		
		if(a < b)System.out.println("LESS");
		else if(a > b)System.out.println("GREATER");
		else System.out.println("EQUAL");
		
		
	}

}


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

int main() {
   int N,M;
   cin >> N >> M;
   int A[M],B[M],P[N];
   for (int i=0; i<M; i++) {
       cin >> A[i] >> B[i];
   }
   for (int i=0; i<N; i++) {
       P[i]=i+1;
   }
   int count=0;
   do {
       if (P[0]!=1) break;
       bool s=true;
       for (int i=0; i<N; i++) {
           bool t=false;
           if (i!=0) {
               for (int j=0; j<M; j++) {
                   if (P[i]==A[j] && P[i-1]==B[j]) t=true;
                   if (P[i]==B[j] && P[i-1]==A[j]) t=true;
               }
               if (!t) s=false;
           }
       }
       if (s) count++;
   }while (next_permutation(P,P+N));
   cout << count << endl;
}

Measured memory_bytes: 256
using Atcoder;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var first = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            long result = long.MaxValue;
            long left = first[0];
            long right = first[1];
            if (right - left > 2019)
            {
                Console.Write(0);
                return;
            }
            for (long i = left; i < right; i++)
            {
                for (long j = i + 1; j <= right; j++)
                {
                    var tmpCal = (i * j) % 2019;
                    if (result >= tmpCal)
                    {
                        result = tmpCal;
                    }
                }

            }
            Console.Write(result);
        }
        //static void Main(string[] args)
        //{
        //    var temp = new Atcoder.ABC130.D();
        //    temp.Run();
        //}

    }
}

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

using namespace std;

int main() {
	int r, g, b, n;
	cin >> r >> g >> b >> n;
	
	int ans = 0;

	for (int i = 0; i <= n; i += r) {
		for (int j = i; j <= n; j += g) {
			if ((n - j) % b == 0) ans++;
		}
	}
	cout << ans << '\n';
	return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;


public class Main {
	 static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !st.hasMoreTokens()) 
	            { 
	                try
	                { 
	                    st = new StringTokenizer(br.readLine()); 
	                } 
	                catch (IOException  e) 
	                { 
	                    e.printStackTrace(); 
	                } 
	            } 
	            return st.nextToken();
	            
	        } 
	  
	        int nextInt() 
	        { 
	            return Integer.parseInt(next()); 
	        } 
	  
	        long nextLong() 
	        { 
	            return Long.parseLong(next()); 
	        } 
	  
	        double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
	  
	        String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    } 
	 static int divisors(long x) {
		    long limit = x;
		    int numberOfDivisors = 0;

		    if (x == 1) return 1;

		    for (int i = 1; i < limit; ++i) {
		        if (x % i == 0) {
		            limit = x / i;
		            if (limit != i) {
		                numberOfDivisors++;
		            }
		            numberOfDivisors++;
		        }
		    }

		    return numberOfDivisors;
		} 
	public static void main(String[] args)throws IOException  {
		FastReader s=new FastReader();		
		int n = s.nextInt();
		int k = s.nextInt();
		int[] ar = new int[n];
		for(int i=0;i<n;i++) {
			ar[i]=s.nextInt();
		}
		Arrays.sort(ar);
		int sum=0;
		for(int i=0;i<k;i++) {
			sum+=ar[i];
		}
		System.out.println(sum);
}
}

Measured memory_bytes: 33048
#include <iostream>
using namespace std;
int main(void){
    std::string s;
    std::string::iterator iterator_s;
    cin >> s;
    for(std::string::reverse_iterator it=s.rbegin();it != s.rend(); ++it) 
        std::cout << *it ;
    std::cout << "\n";
    return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

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

    string ans = "";
    while (N) {
        --N;
        ans += char('a' + (N % 26));
        N /= 26;
    }
    reverse(ALL(ans));
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
const lld MAXN = 1e9;

int main()
{
    int n,a,b;

    cin >> n >> a >> b;

    if ((b-a-1) % 2 == 0)
    {
        cout << "Borys" << endl;
    }else
    {
        cout << "Alice" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	
	bool ans=0;
	int N;
	string a,b;
	cin >>N >>a >>b;
	vector<string> vec(0);
	
	for(int i=0; i<N-1; i++){
		
		
		
		if(a.at(a.size()-1)!=b.at(0)){
			
			ans=1;
			
		}
		
		
		vec.push_back(a);
		a=b;
		
		for(int j=0; j<vec.size(); j++){
			
			if(vec.at(j)==a){
				
				ans=1;
				break;
				
			}
			
		}
		
		cin >>b;
		
	}
	
	cout <<((ans)?"No":"Yes") <<endl;
	
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  string s;cin>>s;
  bool e=true;
  if(s.size()%2)e=false;
  else {

    for(ll i=0;2*i+1<s.size();i+=2){
      if(s[2*i]=='h'&&s[2*i+1]=='i');
      else e=false;
    }
  }

  if(e)out("Yes");
  else out("No");

  return 0;
}


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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


int main()
{
    int A,B;
    cin >> A >> B;
    int ans = 0;

    REP(i, A, B+1)
    {
        string tmp = to_string(i);
        string tmp2 = tmp;
        reverse(all(tmp2));
        if( tmp == tmp2 )ans++;
    }
    cout << ans << endl;
}


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

h, w, k = map(int, input().split())
x1, y1, x2, y2 = map(int, input().split())
c = []
for _ in range(h):
    c.append(list(input()))
from collections import deque
def bfs(x, y):
    queue = deque([(x, y)])
    d = [[float('inf')]*w for _ in range(h)]
    d[x][y] = 0
    while queue:
        u, v = queue.popleft()
        # ↑
        for l in range(1, k + 1):
            p, q = u + l, v
            if not (0 <= p < h and 0 <= q < w) or c[p][q] == "@":
                break
            if d[u][v] + 1 > d[p][q]:
                break
            if d[p][q] == float("inf"):
                queue.append((p, q))
            d[p][q] = d[u][v] + 1
        for l in range(1, k + 1):
            p, q = u - l, v
            if not (0 <= p < h and 0 <= q < w) or c[p][q] == "@":
                break
            if d[u][v] + 1 > d[p][q]:
                break
            if d[p][q] == float("inf"):
                queue.append((p, q))
            d[p][q] = d[u][v] + 1
        for l in range(1, k + 1):
            p, q = u, v + l
            if not (0 <= p < h and 0 <= q < w) or c[p][q] == "@":
                break
            if d[u][v] + 1 > d[p][q]:
                break
            if d[p][q] == float("inf"):
                queue.append((p, q))
            d[p][q] = d[u][v] + 1
        for l in range(1, k + 1):
            p, q = u, v - l
            if not (0 <= p < h and 0 <= q < w) or c[p][q] == "@":
                break
            if d[u][v] + 1 > d[p][q]:
                break
            if d[p][q] == float("inf"):
                queue.append((p, q))
            d[p][q] = d[u][v] + 1
    return d
d = bfs(x1 - 1, y1 - 1)
if d[x2 - 1][y2 - 1] == float("inf"):
    print(-1)
else:
    print(d[x2 - 1][y2 - 1])

Measured memory_bytes: 149860
from collections import defaultdict
d = defaultdict(int)
N = int(input())
for i in range(N):
  d[input()] += 1
print(f"AC x {d['AC']}")
print(f"WA x {d['WA']}")
print(f"TLE x {d['TLE']}")
print(f"RE x {d['RE']}")

Measured memory_bytes: 9424
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}


int main(){
	vector<string>keistr(10);
	keistr[1] = ".,!? ";
	keistr[2] = "abc";
	keistr[3] = "def";
	keistr[4] = "ghi";
	keistr[5] = "jkl";
	keistr[6] = "mno";
	keistr[7] = "pqrs";
	keistr[8] = "tuv";
	keistr[9] = "wxyz";
	int n;
	cin >> n;
	REP(i,n){
		string in_str;
		cin >> in_str;
		int cnt = -1;
		REP(j,in_str.size()){
			if(in_str[j]=='0'){
				if(cnt>=0){
					int pos = in_str[j-1] - '0';
					cout << keistr[pos][cnt%keistr[pos].size()];
					cnt = -1;
				}
			}else{
				cnt++;
			}
		}
		cout  << endl;
	}
}

Measured memory_bytes: 1212
n, a, b, c, d = gets.split.map(&:to_i)
Y = "YES"
N = "NO"

x = b - a

n.times do |i|
    min = i * c - (n - i - 1) * d
    max = i * d - (n - i - 1) * c

    if min <= x && x <= max
        puts Y
        break
    end
end and puts N

Measured memory_bytes: 14352
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int main(){

  int i,j;
  int n,t;
  int a[105];
  int cnt = 0;

  scanf("%d", &n);

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

  for(i = 0;i < n - 1;i++){
    for(j = n - 1;j > i;j--){
      if(a[j] < a[j - 1]){
        t = a[j]; a[j] = a[j - 1]; a[j - 1] = t;
      }
    }
  }

  for(i = 0;i < n - 1;i++){
    if(a[i] != a[i + 1]) cnt++;
  }

  printf("%d\n", cnt + 1);

  return 0;
}


Measured memory_bytes: 128
import java.util.*;

class Main
{
    public static void main(String[] args)throws Exception
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Deque<Integer> dq = new ArrayDeque <>();
        
        for(int i = 0; i<n; i++) dq.add(sc.nextInt());
        
        int t = sc.nextInt();
        int ct=0;
        int [] arr = new int[t];
        for(int i = 0; i<t;i++)
        {   
            arr[i] = sc.nextInt();
            Iterator itr = dq.iterator();
            while(itr.hasNext())
            {
                if(arr[i]==Integer.parseInt(itr.next().toString()))
                {
                    itr.remove();
                    ct++;
                    break;
                }
            }
        }
        System.out.println(ct);
    }
}
       





Measured memory_bytes: 54524
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N, K;
  cin >> N >> K;
  vector<i64> A(N);
  for (i64 i = 0; i < N; i++)
    cin >> A[i];
  for (i64 i = K; i < N; i++)
    if (A[i] <= A[i - K])
      cout << "No" << endl;
    else
      cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 4836
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <cassert>
#include <cmath>
#include <queue>
using namespace std;

struct state { int y, x, step; };
static const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int main() {
        int h, w;
        scanf("%d %d", &h, &w);
        vector<string> s(h);
        for (int i = 0; i < h; i ++) {
                cin >> s[i];
        }
        vector<vector<int>> used(h, vector<int> (w, -1));
        int sy = 0, sx = 0;
        queue<state> q;
        q.push({sy, sx, 0});
        used[sy][sx] = 0;
        while (!q.empty()) {
                state p = q.front(); q.pop();
                for (int d = 0; d < 4; d ++) {
                        int xx = p.x + dx[d], yy = p.y + dy[d];
                        if (xx < 0 || xx >= w || yy < 0 || yy >= h) continue;
                        if (used[yy][xx] != -1 || s[yy][xx] == '#') continue;
                        used[yy][xx] = p.step + 1;
                        q.push({yy, xx, p.step + 1});
                }
        }
        if (used[h - 1][w - 1] == -1) {
                printf("%d\n", -1);
                return 0;
        }
        /*
        for (int i = 0; i < h; i ++) {
                for (int j = 0; j < w; j ++) {
                        cerr << used[i][j] << " ";
                }
                cerr << endl;
        }
        */
        int cury = h - 1, curx = w - 1;
        vector<vector<bool>> pass(h, vector<bool> (w, false));
        while (true) {
                pass[cury][curx] = true;
                if (cury == 0 && curx == 0) break;
                for (int d = 0; d < 4; d ++) {
                        int xx = curx + dx[d], yy = cury + dy[d];
                        if (xx < 0 || xx >= w || yy < 0 || yy >= h) continue;
                        if (used[yy][xx] == used[cury][curx] - 1) {
                                cury = yy, curx = xx;
                                break;
                        }
                }
        }
        /*
        for (int i = 0; i < h; i ++) {
                for (int j = 0; j < w; j ++) {
                        cerr << pass[i][j] << " ";
                }
                cerr << endl;
        }
        */
        int ans = 0;
        for (int i = 0; i < h; i ++) {
                for (int j = 0; j < w; j ++) {
                        if (!pass[i][j] && s[i][j] != '#') {
                                ans ++;
                        }
                }
        }
        printf("%d", ans);
        return 0;
}



Measured memory_bytes: 256
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define ifYN(x) cout<<(x?"Yes":"No")<<"\n" 
#define dcml(n) fixed<<setprecision(n)

 
ll GCD(ll a,ll b) { return b ? GCD(b,a%b) : a; } 
ll LCM(ll a,ll b) { return a/GCD(a,b)*b; } 
ll Factorial(ll n){ ll m=1;while(n>=1)m*=n--;return m; } 
ll modPow(ll x,ll n,ll mod=MOD){ 
    return (!n?1:!n%2?modPow(x*x,n/2,mod)%mod:x%mod*modPow(x,n-1,mod)%mod); 
} 
using namespace std;
//-------------------------------------------
typedef pair<ll,ll> P;
int main(void){
    ll n;cin>>n;
    ll N=1<<n;
    vi s(N);
    REP(i,N) cin >> s[i];

    multiset<ll> S;
    REP(i,N)S.insert(s[i]);

    priority_queue<ll> q1,q2;
    auto it=S.end();it--;
    q1.push(*it);
    S.erase(it);

    while(S.size()!=0){
        while(q1.size()!=0){

            ll q=q1.top();q1.pop();
            auto it2=S.lower_bound(q);
            if(it2==S.begin()){cout<<"No\n";exit(0);}

            it2--;
            q2.push(*it2);S.erase(it2);
            q2.push(q);
        }
        swap(q1,q2);
    }
    cout<<"Yes\n";
}

Measured memory_bytes: 17772
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define all(a) a.begin(),a.end()
#define endl '\n'
#define int ll

using namespace std;

const int N = 3e5 + 3;
const int inf = 1e9 + 3;
const int md = 1e9 + 7;

int n, m;

int f(int n) {
    return n * (n - 1) / 2;
}

main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    cin >> n >> m;
    cout << f(n) + f(m);

}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
using namespace std;

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int x = 0;
	string s; cin >> s;
	string c = "CODEFESTIVAL2016";
	for (int i = 0; i < c.size(); i++) {
		if (s[i] != c[i]) {
			x++;
		}
	}
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
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 (b<a) { a=b; return 1; } return 0; }

ll MOD = 1000000007;
ll INF =1<<30;

int main(){
    ll n,d;
    cin >> n >>d;
    vector<ll> x(n),y(n);
    rep(i,n) cin >> x[i]>>y[i];
    d*=d;
    int cnt = 0;
    rep(i,n){
        if(x[i]*x[i]+y[i]*y[i]<=d) cnt++;
    } 
    cout << cnt << endl;
}


Measured memory_bytes: 6372
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}
ll modpow(ll a,ll b){
    ll ret = 1;
    while(b>0){
        if(b&1)ret = (ret*a)%MOD;
        a = (a*a)%MOD;
        b = b>>1;
    }
    return ret;
}

ll combmod(ll n,ll r){
    ll nn = 1;
    ll rr = 1;
//    if(n-r<r){
//        r=n-r;
//    }
    rep(i,r){
        nn *= (n-i);
        nn %=MOD;
        rr *= (r-i);
        rr %=MOD;
    }
    return nn*modpow(rr,MOD-2)%MOD;





}

int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    ll sou = modpow(2,n);

    sou = (MOD + sou-1)%MOD;


    ll k1 = combmod(n,a)%MOD;
    ll k2 = combmod(n,b)%MOD;
    sou = (MOD+sou-k1)%MOD;
    sou = (MOD+sou-k2)%MOD;
    cout<<sou<<endl;












    return 0;
}


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

const double pi = acos(-1);
void koch(double x1, double y1, double x2, double y2, int n){
	double tx1 = (2*x1 + x2) / 3.0;
	double ty1 = (2*y1 + y2) / 3.0;
	double tx2 = (x1 + 2*x2) / 3.0;
	double ty2 = (y1 + 2*y2) / 3.0;

	
	if(n > 0){
		koch(x1, y1, tx1, ty1, n-1);
		cout << setprecision(10) << fixed;
		cout << tx1 << " " << ty1 << endl;
	
		double ux = tx1 + (tx2-tx1) * cos(pi/3.0) - (ty2-ty1) * sin(pi/3.0);
		double uy = ty1 + (tx2-tx1) * sin(pi/3.0) + (ty2-ty1) * cos(pi/3.0);
	
		koch(tx1, ty1, ux, uy, n-1);
		cout << ux << " " << uy << endl;

		koch(ux, uy, tx2, ty2, n-1);
		cout << tx2 << " " << ty2 << endl; 

		koch(tx2, ty2, x2, y2, n-1);
	}	

}

int main(){
	int n;
	cin >> n;
	cout << setprecision(10) << fixed;	
	cout << 0.0 << " " << 0.0 << endl;	
	koch(0.0, 0.0, 100.0, 0.0, n);
	cout << 100.0 << " " <<  0.0 << endl;
	return 0; 
	 

}

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

int main(){
	int i;
	string str;
	
	cin >> str;
	
	for(i=str.size()-1;i>=0;i--){
		cout << str[i];
		if(i==0){
			cout << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    auto z = v;
    sort(z.begin(), z.end());
    z.erase(unique(z.begin(), z.end()), z.end());
    for (auto &&j : v) j = lower_bound(z.begin(),z.end(), j) - z.begin();

    auto merge = [&](GPQ<int> &a, GPQ<int> &b){
        if(a.size() < b.size()) swap(a, b);
        while(!b.empty()){
            a.emplace(b.top());
            b.pop();
        }
    };
    ll ans = 0;
    queue<int> Q;
    vector<GPQ<int>> a(n);
    for (int i = 0; i < n; ++i) {
        a[i].emplace(i);
        Q.emplace(v[i]);
    }
    for (int i = 0; i < n; ++i) {
        int x = Q.front(); Q.pop();
        while(a[x].top() != i) merge(a[x], a[Q.front()]), Q.pop();
        a[x].pop();
        ans += a[x].size();
        if(!a[x].empty()) Q.emplace(x);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 19400
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mk make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    std::cin >> n;
    std::vector<int> p(n),q(n);
    rep(i,n)std::cin >> p[i];
    rep(i,n)std::cin >> q[i];
    std::vector<int> a(n);
    rep(i,n)a[i]=i+1;
    int aaa,b,cou=0;
    do {
        cou++;
        bool aa=1,bb=1;
        rep(i,n){
            if(a[i]!=p[i])aa=0;
            if(a[i]!=q[i])bb=0;
        }
        if(aa)aaa=cou;
        if(bb)b=cou;
    } while (std::next_permutation(a.begin(), a.end()));
 //   std::cout << aaa<<b << std::endl;
    std::cout << abs(b-aaa) << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)

//dpテーブルをローカルで宣言したらセグフォになった...

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

const ll INF=1e11;

ll dp[110][100010]={};

const ll maxv=100010;

int main(){
  rep(i,110)rep(j,100010)dp[i][j]=INF;
  dp[0][0]=0;
  ll n,W;
  cin >> n >> W;
  ll w[200];
  ll v[200];
  rep(i,n)cin >> w[i] >> v[i];
  rep(i,n){
    rep(value,maxv){
      if(value-v[i]>=0){
        chmin(dp[i+1][value],dp[i][value-v[i]]+w[i]);
      }
      chmin(dp[i+1][value],dp[i][value]);
    }
  }
  ll ans=0;
  rep(value,maxv){
    if(dp[n][value]<=W)ans=value;
  }
  cout << ans << endl;
}


Measured memory_bytes: 86272
#include "bits/stdc++.h"
using namespace std;

vector<vector<int> > f(101,vector<int>(101));
vector<vector<int> > p(101,vector<int>(101));

int main(){
	int n;
	cin>>n;
	
	for(int i=0;i<n;i++){
		for(int j=0;j<10;j++)cin>>f[i][j];
	}
	
	for(int i=0;i<n;i++){
		for(int j=0;j<11;j++)cin>>p[i][j];
	}
	
	int ans=-1e9;
	
	for(int i=1;i<(1<<10);i++){
		int tmp=0;
		for(int j=0;j<n;j++){
			int x=0;
			for(int k=0;k<10;k++){
				if((i>>k&1)&&f[j][k])x++;
			}
			tmp+=p[j][x];
		}
		//cout<<tmp<<endl;
		//if(ans<tmp)cout<<i<<" "<<tmp<<" "<<ans<<endl;
		ans=max(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
// https://atcoder.jp/contests/abc171/tasks/abc171_d

use proconio::input;

fn main() {
    input! {
      n: usize,
      a_s: [usize; n],
      q: usize,
      bcs: [(usize, usize); q],
    }
    let mut acc = vec![0; 100001];
    let mut sum = 0;
    for a in a_s {
        acc[a] += 1;
        sum += a;
    }
    for (b, c) in bcs {
        let bb = acc[b];
        acc[c] += bb;
        acc[b] = 0;
        sum += bb * (c - b);
        println!("{}", sum);
    }
}


Measured memory_bytes: 6828
from collections import Counter
import math
n = int(input())
d = list(map(int, input().split()))

for i in range(1, n):
        if d[i] == 0:
                print(0)
                exit()

ans = 1
setD = list(set(d))
# setD.sort()



if d[0] > 0:
        print(0)
else:
        c = Counter(d)
        
        # for _d in d:
        #         if _d != 0:
        #                 # print(_d - 1)
        #                 print(c[_d - 1])
        #                 # print("---------------")
        #                 ans *= c[_d - 1]

        for _d in setD:
                if _d != 0:
                        ans *= c[_d - 1] ** c[_d]

        print(ans%998244353)

Measured memory_bytes: 22236
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int x;
  cin >> x;
  cout << (30 <= x ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3604
N, M = map(int, input().split())
MOD = 10**9+7
d = abs(N-M)
if d > 1:
    print(0)
else:
    ans = 1
    for i in range((N+M)//2):
        ans *= (N-i)*(M-i)
        ans %= MOD
    if (N+M) % 2 == 0:
        ans *= 2
    print(ans % MOD)


Measured memory_bytes: 40044
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;}


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

int N, M, X; cin >> N >> M >> X;
VI C(N);
VVI A(N, VI(M));
rep(i, 0, N) {
    cin >> C[i];
    rep(j, 0, M) cin >> A[i][j];
}

i64 mini = INF;
rep(bit, 0, 1L<<N) {
    VI B(M, 0);
    i64 yen = 0;
    rep(i, 0, N) if (bit & (1L<<i)){
        yen += C[i];
        rep(r, 0, M) B[r] += A[i][r];
    }
    if (all_of(ALL(B), [X](int i){return i >= X;}))
        mini = min(mini, yen);
}

if (mini == INF) cout << "-1\n";
else cout << mini << "\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 3664
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <cstring> 
using namespace std;
int main( )
{
	int n,k,x,y;
	cin>>n>>k>>x>>y;
	if(n>k)
	{
		cout<<x*k+y*(n-k)<<endl;
	}
	else 
	cout<<n*x<<endl;
	
	return 0;
}

Measured memory_bytes: 256
N = int(input())
W = [i for i in map(int,input().split())]
res = 10**9
for i in range(N):
    L1 = W[0:i]
    L2 = W[i:N]
    if res > abs(sum(L1)-sum(L2)):
        res = abs(sum(L1)-sum(L2))
print(res)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();
        long k = sc.NextLong();

        int oneCount = 0;
        int next = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == '1')
            {
                oneCount++;
            }
            else
            {
                next = int.Parse(s[i].ToString());
                break;
            }
        }

        int answer = k > oneCount ? next : 1;

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 27468