akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

n = int(input())
s = [0]*n
for i in range(n):
    s[i] = list(input())

def list_intersection(a,b):
    c = []
    for i in range(len(a)):
        for j in range(len(b)):
            if a[i] == b[j]:
                c.append(a[i])
                a[i] = "_"
                b[j] = "&"
    return c

if n == 1:
    ans = s[0]
    ans.sort()
elif n == 2:
    ans = list_intersection(s[0],s[1])
    ans.sort()
else:
    ans = list_intersection(s[0],s[1])
    for i in range(2,n):
        ans = list_intersection(ans,s[i])
    ans.sort()

print("".join(ans))


Measured memory_bytes: 3064
#include<stdio.h>
#define N 500000
 
int n;

int left(int i){
    return 2*i;
}
int right(int i){
    return 2*i+1;
}
 
void maxHeapify(int A[], int i){
    int lar;
    int le,ri;
    int tmp;
    le = left(i);
    ri = right(i);
     
    if(le<=n && A[le] > A[i]) lar=le;
    else lar=i;
     
    if(ri<=n && A[ri]>A[lar]) lar=ri;
     
    if(lar != i){
        tmp=A[i];
        A[i]=A[lar];
        A[lar]=tmp;
        maxHeapify(A,lar);
    }
     
}
 
void buildMaxHeap(int A[]){
    int i;
    for(i=n/2;i>=1;i--){
        maxHeapify(A, i);
    }
}
 
 
int main(void){
    int i;
 
    int heap[N];
    scanf("%d",&n);
    for(i=1;i<n+1;i++){
        scanf("%d",&heap[i]);
    }
     
    buildMaxHeap(heap);
 
     
    for(i=1;i<n+1;i++){
        printf(" %d",heap[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 2552
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#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 itn int
#define mp 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 ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
/*メモ 
*/
int main(){
    int n,m;
    std::cin >> n>>m;
    string s;
    std::cin >> s;
    reverse(all(s));
    int c=0;
    std::vector<int> ans;
    while(c!=n){
        irep(i,m){
            i=min(i,n-c-1);
            
            if(s[c+i+1]=='0'){
                c+=i+1;
                //ans++;
                ans.pb(i+1);
                
                break;
                
            }
            if(i==0){
                std::cout << -1<< std::endl;
                exit(0);
            }
        }
    }
    std::cout  << std::endl;
    //std::cout << ans << std::endl;
    reverse(all(ans));
    erep(i,ans){
        std::cout << i << " ";
    }
    std::cout << std::endl;
}

Measured memory_bytes: 1144
#include<iostream>
#include <string>
using namespace std;
int main()
{
  string S;
  int s;
  cin >> S;
  
  if (S == "MON") {
    s = 6;
    }else if (S == "TUE") {
    s = 5;
    }else if (S == "WED") {
    s = 4;
    }else if (S == "THU") {
    s = 3;
    }else if (S == "FRI") {
    s = 2;
    }else if (S == "SAT") {
    s = 1;
    }else if (S == "SUN") {
    s = 7;
    }else{
    s = -1;
    }
  cout << s << endl;
  
  return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        List<Integer> a = new ArrayList<>();
        List<Integer> b = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            a.add(Integer.parseInt(sc.next()));
            b.add(Integer.parseInt(sc.next()));
        }
        sc.close();

        // 主処理
        int max = a.stream().mapToInt(i -> i).max().getAsInt();
        int index = a.indexOf(max);
        int result = max + b.get(index);

        // 出力
        System.out.println(result);
    }
}


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

using namespace std;

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

const int N = (int)1e5 + 7;
const int inf = (int)1e9 + 7;
const ll linf = (ll)1e18;

int n;
int up[N][20], hh[N];
ll h[N];
vector < pii > g[N];

void dfs1(int v, int p){
  up[v][0] = p;
  hh[v] = hh[p] + 1;
  for(int j = 1; j < 20; ++j){
    up[v][j] = up[up[v][j - 1]][j - 1];
  }
  for(pii i : g[v]){
    if(i.first == p){
      continue;
    }
    h[i.first] = h[v] + i.second;
    dfs1(i.first, v);
  }
}

int lca(int x, int y){
  if(hh[x] < hh[y]){
    swap(x, y);
  }
  for(int j = 19; j >= 0; --j){
    if(up[x][j] && ((hh[x] - hh[y]) >> j) & 1){
      x = up[x][j];
    }
  }
  for(int j = 19; j >= 0; --j){
    if(up[x][j] && up[y][j] && up[x][j] != up[y][j]){
      x = up[x][j];
      y = up[y][j];
    }
  }
  if(x == y){
    return x;
  }
  return up[x][0];
}

ll dist(int x, int y){
  return h[x] + h[y] - 2 * h[lca(x, y)];
}

int main(){
  scanf("%d", &n);
  for(int i = 1; i < n; ++i){
    int x, y, c;
    scanf("%d %d %d", &x, &y, &c);
    g[x].push_back({y, c});
    g[y].push_back({x, c});
  }
  dfs1(1, 1);
  int q, k;
  scanf("%d %d", &q, &k);
  for(int i = 1; i <= q; ++i){
    int x, y;
    scanf("%d %d", &x, &y);
    printf("%lld\n", dist(x, k) + dist(k, y));
  }
  return 0;
}


Measured memory_bytes: 20992
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{

    class Katana
    {
        public readonly int a;
        public readonly int b;

        public Katana(int a, int b)
        {
            this.a = a;
            this.b = b;
        }
    }

    private static List<Katana> katanas;

    private static int Search(int hp, int maxSwingDamage)
    {
        int resultTurn = 0;
        foreach (var katana in katanas)
        {
            if (katana.b > maxSwingDamage)
            {
                hp -= katana.b;
                resultTurn++;
                if(hp <= 0)
                {
                    return resultTurn;
                }
            }
        }

        resultTurn += (int)Math.Ceiling((double)hp / maxSwingDamage);

        return resultTurn;
    }

    static void Main(string[] args)
    {
        var firstInputStrings = Console.ReadLine().Split(' ');
        var N = int.Parse(firstInputStrings[0]);
        int H = int.Parse(firstInputStrings[1]);

        katanas = new List<Katana>();
        for (int i = 0; i < N; i++)
        {
            var inputStrings = Console.ReadLine().Split(' ');
            var a = int.Parse(inputStrings[0]);
            var b = int.Parse(inputStrings[1]);
            katanas.Add(new Katana(a, b));
        }

        var maxSwingDamage = katanas.Max(x => x.a);

        katanas = katanas.OrderBy(x => -x.b).ToList();

        Console.WriteLine(Search(H, maxSwingDamage));
    }
}

Measured memory_bytes: 27084
///PROBLEM CODE - SEGDIR (CodeChef)
///SOLUTION FOR 3rd problem of ICPC Online round 2k19!!

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define pb push_back


///Input/Output macros!
#define gi(x) scanf("%d", &x)
#define gi2(x, y) scanf("%d%d", &x, &y)
#define gi3(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define gill(x) scanf("%lld", &x)
#define gill2(x, y) scanf("%lld%lld", &x, &y)
#define gill3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define pi(x) printf("%d\n", x)
#define pill(x) printf("%lld\n", x)


///Basic Debugging macros!
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(ll __i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(ll __i__=0;__i__<r;__i__++){for(ll __j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}

using namespace std;

///Power of 2 till 2^31!
ll pow2[32] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648};

///Power function!
ll power(ll x,ll y)
{
        ll res = 1;
        while(y>0){
            if(y&1)
                res *= x;
            y>>=1;
            x*=x;
        }
        return res;
}

///Basic Sieve of Eratosthenes!
void Sieve(ll n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (ll p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}

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

bool isPerfectSquare(ll x){ ll s = sqrt(x); return (s*s == x);}

bool isFibonacci(int n){return isPerfectSquare(5*n*n + 4) || isPerfectSquare(5*n*n - 4);}

bool isPrime(int n){if (n <= 1)return false;if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0)return false;
    return true;
}

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;


const int MOD = 1000000007;
const long double PI = 4*atan((long double)1);
const ll INF = 1e18;

int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    char c = s[0];
    string ans;
    for(int i=1;i<n;i++){
        if(c!=s[i]){
            ans+=c;
        }
        c=s[i];
    }
    ans+=c;
    cout<<(int)ans.length()<<'\n';
    return 0;
}


Measured memory_bytes: 512
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;
//const ll MAX_V=114514LL;
//const ll MAX = 500010LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={0,0,1,-1};
vl dy={1,-1,0,0};

//素因数分解O(√n)
map<ll,ll>prime_factor(ll n){
  map<ll,ll>res;
  for(ll i=2;i*i<=n;i++){
    while(n%i==0){
      res[i]++;
      n/=i;
    }
  }
  if(n!=1)res[n]=1;
  return res;
}

const ll MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
//finvが階乗の逆元

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modpow(ll a, ll n, ll mod) {
  
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}



int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  /*--------------------------------*/
  
  ll n;cin>>n;
  vl a(n+1);
  for(ll x=1;x<=200;x++){
    for(ll y=1;y<=200;y++){
      for(ll z=1;z<=200;z++){
        if((x+y)*(x+y)+(y+z)*(y+z)+(z+x)*(z+x)>2*n||((x+y)*(x+y)+(y+z)*(y+z)+(z+x)*(z+x))%2==1)continue;
        a[((x+y)*(x+y)+(y+z)*(y+z)+(z+x)*(z+x))/2]++;
      }
    }
  }
  for(ll i=1;i<=n;i++)cout<<a[i]<<endl;
}

Measured memory_bytes: 3740
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Queue<Integer> queue = new PriorityQueue<Integer>(Collections.reverseOrder());
		String com = scan.next();
		while(!com.equals("end")) {
			if(com.equals("insert")) {
				queue.add(scan.nextInt());
			}else if(com.equals("extract")) {
				System.out.println(queue.poll());
			}
			com = scan.next();
		}
		scan.close();
	}
}


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

typedef long long ll;

using namespace std;

int main()
{
    //ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    set <int> s;
    int N;
    cin >> N;

    int a;
    for(int i=0; i<N; i++)
    {
        cin >> a;
        s.insert(a);
    }

    if(s.size() != N)
    {
        cout << "NO" << endl;
    }

    else
    {
        cout << "YES" << endl;
    }

}


Measured memory_bytes: 12956
N = int(input())
ketaCounter = 1
keta = 10
answer = 0

while N >= keta:
    ketaCounter += 1
    keta *= 10

for i in range(ketaCounter-1):
    ketaketa = i+1
    if ketaketa % 2 == 1:
        answer += 10 ** (ketaketa) - 10 ** (i) 
        

if ketaCounter == 1:
    answer += N
elif ketaCounter % 2 == 1:
    answer += N - 10 ** (ketaCounter-1) + 1
   
print(answer)   




Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0); cin.tie(0)
int main()
{

    flash;
    long long n,k,cnt1=0,cnt2=0, ans=0,y;
    cin>>n>>k;

    for(int i=1; i<=n; i++)
    {
        if(i % k == 0)
            cnt1++;
    }

    ans = cnt1*cnt1*cnt1;

    if(k % 2 == 0)
    {
        for(int i=1; i<=n; i++)
        {

            if(i %k == k/2 )
                cnt2++;
        }
    }

    ans += cnt2*cnt2*cnt2;


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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>

using namespace std;
typedef long long ll;


ll ans, mx, mn, flag, sum, cnt;

int main(){
	string s;
	cin>>s;
	bool ok=true;
	for(ll i=0; i<s.size(); i++){
		if(i>=2 && i<s.size()-1 && s[i]=='C') cnt++;
		if(s[i]!='A' && s[i]!='C' && s[i]<96) ok=false;
	}
	if(s[0]=='A' && cnt==1 && ok==true) cout<<"AC";
	else cout<<"WA";
}

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

int ctoi(char a){
  if(a == '0') return 0;
  if(a == '1') return 1;
  if(a == '2') return 2;
  if(a == '3') return 3;
  if(a == '4') return 4;
  if(a == '5') return 5;
  if(a == '6') return 6;
  if(a == '7') return 7;
  if(a == '8') return 8;
  if(a == '9') return 9;
}

int main(){
  string l;
  cin >>l;
  int keta = l.size();
  int d=1000;
  vector<int> a(keta);
  for(int i=0;i<keta;i++){
    a.at(i) = ctoi(l[i]);
  }
  int z;
  for(int i=0;i<keta-2;i++){
    z = abs(100*a.at(i)+10*a.at(i+1)+a.at(i+2)-753);
    d = min(d,z);
  }
  cout << d <<endl;
}

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

int main(void)
{
    string a, b;
    cin >> a >> b;
    int number = stoi(a+b);

    int answer = 0;
    for (int i = 0;i * i<=number;i++) {
        if (i * i == number) answer = 1; 
    }
    if (answer) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
x, n = map(int, input().split())
p = list(map(int, input().split()))
if n == 0:
    print(x)
    exit()
for i in range(100):
    if x - i not in p:
        print(x-i)
        exit()
    if x + i not in p:
        print(x+i)
        exit()

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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b)a=b;};
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b)a=b;};

ll n,m;
vector<pair<ll,ll>> C;
vector<ll> A;
const ll INF=1e9;

bool judge(ll x){
  vector<ll> dp(m,INF);
  //(l,r]
  auto cul=[&](ll l,ll r){
    auto I=--lower_bound(C.begin(),C.end(),pair<ll,ll>(r,INF));
    auto J=--lower_bound(C.begin(),C.end(),pair<ll,ll>(l,INF));
    return (I->second)-(J->second);
  };
  dp[0]=cul(-INF,A[0]);
  for(Int i=1;i<m;i++){
    for(Int j=0;j<i;j++){
      ll m=(A[j]+A[i])/2;
      
      if(dp[j]+cul(A[j],m)<=x){
        dp[i]=min(dp[i],cul(m,A[i]));
      }
      //cout<<j<<" "<<i<<":"<<dp[j]<<" "<<dp[i]<<":"<<m<<":";
      //cout<<cul(A[j],m)<<" "<<cul(m,A[i])<<endl;
    }
  }
  return dp.back()+cul(A.back(),INF)<=x;
}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  while(cin>>n>>m,m){
    C.resize(n);
    A.resize(m);
    for(Int i=0;i<n;i++){
      Int y;
      cin>>C[i].first>>y>>C[i].second;
      C[i].first*=2;
    }
    for(Int i=0;i<m;i++){
      cin>>A[i];
      A[i]*=2;
    }
    if(n==0){cout<<0<<endl; continue;}
    sort(A.begin(),A.end());
    C.emplace_back(-2*INF,0);
    sort(C.begin(),C.end());
    for(Int i=1;i<=n;i++){C[i].second+=C[i-1].second;}
    C.push_back(C[n]);
    C.back().first=INF*2;
    //for(auto p:C) cout<<p.first<<" "<<p.second<<endl;

    // judge(2);
    
    ll l=0,r=INF;
    while(l+1<r){
      ll m=(l+r)>>1;
      if(judge(m)){r=m;}
      else{l=m;}
    }
    cout<<r<<endl;    
  }
  
  
  return 0;
}



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

bool check(int a) {
  for (int i = 1; i < 10; ++i) {
    for (int j = 1; j < 10; ++j) {
      if (i * j == a) {
        return true;
      }
    }
  }
  return false;
}

int main() {
  int a;
  cin >> a;
  cout << (check(a) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pp pair<int,int>
#define ll long long
int inf=100000000;
ll INF=5000000000000000000;
ll MOD=1000000007;

int main() {
    int n;
    ll w;
    cin >> n >> w;
    vector<ll> a(n),b(n);
    cin >> a.at(0) >> b.at(0);
    ll ww=a.at(0);
    int k=0;
    for (int i=1;i<n;i++){
        cin >> a.at(i) >> b.at(i);
        a.at(i)=a.at(i)-a.at(0);
        k+=a.at(i);
    }    
    a.at(0)=0;
    vector<vector<ll>> d(301,vector<ll>(101));

    d.at(0).at(0)=0;
    ll o=w/ww;
    ll h=0;
    rep(i,301){
        rep(j,101) d.at(i).at(j)=-1;
    }
    d.at(0).at(0)=0;
        for (int i=0;i<n;i++){
            for (int j=300;j>-1;j--){
                for (int l=100;l>-1;l--){
                    if (d.at(j).at(l)!=-1 && d.at(j+a.at(i)).at(l+1)<d.at(j).at(l)+b.at(i)) d.at(j+a.at(i)).at(l+1)=d.at(j).at(l)+b.at(i);
                }
            }
        }
        //cout << d.at(0).at(0) << " " << d.at(0).at(1) << endl; 
        for (int j=0;j<301;j++){
            for (int l=0;l<101;l++){
                if (l*ww+j>w) continue;
                h=max(h,d.at(j).at(l));
            }
        }
    cout << h << endl;
}


Measured memory_bytes: 512
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
using namespace std;
using ll=long long;
#define MOD  1000000007


int main(int argc, char const *argv[]) {
  int n,cnt=0;
  string a,b,c;
  std::cin >> n >> a >> b >> c;

  for(int i=0; i<n ; i++){
    if(a[i]==b[i] && a[i]==c[i]) cnt+=0;
    else if(a[i]==b[i] && a[i]!=c[i] || a[i]==c[i] && a[i]!=b[i] || b[i]==c[i] && b[i]!=a[i]) cnt++;
    else cnt+=2;
  }
  std::cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

char s[110],t[110];
int main(){
	scanf("%s%s",s,t);
	ll sn=strlen(s);
	ll tn=strlen(t);
	if(sn<tn)puts("LESS");
	else if(sn>tn)puts("GREATER");
	else{
		rep(i,0,sn){
			if(s[i]<t[i]){
				puts("LESS");
				return 0;
			}
			if(s[i]>t[i]){
				puts("GREATER");
				return 0;
			}
		}
		puts("EQUAL");
	}
}

Measured memory_bytes: 128
<?php
list($H, $N) = ints();
$dp = array_fill(0, $N + 1, array_fill(0, $H + 1, 10**18));
$dp[0][0] = 0;
for($i = 1; $i <= $N; $i++){
  $dp[$i] = $dp[$i-1];
  $dpi = &$dp[$i];
  list($a, $b) = ints();
  for($j = 1; $j <= $H; $j++){
    if($j - $a >= 0){
      chmin($dpi[$j], $dpi[$j-$a]+$b);
    }else{
      chmin($dpi[$j], $b);
    }
  }
}
//o($dp);
echo $dp[$N][$H];
function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}

function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array: ";
            echo implode(" ", addIndex($val))."\n";
        }else{
            echo "array:array\n";
            if(isCleanArray($val)){
                foreach($val as $row)echo implode(" ", addIndex($row))."\n";
            }else{
                foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row))."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}
function addIndex($val){
    if(!isCleanArray($val)){
        $val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);
    }
    return $val;
}
function isCleanArray($array){
    $clean = true;
    $i = 0;
    foreach($array as $k => $v){
        if($k != $i++)$clean = false;
    }
    return $clean;
}

Measured memory_bytes: 758264
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using namespace std;
int main() {
    int a,b;
    cin >> a >> b;
    int k;
    k = (a+b)/2;
    if((a+b)%2 == 1){
        cout << "IMPOSSIBLE";
    }
    else cout << k;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop
import itertools
import math
import copy

H, W = map(int, input().split())

A = []
B = []
for _ in range(H):
    a = list(map(int, input().split()))
    A.append(a)

for _ in range(H):
    b = list(map(int, input().split()))
    B.append(b)

C = []
for i in range(H):
    cs = []
    for j in range(W):
        c = abs(A[i][j] - B[i][j])
        cs.append(c)

    C.append(cs)


X = (H+W) * 80
L = X + X + 1

dp = [[0] * W for _ in range(H)]
dp[0][0] = np.zeros(L, np.bool)
d = C[0][0]
dp[0][0][X+d] = 1
dp[0][0][X-d] = 1

for r in range(H):
    for c in range(W):
        if r == 0 and c == 0:
            continue

        l = np.zeros(L, np.bool)
        d = C[r][c]

        if r != 0:
            l[d:] |= dp[r-1][c][:L-d]
            l[:L-d] |= dp[r-1][c][d:]

        if c != 0:
            l[d:] |= dp[r][c-1][:L-d]
            l[:L-d] |= dp[r][c-1][d:]

        dp[r][c] = l

dp = dp[-1][-1]
d = np.where(dp)[0] - X
ans = np.abs(d).min()
print(ans)


Measured memory_bytes: 173392
import math
n=int(input())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
a=0
b=0
suuzi1=[i for i in range(1,n+1)]
suuzi2=[i for i in range(1,n+1)]
for i in range(n):
    a+=suuzi1.index(s[i])*math.factorial(n-i-1)
    suuzi1.remove(s[i])
for i in range(n):
    b+=suuzi2.index(t[i])*math.factorial(n-i-1)
    suuzi2.remove(t[i])
print(abs(b-a))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define N 100005
struct xx {
	int a,b;
} w[N<<1];
bool cmp(xx k1,xx k2) {
	return k1.b < k2.b;
}
int main () {
	int n;
	cin >> n;
	for(int i=1; i<=n; i++) scanf("%d%d",&w[i].a,&w[i].b);
	sort(w+1,w+n+1,cmp);
	int now = 0,flg = 0;
	for(int i=1; i<=n; i++) {
		now += w[i].a;
		if(now > w[i].b) flg = 1;
	}
	if(!flg) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int dp[2005][2005],n;
P<int,int> p[2005];
int cost(int x,int y){
	RE p[y].F*abs(x-p[y].S);
}
int dfs(int l,int r){
	if(dp[l][r]!=-1)RE dp[l][r];
	int len=l+n-r+2,re=0;
	if(len==n+1)RE dp[l][r]=re;
	re=max(dfs(l+1,r)+cost(l+1,len),dfs(l,r-1)+cost(r-1,len));
	RE dp[l][r]=re;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int x;
	cin>>n;
	FOR(i,1,n){
		cin>>x;
		p[i]=MP(x,i);
	}
	sort(p+1,p+n+1,greater<P<int,int>>());
	FILL(dp,-1);
	cout<<dfs(0,n+1)<<'\n';
	RE 0;
}




Measured memory_bytes: 35180
#include <stdio.h>

int main(void)
{
    int TotalSeconds;
    scanf("%d", &TotalSeconds);
    // int Hour = TotalSeconds / 60 / 60;
    int Minutes = TotalSeconds / 60 % 60;
    int Seconds = TotalSeconds % 60;
    printf("%d:%d:%d\n", TotalSeconds / 60 / 60,
           Minutes, Seconds);
    return 0;
}


Measured memory_bytes: 2712
#include<bits/stdc++.h>
using namespace std;
#define MOD (long long)1e9+7
long long partial(long long n)
{
    return n*(n+1)/2;
}
int main()
{
   int n,k;
   cin>>n>>k;
   long long sum=0;
   long long t_sum=partial(n);
   for(int i=k;i<=n+1;i++){
       sum+=t_sum-partial(n-i)-partial(i-1)+1;
       sum%=MOD;
   }
   cout<<sum;
} 


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

int N;
int sum = 0;                  //周の長さ
bool able = true;       //構築可能か否か
vector<int> L(0);

int main(){
  cin >> N;
  
  for(int i = 0; i < N; i++){
    int l;
    cin >> l;
    L.push_back(l);
    sum += l;
  }

  for(int i = 0; i < N; i++){
    if(L[i] >= (sum - L[i]))
      able = false;
  }

  if(able)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())

a=[0 for i in range(n+1)]
b=[0 for i in range(n+1)]
c=[0 for i in range(m+1)]
d=[0 for i in range(m+1)]



for i in range(1,n+1):
    a[i],b[i]=map(int,input().split())
for j in range(1,m+1):
    c[j],d[j]=map(int,input().split())

for i in range(1,n+1):
    min=abs(a[i]-c[1])+abs(b[i]-d[1])+1
    for j in range(1,m+1):
        dis = abs(a[i]-c[j])+abs(b[i]-d[j])
        if dis<min: min=dis ; ans=j
    print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){
    for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){
    os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){
    os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){
    os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){
    os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){
    os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){
    os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){
    os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){
    os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) {
    if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) {
    if (q < m) {m = q; return true;} else return false; }

int main()
{
    int N;
    cin >> N;
    vector<pint> A(N);
    rep(i,N) {
        cin >> A[i].first;
        A[i].second = i;
    }
    sort(A.rbegin(), A.rend());
    vector<vector<ll>> dp(N+2, vector<ll>(N+2,-1));
    // until i-th element, there are j number id satisfying p[id] > id
    dp[0][0] = 0;
    rep(i,N) {
        ll cost = A[i].first;
        int id = A[i].second;
        rep(j,i+1) {
            if (dp[i][j] >= 0) {
                chmax(dp[i+1][j+1], dp[i][j] + cost * abs(j - id));
                chmax(dp[i+1][j], dp[i][j] + cost * abs((N - 1) - id - (i - j)));
            }
        }
    }
    ll ans = 0;
    rep(i,N) chmax(ans, dp[N][i]);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 34644
U = 2*10**5
MOD = 998244353
 
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
 
for i in range(1,U+1):
    fact[i] = (fact[i-1]*i)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
 
for i in range(U,0,-1):
    fact_inv[i-1] = (fact_inv[i]*i)%MOD

def comb(n, k):
    if k < 0 or k > n:
        return 0
    z = fact[n]
    z *= fact_inv[k]
    z *= fact_inv[n-k]
    z %= MOD
    return z

n, m, k = map(int, input().split())
ans = 0
for i in range(k+1):
    res = 1
    res *= comb(n-1, i)
    res *= m
    res %= MOD
    res *= pow(m-1, n-i-1, MOD)
    res %= MOD
    ans += res
    ans %= MOD
print(ans)

Measured memory_bytes: 24640
n=int(input())
arr=list(map(int,input().split()))
arr_sum = 0
mod = 10**9 + 7
for i in range(0, n, 1): 
    arr_sum = arr_sum + arr[i] 

temp = arr_sum * arr_sum  
temp1 = 0

for i in range(0, n, 1): 
    temp1 += arr[i] * arr[i] 
ans=((temp - temp1)//2)%mod
print(ans)

Measured memory_bytes: 31604
# include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
template<typename T>vector<T> make_v(size_t a){ return vector<T>(a); }
template<typename T,typename... Ts>auto make_v(size_t a, Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type fill_v(T &t, const V &v){ t = v; }
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type fill_v(T &t, const V &v){ for(auto &e : t) fill_v(e, v); }
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int a, b, t;

int main(){
    cin >> a >> b >> t;
    cout << (t/a)*b << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <string>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int h, w;
	cin >> h >> w;

	vector<string> grid(h);
	for (int i = 0; i < h; ++i) {
		cin >> grid[i];
	}

	vector<vector<int> > horizontal_obstacles(h), vertical_obstacles(w);
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (grid[i][j] == '#') {
				horizontal_obstacles[i].push_back(j);
				vertical_obstacles[j].push_back(i);
			}
		}
	}

	int max_light = 0;
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (grid[i][j] == '.') {
				vector<int>::iterator low = lower_bound(horizontal_obstacles[i].begin(), horizontal_obstacles[i].end(), j);
				int left = 0;
				int right = 0;
				if (low != horizontal_obstacles[i].end()) {
					right = *low - j - 1;
				} else {
					right = w - j - 1;
				}

				if (low != horizontal_obstacles[i].begin()) {
					--low;
					left = j - *low - 1;
				} else {
					left = j;
				}

				int up = 0;
				int down = 0;
				low = lower_bound(vertical_obstacles[j].begin(), vertical_obstacles[j].end(), i);
				if (low != vertical_obstacles[j].end()) {
					down = *low - i - 1;
				} else {
					down = h - i - 1;
				}

				if (low != vertical_obstacles[j].begin()) {
					--low;
					up = i - *low - 1;
				} else {
					up = i;
				}

				max_light = max(max_light, left + right + up + down + 1);
			}
		}
	}

	cout << max_light << "\n";

	return 0;

}

Measured memory_bytes: 41640
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, a, b;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    bool ans;
    cin >> n >> a >> b;
    if ((a+b)%2) ans = false;
    else ans = true;
    if (ans) cout << "Alice" << endl;
    else cout << "Borys" << endl;
    return 0;
}


Measured memory_bytes: 256
<?php
list($n,$k)=explode(" ",trim(fgets(STDIN)));
if($n<=$k){
  echo 0;
  exit;
}
$h=explode(" ",trim(fgets(STDIN)));
sort($h);
$a=array_slice($h,0,$n-$k);
echo (int)array_sum($a);

Measured memory_bytes: 29240
#include <iostream>

using namespace std;

static const int MAX = 200000;

int main(){
  int R[MAX], n;

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

  int min = R[0];
  int max = -2000000000;
  for(int i = 1; i < n; i++){
    if(R[i] - min > max){
      max = R[i] - min;
    }
    if (R[i] < min){
      min = R[i];
    }
  }

  cout << max << endl;

  return 0;
}

Measured memory_bytes: 3872
s = input()
mod = 10**9 + 7
n = len(s)
dp = [[0] * 13 for i in range(n+1)]
dp[0][0] = 1
for i in range(n):
    ss = s[i]
    for j in range(13):
        if ss == '?':
            for k in range(10):
                dp[i+1][(j*10+k)%13] += dp[i][j]
        else:
            dp[i+1][(j*10+int(ss))%13] += dp[i][j]
        dp[i+1][j] %= mod
print(dp[n][5]%mod)


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

vector<pair<int,int> > v[1010][1010];
int n,x[1010][1010];
int dist[1010][1010],deg[1010][1010];

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++){
		for(int j=1;j<n;j++){
			cin>>x[i][j];
		}
		for(int j=1;j<n-1;j++){
			pair<int,int> v1,v2;
			if(i<x[i][j]){
				v1=make_pair(i,x[i][j]);
			}
			else v1=make_pair(x[i][j],i);
			
			if(i<x[i][j+1]){
				v2=make_pair(i,x[i][j+1]);
			}
			else v2=make_pair(x[i][j+1],i);
			
			v[v1.first][v1.second].push_back(make_pair(v2.first,v2.second));
			deg[v2.first][v2.second]++;
		}
	}
	queue<pair<int,int> > q;
	for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++) if(deg[i][j]==0){
		q.push(make_pair(i,j));
		dist[i][j]=1;
	}
	while(!q.empty()){
		pair<int,int> t=q.front();
		q.pop();
		for(int i=0;i<v[t.first][t.second].size();i++){
			pair<int,int> u=v[t.first][t.second][i];
			dist[u.first][u.second]=max(dist[u.first][u.second],dist[t.first][t.second]+1);
			deg[u.first][u.second]--;
			if(deg[u.first][u.second]==0){
				q.push(u);
			}
		}
	}
	for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++) if(deg[i][j]!=0){
		cout<<-1<<endl;
		return 0;
	}
	int ans=0;
	for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++){
		ans=max(ans,dist[i][j]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 51712
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define ET cout << "\n"
#define MEM(i,j) memset(i,j,sizeof i)
#define ALL(v) v.begin(),v.end()
#define DB(a,s,e) {for(int i=s;i<e;++i) cerr << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll MOD=998244353;
ll dp[90005],dp2[90005];

int main()
{jizz
	ll n,ans=1,sum=0,x,t=1;
	cin >> n,dp[0]=1,dp2[0]=1;
	while(n--)
	{
		cin >> x,ans=ans*3%MOD,t=t*2%MOD,sum+=x;
		for(int i=sum;i>=x;--i)
			dp[i]=(dp[i]+dp[i-x])%MOD,dp2[i]=(dp2[i]*2+dp2[i-x])%MOD;
		for(int i=x-1;i>=0;--i)
			dp2[i]=dp2[i]*2%MOD;
	}
	for(int i=sum/2+(sum&1);i<=sum;++i)
		ans=(ans-dp2[i]*3%MOD+dp[i]*6%MOD+MOD)%MOD;
	cout << (ans-t*3%MOD+MOD)%MOD << "\n";
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <vector> 
#include <functional>

using namespace std;



int main()
{
    string input1, input2;

    cin >> input1 >> input2;

    sort(input1.begin(), input1.end());
    sort(input2.rbegin(), input2.rend());

    //cout << s << endl << t << strcmp(s.c_str(), t.c_str()) << endl;
    if (input1<input2)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
<?php

//$_input = explode(
//    "\n",
//    '100 4 16'
//);

function getNext() {
    return trim(
        isset($GLOBALS['_input'])
            ? array_shift($GLOBALS['_input'])
            : fgets(STDIN)
    );
}

list($n, $a, $b) = explode(' ', getNext());

function charSum($i) {
    return array_reduce(str_split((string) $i), function ($carry, $item) {
        return $carry + (int) $item;
    }, 0);
}

// 1 以上 N 以下の整数のうち、10 進法での各桁の和が A 以上 B 以下であるものの総和を求めてください。
$sum = 0;
for ($i = 1; $i <= $n; ++$i) {
    $temp = charSum($i);
    if ($temp >= $a && $temp <= $b) {
        $sum = $sum + $i;
    }
}

printf("%d\n", $sum);



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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  string s;
  cin >> s;
  string t = "NSWE";
  vector<bool> flg(4, 0);
  rep(i, s.size()) rep(j, t.size()) if (s[i] == t[j]) flg[j] = 1;
  cout << ((flg[0] ^ flg[1]) | (flg[2] ^ flg[3]) ? "No" : "Yes") << endl;
}


Measured memory_bytes: 256
'use strict';

function Main(input) {
  const N = Number(input.split(' ')[0]);
  const K = Number(input.split(' ')[1]);

  if(K % 2 !== 0) {
    console.log(Math.pow(Math.floor(N/K), 3));
  } else {
    if(N*2 >= ((Math.floor(N/K) * 2)+1)*K ) {
      console.log(Math.pow(Math.floor(N/K), 3) + Math.pow(Math.floor(N/K)+1, 3));
    } else {
      console.log(Math.pow(Math.floor(N/K), 3) + Math.pow(Math.floor(N/K), 3));
    }
  }




};
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

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

int main(){
    int n, m;
    
    while(true){
        cin >> n >> m;
        if (n==0 && m==0) break;
        int ma=0, list[n];
        for (int i=0; i<n; i++) cin >> list[i];
        for (int i=0; i<n-1; i++){
            for (int j=i+1; j<n; j++){
                int sum = list[i] + list[j];
                if (sum<=m) ma = max(ma,sum);
            }
        }
        if (ma==0) cout << "NONE" << endl;
        else cout << ma << endl;
    }
}


Measured memory_bytes: 3068
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    string s;
    cin >> s;
    int N = s.size();
    int a = s.size(), b = 0;
    rep(0, i, N)
    {
        if (s.at(i) == 'A')
        {
            a = min(a, i);
        }
        if (s.at(i) == 'Z')
        {
            b = max(b, i);
        }
    }
    cout << b - a + 1 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
using namespace std;

int main() {
	#ifdef kvutxdy
	freopen("C:/Users/khanh/OneDrive/RoadtoPurple/Code/Codeforces/input.in", "r", stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	string s;
	cin>>s;
	int n=s.size();
	if(s[0]==s[n-1]) cout<<((n&1)?"Second\n":"First\n");
	else cout<<((n&1)?"First\n":"Second\n");
}

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

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		String s = "";

		try {
			scanner = new Scanner(System.in);
			s = scanner.next();

			char[] wk = s.toCharArray();

			int cntA = 0;
			int cntB = 0;
			int cntC = 0;

			for (int i = 0; i < wk.length; i++) {
				char c = wk[i];
				if (c == 'a' && cntA == 0) {
					cntA++;
				} else if (c == 'b' && cntB == 0) {
					cntB++;
				} else if (c == 'c' && cntC == 0) {
					cntC++;
				}
			}

			System.out.println((cntA + cntB + cntC) == 3 ? "Yes" : "No");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;
		int numK = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();
			numK = scanner.nextInt();

			List<Integer> wk = new ArrayList<Integer>();
			for (int i = numA; i <= numB; i++) {
				if (i < numA + numK || numB - numK < i) {
					wk.add(i);
				}
			}

			for (int i = 0; i < wk.size(); i++) {
				System.out.println(wk.get(i));
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 22868