akhauriyash/Code-Regression huggingface dataset:
using System;

public class Dice
{
	private int[] labels;
	public const int TOP = 0;
	public const int FRONT = 1;
	public const int RIGHT = 2;
	public const int LEFT = 3;
	public const int BACK = 4;
	public const int BOTTOM = 5;
	public Dice( int[] labels )
	{
		this.labels = labels;
	}
	public void roll( string cmds )
	{
		int t;
		for( int i=0; i<cmds.Length; i++ ) {
			if( 'E' == cmds[i] ) {
			t = this.labels[TOP];
				this.labels[TOP] = this.labels[LEFT];
				this.labels[LEFT] = this.labels[BOTTOM];
				this.labels[BOTTOM] = this.labels[RIGHT];
				this.labels[RIGHT] = t;
			} else if( 'S' == cmds[i] ) {
				t = this.labels[TOP];
				this.labels[TOP] = this.labels[BACK];
				this.labels[BACK] = this.labels[BOTTOM];
				this.labels[BOTTOM] = this.labels[FRONT];
				this.labels[FRONT] = t;
			} else if( 'W' == cmds[i] ) {
				t = this.labels[TOP];
				this.labels[TOP] = this.labels[RIGHT];
				this.labels[RIGHT] = this.labels[BOTTOM];
				this.labels[BOTTOM] = this.labels[LEFT];
				this.labels[LEFT] = t;
			} else if( 'N' == cmds[i] ) {
				t = this.labels[TOP];
				this.labels[TOP] = this.labels[FRONT];
				this.labels[FRONT] = this.labels[BOTTOM];
				this.labels[BOTTOM] = this.labels[BACK];
				this.labels[BACK] = t;        
			} else if( 'M' == cmds[i] ) {
				t = this.labels[FRONT];
				this.labels[FRONT] = this.labels[RIGHT];
				this.labels[RIGHT] = this.labels[BACK];
				this.labels[BACK] = this.labels[LEFT];
				this.labels[LEFT] = t;        
			}	
		}
	}
	public int getLabel( int face )
	{
		return this.labels[face];
	}
	public bool isEqual( Dice another )
	{
		string cmds = "SWWWSMMMM";
		for( int i=0; i<6; i++ ) {
			if( another.getLabel( Dice.TOP ) == this.getLabel( Dice.TOP ) ) {
				for( int j=5; j<9; j++ ) {
					if( another.getLabel( Dice.FRONT ) == this.getLabel( Dice.FRONT ) ) {
						int k;
						for( k=Dice.TOP; k<=Dice.BOTTOM; k++ ) {
							if( another.getLabel( k ) != this.getLabel( k ) ) { break; }		
						}
						if( 6 == k ) { return true; }
						break;
					}
					this.roll( cmds[j].ToString() );		
				}
			}
			this.roll( cmds[i].ToString() );			
		}
		return false;
	}
	
}

public class Test
{
	public static void Main( )
	{
		int n = int.Parse( Console.ReadLine() );
		Dice[] dices = new Dice[n];
		for( int i=0; i<n; i++ ) {
			int[] labels = Array.ConvertAll( Console.ReadLine().Split( ' ' ), int.Parse );
			dices[i] = new Dice( labels );
		}
		bool isDiff = true;
		for( int i=0; i<n-1; i++ ) {
			for( int j=i+1; j<n; j++ ) {
				if( dices[i].isEqual( dices[j] ) ) {
					isDiff = false;
					goto END;
				}
			}
		}
		END:
		if( isDiff ) {
			Console.WriteLine( "Yes" );
		} else {		
			Console.WriteLine( "No" );		
		}
	}
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
     ll n;
     cin>>n;
     if(n%2==0)
     {
         ll count=0;
         ll i=5;
         while(1)
         {
             ll temp=0;
            
                 if(n%2==0)
                 temp=n/(2*i);
                 else
                 {
                     ll temp1=n/i;
                     long double temp2=temp1/2.0;
                     temp=ceil(temp2);
                     
                 }
                 
                 count+=temp;
                 if(temp==0)
                 break;
                 i=i*5;
                
         }
         
         cout<<count<<"\n";
     }
     else
     {
         cout<<0<<"\n";
     }

}


Measured memory_bytes: 256
diff = list()
ans = 0
for i in range(5):
  x = int(input())
  ans += x if x %10 == 0 else x + 10 - (x % 10)
  diff.append(0 if x %10 == 0 else 10 - (x % 10))
diff = sorted(diff, reverse = True)
ans -= diff[0]
print(ans)


Measured memory_bytes: 2940
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var K = one[1];  
  var output = 1;
  output *= K;
  for(var i = 0; i < N - 1; i++){
    output *= (K - 1);
  }
  myout(output);
}


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

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

int main(){
  int N,W;
  cin >> N >> W;

  const long long INF = 1LL << 60;
  long long weight[110], value[110];
  long long dp[110][100010];
  for(int i = 0; i < N; i++){
      cin >> weight[i] >> value[i];
  }
  for(int i = 0; i < 110; i++){
    for(int j = 0; j < 100010; j++){
      dp[i][j] = INF;
    }
  }
dp[0][0] = 0;

  for(int i = 0; i < N; i++){
    for(int sum_v = 0; sum_v <= 100010; sum_v++){
      	if(sum_v >= value[i]){
     	 	chmin(dp[i+1][sum_v], dp[i][sum_v - value[i]]+ weight[i]);
      	}    
      	chmin(dp[i+1][sum_v], dp[i][sum_v]);
    }
  }
  int64_t ans;
 for(int sum_v =0; sum_v < 100010; sum_v++){
   if(dp[N][sum_v] <= W) ans = sum_v;
 }
  cout <<ans << endl;
  
}

Measured memory_bytes: 86144
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //配列(vector)vの重複要素を削除


void solve(){
    ll a, b, c;
    cin >> a >> b >> c;
    
    if((c-a-b > 0) && ((4*a*b) < ((c-a-b)*(c-a-b)))) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <boost/functional/hash.hpp>
using namespace std;
typedef long long ll;
// typedef int long long int;
typedef unsigned long long ull;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll>   vl;
#define f(i,n)  for(i=0;i<n;i++)
#define f1(i,n)  for(i=1;i<n;i++)
#define fr(i,n) for(i=n-1;i>=0;i--)
#define em emplace_back
#define mp make_pair
#define in insert
#define fi first
#define sc second
#define b begin
#define e end
#define er erase
#define l length
#define c clear
#define si size
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
const double pi=3.141592653;
const ll MOD=1000000007;
const ll mod=998244353;
const string no="NO\n",yes="YES\n";

// ll gcd(ll a,ll b){
//     if(a==0)    return b;
//     gcd(b%a,a);
// }

// void dfs(vl v[],ll node,ll hai[]){
//     hai[node]=1;
//     for(auto i:v[node]){
//         if(hai[i]==0){
//             dfs(v,i,hai);
//         }
//     }
// }

// ll con(vl v[],ll hai[],ll sz){
//     ll count=0;
//     for(int i=1;i<sz;i++){
//         if(hai[i]==0){
//             count++;
//             dfs(v,i,hai);
//         }
//     }
    // return count;
// }

// void gcde(int a,int b,int *x,int *y){
//     if(a==0){
//         *x=0;
//         *y=1;
//         return;
//     }    
//     int x1,y1;
//     gcde(b%a,a,&x1,&y1);
    
//     *x=y1-(b/a)*x1;
//     *y=x1;
// }


// ll recur(vl v,ll in,ll m,ll n){
//     if(in==-1)  return 1000000000001;
//     ll d,e,c;
//     d=max(m/v[in],n*v[in]);
//     c=recur(v,in-1,m/v[in],n*v[in]);
//     e=recur(v,in-1,m,n);
//     return min(c,min(e,d));
// }

// ll bexpo(ll a,ll p){
//     ll x=1;
//     while(p){
//     if(p&1){
//         x=(x*a)%mod;
//     }
//     a=(a*a)%mod;
//     p>>=1;
//     }
//     return x;
// }
// ll fact[500001],invf[500001];

int main() {
    fastio
    int t=1;
    // cin>>t;
    ull n,m,a,b,i,l,r,d,ans;
    
    while(t--){ans=0;
        cin>>n;
        f1(i,n+1){
            cin>>a;
            if(a%2==1&&i%2==1)  ans++;
        }
        
        cout<<ans;
    }
    
	return 0;
}

Measured memory_bytes: 3636
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    sA = sum(A)
    sB = sum(B)
    if sA < sB:
        return print(-1)
    C = [a-b for a, b in zip(A, B)]
    C.sort()
    ans = 0
    less = 0
    for c in C:
        if c < 0:
            ans += 1
            less += c
        else:
            break
    for c in C[::-1]:
        if 0 <= less:
            break
        less += c
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 84784
#include<bits/stdc++.h>
#define endl "\n"
#define PI acos(-1)
#define BMW_GTR ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)

typedef long long ll;
using namespace std;

//ll const n = 50005;

int main()
{
    BMW_GTR;

    int N, flag = 0;
    cin >> N;

    int arr[N];

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

    sort(arr, arr + N);

    for(int i = 1; i < N; i++)
    {
        if(arr[i] == arr[i - 1])
        {
            flag++;
            break;
        }
    }

    if(flag == 0)cout << "YES";
    else cout << "NO";

    return 0;
}

Measured memory_bytes: 4344
#include <iostream>
//#include <vector>
#include <string>
#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    string s;
    cin >> s;
    LL ans=0;
    LL max_ans=0;
    for(LL i=0; i<s.size(); i++){
        if(s[i]=='R'){
            ans++;
            if(i==s.size()-1){
                max_ans=max(max_ans,ans);
            }
        }else{
            max_ans=max(max_ans,ans);
            ans=0;
        }
    }

    cout << max_ans << endl;

    return 0;
}


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


int main(){
  long long A, B, C, D;
  cin >> A >> B >> C >> D;
  long long count1, count2, ans, gcd_CD;
  gcd_CD = C / __gcd(C, D) * D;
  count1 = B/C + B/D - B/gcd_CD;
  count2 = (A - 1)/C + (A - 1)/D - (A - 1)/gcd_CD;
  ans = (B - A + 1) - (count1 - count2);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=200005;
int n,a[N],t[2][N<<2];
void update(int o,int rt,int L,int R,int pos){
	if (a[pos]<a[t[o][rt]])
		t[o][rt]=pos;
	if (L==R)
		return;
	int mid=(L+R)>>1,ls=rt<<1,rs=ls|1;
	if (pos<=mid)
		update(o,ls,L,mid,pos);
	else
		update(o,rs,mid+1,R,pos);
}
int query(int o,int rt,int L,int R,int xL,int xR){
	if (L>xR||R<xL)
		return 0;
	if (xL<=L&&R<=xR)
		return t[o][rt];
	int mid=(L+R)>>1,ls=rt<<1,rs=ls|1;
	int Lans=query(o,ls,L,mid,xL,xR);
	int Rans=query(o,rs,mid+1,R,xL,xR);
	return a[Lans]<a[Rans]?Lans:Rans;
}
struct seg{
	int L,R,v;
	seg(){}
	seg(int _L,int _R){
		L=_L,R=_R,v=L>R?0:query(L&1,1,1,n,L,R);
	}
	friend bool operator < (seg A,seg B){
		return a[A.v]<a[B.v];
	}
};
int scnt=0;
set <seg> S;
int main(){
	scanf("%d",&n);
	a[0]=n+1;
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		update(i&1,1,1,n,i);
	}
	S.clear();
	S.insert(seg(1,n));
	for (int i=1;i<=n/2;i++){
		seg now=*S.begin();
		S.erase(S.begin());
		int L=now.L,R=now.R;
		int Lmid=now.v,Rmid=query((Lmid&1)^1,1,1,n,Lmid,R);
		printf("%d %d ",a[Lmid],a[Rmid]);
		S.insert(seg(L,Lmid-1));
		S.insert(seg(Lmid+1,Rmid-1));
		S.insert(seg(Rmid+1,R));
	}
	return 0;
}

Measured memory_bytes: 11008
n = int(input())
lst = list(map(int,input().split()))

lst.sort()
M = lst[-1]
m = lst[0]
total = float('inf')

for i in range(m,M+1):
  s = sum([(x-i)**2 for x in lst])
  if s < total:
    total = s
    
print(total)    
    

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

using namespace std;

typedef long long ll;

long long test_cases;
int main()
{
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    /* cin >> test_cases; */
    test_cases = 1;
    char letter;
    while (test_cases > 0)
    {
        cin >> letter;

        if (islower(letter))
            cout << "a\n";
        else
            cout << "A\n";


        test_cases--;
    }

    
    return 0;
}

Measured memory_bytes: 3608
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 300001
using namespace std;
inline long long read()
{
   long long f=1,s=0,ch=getchar();
   while(ch!='-'&&!isdigit(ch)) ch=getchar();
   ch=='-' ? f=-1:s=ch-'0',ch=getchar();
   while(isdigit(ch)) s=s*10+ch-'0',ch=getchar();
   return s*f;
}
long long n,m;
int main()
{
	n=read();m=read();
	printf("%lld\n",n+(m/2));
	
	return 0;
}

Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>
#include <set>
#include<stack>
#include <utility>
#define INF 1000000000000
const long long MOD = 1000000007;

using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

llong dfs(llong n, vector<llong> &dp){
    if(n<0){
        return INF;
    }
    if(n==0){
        return 0;
    }
    if(dp[n]!=-1){
        return dp[n];
    }
    llong ans=INF;
    ans = min(dfs(n-1, dp)+1, ans);
    for(int i=1; pow(6,i)<=n; i++){
        ans = min(dfs(n-pow(6,i), dp)+1, ans);
    }    
    for(int i=1; pow(9,i)<=n; i++){
        ans = min(dfs(n-pow(9,i), dp)+1, ans);
    }   
    dp[n] = ans;
    return ans; 
}

int main(){
    llong N;
    cin >> N;
    vector<llong> dp(N+1, INF);
    llong ans;
    dp[0] = 0;
    for(int i=1; i<=N; i++){
        dp[i] = INF;
        dp[i] = min(dp[i-1]+1, dp[i]);
        for(int j=1; pow(6,j)<=i; j++){
            dp[i] = min(dp[i-pow(6,j)]+1, dp[i]);
        }    
        for(int j=1; pow(9,j)<=i; j++){
            dp[i] = min(dp[i-pow(9,j)]+1, dp[i]);
        }  
    }
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 3676
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template <class T = ll>
T C(){T x;cin>>x;return (x);}

template <class T = ll>
T CI(T& t){cin>>t;}

template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}

template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=C();
  VT3(head,move(tail)...);
}

#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)

bool BitEnum(vector<int> &inpvec, int count){
  if(pow(3,inpvec.size())  == count)return false;
  REP(i,inpvec.size()){
    inpvec[i]=count%3;
    count/=3;
  }

  return true;
}

int main(){
  CIN(k,s);
  ll cou=0;
  REP(x,k+1){
    REP(y,k+1){
      int z = s-x-y;
      if(x+y+z==s&&0<=z&&z<=k)cou++;
    }
  }

  COUT(cou);
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
const ll INF = 0xffffffffff;
ll n,k;
ll d[100][100];
ll a,b,c,e;
int main()
{while(1){
	cin>>n>>k;
	if(!n )return 0;
	fill(d[0],d[100],INF);
	for(ll i=0;i<100;i++) d[i][i]=0;
	for(ll i=0;i<k;i++){
		cin>>a;
		if(a==1){
			cin>>b>>c>>e;
			--b;
			--c;
			d[b][c]=min(d[b][c],e);
			d[c][b]=d[b][c];
			for(ll x=0;x<n;x++){
				for(ll y=0;y<x;y++){
					d[x][y]=min(d[x][y],min(d[x][b]+d[b][c]+d[c][y] ,d[x][c]+d[c][b]+d[b][y])  );
					d[y][x]=d[x][y];
				}
			}
		}
		else{
			cin>>a>>b;
			--a;
			--b;
			if(d[a][b]==INF) puts("-1");
			else printf("%lld\n",d[a][b]);
		}
	}
}}

Measured memory_bytes: 3108
def main(X, Y):
    cand = Y // 4
    for i in range(cand, -1, -1):
        if i * 4 + (X - i) * 2 == Y:
            print('Yes')
            exit()
    else:
        print('No')
if __name__ == '__main__':
    X, Y = list(map(int, input().split()))
    main(X, Y)

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

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

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    ll K; cin >> K;
    string S; cin >> S;
    if (S.size()<= K) cout << S << endl;
    else {
        cout << S.substr(0,K) << "..." << endl;
    }
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int ans = 0;
    for(int i = 0; i < n-1; i++){
        int l = i;
        int r = i+1;
        while(a[l] == a[r]){
            r++;
            if(r==n){break;}
        }
        ans += (r-l)/2;
        i = r-1;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int color[9];
    int N, rate, count = 0;
    cin >> N;
    for (int i = 0; i < 9; i++) color[i] = 0;
    for (int i = 0; i < N; i++) {
        cin >> rate;
        if (rate < 400) color[0]++;
        else if (rate >= 400 && rate < 800) color[1]++;
        else if (rate >= 800 && rate < 1200) color[2]++;
        else if (rate >= 1200 && rate < 1600) color[3]++;
        else if (rate >= 1600 && rate < 2000) color[4]++;
        else if (rate >= 2000 && rate < 2400) color[5]++;
        else if (rate >= 2400 && rate < 2800) color[6]++;
        else if (rate >= 2800 && rate < 3200) color[7]++;
        else color[8]++;
    }
    for (int i = 0; i < 8; i++) {
        if (color[i] != 0) count++;
    }
    if (count == 0) cout << 1 << " " << color[8] << endl;
    else cout << count << " " << color[8] + count << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = [8 for _ in range(n)]
free = 0
for i in range(n):
    if a[i] > 3199:
        free += 1
    else:
        b[i] = a[i] // 400
if 8 in set(b):
    under = len(set(b)) - 1
else:
    under = len(set(b))
if under != 0:
    m = under
else:
    m = 1
M = under + free
print(m, M)


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

int main()
{
	ll H, W;
	cin >> H >> W;
	ll res = H * W;
	for (ll i = 1; i < H; i++) {
		res = min(res, W & 1 ? max(abs(W * (H - i) - (W / 2 * i + i)), max(abs(W * (H - i) - (W / 2 * i)), i)) : abs(W * (H - i) - (W / 2 * i)));
		res = min(res, i & 1 ? max(abs(W * (H - i) - (i / 2 * W + W)), max(abs(W * (H - i) - (i / 2 * W)), W)) : abs(W * (H - i) - (i / 2 * W)));
	}
	swap(H, W);
	for (ll i = 1; i < H; i++) {
		res = min(res, W & 1 ? max(abs(W * (H - i) - (W / 2 * i + i)), max(abs(W * (H - i) - (W / 2 * i)), i)) : abs(W * (H - i) - (W / 2 * i)));
		res = min(res, i & 1 ? max(abs(W * (H - i) - (i / 2 * W + W)), max(abs(W * (H - i) - (i / 2 * W)), W)) : abs(W * (H - i) - (i / 2 * W)));
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int N, Y; cin >> N >> Y;
    int x = -1;
    int y = -1;
    int z = -1;
    bool f = false;

    for (int i = 0; i <= N; ++i) {
        for (int j = 0; j <= N; ++j) {
            int tmp = N - i - j;
            if (tmp < 0) break;
            int a, b, c;

            a = i * 10000;
            b = j * 5000;
            c = tmp * 1000;
            if (a + b + c == Y) {
                x = i;
                y = j;
                z = tmp;
                f = true;
                break;
            }
        }
        if (f) break;
    }

    cout << x << " " << y << " " << z << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std; 
    using ll = long long;
    vector<vector<int>> memo (3e3+5, vector<int> (3e3+5, -1));
     
     
    int dp(string &s, string &t, int i, int j){
    	if(j < 0 || i < 0)
    		return 0;
    	if(memo[i][j] != -1)
    		return memo[i][j];
    	if(s[i] == t[j]){
    		return memo[i][j] = dp(s, t, i-1, j-1)+1;
    	}else {
    		return memo[i][j] = max(dp(s, t, i-1, j), dp(s, t, i, j-1));
    	}
     
    }
     
    signed main() { 
    	cin.tie(0);
    	cin.sync_with_stdio();
    	string s, t;
    	cin>>s>>t;
    	dp(s, t, s.size()-1, t.size()-1);
    	string sol;
    	int i = s.size()-1;
    	int j = t.size()-1;
    	while(i >= 0 && j >= 0){
    		if(s[i] == t[j]){
    			sol = s[i]+sol;
    			i--;
    			j--;
    		}else{
    			if(i == 0){
    				j--;
    				
    			}else if(j == 0){
    				i--;
    			}else if(memo[i][j-1] > memo[i-1][j]){
    				j--;
    			}else{
    				i--;
    			}
    		}
    	}
    	if(j == 0 && i == 0 && s[0] == t[0])
    		sol = s[0]+sol;
    	cout<<sol;
    }

Measured memory_bytes: 36096
K, S = map(int, input().split())

cnt = 0

if S <= 0:
  cnt += 1
else:

  if K >= S:
      cnt+=3

  def cnt2(k, s):
      if 2 * k >= s:
          if s - 1 <= k:
              return s-1
          else:
              return k-(s-k)+1
      else:
          return 0

  cnt+=3*cnt2(K, S)

  for x in range(1, K+1):
      if S-x <=0:
          break
      cnt += cnt2(K, S-x)

print(cnt)

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

template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct frep {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr frep(int l_, int r_): l(std::min(l_, r_)), r(r_) {}
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct brep {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr r, l;
  constexpr brep(int l_, int r_): r(std::max(l_, r_) - 1), l(l_ - 1) {}
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

template <class T>
inline T scan() {
  T res;
  std::cin >> res;
  return res;
}

using lint = long long;

int main() {
  int N, D, A;
  std::cin >> N >> D >> A;
  std::vector<std::pair<int, int>> vec(N);
  for (auto& p: vec) {
    std::cin >> p.first >> p.second;
  }
  std::sort(vec.begin(), vec.end());
  std::vector<lint> X(N), H(N);
  for (int i: frep(0, N)) {
    X[i] = vec[i].first;
    H[i] = vec[i].second;
  }
  std::vector<lint> sum(N + 1);
  lint ans = 0;
  for (int i: frep(0, N)) {
    if (i > 0) {
      sum[i] += sum[i - 1];
    }
    lint now = H[i] - sum[i] * A;
    if (now <= 0) {
      continue;
    }
    lint need = (now + A - 1) / A;
    sum[i] += need;
    sum[std::upper_bound(X.begin(), X.end(), X[i] + 2 * D) - X.begin()] -= need;
    ans += need;
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 6528
import java.util.*;
public class Main{

    void run(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while(n-- > 0){
            String exp = sc.next();
            Parser parser = new Parser(exp);
            System.out.println(parser.expression());
        }
    }
    public static void main(String[] args){
        new Main().run();
    }
}

class Parser{
    char[] exp;
    int begin;
    Parser(String str){
        this.exp = (str+"#").toCharArray();
    }
    //四則演算の式をパースして、その評価結果を返す
    int expression(){
        int ret = term();
        
        while(true){
            if(exp[begin] == '+'){
                begin++;
                ret += term();
            }
            else if(exp[begin] == '-'){
                begin++;
                ret -= term();
            }
            else{
                break;
            }
        }
        return ret;
    }
    //乗算除算の式をパースして、その評価結果を返す
    int term(){
        int ret = factor();
        while(true){
            if(exp[begin] == '*'){
                begin++;
                ret *= factor();
            }
            else if(exp[begin] == '/'){
                begin++;
                ret /= factor();
            }
            else{
                break;
            }
        }
        return ret;
    }
    //数字の列をパースして、その数を返す
    int number(){
        int ret = 0;
        while(Character.isDigit(exp[begin])){
            ret *= 10;
            ret += exp[begin] - '0';
            begin++;
        }
        return ret;
    }
    //括弧か数かをパースして、その評価結果を返す
    int factor(){
        if(exp[begin] == '('){
            begin++;//'('を飛ばす
            int ret = expression();
            begin++;//')'を飛ばす
            return ret;
        }
        else{
            return number();
        }
    }
}
//https://gist.github.com/draftcode/1357281

Measured memory_bytes: 17328
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

"""
2X = ak * (2p+1)
基本的には最小公倍数/2を基本とし，これの奇数倍か．

X  = (ak//2) * (2p+1)
と書ける．第二項が奇数なので，各akが2で割り切れれう回数が同じでなければならない
a=[2,4]だと無理
"""
def main():
    from math import gcd
    N,M=MI()
    A=LI()
    
    def count(X):
        cnt=0
        while X%2==0:
            cnt+=1
            X=X//2
        return cnt
    
    C=count(A[0])
    for i in range(1,N):
        if count(A[i])!=C:
            print(0)
            exit()
            
    lca=1
    for i in range(N):
        g=gcd(lca,A[i])
        lca=(lca*A[i])//g
        
    lca2=lca//2
    ans=M//lca2 - M//lca
    
    print(ans)
    
            
    

main()


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

using namespace std;

string A,B;

int main()
{
    int i;
    char a,b;
    cin>>a>>b;
    for(i=1;i<=b-'0';i++)
        A+=a;
    for(i=1;i<=a-'0';i++)
        B+=b;
    cout<<min(A,B)<<"\n";
    return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};


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

string s;
ll cnt[26];

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

	cin>>s;
	REP(i,s.size()) cnt[s[i]-'a']++;
	ll ans=0;
	REP(i,26) {
		ans+=(cnt[i]*(cnt[i]-1))/2;
	}
	ll sz=s.size();
	ll sum=sz*(sz-1)/2;
	cout<<sum-ans+1<<endl;

	return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int a,b,c,total;



int main()
{
	cin >> a >> b >> c ;
	if (a == b && a == c)
	{
		total = 1;
	}
	else if (a == b || a == c || b == c)
	{
		total = 2;
	}
	else
	{
		total = 3;
	}
	

	cout << total << endl;


	

	
	//system("pause");

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>

using namespace std;

int main(){
char a[3];
  char b[3];
  char c[3];

  cin>>a;
  cin>>b;
  cin>>c;
  
  cout<<a[0]<<b[1]<<c[2]<<endl;
  
  return 0;
  
}


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

int n;
int t[16][17];
int dp[1 << 16];

int dfs(int used) {
	if (used == (1 << n) - 1) { return 0; }
	if (dp[used] != -1) { return dp[used]; }
	
	int ret = 1145141919;
	for (int i = 0; i < n; i++) {
		if ((used >> i) % 2) continue;
		
		int cst = 114514;
		for (int j = 0; j <= n; j++) {
			if (j == 0 || (used >> (j - 1)) % 2) {
				cst = min(cst, t[i][j]);
			}
		}
		
		ret = min(ret, cst + dfs(used + (1 << i)));
	}
	return dp[used] = ret;
}

int main() {
	while (cin >> n) {
		if (!n) break;
		for (int i = 0; i < n; i++) for (int j = 0; j <= n; j++) cin >> t[i][j];
		for (int i = 0; i < (1 << n); i++) dp[i] = -1;
		cout << dfs(0) << endl;
	}
	return 0;
}

Measured memory_bytes: 3320
n,m=map(int,input().split())
a=[int(input()) for _ in range(n)]
baton=0 #initial index of baton
for k in range(1,m+1):
    for i in range(n):
        if i==n-1:
            continue
        elif a[i]%k>a[i+1]%k:
            v=a[i+1]
            a[i+1]=a[i]
            a[i]=v
for i in a:
    print(i)


Measured memory_bytes: 5616
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String a = scanner.next();
        String b = scanner.next();
        String c = scanner.next();

        char al = a.charAt(a.length()-1); //文字列aの最後の文字
        char bf = b.charAt(0);            //文字列bの最初の文字
        char bl = b.charAt(b.length()-1); //文字列bの最後の文字
        char cf = c.charAt(0);            //文字列cの最初の文字

        if(al == bf && bl == cf) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 23764
def examA():
    S = SI()
    T = SI()
    N = len(S)
    ans = "No"
    for i in range(N):
        cur = S[i:] + S[:i]
        #print(cur)
        if cur==T:
            ans = "Yes"
    print(ans)
    return

def examB():
    H, W = LI()
    S = [SI()for _ in range(H)]
    flag = True
    ans = 0
    print(ans)
    return

def examC():
    L, R = LI()
    ans = inf
    if R-L>=3000:
        R = L+3000

    for l in range(L, R + 1):
        for r in range(l+1, R + 1):
            now = (l*r) %2019
            ans = min(ans,now)
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 3956
# https://atcoder.jp/contests/abc131/tasks/abc131_c

a, b, c, d = map(int, input().split())
a -= 1

def gcd(x, y): #GCD
    # greatest_common_divisor
    if x < y:
        x, y = y, x
    if y == 0:
        return 0
    if x % y == 0:
        return y
    return gcd(y, x % y)

def lcm(x, y): #LCM
    # lowest_common_multiple
    return x * y // gcd(x, y)

s = b // c - a // c
t = b // d - a // d
LCM = lcm(c, d)
both = b // LCM - a // LCM
ans = (b - a) - s - t + both
print(ans)

Measured memory_bytes: 38384
#include <cstdio>

int main() {
    int y, m, d;
    scanf("%d/%d/%d", &y, &m, &d);
    printf("%s\n", y < 2019 || (y == 2019 && (m < 4 || (m == 4 && d <= 30))) ? "Heisei" : "TBD");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(a) int((a).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

#define _deb(x) cout<<x;
void _print() {cerr << "]\n";} template <typename T, typename... V>void _print(T t, V... v) {_deb(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
template <class T, class U> void print_m(const map<T,U> &m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}
template<class T, class U>void debp(const pair<T, U> &pr, bool end_line=1){cout<<"{"<<pr.first<<" "<<pr.second<<"}"; cout<<(end_line ? "\n" : ", ");}
template <class T> void print_vp(const T &vp, int sep_line=0){if(vp.empty()){cout<<"Empty"<<endl; return;}if(!sep_line) cout<<"{ ";for(auto x: vp) debp(x,sep_line);if(!sep_line) cout<<"}\n";cout<<endl;}
template <typename T>void print(const T &v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<sz(v); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<endl;}
template <typename T>void print_vv(const T &vv){if(sz(vv)==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<sz(*vv.begin()); j++)cout<<setw(w)<<j<<" ";cout<<endl;int i = 0;for(auto &v: vv){cout<<i++<<" {";for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<"},\n";}cout<<endl;}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    while(cin>>n){
        vl a(n); forn(i,n) cin>>a[i];
        ll sum = 0, out = 0;
        for(int i=n-1; i>=0; --i){
            add_self(out, a[i]*sum%mod);
            add_self(sum, a[i]);
        }
        out%=mod;
        cout<<out<<"\n";
    }
    return 0;
}

Measured memory_bytes: 4792
N = gets.to_i
A = gets.chomp.split(" ").map(&:to_i)

c_o = A.count{|a| a.odd?}
c_4 = A.count{|a| a % 4 == 0}
c_2 = N - c_o - c_4

if c_o <= c_4 then
  puts 'Yes'
elsif c_o - 1 == c_4 && c_2 == 0 then
  puts 'Yes'
else
  puts 'No'
end


Measured memory_bytes: 9476
#include<bits/stdc++.h>
#define maxl 510
using namespace std;

int n,m,ans,k;
int a[maxl][maxl];
char s[maxl][maxl];
vector<int> v[maxl];

inline void prework()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s[i]+1);
		for(int j=1;j<=m;j++)
		if(s[i][j]=='#')
			v[i].push_back(j);
	}
}

inline void pt(int l,int r,int u,int d,int id)
{
	for(int i=u;i<=d;i++)
		for(int j=l;j<=r;j++)
			a[i][j]=id;
}

inline void mainwork()
{
	int u=0,cnt=0;
	for(int i=1;i<=n;i++)
	if(v[i].size()>0)
	{
		int l=0,len=v[i].size();
		for(int j=0;j<len-1;j++)
		{
			pt(l+1,v[i][j],u+1,i,++cnt);
			l=v[i][j];
		}
		pt(l+1,m,u+1,i,++cnt);
		u=i;
	} 
	for(int i=u+1;i<=n;i++)
		for(int j=1;j<=m;j++)
			a[i][j]=a[i-1][j];
}

inline void print()
{
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			printf("%d%c",a[i][j],(j==m)?'\n':' ');
	}
}

int main()
{
	int t=1;
	//scanf("%d",&t);
	for(int i=1;i<=t;i++)
	{
		prework();
		mainwork();
		print();
	}
	return 0;
}

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

int main(){
	int a,b,k;
	cin >> a >> b >> k;
	for(int i = a;i<=b;i++){
		if(i <= a+k-1 || i >= b-k+1){
			cout << i << endl;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {
int N, M; 
cin >> N >> M; 
int K = M / N; 
int ans = 1; 
for(int i = K; i >= 1; i--){
if(M % i == 0){
ans = i; 
break; 
}
}
cout << ans << endl; 
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
	string s;
	cin >> s;
	int x = 0;
	int y = 0;
	int z = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'a')
			x += 1;
		else if (s[i] == 'b')
			y += 1;
		else
			z += 1;
	}
	if (x == 1 && y == 1 && z == 1)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
}

Measured memory_bytes: 3592
#include<cstdio>
#include<cstdlib>

int a[100010][2];
int n,a1=0,a2=100010;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		a[x][i&1]++;
		if(x>a1) a1=x;
		if(x<a2) a2=x;
	}
	int max1=0,max2=0,c1,c2;
	for(int i=a2;i<=a1;i++)
	{
		if(max1<a[i][1]) max1=a[i][1],c1=i;
		if(max2<a[i][0]) max2=a[i][0],c2=i;
	}
	int ans;
	if(c1==c2)
	{
		int k=0;
		for(int i=a2;i<=a1;i++) 
			if(i!=c1)
			{
				if(k<a[i][1]) k=a[i][1];
				if(k<a[i][0]) k=a[i][0];
			}
		if(max1>max2) max2=k;
		else max1=k;
	}
	ans=n-max1-max2;
	printf("%d",ans);
}

Measured memory_bytes: 896
W,H,x,y = map(int,input().split())

# 直線が長方形の対角線の交点Zを通るとき、長方形の面積は二等分される
# そのような直線が複数あるのは、Zと(x,y)が一致するときだけ

if x == W/2 and y == H/2:
    multi_flag = 1
else:
    multi_flag = 0
    
print(W*H/2, multi_flag)

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

int main(void)
{
	int N, M;
	int L, R;
	cin >> N >> M;
	L = 0; R = N;
	for (int i = 0; i < M; i++) {
		int tmp_l, tmp_r;
		cin >> tmp_l >> tmp_r;
		L = (L < tmp_l) ? tmp_l : L;
		R = (R > tmp_r) ? tmp_r : R;
	}

	int ans = (R >= L) ? (R - L + 1) : 0;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
a=[int(input()) for i in range(5)]
result=0
ans=0
x=10
for i in a:
    if i%10!=0:
        result+=(i//10+1)*10
    else:
        result+=i
for i in a:
    if i%10!=0:
        ans=i%10
        if ans<x:
            x=ans
print(result+x-10)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> Pi; typedef map<int,int> MPi; typedef pair<Int,Int> Pl;
const int mod = 1000000007;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) v.begin(),v.end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    Int n; cin>>n;  gPr(Int) a; Pr(Int) b; Int f[n+1],g[n+1],c[n+1]; f[0]=g[n]=0;
    for (int i = 1; i <= 3*n; i++){
        Int x; cin>>x;
        if(i<=n){a.push(x); f[0]+=x;}
        if(2*n<i){b.push(x); g[n]+=x;}
        if(n<i&&i<=2*n)c[i-n-1]=x;
    }
    for (int i = 0; i < n; i++){
        int p=a.top(),q=b.top();
        if(p<c[i]){f[i+1]=f[i]+c[i]-p; a.pop(); a.push(c[i]);}
        else f[i+1]=f[i];
        if(q>c[n-i-1]){g[n-i-1]=g[n-i]+c[n-i-1]-q; b.pop(); b.push(c[n-i-1]);}
        else g[n-i-1]=g[n-i];
    }
    Int ans=f[0]-g[0];
    for (int i = 1; i <= n; i++)cmax(ans,f[i]-g[i]);
    END
}

Measured memory_bytes: 4340
#include<stdio.h>

int main(){
  int x=-1, y=-1;
  while (1) {
    scanf("%d %d", &x, &y);
    if (x == 0 && y == 0) {
      break;
    } else if (x > y) {
      printf("%d %d\n", y, x);
    } else {
      printf("%d %d\n", x, y);
    }
  }
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
const int MOD = 1e9 + 7;

ll dp[100001][13];

signed main(){
    string S;
    cin >> S;
    dp[0][0] = 1;
    REP(i,S.size()){
        if(S[i] == '?'){
            REP(j,10){
                REP(k,13){
                    dp[i + 1][(k * 10 + j) % 13] += dp[i][k];
                    dp[i + 1][(k * 10 + j) % 13] %= MOD;
                }
            }
        }else{
            int c = S[i] - '0';
            REP(k,13){
                dp[i + 1][(k * 10 + c) % 13] = dp[i][k];
            }
        }
    }
    cout << dp[S.size()][5] << endl;
}


Measured memory_bytes: 10624
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

void dfs(vector<vector<int>>& g, unordered_set<int>& visited, int v)
{
    visited.insert(v);
    for(auto& next_v:g[v])
    {
        if(visited.count(next_v) > 0) continue;
        dfs(g, visited, next_v);
    }
}

int main()
{    
    int a,b;
    cin >> a >> b;
    int cnt = a;
    if(b < a) cnt--;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        int a,b;
        String str = "";
        char op;
        boolean loop=true;
        Scanner sc = new Scanner(System.in);
        while(loop) {
            a = sc.nextInt();
            op = sc.next().charAt(0);
            b = sc.nextInt();
            switch (op) {
                case '+':
                    str += Integer.toString(a+b) + "\n";
                    break;
                case '-':
                    str += Integer.toString(a-b) + "\n";
                    break;
                case '*':
                    str += Integer.toString(a*b) + "\n";
                    break;
                case '/':
                    str += Integer.toString(a/b) + "\n";
                    break;
                case '?':
                    loop = false;
                    break;
            }
        }
        System.out.print(str);
    }
}

Measured memory_bytes: 26296
gets
d = [gets, gets].map{|v| v.split(" ").map(&:to_f)}.transpose.map{|c| c.inject(:-).abs}
(1..4).each do |i|
  puts ((i == 4) ? d.max : d.map{|c| c**(i)}.inject(:+)**(1.0/i)).round(6)
end

Measured memory_bytes: 8768
s = list(input())
N = s[0]+s[1]
M = s[2]+s[3]
YM = ["01","02","03","04","05","06","07"
,"08","09","10","11","12"]
Y = ["00"]
for i in range(13,100):
	Y.append(str(i))
if N in Y and M in YM:
	print("YYMM")
elif N in YM and M in Y:
	print("MMYY")
elif N in YM and M in YM:
	print("AMBIGUOUS")
else:
	print("NA")

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

int main()
{
	int h, w;
	while( cin >> h >> w && !( h == 0 && w == 0 ) ){
		if( h == 0 || w == 0 ){
			cout << 0 << endl;
			continue;
		}

		int ww = w + 1;
		int hh = h + 1;

		int* map = new int[ hh * ww ]();
		char* input = new char[ ww ]();

		for( int i = 0; i < h; ++i ){
			cin >> input;
			int* ptrMap = &map[ ( i + 1 ) * ww - 2 ];
			char* ptrInput = &input[ ww - 2 ];
			for( int j = 0; j < w; ++j, --ptrMap, --ptrInput ){
				if( *ptrInput == '.' ){
					*ptrMap = *( ptrMap + 1 ) + 1;
				}
			}
		}

		int maxArea = 0;
		for( int i = 0; i < h; ++i ){
			for( int j = 0; j < w; ++j ){
				int col = w;
				for( int row = 1; map[ ( i + row - 1 ) * ww + j ] != 0; ++row ){
					col = min( col, map[ ( i + row - 1 ) * ww + j ] );
					maxArea = max( maxArea, col * row );
				}
			}
		}

		cout << maxArea << endl;

		delete[] input;
		delete[] map;
	}

	return 0;
}

Measured memory_bytes: 2180
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  if (S.at(0) == 'A'){
  cout << "T";
  }else if (S.at(0) == 'T'){
  cout << "A";
  }else if (S.at(0) == 'G'){
  cout << "C";
  }else if (S.at(0) == 'C'){
  cout << "G";
  }
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split()))
a.sort()
now = 0
num = 0
ans = 0
for i in range(N):
    if now != a[i]:
        if num < now:
            ans += num
        else:
            ans += num - now
        now = a[i]
        num = 1
    else:
        num += 1
if num < now:
    ans += num
else:
    ans += num-now
print(ans)


Measured memory_bytes: 14692